Skip to content
Last updated

PERS SDK - v2.3.26 / Exports

PERS SDK - v2.3.26

Table of contents

Analytics & Reporting Managers

Authentication Managers

Booking Management Managers

Business Management Managers

Campaign Management Managers

Custom Fields Managers

File Management Managers

Notification Managers

Purchase Management Managers

Redemption Management Managers

Token Management Managers

Transaction Management Managers

TriggerSource Management Managers

User Management Managers

Webhook Management Managers

SDK Core

Classes

Enumerations

Functions

Interfaces

References

Notification Services

Webhook Services

DTOs Tenant Management

Type Aliases

Variables

Functions

isFatalAuthErrorInMessage

isFatalAuthErrorInMessage(message): boolean

Check if an error message contains any fatal auth error code. Useful for detecting fatal errors in wrapped/stringified errors.

Parameters

NameType
messagestring

Returns

boolean

Defined in

core/auth/services/auth-service.ts:53


detectWebPlatform

detectWebPlatform(): Platform

Detect web platform from User-Agent (browser environments only)

This uses navigator.userAgent which is only available in browsers. For Node.js or React Native, use platform-specific detection.

Returns

Platform

Example

const platform = detectWebPlatform();
sdk.setPlatform(platform);
// { os: 'macOS', browser: 'Chrome', browserVersion: '125.0', deviceType: 'desktop' }

Defined in

core/data-source/index.ts:57


detectEnvironment

detectEnvironment(): EnvironmentInfo

Detects the current runtime environment

Returns

EnvironmentInfo

Defined in

core/environment.ts:17


warnIfProblematicEnvironment

warnIfProblematicEnvironment(feature): void

Warns if environment might have bundling issues

Parameters

NameType
featurestring

Returns

void

Defined in

core/environment.ts:50


buildApiRoot

buildApiRoot(environment?, version?, customApiUrl?): string

Build the API root URL based on config

Priority:

  1. customApiUrl (if provided)
  2. Environment-based URL (staging/production)

Parameters

NameTypeDefault value
environmentPersEnvironment'production'
version"v2"'v2'
customApiUrl?stringundefined

Returns

string

Defined in

core/pers-config.ts:209


buildWalletEventsWsUrl

buildWalletEventsWsUrl(environment?, customWsUrl?): string

Build wallet events WebSocket URL based on config

Parameters

NameTypeDefault value
environmentPersEnvironment'production'
customWsUrl?stringundefined

Returns

string

Defined in

core/pers-config.ts:232


mergeWithDefaults

mergeWithDefaults(config): PersConfig & Required<Pick<PersConfig, "environment" | "apiVersion" | "timeout" | "retries">>

Merge user config with defaults

Parameters

NameType
configPersConfig

Returns

PersConfig & Required<Pick<PersConfig, "environment" | "apiVersion" | "timeout" | "retries">>

Defined in

core/pers-config.ts:251


createPersEventsClient

createPersEventsClient(config): PersEventsClient

Create a PERS Events client instance

Parameters

NameType
configEventsClientConfig

Returns

PersEventsClient

Defined in

events/pers-events-client.ts:609


createPersSDK

createPersSDK(httpClient, config): PersSDK

Factory function for creating PERS SDK

Parameters

NameTypeDescription
httpClientHttpClientPlatform-specific HTTP client implementation
configPersConfigSDK configuration options

Returns

PersSDK

PERS SDK instance

Defined in

pers-sdk.ts:1275


buildImageUrl

buildImageUrl(url, options?, gateway?): string

Build optimized image URL with automatic IPFS resolution and CDN options

Single entry point for all image URL building:

  • IPFS URIs → resolved via gateway + CDN options applied
  • HTTP URLs → CDN options applied directly

Parameters

NameTypeDescription
urlstringImage URL (ipfs://, https://, or any URL)
options?ImageCdnOptionsCDN optimization options (preset, quality, format, fit)
gateway?stringIPFS gateway domain (required for ipfs:// URLs)

Returns

string

Optimized URL with query parameters

Example

// IPFS thumbnail
buildImageUrl('ipfs://QmHash', { preset: 'thumb' }, 'cdn.example.com')
// => 'https://cdn.example.com/ipfs/QmHash?preset=thumb'

// IPFS hero with high quality
buildImageUrl('ipfs://QmHash', { preset: 'hero', q: 95, fit: 'cover' }, 'cdn.example.com')
// => 'https://cdn.example.com/ipfs/QmHash?preset=hero&q=95&fit=cover'

// HTTP URL (gateway ignored)
buildImageUrl('https://example.com/photo.jpg', { preset: 'card' })
// => 'https://example.com/photo.jpg?preset=card'

// No options - just IPFS resolution
buildImageUrl('ipfs://QmHash', undefined, 'cdn.example.com')
// => 'https://cdn.example.com/ipfs/QmHash'

Defined in

shared/utils/image-url-utils.ts:73


isIpfsUrl

isIpfsUrl(url): boolean

Check if a URL is an IPFS URI

Parameters

NameTypeDescription
urlstringURL to check

Returns

boolean

True if URL starts with ipfs://

Defined in

shared/utils/image-url-utils.ts:102


extractIpfsCid

extractIpfsCid(ipfsUri): string | null

Extract CID from IPFS URI

Parameters

NameTypeDescription
ipfsUristringIPFS URI (ipfs://Qm... or ipfs://baf...)

Returns

string | null

CID string, or null if not a valid IPFS URI

Example

extractIpfsCid('ipfs://QmHash123')
// => 'QmHash123'

extractIpfsCid('https://example.com/image.jpg')
// => null

Defined in

shared/utils/image-url-utils.ts:121


isPaginatedResponse

isPaginatedResponse<T>(response): response is PaginatedResponseDTO<T>

Type guard to check if response is paginated

Type parameters

Name
T

Parameters

NameTypeDescription
responsePaginatedResponseDTO<T> | T[]Either an array or paginated response

Returns

response is PaginatedResponseDTO<T>

True if response is PaginatedResponseDTO

Example

const response = await api.getItems();
if (isPaginatedResponse(response)) {
  console.log(response.pagination.total);
}

Defined in

shared/utils/pagination-utils.ts:69


extractData

extractData<T>(response): T[]

Extract data array from either array or paginated response Use during hybrid backend phase to safely handle both response shapes

Type parameters

Name
T

Parameters

NameTypeDescription
responsePaginatedResponseDTO<T> | T[]Either an array or paginated response

Returns

T[]

Data array

Example

const response = await api.getItems(); // Could be T[] or PaginatedResponseDTO<T>
const items = extractData(response);   // Always T[]

Defined in

shared/utils/pagination-utils.ts:94


extractPagination

extractPagination<T>(response): PaginatedResponseDTO<T>["pagination"] | null

Extract pagination metadata (returns null for array responses)

Type parameters

Name
T

Parameters

NameTypeDescription
responsePaginatedResponseDTO<T> | T[]Either an array or paginated response

Returns

PaginatedResponseDTO<T>["pagination"] | null

Pagination metadata or null

Example

const response = await api.getItems();
const pagination = extractPagination(response);
if (pagination) {
  console.log(`Total: ${pagination.total}`);
}

Defined in

shared/utils/pagination-utils.ts:116


normalizeToPaginated

normalizeToPaginated<T>(response): PaginatedResponseDTO<T>

Normalize any list response to PaginatedResponseDTO format Converts array responses to paginated format during hybrid backend phase

Type parameters

Name
T

Parameters

NameTypeDescription
responsePaginatedResponseDTO<T> | T[]Either an array or paginated response

Returns

PaginatedResponseDTO<T>

Paginated response (normalized if input was array)

Example

// Backend returns array (no pagination params)
const arrayResponse = await api.getItems();
const normalized = normalizeToPaginated(arrayResponse);
console.log(normalized.data);       // Original array
console.log(normalized.pagination); // Generated metadata

// Backend returns paginated (with pagination params)
const paginatedResponse = await api.getItems({ page: 1, limit: 50 });
const normalized2 = normalizeToPaginated(paginatedResponse);
console.log(normalized2); // Same as input (no conversion needed)

Defined in

shared/utils/pagination-utils.ts:143


fetchAllPages

fetchAllPages<T>(fetchFn, limit?, maxPages?): Promise<T[]>

Fetch all pages automatically (useful for infinite scroll or complete datasets)

⚠️ WARNING: Use with caution on large datasets. This will make multiple API calls and load all items into memory. Consider using pagination UI instead.

Type parameters

Name
T

Parameters

NameTypeDefault valueDescription
fetchFn(page: number, limit: number) => Promise<PaginatedResponseDTO<T>>undefinedFunction that fetches a page (must return PaginatedResponseDTO)
limitnumberDEFAULT_PAGE_SIZEItems per page (default: 50)
maxPagesnumber100Safety limit to prevent infinite loops (default: 100)

Returns

Promise<T[]>

All items from all pages

Example

// Fetch all campaigns (use with caution!)
const allCampaigns = await fetchAllPages(
  (page, limit) => sdk.campaigns.getCampaigns({ page, limit }),
  50,  // items per page
  100  // max 100 pages (5000 items)
);

Defined in

shared/utils/pagination-utils.ts:185


getMetadataFromTokenUnitResponse

getMetadataFromTokenUnitResponse(tokenUnit, incrementalId?): TokenMetadataDTO | null

Get metadata from a token unit response Handles metadata-based tokens (ERC-1155 with metadata array)

For metadata-based tokens:

  • Returns the metadata object from token.metadata array
  • Uses provided incrementalId or tokenMetadataIncrementalId from tokenUnit
  • Defaults to index 0 if no incrementalId specified

For standard tokens (no metadata):

  • Returns null

Parameters

NameTypeDescription
tokenUnitTokenUnitDTOThe token unit from campaign or balance
incrementalId?numberOptional metadata index to use (overrides tokenUnit.tokenMetadataIncrementalId)

Returns

TokenMetadataDTO | null

Token metadata object or null

Example

// Get metadata using tokenUnit's incrementalId
const tokenUnit = {
  tokenMetadataIncrementalId: 3,
  token: { 
    metadata: [
      { name: 'Bronze Pass', imageUrl: '...' },
      { name: 'Silver Pass', imageUrl: '...' },
      { name: 'Gold Pass', imageUrl: '...' }
    ]
  }
};
const metadata = getMetadataFromTokenUnitResponse(tokenUnit);
// Returns: { name: 'Bronze Pass', imageUrl: '...' } (index 0 - default)

// Override incrementalId
const metadata2 = getMetadataFromTokenUnitResponse(tokenUnit, 2);
// Returns: { name: 'Gold Pass', imageUrl: '...' } (index 2)

// Standard token (no metadata)
const tokenUnit2 = {
  token: { symbol: 'VQP', name: 'Visit Qatar Points' }
};
const metadata3 = getMetadataFromTokenUnitResponse(tokenUnit2);
// Returns: null

// Display name with fallback
const displayName = metadata?.name || tokenUnit.token?.symbol || 'Reward';

// Display image
const imageUrl = metadata?.imageUrl;

Defined in

token/utils.ts:57


needsExternalSigning

needsExternalSigning(response): boolean

🔍 Check if a transaction response requires external wallet signing

Returns true when the user needs to sign the transaction externally (e.g., via WebAuthn signer app) before it can be submitted.

Parameters

NameType
responseundefined | null | TransactionRequestResponseDTO

Returns

boolean

Example

const response = await sdk.transactions.createTransaction(request);
if (needsExternalSigning(response)) {
  const signingUrl = getSigningUrl(response);
  // Show "Click to Sign" button with signingUrl
}

Defined in

transaction/models/transaction-request.builder.ts:23


needsSubmission

needsSubmission(response): boolean

🔍 Check if a transaction response is signed and ready for submission

Returns true when the user has signed the transaction and it's waiting to be submitted to the blockchain (typically by a business in POS flows).

Parameters

NameType
responseundefined | null | TransactionRequestResponseDTO

Returns

boolean

Example

const response = await sdk.transactions.getTransaction(transactionId);
if (needsSubmission(response)) {
  // Transaction is signed, ready to submit
  await sdk.transactions.submitSignedTransaction({ ... });
}

Defined in

transaction/models/transaction-request.builder.ts:44


getSigningUrl

getSigningUrl(response, options?): string | null

🔗 Get the signing URL from a transaction response

Returns the URL where the user should be redirected to sign the transaction. Optionally appends signOnly=true for POS flows where the signer app should skip the confirmation UI.

Parameters

NameTypeDescription
responseundefined | null | TransactionRequestResponseDTOTransaction response from API
options?ObjectOptional configuration
options.signOnly?booleanIf true, appends signOnly param for POS flows (default: false)

Returns

string | null

Signing URL or null if not available

Example

const signingUrl = getSigningUrl(response, { signOnly: isPOSTransaction });
if (signingUrl) {
  window.open(signingUrl, '_blank');
}

Defined in

transaction/models/transaction-request.builder.ts:70


extractDeadlineFromSigningData

extractDeadlineFromSigningData(signingData): number | null

Helper to extract deadline from transaction signing data Works with EIP-712 typed data structure from counterfactual wallet

Parameters

NameTypeDescription
signingDataunknownThe signing data from TransactionSigningResult

Returns

number | null

Deadline timestamp in seconds, or null if not found

Defined in

transaction/models/transaction-request.builder.ts:126


buildPendingTransactionData

buildPendingTransactionData(transactionId, signature, transactionFormat?): PendingTransactionParams & { txType: typeof PENDING_SUBMISSION }

Build pending transaction data for transfer to business Returns properly typed object ready for serialization (QR code, NFC, deep link, etc.)

Pattern from loyalty app: scan.component.ts

Parameters

NameTypeDefault valueDescription
transactionIdstringundefinedTransaction ID from signing result
signaturestringundefinedUser's signature from WebAuthn
transactionFormatstring'EIP-712'Format (e.g., 'EIP-712')

Returns

PendingTransactionParams & { txType: typeof PENDING_SUBMISSION }

Typed object with txType set to PENDING_SUBMISSION

Defined in

transaction/models/transaction-request.builder.ts:155


buildMintRequest

buildMintRequest(data): TransactionRequestDTO

🎯 Build a MINT transaction request (admin/business endpoint) Creates tokens and assigns them to a recipient account

Parameters

NameTypeDescription
dataObject-
data.amountnumber-
data.contractAddressstring-
data.contractTokenId?string-
data.chainIdnumber-
data.recipientAccountId?string-
data.recipientAccountTypeAccountOwnerType-
data.recipientAccountAddress?string-
data.engagedBusinessId?stringBusiness commercially involved in this transaction (for stats/reporting)
data.context?DynamicContextDynamic context for ERC721 template interpolation and AI prompts. Values become available as {{context.keyName}} placeholders. Special keys: validityDate, validityEndDate, validityDuration

Returns

TransactionRequestDTO

Example

const request = buildMintRequest({
  amount: 100,
  contractAddress: '0x...',
  chainId: 137,
  recipientAccountId: 'user-123',
  recipientAccountType: AccountOwnerType.USER,
  engagedBusinessId: 'business-456' // optional: for tracking which business triggered the mint
});

Example

const request = buildMintRequest({
  amount: 1,
  contractAddress: '0x...',
  contractTokenId: '123', // TokenMetadata ID
  chainId: 137,
  recipientAccountId: 'user-123',
  recipientAccountType: AccountOwnerType.USER,
  context: {
    // Validity control
    validityDate: '2026-04-15T14:00:00Z',
    validityEndDate: '2026-04-20T11:00:00Z',
    // AI prompt placeholders (available as {{context.xxx}})
    guestName: 'John Doe',
    roomNumber: '305',
    awardReason: 'Employee of the Month'
  }
});

Defined in

transaction/models/transaction-request.builder.ts:282


buildBurnRequest

buildBurnRequest(data): TransactionRequestDTO

🎯 Build a BURN transaction request For auth endpoint: sender is handled automatically by backend For admin endpoint: provide senderAccountId/Type to burn on behalf of user

Parameters

NameType
data{ amount: number ; contractAddress: string ; contractTokenId?: string ; chainId: number ; senderAccountId?: string ; senderAccountType?: AccountOwnerType ; senderAccountAddress?: string } & POSAuthorizationOptions

Returns

TransactionRequestDTO

Example

// Auth endpoint (sender auto-resolved)
const request = buildBurnRequest({
  amount: 50,
  contractAddress: '0x...',
  chainId: 137
});

// Admin endpoint (explicit sender)
const request = buildBurnRequest({
  amount: 50,
  contractAddress: '0x...',
  chainId: 137,
  senderAccountId: 'user-123',
  senderAccountType: AccountOwnerType.USER
});

// POS burn (business submits on behalf of user)
const request = buildBurnRequest({
  amount: 50,
  contractAddress: '0x...',
  chainId: 137,
  engagedBusinessId: 'business-456',
  authorizedSubmitterId: 'business-456',
  authorizedSubmitterType: AccountOwnerType.BUSINESS
});

Defined in

transaction/models/transaction-request.builder.ts:349


buildTransferRequest

buildTransferRequest(data): TransactionRequestDTO

🎯 Build a TRANSFER transaction request (business endpoint) Transfers tokens between accounts

Parameters

NameType
data{ amount: number ; contractAddress: string ; contractTokenId?: string ; chainId: number ; senderAccountId?: string ; senderAccountType: AccountOwnerType ; senderAccountAddress?: string ; recipientAccountId?: string ; recipientAccountType: AccountOwnerType ; recipientAccountAddress?: string } & POSAuthorizationOptions

Returns

TransactionRequestDTO

Example

const request = buildTransferRequest({
  amount: 25,
  contractAddress: '0x...',
  chainId: 137,
  senderAccountId: 'user-123',
  senderAccountType: AccountOwnerType.USER,
  recipientAccountId: 'business-456',
  recipientAccountType: AccountOwnerType.BUSINESS
});

Example

const request = buildTransferRequest({
  amount: 25,
  contractAddress: '0x...',
  chainId: 137,
  senderAccountId: 'user-123',
  senderAccountType: AccountOwnerType.USER,
  recipientAccountId: 'business-456',
  recipientAccountType: AccountOwnerType.BUSINESS,
  // POS authorization - allows business to submit the signed transaction
  engagedBusinessId: 'business-456',
  authorizedSubmitterId: 'business-456',
  authorizedSubmitterType: AccountOwnerType.BUSINESS
});

Defined in

transaction/models/transaction-request.builder.ts:411


buildSubmissionRequest

buildSubmissionRequest(params): TransactionSubmissionRequestDTO

🎯 Build a transaction submission request from QR code parameters Handles the logic of mapping signature to the correct field based on transaction format.

Parameters

NameType
paramsObject
params.transactionIdstring
params.transactionFormatstring
params.signaturestring

Returns

TransactionSubmissionRequestDTO

Example

const request = buildSubmissionRequest({
  transactionId: 'tx-123',
  transactionFormat: 'EIP-712',
  signature: '0x...'
});

Defined in

transaction/models/transaction-request.builder.ts:461


buildPOSTransferRequest

buildPOSTransferRequest(data): TransactionRequestDTO

🎯 Build a POS TRANSFER transaction request Convenience function for POS (Point of Sale) scenarios where a business submits a transaction on behalf of a user.

This sets up the authorization fields correctly so the business can submit the user-signed transaction.

Parameters

NameTypeDescription
dataObject-
data.amountnumber-
data.contractAddressstring-
data.contractTokenId?string-
data.chainIdnumber-
data.userIdstringThe user sending tokens
data.userAccountAddress?string-
data.businessIdstringThe business receiving tokens and authorized to submit
data.businessAccountAddress?string-

Returns

TransactionRequestDTO

Example

// Step 1: Create POS transaction (user to business)
const request = buildPOSTransferRequest({
  amount: 100,
  contractAddress: '0x...',
  chainId: 137,
  userId: 'user-123',
  businessId: 'business-456'
});

// Step 2: Prepare and get signing data
const response = await sdk.transactions.prepareClientSignedTransaction(request);

// Step 3: User signs the transaction
const signature = await userWallet.signTypedData(response.signingData);

// Step 4: Business submits the signed transaction
await sdk.transactions.submitSignedTransaction({
  transactionId: response.transaction.id,
  type: 'EIP_712',
  signature
});

Defined in

transaction/models/transaction-request.builder.ts:507


buildPOSBurnRequest

buildPOSBurnRequest(data): TransactionRequestDTO

🎯 Build a POS BURN transaction request Convenience function for POS scenarios where a business facilitates a user burning tokens (e.g., redeeming rewards at point of sale).

This sets up the authorization fields correctly so the business can submit the user-signed burn transaction.

Parameters

NameTypeDescription
dataObject-
data.amountnumber-
data.contractAddressstring-
data.contractTokenId?string-
data.chainIdnumber-
data.userIdstringThe user burning tokens
data.userAccountAddress?string-
data.businessIdstringThe business facilitating the burn and authorized to submit

Returns

TransactionRequestDTO

Example

// Step 1: Create POS burn transaction
const request = buildPOSBurnRequest({
  amount: 1,
  contractAddress: '0x...',
  contractTokenId: '123', // NFT token ID
  chainId: 137,
  userId: 'user-123',
  businessId: 'business-456'
});

// Step 2: Prepare and get signing data
const response = await sdk.transactions.prepareClientSignedTransaction(request);

// Step 3: User signs the transaction
const signature = await userWallet.signTypedData(response.signingData);

// Step 4: Business submits the signed transaction
await sdk.transactions.submitSignedTransaction({
  transactionId: response.transaction.id,
  type: 'EIP_712',
  signature
});

Defined in

transaction/models/transaction-request.builder.ts:571


createUserStatusSDK

createUserStatusSDK(apiClient): Object

Create a complete User Status SDK instance

Parameters

NameTypeDescription
apiClientPersApiClientConfigured PERS API client

Returns

Object

User Status SDK with flattened structure for better DX

NameType
getRemoteUserStatusTypes(options?: PaginationOptions) => Promise<PaginatedResponseDTO<UserStatusTypeDTO>>
getRemoteEarnedUserStatus(options?: PaginationOptions) => Promise<PaginatedResponseDTO<UserStatusTypeDTO>>
createUserStatusType(userStatusType: UserStatusTypeDTO) => Promise<UserStatusTypeDTO>
updateUserStatusType(id: number, userStatusType: UserStatusTypeDTO) => Promise<UserStatusTypeDTO>
deleteUserStatusType(id: number) => Promise<void>
apiUserStatusApi
serviceUserStatusService

Defined in

user-status/index.ts:33

References

ClientTransactionTypeEnum

Renames and re-exports ClientTransactionType

Type Aliases

CampaignClaimFilters

Ƭ CampaignClaimFilters: CampaignClaimQueryParams

Deprecated

Use CampaignClaimQueryParams instead. Will be removed in next major version.

Defined in

campaign/models/index.ts:15


CampaignClaimQueryOptions

Ƭ CampaignClaimQueryOptions: CampaignClaimQueryParams

Deprecated

Use CampaignClaimQueryParams instead. Will be removed in next major version.

Defined in

campaign/models/index.ts:20


CampaignFilterOptionsWithInclude

Ƭ CampaignFilterOptionsWithInclude: CampaignQueryParams

Deprecated

Use CampaignQueryParams instead. Will be removed in next major version.

Defined in

campaign/services/campaign-service.ts:27


CampaignFilterOptions

Ƭ CampaignFilterOptions: CampaignQueryParams

Deprecated

Use CampaignQueryParams instead. Will be removed in next major version.

Defined in

campaign/services/campaign-service.ts:32


SdkErrorCode

Ƭ SdkErrorCode: typeof SdkErrorCodes[keyof typeof SdkErrorCodes]

Defined in

core/errors/index.ts:23


NotificationLevel

Ƭ NotificationLevel: "success" | "error"

Notification level - UI display hint

Defined in

core/events/event-types.ts:25


EventDetails

Ƭ EventDetails: Record<string, unknown>

Event details - untyped bag for logging/debugging

Defined in

core/events/event-types.ts:30


AuthEventType

Ƭ AuthEventType: "login_success" | "logout_success" | "session_restored" | "session_restoration_failed" | "token_refreshed" | "auth_failed"

Auth domain event types

NOTE: Uses lowercase to match backend event format

Defined in

core/events/event-types.ts:41


TransactionEventType

Ƭ TransactionEventType: "transaction_created" | "transaction_submitted" | "transaction_signed" | "transaction_confirmed"

Transaction domain event types

Defined in

core/events/event-types.ts:52


CampaignEventType

Ƭ CampaignEventType: "claim_success" | "campaign_trigger_created" | "campaign_trigger_updated" | "campaign_trigger_deleted" | "campaign_trigger_assigned" | "campaign_trigger_removed" | "trigger_source_assigned" | "campaign_expired"

Campaign domain event types

Defined in

core/events/event-types.ts:61


RedemptionEventType

Ƭ RedemptionEventType: "redeem_success" | "redemption_created" | "redemption_expired"

Redemption domain event types

Defined in

core/events/event-types.ts:74


NotificationEventType

Ƭ NotificationEventType: "notification_pending" | "notification_sent"

Notification domain event types

Defined in

core/events/event-types.ts:124


KnownEventType

Ƭ KnownEventType: AuthEventType | TransactionEventType | CampaignEventType | RedemptionEventType | BusinessEventType | UserEventType | TriggerSourceEventType | WebhookEventType | CustomFieldEventType | NotificationEventType | WalletEventType | ApiErrorType

All known event types

Defined in

core/events/event-types.ts:141


PersEvent

Ƭ PersEvent: SuccessEvent | ErrorEvent

Universal event type - discriminated union based on level

Success events can only use business domains (Domain). Error events can use all domains including technical (ErrorDomain).

Defined in

core/events/event-types.ts:213


EventHandler

Ƭ EventHandler: (event: PersEvent) => void | Promise<void>

Event handler callback (can be sync or async)

Type declaration

▸ (event): void | Promise<void>

Parameters
NameType
eventPersEvent
Returns

void | Promise<void>

Defined in

core/events/event-types.ts:222


Unsubscribe

Ƭ Unsubscribe: () => void

Unsubscribe function

Type declaration

▸ (): void

Returns

void

Defined in

core/events/event-types.ts:227


AnyDomain

Ƭ AnyDomain: Domain | ErrorDomain

All domain types (business + error domains)

Defined in

core/events/event-types.ts:230


SuccessEventInput

Ƭ SuccessEventInput: Omit<SuccessEvent, "id" | "timestamp" | "level">

Success event input (without auto-generated fields and level) Level is automatically set to 'success' by emitSuccess()

Defined in

core/events/event-types.ts:281


ErrorEventInput

Ƭ ErrorEventInput: Omit<ErrorEvent, "id" | "timestamp" | "level">

Error event input (without auto-generated fields and level) Level is automatically set to 'error' by emitError()

Defined in

core/events/event-types.ts:287


PersEnvironment

Ƭ PersEnvironment: "staging" | "production"

PERS API environment targets

Defined in

core/pers-config.ts:15


PersApiVersion

Ƭ PersApiVersion: "v2"

Supported PERS API versions

Defined in

core/pers-config.ts:18


NotificationPendingHandler

Ƭ NotificationPendingHandler: (info: NotificationPendingInfo) => void

Handler for real-time notification wake signals (notification.pending).

Type declaration

▸ (info): void

Parameters
NameType
infoNotificationPendingInfo
Returns

void

Defined in

events/pers-events-client.ts:61


RedemptionRedeemFilters

Ƭ RedemptionRedeemFilters: RedemptionRedeemQueryParams

Deprecated

Use RedemptionRedeemQueryParams instead. Will be removed in next major version.

Defined in

redemption/models/index.ts:27


RedemptionRedeemQueryOptions

Ƭ RedemptionRedeemQueryOptions: RedemptionRedeemQueryParams

Deprecated

Use RedemptionRedeemQueryParams instead. Will be removed in next major version.

Defined in

redemption/models/index.ts:32


RedemptionFilterOptionsWithInclude

Ƭ RedemptionFilterOptionsWithInclude: RedemptionQueryParams

Deprecated

Use RedemptionQueryParams instead. Will be removed in next major version.

Defined in

redemption/services/redemption-service.ts:23


ListResponse

Ƭ ListResponse<T>: T[] | PaginatedResponseDTO<T>

Type alias for hybrid period (backend can return either shape) Use this in API method return types during backend hybrid phase

Example

// During hybrid backend phase
async getItems(): Promise<ListResponse<ItemDTO>> {
  return this.apiClient.get<ListResponse<ItemDTO>>('/items');
}

Type parameters

Name
T

Defined in

shared/utils/pagination-utils.ts:53


TokenMetadataQueryOptions

Ƭ TokenMetadataQueryOptions: TokenMetadataQueryParams

Deprecated

Use TokenMetadataQueryParams instead. Will be removed in next major version.

Defined in

token/api/token-api.ts:19


RewardsFilterOptions

Ƭ RewardsFilterOptions: Omit<TokenMetadataQueryParams, "tokenType">

Filter options for rewards (ERC1155 token metadata) Omits tokenType since it's always ERC1155

Defined in

token/api/token-api.ts:25


StampsFilterOptions

Ƭ StampsFilterOptions: Omit<TokenMetadataQueryParams, "tokenType">

Filter options for stamps (ERC721 token metadata) Omits tokenType since it's always ERC721

Defined in

token/api/token-api.ts:31


TransactionQueryOptions

Ƭ TransactionQueryOptions: TransactionQueryParams

Deprecated

Use TransactionQueryParams instead. Will be removed in next major version.

Defined in

transaction/models/index.ts:20


ClientTransactionType

Ƭ ClientTransactionType: typeof ClientTransactionType[keyof typeof ClientTransactionType]

Defined in

transaction/models/transaction-request.builder.ts:96

transaction/models/transaction-request.builder.ts:102


UserStatusSDK

Ƭ UserStatusSDK: ReturnType<typeof createUserStatusSDK>

Defined in

user-status/index.ts:61


UserQueryOptions

Ƭ UserQueryOptions: UserQueryParams

Deprecated

Use UserQueryParams instead. Will be removed in next major version.

Defined in

user/api/user-api.ts:14

Variables

DPOP_STORAGE_KEYS

Const DPOP_STORAGE_KEYS: Object

Type declaration

NameType
PUBLIC"pers_dpop_public_key"
PRIVATE"pers_dpop_private_key"

Defined in

core/auth/dpop/dpop-manager.ts:5


FATAL_AUTH_CODES

Const FATAL_AUTH_CODES: readonly ["REFRESH_TOKEN_EXPIRED", "REFRESH_TOKEN_REVOKED", "INVALID_TOKEN", "TOKEN_REVOKED"]

Fatal auth error codes that require immediate logout. These indicate the session is completely invalid and cannot be recovered. TOKEN_EXPIRED is NOT in this list - it's the normal "please refresh" case.

Values validated against CommonErrorCodes from @explorins/pers-shared at compile time.

SINGLE SOURCE OF TRUTH - use this constant everywhere, never duplicate these values.

Defined in

core/auth/services/auth-service.ts:42


AUTH_STORAGE_KEYS

Const AUTH_STORAGE_KEYS: Object

Type declaration

NameType
ACCESS_TOKEN"pers_access_token"
REFRESH_TOKEN"pers_refresh_token"
PROVIDER_TOKEN"pers_provider_token"
AUTH_TYPE"pers_auth_type"

Defined in

core/auth/token-storage.ts:8


globalCacheService

Const globalCacheService: CacheService

Defined in

core/cache/cache.service.ts:324


CacheTTL

Const CacheTTL: Object

Type declaration

NameType
SHORTnumber
MEDIUMnumber
LONGnumber
METADATAnumber
GATEWAYnumber
PROVIDERnumber

Defined in

core/cache/index.ts:9


environment

Const environment: EnvironmentInfo

Global environment info (cached)

Defined in

core/environment.ts:45


SdkErrorCodes

Const SdkErrorCodes: Object

SDK-internal error codes for auth flow control These are not backend errors - they're used for SDK-internal state management

Type declaration

NameType
TOKEN_REFRESH_NEEDED"TOKEN_REFRESH_NEEDED"
PROVIDER_TOKEN_REFRESH_NEEDED"PROVIDER_TOKEN_REFRESH_NEEDED"
LOGOUT_REQUIRED"LOGOUT_REQUIRED"
NETWORK_ERROR"NETWORK_ERROR"
API_ERROR"API_ERROR"

Defined in

core/errors/index.ts:15


ApiErrorDetector

Const ApiErrorDetector: Object

Type declaration

NameType
getErrorMessage(error: unknown) => string
getStatusCode(error: unknown) => null | number
isRetryable(error: unknown) => boolean
isAuthError(error: unknown) => boolean

Defined in

core/errors/index.ts:306


DEFAULT_PERS_CONFIG

Const DEFAULT_PERS_CONFIG: Object

Default configuration values

Type declaration

NameType
environment"production"
apiVersion"v2"
timeout30000
retries3
tokenRefreshMargin60
backgroundRefreshThreshold30
captureWalletEventstrue
autoRestoreSessiontrue

Defined in

core/pers-config.ts:189


SDK_NAME

Const SDK_NAME: string = __SDK_NAME__

SDK package name

Defined in

core/version.ts:16


SDK_VERSION

Const SDK_VERSION: string = __SDK_VERSION__

SDK version - injected from package.json at build time

Defined in

core/version.ts:19


SDK_USER_AGENT

Const SDK_USER_AGENT: string

Full SDK identifier for headers

Defined in

core/version.ts:22


ClientTransactionType

Const ClientTransactionType: Object

Client-side transaction types extending backend Web3TransactionType Includes client-specific flows like pending submissions (POS flow)

Pattern follows loyalty app: extend Web3TransactionType with client-side types

Type declaration

NameTypeDescription
PENDING_SUBMISSION"PENDING_SUBMISSION"Transaction signed by user, pending business submission (POS QR flow)

Defined in

transaction/models/transaction-request.builder.ts:96

transaction/models/transaction-request.builder.ts:102