@proofchain/sdk 2.15.0 → 2.16.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.d.mts +103 -14
- package/dist/index.d.ts +103 -14
- package/dist/index.js +100 -9
- package/dist/index.mjs +100 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1858,6 +1858,7 @@ interface UserReward {
|
|
|
1858
1858
|
id: string;
|
|
1859
1859
|
reward_name: string;
|
|
1860
1860
|
reward_type: string;
|
|
1861
|
+
category?: string;
|
|
1861
1862
|
slug?: string;
|
|
1862
1863
|
description?: string;
|
|
1863
1864
|
status: string;
|
|
@@ -1914,6 +1915,23 @@ interface ManualRewardRequest {
|
|
|
1914
1915
|
trigger_data?: Record<string, any>;
|
|
1915
1916
|
distribute_immediately?: boolean;
|
|
1916
1917
|
}
|
|
1918
|
+
interface ClaimNFTResult {
|
|
1919
|
+
success: boolean;
|
|
1920
|
+
reward_id: string;
|
|
1921
|
+
token_id?: number;
|
|
1922
|
+
tx_hash: string;
|
|
1923
|
+
wallet_address: string;
|
|
1924
|
+
}
|
|
1925
|
+
interface DistributeResult {
|
|
1926
|
+
success: boolean;
|
|
1927
|
+
reward_id: string;
|
|
1928
|
+
message: string;
|
|
1929
|
+
}
|
|
1930
|
+
interface RevokeResult {
|
|
1931
|
+
success: boolean;
|
|
1932
|
+
reward_id: string;
|
|
1933
|
+
status: string;
|
|
1934
|
+
}
|
|
1917
1935
|
interface ListRewardsOptions {
|
|
1918
1936
|
is_active?: boolean;
|
|
1919
1937
|
reward_type?: string;
|
|
@@ -1962,37 +1980,108 @@ declare class RewardsClient {
|
|
|
1962
1980
|
offset?: number;
|
|
1963
1981
|
}): Promise<EarnedReward[]>;
|
|
1964
1982
|
/**
|
|
1965
|
-
* Get earned rewards for a user (with full badge/reward details)
|
|
1983
|
+
* Get earned rewards for a user (with full badge/reward details).
|
|
1984
|
+
* Use this to display a user's reward collection on a dedicated screen.
|
|
1985
|
+
*
|
|
1986
|
+
* @example
|
|
1987
|
+
* ```ts
|
|
1988
|
+
* // All user rewards
|
|
1989
|
+
* const all = await client.rewards.getUserRewards('user-123');
|
|
1990
|
+
*
|
|
1991
|
+
* // Only badges in the "Fan Pass" category
|
|
1992
|
+
* const badges = await client.rewards.getUserRewards('user-123', {
|
|
1993
|
+
* reward_type: 'badge',
|
|
1994
|
+
* category: 'Fan Pass',
|
|
1995
|
+
* });
|
|
1996
|
+
*
|
|
1997
|
+
* // Only distributed rewards
|
|
1998
|
+
* const distributed = await client.rewards.getUserRewards('user-123', {
|
|
1999
|
+
* status: 'distributed',
|
|
2000
|
+
* });
|
|
2001
|
+
* ```
|
|
1966
2002
|
*/
|
|
1967
2003
|
getUserRewards(userId: string, options?: {
|
|
1968
2004
|
status?: string;
|
|
1969
2005
|
reward_type?: string;
|
|
2006
|
+
category?: string;
|
|
1970
2007
|
}): Promise<UserReward[]>;
|
|
1971
2008
|
/**
|
|
1972
|
-
* Get the public reward catalog (active, public reward definitions)
|
|
2009
|
+
* Get the public reward catalog (active, public reward definitions).
|
|
1973
2010
|
* Available to both API key and end-user JWT clients.
|
|
2011
|
+
*
|
|
2012
|
+
* @param category - Optional category filter (e.g. "Fan Pass", "Partner: Acme")
|
|
2013
|
+
*
|
|
2014
|
+
* @example
|
|
2015
|
+
* ```ts
|
|
2016
|
+
* // All available rewards
|
|
2017
|
+
* const all = await client.rewards.getCatalog();
|
|
2018
|
+
*
|
|
2019
|
+
* // Only "Fan Pass" rewards
|
|
2020
|
+
* const fanPass = await client.rewards.getCatalog('Fan Pass');
|
|
2021
|
+
* ```
|
|
1974
2022
|
*/
|
|
1975
|
-
getCatalog(): Promise<RewardDefinition[]>;
|
|
2023
|
+
getCatalog(category?: string): Promise<RewardDefinition[]>;
|
|
1976
2024
|
/**
|
|
1977
2025
|
* Claim a lazy-minted NFT reward.
|
|
1978
2026
|
* The wallet_address receives the minted NFT. The tenant's treasury pays gas.
|
|
1979
2027
|
* Available to both API key and end-user JWT clients (scoped to own rewards).
|
|
2028
|
+
*
|
|
2029
|
+
* For non-NFT rewards, use {@link distribute} instead.
|
|
1980
2030
|
*/
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2031
|
+
claimNFT(earnedRewardId: string, walletAddress: string): Promise<ClaimNFTResult>;
|
|
2032
|
+
/**
|
|
2033
|
+
* @deprecated Use {@link claimNFT} instead — this method only works for lazy-mint NFTs.
|
|
2034
|
+
*/
|
|
2035
|
+
claimReward(earnedRewardId: string, walletAddress: string): Promise<ClaimNFTResult>;
|
|
2036
|
+
/**
|
|
2037
|
+
* Manually award rewards to one or more users.
|
|
2038
|
+
* Works for all reward types: points, tokens, NFTs, badges, custom.
|
|
2039
|
+
*
|
|
2040
|
+
* @example
|
|
2041
|
+
* ```ts
|
|
2042
|
+
* // Award a badge to two users
|
|
2043
|
+
* const rewards = await client.rewards.award({
|
|
2044
|
+
* definition_id: 'badge-def-id',
|
|
2045
|
+
* user_ids: ['user-1', 'user-2'],
|
|
2046
|
+
* distribute_immediately: true,
|
|
2047
|
+
* });
|
|
2048
|
+
* ```
|
|
2049
|
+
*/
|
|
2050
|
+
award(request: ManualRewardRequest): Promise<EarnedReward[]>;
|
|
1988
2051
|
/**
|
|
1989
|
-
*
|
|
2052
|
+
* @deprecated Use {@link award} instead.
|
|
1990
2053
|
*/
|
|
1991
2054
|
awardManual(request: ManualRewardRequest): Promise<EarnedReward[]>;
|
|
1992
2055
|
/**
|
|
1993
|
-
* Distribute pending
|
|
2056
|
+
* Distribute a pending or failed reward.
|
|
2057
|
+
* Works for all reward types — triggers the appropriate distribution
|
|
2058
|
+
* (mint NFT, transfer tokens, issue badge, credit points, etc.).
|
|
2059
|
+
*
|
|
2060
|
+
* @example
|
|
2061
|
+
* ```ts
|
|
2062
|
+
* // Distribute a pending reward
|
|
2063
|
+
* const result = await client.rewards.distribute('earned-reward-id');
|
|
2064
|
+
* ```
|
|
2065
|
+
*/
|
|
2066
|
+
distribute(earnedRewardId: string): Promise<DistributeResult>;
|
|
2067
|
+
/**
|
|
2068
|
+
* @deprecated Use {@link distribute} instead.
|
|
2069
|
+
*/
|
|
2070
|
+
distributePending(earnedRewardId: string): Promise<DistributeResult>;
|
|
2071
|
+
/**
|
|
2072
|
+
* Distribute all pending rewards for the tenant.
|
|
2073
|
+
* Queues every pending reward for background distribution.
|
|
2074
|
+
*/
|
|
2075
|
+
distributeAll(): Promise<{
|
|
2076
|
+
queued: number;
|
|
2077
|
+
}>;
|
|
2078
|
+
/**
|
|
2079
|
+
* Revoke an earned reward.
|
|
2080
|
+
*
|
|
2081
|
+
* @param earnedRewardId - The earned reward ID to revoke
|
|
2082
|
+
* @param reason - Reason for revocation
|
|
1994
2083
|
*/
|
|
1995
|
-
|
|
2084
|
+
revoke(earnedRewardId: string, reason: string): Promise<RevokeResult>;
|
|
1996
2085
|
/**
|
|
1997
2086
|
* Upload an asset for a reward (image, metadata JSON)
|
|
1998
2087
|
*/
|
|
@@ -3268,4 +3357,4 @@ declare class TimeoutError extends ProofChainError {
|
|
|
3268
3357
|
constructor(message?: string);
|
|
3269
3358
|
}
|
|
3270
3359
|
|
|
3271
|
-
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };
|
|
3360
|
+
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };
|
package/dist/index.d.ts
CHANGED
|
@@ -1858,6 +1858,7 @@ interface UserReward {
|
|
|
1858
1858
|
id: string;
|
|
1859
1859
|
reward_name: string;
|
|
1860
1860
|
reward_type: string;
|
|
1861
|
+
category?: string;
|
|
1861
1862
|
slug?: string;
|
|
1862
1863
|
description?: string;
|
|
1863
1864
|
status: string;
|
|
@@ -1914,6 +1915,23 @@ interface ManualRewardRequest {
|
|
|
1914
1915
|
trigger_data?: Record<string, any>;
|
|
1915
1916
|
distribute_immediately?: boolean;
|
|
1916
1917
|
}
|
|
1918
|
+
interface ClaimNFTResult {
|
|
1919
|
+
success: boolean;
|
|
1920
|
+
reward_id: string;
|
|
1921
|
+
token_id?: number;
|
|
1922
|
+
tx_hash: string;
|
|
1923
|
+
wallet_address: string;
|
|
1924
|
+
}
|
|
1925
|
+
interface DistributeResult {
|
|
1926
|
+
success: boolean;
|
|
1927
|
+
reward_id: string;
|
|
1928
|
+
message: string;
|
|
1929
|
+
}
|
|
1930
|
+
interface RevokeResult {
|
|
1931
|
+
success: boolean;
|
|
1932
|
+
reward_id: string;
|
|
1933
|
+
status: string;
|
|
1934
|
+
}
|
|
1917
1935
|
interface ListRewardsOptions {
|
|
1918
1936
|
is_active?: boolean;
|
|
1919
1937
|
reward_type?: string;
|
|
@@ -1962,37 +1980,108 @@ declare class RewardsClient {
|
|
|
1962
1980
|
offset?: number;
|
|
1963
1981
|
}): Promise<EarnedReward[]>;
|
|
1964
1982
|
/**
|
|
1965
|
-
* Get earned rewards for a user (with full badge/reward details)
|
|
1983
|
+
* Get earned rewards for a user (with full badge/reward details).
|
|
1984
|
+
* Use this to display a user's reward collection on a dedicated screen.
|
|
1985
|
+
*
|
|
1986
|
+
* @example
|
|
1987
|
+
* ```ts
|
|
1988
|
+
* // All user rewards
|
|
1989
|
+
* const all = await client.rewards.getUserRewards('user-123');
|
|
1990
|
+
*
|
|
1991
|
+
* // Only badges in the "Fan Pass" category
|
|
1992
|
+
* const badges = await client.rewards.getUserRewards('user-123', {
|
|
1993
|
+
* reward_type: 'badge',
|
|
1994
|
+
* category: 'Fan Pass',
|
|
1995
|
+
* });
|
|
1996
|
+
*
|
|
1997
|
+
* // Only distributed rewards
|
|
1998
|
+
* const distributed = await client.rewards.getUserRewards('user-123', {
|
|
1999
|
+
* status: 'distributed',
|
|
2000
|
+
* });
|
|
2001
|
+
* ```
|
|
1966
2002
|
*/
|
|
1967
2003
|
getUserRewards(userId: string, options?: {
|
|
1968
2004
|
status?: string;
|
|
1969
2005
|
reward_type?: string;
|
|
2006
|
+
category?: string;
|
|
1970
2007
|
}): Promise<UserReward[]>;
|
|
1971
2008
|
/**
|
|
1972
|
-
* Get the public reward catalog (active, public reward definitions)
|
|
2009
|
+
* Get the public reward catalog (active, public reward definitions).
|
|
1973
2010
|
* Available to both API key and end-user JWT clients.
|
|
2011
|
+
*
|
|
2012
|
+
* @param category - Optional category filter (e.g. "Fan Pass", "Partner: Acme")
|
|
2013
|
+
*
|
|
2014
|
+
* @example
|
|
2015
|
+
* ```ts
|
|
2016
|
+
* // All available rewards
|
|
2017
|
+
* const all = await client.rewards.getCatalog();
|
|
2018
|
+
*
|
|
2019
|
+
* // Only "Fan Pass" rewards
|
|
2020
|
+
* const fanPass = await client.rewards.getCatalog('Fan Pass');
|
|
2021
|
+
* ```
|
|
1974
2022
|
*/
|
|
1975
|
-
getCatalog(): Promise<RewardDefinition[]>;
|
|
2023
|
+
getCatalog(category?: string): Promise<RewardDefinition[]>;
|
|
1976
2024
|
/**
|
|
1977
2025
|
* Claim a lazy-minted NFT reward.
|
|
1978
2026
|
* The wallet_address receives the minted NFT. The tenant's treasury pays gas.
|
|
1979
2027
|
* Available to both API key and end-user JWT clients (scoped to own rewards).
|
|
2028
|
+
*
|
|
2029
|
+
* For non-NFT rewards, use {@link distribute} instead.
|
|
1980
2030
|
*/
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2031
|
+
claimNFT(earnedRewardId: string, walletAddress: string): Promise<ClaimNFTResult>;
|
|
2032
|
+
/**
|
|
2033
|
+
* @deprecated Use {@link claimNFT} instead — this method only works for lazy-mint NFTs.
|
|
2034
|
+
*/
|
|
2035
|
+
claimReward(earnedRewardId: string, walletAddress: string): Promise<ClaimNFTResult>;
|
|
2036
|
+
/**
|
|
2037
|
+
* Manually award rewards to one or more users.
|
|
2038
|
+
* Works for all reward types: points, tokens, NFTs, badges, custom.
|
|
2039
|
+
*
|
|
2040
|
+
* @example
|
|
2041
|
+
* ```ts
|
|
2042
|
+
* // Award a badge to two users
|
|
2043
|
+
* const rewards = await client.rewards.award({
|
|
2044
|
+
* definition_id: 'badge-def-id',
|
|
2045
|
+
* user_ids: ['user-1', 'user-2'],
|
|
2046
|
+
* distribute_immediately: true,
|
|
2047
|
+
* });
|
|
2048
|
+
* ```
|
|
2049
|
+
*/
|
|
2050
|
+
award(request: ManualRewardRequest): Promise<EarnedReward[]>;
|
|
1988
2051
|
/**
|
|
1989
|
-
*
|
|
2052
|
+
* @deprecated Use {@link award} instead.
|
|
1990
2053
|
*/
|
|
1991
2054
|
awardManual(request: ManualRewardRequest): Promise<EarnedReward[]>;
|
|
1992
2055
|
/**
|
|
1993
|
-
* Distribute pending
|
|
2056
|
+
* Distribute a pending or failed reward.
|
|
2057
|
+
* Works for all reward types — triggers the appropriate distribution
|
|
2058
|
+
* (mint NFT, transfer tokens, issue badge, credit points, etc.).
|
|
2059
|
+
*
|
|
2060
|
+
* @example
|
|
2061
|
+
* ```ts
|
|
2062
|
+
* // Distribute a pending reward
|
|
2063
|
+
* const result = await client.rewards.distribute('earned-reward-id');
|
|
2064
|
+
* ```
|
|
2065
|
+
*/
|
|
2066
|
+
distribute(earnedRewardId: string): Promise<DistributeResult>;
|
|
2067
|
+
/**
|
|
2068
|
+
* @deprecated Use {@link distribute} instead.
|
|
2069
|
+
*/
|
|
2070
|
+
distributePending(earnedRewardId: string): Promise<DistributeResult>;
|
|
2071
|
+
/**
|
|
2072
|
+
* Distribute all pending rewards for the tenant.
|
|
2073
|
+
* Queues every pending reward for background distribution.
|
|
2074
|
+
*/
|
|
2075
|
+
distributeAll(): Promise<{
|
|
2076
|
+
queued: number;
|
|
2077
|
+
}>;
|
|
2078
|
+
/**
|
|
2079
|
+
* Revoke an earned reward.
|
|
2080
|
+
*
|
|
2081
|
+
* @param earnedRewardId - The earned reward ID to revoke
|
|
2082
|
+
* @param reason - Reason for revocation
|
|
1994
2083
|
*/
|
|
1995
|
-
|
|
2084
|
+
revoke(earnedRewardId: string, reason: string): Promise<RevokeResult>;
|
|
1996
2085
|
/**
|
|
1997
2086
|
* Upload an asset for a reward (image, metadata JSON)
|
|
1998
2087
|
*/
|
|
@@ -3268,4 +3357,4 @@ declare class TimeoutError extends ProofChainError {
|
|
|
3268
3357
|
constructor(message?: string);
|
|
3269
3358
|
}
|
|
3270
3359
|
|
|
3271
|
-
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };
|
|
3360
|
+
export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type NFT, NetworkError, NotFoundError, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardDefinition, type RewardEarned, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StreamAck, type StreamEventRequest, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };
|
package/dist/index.js
CHANGED
|
@@ -1466,42 +1466,133 @@ var RewardsClient = class {
|
|
|
1466
1466
|
return this.http.get(`/rewards/earned?${params.toString()}`);
|
|
1467
1467
|
}
|
|
1468
1468
|
/**
|
|
1469
|
-
* Get earned rewards for a user (with full badge/reward details)
|
|
1469
|
+
* Get earned rewards for a user (with full badge/reward details).
|
|
1470
|
+
* Use this to display a user's reward collection on a dedicated screen.
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* ```ts
|
|
1474
|
+
* // All user rewards
|
|
1475
|
+
* const all = await client.rewards.getUserRewards('user-123');
|
|
1476
|
+
*
|
|
1477
|
+
* // Only badges in the "Fan Pass" category
|
|
1478
|
+
* const badges = await client.rewards.getUserRewards('user-123', {
|
|
1479
|
+
* reward_type: 'badge',
|
|
1480
|
+
* category: 'Fan Pass',
|
|
1481
|
+
* });
|
|
1482
|
+
*
|
|
1483
|
+
* // Only distributed rewards
|
|
1484
|
+
* const distributed = await client.rewards.getUserRewards('user-123', {
|
|
1485
|
+
* status: 'distributed',
|
|
1486
|
+
* });
|
|
1487
|
+
* ```
|
|
1470
1488
|
*/
|
|
1471
1489
|
async getUserRewards(userId, options = {}) {
|
|
1472
1490
|
const params = new URLSearchParams();
|
|
1473
1491
|
if (options.status) params.append("status", options.status);
|
|
1474
1492
|
if (options.reward_type) params.append("reward_type", options.reward_type);
|
|
1493
|
+
if (options.category) params.append("category", options.category);
|
|
1475
1494
|
const query = params.toString();
|
|
1476
1495
|
return this.http.get(`/rewards/users/${userId}/rewards${query ? "?" + query : ""}`);
|
|
1477
1496
|
}
|
|
1478
1497
|
/**
|
|
1479
|
-
* Get the public reward catalog (active, public reward definitions)
|
|
1498
|
+
* Get the public reward catalog (active, public reward definitions).
|
|
1480
1499
|
* Available to both API key and end-user JWT clients.
|
|
1500
|
+
*
|
|
1501
|
+
* @param category - Optional category filter (e.g. "Fan Pass", "Partner: Acme")
|
|
1502
|
+
*
|
|
1503
|
+
* @example
|
|
1504
|
+
* ```ts
|
|
1505
|
+
* // All available rewards
|
|
1506
|
+
* const all = await client.rewards.getCatalog();
|
|
1507
|
+
*
|
|
1508
|
+
* // Only "Fan Pass" rewards
|
|
1509
|
+
* const fanPass = await client.rewards.getCatalog('Fan Pass');
|
|
1510
|
+
* ```
|
|
1481
1511
|
*/
|
|
1482
|
-
async getCatalog() {
|
|
1483
|
-
|
|
1512
|
+
async getCatalog(category) {
|
|
1513
|
+
const params = new URLSearchParams();
|
|
1514
|
+
if (category) params.append("category", category);
|
|
1515
|
+
const query = params.toString();
|
|
1516
|
+
return this.http.get(`/rewards/catalog${query ? "?" + query : ""}`);
|
|
1484
1517
|
}
|
|
1485
1518
|
/**
|
|
1486
1519
|
* Claim a lazy-minted NFT reward.
|
|
1487
1520
|
* The wallet_address receives the minted NFT. The tenant's treasury pays gas.
|
|
1488
1521
|
* Available to both API key and end-user JWT clients (scoped to own rewards).
|
|
1522
|
+
*
|
|
1523
|
+
* For non-NFT rewards, use {@link distribute} instead.
|
|
1489
1524
|
*/
|
|
1490
|
-
async
|
|
1525
|
+
async claimNFT(earnedRewardId, walletAddress) {
|
|
1491
1526
|
return this.http.post(`/rewards/earned/${earnedRewardId}/claim?wallet_address=${encodeURIComponent(walletAddress)}`, {});
|
|
1492
1527
|
}
|
|
1493
1528
|
/**
|
|
1494
|
-
*
|
|
1529
|
+
* @deprecated Use {@link claimNFT} instead — this method only works for lazy-mint NFTs.
|
|
1495
1530
|
*/
|
|
1496
|
-
async
|
|
1531
|
+
async claimReward(earnedRewardId, walletAddress) {
|
|
1532
|
+
return this.claimNFT(earnedRewardId, walletAddress);
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Manually award rewards to one or more users.
|
|
1536
|
+
* Works for all reward types: points, tokens, NFTs, badges, custom.
|
|
1537
|
+
*
|
|
1538
|
+
* @example
|
|
1539
|
+
* ```ts
|
|
1540
|
+
* // Award a badge to two users
|
|
1541
|
+
* const rewards = await client.rewards.award({
|
|
1542
|
+
* definition_id: 'badge-def-id',
|
|
1543
|
+
* user_ids: ['user-1', 'user-2'],
|
|
1544
|
+
* distribute_immediately: true,
|
|
1545
|
+
* });
|
|
1546
|
+
* ```
|
|
1547
|
+
*/
|
|
1548
|
+
async award(request) {
|
|
1497
1549
|
return this.http.post("/rewards/award", request);
|
|
1498
1550
|
}
|
|
1499
1551
|
/**
|
|
1500
|
-
*
|
|
1552
|
+
* @deprecated Use {@link award} instead.
|
|
1501
1553
|
*/
|
|
1502
|
-
async
|
|
1554
|
+
async awardManual(request) {
|
|
1555
|
+
return this.award(request);
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Distribute a pending or failed reward.
|
|
1559
|
+
* Works for all reward types — triggers the appropriate distribution
|
|
1560
|
+
* (mint NFT, transfer tokens, issue badge, credit points, etc.).
|
|
1561
|
+
*
|
|
1562
|
+
* @example
|
|
1563
|
+
* ```ts
|
|
1564
|
+
* // Distribute a pending reward
|
|
1565
|
+
* const result = await client.rewards.distribute('earned-reward-id');
|
|
1566
|
+
* ```
|
|
1567
|
+
*/
|
|
1568
|
+
async distribute(earnedRewardId) {
|
|
1503
1569
|
return this.http.post(`/rewards/earned/${earnedRewardId}/distribute`, {});
|
|
1504
1570
|
}
|
|
1571
|
+
/**
|
|
1572
|
+
* @deprecated Use {@link distribute} instead.
|
|
1573
|
+
*/
|
|
1574
|
+
async distributePending(earnedRewardId) {
|
|
1575
|
+
return this.distribute(earnedRewardId);
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Distribute all pending rewards for the tenant.
|
|
1579
|
+
* Queues every pending reward for background distribution.
|
|
1580
|
+
*/
|
|
1581
|
+
async distributeAll() {
|
|
1582
|
+
return this.http.post("/rewards/distribute-all-pending", {});
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Revoke an earned reward.
|
|
1586
|
+
*
|
|
1587
|
+
* @param earnedRewardId - The earned reward ID to revoke
|
|
1588
|
+
* @param reason - Reason for revocation
|
|
1589
|
+
*/
|
|
1590
|
+
async revoke(earnedRewardId, reason) {
|
|
1591
|
+
return this.http.post(
|
|
1592
|
+
`/rewards/earned/${earnedRewardId}/revoke?reason=${encodeURIComponent(reason)}`,
|
|
1593
|
+
{}
|
|
1594
|
+
);
|
|
1595
|
+
}
|
|
1505
1596
|
// ---------------------------------------------------------------------------
|
|
1506
1597
|
// Reward Assets
|
|
1507
1598
|
// ---------------------------------------------------------------------------
|
package/dist/index.mjs
CHANGED
|
@@ -1411,42 +1411,133 @@ var RewardsClient = class {
|
|
|
1411
1411
|
return this.http.get(`/rewards/earned?${params.toString()}`);
|
|
1412
1412
|
}
|
|
1413
1413
|
/**
|
|
1414
|
-
* Get earned rewards for a user (with full badge/reward details)
|
|
1414
|
+
* Get earned rewards for a user (with full badge/reward details).
|
|
1415
|
+
* Use this to display a user's reward collection on a dedicated screen.
|
|
1416
|
+
*
|
|
1417
|
+
* @example
|
|
1418
|
+
* ```ts
|
|
1419
|
+
* // All user rewards
|
|
1420
|
+
* const all = await client.rewards.getUserRewards('user-123');
|
|
1421
|
+
*
|
|
1422
|
+
* // Only badges in the "Fan Pass" category
|
|
1423
|
+
* const badges = await client.rewards.getUserRewards('user-123', {
|
|
1424
|
+
* reward_type: 'badge',
|
|
1425
|
+
* category: 'Fan Pass',
|
|
1426
|
+
* });
|
|
1427
|
+
*
|
|
1428
|
+
* // Only distributed rewards
|
|
1429
|
+
* const distributed = await client.rewards.getUserRewards('user-123', {
|
|
1430
|
+
* status: 'distributed',
|
|
1431
|
+
* });
|
|
1432
|
+
* ```
|
|
1415
1433
|
*/
|
|
1416
1434
|
async getUserRewards(userId, options = {}) {
|
|
1417
1435
|
const params = new URLSearchParams();
|
|
1418
1436
|
if (options.status) params.append("status", options.status);
|
|
1419
1437
|
if (options.reward_type) params.append("reward_type", options.reward_type);
|
|
1438
|
+
if (options.category) params.append("category", options.category);
|
|
1420
1439
|
const query = params.toString();
|
|
1421
1440
|
return this.http.get(`/rewards/users/${userId}/rewards${query ? "?" + query : ""}`);
|
|
1422
1441
|
}
|
|
1423
1442
|
/**
|
|
1424
|
-
* Get the public reward catalog (active, public reward definitions)
|
|
1443
|
+
* Get the public reward catalog (active, public reward definitions).
|
|
1425
1444
|
* Available to both API key and end-user JWT clients.
|
|
1445
|
+
*
|
|
1446
|
+
* @param category - Optional category filter (e.g. "Fan Pass", "Partner: Acme")
|
|
1447
|
+
*
|
|
1448
|
+
* @example
|
|
1449
|
+
* ```ts
|
|
1450
|
+
* // All available rewards
|
|
1451
|
+
* const all = await client.rewards.getCatalog();
|
|
1452
|
+
*
|
|
1453
|
+
* // Only "Fan Pass" rewards
|
|
1454
|
+
* const fanPass = await client.rewards.getCatalog('Fan Pass');
|
|
1455
|
+
* ```
|
|
1426
1456
|
*/
|
|
1427
|
-
async getCatalog() {
|
|
1428
|
-
|
|
1457
|
+
async getCatalog(category) {
|
|
1458
|
+
const params = new URLSearchParams();
|
|
1459
|
+
if (category) params.append("category", category);
|
|
1460
|
+
const query = params.toString();
|
|
1461
|
+
return this.http.get(`/rewards/catalog${query ? "?" + query : ""}`);
|
|
1429
1462
|
}
|
|
1430
1463
|
/**
|
|
1431
1464
|
* Claim a lazy-minted NFT reward.
|
|
1432
1465
|
* The wallet_address receives the minted NFT. The tenant's treasury pays gas.
|
|
1433
1466
|
* Available to both API key and end-user JWT clients (scoped to own rewards).
|
|
1467
|
+
*
|
|
1468
|
+
* For non-NFT rewards, use {@link distribute} instead.
|
|
1434
1469
|
*/
|
|
1435
|
-
async
|
|
1470
|
+
async claimNFT(earnedRewardId, walletAddress) {
|
|
1436
1471
|
return this.http.post(`/rewards/earned/${earnedRewardId}/claim?wallet_address=${encodeURIComponent(walletAddress)}`, {});
|
|
1437
1472
|
}
|
|
1438
1473
|
/**
|
|
1439
|
-
*
|
|
1474
|
+
* @deprecated Use {@link claimNFT} instead — this method only works for lazy-mint NFTs.
|
|
1440
1475
|
*/
|
|
1441
|
-
async
|
|
1476
|
+
async claimReward(earnedRewardId, walletAddress) {
|
|
1477
|
+
return this.claimNFT(earnedRewardId, walletAddress);
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Manually award rewards to one or more users.
|
|
1481
|
+
* Works for all reward types: points, tokens, NFTs, badges, custom.
|
|
1482
|
+
*
|
|
1483
|
+
* @example
|
|
1484
|
+
* ```ts
|
|
1485
|
+
* // Award a badge to two users
|
|
1486
|
+
* const rewards = await client.rewards.award({
|
|
1487
|
+
* definition_id: 'badge-def-id',
|
|
1488
|
+
* user_ids: ['user-1', 'user-2'],
|
|
1489
|
+
* distribute_immediately: true,
|
|
1490
|
+
* });
|
|
1491
|
+
* ```
|
|
1492
|
+
*/
|
|
1493
|
+
async award(request) {
|
|
1442
1494
|
return this.http.post("/rewards/award", request);
|
|
1443
1495
|
}
|
|
1444
1496
|
/**
|
|
1445
|
-
*
|
|
1497
|
+
* @deprecated Use {@link award} instead.
|
|
1446
1498
|
*/
|
|
1447
|
-
async
|
|
1499
|
+
async awardManual(request) {
|
|
1500
|
+
return this.award(request);
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Distribute a pending or failed reward.
|
|
1504
|
+
* Works for all reward types — triggers the appropriate distribution
|
|
1505
|
+
* (mint NFT, transfer tokens, issue badge, credit points, etc.).
|
|
1506
|
+
*
|
|
1507
|
+
* @example
|
|
1508
|
+
* ```ts
|
|
1509
|
+
* // Distribute a pending reward
|
|
1510
|
+
* const result = await client.rewards.distribute('earned-reward-id');
|
|
1511
|
+
* ```
|
|
1512
|
+
*/
|
|
1513
|
+
async distribute(earnedRewardId) {
|
|
1448
1514
|
return this.http.post(`/rewards/earned/${earnedRewardId}/distribute`, {});
|
|
1449
1515
|
}
|
|
1516
|
+
/**
|
|
1517
|
+
* @deprecated Use {@link distribute} instead.
|
|
1518
|
+
*/
|
|
1519
|
+
async distributePending(earnedRewardId) {
|
|
1520
|
+
return this.distribute(earnedRewardId);
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Distribute all pending rewards for the tenant.
|
|
1524
|
+
* Queues every pending reward for background distribution.
|
|
1525
|
+
*/
|
|
1526
|
+
async distributeAll() {
|
|
1527
|
+
return this.http.post("/rewards/distribute-all-pending", {});
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Revoke an earned reward.
|
|
1531
|
+
*
|
|
1532
|
+
* @param earnedRewardId - The earned reward ID to revoke
|
|
1533
|
+
* @param reason - Reason for revocation
|
|
1534
|
+
*/
|
|
1535
|
+
async revoke(earnedRewardId, reason) {
|
|
1536
|
+
return this.http.post(
|
|
1537
|
+
`/rewards/earned/${earnedRewardId}/revoke?reason=${encodeURIComponent(reason)}`,
|
|
1538
|
+
{}
|
|
1539
|
+
);
|
|
1540
|
+
}
|
|
1450
1541
|
// ---------------------------------------------------------------------------
|
|
1451
1542
|
// Reward Assets
|
|
1452
1543
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED