Skip to content

Entity Types

The package exports its entity types from @wallethero/sdk. Import them instead of copying local interfaces; the snippets below show the most important current relationships.

Client and pass ownership

Identity, consent, loyalty enrollment, tier state, and custom fields live on Client. A Pass references a client and stores pass-specific display state.

typescript
import type { Client, Pass } from "@wallethero/sdk";

function describePass(client: Client, pass: Pass) {
  return {
    clientId: client.id,
    workspaceId: client.workspace_id,
    identity: [client.first_name, client.last_name, client.email],
    consent: client.marketing_consent,
    customFields: client.custom_fields,
    loyaltyEnabled: client.loyalty_program_enabled,
    tier: client.tier_name,
    passId: pass.id,
    templateId: pass.pass_template_id,
    passFields: pass.pass_fields,
    appleUrl: pass.apple_pass_url,
    googleUrl: pass.google_pass_url,
  };
}

Pass templates

typescript
import type {
  BackSectionRef,
  BarcodeType,
  Location,
  PassField,
  PassTemplate,
} from "@wallethero/sdk";

function templatePresentation(template: PassTemplate): {
  barcode: BarcodeType | undefined;
  front: PassField[];
  backOrder: BackSectionRef[];
  locations: Location[];
} {
  return {
    barcode: template.barcode_type,
    front: template.front_fields ?? [],
    backOrder: template.back_sections_order ?? [],
    locations: template.locations ?? [],
  };
}

Template values support ${client.<field>}, ${custom_fields.<field>}, ${wallet.points}, ${wallet:<code>.points}, and supported ${loyalty.<field>} placeholders. ${loyalty.points} has been retired.

Projects and workspaces

typescript
import type { Project, Workspace } from "@wallethero/sdk";

function projectSummary(workspace: Workspace, project: Project) {
  return {
    workspace: workspace.name ?? workspace.slug,
    project: project.name,
    templates: project.statistics?.templates_count ?? 0,
    passes: project.statistics?.passes_count ?? 0,
  };
}

Campaign actions

Campaigns target either segment_id or manual_client_ids. Current action types are:

typescript
import type { CampaignActionType } from "@wallethero/sdk";

const supportedActions: CampaignActionType[] = [
  "push_notification",
  "template_switch",
  "custom_field_update",
  "give_reward",
  "assign_tier",
];

Template switches and tier assignments can include duration_days for temporary changes.

Find the exact type

All service request and response types are exported from the package root:

typescript
import type {
  Campaign,
  Client,
  Distribution,
  Pass,
  PassTemplate,
  Referral,
  Reward,
  Segment,
  Tier,
  Transaction,
  WalletType,
  Workspace,
} from "@wallethero/sdk";

Your editor's TypeScript language service is the authoritative reference for optional fields and nested provider-specific types in the installed version.

WalletHero Documentation