@stackedapp/types 1.9.16 → 1.9.18

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
@@ -20,4 +20,7 @@ __exportStar(require("./stacked_reward"), exports);
20
20
  __exportStar(require("./stacked_snapshot"), exports);
21
21
  __exportStar(require("./stacked_user"), exports);
22
22
  __exportStar(require("./stacked_response"), exports);
23
+ __exportStar(require("./stacked_content"), exports);
24
+ __exportStar(require("./stacked_app"), exports);
25
+ __exportStar(require("./stacked_currency"), exports);
23
26
  //# sourceMappingURL=index.js.map
@@ -896,7 +896,496 @@ interface StackedCampaignsServerResponse extends StackedCampaignsBaseResponse {
896
896
  /** @deprecated use player.stackedData instead */
897
897
  playerData?: StackedEntityData;
898
898
  }
899
+ type GetOneTimeAuthTokenResponse = {
900
+ token: string;
901
+ };
902
+ type ExchangeOneTimeTokenForSessionTokenResponse = {
903
+ playerId: string;
904
+ gameId: string;
905
+ token: string;
906
+ player: {
907
+ snapshot?: StackedSnapshot;
908
+ data?: StackedEntityData;
909
+ };
910
+ };
911
+ type GenerateStackedLinkTokenResponse = {
912
+ token: string;
913
+ };
914
+ type ExchangeStackedLinkTokenResponse = {
915
+ linked: boolean;
916
+ alreadyLinked: boolean;
917
+ };
918
+ type InitializeUnifiedUserResponse = StackedUserComplete;
919
+ type LinkExternalGameToUnifiedAccountResponse = {
920
+ user?: StackedBaseUser;
921
+ };
922
+ type UnlinkExternalGameFromUnifiedAccountResponse = LinkExternalGameToUnifiedAccountResponse;
923
+ type StartOneTimeAuthResponse = {
924
+ message: string;
925
+ sessionId: string;
926
+ method_id: string;
927
+ };
928
+ type CompleteOneTimeAuthResponse = {
929
+ success: boolean;
930
+ user: StackedUserComplete;
931
+ session_token: string;
932
+ };
933
+ type StartCryptoAuthResponse = {
934
+ challenge: string;
935
+ };
936
+ type CompleteCryptoAuthResponse = {
937
+ success: boolean;
938
+ user: StackedUserComplete;
939
+ session_token: string;
940
+ };
941
+ type DeleteAccountResponse = {
942
+ success: boolean;
943
+ };
944
+ type RemoveAuthMethodResponse = {
945
+ success: boolean;
946
+ };
947
+ type StartOAuthResponse = {
948
+ url: string;
949
+ };
950
+ type StartOAuthAttachResponse = {
951
+ url: string;
952
+ };
953
+ type CompleteOAuthResponse = {
954
+ success: boolean;
955
+ user: StackedUserComplete;
956
+ session_token: string;
957
+ };
958
+ type RemoveOAuthProviderResponse = {
959
+ success: boolean;
960
+ message?: string;
961
+ };
962
+ type SignOutUnifiedUserResponse = {
963
+ success: boolean;
964
+ message?: string;
965
+ };
966
+
967
+ interface ContentItem {
968
+ id: string;
969
+ title: string;
970
+ description?: string;
971
+ thumbnail?: string;
972
+ platform: string;
973
+ platformId: string;
974
+ views?: number;
975
+ likes?: number;
976
+ comments?: number;
977
+ shares?: number;
978
+ duration?: number;
979
+ createdAt: string;
980
+ url?: string;
981
+ embedHtml?: string;
982
+ coverImageUrl?: string;
983
+ musicTitle?: string;
984
+ musicAuthor?: string;
985
+ attachedOfferId?: string;
986
+ }
987
+ interface ContentResponse {
988
+ items: ContentItem[];
989
+ cursor?: string | number;
990
+ hasMore: boolean;
991
+ totalCount?: number;
992
+ }
993
+ interface ContentStats {
994
+ totalViews: number;
995
+ totalLikes: number;
996
+ totalComments: number;
997
+ totalShares: number;
998
+ totalContent: number;
999
+ avgEngagementRate: number;
1000
+ topContent?: ContentItem[];
1001
+ }
1002
+
1003
+ type StackedContentItem = ContentItem;
1004
+ type StackedContentResponse = ContentResponse;
1005
+ type StackedContentStats = ContentStats;
1006
+
1007
+ /**
1008
+ * doc that defines a third party app
1009
+ */
1010
+ interface IThirdPartyApp {
1011
+ /** the organization_id from stytch for b2b auth */
1012
+ stytchId?: string;
1013
+ /** fireblocks vault id */
1014
+ vaultId?: string;
1015
+ /** growthbook project id */
1016
+ growthbookProjectId?: string;
1017
+ /** should we show advanced offer fields and settings? */
1018
+ advancedOffers?: boolean;
1019
+ /** If ture, the stacked app should show this
1020
+ * org as a connection even if it hasn't been linked
1021
+ * or tunneled into yet
1022
+ */
1023
+ showLinkable?: string;
1024
+ /** url of this game. must exist with showLinkable
1025
+ * if it is to be shown in the app always
1026
+ */
1027
+ url?: string;
1028
+ /**
1029
+ * third party app id
1030
+ */
1031
+ id: string;
1032
+ /**
1033
+ * third party app display name
1034
+ */
1035
+ displayName: string;
1036
+ /**
1037
+ * third party app image
1038
+ */
1039
+ image?: string;
1040
+ /**
1041
+ * third party app client id - this is public
1042
+ */
1043
+ clientId: string;
1044
+ /**
1045
+ * third party app api key
1046
+ */
1047
+ apiKey: string;
1048
+ /** a list of sdk events and when this specific organization received events last from sdk */
1049
+ sdkEvents?: Record<string, {
1050
+ lastReceived: number;
1051
+ data?: any;
1052
+ }>;
1053
+ /** Short tagline for the game (e.g., "Farm, explore & earn in a pixel world") */
1054
+ tagline?: string;
1055
+ /** Longer description of the game */
1056
+ description?: string;
1057
+ /** Game genres/categories (e.g., ['RPG', 'Farming', 'Web3']) */
1058
+ genres?: string[];
1059
+ /** YouTube or video trailer URL */
1060
+ trailerUrl?: string;
1061
+ /** Game thumbnail image URL */
1062
+ gameThumbnail?: string;
1063
+ /** Game logo URL */
1064
+ logo?: string;
1065
+ /** Square logo variant URL */
1066
+ squareLogo?: string;
1067
+ /** Header/banner image URL */
1068
+ headerImage?: string;
1069
+ /** Featured square screenshot URL */
1070
+ squareScreenshot?: string;
1071
+ /** Array of screenshot URLs for the game */
1072
+ screenshots?: string[];
1073
+ /** iOS App Store URL */
1074
+ appStoreUrl?: string;
1075
+ /** Google Play Store URL */
1076
+ playStoreUrl?: string;
1077
+ /** Browser game URL (if different from main url) */
1078
+ webUrl?: string;
1079
+ /** Marketing landing page URL */
1080
+ landingPageUrl?: string;
1081
+ /** App Store rating (e.g., 4.8) */
1082
+ appStoreRating?: number;
1083
+ /** Number of ratings on App Store */
1084
+ appStoreRatingCount?: number;
1085
+ /** Play Store rating (e.g., 4.5) */
1086
+ playStoreRating?: number;
1087
+ /** Number of ratings on Play Store */
1088
+ playStoreRatingCount?: number;
1089
+ /** Offer presets - named configurations for offer targeting (countries, network restrictions) */
1090
+ offerPresets?: Array<{
1091
+ name: string;
1092
+ /** Whitelist mode - only these countries can see offers using this preset */
1093
+ allowedCountries?: string[];
1094
+ /** Blacklist mode - these countries cannot see offers using this preset */
1095
+ restrictedCountries?: string[];
1096
+ /** Network types to block */
1097
+ networkRestrictions?: ('vpn' | 'tor' | 'proxy' | 'relay')[];
1098
+ }>;
1099
+ /** Name of the default offer preset to use for new offers */
1100
+ offerPresetDefault?: string;
1101
+ }
1102
+
1103
+ /**
1104
+ * Represents an active listener config from blockchain_server.
1105
+ * Data comes from POST /api/listener-configs/active endpoint.
1106
+ */
1107
+ interface IActiveListener {
1108
+ /** Listener config ID */
1109
+ _id: string;
1110
+ /** Listener name (e.g., "Ronin $PIXEL Transfer") */
1111
+ name: string;
1112
+ /** Populated contract reference */
1113
+ contract_id: {
1114
+ _id: string;
1115
+ contract_address: string;
1116
+ name: string;
1117
+ symbol: string;
1118
+ };
1119
+ /** Populated RPC provider reference */
1120
+ rpc_provider_config_id: {
1121
+ _id: string;
1122
+ name: string;
1123
+ network: string;
1124
+ };
1125
+ /** Events being tracked by this listener */
1126
+ events_to_track: string[];
1127
+ /** Whether this listener is active */
1128
+ is_active: boolean;
1129
+ /** Post-processing configuration for balance fetching */
1130
+ post_processing?: {
1131
+ enabled: boolean;
1132
+ fetch_native_balances: string[];
1133
+ fetch_erc20_balances: string[];
1134
+ fetch_erc721_balances: string[];
1135
+ fetch_erc1155_balances: Array<{
1136
+ contract_id: string;
1137
+ token_ids: string[];
1138
+ }>;
1139
+ };
1140
+ /** Schedule for when this listener runs */
1141
+ schedule?: {
1142
+ start_datetime: string;
1143
+ end_datetime: string;
1144
+ };
1145
+ createdAt: string;
1146
+ updatedAt: string;
1147
+ }
1148
+
1149
+ interface IAppState {
1150
+ /**
1151
+ * our app config. Just pixels using db for now, but
1152
+ * could have config for pixels_data, too, and maybe
1153
+ * 'pets' in future, or 'retool'...
1154
+ * ('blockchain' app now has separate config)
1155
+ */
1156
+ appName: string;
1157
+ /**
1158
+ * overrides for environment variables. Gets put into keys of serverConfig
1159
+ */
1160
+ environment?: Record<string, string>;
1161
+ /** threshold for adding wallet after it's deleted */
1162
+ deleteWalletThresholdDays?: number;
1163
+ /**
1164
+ * feature flags for the app. These are used to enable/disable
1165
+ */
1166
+ featureFlags?: Record<string, boolean>;
1167
+ /**
1168
+ * List of event names we don't want to track.
1169
+ */
1170
+ disabledEventNames?: string[];
1171
+ tokens?: Array<{
1172
+ symbol: string;
1173
+ }>;
1174
+ /** getting deprecated */
1175
+ segments?: Array<{
1176
+ name: string;
1177
+ /** specific orgIds that can see and use this specific segment */
1178
+ orgIds?: Array<string>;
1179
+ }>;
1180
+ /** key is the segment GROUP. segmentation tags are mutually exclusive within a group */
1181
+ segmentGroups: Record<string, {
1182
+ tags: Array<string>;
1183
+ }>;
1184
+ restrictedCountryCodes?: {
1185
+ withdraw: Array<string>;
1186
+ deposit: Array<string>;
1187
+ rewardBadges: Array<string>;
1188
+ };
1189
+ currencyPrices: {
1190
+ /** how often refresh curr prices */
1191
+ refreshMs: number;
1192
+ /** convert targets. eth and usd default */
1193
+ convertTo: Array<string>;
1194
+ };
1195
+ /** if undefined, the infinite */
1196
+ maxOfferSlots?: number;
1197
+ maxCryptoWallets?: number;
1198
+ defaultRakePercentage?: number;
1199
+ adminOrgIds?: string[];
1200
+ /** number of days before a player snapshot can be UNLINKED and then RELINKED to a new account */
1201
+ unifiedUserLinkCooldown?: number;
1202
+ notifications?: {
1203
+ /** how long does the offer need to have been created and still in active status for us to send a targetted notif? */
1204
+ offerCreatedMsRequired?: number;
1205
+ pushCooldown?: number;
1206
+ lastLoggedInCooldown?: number;
1207
+ batchSize?: number;
1208
+ };
1209
+ /** Maximum number of active offers a player can have at once. Defaults to 25 */
1210
+ maxActiveOffersPerPlayer?: number;
1211
+ activeListeners?: Record<string, IActiveListener[]>;
1212
+ }
1213
+
1214
+ type StackedThirdPartyApp = Pick<IThirdPartyApp, 'id' | 'displayName' | 'image' | 'showLinkable' | 'url' | 'tagline' | 'description' | 'genres' | 'trailerUrl' | 'gameThumbnail' | 'logo' | 'squareLogo' | 'headerImage' | 'squareScreenshot' | 'screenshots' | 'appStoreUrl' | 'playStoreUrl' | 'webUrl' | 'landingPageUrl' | 'appStoreRating' | 'appStoreRatingCount' | 'playStoreRating' | 'playStoreRatingCount'>;
1215
+ type StackedAppState = Pick<IAppState, 'featureFlags' | 'maxCryptoWallets' | 'maxOfferSlots' | 'restrictedCountryCodes' | 'deleteWalletThresholdDays'>;
1216
+
1217
+ type SupportedNetwork = 'ethereum' | 'sepolia' | 'matic' | 'amoy' | 'bsc' | 'bsctestnet' | 'base' | 'basesepoliatestnet' | 'ronin' | 'saigon';
1218
+ interface ICurrency {
1219
+ _id: Stringable;
1220
+ /** if true, then this currency can be used as a reward currency from offerwall/neo */
1221
+ rewardable?: boolean;
1222
+ /**
1223
+ * id of the currency: cur_pixel, cur_berry, cur_gold, etc.
1224
+ */
1225
+ id: string;
1226
+ /**
1227
+ * true if this currency no longer used. do not send
1228
+ * the currency info to client.
1229
+ */
1230
+ archived?: boolean;
1231
+ /**
1232
+ * Display Name of the currency: $PIXEL, $BERRY, $GOLD, etc.
1233
+ */
1234
+ name?: string;
1235
+ /**
1236
+ * VIP points earned per unit of currency spent
1237
+ */
1238
+ vipPoints?: number;
1239
+ /**
1240
+ * currency (ERC-20) contract address. This is used for deposit and withdraw
1241
+ * and for burning.
1242
+ * for a compound currency, this is the ERC20 that will be burned.
1243
+ */
1244
+ contractAddress?: string;
1245
+ /**
1246
+ * contract network for this currency
1247
+ */
1248
+ network?: SupportedNetwork;
1249
+ /** default network for this currency? */
1250
+ default?: boolean;
1251
+ /**
1252
+ * a list of wallets to send (withdraw) from
1253
+ */
1254
+ operators?: Array<string>;
1255
+ /**
1256
+ * list of wallets to receive deposits
1257
+ */
1258
+ depositors?: Array<string>;
1259
+ /**
1260
+ * list of retired wallets we still might need to work with. Accept deposits or continue
1261
+ * withdrawals initiated on these wallets, but do not use them for new transactions.
1262
+ */
1263
+ additional?: Array<string>;
1264
+ /**
1265
+ * for image/size of the currency symbol
1266
+ */
1267
+ image: string;
1268
+ /**
1269
+ * abi of the currency contract
1270
+ */
1271
+ abi?: any;
1272
+ /**
1273
+ * reset timestamp. If a player most recently saved before this date, we
1274
+ * clear this currency from their wallet. Only used on temporary currencies.
1275
+ * For safety, we do not reset if a currency has a crypto contract or for
1276
+ * cur_coins
1277
+ */
1278
+ resetAt?: number;
1279
+ /**
1280
+ * tenants to use this currency on. empty for all.
1281
+ */
1282
+ tenants: Array<string>;
1283
+ /**
1284
+ * round decimal places when saving, depositing, withdrawing.
1285
+ */
1286
+ roundDecimalPlaces?: number;
1287
+ /**
1288
+ * a composite currency composed the balance as a SUM of the balances
1289
+ * of the components. The currencies are spent in array order (first one first)
1290
+ */
1291
+ composite?: string[];
1292
+ /**
1293
+ * if set, when this currency is increased for a player, it will use this
1294
+ * component currencyId (must be in composite array). by default, it will
1295
+ * use the first entry in composite array
1296
+ */
1297
+ rewardComponent?: string;
1298
+ /**
1299
+ * internal and not persisted to db, this tracks which currencies are
1300
+ * components of other currencies, so that in the event they get changed,
1301
+ * the composite can be updated as well.
1302
+ */
1303
+ componentOf?: string;
1304
+ withdraw?: {
1305
+ /** if undefined, then withdraw to any currency. This only matters if Currency.rewardable is true. */
1306
+ to?: Array<{
1307
+ currencyId: string;
1308
+ disabled?: boolean;
1309
+ }>;
1310
+ disabled: boolean;
1311
+ min?: number;
1312
+ max?: number;
1313
+ maxPerDay?: number;
1314
+ monthlyLimit?: number;
1315
+ surcharge?: {
1316
+ fixed: number;
1317
+ percentage: number;
1318
+ };
1319
+ surcharges?: Array<{
1320
+ reputation: number;
1321
+ fixed: number;
1322
+ percentage: number;
1323
+ }>;
1324
+ emergencyShutoff?: {
1325
+ amount: number;
1326
+ hours: number;
1327
+ };
1328
+ limits?: Array<{
1329
+ maxTrust: number;
1330
+ hours: number;
1331
+ max: number;
1332
+ }>;
1333
+ autoApprovals?: Array<{
1334
+ upTo: number;
1335
+ hours: number;
1336
+ minTrust?: number;
1337
+ }>;
1338
+ };
1339
+ deposit?: {
1340
+ disabled: boolean;
1341
+ min?: number;
1342
+ max?: number;
1343
+ maxPerDay?: number;
1344
+ needApproval?: boolean;
1345
+ surcharge?: {
1346
+ fixed: number;
1347
+ percentage: number;
1348
+ };
1349
+ surcharges?: Array<{
1350
+ reputation: number;
1351
+ fixed: number;
1352
+ percentage: number;
1353
+ }>;
1354
+ conversion?: {
1355
+ toCurrency: string;
1356
+ rate: number;
1357
+ };
1358
+ };
1359
+ }
1360
+
1361
+ type CurrencyUnit = 'ETH' | 'USD';
1362
+ interface ILibraryCurrencyPrice {
1363
+ id: string;
1364
+ name: string;
1365
+ symbol: string;
1366
+ usdPrice: number;
1367
+ default?: boolean;
1368
+ }
1369
+
1370
+ type StackedSupportedNetwork = SupportedNetwork;
1371
+ type StackedCurrency = Pick<ICurrency, 'id' | 'name' | 'image' | 'contractAddress' | 'network' | 'default' | 'rewardable' | 'archived' | 'roundDecimalPlaces' | 'composite' | 'rewardComponent'> & {
1372
+ withdraw?: {
1373
+ to?: Array<{
1374
+ currencyId: string;
1375
+ disabled?: boolean;
1376
+ }>;
1377
+ disabled: boolean;
1378
+ min?: number;
1379
+ max?: number;
1380
+ };
1381
+ deposit?: {
1382
+ disabled: boolean;
1383
+ min?: number;
1384
+ max?: number;
1385
+ };
1386
+ };
1387
+ type StackedCurrencyPrice = ILibraryCurrencyPrice;
899
1388
 
900
1389
  type StackedEnv = IEnv;
901
1390
 
902
- 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, StackedUserWithApps, UserOfferStatus };
1391
+ export type { CompleteCryptoAuthResponse, CompleteOAuthResponse, CompleteOneTimeAuthResponse, CurrencyUnit, DeleteAccountResponse, ExchangeOneTimeTokenForSessionTokenResponse, ExchangeStackedLinkTokenResponse, GenerateStackedLinkTokenResponse, GetOneTimeAuthTokenResponse, IClientPlayerData, InitializeUnifiedUserResponse, LinkExternalGameToUnifiedAccountResponse, RemoveAuthMethodResponse, RemoveOAuthProviderResponse, SignOutUnifiedUserResponse, StackedAppConnection, StackedAppState, StackedBaseConditions, StackedBaseOffer, StackedBaseUser, StackedBaseUserExtra, StackedCampaignsResponse, StackedCampaignsServerResponse, StackedClaimableConditions, StackedClaimableTrackers, StackedCompletionConditions, StackedCompletionDynamicTracker, StackedCompletionTrackers, StackedContentItem, StackedContentResponse, StackedContentStats, StackedCurrency, StackedCurrencyPrice, StackedDynamicCondition, StackedDynamicGroup, StackedEntityCurrencies, StackedEntityData, StackedEnv, StackedOffer, StackedOfferTrackers, StackedReward, StackedRewardKind, StackedSnapshot, StackedSnapshotProgress, StackedSocialTrackerAccumulate, StackedSocialTrackerAttach, StackedSupportedNetwork, StackedThirdPartyApp, StackedUser, StackedUserComplete, StackedUserOffer, StackedUserResponse, StackedUserWithApps, StartCryptoAuthResponse, StartOAuthAttachResponse, StartOAuthResponse, StartOneTimeAuthResponse, UnlinkExternalGameFromUnifiedAccountResponse, UserOfferStatus };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackedapp/types",
3
- "version": "1.9.16",
3
+ "version": "1.9.18",
4
4
  "description": "Public types for Stacked platform SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/stacked-types.d.ts",