@stackedapp/types 1.5.10 → 1.6.0

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.
@@ -557,6 +557,10 @@ type Restriction = {
557
557
  eventCount: number;
558
558
  message?: string;
559
559
  };
560
+ type IUserCryptoWallet = {
561
+ address: string;
562
+ createdAt?: number;
563
+ };
560
564
  interface IUser {
561
565
  _id: Stringable;
562
566
  deleted?: boolean;
@@ -571,10 +575,7 @@ interface IUser {
571
575
  /** last push generic notification to come back into the app */
572
576
  lastPushedGeneric?: number;
573
577
  };
574
- cryptoWallets?: Array<{
575
- address: string;
576
- createdAt: number;
577
- }>;
578
+ cryptoWallets?: Array<IUserCryptoWallet>;
578
579
  rewardWallets?: Array<{
579
580
  address: string;
580
581
  createdAt: number;
@@ -726,7 +727,7 @@ type Nullable<T> = {
726
727
  /** this is the Stacked platforms' copy of a user/entity's snapshot for the current app/game */
727
728
  type StackedSnapshot = Nullable<Pick<IPlayerSnapshot, '_id' | 'gameId' | 'playerId' | 'unifiedUserLinkedAt' | 'unifiedUserUnlinkedAt' | 'referredById' | 'username' | 'snapshotLastUpdated' | 'offersLastChecked' | 'daysInGame' | 'loginStreak' | 'daysInGameLastUpdated' | 'dateSignedUp' | 'dynamic' | 'stakedTokens' | 'currencies' | 'levels' | 'quests' | 'trustScore' | 'trustLastUpdated' | 'achievements' | 'memberships' | 'cryptoWallets' | 'identifiers' | 'entityKind' | 'entityLinks'>>;
728
729
  /** represents a stacked snapshot's data within a specific app/game. This is scoped to the app/game! */
729
- type StackedSnapshotData = Pick<IPlayerData, 'gameId' | 'playerId' | 'currencies'>;
730
+ type StackedEntityData = Pick<IPlayerData, 'gameId' | 'playerId' | 'currencies'>;
730
731
 
731
732
  type StackedCompletionConditions = ICompletionCondition;
732
733
  /** Stripped sibling offer data for client rendering */
@@ -766,30 +767,35 @@ interface StackedReward extends IReward {
766
767
  }
767
768
 
768
769
  /** represents a stacked consumer from the web/mobile app */
769
- type StackedBaseUser = Pick<IUser, 'appConnections' | 'providers'>;
770
+ type StackedBaseUser = Pick<IUser, '_id' | 'appConnections' | 'providers'>;
770
771
  /** extra data populated into a stacked web/mobile app user */
771
772
  interface StackedBaseUserExtra {
772
- cryptoWallets?: Array<{
773
- address: string;
773
+ cryptoWallets?: Array<IUserCryptoWallet & {
774
774
  balances: Record<string, number>;
775
775
  }>;
776
776
  }
777
- type StackedUser = StackedBaseUser & StackedBaseUserExtra & {
778
- apps: {
779
- [appId: string]: StackedSnapshotData;
780
- };
777
+ type StackedUser = StackedBaseUser & StackedBaseUserExtra;
778
+ /** This user's app connection data which is a snapshot of their profile in your app, plus the stacked platform's data (like stacked points, etc) */
779
+ type StackedAppConnection = {
780
+ snapshot: StackedSnapshot;
781
+ stackedData: StackedEntityData;
781
782
  };
782
- /** @deprecated - old way of getting a specific game player's currencies in stacked */
783
- type IClientPlayerData = StackedSnapshotData;
783
+ /** Returned alongside offers when fetching a specific user/player's offers */
784
784
  type StackedUserResponse = {
785
- /** @deprecated use stacked instead */
785
+ /** @deprecated use stackedData instead */
786
786
  data?: IClientPlayerData | null;
787
- /** this is the current user's snapshot within this app/game */
788
- snapshot: StackedSnapshot;
789
- /** this current user's stacked web/mobile app profile */
787
+ user?: StackedUser;
788
+ } & StackedAppConnection;
789
+ /** @deprecated - old way of getting a specific game player's currencies in stacked */
790
+ type IClientPlayerData = StackedEntityData;
791
+ /** Stacked mobile web app's initialize user response */
792
+ interface StackedUserWithAppConnections {
790
793
  user: StackedUser;
791
- };
794
+ apps: {
795
+ [appId: string]: StackedAppConnection;
796
+ };
797
+ }
792
798
 
793
799
  type StackedEnv = IEnv;
794
800
 
795
- export type { IClientPlayerData, StackedBaseOffer, StackedBaseUser, StackedBaseUserExtra, StackedCompletionConditions, StackedEnv, StackedOffer, StackedReward, StackedRewardKind, StackedSnapshot, StackedSnapshotData, StackedSnapshotProgress, StackedUser, StackedUserOffer, StackedUserResponse, UserOfferStatus };
801
+ export type { IClientPlayerData, StackedAppConnection, StackedBaseOffer, StackedBaseUser, StackedBaseUserExtra, StackedCompletionConditions, StackedEntityData, StackedEnv, StackedOffer, StackedReward, StackedRewardKind, StackedSnapshot, StackedSnapshotProgress, StackedUser, StackedUserOffer, StackedUserResponse, StackedUserWithAppConnections, UserOfferStatus };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackedapp/types",
3
- "version": "1.5.10",
3
+ "version": "1.6.0",
4
4
  "description": "Public types for Stacked platform SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/stacked-types.d.ts",