@stackedapp/types 0.26.0 → 1.0.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.
- package/dist/index.js +1 -0
- package/dist/stacked-types.d.ts +94 -26
- package/package.json +7 -4
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
|
package/dist/stacked-types.d.ts
CHANGED
|
@@ -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
|
|
199
|
-
|
|
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?:
|
|
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 =
|
|
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,28 @@ 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'
|
|
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
|
+
type StackedEntityCurrencies = Record<string, IPlayerDataCurrency>;
|
|
721
732
|
/** represents a stacked snapshot's data within a specific app/game. This is scoped to the app/game! */
|
|
722
|
-
type
|
|
733
|
+
type StackedEntityData = Pick<IPlayerData, 'gameId' | 'playerId'> & {
|
|
734
|
+
currencies?: StackedEntityCurrencies;
|
|
735
|
+
};
|
|
723
736
|
|
|
737
|
+
type StackedBaseConditions = IBaseCondition;
|
|
724
738
|
type StackedCompletionConditions = ICompletionCondition;
|
|
739
|
+
type StackedDynamicCondition = IDynamicCondition;
|
|
740
|
+
type StackedCompletionDynamicTracker = ICompletionDynamicTracker;
|
|
741
|
+
type StackedCompletionTrackers = ICompletionTrackers;
|
|
742
|
+
type StackedOfferTrackers = IPlayerOfferTrackers;
|
|
743
|
+
type StackedSocialTrackerAccumulate = ISocialTrackerAccumulate;
|
|
744
|
+
type StackedSocialTrackerAttach = ISocialTrackerAttach;
|
|
745
|
+
type StackedDynamicGroup = IDynamicGroup;
|
|
746
|
+
type StackedClaimableConditions = IOffer['claimableConditions'];
|
|
747
|
+
type StackedClaimableTrackers = IPlayerOffer['claimableTrackers'];
|
|
725
748
|
/** Stripped sibling offer data for client rendering */
|
|
726
749
|
interface StackedSnapshotProgress {
|
|
727
750
|
status: UserOfferStatus;
|
|
@@ -759,30 +782,75 @@ interface StackedReward extends IReward {
|
|
|
759
782
|
}
|
|
760
783
|
|
|
761
784
|
/** represents a stacked consumer from the web/mobile app */
|
|
762
|
-
type StackedBaseUser = Pick<IUser, 'appConnections' | 'providers'>;
|
|
785
|
+
type StackedBaseUser = Pick<IUser, '_id' | 'appConnections' | 'providers'>;
|
|
763
786
|
/** extra data populated into a stacked web/mobile app user */
|
|
764
787
|
interface StackedBaseUserExtra {
|
|
765
|
-
cryptoWallets?: Array<{
|
|
766
|
-
|
|
767
|
-
balances: Record<string, number>;
|
|
788
|
+
cryptoWallets?: Array<IUserCryptoWallet & {
|
|
789
|
+
balances?: Record<string, number>;
|
|
768
790
|
}>;
|
|
769
791
|
}
|
|
770
|
-
type StackedUser = StackedBaseUser & StackedBaseUserExtra
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
792
|
+
type StackedUser = StackedBaseUser & StackedBaseUserExtra;
|
|
793
|
+
/** 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) */
|
|
794
|
+
type StackedAppConnection = {
|
|
795
|
+
snapshot: StackedSnapshot;
|
|
796
|
+
stackedData: StackedEntityData;
|
|
774
797
|
};
|
|
775
|
-
/**
|
|
776
|
-
type IClientPlayerData = StackedSnapshotData;
|
|
798
|
+
/** Returned alongside offers when fetching a specific user/player's offers */
|
|
777
799
|
type StackedUserResponse = {
|
|
778
|
-
/** @deprecated use
|
|
800
|
+
/** @deprecated use stackedData instead */
|
|
779
801
|
data?: IClientPlayerData | null;
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
802
|
+
user?: StackedUser;
|
|
803
|
+
} & StackedAppConnection;
|
|
804
|
+
/** @deprecated - old way of getting a specific game player's currencies in stacked */
|
|
805
|
+
type IClientPlayerData = StackedEntityData;
|
|
806
|
+
/** Stacked mobile web app's initialize user response */
|
|
807
|
+
interface StackedUserComplete {
|
|
783
808
|
user: StackedUser;
|
|
784
|
-
|
|
809
|
+
apps: {
|
|
810
|
+
[appId: string]: StackedAppConnection;
|
|
811
|
+
};
|
|
812
|
+
authMethods: {
|
|
813
|
+
wallets: Array<{
|
|
814
|
+
address: string;
|
|
815
|
+
type: number;
|
|
816
|
+
}>;
|
|
817
|
+
emails: Array<{
|
|
818
|
+
email: string;
|
|
819
|
+
}>;
|
|
820
|
+
phones: Array<{
|
|
821
|
+
phone: string;
|
|
822
|
+
}>;
|
|
823
|
+
providers: Array<{
|
|
824
|
+
type: string;
|
|
825
|
+
profilePic?: string;
|
|
826
|
+
username?: string;
|
|
827
|
+
displayName?: string;
|
|
828
|
+
providerUserId?: string;
|
|
829
|
+
}>;
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/** Base campaigns response - shared fields between client and server */
|
|
834
|
+
interface StackedCampaignsBaseResponse extends StackedUserResponse {
|
|
835
|
+
/** List of offers/campaigns for the player */
|
|
836
|
+
offers: StackedOffer[];
|
|
837
|
+
/** Player's currency balances */
|
|
838
|
+
currencies?: StackedEntityCurrencies;
|
|
839
|
+
}
|
|
840
|
+
/** Client-side campaigns response (from JWT-authenticated endpoints) */
|
|
841
|
+
type StackedCampaignsResponse = StackedCampaignsBaseResponse;
|
|
842
|
+
/** Server-side campaigns response (from API key authenticated endpoints) */
|
|
843
|
+
interface StackedCampaignsServerResponse extends StackedCampaignsBaseResponse {
|
|
844
|
+
/** @deprecated iframe session token for subsequent client calls */
|
|
845
|
+
token: string;
|
|
846
|
+
/** Game/app ID */
|
|
847
|
+
gameId: string;
|
|
848
|
+
/** @deprecated use player.snapshot instead */
|
|
849
|
+
playerSnapshot: StackedSnapshot;
|
|
850
|
+
/** @deprecated use player.stackedData instead */
|
|
851
|
+
playerData: StackedEntityData;
|
|
852
|
+
}
|
|
785
853
|
|
|
786
854
|
type StackedEnv = IEnv;
|
|
787
855
|
|
|
788
|
-
export type { IClientPlayerData, StackedBaseOffer, StackedBaseUser, StackedBaseUserExtra, StackedCompletionConditions, StackedEnv, StackedOffer, StackedReward, StackedRewardKind, StackedSnapshot,
|
|
856
|
+
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.
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"
|
|
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"
|