index
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
new JoyApiError(__namedParameters): JoyApiError;Parameters
| Parameter | Type |
|---|---|
__namedParameters | { code: string; message: string; statusCode: number; } |
__namedParameters.code | string |
__namedParameters.message | string |
__namedParameters.statusCode | number |
Returns
Overrides
Error.constructor
Properties
cause?
cause?: unknown;Inherited from
Error.cause
code
readonly code: string;message
message: string;Inherited from
Error.message
name
name: string;Inherited from
Error.name
stack?
stack?: string;Inherited from
Error.stack
statusCode
readonly statusCode: number;stackTraceLimit
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()
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.
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:
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()
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 (opens in a new tab)
Inherited from
Error.prepareStackTrace
Interfaces
Activity
One point-transaction history row (GET /customer/activities).
Properties
couponCode?
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
createdAt: string | null;customerId?
customerId?: string | null;This customer's own Joy customer id.
discountId?
discountId?: string | number | null;Minted discount id (redeem rows).
email?
email?: string | null;This customer's own email.
event?
event?: string | null;Earning event key, e.g. sign_up / interact_website.
hasWebhook?
hasWebhook?: boolean | null;Internal delivery flag.
id
id: string;isWebhookSent?
isWebhookSent?: boolean | null;Internal delivery flag.
newPoint?
newPoint?: number;Point balance immediately after this row.
oldPoint?
oldPoint?: number;Point balance immediately before this row.
orderId?
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
points: number;Signed — positive for earn, negative for spend/expire.
priceRuleId?
priceRuleId?: string | number | null;Legacy price-rule id (redeem rows).
program?
program?: Record<string, unknown> | null;Embedded program snapshot, when the row carries one.
programId?
programId?: string | null;Source program id.
programTitle?
programTitle?: string | null;Source program title snapshot.
rawType?
rawType?: string | null;Raw ACTION_* value (Liquid's type), e.g. redeem_point/earn_point.
redeemPoint?
redeemPoint?: number | null;Points spent (redeem rows).
shopId?
shopId?: string | null;The shop id.
shopifyCustomerId?
shopifyCustomerId?: number | null;This customer's Shopify numeric id.
source?
source?: string | null;How the row was created, e.g. user / source_headless.
statusSentNotification?
statusSentNotification?: boolean | null;Internal notification flag.
title
title: string;type
type: ActivityType;typeCustom?
typeCustom?: string | null;Custom-program sub-type, when set.
updatedAt?
updatedAt?: string | null;ISO timestamp of last update.
ActivityPage
A page of Activity rows plus its pagination flags.
Properties
activities
activities: Activity[];pagination
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
address1: string;address2
address2: string;city
city: string;company
company: string;country
country: string;firstName
firstName: string;id
id: string | number | null;isDefault
isDefault: boolean;lastName
lastName: string;phone
phone: string;province
province: string;provinceCode
provinceCode: string;zip
zip: string;AddressDeleteResult
Result of POST /customer/addresses/delete.
Properties
deleted
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
address1: string;address2?
address2?: string;city
city: string;company?
company?: string;country
country: string;firstName?
firstName?: string;id?
id?: string | number;Existing Shopify address id, to update it. Omit to create a new address.
isDefault?
isDefault?: boolean;Set to also make this the customer's default address.
lastName?
lastName?: string;phone?
phone?: string;province?
province?: string;provinceCode?
provinceCode?: string;zip?
zip?: string;AppleWalletPassResult
Result of POST /customer/wallet-pass/apple.
Properties
qrUrl
qrUrl: string;PNG data URL (data:image/png;base64,...) of url, for surfaces
(e.g. in-store) that show a scannable code instead of a tap link.
url
url: string;Public download link for the generated .pkpass file.
AvailableReward
A spending program the customer can redeem now (GET /customer/rewards).
Properties
affordable
affordable: boolean;Whether the customer can afford the cheapest redemption this program
allows — minPoints when there is one, else pointsCost.
conditionCollectionsGets?
conditionCollectionsGets?: RewardCollectionRef[];BXGY only: the collections the customer gets. [] otherwise.
conditionProductsGets?
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 (server-rendered for every reward), and the latter is only ever built client-side, so map it off these structured fields.
conditions
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
description: string;enableMaximumUsesPerOrder?
enableMaximumUsesPerOrder?: boolean;BXGY only: whether a per-order use cap is set. false otherwise.
giftProducts
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
giftSelectionMode: GiftSelectionMode | null;Null for every reward that isn't a free_product.
hasLimitCartValue
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 alone overstates it — feed
limitCartValue and the cart total into the slider bound. Always
false on fixed programs.
iconUrl
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.
impactDashboardUrl?
impactDashboardUrl?: string | null;Impact reward only: the merchant's public impact dashboard link. null otherwise.
impactProvider?
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?
impactQuantity?: number | null;Impact reward only: how many units per redemption. null otherwise.
impactType?
impactType?: string | null;Impact reward only: what is created (e.g. tree). null otherwise.
key
key: string;Program event key — same values as Program.key; map built-in icons off it.
limitCartValue
limitCartValue: number | null;The cap from hasLimitCartValue, as an integer percent 1-100 of cart value. Null when hasLimitCartValue is false.
maximumUsesPerOrder?
maximumUsesPerOrder?: number | null;BXGY only: the per-order use cap when enableMaximumUsesPerOrder. null otherwise.
maxPoints
maxPoints: number | null;Dynamic only, and only when the merchant set a ceiling. Null = unbounded.
minPoints
minPoints: number | null;Dynamic only, and only when the merchant set a floor. Null = unbounded.
orderReqQuantity?
orderReqQuantity?: number | null;BXGY only: how many "buy" items are required. null otherwise.
pointsCost
pointsCost: number;fixed — the price. dynamic — the STEP: how many points buy one
rewardValue of discount. Read redeemType before treating it as a
price.
programId
programId: string;redeemType
redeemType: RedeemType;rewardType
rewardType: RewardType | null;rewardValue
rewardValue: number | null;Discount gained per pointsCost points.
sendRewardToFriend?
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?
sendRewardToFriendAutomationProvider?: string | null;When the send-to-friend flow routes through an automation, which provider.
null when sendRewardToFriend is off or no provider is configured.
title
title: string;BirthdayClaimResult
Result of POST /customer/birthday/claim.
Properties
claimed
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
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 (which reward
they picked) and BirthdayClaimResult (claiming the annual reward).
Properties
birthday
birthday: string | null;The stored birthday as 'MM/DD', or null.
dateOfBirth
dateOfBirth: string | null;The stored 'YYYY-MM-DD' on shops that collect a year, else null.
earnedCompleteBirthday
earnedCompleteBirthday: boolean;Whether saving the date granted the one-time "complete birthday" reward.
earnPoint
earnPoint: number;Points granted by that reward; 0 when none.
Branding
Shop branding colors.
Properties
primaryColor
primaryColor: string | null;null when the merchant never picked a brand color — fall back to your own theme.
secondaryColor
secondaryColor: string | null;CancelRedeemResult
Result of POST /customer/rewards/{rewardId}/cancel — see JoyClient.cancelRedeem.
Same fields as RevokeRewardResult, plus the balance the refund left.
Extends
Properties
customer
customer: object;point
point: number;refundedPoints
refundedPoints: number;Points returned to the customer's balance.
Inherited from
RevokeRewardResult.refundedPoints
rewardId
rewardId: string;Inherited from
status
status: "revoked";Inherited from
Customer
Personalised customer state (GET /customer).
Properties
assignedTierId?
assignedTierId?: string | null;The customer's OWN stored tier id, or null when they have none (a guest).
Unlike Customer.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
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
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
createdApplePass: boolean;Whether this customer has an Apple Wallet pass on file, created via JoyClient.createApplePass. Combine with qrCodeDownloadApplePass to decide whether to show an "Add to Apple Wallet" button or a re-download QR code.
dateOfBirth
dateOfBirth: string | null;'YYYY-MM-DD'. Only ever set on shops asking for a year
(ShopConfig.isNewFormatDOB); null on shops that only collect
day/month.
earningLimit
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?
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
id: string;marketingConsent
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
memberSince: string | null;ISO date-time, or null when unknown.
phone?
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
points: number;Current spendable balance.
qrCodeDownloadApplePass
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 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
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 — use
it ONLY to show opt-in state and disable an already-checked control.
social
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
tier: CustomerTierRef | null;tierPoint?
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
alone. 0 (not null) when the customer is below the first threshold. Absent
on older payloads.
tierProgress
tierProgress: TierProgress | null;totalEarned
totalEarned: number | null;totalOrders?
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
type: CustomerType;Whether this customer has joined the loyalty program. See CustomerType.
CustomerRewards
GET /customer/rewards. Two lists, not one: merging them showed a
just-redeemed reward twice in the same grid.
Extended by
Properties
available
available: AvailableReward[];customerPoints
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
redeemed: RedeemedReward[];CustomerSocial
Customer.social — see Customer.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
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
facebookName: string | null;Display name Meta returned when the link was made, for a "Connected as
{name}" label. null when facebookConnected is false, and null
when Meta sent no name — render a bare "Connected" in that case.
instagramUsername
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
lineFollowedOA: boolean;Whether the customer also follows the shop's LINE Official Account. A SEPARATE step from 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
lineLinked: boolean;Whether the customer completed LINE Login (the OAuth popup from
JoyClient.getLineAuthUrl). A join_line program whose
Program.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).
Properties
id
id: string;name
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
imageBase64: string;Base64 image data, with or without a data:image/png;base64, prefix.
imageName?
imageName?: string;Original file name — used only in error messages.
imageType
imageType: "image/jpeg" | "image/jpg" | "image/png";EarningLimit
Customer.earningLimit — see Customer.
Properties
message
message: string | null;Server-rendered warning sentence, ready to show as-is. null when
reached is false — there is no sentence to show until then.
reached
reached: boolean;Whether the customer has hit the limit for the current period.
remainingCapacity?
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. Optional only for old-server compatibility:
absent on payloads from a backend that predates the field — treat absent as
"no cap known".
resetDate
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 plus status.
Extends
Properties
key
key: string;Program event key — same values as Program.key.
Inherited from
pointsEarned
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
programId
programId: string | null;The program that was claimed. null when the server did not echo it.
Inherited from
status
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
totalPoints: number;Customer balance after the award.
Inherited from
EarnUploadResult
Result of POST /customer/earn/upload.
Properties
urls
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
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 — it hits Shopify uncached, so the rewards list must not pay for it. Match a variant back to its GiftVariant by id to disable the sold-out ones.
Properties
missingVariantIds?
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
products: FreeGiftStockProduct[];FreeGiftStockProduct
Live stock for one product of a free_product gift.
Properties
available
available: boolean;productId
productId: string;Shopify product id, numeric and unprefixed — matches GiftProduct.id.
variants
variants: FreeGiftStockVariant[];FreeGiftStockVariant
Live stock for one variant of a free_product gift.
Properties
available
available: boolean;variantId
variantId: string;Shopify product-variant id, numeric and unprefixed — matches GiftVariant.id.
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 uses).
Properties
isReferralLimitReached
isReferralLimitReached: boolean;referralCode
referralCode: string;referralLimit
referralLimit: number | null;urlReferral
urlReferral: string;The guest's ready-to-share referral link.
GiftProduct
A product a free_product reward lets the customer choose from.
Properties
id
id: string;Shopify product id, numeric and unprefixed.
image
image: string | null;title
title: string;variants
variants: GiftVariant[];GiftVariant
One selectable variant of a GiftProduct.
Properties
id
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
title: string;GoogleWalletPassResult
Result of GET /customer/wallet-pass/google.
Properties
link
link: string;Google Wallet "Add to Google Wallet" save link.
ImpactEvent
One environmental-impact redemption (GET /customer/impact-history).
Properties
createdAt
createdAt: string | null;id
id: string;quantity
quantity: number;Units funded (trees planted / bottles removed).
status
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
type: ImpactEventType;ImpactHistory
The customer's environmental-impact history (GET /customer/impact-history):
reconciled cumulative ImpactTotals plus the individual redemption
ImpactEvents. 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
connected: boolean;events
events: ImpactEvent[];pagination
pagination: Pagination;Cursor pagination for events.
totals
totals: ImpactTotals;ImpactTotals
Cumulative environmental-impact totals (GET /customer/impact-history).
Properties
plasticBottles
plasticBottles: number;trees
trees: number;InstagramLinkResult
Result of POST /customer/social/instagram/link.
Properties
instagramUsername
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
pointsEarned: number;Points granted by this call. 0 when rewardEarned is false.
rewardEarned
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
error: object;code
code: string;message
message: string;statusCode
statusCode: number;success
success: false;timestamp
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/Customer: 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
[key: string]: unknownProperties
allTiers?
allTiers?: unknown[];customer?
customer?: JoyInfoCustomer;Present only when the call was authenticated (Bearer JWT); absent for a guest.
primaryTranslation?
primaryTranslation?: Record<string, unknown>;referralProgram?
referralProgram?: Record<string, unknown>;settings?
settings?: Record<string, unknown>;settingsReferral?
settingsReferral?: Record<string, unknown>;settingWidgetQr?
settingWidgetQr?: Record<string, unknown>;tierProgram?
tierProgram?: Record<string, unknown>;translation?
translation?: Record<string, unknown>;JoyInfoCustomer
JoyInfo.customer — the rich, personalised customer object handleGetInfo builds
(finalCustomer), a superset of Customer. Same looseness rule as JoyInfo.
Indexable
[key: string]: unknownProperties
acceptsMarketing?
acceptsMarketing?: boolean | null;acceptsSmsMarketing?
acceptsSmsMarketing?: boolean | null;avatarUrl?
avatarUrl?: string | null;becomeMemberAt?
becomeMemberAt?: string | null;birthday?
birthday?: string | null;canClaimMemberAnniversary?
canClaimMemberAnniversary?: boolean;dateOfBirth?
dateOfBirth?: string | null;earnMemberAnniversaryReward?
earnMemberAnniversaryReward?: boolean;email?
email?: string | null;facebook?
facebook?: object;name?
name?: string | null;pageId?
pageId?: string | null;psid?
psid?: string | null;impact?
impact?: object;plasticBottles?
plasticBottles?: number;trees?
trees?: number;instagramUsername?
instagramUsername?: string | null;latestActivity?
latestActivity?: unknown;phone?
phone?: string | null;point?
point?: number;qrImageUrl?
qrImageUrl?: string | null;referralCode?
referralCode?: string | null;referralCompleteCount?
referralCompleteCount?: number;referralPendingCount?
referralPendingCount?: number;storeCredit?
storeCredit?: unknown;tierData?
tierData?: Record<string, unknown>;tierId?
tierId?: string;tierPoint?
tierPoint?: number;JoySuccess
Success envelope: {success: true, data, meta?, timestamp}.
Type Parameters
Properties
data
data: T;meta?
meta?: Record<string, unknown>;Optional metadata (pagination, counts).
success
success: true;timestamp
timestamp: string;ISO date-time of the response.
LineAuthUrlResult
Result of POST /customer/social/line/auth-url.
Properties
authUrl
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?
isMixed?: boolean;Mixed programs only.
isSelectVariantFreeGiftMilestone?
isSelectVariantFreeGiftMilestone?: boolean;Whether the shopper picked a variant for a free-gift milestone reward.
milestoneValue
milestoneValue: string | number;The raw step value (for a mixed program, still the raw step value, not the composite key).
programId
programId: string;selectedRewardIds?
selectedRewardIds?: number[];Indices into the SERVER-resolved step's rewards; absent claims the whole step.
stepType?
stepType?: string;Mixed programs only — the step's type.
variantIdsSelected?
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
[pendingField: string]: unknownThe type-specific pending-claim array (dynamic key), post-claim.
Properties
point
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
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
programId: string;steps
steps: MilestoneStep[];subheading
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
supported: boolean;False for program types with no storefront ladder
(milestone_inactivity). steps is empty; render the program's
own description instead of an empty track.
title
title: string;Program title in the served locale. '' when unset, never null.
typeMilestone
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
claimKey: string;The step's claimKey from JoyClient.getMilestones. Opaque.
selectedRewardIds
selectedRewardIds: number[];Indexes into the step's rewards array. Exactly maxRewardSelect of
them, each in range, no duplicates — anything else is
INVALID_SELECTION.
variantIds?
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
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
claimedRewardIds: number[];pointsEarned
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 says which.
step
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
totalPoints: number;Customer balance after the grant.
MilestoneReward
One reward line at a MilestoneStep.
Properties
action
action: MilestoneRewardAction;giftProducts
giftProducts: GiftProduct[];Empty unless needsVariantChoice. Same shape as AvailableReward.giftProducts.
index
index: number;Position in this step's rewards — the value to send in
MilestoneLadderClaimInput.selectedRewardIds. The client never sends the
reward itself.
needsVariantChoice
needsVariantChoice: boolean;A free product whose variant this shopper still has to choose. Render giftProducts as a picker and send the choice in MilestoneLadderClaimInput.variantIds — without it the coupon would entitle every variant.
text
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. Every string here is print-ready.
Properties
claimKey
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
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
maxRewardSelect: number;How many rewards the shopper may pick when state is claimable.
1 unless the merchant raised it. Keep the Claim button disabled until
exactly this many are selected.
note
note: string | null;Tooltip text for passed_unclaimed. Null in every other state.
progress
progress: MilestoneStepProgress | null;Present only when state is current.
reached
reached: boolean;Whether the circle and the connector above it are filled. Separate from
state on purpose — on milestone_mixed a step counts as reached
by its position in the sequence, not by its own counter.
rewardLogic
rewardLogic: MilestoneRewardLogic;rewards
rewards: MilestoneReward[];state
state: MilestoneState;locked — not reached. current — the step being worked towards; the
only one carrying 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 as a tooltip beside the
label.
stepType
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
completedText: string;'"42% completed"', localised and lowercased as the loyalty page renders it.
percent
percent: number;0-100, already clamped — width of the bar.
remainingText
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
billingAddress: OrderAddress | null;createdAt
createdAt: string | null;currencyCode
currencyCode: string;customer
customer: OrderCustomer | null;discounts
discounts: OrderDiscount[];financialStatus
financialStatus: string;Lowercased Shopify financial status, e.g. paid, pending, refunded.
fulfillmentStatus
fulfillmentStatus: OrderFulfillmentStatus;id
id: number;Shopify order id, numeric and unprefixed.
lineItemCount
lineItemCount: number;lineItems
lineItems: OrderLineItem[];name
name: string;Order name, e.g. #1042.
orderStatusUrl
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
paymentGatewayNames: string[];shippingAddress
shippingAddress: OrderAddress | null;shippingMethod
shippingMethod: string;subtotalPrice
subtotalPrice: number;totalDiscounts
totalDiscounts: number;totalPrice
totalPrice: number;All amounts below are integer CENTS.
totalShipping
totalShipping: number;totalTax
totalTax: number;OrderAddress
A shipping/billing address on an 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
address1: string | null;address2
address2: string | null;city
city: string | null;country
country: string | null;name
name: string | null;province
province: string | null;zip
zip: string | null;OrderCustomer
The buyer summary on an Order; null when Shopify returned none.
Properties
email: string;firstName
firstName: string;lastName
lastName: string;OrderDiscount
A discount applied to an Order.
Properties
amount
amount: number;Discount amount in the order's presentment currency, in CENTS.
code
code: string;Discount code, or the automatic/script/manual discount's title.
percentage
percentage: number | null;Percentage discount (0-100), or null for a fixed-amount discount.
targetType
targetType: string;Shopify targetType (e.g. LINE_ITEM, SHIPPING_LINE); '' when absent.
type
type: string;Shopify allocationMethod (e.g. ACROSS, EACH); '' when absent.
OrderLineItem
One line item on an Order.
Properties
image
image: string | null;price
price: number;Line total in the order's presentment currency, in CENTS.
productHandle
productHandle: string | null;productId
productId: number | null;Shopify product id, numeric and unprefixed; null when unavailable.
quantity
quantity: number;title
title: string;variantId
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
variantTitle: string;Pagination
Cursor-pagination flags returned in meta.pagination.
Properties
hasNext
hasNext: boolean;hasPre
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?
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
allProducts: boolean;Whether the reward covers every product (the widget renders a search box instead of a list).
claimedCount
claimedCount: number;How many times it has already been claimed.
claimType
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
createdAt: string | null;ISO date-time the claim was created, or null.
event
event: string | null;The source program's event; null when not recorded.
expiredAt
expiredAt: string | null;ISO date-time the claim expires, or null when it never does.
id
id: string;The claim's own id — the id a claim call (/pending-rewards/{id}/claim) targets.
maxClaims
maxClaims: number;How many times this pending doc may be claimed.
products
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
programId: string | null;The tier-reward program it came from; null on docs issued before that was recorded.
rewardProductQuantity
rewardProductQuantity: number | null;How many of the chosen product the reward grants; null when not applicable.
selectedProductIds
selectedProductIds: string[];Product ids the reward is scoped to; empty when allProducts is true.
status
status: string | null;Lifecycle status — pending, or claimed for a completed product_selection.
tierId
tierId: string | null;The tier that granted it; null on docs issued before that was recorded.
title
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
collections: PlaceOrderScopeCollection[];products
products: PlaceOrderScopeProduct[];scope
scope: "all" | "select";all — every product qualifies; products/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).
Properties
handle
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
title: string;PlaceOrderScopeProduct
PlaceOrderScope.products[] — one eligible product, identifier only (see PlaceOrderScope).
Properties
handle
handle: string | null;id
id: string;Shopify product id, numeric and unprefixed.
quantity
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
plural: string;singular
singular: string;ProfileResult
Result of POST /customer/profile.
Properties
avatarUrl
avatarUrl: string | null;firstName
firstName: string;lastName
lastName: string;phone?
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
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
birthday: ProgramBirthday | null;birthday only — null for every other event, and always null on a
spending program. Like 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), 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
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
description: string;Empty string when the merchant wrote none — never null.
form
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
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
iconUrl: string | null;id
id: string;isEarned?
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
key: string;Program event key, e.g. place_order, signup, birthday.
lineJoinType
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 +
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
points: number | null;Points earned (earning programs).
pointsCost
pointsCost: number | null;Points required to redeem (spending programs).
programType
programType: ProgramType;rateMoney
rateMoney: number | null;Spend-rate programs earn points per this amount of shop currency (see
ShopConfig.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
redeemType: RedeemType | null;How to read pointsCost 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 does.
review
review: ProgramReview | null;Design + reward settings, write_review only — null for every other
event, and always null on a spending program.
rewardType
rewardType: RewardType | null;Reward kind (spending programs).
rewardValue
rewardValue: number | null;Reward amount — currency or percent depending on rewardType.
streak
streak: ProgramStreak | null;streak_interact_website only — null for every other event, and
always null on a spending program. UNLIKE 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 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
title: string;ProgramBirthday
Program.birthday — the birthday-entry modal's reward picker + date-input config.
Properties
dateFormat
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 for that).
rewardOptions
rewardOptions: ProgramBirthdayRewardOption[];rewardSelection
rewardSelection: "single" | "multiple";Whether the shopper may pick exactly one reward (radio buttons) or several (checkboxes). Independent of whether 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
id: string;Send this value back in earnCustomer()'s context.birthdayRewards.
imageUrl
imageUrl: string | null;Present only for a free-gift reward; null for point/discount rewards.
label
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
autoApprove: boolean;When true, earnCustomer() reports status: 'earned' immediately; when
false, status: 'pending' until a merchant approves the submission.
headerImage
headerImage: string | null;instantRewardEnabled
instantRewardEnabled: boolean;Whether a smaller reward is granted immediately, ahead of approval.
instantRewardPoints
instantRewardPoints: number | null;The instant reward amount, when instantRewardEnabled is true.
requireImage
requireImage: boolean;Whether the shopper must attach an image with their submission.
successIconUrl
successIconUrl: string | null;ProgramGoogleReview
Program.googleReview — google_maps_review location + review approval state.
Properties
status?
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.
statusText?
statusText?: string | null;The sentence the shopper reads for the current status, 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
urlLocation: string | null;Guaranteed http(s) — the server drops any other scheme.
ProgramReview
Program.review — write_review design + reward settings.
Properties
extraPoints
extraPoints: number | null;Bonus points awarded on top of the base reward for this program.
headerImage
headerImage: string | null;redirectUrl
redirectUrl: string | null;Where to send the shopper back to AFTER they finish writing the review —
NOT a CTA (Program.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
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 is the only field that tells them apart.
currentDay
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
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) — every other state, including an ordinary same-day
cooldown, has nothing extra to say and reports null.
totalDays
totalDays: number;The highest streak milestone day configured on this program.
QrCodeResult
Result of POST /customer/qrcode.
Properties
qrCode
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
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
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 (face value)
for the amount label instead.
conditions
conditions: string[];The gift's own fine print — same rows, same builder as the matching RedeemedReward, so a gift and an own coupon from one program read identically on the shared card.
couponCode
couponCode: string | null;Masked for a gift card — the spendable full code is never sent.
description
description: string;expiresAt
expiresAt: string | null;ISO date-time, or null when the gift never expires.
freeGiftCollections?
freeGiftCollections?: RewardCollectionRef[];Collections a collection-scoped free gift hands out. [] on every other gift.
freeGiftMode?
freeGiftMode?: GiftSelectionMode | null;'one' | 'all' | null — which free-gift picker the core renders.
freeGiftProducts?
freeGiftProducts?: GiftProduct[];Full picked-product info for an already-received free-gift gift — same shape
and purpose as RedeemedReward.freeGiftProducts. [] on non-free-gift
gifts. Absent on older backends.
freeGiftSelectedVariantId?
freeGiftSelectedVariantId?: string | null;The variant the sender chose (same value as giftVariantId).
giftVariantId
giftVariantId: string | null;On a free_product gift, the variant the sender chose.
iconUrl
iconUrl: string | null;Merchant-uploaded icon for the source program; null when they set none.
key
key: string;The source program's event, same meaning as AvailableReward.key.
partiallyUsed
partiallyUsed: boolean;Gift card spent down but still has balance — show the "Partially used" badge.
programId
programId: string | null;The program it came from; null on gifts issued before that was recorded.
rewardId
rewardId: string;The gift's own id — also the cursor for before/after.
rewardType
rewardType: RewardType | null;rewardValue
rewardValue: number | null;senderEmail
senderEmail: string;senderName
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
startsAt: string | null;Always null today — the gift record carries no start date.
status
status: RewardStatus;title
title: string;ReceivedRewardsPage
One page of JoyClient.getReceivedRewards.
Properties
pagination
pagination: Pagination;received
received: ReceivedReward[];RedeemedReward
A coupon the customer has already redeemed (GET /customer/rewards).
Properties
balanceRemaining?
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 (face value)
for the amount label instead. Absent on older backends.
conditions
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.
couponCode
couponCode: string | null;description
description: string;expiresAt
expiresAt: string | null;ISO date-time, or null when the coupon never expires.
freeGiftCollections?
freeGiftCollections?: RewardCollectionRef[];Collections a collection-scoped free gift hands out (the case freeGiftProducts is empty for). [] on every other coupon.
freeGiftMode?
freeGiftMode?: GiftSelectionMode | null;'one' | 'all' | null — which free-gift picker the core renders.
freeGiftProducts?
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 alone is not enough). Same shape as AvailableReward.giftProducts; [] on non-free-gift coupons. Absent on older
backends.
freeGiftSelectedVariantId?
freeGiftSelectedVariantId?: string | null;The already-chosen variant (same value as giftVariantId).
giftVariantId
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
iconUrl: string | null;Merchant-uploaded icon for the source program; null when they set none.
key
key: string;The source program's event, same meaning as AvailableReward.key —
what a client maps its built-in icon off. '' when the coupon's program
snapshot never recorded one.
partiallyUsed?
partiallyUsed?: boolean;Gift card spent down but still has balance — show the "Partially used" badge. Absent on older backends.
pointsSpent
pointsSpent: number;Points actually spent at redemption time.
programId
programId: string | null;The program it came from; null on coupons issued before that was recorded.
rewardId
rewardId: string;The coupon's own id — NOT the program's.
rewardType
rewardType: RewardType | null;rewardValue
rewardValue: number | null;startsAt
startsAt: string | null;ISO date-time, or null when it is usable immediately.
status
status: RewardStatus;title
title: string;RedeemResult
Result of POST /customer/redeem.
Properties
couponCode
couponCode: string | null;giftCard
giftCard:
| {
expiresOn: string | null;
isSentToFriend: boolean;
recipientEmail: string | null;
}
| null;Gift-card delivery details; null for every other reward type.
id
id: string | null;Issued voucher/discount ID.
pointsSpent
pointsSpent: number;remainingPoints
remainingPoints: number;Customer balance after redemption. Only trustworthy when
remainingPointsKnown is true — otherwise it is a placeholder 0.
remainingPointsKnown
remainingPointsKnown: boolean;false when the server could not read the new balance; do not repaint the balance from remainingPoints.
rewardType
rewardType: RewardType | null;rewardValue
rewardValue: number | null;Referral
Personalised referral state (GET /customer/referral).
Properties
referralCode
referralCode: string | null;referralLink
referralLink: string | null;Null for guests or when referral is disabled.
rewardForFriend
rewardForFriend: string | null;Human-readable reward the referred friend receives.
rewardForReferrer
rewardForReferrer: string | null;stats
stats: ReferralStats;ReferralEmailResult
Result of POST /customer/referral/send-email.
Properties
sent
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
createdAt: string | null;email: string;id
id: string;status
status: ReferralHistoryStatus;ReferralHistoryPage
One page (5 rows) of JoyClient.getReferralHistory.
Properties
items
items: ReferralHistoryEntry[];pagination
pagination: Pagination;ReferralStats
Referral stats (GET /customer/referral).
Properties
completed
completed: number;pending
pending: number;pointsEarned
pointsEarned: number;RevokeRewardResult
Result of POST /customer/rewards/{rewardId}/revoke — see JoyClient.revokeReward.
Extended by
Properties
refundedPoints
refundedPoints: number;Points returned to the customer's balance.
rewardId
rewardId: string;status
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
handle: string | null;id
id: string;Shopify collection id, numeric and unprefixed.
image
image: string | null;title
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
handle: string | null;id
id: string;Shopify product id, numeric and unprefixed.
image
image: string | null;title
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
programId: string;segmentIds
segmentIds: string[];SendRewardInput
Input for JoyClient.sendRewardToFriend.
Properties
couponCode
couponCode: string;The redeemed coupon to gift — must be one THIS customer redeemed from programId.
programId
programId: string;The spending program the coupon came from.
recipient
recipient: SendRewardRecipient;SendRewardRecipient
The friend to gift a redeemed reward to.
Properties
email: string;message?
message?: string;name?
name?: string;sendNotificationAt?
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
sent: boolean;Always true on success — the call has no partial outcome to report.
ShopConfig
Public shop configuration — branding, currency, point label.
Properties
branding
branding: Branding;currency
currency: string;currencyFormat
currencyFormat: string;Shopify money format, e.g. ${{amount}}.
facebookPageId
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, which reports whether THIS shopper is linked to that page — and with JoyClient.disconnectFacebook for the way back out.
isNewFormatDOB
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 is a different, per-program setting: it only reorders day/month for display, never adds or removes the year field.
loyaltyPageUrl
loyaltyPageUrl: string | null;optInEnrollmentEnabled
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 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
pointLabel: PointLabel;programEnabled
programEnabled: boolean;shopDomain
shopDomain: string | null;null when the shop's domain is unresolved.
SocialEarnResult
Result of POST /customer/earn/social.
Extended by
Properties
key
key: string;Program event key — same values as Program.key.
pointsEarned
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
programId: string | null;The program that was claimed. null when the server did not echo it.
totalPoints
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
amount: number;balanceAfter
balanceAfter: number;createdAt
createdAt: string | null;currencyCode
currencyCode: string;event
event: string | null;System event (ADJUSTMENT, ORDER_PAYMENT, ORDER_REFUND, …); null when none.
expiresAt
expiresAt: string | null;ISO date-time the credit expires, or null when it never does.
orderName
orderName: string | null;Order name the transaction originated from, e.g. #1042; null when not order-linked.
type
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 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
endCursor: string | null;hasNextPage
hasNextPage: boolean;hasPrevPage
hasPrevPage: boolean;startCursor
startCursor: string | null;transactions
transactions: StoreCreditTransaction[];Tier
A VIP tier with its perks.
Properties
description
description: string | null;iconUrl
iconUrl: string | null;id
id: string;memberCount
memberCount: number | null;Present only when the merchant enables member counts.
name
name: string;perks
perks: TierPerk[];threshold
threshold: number;Points or spend required to reach this tier.
tierRewards?
tierRewards?: TierRewardDefinition[];Structured tier rewards the core maps into membership-card + perks-page perks. Backend emits this alongside perks (the older generic list); absent on older payloads.
TierPerk
A perk attached to a VIP tier.
Properties
description
description: string | null;id
id: string;title
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
programId: string;tierId
tierId: string;variantIds
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's
extras — the widget re-derives the perk view from its own repaint.
Properties
tierData?
tierData?: unknown;TierProgress
Progress toward the next tier; null when already at the top tier.
Properties
currentTarget?
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, which drifts by hundreds of points near 100%. Optional: absent on older servers that don't send it yet.
nextTarget?
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
nextTierName: string | null;percentage
percentage: number;0–100.
pointsToNext
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?
bonusPoints?: string | number;description?
description?: string | null;earnAmount?
earnAmount?: string | number;event?
event?: string;externalLinkDisplayOn?
externalLinkDisplayOn?: Record<string, boolean>;Per-surface visibility map (e.g. {widget: false}); an absent key means "show".
externalLinkLabel?
externalLinkLabel?: string;externalLinkStyle?
externalLinkStyle?: string;externalLinkTarget?
externalLinkTarget?: string;externalLinkUrl?
externalLinkUrl?: string;hasExternalLink?
hasExternalLink?: boolean;id?
id?: string;shippingDiscountAmount?
shippingDiscountAmount?: string | number;shippingDiscountType?
shippingDiscountType?: string;title?
title?: string;translateTitle?
translateTitle?: Record<string, string>;type?
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?
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?
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?
avatarBase64?: string;A data URL (data:image/png;base64,...) or raw base64 image, up to 10MB decoded.
firstName?
firstName?: string;Empty string clears the stored first name. Omit to leave it unchanged.
lastName?
lastName?: string;Empty string clears the stored last name. Omit to leave it unchanged.
phone?
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
exists: boolean;Whether the pass record behind Customer.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
type ActivityType = "earn" | "spend" | "adjust" | "expire";Activity.type — collapsed 4-value kind (see backend activityPresenter).
BirthdayEarnContext
type BirthdayEarnContext = Exclusive<BirthdayEarnContextFields>;POST /customer/earn context for a birthday program — the same two
inputs the widget's birthday modal collects.
BirthdayRewardsMap
type BirthdayRewardsMap = Record<string, string[]>;A birthday reward selection, keyed by 4-digit year, each value a list of ProgramBirthdayRewardOption.id 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
type CustomerType = "guest" | "member";Customer.type — whether the shopper has joined the loyalty program.
Combine with ShopConfig.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
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
type EarnStatus = "earned" | "pending";EarnResult.status — see EarnResult.
GiftSelectionMode
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
type GoogleMapsReviewEarnContext = Exclusive<GoogleMapsReviewEarnContextFields>;POST /customer/earn context for a google_maps_review program.
GoogleReviewStatus
type GoogleReviewStatus = "pending" | "approved" | "rejected";Program.googleReview.status — the shopper's own review, if any.
ImpactEventType
type ImpactEventType = "tree" | "plastic";ImpactEvent.type — the kind of impact a redemption funded.
JoinFrom
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
type JoyEnvelope<T> = JoySuccess<T> | JoyError;Either envelope, as returned by every Headless API endpoint.
Type Parameters
JoyFetch
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
type LineJoinType = "follow_oa" | "join_link";Program.lineJoinType — how a join_line program credits points.
MilestoneEarnContext
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
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
type MilestoneRewardAction =
| "bonus_point"
| "give_product"
| "amount"
| "percentage"
| "free_shipping"
| "plant_tree"
| "store_credit";MilestoneReward.action — reward kind granted at one milestone step.
MilestoneRewardLogic
type MilestoneRewardLogic = "grantAll" | "customerPicks";MilestoneStep.rewardLogic — see MilestoneStep.rewardLogic.
MilestoneState
type MilestoneState = "locked" | "current" | "claimable" | "achieved" | "passed_unclaimed";MilestoneStep.state — see MilestoneStep.state.
MilestoneType
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
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
type ProgramType = "earning" | "spending";Program.programType — which side of the loyalty loop a program is on.
ReceiptEarnContext
type ReceiptEarnContext = Exclusive<ReceiptEarnContextFields>;POST /customer/earn context for a submit_receipt program.
RedeemType
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
type ReferralHistoryStatus = "complete" | "pending" | "cancel";ReferralHistoryEntry.status — the referred friend's lifecycle state.
RewardStatus
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
type RewardType = "fixed_amount" | "percentage" | "free_shipping" | "free_product";Program.rewardType — reward kind for spending programs.
SegmentEligibility
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
type SubmitFormEarnContext = Exclusive<SubmitFormEarnContextFields>;POST /customer/earn context for a submit_form or fill_survey program.