@stackedapp/types 0.26.0 → 1.0.1

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/dist/index.js CHANGED
@@ -19,4 +19,5 @@ __exportStar(require("./stacked_offer"), exports);
19
19
  __exportStar(require("./stacked_reward"), exports);
20
20
  __exportStar(require("./stacked_snapshot"), exports);
21
21
  __exportStar(require("./stacked_user"), exports);
22
+ __exportStar(require("./stacked_response"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -99,6 +99,8 @@ interface IBaseCondition {
99
99
  min?: number;
100
100
  /** maximum number of links of this type allowed */
101
101
  max?: number;
102
+ /** Display template for this link condition */
103
+ template?: string;
102
104
  }>;
103
105
  /** dynamic field conditions */
104
106
  dynamic?: IDynamicGroup;
@@ -183,6 +185,8 @@ interface ICompletionCondition extends IBaseCondition {
183
185
  linkedCompletions?: {
184
186
  /** Number of linked entity completions required */
185
187
  min: number;
188
+ /** Display template for this condition */
189
+ template?: string;
186
190
  };
187
191
  /**
188
192
  * Dynamic field tracker - tracks changes to dynamic fields AFTER offer surfacing.
@@ -195,8 +199,8 @@ interface ICompletionCondition extends IBaseCondition {
195
199
  * Keyed by condition ID for multiple trackers.
196
200
  */
197
201
  contractInteractions?: Record<string, {
198
- /** Display name for this condition (e.g., "Spend PIXEL", "Earn NFT") */
199
- name: string;
202
+ /** Display template for this condition (e.g., "Spend PIXEL", "Earn NFT") */
203
+ template: string;
200
204
  /**
201
205
  * Event type to track:
202
206
  * - 'spend': Currency transferred OUT (onchain_currency_tx kind=spend)
@@ -384,6 +388,8 @@ interface IOffer {
384
388
  /** for grouping offers together if they are assocaited with each othert for easy rendering in front-end */
385
389
  groupId?: string;
386
390
  name: string;
391
+ /** Custom tab name for grouped offers - displays instead of name when set */
392
+ tabName?: string;
387
393
  /** how high of a priority is this offer in comparison to other offers? 1 is highest priority */
388
394
  priority?: number;
389
395
  description: string;
@@ -391,7 +397,7 @@ interface IOffer {
391
397
  /** notes about this offer */
392
398
  notes?: string;
393
399
  /** if this should be an offer that gets surfaced in real time */
394
- realTime?: string;
400
+ realTime?: boolean;
395
401
  /** if this offer is tied to other offers for a/b testing, this is the ID that ties
396
402
  * all of the offers together
397
403
  */
@@ -533,7 +539,7 @@ interface IPlayerOffer {
533
539
  onComplete?: Array<IOfferHookEvent>;
534
540
  }
535
541
 
536
- type CoinSyncStatusType = "pending" | "success" | "error" | "exclusive" | "synced" | null;
542
+ type CoinSyncStatusType = 'pending' | 'success' | 'error' | 'exclusive' | 'synced' | null;
537
543
  interface IBlockchainSyncStatus {
538
544
  ts: number | null;
539
545
  status: CoinSyncStatusType;
@@ -553,6 +559,10 @@ type Restriction = {
553
559
  eventCount: number;
554
560
  message?: string;
555
561
  };
562
+ type IUserCryptoWallet = {
563
+ address: string;
564
+ createdAt?: number;
565
+ };
556
566
  interface IUser {
557
567
  _id: Stringable;
558
568
  deleted?: boolean;
@@ -567,10 +577,7 @@ interface IUser {
567
577
  /** last push generic notification to come back into the app */
568
578
  lastPushedGeneric?: number;
569
579
  };
570
- cryptoWallets?: Array<{
571
- address: string;
572
- createdAt: number;
573
- }>;
580
+ cryptoWallets?: Array<IUserCryptoWallet>;
574
581
  rewardWallets?: Array<{
575
582
  address: string;
576
583
  createdAt: number;
@@ -716,12 +723,34 @@ interface IPlayerIpInfo {
716
723
  continentCode?: string;
717
724
  }
718
725
 
726
+ type Nullable<T> = {
727
+ [K in keyof T]?: T[K] | null;
728
+ };
719
729
  /** this is the Stacked platforms' copy of a user/entity's snapshot for the current app/game */
720
- type StackedSnapshot = Pick<IPlayerSnapshot, '_id' | 'gameId' | 'playerId' | 'unifiedUserLinkedAt' | 'unifiedUserUnlinkedAt' | 'referredById' | 'username' | 'snapshotLastUpdated' | 'offersLastChecked' | 'daysInGame' | 'loginStreak' | 'daysInGameLastUpdated' | 'dateSignedUp' | 'dynamic' | 'stakedTokens' | 'currencies' | 'levels' | 'quests' | 'trustScore' | 'trustLastUpdated' | 'achievements' | 'memberships' | 'entityKind' | 'entityLinks'>;
721
- /** represents a stacked snapshot's data within a specific app/game. This is scoped to the app/game! */
722
- type StackedSnapshotData = Pick<IPlayerData, 'gameId' | 'playerId' | 'currencies'>;
730
+ 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'>>;
731
+ /** Currencies for this entity that is populated with name and image information */
732
+ type StackedEntityCurrencies = Record<string, IPlayerDataCurrency & {
733
+ name: string;
734
+ image?: string;
735
+ }>;
736
+ /** represents a stacked entity's snapshot's data within a specific app/game. This is scoped to the app/game!
737
+ * Has information about stacked currencies of this entity earned through this specific app/game
738
+ */
739
+ type StackedEntityData = Pick<IPlayerData, 'gameId' | 'playerId'> & {
740
+ currencies?: StackedEntityCurrencies;
741
+ };
723
742
 
743
+ type StackedBaseConditions = IBaseCondition;
724
744
  type StackedCompletionConditions = ICompletionCondition;
745
+ type StackedDynamicCondition = IDynamicCondition;
746
+ type StackedCompletionDynamicTracker = ICompletionDynamicTracker;
747
+ type StackedCompletionTrackers = ICompletionTrackers;
748
+ type StackedOfferTrackers = IPlayerOfferTrackers;
749
+ type StackedSocialTrackerAccumulate = ISocialTrackerAccumulate;
750
+ type StackedSocialTrackerAttach = ISocialTrackerAttach;
751
+ type StackedDynamicGroup = IDynamicGroup;
752
+ type StackedClaimableConditions = IOffer['claimableConditions'];
753
+ type StackedClaimableTrackers = IPlayerOffer['claimableTrackers'];
725
754
  /** Stripped sibling offer data for client rendering */
726
755
  interface StackedSnapshotProgress {
727
756
  status: UserOfferStatus;
@@ -759,30 +788,88 @@ interface StackedReward extends IReward {
759
788
  }
760
789
 
761
790
  /** represents a stacked consumer from the web/mobile app */
762
- type StackedBaseUser = Pick<IUser, 'appConnections' | 'providers'>;
791
+ type StackedBaseUser = Pick<IUser, '_id' | 'appConnections' | 'providers'>;
763
792
  /** extra data populated into a stacked web/mobile app user */
764
793
  interface StackedBaseUserExtra {
765
- cryptoWallets?: Array<{
766
- address: string;
767
- balances: Record<string, number>;
794
+ cryptoWallets?: Array<IUserCryptoWallet & {
795
+ balances?: Record<string, number>;
768
796
  }>;
769
797
  }
770
- type StackedUser = StackedBaseUser & StackedBaseUserExtra & {
771
- apps: {
772
- [appId: string]: StackedSnapshotData;
773
- };
798
+ /** Base stacked user that includes their id, app connections connected to their stacked account, crypto wallets
799
+ * information
800
+ */
801
+ type StackedUser = StackedBaseUser & StackedBaseUserExtra;
802
+ /** 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) */
803
+ type StackedAppConnection = {
804
+ /** this is the Stacked platforms' copy of a user/entity's snapshot for the current app/game */
805
+ snapshot: StackedSnapshot;
806
+ /** represents a stacked entity's snapshot's data within a specific app/game. This is scoped to the app/game!
807
+ * Has information about stacked currencies of this entity earned through this specific app/game
808
+ */
809
+ stackedData: StackedEntityData;
774
810
  };
775
- /** @deprecated - old way of getting a specific game player's currencies in stacked */
776
- type IClientPlayerData = StackedSnapshotData;
811
+ /** Returned alongside offers when fetching a specific user/player's offers */
777
812
  type StackedUserResponse = {
778
- /** @deprecated use stacked instead */
813
+ /** @deprecated use stackedData instead */
779
814
  data?: IClientPlayerData | null;
780
- /** this is the current user's snapshot within this app/game */
781
- snapshot: StackedSnapshot;
782
- /** this current user's stacked web/mobile app profile */
815
+ user?: StackedUser;
816
+ } & StackedAppConnection;
817
+ /** @deprecated - old way of getting a specific game player's currencies in stacked */
818
+ type IClientPlayerData = StackedEntityData;
819
+ /** Stacked mobile/web app's initialize user response */
820
+ interface StackedUserComplete {
783
821
  user: StackedUser;
784
- };
822
+ apps: {
823
+ [appId: string]: StackedAppConnection;
824
+ };
825
+ authMethods: {
826
+ wallets: Array<{
827
+ address: string;
828
+ type: number;
829
+ }>;
830
+ emails: Array<{
831
+ email: string;
832
+ }>;
833
+ phones: Array<{
834
+ phone: string;
835
+ }>;
836
+ providers: Array<{
837
+ type: string;
838
+ profilePic?: string;
839
+ username?: string;
840
+ displayName?: string;
841
+ providerUserId?: string;
842
+ }>;
843
+ };
844
+ }
845
+
846
+ /** Base campaigns response - shared fields between client and server */
847
+ interface StackedCampaignsBaseResponse extends StackedUserResponse {
848
+ /** List of offers/campaigns for the player */
849
+ offers: StackedOffer[];
850
+ /**
851
+ * @deprecated
852
+ * look at stackedData.currencies instead.
853
+ * Currencies with name and image and balance information */
854
+ currencies?: StackedEntityCurrencies;
855
+ }
856
+ /** Client-side campaigns response (from JWT-authenticated endpoints). Returns a list of offers plus
857
+ * user snapshot and stacked user-specific data.
858
+ */
859
+ type StackedCampaignsResponse = StackedCampaignsBaseResponse;
860
+ /** Server-side campaigns response (from API key authenticated endpoints). Returns a list of offers plus
861
+ * user snapshot and stacked user-specific data. */
862
+ interface StackedCampaignsServerResponse extends StackedCampaignsBaseResponse {
863
+ /** @deprecated iframe session token for subsequent client calls */
864
+ token?: string;
865
+ /** Game/app ID */
866
+ gameId: string;
867
+ /** @deprecated use player.snapshot instead */
868
+ playerSnapshot?: StackedSnapshot;
869
+ /** @deprecated use player.stackedData instead */
870
+ playerData?: StackedEntityData;
871
+ }
785
872
 
786
873
  type StackedEnv = IEnv;
787
874
 
788
- export type { IClientPlayerData, StackedBaseOffer, StackedBaseUser, StackedBaseUserExtra, StackedCompletionConditions, StackedEnv, StackedOffer, StackedReward, StackedRewardKind, StackedSnapshot, StackedSnapshotData, StackedSnapshotProgress, StackedUser, StackedUserOffer, StackedUserResponse, UserOfferStatus };
875
+ export type { IClientPlayerData, StackedAppConnection, StackedBaseConditions, StackedBaseOffer, StackedBaseUser, StackedBaseUserExtra, StackedCampaignsResponse, StackedCampaignsServerResponse, StackedClaimableConditions, StackedClaimableTrackers, StackedCompletionConditions, StackedCompletionDynamicTracker, StackedCompletionTrackers, StackedDynamicCondition, StackedDynamicGroup, StackedEntityCurrencies, StackedEntityData, StackedEnv, StackedOffer, StackedOfferTrackers, StackedReward, StackedRewardKind, StackedSnapshot, StackedSnapshotProgress, StackedSocialTrackerAccumulate, StackedSocialTrackerAttach, StackedUser, StackedUserComplete, StackedUserOffer, StackedUserResponse, UserOfferStatus };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackedapp/types",
3
- "version": "0.26.0",
3
+ "version": "1.0.1",
4
4
  "description": "Public types for Stacked platform SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/stacked-types.d.ts",
@@ -16,9 +16,12 @@
16
16
  "clean": "rimraf dist"
17
17
  },
18
18
  "devDependencies": {
19
- "@stackedplatform/types-internal": "*",
20
- "@microsoft/api-extractor": "^7.55.2",
21
- "typescript": "^5.8.2"
19
+ "@semantic-release/commit-analyzer": "^13.0.1",
20
+ "@semantic-release/gitlab": "^13.2.9",
21
+ "@semantic-release/npm": "^13.1.3",
22
+ "@semantic-release/release-notes-generator": "^14.1.0",
23
+ "@stackedplatform/types": "*",
24
+ "conventional-changelog-conventionalcommits": "^9.1.0"
22
25
  },
23
26
  "publishConfig": {
24
27
  "access": "public"