> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackfront.digital/llms.txt
> Use this file to discover all available pages before exploring further.

# Types Reference

# Types Reference

All TypeScript types are exported from the SDK:

```ts theme={null}
import type { SdkConfigResponse, SdkBranding, ProductReview } from 'react-native-stackfront-sdk';
```

## SDK Config

```ts theme={null}
interface SdkConfigResponse {
  storefrontToken: string;
  shopDomain: string;
  branding: SdkBranding;
  homeLayout: SdkHomeLayout;
  banners: SdkBanner[];
  activePopups: SdkPopup[];
  activeAnnouncements: SdkAnnouncement[];
  featureFlags: SdkFeatureFlags;
  oneSignalAppId: string;
  integrations: Record<string, SdkIntegrationSource>;
  billing: SdkBillingInfo;
}
```

## Branding

```ts theme={null}
interface SdkBranding {
  primaryColor: string;
  secondaryColor: string;
  accentColor: string;
  backgroundColor: string;
  textColor: string;
  logoUrl: string | null;
  splashUrl: string | null;
  fontFamily: string;
  darkModeEnabled: boolean;
}
```

## Home Layout

```ts theme={null}
interface SdkHomeLayoutSection {
  id: string;
  type: string;
  enabled: boolean;
  order: number;
  config: Record<string, unknown> | null;
}

interface SdkHomeLayout {
  sections: SdkHomeLayoutSection[];
}
```

## UI Elements

```ts theme={null}
interface SdkBanner {
  id: string;
  title: string | null;
  subtitle: string | null;
  imageUrl: string;
  mobileImageUrl: string | null;
  actionPayload: Record<string, unknown> | null;
  order: number;
}

interface SdkPopup {
  id: string;
  type: string;
  title: string;
  body: string;
  imageUrl: string | null;
  ctaLabel: string | null;
  ctaActionPayload: Record<string, unknown> | null;
  dismissLabel: string;
  discountCode: string | null;
  triggerType: string;
  triggerDelaySeconds: number;
  showFrequency: string;
}

interface SdkAnnouncement {
  id: string;
  message: string;
  backgroundColor: string | null;
  textColor: string | null;
  actionPayload: Record<string, unknown> | null;
  order: number;
}
```

## Feature Flags

```ts theme={null}
interface SdkFeatureFlags {
  storiesEnabled: boolean;
  loyaltyEnabled: boolean;
  reviewsEnabled: boolean;
  wishlistEnabled: boolean;
  announcementsEnabled: boolean;
  popupsEnabled: boolean;
  abandonedCartEnabled: boolean;
  liveVisitorCountEnabled: boolean;
  recentPurchasePopupEnabled: boolean;
  subscriptionsEnabled: boolean;
}
```

## Billing

```ts theme={null}
interface SdkBillingInfo {
  planName: string;
  subscriptionStatus: string;
  upgradeUrl?: string;
}
```

## Push Notifications

```ts theme={null}
interface RegisterDeviceRequest {
  oneSignalPlayerId: string;
  platform: 'iOS' | 'Android';
  customerId?: string;
  customerEmail?: string;
  appVersion?: string;
  deviceModel?: string;
  osVersion?: string;
}

interface UnsubscribeDeviceRequest {
  oneSignalPlayerId: string;
}

interface LinkCustomerRequest {
  oneSignalPlayerId: string;
  customerId: string;
}

interface NotificationPreference {
  id: string;
  merchantId: string;
  customerId: string;
  marketingEnabled: boolean;
  transactionalEnabled: boolean;
  abandonedCartEnabled: boolean;
  orderUpdatesEnabled: boolean;
  promotionsEnabled: boolean;
  updatedAt: string;
}

interface UpdatePreferencesRequest {
  marketingEnabled: boolean;
  transactionalEnabled: boolean;
  abandonedCartEnabled: boolean;
  orderUpdatesEnabled: boolean;
  promotionsEnabled: boolean;
}
```

## Events

```ts theme={null}
interface SdkEvent {
  eventType: string;
  customerId?: string;
  oneSignalPlayerId?: string;
  platform: 'iOS' | 'Android';
  appVersion?: string;
  sessionId?: string;
  properties?: Record<string, unknown>;
  occurredAt: string;
}

interface SdkEventsBatchRequest {
  events: SdkEvent[];
}

interface SdkEventsBatchResponse {
  acceptedCount: number;
}
```

## Products

```ts theme={null}
// Product types correspond to Shopify Storefront API Product type.
// See graphql/index.ts for the exact query shapes.
```

## Reviews

```ts theme={null}
interface ProductReview {
  id: string;
  productId: string;
  productHandle: string;
  customerId: string | null;
  customerName: string;
  rating: number;
  title: string | null;
  body: string | null;
  mediaItems: ReviewMediaItem[];
  status: string;
  isVerifiedPurchase: boolean;
  helpfulCount: number;
  replyText: string | null;
  repliedAt: string | null;
  createdAt: string;
  updatedAt: string;
}

interface ReviewMediaItem {
  r2Key: string;
  type: string;
  url: string | null;
}

interface CreateProductReviewRequest {
  productId: string;
  productHandle: string;
  customerId?: string;
  customerEmail?: string;
  customerName: string;
  rating: number;
  title?: string;
  body?: string;
}

interface ProductReviewsSdkResponse {
  reviews: ProductReview[];
  averageRating: number;
  totalReviews: number;
  ratingDistribution: Record<string, number>;
}

interface ReviewHelpfulRequest {
  oneSignalPlayerId?: string;
}
```

## Loyalty & Referrals

```ts theme={null}
interface LoyaltyAccountSdkResponse {
  pointsBalance: number;
  lifetimePointsEarned: number;
  tier: LoyaltyTierSdkResponse | null;
  nextTier: NextTierSdkResponse | null;
  referralCode: string;
  programName: string;
}

interface LoyaltyTierSdkResponse {
  name: string;
  badgeColor: string;
  multiplier: number;
}

interface NextTierSdkResponse {
  name: string;
  pointsRequired: number;
  pointsRemaining: number;
}

interface LoyaltyTransactionResponse {
  id: string;
  type: string;
  points: number;
  balanceAfter: number;
  description: string;
  orderId: string | null;
  expiresAt: string | null;
  createdAt: string;
}

interface RedeemPointsRequest {
  customerId: string;
  pointsToRedeem: number;
  orderTotal: number;
}

interface RedeemPointsResponse {
  discountCode: string;
  discountValue: number;
  pointsRedeemed: number;
  remainingBalance: number;
}

interface ReferralSdkResponse {
  referralCode: string;
  totalClicks: number;
  totalConversions: number;
  pointsEarnedFromReferrals: number;
}

interface TrackReferralRequest {
  referralCode: string;
  refereeCustomerId?: string;
  refereeEmail?: string;
}
```

## Stories

```ts theme={null}
interface SdkStoryDto {
  id: string;
  type: string;
  mediaUrl: string;
  description: string | null;
  productHandle: string | null;
  durationSeconds: number;
  order: number;
  backgroundColor: string | null;
  elements: StoryElement[];
  actionPayload: Record<string, unknown> | null;
}

interface SdkStoryGroupDto {
  id: string;
  title: string;
  coverImageUrl: string | null;
  order: number;
  stories: SdkStoryDto[];
}

interface SdkStoriesResponse {
  storyGroups: SdkStoryGroupDto[];
}

interface StoryElement {
  id: string;
  type: string;
  positionX: number;
  positionY: number;
  config: Record<string, unknown>;
  actionPayload?: Record<string, unknown> | null;
}

interface StoryViewedRequest {
  storyId: string;
  storyGroupId: string;
  watchedFullDuration: boolean;
  customerId?: string;
  oneSignalPlayerId?: string;
}

interface StoryTappedRequest {
  storyId: string;
  elementId: string;
  actionTaken: boolean;
  customerId?: string;
  oneSignalPlayerId?: string;
}

interface StoryPollVoteRequest {
  storyId: string;
  elementId: string;
  optionId: string;
  customerId?: string;
  oneSignalPlayerId?: string;
}

interface PollOptionResult {
  optionId: string;
  label: string;
  voteCount: number;
  percentage: number;
}

interface StoryPollVoteResponse {
  elementId: string;
  options: PollOptionResult[];
}
```

## Social Proof

```ts theme={null}
interface ProductViewEventRequest {
  productId: string;
  oneSignalPlayerId?: string;
}

interface SocialProofSignalsResponse {
  liveViewerCount: number | null;
  recentPurchase: RecentPurchaseSignal | null;
  lowStockBadge: LowStockSignal | null;
}

interface RecentPurchaseSignal {
  customerName: string;
  customerLocation: string;
  productTitle: string;
  timeAgo: string;
}

interface LowStockSignal {
  show: boolean;
  label: string;
}
```

## Integrations

```ts theme={null}
interface IntegrationDataResponse {
  integrationSlug: string;
  dataType: string;
  entityId: string;
  data: string;
  syncedAt: string;
}

interface SdkIntegrationSource {
  source: string;
  connected: boolean;
}
```
