# index

> Source: https://devdocs.joy.so/joy-headless-api/sdk-reference/sdk/root/ · Last updated: 2026-11-25

## Classes

### JoyApiError

Error thrown when a Joy Headless API call fails.

`code`/`statusCode` come from the API error envelope when available;
transport-level failures (network reject, malformed body) use code
`NETWORK_ERROR`, non-2xx responses without an error envelope use `HTTP_ERROR`.

#### Extends

- `Error`

#### Constructors

##### Constructor

```ts
new JoyApiError(__namedParameters): JoyApiError;
```

###### Parameters

| Parameter                      | Type                                                               |
| ------------------------------ | ------------------------------------------------------------------ |
| `__namedParameters`            | { `code`: `string`; `message`: `string`; `statusCode`: `number`; } |
| `__namedParameters.code`       | `string`                                                           |
| `__namedParameters.message`    | `string`                                                           |
| `__namedParameters.statusCode` | `number`                                                           |

###### Returns

[`JoyApiError`](#joyapierror)

###### Overrides

`Error.constructor`

#### Properties

##### cause?

```ts
cause?: unknown;
```

###### Inherited from

`Error.cause`

##### code

```ts
readonly code: string;
```

##### message

```ts
message: string;
```

###### Inherited from

`Error.message`

##### name

```ts
name: string;
```

###### Inherited from

`Error.name`

##### stack?

```ts
stack?: string;
```

###### Inherited from

`Error.stack`

##### statusCode

```ts
readonly statusCode: number;
```

##### stackTraceLimit

```ts
static stackTraceLimit: number;
```

The `Error.stackTraceLimit` property specifies the number of stack frames
collected by a stack trace (whether generated by `new Error().stack` or
`Error.captureStackTrace(obj)`).

The default value is `10` but may be set to any valid JavaScript number. Changes
will affect any stack trace captured *after* the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will
not capture any frames.

###### Inherited from

`Error.stackTraceLimit`

#### Methods

##### captureStackTrace()

```ts
static captureStackTrace(targetObject, constructorOpt?): void;
```

Creates a `.stack` property on `targetObject`, which when accessed returns
a string representing the location in the code at which
`Error.captureStackTrace()` was called.

```js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`
```

The first line of the trace will be prefixed with
`${myObject.name}: ${myObject.message}`.

The optional `constructorOpt` argument accepts a function. If given, all frames
above `constructorOpt`, including `constructorOpt`, will be omitted from the
generated stack trace.

The `constructorOpt` argument is useful for hiding implementation
details of error generation from the user. For instance:

```js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
```

###### Parameters

| Parameter         | Type       |
| ----------------- | ---------- |
| `targetObject`    | `object`   |
| `constructorOpt?` | `Function` |

###### Returns

`void`

###### Inherited from

`Error.captureStackTrace`

##### prepareStackTrace()

```ts
static prepareStackTrace(err, stackTraces): any;
```

###### Parameters

| Parameter     | Type          |
| ------------- | ------------- |
| `err`         | `Error`       |
| `stackTraces` | `CallSite`\[] |

###### Returns

`any`

###### See

<https://v8.dev/docs/stack-trace-api#customizing-stack-traces>

###### Inherited from

`Error.prepareStackTrace`

## Interfaces

### Activity

One point-transaction history row (`GET /customer/activities`).

#### Properties

##### couponCode?

```ts
couponCode?: string | null;
```

The coupon this row minted (spend / referral rows), for a click-through to
that coupon's detail. `null` on every row that issued no coupon — the
majority. Absent on older backends.

##### createdAt

```ts
createdAt: string | null;
```

##### customerId?

```ts
customerId?: string | null;
```

This customer's own Joy customer id.

##### discountId?

```ts
discountId?: string | number | null;
```

Minted discount id (redeem rows).

##### email?

```ts
email?: string | null;
```

This customer's own email.

##### event?

```ts
event?: string | null;
```

Earning event key, e.g. `sign_up` / `interact_website`.

##### hasWebhook?

```ts
hasWebhook?: boolean | null;
```

Internal delivery flag.

##### id

```ts
id: string;
```

##### isWebhookSent?

```ts
isWebhookSent?: boolean | null;
```

Internal delivery flag.

##### newPoint?

```ts
newPoint?: number;
```

Point balance immediately after this row.

##### oldPoint?

```ts
oldPoint?: number;
```

Point balance immediately before this row.

##### orderId?

```ts
orderId?: string | null;
```

The Shopify order this row was earned on (numeric id as a string), for the
"view order" click-through. `null` on any row not tied to an order (sign-up,
birthday, manual adjust). Absent on older backends.

##### points

```ts
points: number;
```

Signed — positive for earn, negative for spend/expire.

##### priceRuleId?

```ts
priceRuleId?: string | number | null;
```

Legacy price-rule id (redeem rows).

##### program?

```ts
program?: Record<string, unknown> | null;
```

Embedded program snapshot, when the row carries one.

##### programId?

```ts
programId?: string | null;
```

Source program id.

##### programTitle?

```ts
programTitle?: string | null;
```

Source program title snapshot.

##### rawType?

```ts
rawType?: string | null;
```

Raw `ACTION_*` value (Liquid's `type`), e.g. `redeem_point`/`earn_point`.

##### redeemPoint?

```ts
redeemPoint?: number | null;
```

Points spent (redeem rows).

##### shopId?

```ts
shopId?: string | null;
```

The shop id.

##### shopifyCustomerId?

```ts
shopifyCustomerId?: number | null;
```

This customer's Shopify numeric id.

##### source?

```ts
source?: string | null;
```

How the row was created, e.g. `user` / `source_headless`.

##### statusSentNotification?

```ts
statusSentNotification?: boolean | null;
```

Internal notification flag.

##### title

```ts
title: string;
```

##### type

```ts
type: ActivityType;
```

##### typeCustom?

```ts
typeCustom?: string | null;
```

Custom-program sub-type, when set.

##### updatedAt?

```ts
updatedAt?: string | null;
```

ISO timestamp of last update.

***

### ActivityPage

A page of [Activity](#activity) rows plus its pagination flags.

#### Properties

##### activities

```ts
activities: Activity[];
```

##### pagination

```ts
pagination: Pagination;
```

***

### Address

A customer shipping address as the headless `/customer/addresses` endpoint
returns it (camelCased whitelist — see the backend addressPresenter). The
`isDefault` flag marks the customer's default address.

#### Properties

##### address1

```ts
address1: string;
```

##### address2

```ts
address2: string;
```

##### city

```ts
city: string;
```

##### company

```ts
company: string;
```

##### country

```ts
country: string;
```

##### firstName

```ts
firstName: string;
```

##### id

```ts
id: string | number | null;
```

##### isDefault

```ts
isDefault: boolean;
```

##### lastName

```ts
lastName: string;
```

##### phone

```ts
phone: string;
```

##### province

```ts
province: string;
```

##### provinceCode

```ts
provinceCode: string;
```

##### zip

```ts
zip: string;
```

***

### AddressDeleteResult

Result of `POST /customer/addresses/delete`.

#### Properties

##### deleted

```ts
deleted: boolean;
```

Always true on success — an address that cannot be deleted rejects instead of resolving false.

***

### AddressInput

Input for JoyClient.saveAddress. `id` present -> update that
address, absent -> create a new one — see JoyClient.saveAddress for
the ownership guarantee on an update.

#### Properties

##### address1

```ts
address1: string;
```

##### address2?

```ts
address2?: string;
```

##### city

```ts
city: string;
```

##### company?

```ts
company?: string;
```

##### country

```ts
country: string;
```

##### firstName?

```ts
firstName?: string;
```

##### id?

```ts
id?: string | number;
```

Existing Shopify address id, to update it. Omit to create a new address.

##### isDefault?

```ts
isDefault?: boolean;
```

Set to also make this the customer's default address.

##### lastName?

```ts
lastName?: string;
```

##### phone?

```ts
phone?: string;
```

##### province?

```ts
province?: string;
```

##### provinceCode?

```ts
provinceCode?: string;
```

##### zip?

```ts
zip?: string;
```

***

### AppleWalletPassResult

Result of `POST /customer/wallet-pass/apple`.

#### Properties

##### qrUrl

```ts
qrUrl: string;
```

PNG data URL (`data:image/png;base64,...`) of [url](#url), for surfaces
(e.g. in-store) that show a scannable code instead of a tap link.

##### url

```ts
url: string;
```

Public download link for the generated `.pkpass` file.

***

### AvailableReward

A spending program the customer can redeem now (`GET /customer/rewards`).

#### Properties

##### affordable

```ts
affordable: boolean;
```

Whether the customer can afford the cheapest redemption this program
allows — `minPoints` when there is one, else `pointsCost`.

##### conditionCollectionsGets?

```ts
conditionCollectionsGets?: RewardCollectionRef[];
```

BXGY only: the collections the customer gets. `[]` otherwise.

##### conditionProductsGets?

```ts
conditionProductsGets?: RewardProductRef[];
```

BXGY only: the specific products the customer gets. `[]` otherwise.

The BXGY fine-print rows and the "customer gets" sentence are intentionally
NOT part of this contract: the former is already covered by
[conditions](#conditions) (server-rendered for every reward), and the latter is
only ever built client-side, so map it off these structured fields.

##### conditions

```ts
conditions: string[];
```

The fine print a shopper needs before spending points, rendered
server-side: sale channel, which products it applies to, usable-from date,
minimum order, expiry, usage limit. Always an array — empty means "no
restrictions", and earning programs never carry any.

##### description

```ts
description: string;
```

##### enableMaximumUsesPerOrder?

```ts
enableMaximumUsesPerOrder?: boolean;
```

BXGY only: whether a per-order use cap is set. `false` otherwise.

##### giftProducts

```ts
giftProducts: GiftProduct[];
```

The gifts to choose between when `giftSelectionMode` is `one`; empty
otherwise. Also empty for collection-scoped gifts — those select a
collection rather than a variant, which no storefront can add to a cart.

##### giftSelectionMode

```ts
giftSelectionMode: GiftSelectionMode | null;
```

Null for every reward that isn't a `free_product`.

##### hasLimitCartValue

```ts
hasLimitCartValue: boolean;
```

Dynamic programs only: whether the merchant caps redemption at a percentage
of cart value. When true, the real point ceiling depends on the live cart
total the storefront owns, so [maxPoints](#maxpoints) alone overstates it — feed
[limitCartValue](#limitcartvalue) and the cart total into the slider bound. Always
false on `fixed` programs.

##### iconUrl

```ts
iconUrl: string | null;
```

The merchant's uploaded icon, when they set one. Built-in per-event icons
are not URLs — map those client-side off [rewardType](#rewardtype).

##### impactDashboardUrl?

```ts
impactDashboardUrl?: string | null;
```

Impact reward only: the merchant's public impact dashboard link. `null` otherwise.

##### impactProvider?

```ts
impactProvider?: string | null;
```

Environmental-impact reward only ("Plant a tree"): the provider that fulfils
it. `null` on every other reward type. Absent on older backends.

##### impactQuantity?

```ts
impactQuantity?: number | null;
```

Impact reward only: how many units per redemption. `null` otherwise.

##### impactType?

```ts
impactType?: string | null;
```

Impact reward only: what is created (e.g. `tree`). `null` otherwise.

##### key

```ts
key: string;
```

Program event key — same values as [Program.key](#key-2); map built-in icons off it.

##### limitCartValue

```ts
limitCartValue: number | null;
```

The cap from [hasLimitCartValue](#haslimitcartvalue), as an integer percent 1-100 of cart
value. Null when [hasLimitCartValue](#haslimitcartvalue) is false.

##### maximumUsesPerOrder?

```ts
maximumUsesPerOrder?: number | null;
```

BXGY only: the per-order use cap when [enableMaximumUsesPerOrder](#enablemaximumusesperorder). `null` otherwise.

##### maxPoints

```ts
maxPoints: number | null;
```

Dynamic only, and only when the merchant set a ceiling. Null = unbounded.

##### minPoints

```ts
minPoints: number | null;
```

Dynamic only, and only when the merchant set a floor. Null = unbounded.

##### orderReqQuantity?

```ts
orderReqQuantity?: number | null;
```

BXGY only: how many "buy" items are required. `null` otherwise.

##### pointsCost

```ts
pointsCost: number;
```

`fixed` — the price. `dynamic` — the STEP: how many points buy one
`rewardValue` of discount. Read [redeemType](#redeemtype) before treating it as a
price.

##### programId

```ts
programId: string;
```

##### redeemType

```ts
redeemType: RedeemType;
```

##### rewardType

```ts
rewardType: RewardType | null;
```

##### rewardValue

```ts
rewardValue: number | null;
```

Discount gained per [pointsCost](#pointscost) points.

##### sendRewardToFriend?

```ts
sendRewardToFriend?: boolean;
```

Whether the merchant lets a redeemer gift this coupon on to a friend — drives
the "Send to a friend" button (backend endpoint already exists). `false` when
off. Absent on older backends.

##### sendRewardToFriendAutomationProvider?

```ts
sendRewardToFriendAutomationProvider?: string | null;
```

When the send-to-friend flow routes through an automation, which provider.
`null` when [sendRewardToFriend](#sendrewardtofriend) is off or no provider is configured.

##### title

```ts
title: string;
```

***

### BirthdayClaimResult

Result of `POST /customer/birthday/claim`.

#### Properties

##### claimed

```ts
claimed: boolean;
```

Always true — a declined claim rejects with `CLAIM_UNAVAILABLE`, it never
comes back as `false`. It says the claim was ACCEPTED and nothing more: the
reward is minted asynchronously, so there is no coupon or point total to
report here yet.

***

### BirthdayRewardsResult

Result of `POST /customer/birthday-rewards`.

#### Properties

##### birthdayRewards

```ts
birthdayRewards: BirthdayRewardsMap;
```

The stored map, echoed back — identical to what was sent.

***

### BirthdaySaveResult

Result of `POST /customer/birthday` — the once-per-lifetime birthday DATE save
from the profile screen. A customer who already has a birthday on file rejects
with `ALREADY_SUBMITTED` (never returns here), so treat a resolved result as
"date now stored". Distinct from [BirthdayRewardsResult](#birthdayrewardsresult) (which reward
they picked) and [BirthdayClaimResult](#birthdayclaimresult) (claiming the annual reward).

#### Properties

##### birthday

```ts
birthday: string | null;
```

The stored birthday as `'MM/DD'`, or `null`.

##### dateOfBirth

```ts
dateOfBirth: string | null;
```

The stored `'YYYY-MM-DD'` on shops that collect a year, else `null`.

##### earnedCompleteBirthday

```ts
earnedCompleteBirthday: boolean;
```

Whether saving the date granted the one-time "complete birthday" reward.

##### earnPoint

```ts
earnPoint: number;
```

Points granted by that reward; `0` when none.

***

### Branding

Shop branding colors.

#### Properties

##### primaryColor

```ts
primaryColor: string | null;
```

`null` when the merchant never picked a brand color — fall back to your own theme.

##### secondaryColor

```ts
secondaryColor: string | null;
```

***

### CancelRedeemResult

Result of `POST /customer/rewards/{rewardId}/cancel` — see JoyClient.cancelRedeem.
Same fields as [RevokeRewardResult](#revokerewardresult), plus the balance the refund left.

#### Extends

- [`RevokeRewardResult`](#revokerewardresult)

#### Properties

##### customer

```ts
customer: object;
```

###### point

```ts
point: number;
```

##### refundedPoints

```ts
refundedPoints: number;
```

Points returned to the customer's balance.

###### Inherited from

[`RevokeRewardResult`](#revokerewardresult).[`refundedPoints`](#refundedpoints-1)

##### rewardId

```ts
rewardId: string;
```

###### Inherited from

[`RevokeRewardResult`](#revokerewardresult).[`rewardId`](#rewardid-3)

##### status

```ts
status: "revoked";
```

###### Inherited from

[`RevokeRewardResult`](#revokerewardresult).[`status`](#status-8)

***

### Customer

Personalised customer state (`GET /customer`).

#### Properties

##### assignedTierId?

```ts
assignedTierId?: string | null;
```

The customer's OWN stored tier id, or `null` when they have none (a guest).
Unlike [Customer.tier](#tier) it is never the resolved/fallback tier (a
non-member or a stale id still reports a `tier`), so a client that must
reproduce the Liquid tier lookup (the points calculator) reads this first.
Optional only for old-server compatibility: absent on a backend that
predates the field — fall back to `tier?.id`. An explicit `null` is a real
value ("no tier"), not absence. Not named `tierId` on purpose: older
clients treat a present `tierId` as authoritative.

##### avatarUrl

```ts
avatarUrl: string | null;
```

Avatar image URL, or `null` when the customer has none. The SAME field name
the storefront builders read, so it flows through beat-1 (`getCustomer`) and
beat-2 (`/info`) identically without a name remap.

##### birthday

```ts
birthday: string | null;
```

`'MM/DD'`, set once via `earnCustomer()` (birthday event) or the popup
equivalent. KNOWN QUIRK, ported faithfully: once set, it can never be
changed — the guard's own message says "once per year", but there is no
year check or reset job behind it, so it is a ONE-TIME submission in
practice. Treat a non-null value here as permanently locked, not just
locked for this year.

##### createdApplePass

```ts
createdApplePass: boolean;
```

Whether this customer has an Apple Wallet pass on file, created via
JoyClient.createApplePass. Combine with
[qrCodeDownloadApplePass](#qrcodedownloadapplepass) to decide whether to show an "Add to
Apple Wallet" button or a re-download QR code.

##### dateOfBirth

```ts
dateOfBirth: string | null;
```

`'YYYY-MM-DD'`. Only ever set on shops asking for a year
([ShopConfig.isNewFormatDOB](#isnewformatdob)); `null` on shops that only collect
day/month.

##### earningLimit

```ts
earningLimit: EarningLimit | null;
```

The shop's global (shop+customer scoped, NOT per-program) earning limit.
`null` when the shop has this feature off. Purpose-built for shoppers —
NOT the shop's limit configuration (max points, timeframe, tier table),
which this contract never exposes.

##### excludedFromLoyalty?

```ts
excludedFromLoyalty?: boolean;
```

`true` when the customer left the loyalty program (`type` still reports
`'guest'` for them) or is excluded by a membership segment. A storefront
block that mirrors the Liquid widget (the points calculator) hides itself
for such a customer. Optional only for old-server compatibility: absent on
payloads from a backend that predates the field — treat absent as `false`.

##### id

```ts
id: string;
```

##### marketingConsent

```ts
marketingConsent: boolean | null;
```

Whether this customer has ever synced as subscribed to marketing emails.
`null` when never synced (unknown), distinct from `false` (synced, not
subscribed). Use this ONLY to show opt-in state and disable an
already-checked opt-in control — the server can only ever subscribe a
customer, never unsubscribe one, so a client must NOT offer an
"unsubscribe" affordance driven by this field.

##### memberSince

```ts
memberSince: string | null;
```

ISO date-time, or `null` when unknown.

##### phone?

```ts
phone?: string | null;
```

The customer's phone (Shopify-synced), or `null` when none is on file. Also
echoed by JoyClient.updateProfile so a just-saved phone reads back
identically. Absent on older payloads.

##### points

```ts
points: number;
```

Current spendable balance.

##### qrCodeDownloadApplePass

```ts
qrCodeDownloadApplePass: string | null;
```

PNG data URL (`data:image/png;base64,...`) of the customer's Apple Wallet
pass download link, pre-rendered server-side. `null` when
[createdApplePass](#createdapplepass) is false. The SAME value
JoyClient.createApplePass returns as `qrUrl` on creation — this
field is what lets a later JoyClient.getCustomer re-show it
without re-generating the pass.

##### smsMarketingConsent

```ts
smsMarketingConsent: boolean | null;
```

Whether this customer has ever synced as subscribed to marketing SMS.
`null` when never synced (unknown), distinct from `false` (synced, not
subscribed). Same opt-in-only semantics as [marketingConsent](#marketingconsent) — use
it ONLY to show opt-in state and disable an already-checked control.

##### social

```ts
social: CustomerSocial;
```

Which social accounts are linked — the state the Instagram / LINE /
Facebook modals branch on. ALWAYS present, never null: "not linked" is a
known state for every customer, so read `customer.social.lineLinked`
unguarded.

##### tier

```ts
tier: CustomerTierRef | null;
```

##### tierPoint?

```ts
tierPoint?: number;
```

The tier-progress running total the tier ring is drawn from — the core
recomputes the ring off this rather than trusting [TierProgress.percentage](#percentage-1)
alone. `0` (not null) when the customer is below the first threshold. Absent
on older payloads.

##### tierProgress

```ts
tierProgress: TierProgress | null;
```

##### totalEarned

```ts
totalEarned: number | null;
```

##### totalOrders?

```ts
totalOrders?: number;
```

Lifetime order count (backend emits `totalOrders`, sourced from the
customer's Firestore `orderCount`). Drives the profile "Total orders" tile —
the core falls back to `customer.totalOrders` when the Liquid-injected
`orders_count` is absent, which on headless it
always is. Absent on older payloads.

##### type

```ts
type: CustomerType;
```

Whether this customer has joined the loyalty program. See [CustomerType](#customertype-1).

***

### CustomerRewards

`GET /customer/rewards`. Two lists, not one: merging them showed a
just-redeemed reward twice in the same grid.

#### Extended by

- [`CustomerRewardsPage`](https://devdocs.joy.so/joy-headless-api/sdk-reference/sdk/client/#customerrewardspage)

#### Properties

##### available

```ts
available: AvailableReward[];
```

##### customerPoints

```ts
customerPoints: number;
```

The customer's balance, so a `dynamic` reward's slider can stop at the
largest whole step they can afford without a second call to `/customer`.

##### redeemed

```ts
redeemed: RedeemedReward[];
```

***

### CustomerSocial

`Customer.social` — see [Customer.social](#social). Deliberately NOT a dump of
the raw social fields: `lineUserId` and the Messenger Page-Scoped User ID are
third-party identifiers a client only ever needs a yes/no answer about, so
only the booleans cross the wire.

#### Properties

##### facebookConnected

```ts
facebookConnected: boolean;
```

Whether the customer has a Messenger link that is still USABLE — they
linked one AND it is scoped to the page the shop currently has connected.
Resolved server-side, so it reports false (not a stale true) once a
merchant reconnects a different page and every stored link goes
unreachable.

##### facebookName

```ts
facebookName: string | null;
```

Display name Meta returned when the link was made, for a "Connected as
{name}" label. `null` when [facebookConnected](#facebookconnected) is false, and null
when Meta sent no name — render a bare "Connected" in that case.

##### instagramUsername

```ts
instagramUsername: string | null;
```

The handle the customer entered via JoyClient.linkInstagram; `null`
when they never linked one, or unlinked. Unlike the LINE/Facebook fields
this IS the raw value, because the modal renders it — it pre-fills the
input and prints the current username. Never verified for ownership:
Instagram linking is a self-declared string, not OAuth.

##### lineFollowedOA

```ts
lineFollowedOA: boolean;
```

Whether the customer also follows the shop's LINE Official Account. A
SEPARATE step from [lineLinked](#linelinked) — set by the LINE follow/unfollow
webhook, and it can go back to false if they unfollow. Required together
with linking before a follow_oa program awards points. Keep the "Follow"
CTA while false; a historical award remains earned after an unfollow.

##### lineLinked

```ts
lineLinked: boolean;
```

Whether the customer completed LINE Login (the OAuth popup from
JoyClient.getLineAuthUrl). A `join_line` program whose
[Program.lineJoinType](#linejointype) is `follow_oa` uses LINE's verified flow —
JoyClient.earnSocial rejects it with `LINE_NOT_LINKED`, so open
the popup instead of attempting the claim. This flag
alone does not mean points were awarded; OA follow is also required.

***

### CustomerTierRef

Customer's current tier reference (subset of [Tier](#tier-1)).

#### Properties

##### id

```ts
id: string;
```

##### name

```ts
name: string | null;
```

***

### EarnImageUpload

One image for JoyClient.uploadEarnImages. Base64 only, deliberately
— no `File`/`FormData`, so the same call works from a React Native client.

#### Properties

##### imageBase64

```ts
imageBase64: string;
```

Base64 image data, with or without a `data:image/png;base64,` prefix.

##### imageName?

```ts
imageName?: string;
```

Original file name — used only in error messages.

##### imageType

```ts
imageType: "image/jpeg" | "image/jpg" | "image/png";
```

***

### EarningLimit

`Customer.earningLimit` — see [Customer](#customer-1).

#### Properties

##### message

```ts
message: string | null;
```

Server-rendered warning sentence, ready to show as-is. `null` when
[reached](#reached) is false — there is no sentence to show until then.

##### reached

```ts
reached: boolean;
```

Whether the customer has hit the limit for the current period.

##### remainingCapacity?

```ts
remainingCapacity?: number | null;
```

Points this customer can still earn in the current period — only the
customer's own remaining number, never the shop's limit configuration.
`null` means unlimited (e.g. a tier with an unlimited override); `0` once
the limit is [reached](#reached). Optional only for old-server compatibility:
absent on payloads from a backend that predates the field — treat absent as
"no cap known".

##### resetDate

```ts
resetDate: string;
```

Merchant-formatted date the period resets. Empty string for a customer
whose tier has an unlimited override.

***

### EarnResult

Result of `POST /customer/earn` — [SocialEarnResult](#socialearnresult) plus `status`.

#### Extends

- [`SocialEarnResult`](#socialearnresult)

#### Properties

##### key

```ts
key: string;
```

Program event key — same values as [Program.key](#key-2).

###### Inherited from

[`SocialEarnResult`](#socialearnresult).[`key`](#key-5)

##### pointsEarned

```ts
pointsEarned: number;
```

Points actually added. May be LOWER than the program's advertised
points when the shop's global earning limit partially caps the award.

###### Inherited from

[`SocialEarnResult`](#socialearnresult).[`pointsEarned`](#pointsearned-4)

##### programId

```ts
programId: string | null;
```

The program that was claimed. `null` when the server did not echo it.

###### Inherited from

[`SocialEarnResult`](#socialearnresult).[`programId`](#programid-11)

##### status

```ts
status: EarnStatus;
```

`earned` — the points are already on the balance. `pending` — the
submission (receipt, survey without auto-approve, Google review awaiting
moderation) is queued for merchant approval and the points land once it's
approved; `pointsEarned` may still be > 0 on a pending claim when the
program also grants an instant reward.

##### totalPoints

```ts
totalPoints: number;
```

Customer balance after the award.

###### Inherited from

[`SocialEarnResult`](#socialearnresult).[`totalPoints`](#totalpoints-2)

***

### EarnUploadResult

Result of `POST /customer/earn/upload`.

#### Properties

##### urls

```ts
urls: string[];
```

Stored image URLs, in request order. Pass back to JoyClient.earn
as `context.images` (receipt) or `context.imageUrls` (submit form/survey).

***

### FacebookDisconnectResult

Result of `POST /customer/social/facebook/disconnect`.

#### Properties

##### disconnected

```ts
disconnected: boolean;
```

Always true on success — the call has no partial outcome to report.

***

### FreeGiftStock

Live gift stock from JoyClient.getFreeGiftStock. Fetched on demand
when a gift modal opens rather than inlined into every [AvailableReward](#availablereward)
— it hits Shopify uncached, so the rewards list must not pay for it. Match a
variant back to its [GiftVariant](#giftvariant) by id to disable the sold-out ones.

#### Properties

##### missingVariantIds?

```ts
missingVariantIds?: string[];
```

Backend-confirmed deleted/invalid configured variant ids — lets the widget
block redeem BEFORE points are spent. Absent on older backends / when every
configured variant still exists.

##### products

```ts
products: FreeGiftStockProduct[];
```

***

### FreeGiftStockProduct

Live stock for one product of a `free_product` gift.

#### Properties

##### available

```ts
available: boolean;
```

##### productId

```ts
productId: string;
```

Shopify product id, numeric and unprefixed — matches [GiftProduct.id](#id-5).

##### variants

```ts
variants: FreeGiftStockVariant[];
```

***

### FreeGiftStockVariant

Live stock for one variant of a `free_product` gift.

#### Properties

##### available

```ts
available: boolean;
```

##### variantId

```ts
variantId: string;
```

Shopify product-variant id, numeric and unprefixed — matches [GiftVariant.id](#id-6).

***

### GenerateReferralLinkResult

Result of `POST /referral/generate-link` (`GuestReferralLink` in
the Headless API v1 OpenAPI spec) — see JoyClient.generateReferralLink.
Field names match the route's actual response verbatim (the server
returns the same referral-link payload Liquid storefronts receive —
legacy `urlReferral` naming, NOT the `referralLink` name [Referral](#referral) uses).

#### Properties

##### isReferralLimitReached

```ts
isReferralLimitReached: boolean;
```

##### referralCode

```ts
referralCode: string;
```

##### referralLimit

```ts
referralLimit: number | null;
```

##### urlReferral

```ts
urlReferral: string;
```

The guest's ready-to-share referral link.

***

### GiftProduct

A product a `free_product` reward lets the customer choose from.

#### Properties

##### id

```ts
id: string;
```

Shopify product id, numeric and unprefixed.

##### image

```ts
image: string | null;
```

##### title

```ts
title: string;
```

##### variants

```ts
variants: GiftVariant[];
```

***

### GiftVariant

One selectable variant of a [GiftProduct](#giftproduct).

#### Properties

##### id

```ts
id: string;
```

Shopify product-variant id, numeric and unprefixed. Pass it straight to
JoyClient.redeem; prefix it with `gid://shopify/ProductVariant/`
for a Storefront cart call.

##### title

```ts
title: string;
```

***

### GoogleWalletPassResult

Result of `GET /customer/wallet-pass/google`.

#### Properties

##### link

```ts
link: string;
```

Google Wallet "Add to Google Wallet" save link.

***

### ImpactEvent

One environmental-impact redemption (`GET /customer/impact-history`).

#### Properties

##### createdAt

```ts
createdAt: string | null;
```

##### id

```ts
id: string;
```

##### quantity

```ts
quantity: number;
```

Units funded (trees planted / bottles removed).

##### status

```ts
status: string;
```

The redemption's impact lifecycle state. `confirmed` is the default;
`refunded` is a failed event whose points were returned. Other raw
provider statuses (e.g. `pending`, `failed`) pass through unchanged, so
treat this as an open string set rather than a closed enum.

##### type

```ts
type: ImpactEventType;
```

***

### ImpactHistory

The customer's environmental-impact history (`GET /customer/impact-history`):
reconciled cumulative [ImpactTotals](#impacttotals) plus the individual redemption
[ImpactEvent](#impactevent)s. `connected` reports whether the shop's GoodAPI
integration answered live — `false` means `totals` are the last-known cached
values, not that the customer has no impact.

#### Properties

##### connected

```ts
connected: boolean;
```

##### events

```ts
events: ImpactEvent[];
```

##### pagination

```ts
pagination: Pagination;
```

Cursor pagination for [events](#events).

##### totals

```ts
totals: ImpactTotals;
```

***

### ImpactTotals

Cumulative environmental-impact totals (`GET /customer/impact-history`).

#### Properties

##### plasticBottles

```ts
plasticBottles: number;
```

##### trees

```ts
trees: number;
```

***

### InstagramLinkResult

Result of `POST /customer/social/instagram/link`.

#### Properties

##### instagramUsername

```ts
instagramUsername: string;
```

The linked username as stored — trimmed and lowercased, so it may differ
from what was sent. Empty string when the call unlinked instead.

##### pointsEarned

```ts
pointsEarned: number;
```

Points granted by this call. 0 when [rewardEarned](#rewardearned) is false.

##### rewardEarned

```ts
rewardEarned: boolean;
```

Whether the shop's one-time "link your Instagram" reward was granted by
THIS call. Always false on an unlink, and on every call after the first
successful link for a customer.

***

### JoyError

Error envelope: `{success: false, error: {message, code, statusCode}, timestamp}`.

#### Properties

##### error

```ts
error: object;
```

###### code

```ts
code: string;
```

###### message

```ts
message: string;
```

###### statusCode

```ts
statusCode: number;
```

##### success

```ts
success: false;
```

##### timestamp

```ts
timestamp: string;
```

***

### JoyInfo

`GET /info` response — the same payload the Liquid widget merges into the storefront's
`AVADA_JOY` global on its own "beat 2" (served unchanged to headless storefronts behind the optional-auth
adapter). Deliberately NOT pinned
field-for-field like [Program](#program-1)/[Customer](#customer-1): `handleGetInfo` is a \~400-line
fan-out this contract does not own or freeze, so this stays a loose index signature PLUS
the fields the Hydrogen façade actually reads, typed strictly.

#### Indexable

```ts
[key: string]: unknown
```

#### Properties

##### allTiers?

```ts
allTiers?: unknown[];
```

##### customer?

```ts
customer?: JoyInfoCustomer;
```

Present only when the call was authenticated (Bearer JWT); absent for a guest.

##### primaryTranslation?

```ts
primaryTranslation?: Record<string, unknown>;
```

##### referralProgram?

```ts
referralProgram?: Record<string, unknown>;
```

##### settings?

```ts
settings?: Record<string, unknown>;
```

##### settingsReferral?

```ts
settingsReferral?: Record<string, unknown>;
```

##### settingWidgetQr?

```ts
settingWidgetQr?: Record<string, unknown>;
```

##### tierProgram?

```ts
tierProgram?: Record<string, unknown>;
```

##### translation?

```ts
translation?: Record<string, unknown>;
```

***

### JoyInfoCustomer

`JoyInfo.customer` — the rich, personalised customer object `handleGetInfo` builds
(`finalCustomer`), a superset of [Customer](#customer-1). Same looseness rule as [JoyInfo](#joyinfo).

#### Indexable

```ts
[key: string]: unknown
```

#### Properties

##### acceptsMarketing?

```ts
acceptsMarketing?: boolean | null;
```

##### acceptsSmsMarketing?

```ts
acceptsSmsMarketing?: boolean | null;
```

##### avatarUrl?

```ts
avatarUrl?: string | null;
```

##### becomeMemberAt?

```ts
becomeMemberAt?: string | null;
```

##### birthday?

```ts
birthday?: string | null;
```

##### canClaimMemberAnniversary?

```ts
canClaimMemberAnniversary?: boolean;
```

##### dateOfBirth?

```ts
dateOfBirth?: string | null;
```

##### earnMemberAnniversaryReward?

```ts
earnMemberAnniversaryReward?: boolean;
```

##### email?

```ts
email?: string | null;
```

##### facebook?

```ts
facebook?: object;
```

###### name?

```ts
name?: string | null;
```

###### pageId?

```ts
pageId?: string | null;
```

###### psid?

```ts
psid?: string | null;
```

##### impact?

```ts
impact?: object;
```

###### plasticBottles?

```ts
plasticBottles?: number;
```

###### trees?

```ts
trees?: number;
```

##### instagramUsername?

```ts
instagramUsername?: string | null;
```

##### latestActivity?

```ts
latestActivity?: unknown;
```

##### phone?

```ts
phone?: string | null;
```

##### point?

```ts
point?: number;
```

##### qrImageUrl?

```ts
qrImageUrl?: string | null;
```

##### referralCode?

```ts
referralCode?: string | null;
```

##### referralCompleteCount?

```ts
referralCompleteCount?: number;
```

##### referralPendingCount?

```ts
referralPendingCount?: number;
```

##### storeCredit?

```ts
storeCredit?: unknown;
```

##### tierData?

```ts
tierData?: Record<string, unknown>;
```

##### tierId?

```ts
tierId?: string;
```

##### tierPoint?

```ts
tierPoint?: number;
```

***

### JoySuccess

Success envelope: `{success: true, data, meta?, timestamp}`.

#### Type Parameters

| Type Parameter |
| -------------- |
| []() `T`       |

#### Properties

##### data

```ts
data: T;
```

##### meta?

```ts
meta?: Record<string, unknown>;
```

Optional metadata (pagination, counts).

##### success

```ts
success: true;
```

##### timestamp

```ts
timestamp: string;
```

ISO date-time of the response.

***

### LineAuthUrlResult

Result of `POST /customer/social/line/auth-url`.

#### Properties

##### authUrl

```ts
authUrl: string;
```

LINE Login OAuth URL — open it in a popup. LINE redirects back to a fixed
Joy-owned callback (not this client's own domain; no platform here
registers a redirect URI per merchant) which links the account and closes
itself, so the opener is not expected to navigate anywhere. Linking alone
does not award follow_oa points. The `joy-line-link` success message may
carry optional `followed` / `awarded` booleans; treat missing flags as false.

***

### MilestoneClaimInput

Input for JoyClient.claimMilestone — the fields the milestone-timeline
component emits on `joy-milestone-claim`, minus identity and minus the reward
definitions. SELECTIONS ONLY: the server re-resolves the milestone step and
its rewards from the program, so a crafted body can never inflate what is
granted (see the route's server-side reward resolution). `programId` +
`milestoneValue` are always sent; the rest are conditional on the step shape.

#### Properties

##### isMixed?

```ts
isMixed?: boolean;
```

Mixed programs only.

##### isSelectVariantFreeGiftMilestone?

```ts
isSelectVariantFreeGiftMilestone?: boolean;
```

Whether the shopper picked a variant for a free-gift milestone reward.

##### milestoneValue

```ts
milestoneValue: string | number;
```

The raw step value (for a mixed program, still the raw step value, not the composite key).

##### programId

```ts
programId: string;
```

##### selectedRewardIds?

```ts
selectedRewardIds?: number[];
```

Indices into the SERVER-resolved step's `rewards`; absent claims the whole step.

##### stepType?

```ts
stepType?: string;
```

Mixed programs only — the step's type.

##### variantIdsSelected?

```ts
variantIdsSelected?: Record<string, string>;
```

`{`rewardIndex-${i}`: variantId}` — the variant chosen per free-gift reward.

***

### MilestoneClaimResult

Result of `POST /customer/milestone/claim`. `point` is the customer's
post-claim balance. The route also carries the updated pending-claim array
under its type-specific key (`pendingMilestoneOrder`, `pendingMilestoneMixed`,
…, one key per milestone type) —
keyed dynamically per milestone type, so it can't be a named field, but a
caller MUST merge the whole result onto its local customer mirror (Liquid's
`Object.assign(adapter.data.customer, responseData)`)
rather than reading `point` alone: without the pending array, the very next
repaint still finds the claimed value pending and shows the step as
claimable again.

#### Indexable

```ts
[pendingField: string]: unknown
```

The type-specific pending-claim array (dynamic key), post-claim.

#### Properties

##### point

```ts
point: number;
```

The customer's spendable balance after the claim.

***

### MilestoneLadder

`GET /customer/milestones/{programId}` result — everything the loyalty
page's milestone modal draws for THIS customer, already rendered: the step
sentence, the reward lines, the progress percentage and the "how much is
left" line. Fetch it when the shopper OPENS the milestone, not with the
program list — see JoyClient.getMilestones.

#### Properties

##### orderRequirement

```ts
orderRequirement: string | null;
```

"Your order needs to be at least $50" / "You need to order at least 3
items" — already rendered and localised. Only present for order/spend
programs (and mixed programs containing such a step) that set one. Null
otherwise.

##### programId

```ts
programId: string;
```

##### steps

```ts
steps: MilestoneStep[];
```

##### subheading

```ts
subheading: string;
```

"2 / 5 Rewards" — how many steps this customer has already been
rewarded for, out of the program's total. Rendered and pluralised
server-side; print it as-is.

##### supported

```ts
supported: boolean;
```

False for program types with no storefront ladder
(`milestone_inactivity`). [steps](#steps) is empty; render the program's
own description instead of an empty track.

##### title

```ts
title: string;
```

Program title in the served locale. `''` when unset, never null.

##### typeMilestone

```ts
typeMilestone: "" | MilestoneType;
```

`''` for program types with no milestone counter.

***

### MilestoneLadderClaimInput

`POST /customer/milestones/{programId}/claim` input — see
JoyClient.claimMilestoneStep. For a step whose `state` is `claimable`,
or a granted step that still owes a free-gift variant choice
(`rewards[].needsVariantChoice`).

#### Properties

##### claimKey

```ts
claimKey: string;
```

The step's `claimKey` from JoyClient.getMilestones. Opaque.

##### selectedRewardIds

```ts
selectedRewardIds: number[];
```

Indexes into the step's `rewards` array. Exactly `maxRewardSelect` of
them, each in range, no duplicates — anything else is
`INVALID_SELECTION`.

##### variantIds?

```ts
variantIds?: Record<string, string>;
```

Chosen product variant per reward index, for rewards with
`needsVariantChoice: true`. Keys are the index as a string. A variant
that is not on that reward's own allow-list is rejected — the coupon
would otherwise entitle every variant of the product.

***

### MilestoneLadderClaimResult

Result of `POST /customer/milestones/{programId}/claim`.

#### Properties

##### blocked

```ts
blocked: boolean;
```

True when every point reward picked was refused by the shop's global
earning limit. The step still counts as claimed; tell the shopper rather
than showing a silent +0.

##### claimedRewardIds

```ts
claimedRewardIds: number[];
```

##### pointsEarned

```ts
pointsEarned: number;
```

Points actually added. 0 when no `bonus_point` reward was picked, and
possibly 0 when one was but the shop's global earning limit blocked it —
[blocked](#blocked) says which.

##### step

```ts
step: MilestoneStep | null;
```

The same step re-rendered in its new state, so the ladder updates
without a second round trip. `null` when the step is no longer
resolvable after the claim — re-fetch the ladder.

##### totalPoints

```ts
totalPoints: number;
```

Customer balance after the grant.

***

### MilestoneReward

One reward line at a [MilestoneStep](#milestonestep).

#### Properties

##### action

```ts
action: MilestoneRewardAction;
```

##### giftProducts

```ts
giftProducts: GiftProduct[];
```

Empty unless [needsVariantChoice](#needsvariantchoice). Same shape as [AvailableReward.giftProducts](#giftproducts).

##### index

```ts
index: number;
```

Position in this step's `rewards` — the value to send in
[MilestoneLadderClaimInput.selectedRewardIds](#selectedrewardids-1). The client never sends the
reward itself.

##### needsVariantChoice

```ts
needsVariantChoice: boolean;
```

A free product whose variant this shopper still has to choose. Render
[giftProducts](#giftproducts-1) as a picker and send the choice in
[MilestoneLadderClaimInput.variantIds](#variantids) — without it the coupon would
entitle every variant.

##### text

```ts
text: string;
```

"Receive 100 points", "Receive $5 off", "Plant 2 trees" — or the
merchant's own reward description when they wrote one. Localised, print
as-is.

***

### MilestoneStep

One rung of a [MilestoneLadder](#milestoneladder). Every string here is print-ready.

#### Properties

##### claimKey

```ts
claimKey: string;
```

Opaque step identity, echoed back to JoyClient.claimMilestoneStep. A
raw milestone value on a plain program; `{programId}_{stepType}_{value}`
on `milestone_mixed`. Also a stable React key across refetches.

##### label

```ts
label: string;
```

The step sentence: "After spending $500", "After completing 3 orders",
or the merchant's own per-step description when they wrote one (their
translation for the served locale wins). `''` only when the step type
has no sentence.

##### maxRewardSelect

```ts
maxRewardSelect: number;
```

How many rewards the shopper may pick when [state](#state) is `claimable`.
1 unless the merchant raised it. Keep the Claim button disabled until
exactly this many are selected.

##### note

```ts
note: string | null;
```

Tooltip text for `passed_unclaimed`. Null in every other state.

##### progress

```ts
progress: MilestoneStepProgress | null;
```

Present only when [state](#state) is `current`.

##### reached

```ts
reached: boolean;
```

Whether the circle and the connector above it are filled. Separate from
[state](#state) on purpose — on `milestone_mixed` a step counts as reached
by its position in the sequence, not by its own counter.

##### rewardLogic

```ts
rewardLogic: MilestoneRewardLogic;
```

##### rewards

```ts
rewards: MilestoneReward[];
```

##### state

```ts
state: MilestoneState;
```

`locked` — not reached. `current` — the step being worked towards; the
only one carrying [progress](#progress). `claimable` — reached, rewards still
to pick: render the radio list and the Claim button. `achieved` —
reached and rewarded. `passed_unclaimed` — the counter passed this step
but no reward was recorded; render [note](#note) as a tooltip beside the
label.

##### stepType

```ts
stepType: string;
```

This step's own metric — the program's `typeMilestone` on a plain
program, the step's own on `milestone_mixed`. Drives which built-in icon
the client draws in the circle.

***

### MilestoneStepProgress

`MilestoneStep.progress` — present only when `state` is `current`.

#### Properties

##### completedText

```ts
completedText: string;
```

'"42% completed"', localised and lowercased as the loyalty page renders it.

##### percent

```ts
percent: number;
```

0-100, already clamped — width of the bar.

##### remainingText

```ts
remainingText: string | null;
```

"Need 3 orders" / "Need $250" — the unit is pluralised and localised
server-side. Null at 100%.

***

### Order

One of the customer's Shopify orders (`GET /customer/orders`). Money fields
are integer CENTS in the order's presentment currency (what the buyer
actually paid in). PARTIAL PARITY (documented): no "Buy again" /
"View order" URLs — those are Online-Store theme routes that don't exist on
headless/Oxygen, so the raw ids are returned for the host to build its own.

#### Properties

##### billingAddress

```ts
billingAddress: OrderAddress | null;
```

##### createdAt

```ts
createdAt: string | null;
```

##### currencyCode

```ts
currencyCode: string;
```

##### customer

```ts
customer: OrderCustomer | null;
```

##### discounts

```ts
discounts: OrderDiscount[];
```

##### financialStatus

```ts
financialStatus: string;
```

Lowercased Shopify financial status, e.g. `paid`, `pending`, `refunded`.

##### fulfillmentStatus

```ts
fulfillmentStatus: OrderFulfillmentStatus;
```

##### id

```ts
id: number;
```

Shopify order id, numeric and unprefixed.

##### lineItemCount

```ts
lineItemCount: number;
```

##### lineItems

```ts
lineItems: OrderLineItem[];
```

##### name

```ts
name: string;
```

Order name, e.g. `#1042`.

##### orderStatusUrl

```ts
orderStatusUrl: string | null;
```

Shopify's own hosted order-status page (signed, self-authing) — unlike the
omitted theme routes, this one resolves the same on headless as on Liquid.
Null when Shopify returned none.

##### paymentGatewayNames

```ts
paymentGatewayNames: string[];
```

##### shippingAddress

```ts
shippingAddress: OrderAddress | null;
```

##### shippingMethod

```ts
shippingMethod: string;
```

##### subtotalPrice

```ts
subtotalPrice: number;
```

##### totalDiscounts

```ts
totalDiscounts: number;
```

##### totalPrice

```ts
totalPrice: number;
```

All amounts below are integer CENTS.

##### totalShipping

```ts
totalShipping: number;
```

##### totalTax

```ts
totalTax: number;
```

***

### OrderAddress

A shipping/billing address on an [Order](#order), passed through from Shopify
unchanged. Every field may be null when Shopify has no value for it; the
whole object is null when the order carries no address of that kind.

#### Properties

##### address1

```ts
address1: string | null;
```

##### address2

```ts
address2: string | null;
```

##### city

```ts
city: string | null;
```

##### country

```ts
country: string | null;
```

##### name

```ts
name: string | null;
```

##### province

```ts
province: string | null;
```

##### zip

```ts
zip: string | null;
```

***

### OrderCustomer

The buyer summary on an [Order](#order); null when Shopify returned none.

#### Properties

##### email

```ts
email: string;
```

##### firstName

```ts
firstName: string;
```

##### lastName

```ts
lastName: string;
```

***

### OrderDiscount

A discount applied to an [Order](#order).

#### Properties

##### amount

```ts
amount: number;
```

Discount amount in the order's presentment currency, in CENTS.

##### code

```ts
code: string;
```

Discount code, or the automatic/script/manual discount's title.

##### percentage

```ts
percentage: number | null;
```

Percentage discount (0-100), or null for a fixed-amount discount.

##### targetType

```ts
targetType: string;
```

Shopify `targetType` (e.g. `LINE_ITEM`, `SHIPPING_LINE`); '' when absent.

##### type

```ts
type: string;
```

Shopify `allocationMethod` (e.g. `ACROSS`, `EACH`); '' when absent.

***

### OrderLineItem

One line item on an [Order](#order).

#### Properties

##### image

```ts
image: string | null;
```

##### price

```ts
price: number;
```

Line total in the order's presentment currency, in CENTS.

##### productHandle

```ts
productHandle: string | null;
```

##### productId

```ts
productId: number | null;
```

Shopify product id, numeric and unprefixed; null when unavailable.

##### quantity

```ts
quantity: number;
```

##### title

```ts
title: string;
```

##### variantId

```ts
variantId: string | null;
```

Shopify product-variant id, numeric and unprefixed; null when the variant
was deleted. Raw id for the host to build its OWN `/cart` link — this
surface never assembles a "Buy again" URL (Online-Store-only, absent on
headless/Oxygen).

##### variantTitle

```ts
variantTitle: string;
```

***

### Pagination

Cursor-pagination flags returned in `meta.pagination`.

#### Properties

##### hasNext

```ts
hasNext: boolean;
```

##### hasPre

```ts
hasPre: boolean;
```

***

### PendingRewardClaimResult

Result of `POST /customer/pending-rewards/{pendingId}/claim`. The
entry-pending branch of a tier perk mints a real coupon NOW for the picked
product; `couponCode` is that code to toast. Absent when the reward mints no
code.

#### Properties

##### couponCode?

```ts
couponCode?: string | null;
```

***

### PendingTierRewardClaim

A pending tier-reward claim the customer still has to redeem by picking a
product/variant (`GET /customer/tier-rewards` grants these on tier-up;
`GET /customer/pending-rewards` lists them). Personalised — see the backend
pendingRewardPresenter; the popup's `/popup/pending-rewards` computes the same
docs.

#### Properties

##### allProducts

```ts
allProducts: boolean;
```

Whether the reward covers every product (the widget renders a search box instead of a list).

##### claimedCount

```ts
claimedCount: number;
```

How many times it has already been claimed.

##### claimType

```ts
claimType: string | null;
```

How the customer claims it: `product_selection` (pick from a fixed list),
`variant_price_difference` (a discount toward a chosen variant), or null on
older docs.

##### createdAt

```ts
createdAt: string | null;
```

ISO date-time the claim was created, or null.

##### event

```ts
event: string | null;
```

The source program's event; null when not recorded.

##### expiredAt

```ts
expiredAt: string | null;
```

ISO date-time the claim expires, or null when it never does.

##### id

```ts
id: string;
```

The claim's own id — the id a claim call (`/pending-rewards/{id}/claim`) targets.

##### maxClaims

```ts
maxClaims: number;
```

How many times this pending doc may be claimed.

##### products

```ts
products: unknown[];
```

Prefetched product/variant views for the claim's product picker (a
Shopify-derived shape from the reused pending-reward service); empty for
`allProducts` / `product_selection` docs.

##### programId

```ts
programId: string | null;
```

The tier-reward program it came from; null on docs issued before that was recorded.

##### rewardProductQuantity

```ts
rewardProductQuantity: number | null;
```

How many of the chosen product the reward grants; null when not applicable.

##### selectedProductIds

```ts
selectedProductIds: string[];
```

Product ids the reward is scoped to; empty when [allProducts](#allproducts) is true.

##### status

```ts
status: string | null;
```

Lifecycle status — `pending`, or `claimed` for a completed product_selection.

##### tierId

```ts
tierId: string | null;
```

The tier that granted it; null on docs issued before that was recorded.

##### title

```ts
title: string;
```

The tier name the reward came from — rendered as the claim's title.

***

### PlaceOrderScope

`GET /programs/{id}/place-order-scope` result — which products/collections
earn points on a `place_order`/`place_order_subscription` program, as
IDENTIFIERS only (id/handle), not product cards. A Hydrogen storefront
already has its own product data (fresher, market-priced, its own
components) via the Storefront API — look the rest up by `handle`.

#### Properties

##### collections

```ts
collections: PlaceOrderScopeCollection[];
```

##### products

```ts
products: PlaceOrderScopeProduct[];
```

##### scope

```ts
scope: "all" | "select";
```

`all` — every product qualifies; [products](#products-2)/[collections](#collections)
are both empty and the client should render a generic "browse
everything" CTA. `select` — only the listed products/collections qualify.

***

### PlaceOrderScopeCollection

`PlaceOrderScope.collections[]` — one eligible collection, identifier only (see [PlaceOrderScope](#placeorderscope)).

#### Properties

##### handle

```ts
handle: string | null;
```

Resolved live from Shopify by title. `null` when the collection was
renamed/deleted since the merchant configured this program, or the title
otherwise didn't resolve — the shopper still sees `title`.

##### title

```ts
title: string;
```

***

### PlaceOrderScopeProduct

`PlaceOrderScope.products[]` — one eligible product, identifier only (see [PlaceOrderScope](#placeorderscope)).

#### Properties

##### handle

```ts
handle: string | null;
```

##### id

```ts
id: string;
```

Shopify product id, numeric and unprefixed.

##### quantity

```ts
quantity: number | null;
```

Required quantity to earn, when the merchant set one (V2 rule-engine programs only). Null otherwise.

***

### PointLabel

Merchant-facing name of the loyalty currency.

#### Properties

##### plural

```ts
plural: string;
```

##### singular

```ts
singular: string;
```

***

### ProfileResult

Result of `POST /customer/profile`.

#### Properties

##### avatarUrl

```ts
avatarUrl: string | null;
```

##### firstName

```ts
firstName: string;
```

##### lastName

```ts
lastName: string;
```

##### phone?

```ts
phone?: string | null;
```

Echoed phone (canonicalized), so a save is readable back. `null` when cleared.

***

### Program

An earning or spending program (whitelisted public fields).

#### Properties

##### actionUrl

```ts
actionUrl: string | null;
```

Where the customer goes to perform the action, resolved server-side per
event. Earning programs only. Guaranteed http(s) — the server drops any
other scheme, so this is safe to use as an `href`. For `share_facebook`,
`share_twitter` and `follow_twitter` this is a ready-to-open share/follow
intent URL, not the merchant-entered profile URL — every other social
event, plus survey/custom-program/Google-review links and the merchant's
own "Add URL on click" override, resolve to that destination unchanged.

##### birthday

```ts
birthday: ProgramBirthday | null;
```

`birthday` only — `null` for every other event, and always `null` on a
spending program. Like [streak](#streak), the ENTIRE object is
personalised — `null` (not a partial object) on the public
`getPrograms()` call. Two reasons: the birthday-entry modal this exists
for always calls the personalised path anyway (it also needs
[Customer.birthday](#birthday-1)), and VIP-tier-scoped `rewardOptions` can only
resolve against a customer's own tier. KNOWN LIMITATION:
`rewardOptions: []` is reported both when the program has no reward
picker at all (an older layout — a reward is still granted on save, just
not through a picker) AND when the picker is on but the shopper's own
tier has zero rewards configured — a client cannot tell the two apart
from this field alone.

##### conditions

```ts
conditions: string[];
```

The fine print a shopper needs before spending points, rendered
server-side: sale channel, which products it applies to, usable-from date,
minimum order, expiry, usage limit. Always an array — empty means "no
restrictions", and earning programs never carry any.

##### description

```ts
description: string;
```

Empty string when the merchant wrote none — never null.

##### form

```ts
form: ProgramForm | null;
```

Design + approval settings, `submit_form` and `fill_survey` only — `null`
for every other event, and always `null` on a spending program.
`autoApprove` matters beyond display: `earnCustomer()` for these two
events already reports `status: 'earned'` vs `'pending'` based on this
exact flag, so without it here that switch is opaque to the client.

##### googleReview

```ts
googleReview: ProgramGoogleReview | null;
```

`google_maps_review` only — `null` for every other event, and always
`null` on a spending program. LIMITATION: review state is stored on the
customer, not per-program, so the backend assumes at most one active
`google_maps_review` program per shop — every such program reports the
SAME customer state.

##### iconUrl

```ts
iconUrl: string | null;
```

##### id

```ts
id: string;
```

##### isEarned?

```ts
isEarned?: boolean;
```

Whether the current customer has already completed this (non-repeatable)
earning program. Only present on the personalised `getPrograms()` call
(client entry, with the customer's session) — `undefined` on the public
`getPrograms()` call and on every spending program. Repeatable earning
events (place_order, write_review, submit_receipt, submit_form,
fill_survey, milestone) always report `false`.

##### key

```ts
key: string;
```

Program event key, e.g. `place_order`, `signup`, `birthday`.

##### lineJoinType

```ts
lineJoinType: LineJoinType | null;
```

How a `join_line` program credits points — `null` for every other event,
and always `null` on a spending program. `follow_oa` requires LINE Login
(JoyClient.getLineAuthUrl) AND following the shop's OA. Claiming with
JoyClient.earnSocial rejects `LINE_NOT_LINKED` for this LINE-managed
flow. Points are awarded once, by the OAuth callback if
follow is already confirmed, or by the later follow webhook. A link alone
does not earn points. `join_link` is claim-on-click through [actionUrl](#actionurl) +
`earnSocial`, same as every other social event — a legacy program that
predates LINE Login reads as `join_link`, so this is never `null` on a
`join_line` program.

##### points

```ts
points: number | null;
```

Points earned (earning programs).

##### pointsCost

```ts
pointsCost: number | null;
```

Points required to redeem (spending programs).

##### programType

```ts
programType: ProgramType;
```

##### rateMoney

```ts
rateMoney: number | null;
```

Spend-rate programs earn `points` per this amount of shop currency (see
[ShopConfig.currency](#currency)), e.g. `points: 1` + `rateMoney: 1` reads
"1 point per $1". Null for flat-rate and spending programs. Base rate only —
per-tier overrides are not reflected.

##### redeemType

```ts
redeemType: RedeemType | null;
```

How to read [pointsCost](#pointscost-1) on a spending program: `fixed` — the price;
`dynamic` — the step, i.e. how many points buy one `rewardValue` of
discount. `null` on earning programs. Present on both the public and
personalised `getPrograms()` calls, so a signed-out card can render the
same "from N points" wording the logged-in [AvailableReward](#availablereward) does.

##### review

```ts
review: ProgramReview | null;
```

Design + reward settings, `write_review` only — `null` for every other
event, and always `null` on a spending program.

##### rewardType

```ts
rewardType: RewardType | null;
```

Reward kind (spending programs).

##### rewardValue

```ts
rewardValue: number | null;
```

Reward amount — currency or percent depending on `rewardType`.

##### streak

```ts
streak: ProgramStreak | null;
```

`streak_interact_website` only — `null` for every other event, and
always `null` on a spending program. UNLIKE [googleReview](#googlereview), the
ENTIRE object is personalised — even `totalDays`, which is program
config — so it is `null` (not a partial object) on the public
`getPrograms()` call, not just missing a couple of fields. Answers a
different question than [isEarned](#isearned) does for this same event:
"what day is the shopper on right now, and can they claim today" rather
than "has the highest milestone ever been reached".

##### title

```ts
title: string;
```

***

### ProgramBirthday

`Program.birthday` — the birthday-entry modal's reward picker + date-input config.

#### Properties

##### dateFormat

```ts
dateFormat: "MM/DD/YYYY" | "DD/MM/YYYY" | "MM/DD" | "DD/MM" | "YYYY/MM/DD";
```

Day/month display ORDER for the date input — NOT whether a year is
collected at all (see [ShopConfig.isNewFormatDOB](#isnewformatdob) for that).

##### rewardOptions

```ts
rewardOptions: ProgramBirthdayRewardOption[];
```

##### rewardSelection

```ts
rewardSelection: "single" | "multiple";
```

Whether the shopper may pick exactly one reward (radio buttons) or several
(checkboxes). Independent of whether [rewardOptions](#rewardoptions) is empty — still
reflects the merchant's configured mode even with nothing to pick.

***

### ProgramBirthdayRewardOption

`Program.birthday.rewardOptions[]` — one reward the shopper may choose.

#### Properties

##### id

```ts
id: string;
```

Send this value back in `earnCustomer()`'s `context.birthdayRewards`.

##### imageUrl

```ts
imageUrl: string | null;
```

Present only for a free-gift reward; `null` for point/discount rewards.

##### label

```ts
label: string;
```

Complete, server-rendered sentence — there is no merchant-authored per-reward title.

***

### ProgramForm

`Program.form` — submit_form / fill_survey design + approval settings.

#### Properties

##### autoApprove

```ts
autoApprove: boolean;
```

When true, `earnCustomer()` reports `status: 'earned'` immediately; when
false, `status: 'pending'` until a merchant approves the submission.

##### headerImage

```ts
headerImage: string | null;
```

##### instantRewardEnabled

```ts
instantRewardEnabled: boolean;
```

Whether a smaller reward is granted immediately, ahead of approval.

##### instantRewardPoints

```ts
instantRewardPoints: number | null;
```

The instant reward amount, when [instantRewardEnabled](#instantrewardenabled) is true.

##### requireImage

```ts
requireImage: boolean;
```

Whether the shopper must attach an image with their submission.

##### successIconUrl

```ts
successIconUrl: string | null;
```

***

### ProgramGoogleReview

`Program.googleReview` — google_maps_review location + review approval state.

#### Properties

##### status?

```ts
status?: GoogleReviewStatus | null;
```

`null` means never submitted — the only one of the 4 states with no
persistent record on the customer. `rejected` is the only state the
shopper can act on again (resubmit); `pending` and `approved` are dead
ends. Only present on the personalised `getPrograms()` call — `undefined`
on the public call, same rule as [Program.isEarned](#isearned).

##### statusText?

```ts
statusText?: string | null;
```

The sentence the shopper reads for the current [status](#status-4), rendered
server-side — do not rebuild this from `status` alone. `null` when
`status` is `null`: "never submitted" is a 3-step guided form, not a
single sentence, and stays entirely client-owned UI. Present under the
same condition as `status`.

##### urlLocation

```ts
urlLocation: string | null;
```

Guaranteed http(s) — the server drops any other scheme.

***

### ProgramReview

`Program.review` — write_review design + reward settings.

#### Properties

##### extraPoints

```ts
extraPoints: number | null;
```

Bonus points awarded on top of the base reward for this program.

##### headerImage

```ts
headerImage: string | null;
```

##### redirectUrl

```ts
redirectUrl: string | null;
```

Where to send the shopper back to AFTER they finish writing the review —
NOT a CTA ([Program.actionUrl](#actionurl) is always `null` for `write_review`;
this is a distinct field). Guaranteed either an absolute http(s) url or a
root-relative path (`/collections/all` style) — non-http(s) schemes and
protocol-relative (`//host`) values are dropped server-side. `null` when
the merchant left it blank; the storefront widget defaults that case to
`/collections/all` on its own, a choice this contract does not replicate.

***

### ProgramStreak

`Program.streak` — today's progress through a streak_interact_website program.

#### Properties

##### canClaimToday

```ts
canClaimToday: boolean;
```

Whether calling `earnCustomer()` for this program right now would award
points. `false` covers two different terminal states for today: an
ordinary same-day cooldown (already claimed, come back tomorrow) and a
program that can no longer be completed at all (not enough days left
before it ends) — [message](#message-2) is the only field that tells them apart.

##### currentDay

```ts
currentDay: number;
```

The streak day the shopper is currently on (0 before their first claim).
Resets to 0 after a missed day or when returning to this program from a
different one.

##### message

```ts
message: string | null;
```

Rendered server-side. Non-null ONLY when the program can no longer be
completed (not enough days remain before it ends to reach
[totalDays](#totaldays)) — every other state, including an ordinary same-day
cooldown, has nothing extra to say and reports `null`.

##### totalDays

```ts
totalDays: number;
```

The highest streak milestone day configured on this program.

***

### QrCodeResult

Result of `POST /customer/qrcode`.

#### Properties

##### qrCode

```ts
qrCode: string;
```

PNG data URL (`data:image/png;base64,...`), 1000px square — around 9KB, so
render it, don't log it. The same string [JoyInfoCustomer.qrImageUrl](#qrimageurl)
carries once a code has been generated at least once.

***

### ReceivedReward

A gift a FRIEND sent this customer (`GET /customer/received-rewards`) — the
widget's "From friends" group. NOT one of the customer's own redeemed
coupons: they spent no points on it (hence no `pointsSpent`) and they cannot
revoke it or pass it on, so a client must not offer those actions on it.

Every gift in the list is live — used, revoked and expired ones are filtered
out server-side, which is why `status` is always `'active'`.

#### Properties

##### balanceRemaining

```ts
balanceRemaining: number | null;
```

The gift card's real remaining balance. `null` when the card was never
refreshed or this isn't a gift card — use [rewardValue](#rewardvalue-2) (face value)
for the amount label instead.

##### conditions

```ts
conditions: string[];
```

The gift's own fine print — same rows, same builder as the matching
[RedeemedReward](#redeemedreward), so a gift and an own coupon from one program read
identically on the shared card.

##### couponCode

```ts
couponCode: string | null;
```

Masked for a gift card — the spendable full code is never sent.

##### description

```ts
description: string;
```

##### expiresAt

```ts
expiresAt: string | null;
```

ISO date-time, or null when the gift never expires.

##### freeGiftCollections?

```ts
freeGiftCollections?: RewardCollectionRef[];
```

Collections a collection-scoped free gift hands out. `[]` on every other gift.

##### freeGiftMode?

```ts
freeGiftMode?: GiftSelectionMode | null;
```

`'one'` | `'all'` | `null` — which free-gift picker the core renders.

##### freeGiftProducts?

```ts
freeGiftProducts?: GiftProduct[];
```

Full picked-product info for an already-received free-gift gift — same shape
and purpose as [RedeemedReward.freeGiftProducts](#freegiftproducts-1). `[]` on non-free-gift
gifts. Absent on older backends.

##### freeGiftSelectedVariantId?

```ts
freeGiftSelectedVariantId?: string | null;
```

The variant the sender chose (same value as [giftVariantId](#giftvariantid-1)).

##### giftVariantId

```ts
giftVariantId: string | null;
```

On a `free_product` gift, the variant the sender chose.

##### iconUrl

```ts
iconUrl: string | null;
```

Merchant-uploaded icon for the source program; null when they set none.

##### key

```ts
key: string;
```

The source program's event, same meaning as [AvailableReward.key](#key).

##### partiallyUsed

```ts
partiallyUsed: boolean;
```

Gift card spent down but still has balance — show the "Partially used" badge.

##### programId

```ts
programId: string | null;
```

The program it came from; null on gifts issued before that was recorded.

##### rewardId

```ts
rewardId: string;
```

The gift's own id — also the cursor for `before`/`after`.

##### rewardType

```ts
rewardType: RewardType | null;
```

##### rewardValue

```ts
rewardValue: number | null;
```

##### senderEmail

```ts
senderEmail: string;
```

##### senderName

```ts
senderName: string;
```

Who sent it, display-safe. `''` when unknown — show the name, falling back
to the email (the widget prints only its local part). No other sender data
is ever exposed to the recipient.

##### startsAt

```ts
startsAt: string | null;
```

Always null today — the gift record carries no start date.

##### status

```ts
status: RewardStatus;
```

##### title

```ts
title: string;
```

***

### ReceivedRewardsPage

One page of JoyClient.getReceivedRewards.

#### Properties

##### pagination

```ts
pagination: Pagination;
```

##### received

```ts
received: ReceivedReward[];
```

***

### RedeemedReward

A coupon the customer has already redeemed (`GET /customer/rewards`).

#### Properties

##### balanceRemaining?

```ts
balanceRemaining?: number | null;
```

The gift card's real remaining balance. `null` when the card was never
refreshed or this isn't a gift card — use [rewardValue](#rewardvalue-3) (face value)
for the amount label instead. Absent on older backends.

##### conditions

```ts
conditions: string[];
```

The coupon's own fine print — the shopper needs it AFTER redeeming too
("Minimum order $50" is why a code looks broken at checkout). Same rows as
the matching [AvailableReward](#availablereward).

##### couponCode

```ts
couponCode: string | null;
```

##### description

```ts
description: string;
```

##### expiresAt

```ts
expiresAt: string | null;
```

ISO date-time, or null when the coupon never expires.

##### freeGiftCollections?

```ts
freeGiftCollections?: RewardCollectionRef[];
```

Collections a collection-scoped free gift hands out (the case [freeGiftProducts](#freegiftproducts-1) is empty for). `[]` on every other coupon.

##### freeGiftMode?

```ts
freeGiftMode?: GiftSelectionMode | null;
```

`'one'` | `'all'` | `null` — which free-gift picker the core renders.

##### freeGiftProducts?

```ts
freeGiftProducts?: GiftProduct[];
```

Full picked-product info for an already-redeemed free-gift coupon — what the
core coupon list needs to render the product row + Add-to-cart ([giftVariantId](#giftvariantid-2) alone is not enough). Same shape as [AvailableReward.giftProducts](#giftproducts); `[]` on non-free-gift coupons. Absent on older
backends.

##### freeGiftSelectedVariantId?

```ts
freeGiftSelectedVariantId?: string | null;
```

The already-chosen variant (same value as [giftVariantId](#giftvariantid-2)).

##### giftVariantId

```ts
giftVariantId: string | null;
```

On a redeemed `free_product` reward, the variant that was chosen — so the
gift can still be added to the cart later.

##### iconUrl

```ts
iconUrl: string | null;
```

Merchant-uploaded icon for the source program; null when they set none.

##### key

```ts
key: string;
```

The source program's event, same meaning as [AvailableReward.key](#key) —
what a client maps its built-in icon off. `''` when the coupon's program
snapshot never recorded one.

##### partiallyUsed?

```ts
partiallyUsed?: boolean;
```

Gift card spent down but still has balance — show the "Partially used" badge. Absent on older backends.

##### pointsSpent

```ts
pointsSpent: number;
```

Points actually spent at redemption time.

##### programId

```ts
programId: string | null;
```

The program it came from; null on coupons issued before that was recorded.

##### rewardId

```ts
rewardId: string;
```

The coupon's own id — NOT the program's.

##### rewardType

```ts
rewardType: RewardType | null;
```

##### rewardValue

```ts
rewardValue: number | null;
```

##### startsAt

```ts
startsAt: string | null;
```

ISO date-time, or null when it is usable immediately.

##### status

```ts
status: RewardStatus;
```

##### title

```ts
title: string;
```

***

### RedeemResult

Result of `POST /customer/redeem`.

#### Properties

##### couponCode

```ts
couponCode: string | null;
```

##### giftCard

```ts
giftCard: 
  | {
  expiresOn: string | null;
  isSentToFriend: boolean;
  recipientEmail: string | null;
}
  | null;
```

Gift-card delivery details; `null` for every other reward type.

##### id

```ts
id: string | null;
```

Issued voucher/discount ID.

##### pointsSpent

```ts
pointsSpent: number;
```

##### remainingPoints

```ts
remainingPoints: number;
```

Customer balance after redemption. Only trustworthy when
[remainingPointsKnown](#remainingpointsknown) is `true` — otherwise it is a placeholder `0`.

##### remainingPointsKnown

```ts
remainingPointsKnown: boolean;
```

`false` when the server could not read the new balance; do not repaint the balance from `remainingPoints`.

##### rewardType

```ts
rewardType: RewardType | null;
```

##### rewardValue

```ts
rewardValue: number | null;
```

***

### Referral

Personalised referral state (`GET /customer/referral`).

#### Properties

##### referralCode

```ts
referralCode: string | null;
```

##### referralLink

```ts
referralLink: string | null;
```

Null for guests or when referral is disabled.

##### rewardForFriend

```ts
rewardForFriend: string | null;
```

Human-readable reward the referred friend receives.

##### rewardForReferrer

```ts
rewardForReferrer: string | null;
```

##### stats

```ts
stats: ReferralStats;
```

***

### ReferralEmailResult

Result of `POST /customer/referral/send-email`.

#### Properties

##### sent

```ts
sent: boolean;
```

Always true on success — a declined send rejects instead of resolving false.

***

### ReferralHistoryEntry

One referred friend (`GET /customer/referral-history`). `email` is
OBFUSCATED server-side (`j******@example.com`) — a referrer sees who they
referred, never the friend's full address.

#### Properties

##### createdAt

```ts
createdAt: string | null;
```

##### email

```ts
email: string;
```

##### id

```ts
id: string;
```

##### status

```ts
status: ReferralHistoryStatus;
```

***

### ReferralHistoryPage

One page (5 rows) of JoyClient.getReferralHistory.

#### Properties

##### items

```ts
items: ReferralHistoryEntry[];
```

##### pagination

```ts
pagination: Pagination;
```

***

### ReferralStats

Referral stats (`GET /customer/referral`).

#### Properties

##### completed

```ts
completed: number;
```

##### pending

```ts
pending: number;
```

##### pointsEarned

```ts
pointsEarned: number;
```

***

### RevokeRewardResult

Result of `POST /customer/rewards/{rewardId}/revoke` — see JoyClient.revokeReward.

#### Extended by

- [`CancelRedeemResult`](#cancelredeemresult)

#### Properties

##### refundedPoints

```ts
refundedPoints: number;
```

Points returned to the customer's balance.

##### rewardId

```ts
rewardId: string;
```

##### status

```ts
status: "revoked";
```

***

### RewardCollectionRef

A collection referenced by a reward as an IDENTIFIER + display snapshot — the
"customer gets" collections of a Buy-X-Get-Y reward, and the collections a
collection-scoped free gift hands out. The client derives the
`/collections/{handle}` link itself.

#### Properties

##### handle

```ts
handle: string | null;
```

##### id

```ts
id: string;
```

Shopify collection id, numeric and unprefixed.

##### image

```ts
image: string | null;
```

##### title

```ts
title: string;
```

***

### RewardProductRef

A product referenced by a reward as an IDENTIFIER + display snapshot (title/
image/handle) — the "customer gets" products of a Buy-X-Get-Y reward. A client
renders the row and derives the `/products/{handle}` link itself.

#### Properties

##### handle

```ts
handle: string | null;
```

##### id

```ts
id: string;
```

Shopify product id, numeric and unprefixed.

##### image

```ts
image: string | null;
```

##### title

```ts
title: string;
```

***

### SegmentProgramQuery

One spending program to test for Shopify-segment membership
(`JoyClient.checkSegmentPrograms`). `segmentIds` are the program's own
`appliedSegments`; the customer is eligible if they are in ANY of them.

#### Properties

##### programId

```ts
programId: string;
```

##### segmentIds

```ts
segmentIds: string[];
```

***

### SendRewardInput

Input for JoyClient.sendRewardToFriend.

#### Properties

##### couponCode

```ts
couponCode: string;
```

The redeemed coupon to gift — must be one THIS customer redeemed from `programId`.

##### programId

```ts
programId: string;
```

The spending program the coupon came from.

##### recipient

```ts
recipient: SendRewardRecipient;
```

***

### SendRewardRecipient

The friend to gift a redeemed reward to.

#### Properties

##### email

```ts
email: string;
```

##### message?

```ts
message?: string;
```

##### name?

```ts
name?: string;
```

##### sendNotificationAt?

```ts
sendNotificationAt?: string;
```

ISO date-time to defer the notification to. Accepted for forward-compat but
NOT yet acted on — the current backend sends immediately (documented gap).

***

### SendRewardResult

Result of `POST /customer/send-reward-to-friend`.

#### Properties

##### sent

```ts
sent: boolean;
```

Always true on success — the call has no partial outcome to report.

***

### ShopConfig

Public shop configuration — branding, currency, point label.

#### Properties

##### branding

```ts
branding: Branding;
```

##### currency

```ts
currency: string;
```

##### currencyFormat

```ts
currencyFormat: string;
```

Shopify money format, e.g. `${{amount}}`.

##### facebookPageId

```ts
facebookPageId: string | null;
```

The Facebook Page the shop currently has connected; `null` when it has
none. Needed to build the `m.me/{facebookPageId}?ref=...` Messenger link
that links a shopper's Facebook account — a client constructs that link
itself, no signing endpoint required. Public by nature: it is the visible
half of that Messenger link, and the same value already ships in the
storefront metafield the Liquid widget reads.

Pair with [CustomerSocial.facebookConnected](#facebookconnected), which reports whether
THIS shopper is linked to that page — and with
JoyClient.disconnectFacebook for the way back out.

##### isNewFormatDOB

```ts
isNewFormatDOB: boolean;
```

Whether the birthday-entry modal must also collect a YEAR (not just
day/month). Shop-level — shared by every date-of-birth-collecting event.
[ProgramBirthday.dateFormat](#dateformat) is a different, per-program setting: it
only reorders day/month for display, never adds or removes the year field.

##### loyaltyPageUrl

```ts
loyaltyPageUrl: string | null;
```

##### optInEnrollmentEnabled

```ts
optInEnrollmentEnabled: boolean;
```

Whether the shop is running the self-serve "opt-in" enrollment flow
(Premium plan + not manual-assignment-only + the toggle is on). Combine
with [Customer.type](#type-1) to decide when to show a "Join Program"
button — see JoyClient.joinProgram. Rides this endpoint's own
5-minute CDN cache, so a shop that just upgraded plan or flipped the
toggle can take up to 5 minutes to see it reflect here.

##### pointLabel

```ts
pointLabel: PointLabel;
```

##### programEnabled

```ts
programEnabled: boolean;
```

##### shopDomain

```ts
shopDomain: string | null;
```

`null` when the shop's domain is unresolved.

***

### SocialEarnResult

Result of `POST /customer/earn/social`.

#### Extended by

- [`EarnResult`](#earnresult)

#### Properties

##### key

```ts
key: string;
```

Program event key — same values as [Program.key](#key-2).

##### pointsEarned

```ts
pointsEarned: number;
```

Points actually added. May be LOWER than the program's advertised
points when the shop's global earning limit partially caps the award.

##### programId

```ts
programId: string | null;
```

The program that was claimed. `null` when the server did not echo it.

##### totalPoints

```ts
totalPoints: number;
```

Customer balance after the award.

***

### StoreCreditTransaction

One store-credit transaction row (`GET /customer/store-credit/transactions`).
`amount` and `balanceAfter` are decimal money values (NOT cents) in
`currencyCode`; a debit `amount` is negative.

#### Properties

##### amount

```ts
amount: number;
```

##### balanceAfter

```ts
balanceAfter: number;
```

##### createdAt

```ts
createdAt: string | null;
```

##### currencyCode

```ts
currencyCode: string;
```

##### event

```ts
event: string | null;
```

System event (`ADJUSTMENT`, `ORDER_PAYMENT`, `ORDER_REFUND`, …); null when none.

##### expiresAt

```ts
expiresAt: string | null;
```

ISO date-time the credit expires, or null when it never does.

##### orderName

```ts
orderName: string | null;
```

Order name the transaction originated from, e.g. `#1042`; null when not order-linked.

##### type

```ts
type: string;
```

Shopify transaction `__typename`, e.g. `StoreCreditAccountCreditTransaction`.

***

### StoreCreditTransactionPage

One page of JoyClient.getStoreCreditTransactions. Uses Shopify's
OPAQUE cursors (`startCursor`/`endCursor`) and `hasNextPage`/`hasPrevPage`
flags — NOT the id-based [Pagination](#pagination-2) the activities/rewards lists use,
because store credit is paged straight through Shopify's own connection.

No `accountId`: the headless route resolves the customer's OWN store-credit
account server-side from the JWT and never accepts (or echoes) a client
accountId — the deliberate IDOR fix that distinguishes it from the popup's
`/popup/store-credit/transactions`. Pass `before`/`after` cursors from here
straight back into the next call.

#### Properties

##### endCursor

```ts
endCursor: string | null;
```

##### hasNextPage

```ts
hasNextPage: boolean;
```

##### hasPrevPage

```ts
hasPrevPage: boolean;
```

##### startCursor

```ts
startCursor: string | null;
```

##### transactions

```ts
transactions: StoreCreditTransaction[];
```

***

### Tier

A VIP tier with its perks.

#### Properties

##### description

```ts
description: string | null;
```

##### iconUrl

```ts
iconUrl: string | null;
```

##### id

```ts
id: string;
```

##### memberCount

```ts
memberCount: number | null;
```

Present only when the merchant enables member counts.

##### name

```ts
name: string;
```

##### perks

```ts
perks: TierPerk[];
```

##### threshold

```ts
threshold: number;
```

Points or spend required to reach this tier.

##### tierRewards?

```ts
tierRewards?: TierRewardDefinition[];
```

Structured tier rewards the core maps into membership-card + perks-page
perks. Backend emits this alongside [perks](#perks) (the older generic list);
absent on older payloads.

***

### TierPerk

A perk attached to a VIP tier.

#### Properties

##### description

```ts
description: string | null;
```

##### id

```ts
id: string;
```

##### title

```ts
title: string;
```

***

### TierPerkSaveInput

Input for JoyClient.saveTierPerkVariantSelection — the fields the
tier-perk picker emits on `joy-tier-perk-save` for a PRIVILEGE perk, minus
identity and minus the reward definition. SELECTIONS ONLY: the server
re-resolves the perk's allowed variants from the program/tier config and
rejects any `variantIds` off that allow-list — the same variant-tampering
guard the product-discount Rust function at checkout depends on — so a
crafted body can never persist a variant the merchant never offered. The
customer/shop are taken from the token, never the body.

#### Properties

##### programId

```ts
programId: string;
```

##### tierId

```ts
tierId: string;
```

##### variantIds

```ts
variantIds: string[];
```

The picked product-variant ids (numeric, unprefixed).

***

### TierPerkSaveResult

Result of `POST /customer/perk/save-variant-selection`. Carries the merged
`tierData` the widget writes back onto the customer so the rebuilt perk shows
the confirmed-selection view; loosely typed like [MilestoneClaimResult](#milestoneclaimresult)'s
extras — the widget re-derives the perk view from its own repaint.

#### Properties

##### tierData?

```ts
tierData?: unknown;
```

***

### TierProgress

Progress toward the next tier; `null` when already at the top tier.

#### Properties

##### currentTarget?

```ts
currentTarget?: number;
```

The current tier's own targetPoint (0 for the base tier). Exact anchor
for a membership-card bar — avoids back-deriving it from the rounded
[percentage](#percentage-1), which drifts by hundreds of points near 100%.
Optional: absent on older servers that don't send it yet.

##### nextTarget?

```ts
nextTarget?: number | null;
```

The next tier's targetPoint, or `null` at the top tier. Optional: absent
on older servers that don't send it yet.

##### nextTierName

```ts
nextTierName: string | null;
```

##### percentage

```ts
percentage: number;
```

0–100.

##### pointsToNext

```ts
pointsToNext: number;
```

***

### TierRewardDefinition

One structured tier-reward the core reads off `Tier.tierRewards` (the shape
`getTierRewards()` returns and `applyTierPerks` maps via `formatRewardLabel` /
`buildPerkLink` in the widget core). Every field is optional — the
backend `tierPresenter` emits exactly these keys and any value may be absent.
`tierId` is intentionally NOT here: the core sets it itself.
`rewardProductSelectionMode` is also omitted —
only the product-picker perks page consumes it, which headless does not build.

#### Properties

##### bonusPoints?

```ts
bonusPoints?: string | number;
```

##### description?

```ts
description?: string | null;
```

##### earnAmount?

```ts
earnAmount?: string | number;
```

##### event?

```ts
event?: string;
```

##### externalLinkDisplayOn?

```ts
externalLinkDisplayOn?: Record<string, boolean>;
```

Per-surface visibility map (e.g. `{widget: false}`); an absent key means "show".

##### externalLinkLabel?

```ts
externalLinkLabel?: string;
```

##### externalLinkStyle?

```ts
externalLinkStyle?: string;
```

##### externalLinkTarget?

```ts
externalLinkTarget?: string;
```

##### externalLinkUrl?

```ts
externalLinkUrl?: string;
```

##### hasExternalLink?

```ts
hasExternalLink?: boolean;
```

##### id?

```ts
id?: string;
```

##### shippingDiscountAmount?

```ts
shippingDiscountAmount?: string | number;
```

##### shippingDiscountType?

```ts
shippingDiscountType?: string;
```

##### title?

```ts
title?: string;
```

##### translateTitle?

```ts
translateTitle?: Record<string, string>;
```

##### type?

```ts
type?: string;
```

***

### UpdateProfileOptions

Options for JoyClient.updateProfile. At least one field is
required — an omitted field is left unchanged, so any one may be sent
alone (e.g. a marketing-consent-only toggle never touches the name/avatar).

#### Properties

##### acceptsMarketing?

```ts
acceptsMarketing?: boolean;
```

Email marketing consent. Synced to Shopify for a customer linked to a
Shopify account; kept locally for a guest. Omit to leave it unchanged.

##### acceptsSmsMarketing?

```ts
acceptsSmsMarketing?: boolean;
```

SMS marketing consent. Synced to Shopify for a customer linked to a
Shopify account; kept locally for a guest. Omit to leave it unchanged.

##### avatarBase64?

```ts
avatarBase64?: string;
```

A data URL (`data:image/png;base64,...`) or raw base64 image, up to 10MB decoded.

##### firstName?

```ts
firstName?: string;
```

Empty string clears the stored first name. Omit to leave it unchanged.

##### lastName?

```ts
lastName?: string;
```

Empty string clears the stored last name. Omit to leave it unchanged.

##### phone?

```ts
phone?: string;
```

E.164 phone (`+14155550123`). Empty string clears the stored phone; omit to
leave it unchanged. Synced to Shopify for a customer linked to a Shopify
account; kept locally for a guest.

***

### VerifyApplePassResult

Result of `GET /customer/wallet-pass/apple/verify`.

#### Properties

##### exists

```ts
exists: boolean;
```

Whether the pass record behind [Customer.createdApplePass](#createdapplepass) still
exists. `false` means the customer's `createdApplePass`/pass-URL fields
were just cleared server-side (self-heal) — treat it the same as a
customer who never created a pass.

## Type Aliases

### ActivityType

```ts
type ActivityType = "earn" | "spend" | "adjust" | "expire";
```

`Activity.type` — collapsed 4-value kind (see backend activityPresenter).

***

### BirthdayEarnContext

```ts
type BirthdayEarnContext = Exclusive<BirthdayEarnContextFields>;
```

`POST /customer/earn` context for a `birthday` program — the same two
inputs the widget's birthday modal collects.

***

### BirthdayRewardsMap

```ts
type BirthdayRewardsMap = Record<string, string[]>;
```

A birthday reward selection, keyed by 4-digit year, each value a list of
[ProgramBirthdayRewardOption.id](#id-12) values from JoyClient.getPrograms.
Only the CURRENT year is ever read when a reward is granted; older years are
carried so the shopper's past picks survive.

The whole map is stored and replaced as a unit — see
JoyClient.setBirthdayRewards, which does not merge.

Unknown ids are inert rather than rejected: every consumer resolves them
against the program and drops whatever is not a configured reward, and a
year whose ids all fail to resolve falls back to the program's default. The
SIZE is bounded server-side though (20 years; 20 ids per year; 100
characters per id), because the map lands in the customer record
JoyClient.getInfo re-reads on every request — breaching a bound is
`BAD_REQUEST` (400), not a silent truncation.

***

### CustomerType

```ts
type CustomerType = "guest" | "member";
```

`Customer.type` — whether the shopper has joined the loyalty program.
Combine with [ShopConfig.optInEnrollmentEnabled](#optinenrollmentenabled) to decide when to
show a "Join Program" button — see JoyClient.joinProgram. A
customer who has left the program also reports `'guest'` here (no third
wire value) — JoyClient.joinProgram rejects a re-join attempt for
that case with `NOT_ELIGIBLE` rather than silently no-op'ing.

***

### EarnContext

```ts
type EarnContext = 
  | BirthdayEarnContext
  | ReceiptEarnContext
  | SubmitFormEarnContext
  | GoogleMapsReviewEarnContext;
```

Per-family input for JoyClient.earn. A union rather than a single
loose object: which shape is valid depends on the program's `key`, so
writing e.g. `images` into an object meant for a `birthday` claim is a type
error at the call site (see Exclusive) rather than a runtime
`INVALID_INPUT`.

Omit `context` entirely for `sign_up`, `sign_up_newsletter`,
`member_anniversary`, `interact_website`, `streak_interact_website`, and the
13 social events (`follow_instagram`, `like_facebook`, ...) — none of them
take input.

***

### EarnStatus

```ts
type EarnStatus = "earned" | "pending";
```

`EarnResult.status` — see [EarnResult](#earnresult).

***

### GiftSelectionMode

```ts
type GiftSelectionMode = "all" | "one";
```

How a `free_product` reward picks its gift.
`one` — the customer chooses one of CustomerReward.giftProducts and
passes it to JoyClient.redeem. `all` — the reward covers every
configured product, so there is nothing to choose.

***

### GoogleMapsReviewEarnContext

```ts
type GoogleMapsReviewEarnContext = Exclusive<GoogleMapsReviewEarnContextFields>;
```

`POST /customer/earn` context for a `google_maps_review` program.

***

### GoogleReviewStatus

```ts
type GoogleReviewStatus = "pending" | "approved" | "rejected";
```

`Program.googleReview.status` — the shopper's own review, if any.

***

### ImpactEventType

```ts
type ImpactEventType = "tree" | "plastic";
```

`ImpactEvent.type` — the kind of impact a redemption funded.

***

### JoinFrom

```ts
type JoinFrom = 
  | "widget"
  | "loyalty_page"
  | "account_page"
  | "product_page"
  | "checkout_thank_you";
```

`POST /customer/join-program` attribution surface — see
JoyClient.joinProgram. Any other value is treated server-side as
omitted (falls back to `'widget'`).

***

### JoyEnvelope

```ts
type JoyEnvelope<T> = JoySuccess<T> | JoyError;
```

Either envelope, as returned by every Headless API endpoint.

#### Type Parameters

| Type Parameter |
| -------------- |
| []() `T`       |

***

### JoyFetch

```ts
type JoyFetch = (url, init?) => Promise<Response>;
```

Fetch signature accepted by the client — lets Weaverse loaders inject
`weaverse.fetchWithCache`-style wrappers. Defaults to `globalThis.fetch`.

#### Parameters

| Parameter | Type          |
| --------- | ------------- |
| `url`     | `string`      |
| `init?`   | `RequestInit` |

#### Returns

`Promise`<`Response`>

***

### LineJoinType

```ts
type LineJoinType = "follow_oa" | "join_link";
```

`Program.lineJoinType` — how a `join_line` program credits points.

***

### ~~MilestoneEarnContext~~

```ts
type MilestoneEarnContext = Exclusive<MilestoneEarnContextFields>;
```

`POST /customer/earn` context for a `milestone` program — the Flow-style
grant-all path.

#### Deprecated

Use JoyClient.claimMilestoneStep (customer-picks ladder) or
JoyClient.claimMilestone instead; milestone claims no longer go through `earn`. A different feature from JoyClient.claimMilestoneStep,
which claims one step of a "customer picks" ladder instead.

***

### MilestoneProgress

```ts
type MilestoneProgress = Record<string, number>;
```

Milestone progress (`GET /customer/milestone`) — the customer's current metric
per milestone type, keyed by `typeMilestone` (`order`, `spent_amount`,
`earned_point`, `reviews`, `referral`, `subscription`; a mixed program keys by
its step types). An empty object when the shop runs no active milestone
program.

These are COUNTERS ONLY. They carry no step thresholds, and `Program`
(`getPrograms()`) carries no milestone configuration either — so the two
cannot be joined: `Program` has no `typeMilestone` to key off. A caller
holding only these values cannot tell which program card a given count
belongs to once a shop runs more than one milestone program.

To draw a ladder you need a source that carries the step configuration:
JoyClient.getMilestones (server-rendered, one program per call), or
the shop metafield blob, which is where the V4 widget reads it.

(An earlier version of this doc said to pair these with `getPrograms()`.
That was never true and cost a planning cycle — see the cook report of
2026-09-08.)

***

### MilestoneRewardAction

```ts
type MilestoneRewardAction = 
  | "bonus_point"
  | "give_product"
  | "amount"
  | "percentage"
  | "free_shipping"
  | "plant_tree"
  | "store_credit";
```

`MilestoneReward.action` — reward kind granted at one milestone step.

***

### MilestoneRewardLogic

```ts
type MilestoneRewardLogic = "grantAll" | "customerPicks";
```

`MilestoneStep.rewardLogic` — see [MilestoneStep.rewardLogic](#rewardlogic).

***

### MilestoneState

```ts
type MilestoneState = "locked" | "current" | "claimable" | "achieved" | "passed_unclaimed";
```

`MilestoneStep.state` — see [MilestoneStep.state](#state).

***

### MilestoneType

```ts
type MilestoneType = 
  | "milestone_order"
  | "milestone_amount_spent"
  | "milestone_earned_point"
  | "milestone_reviews"
  | "milestone_referral"
  | "milestone_subscription"
  | "milestone_inactivity"
  | "milestone_mixed";
```

`MilestoneLadder.typeMilestone` — which counter drives this program's steps.

***

### OrderFulfillmentStatus

```ts
type OrderFulfillmentStatus = "fulfilled" | "partial" | null;
```

`Order.fulfillmentStatus` — collapsed to the same lowercase values the
Liquid-injected order data used (the backend maps Shopify's
`displayFulfillmentStatus` down to these). `UNFULFILLED`/empty -> `null`.

***

### ProgramType

```ts
type ProgramType = "earning" | "spending";
```

`Program.programType` — which side of the loyalty loop a program is on.

***

### ReceiptEarnContext

```ts
type ReceiptEarnContext = Exclusive<ReceiptEarnContextFields>;
```

`POST /customer/earn` context for a `submit_receipt` program.

***

### RedeemType

```ts
type RedeemType = "fixed" | "dynamic";
```

How a spending program is priced. `fixed` — one price (`pointsCost`).
`dynamic` — the customer chooses a multiple of `pointsCost`, each step worth
`rewardValue`, bounded by `minPoints`/`maxPoints`. This is the DEFAULT for
"Amount discount" programs, so a client that ignores it is wrong often.

***

### ReferralHistoryStatus

```ts
type ReferralHistoryStatus = "complete" | "pending" | "cancel";
```

`ReferralHistoryEntry.status` — the referred friend's lifecycle state.

***

### RewardStatus

```ts
type RewardStatus = "active" | "used" | "expired" | "notYetUsable";
```

`RedeemedReward.status` — the coupon's lifecycle state, mirroring the
backend's `prepareStatusReward`. A `notYetUsable` coupon exists but its
`startsAt` is in the future: show "Active from …", not an Add-to-cart button.

***

### RewardType

```ts
type RewardType = "fixed_amount" | "percentage" | "free_shipping" | "free_product";
```

`Program.rewardType` — reward kind for spending programs.

***

### SegmentEligibility

```ts
type SegmentEligibility = Record<string, boolean>;
```

`{programId: boolean}` — `true` means the customer is inside at least one of
that program's gating segments. Fail-closed: a program the server could not
resolve is `false`, never absent-and-assumed-eligible.

***

### SubmitFormEarnContext

```ts
type SubmitFormEarnContext = Exclusive<SubmitFormEarnContextFields>;
```

`POST /customer/earn` context for a `submit_form` or `fill_survey` program.
