@campnetwork/origin 1.3.1 → 1.3.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
@@ -70,6 +70,7 @@ The Auth class is the entry point for authenticating users with the Origin SDK.
70
70
  - `spotify` - The URI to redirect to after the user completes oauth for Spotify.
71
71
  - `environment` - `string` - The environment to use. Can be either `DEVELOPMENT` or `PRODUCTION`. Defaults to `DEVELOPMENT`.
72
72
  - `baseParentId` - `bigint` - A valid tokenID to be used as the parent of all IPNFTs minted on your platform, making them all derivatives of your base asset.
73
+ - `appId` - `string` - The app ID of your app. This is used to identify your app in the AppRegistry smart contract and to apply any app fees or revenue sharing that you have set up.
73
74
 
74
75
  You may use the `redirectUri` object to redirect the user to different pages based on the social they are linking.
75
76
  You may only define the URIs for the socials you are using, the rest will default to `window.location.href`.
@@ -80,6 +81,7 @@ import { Auth } from "@campnetwork/origin";
80
81
  const auth = new Auth({
81
82
  clientId: string,
82
83
  redirectUri: string | object,
84
+ appId?: string,
83
85
  });
84
86
  ```
85
87
 
@@ -542,6 +544,7 @@ It can also take the following optional props:
542
544
  - `environment` - `string` - The environment to use. Can be either `DEVELOPMENT` or `PRODUCTION`. Defaults to `DEVELOPMENT`.
543
545
  - - the `DEVELOPMENT` environment uses the Camp Testnet while the `PRODUCTION` environment uses the Camp Mainnet.
544
546
  - `baseParentId` - `string | bigint` - A valid tokenID to be used as the parent of all IPNFTs minted on your platform, making them all derivatives of your base asset.
547
+ - `appId` - `string` - The app ID of your app. This is used to identify your app in the AppRegistry smart contract and to apply any app fees or revenue sharing that you have set up.
545
548
 
546
549
  ```jsx
547
550
  import { CampProvider } from "@campnetwork/origin/react";
@@ -552,6 +555,7 @@ function App() {
552
555
  clientId="your-client-id"
553
556
  redirectUri="https://your-website.com"
554
557
  environment="DEVELOPMENT"
558
+ appId="your-app-id"
555
559
  >
556
560
  <div>Your app</div>
557
561
  </CampProvider>
package/dist/core.cjs CHANGED
@@ -1072,7 +1072,11 @@ class{
1072
1072
  * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
1073
1073
  * @throws {APIError} - Throws an error if the clientId is not provided.
1074
1074
  */
1075
- constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:o}){if(nt.add(this),it.set(this,void 0),at.set(this,void 0),st.set(this,void 0),rt.set(this,void 0),!e)throw new T("clientId is required");if(!t)throw new T("appId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new T(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);r(this,at,"undefined"==typeof window,"f"),r(this,rt,o||(s(this,at,"f")?new y:new l),"f"),this.viem=null,this.environment=U[i],this.baseParentId=a,this.redirectUri=(e=>{const t=["twitter","spotify"];return"object"==typeof e?t.reduce(((t,n)=>(t[n]=e[n]||("undefined"!=typeof window?window.location.href:""),t)),{}):"string"==typeof e?t.reduce(((t,n)=>(t[n]=e,t)),{}):e?{}:t.reduce(((e,t)=>(e[t]="undefined"!=typeof window?window.location.href:"",e)),{})})(n),this.clientId=e,this.appId=t,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,r(this,it,{},"f"),
1075
+ constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:o}){if(nt.add(this),it.set(this,void 0),at.set(this,void 0),st.set(this,void 0),rt.set(this,void 0),!e)throw new T("clientId is required");
1076
+ // if (!appId) {
1077
+ // throw new ValidationError("appId is required");
1078
+ // }
1079
+ if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new T(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);r(this,at,"undefined"==typeof window,"f"),r(this,rt,o||(s(this,at,"f")?new y:new l),"f"),this.viem=null,this.environment=U[i],this.baseParentId=a,this.redirectUri=(e=>{const t=["twitter","spotify"];return"object"==typeof e?t.reduce(((t,n)=>(t[n]=e[n]||("undefined"!=typeof window?window.location.href:""),t)),{}):"string"==typeof e?t.reduce(((t,n)=>(t[n]=e,t)),{}):e?{}:t.reduce(((e,t)=>(e[t]="undefined"!=typeof window?window.location.href:"",e)),{})})(n),this.clientId=e,this.appId=t,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,r(this,it,{},"f"),
1076
1080
  // only subscribe to providers in browser environment
1077
1081
  s(this,at,"f")||j((e=>{s(this,nt,"m",ot).call(this,"providers",e)})),s(this,nt,"m",dt).call(this)}
1078
1082
  /**
package/dist/core.d.ts CHANGED
@@ -1361,7 +1361,7 @@ declare class Auth {
1361
1361
  #private;
1362
1362
  redirectUri: Record<string, string>;
1363
1363
  clientId: string;
1364
- appId: string;
1364
+ appId?: string;
1365
1365
  isAuthenticated: boolean;
1366
1366
  jwt: string | null;
1367
1367
  walletAddress: string | null;
@@ -1381,7 +1381,7 @@ declare class Auth {
1381
1381
  */
1382
1382
  constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
1383
1383
  clientId: string;
1384
- appId: string;
1384
+ appId?: string;
1385
1385
  redirectUri: string | Record<string, string>;
1386
1386
  environment?: "DEVELOPMENT" | "PRODUCTION";
1387
1387
  baseParentId?: bigint;
@@ -1361,7 +1361,7 @@ declare class Auth {
1361
1361
  #private;
1362
1362
  redirectUri: Record<string, string>;
1363
1363
  clientId: string;
1364
- appId: string;
1364
+ appId?: string;
1365
1365
  isAuthenticated: boolean;
1366
1366
  jwt: string | null;
1367
1367
  walletAddress: string | null;
@@ -1381,7 +1381,7 @@ declare class Auth {
1381
1381
  */
1382
1382
  constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
1383
1383
  clientId: string;
1384
- appId: string;
1384
+ appId?: string;
1385
1385
  redirectUri: string | Record<string, string>;
1386
1386
  environment?: "DEVELOPMENT" | "PRODUCTION";
1387
1387
  baseParentId?: bigint;
package/dist/core.esm.js CHANGED
@@ -1062,7 +1062,11 @@ class Pt{
1062
1062
  * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
1063
1063
  * @throws {APIError} - Throws an error if the clientId is not provided.
1064
1064
  */
1065
- constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:s}){if(ht.add(this),Tt.set(this,void 0),ft.set(this,void 0),vt.set(this,void 0),wt.set(this,void 0),!e)throw new P("clientId is required");if(!t)throw new P("appId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new P(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);T(this,ft,"undefined"==typeof window,"f"),T(this,wt,s||(h(this,ft,"f")?new g:new I),"f"),this.viem=null,this.environment=Z[i],this.baseParentId=a,this.redirectUri=(e=>{const t=["twitter","spotify"];return"object"==typeof e?t.reduce(((t,n)=>(t[n]=e[n]||("undefined"!=typeof window?window.location.href:""),t)),{}):"string"==typeof e?t.reduce(((t,n)=>(t[n]=e,t)),{}):e?{}:t.reduce(((e,t)=>(e[t]="undefined"!=typeof window?window.location.href:"",e)),{})})(n),this.clientId=e,this.appId=t,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,T(this,Tt,{},"f"),
1065
+ constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:s}){if(ht.add(this),Tt.set(this,void 0),ft.set(this,void 0),vt.set(this,void 0),wt.set(this,void 0),!e)throw new P("clientId is required");
1066
+ // if (!appId) {
1067
+ // throw new ValidationError("appId is required");
1068
+ // }
1069
+ if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new P(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);T(this,ft,"undefined"==typeof window,"f"),T(this,wt,s||(h(this,ft,"f")?new g:new I),"f"),this.viem=null,this.environment=Z[i],this.baseParentId=a,this.redirectUri=(e=>{const t=["twitter","spotify"];return"object"==typeof e?t.reduce(((t,n)=>(t[n]=e[n]||("undefined"!=typeof window?window.location.href:""),t)),{}):"string"==typeof e?t.reduce(((t,n)=>(t[n]=e,t)),{}):e?{}:t.reduce(((e,t)=>(e[t]="undefined"!=typeof window?window.location.href:"",e)),{})})(n),this.clientId=e,this.appId=t,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,T(this,Tt,{},"f"),
1066
1070
  // only subscribe to providers in browser environment
1067
1071
  h(this,ft,"f")||Q((e=>{h(this,ht,"m",At).call(this,"providers",e)})),h(this,ht,"m",It).call(this)}
1068
1072
  /**
@@ -1199,7 +1199,7 @@ declare class Auth {
1199
1199
  #private;
1200
1200
  redirectUri: Record<string, string>;
1201
1201
  clientId: string;
1202
- appId: string;
1202
+ appId?: string;
1203
1203
  isAuthenticated: boolean;
1204
1204
  jwt: string | null;
1205
1205
  walletAddress: string | null;
@@ -1219,7 +1219,7 @@ declare class Auth {
1219
1219
  */
1220
1220
  constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
1221
1221
  clientId: string;
1222
- appId: string;
1222
+ appId?: string;
1223
1223
  redirectUri: string | Record<string, string>;
1224
1224
  environment?: "DEVELOPMENT" | "PRODUCTION";
1225
1225
  baseParentId?: bigint;
@@ -1429,7 +1429,7 @@ declare const CampContext: React.Context<CampContextType>;
1429
1429
  */
1430
1430
  declare const CampProvider: ({ clientId, appId, redirectUri, children, environment, baseParentId, }: {
1431
1431
  clientId: string;
1432
- appId: string;
1432
+ appId?: string;
1433
1433
  redirectUri?: string;
1434
1434
  children: React.ReactNode;
1435
1435
  environment?: "DEVELOPMENT" | "PRODUCTION";
@@ -9486,9 +9486,9 @@ class Auth {
9486
9486
  if (!clientId) {
9487
9487
  throw new ValidationError("clientId is required");
9488
9488
  }
9489
- if (!appId) {
9490
- throw new ValidationError("appId is required");
9491
- }
9489
+ // if (!appId) {
9490
+ // throw new ValidationError("appId is required");
9491
+ // }
9492
9492
  if (["PRODUCTION", "DEVELOPMENT"].indexOf(environment) === -1) {
9493
9493
  throw new ValidationError(`Invalid environment "${environment}". Must be "DEVELOPMENT" or "PRODUCTION"`);
9494
9494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campnetwork/origin",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "main": "dist/core.cjs",
5
5
  "exports": {
6
6
  ".": {