@invonetwork/web-sdk 3.19.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +90 -0
- package/dist/{chunk-YW2PYARQ.js → chunk-6IY4473A.js} +143 -4
- package/dist/index.cjs +212 -6
- package/dist/index.d.cts +32 -3
- package/dist/index.d.ts +32 -3
- package/dist/index.js +69 -2
- package/dist/server.cjs +142 -11
- package/dist/server.d.cts +20 -4
- package/dist/server.d.ts +20 -4
- package/dist/server.js +29 -3
- package/dist/{types-CCqgVhzf.d.cts → types-BwgkJoM6.d.cts} +160 -2
- package/dist/{types-CCqgVhzf.d.ts → types-BwgkJoM6.d.ts} +160 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1dc07df: Loyalty and rewards. Server: `InvoServer.getPlayerRewards(playerEmail)` reads one player's
|
|
8
|
+
loyalty cards with the game secret (`GET /api/sdk/loyalty/players/rewards`). Browser, with the
|
|
9
|
+
player token: `InvoClient.getMyRewards()` (the player's cards), `getMyVault()`,
|
|
10
|
+
`redeemReward(vaultEntryId)` (the only response with a code; never auto-retried) and
|
|
11
|
+
`getRewardsPageLink()` (INVO's hosted "My rewards" page). Every card step carries `progress`,
|
|
12
|
+
`{ current, target }`, or `null` when unavailable; `state` decides completion. New error
|
|
13
|
+
predicates `isRewardAlreadyRedeemed`, `isRewardNotFound`, `isRewardExpired`,
|
|
14
|
+
`isRewardUnavailable` (`inventory_exhausted` / `conflict`); the server read's
|
|
15
|
+
`PLAYER_NOT_FOUND` and `INVALID_PLAYER_EMAIL` use the existing `isPlayerNotFound` and
|
|
16
|
+
`isInvalidPlayerEmail`. Additive only. README section "Loyalty and rewards".
|
|
17
|
+
|
|
3
18
|
## 3.19.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -117,6 +117,7 @@ The right approval method is a property of the **client the player is sitting in
|
|
|
117
117
|
- [Passkeys (enroll, approve, link, recover)](#passkeys-enroll-approve-link-recover)
|
|
118
118
|
- [Web games — approving on INVO's hosted page](#web-games--approving-on-invos-hosted-page)
|
|
119
119
|
- [Consoles and TVs — approving without a browser (RFC 8628)](#consoles-and-tvs--approving-without-a-browser-rfc-8628)
|
|
120
|
+
- [Loyalty and rewards](#loyalty-and-rewards)
|
|
120
121
|
- [Webhooks](#webhooks)
|
|
121
122
|
- [Resilience & observability](#resilience--observability)
|
|
122
123
|
- [Errors](#errors)
|
|
@@ -2126,6 +2127,90 @@ const done = await server.completeDeviceApproval({
|
|
|
2126
2127
|
|
|
2127
2128
|
---
|
|
2128
2129
|
|
|
2130
|
+
## Loyalty and rewards
|
|
2131
|
+
|
|
2132
|
+
Show a player their loyalty programs, how far they are through each step, and the rewards they
|
|
2133
|
+
unlocked. Programs are built in the INVO console; the SDK only reads them and redeems rewards.
|
|
2134
|
+
Currency steps (purchases, transfers, sends, item spends, subscriptions) count on their own.
|
|
2135
|
+
|
|
2136
|
+
**Browser (player token).** The token names the player; no email or id is sent.
|
|
2137
|
+
|
|
2138
|
+
```ts
|
|
2139
|
+
import { InvoClient } from "@invonetwork/web-sdk";
|
|
2140
|
+
|
|
2141
|
+
const invo = new InvoClient({ token: playerToken, baseUrl: "https://invo.network" });
|
|
2142
|
+
|
|
2143
|
+
const { cards } = await invo.getMyRewards(); // GET /api/sdk/loyalty/me/card
|
|
2144
|
+
for (const card of cards) {
|
|
2145
|
+
console.log(card.title, `${card.stepsComplete} of ${card.stepsRequired} steps`);
|
|
2146
|
+
for (const step of card.steps) {
|
|
2147
|
+
const label =
|
|
2148
|
+
step.state === "complete" ? "Done"
|
|
2149
|
+
: step.state === "locked" ? "Locked"
|
|
2150
|
+
: step.progress ? `${step.progress.current} / ${step.progress.target}` // "3 / 5"
|
|
2151
|
+
: "Open";
|
|
2152
|
+
console.log(step.summary, label);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
const { items } = await invo.getMyVault(); // every reward the player holds or held, newest first
|
|
2157
|
+
const redeemed = await invo.redeemReward(items[0].vaultEntryId);
|
|
2158
|
+
showToPlayer(redeemed.code); // the ONLY place a code appears: never log, cache or store it
|
|
2159
|
+
|
|
2160
|
+
const { url } = await invo.getRewardsPageLink(); // INVO's hosted "My rewards" page, short-lived
|
|
2161
|
+
window.open(url);
|
|
2162
|
+
```
|
|
2163
|
+
|
|
2164
|
+
**Server (game secret).** Read the same cards for any of your players by email, for example to
|
|
2165
|
+
render loyalty UI server-side or send your own "2 matches to go" notification:
|
|
2166
|
+
|
|
2167
|
+
```ts
|
|
2168
|
+
import { InvoServer } from "@invonetwork/web-sdk/server";
|
|
2169
|
+
|
|
2170
|
+
const server = new InvoServer({ gameSecret: process.env.INVO_GAME_SECRET!, baseUrl: "https://invo.network" });
|
|
2171
|
+
const { cards } = await server.getPlayerRewards("player@example.com");
|
|
2172
|
+
```
|
|
2173
|
+
|
|
2174
|
+
`getPlayerRewards` takes the game's server secret only. Never ship the secret in a game client;
|
|
2175
|
+
the client uses `getMyRewards()` with the player token instead.
|
|
2176
|
+
|
|
2177
|
+
**Reading a card.**
|
|
2178
|
+
|
|
2179
|
+
- `step.state` is the authority on whether a step is done: `complete`, `open` (the player can
|
|
2180
|
+
work on it now) or `locked` (in an ordered program, a step after the first unfinished one).
|
|
2181
|
+
- `step.progress` is `{ current, target }` on a live card. `target` is the step's count (1
|
|
2182
|
+
unless the program set one), and `current` reaches `target` only when `state` is `complete`.
|
|
2183
|
+
It is `null` in a preview and when the number could not be read this time: render `state`
|
|
2184
|
+
alone then. Do not recompute progress yourself.
|
|
2185
|
+
- `card.status` is `available`, `in_progress`, `completed`, `expired` or `in_review`.
|
|
2186
|
+
- A card never carries a code. A redeemed reward shows `codeMasked` (for example `••••ABCD`).
|
|
2187
|
+
`redeemReward` returns the code; calling it again for a reward the player already redeemed
|
|
2188
|
+
shows the code once more while the card's `canRevealAgain` is true (`revealedAgain: true`).
|
|
2189
|
+
- Mint a fresh rewards page link each time the player opens the page; never share or store it.
|
|
2190
|
+
The page cannot be embedded in an iframe.
|
|
2191
|
+
|
|
2192
|
+
**Errors.**
|
|
2193
|
+
|
|
2194
|
+
| Call | Status | `err.code` | Predicate |
|
|
2195
|
+
|---|---|---|---|
|
|
2196
|
+
| `getPlayerRewards` | 400 | `INVALID_PLAYER_EMAIL` | `err.isInvalidPlayerEmail` |
|
|
2197
|
+
| `getPlayerRewards` | 401 | `INVALID_GAME_SECRET` (missing or wrong key, or a per-channel key: this read takes the server secret only) | |
|
|
2198
|
+
| `getPlayerRewards` | 404 | `PLAYER_NOT_FOUND` (no player with this email in this game) | `err.isPlayerNotFound` |
|
|
2199
|
+
| any | 429 | (do not match on a code) | treat any 429 as retryable after a pause; `err.retryAfter` (reads are retried automatically first) |
|
|
2200
|
+
| `redeemReward` | 409 | `already_redeemed` | `err.isRewardAlreadyRedeemed` |
|
|
2201
|
+
| `redeemReward` | 404 | `vault_entry_not_found` | `err.isRewardNotFound` |
|
|
2202
|
+
| `redeemReward` | 410 | `vault_entry_expired` | `err.isRewardExpired` |
|
|
2203
|
+
| `redeemReward` | 409 | `inventory_exhausted` (no units or codes left for this reward) | `err.isRewardUnavailable` |
|
|
2204
|
+
| `redeemReward` | 409 | `conflict` (the reward is reserved or revoked) | `err.isRewardUnavailable` |
|
|
2205
|
+
| `getPlayerRewards` | 409 | `NO_TENANT` (the game is not set up for loyalty) | |
|
|
2206
|
+
| any | 503 | temporarily unavailable | retry later |
|
|
2207
|
+
| any | 502 / 504 | the loyalty service could not be reached, or timed out | retry later |
|
|
2208
|
+
|
|
2209
|
+
A blank email, or a `vaultEntryId` that is not a reward's id, throws `INVALID_INPUT` (status 0)
|
|
2210
|
+
before the network. `redeemReward` is never auto-retried.
|
|
2211
|
+
|
|
2212
|
+
---
|
|
2213
|
+
|
|
2129
2214
|
## Webhooks
|
|
2130
2215
|
|
|
2131
2216
|
The synchronous responses are for UX; **reconcile and grant value off webhooks.** They're HMAC-signed; **dedupe on the `X-Invo-Idempotency-Key` header** (stable across retries/replays — *not* `X-Invo-Event-Id`, which changes per delivery).
|
|
@@ -2343,6 +2428,7 @@ try {
|
|
|
2343
2428
|
| `cards.list(playerEmail)` | `{ cards: SavedCard[], raw }` — unexpired cards, newest first; `card.id` is the `playerCardId` |
|
|
2344
2429
|
| `sandbox.subscriptions.advanceClock(id, intervals?)` / `forceRenewal(id)` / `forceFailure(id, outcome?, { failureCode?, failureMessage? })` / `forceAuthChallenge(id, { failureMessage? })` | `SandboxClockResult` — `{ status, action, subscription, before?, after?, engineStats?, retryScheduleDays?, retriesRemaining?, authChallengesUsed?, …, raw }`; **sandbox only**, posts to `/subscriptions/<id>/...` relative to the sandbox base (not `/api`), needs `sandboxClockKey`; never auto-retried |
|
|
2345
2430
|
| `getPlayerBalance({ playerEmail })` | `{ player, balances, summary, raw }` — **by email only** (no by-id route; use `InvoClient.getBalance()` client-side) |
|
|
2431
|
+
| `getPlayerRewards(playerEmail)` | `LoyaltyCardsResult`: `{ cardVersion, cards, raw }`, the player's loyalty cards in your game (the same cards as `InvoClient.getMyRewards()`); each step carries `state` and `progress` (`{ current, target }` or `null`); rewards carry `codeMasked` only. Server secret only. `isPlayerNotFound` / `isInvalidPlayerEmail`. See [Loyalty and rewards](#loyalty-and-rewards) |
|
|
2346
2432
|
| `getInboundPending({ playerEmail? \| playerPhone? })` | `{ inboundPending, raw }` — live unclaimed inbound sends/transfers |
|
|
2347
2433
|
| `getLinkedIdentities({ playerEmail? \| playerPhone? })` | `{ walletUserId, primaryEmail, primaryPhone, isMinor, emails, notFound, raw }` — **server-only** (returns PII) |
|
|
2348
2434
|
| ~~`verifySmsTransfer(txnId, smsPin)`~~ / ~~`verifySmsSend(txnId, smsPin)`~~ | **Deprecated (3.1.0), removal at a future major.** `SmsVerifyResult` — completes the SMS-PIN path when `verificationMethod: "sms"`. Prefer passkey enrollment + `approveTransfer`/`approveSend`; keep this only for users who can't enroll. Still fully functional. |
|
|
@@ -2376,6 +2462,10 @@ Every method also accepts an optional final `{ signal }` (`AbortSignal`) for can
|
|
|
2376
2462
|
| `getPendingCollect()` | `{ pending, raw }` — the player's own pending-to-collect list (player-token) |
|
|
2377
2463
|
| `getDestinations({ direction? })` | `{ availableGames, sourceGameName, transferMode, … }` — where the player can send/transfer, metadata inline |
|
|
2378
2464
|
| `getBalance()` | `{ gameId, gameName, balances, totalValue, currencyCount, hasFunds, raw }` — the player's balances for this game |
|
|
2465
|
+
| `getMyRewards()` | `LoyaltyCardsResult`: `{ cardVersion, cards, raw }`, the signed-in player's loyalty cards with per-step `state` and `progress` |
|
|
2466
|
+
| `getMyVault()` | `{ items, raw }`: every reward the player holds or held, newest first, codes masked |
|
|
2467
|
+
| `redeemReward(vaultEntryId)` | `{ vaultEntryId, rewardRef, state, redeemedAt, code, codeMasked, revealedAgain, revealUntil, raw }`: the only response with a code; never auto-retried |
|
|
2468
|
+
| `getRewardsPageLink()` | `{ url, expiresAt, raw }`: a short-lived link to INVO's hosted "My rewards" page |
|
|
2379
2469
|
| `approveHosted({ transactionId, flow, platformOrigin?, onEnrollment?, renderPrompt?, popupBlocked?, popup?, signal? })` | `{ status: "approved" \| "denied" \| "expired" \| "closed" \| "blocked" \| "redirected", popupBlocked, message?, approval? }` — runs the whole RFC 8628 device-approval grant from the browser on INVO's hosted page (begin `channel:"popup"` → popup → poll → match-code prompt → confirm-enrollment → approve with the `device_code`, which the SDK holds and never exposes); `approval` is the `ApproveResult` / `ConfirmReceiptResult` of the flow's approve endpoint |
|
|
2380
2470
|
| `checkout.getPurchaseStatus({ sessionId, sessionToken })` | `{ status, terminal, orderId, sessionId, coinsCredited, transactionId, newBalance, reasonCode, message, amountChargedUsd, listedUsd, currencyName, raw }`: what happened to a hosted-checkout purchase. Authenticated by the SESSION token, not the player token |
|
|
2381
2471
|
| `checkout.waitForPurchase({ sessionId, sessionToken, intervalMs?, timeoutMs?, maxAttempts?, signal?, onUpdate? })` | the same result, polled until INVO's `terminal` is true (never re-derived from `status`); on the cap it returns the last result rather than throwing. Also available standalone: `new CheckoutClient({ baseUrl })` |
|
|
@@ -817,6 +817,7 @@ var InvoError = class _InvoError extends Error {
|
|
|
817
817
|
* The same code comes back from `cards.beginSetup` and from `mintPlayerToken` for the
|
|
818
818
|
* same reason; those two never create players, so create the member first (for
|
|
819
819
|
* example with `createSetupSession` and a `playerName`, or a currency purchase).
|
|
820
|
+
* `getPlayerRewards` answers it when no player has that email in this game.
|
|
820
821
|
*/
|
|
821
822
|
get isPlayerNotFound() {
|
|
822
823
|
return this.code === "PLAYER_NOT_FOUND";
|
|
@@ -831,7 +832,8 @@ var InvoError = class _InvoError extends Error {
|
|
|
831
832
|
}
|
|
832
833
|
/**
|
|
833
834
|
* True when `cards.createSetupSession` was refused because `playerEmail` was missing or
|
|
834
|
-
* is not an email address (`INVALID_PLAYER_EMAIL`, 400).
|
|
835
|
+
* is not an email address (`INVALID_PLAYER_EMAIL`, 400). `getPlayerRewards` answers it
|
|
836
|
+
* for an email that is not an email address (a blank one never leaves the SDK).
|
|
835
837
|
*/
|
|
836
838
|
get isInvalidPlayerEmail() {
|
|
837
839
|
return this.code === "INVALID_PLAYER_EMAIL";
|
|
@@ -882,6 +884,26 @@ var InvoError = class _InvoError extends Error {
|
|
|
882
884
|
get isIdentityCheckUnavailable() {
|
|
883
885
|
return this.code === "IDENTITY_CHECK_UNAVAILABLE";
|
|
884
886
|
}
|
|
887
|
+
// ---- Loyalty rewards (InvoClient.redeemReward) ----
|
|
888
|
+
/** True when a reward was already redeemed and its code can no longer be shown (`already_redeemed`, 409). */
|
|
889
|
+
get isRewardAlreadyRedeemed() {
|
|
890
|
+
return this.code === "already_redeemed";
|
|
891
|
+
}
|
|
892
|
+
/** True when the player has no such reward (`vault_entry_not_found`, 404). */
|
|
893
|
+
get isRewardNotFound() {
|
|
894
|
+
return this.code === "vault_entry_not_found";
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* True when the reward cannot be redeemed right now (409): `inventory_exhausted` (no units or
|
|
898
|
+
* codes are left for it) or `conflict` (the reward is reserved or revoked).
|
|
899
|
+
*/
|
|
900
|
+
get isRewardUnavailable() {
|
|
901
|
+
return this.code === "inventory_exhausted" || this.code === "conflict";
|
|
902
|
+
}
|
|
903
|
+
/** True when the reward expired before it was redeemed (`vault_entry_expired`, 410). */
|
|
904
|
+
get isRewardExpired() {
|
|
905
|
+
return this.code === "vault_entry_expired";
|
|
906
|
+
}
|
|
885
907
|
/** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
|
|
886
908
|
get retryAfter() {
|
|
887
909
|
const v = this.bodyObject()["retry_after"];
|
|
@@ -1181,6 +1203,123 @@ function receiptFields(raw) {
|
|
|
1181
1203
|
return typeof u === "string" && u !== "" ? { receiptNumber: n, receiptUrl: u } : { receiptNumber: n };
|
|
1182
1204
|
}
|
|
1183
1205
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1206
|
+
// src/shared/loyalty.ts
|
|
1207
|
+
var obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
1208
|
+
var rows = (v) => Array.isArray(v) ? v.filter((r) => r && typeof r === "object" && !Array.isArray(r)) : [];
|
|
1209
|
+
var str = (v) => v === void 0 || v === null ? "" : String(v);
|
|
1210
|
+
var strOrNull = (v) => v === void 0 || v === null ? null : String(v);
|
|
1211
|
+
var numOrNull = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
1212
|
+
var int = (v, fallback = 0) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
1213
|
+
var passThrough = (v) => v;
|
|
1214
|
+
function toLoyaltyStepProgress(value) {
|
|
1215
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1216
|
+
const v = value;
|
|
1217
|
+
const current = v["current"];
|
|
1218
|
+
const target = v["target"];
|
|
1219
|
+
if (!Number.isInteger(current) || !Number.isInteger(target)) return null;
|
|
1220
|
+
return { current, target };
|
|
1221
|
+
}
|
|
1222
|
+
function toStep(row) {
|
|
1223
|
+
return {
|
|
1224
|
+
stepId: strOrNull(row["step_id"]),
|
|
1225
|
+
index: int(row["index"]),
|
|
1226
|
+
action: str(row["action"]),
|
|
1227
|
+
label: str(row["label"]),
|
|
1228
|
+
summary: str(row["summary"]),
|
|
1229
|
+
windowHours: numOrNull(row["window_hours"]),
|
|
1230
|
+
state: str(row["state"]),
|
|
1231
|
+
progress: toLoyaltyStepProgress(row["progress"]),
|
|
1232
|
+
raw: row
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
function toCardReward(row) {
|
|
1236
|
+
return {
|
|
1237
|
+
vaultEntryId: str(row["vault_entry_id"]),
|
|
1238
|
+
rewardId: str(row["reward_id"]),
|
|
1239
|
+
state: str(row["state"]),
|
|
1240
|
+
unlockedAt: str(row["unlocked_at"]),
|
|
1241
|
+
expiresAt: str(row["expires_at"]),
|
|
1242
|
+
redeemedAt: strOrNull(row["redeemed_at"]),
|
|
1243
|
+
codeMasked: strOrNull(row["code_masked"]),
|
|
1244
|
+
canRedeem: row["can_redeem"] === true,
|
|
1245
|
+
canRevealAgain: row["can_reveal_again"] === true,
|
|
1246
|
+
revealUntil: strOrNull(row["reveal_until"]),
|
|
1247
|
+
raw: row
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
function toLoyaltyCard(row) {
|
|
1251
|
+
const brand = obj(row["brand"]);
|
|
1252
|
+
const reward = obj(row["reward"]);
|
|
1253
|
+
const steps = rows(row["steps"]).map(toStep);
|
|
1254
|
+
return {
|
|
1255
|
+
cardVersion: passThrough(row["card_version"]),
|
|
1256
|
+
mode: str(row["mode"]),
|
|
1257
|
+
programId: strOrNull(row["program_id"]),
|
|
1258
|
+
questId: strOrNull(row["quest_id"]),
|
|
1259
|
+
questVersion: numOrNull(row["quest_version"]),
|
|
1260
|
+
campaignId: strOrNull(row["campaign_id"]),
|
|
1261
|
+
title: str(row["title"]),
|
|
1262
|
+
description: str(row["description"]),
|
|
1263
|
+
brand: { name: strOrNull(brand["name"]), logoUrl: strOrNull(brand["logo_url"]) },
|
|
1264
|
+
artUrl: strOrNull(row["art_url"]),
|
|
1265
|
+
reward: { rewardId: strOrNull(reward["reward_id"]), name: strOrNull(reward["name"]) },
|
|
1266
|
+
orderMode: str(row["order_mode"]),
|
|
1267
|
+
status: str(row["status"]),
|
|
1268
|
+
startsAt: strOrNull(row["starts_at"]),
|
|
1269
|
+
endsAt: strOrNull(row["ends_at"]),
|
|
1270
|
+
completionHours: numOrNull(row["completion_hours"]),
|
|
1271
|
+
completionNote: strOrNull(row["completion_note"]),
|
|
1272
|
+
windowEndsAt: strOrNull(row["window_ends_at"]),
|
|
1273
|
+
completedAt: strOrNull(row["completed_at"]),
|
|
1274
|
+
stepsRequired: passThrough(row["steps_required"]),
|
|
1275
|
+
stepsComplete: passThrough(row["steps_complete"]),
|
|
1276
|
+
steps,
|
|
1277
|
+
rewards: rows(row["rewards"]).map(toCardReward),
|
|
1278
|
+
raw: row
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
function toLoyaltyCardsResult(raw) {
|
|
1282
|
+
return {
|
|
1283
|
+
cardVersion: passThrough(raw["card_version"]),
|
|
1284
|
+
cards: rows(raw["cards"]).map(toLoyaltyCard),
|
|
1285
|
+
raw
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
function toVaultEntry(row) {
|
|
1289
|
+
return {
|
|
1290
|
+
vaultEntryId: str(row["vault_entry_id"]),
|
|
1291
|
+
rewardRef: str(row["reward_ref"]),
|
|
1292
|
+
programId: str(row["program_id"]),
|
|
1293
|
+
questId: strOrNull(row["quest_id"]),
|
|
1294
|
+
units: str(row["units"]),
|
|
1295
|
+
state: str(row["state"]),
|
|
1296
|
+
unlockedAt: strOrNull(row["unlocked_at"]),
|
|
1297
|
+
expiresAt: strOrNull(row["expires_at"]),
|
|
1298
|
+
redeemedAt: strOrNull(row["redeemed_at"]),
|
|
1299
|
+
codeMasked: strOrNull(row["code_masked"]),
|
|
1300
|
+
raw: row
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
function toLoyaltyVaultResult(raw) {
|
|
1304
|
+
return { items: rows(raw["items"]).map(toVaultEntry), raw };
|
|
1305
|
+
}
|
|
1306
|
+
function toRedeemRewardResult(raw, vaultEntryId) {
|
|
1307
|
+
return {
|
|
1308
|
+
vaultEntryId: str(raw["vault_entry_id"] ?? vaultEntryId),
|
|
1309
|
+
rewardRef: str(raw["reward_ref"]),
|
|
1310
|
+
state: str(raw["state"]),
|
|
1311
|
+
redeemedAt: strOrNull(raw["redeemed_at"]),
|
|
1312
|
+
code: strOrNull(raw["code"]),
|
|
1313
|
+
codeMasked: strOrNull(raw["code_masked"]),
|
|
1314
|
+
revealedAgain: raw["revealed_again"] === true,
|
|
1315
|
+
revealUntil: strOrNull(raw["reveal_until"]),
|
|
1316
|
+
raw
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
function toRewardsPageLink(raw) {
|
|
1320
|
+
return { url: str(raw["url"]), expiresAt: str(raw["expires_at"]), raw };
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
export { Http, InvoError, assertSecureBaseUrl, creditFields, receiptFields, toDestinationsResult, toLoyaltyCardsResult, toLoyaltyVaultResult, toRedeemRewardResult, toRewardsPageLink };
|
|
1324
|
+
//# sourceMappingURL=chunk-6IY4473A.js.map
|
|
1325
|
+
//# sourceMappingURL=chunk-6IY4473A.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -819,6 +819,7 @@ var InvoError = class _InvoError extends Error {
|
|
|
819
819
|
* The same code comes back from `cards.beginSetup` and from `mintPlayerToken` for the
|
|
820
820
|
* same reason; those two never create players, so create the member first (for
|
|
821
821
|
* example with `createSetupSession` and a `playerName`, or a currency purchase).
|
|
822
|
+
* `getPlayerRewards` answers it when no player has that email in this game.
|
|
822
823
|
*/
|
|
823
824
|
get isPlayerNotFound() {
|
|
824
825
|
return this.code === "PLAYER_NOT_FOUND";
|
|
@@ -833,7 +834,8 @@ var InvoError = class _InvoError extends Error {
|
|
|
833
834
|
}
|
|
834
835
|
/**
|
|
835
836
|
* True when `cards.createSetupSession` was refused because `playerEmail` was missing or
|
|
836
|
-
* is not an email address (`INVALID_PLAYER_EMAIL`, 400).
|
|
837
|
+
* is not an email address (`INVALID_PLAYER_EMAIL`, 400). `getPlayerRewards` answers it
|
|
838
|
+
* for an email that is not an email address (a blank one never leaves the SDK).
|
|
837
839
|
*/
|
|
838
840
|
get isInvalidPlayerEmail() {
|
|
839
841
|
return this.code === "INVALID_PLAYER_EMAIL";
|
|
@@ -884,6 +886,26 @@ var InvoError = class _InvoError extends Error {
|
|
|
884
886
|
get isIdentityCheckUnavailable() {
|
|
885
887
|
return this.code === "IDENTITY_CHECK_UNAVAILABLE";
|
|
886
888
|
}
|
|
889
|
+
// ---- Loyalty rewards (InvoClient.redeemReward) ----
|
|
890
|
+
/** True when a reward was already redeemed and its code can no longer be shown (`already_redeemed`, 409). */
|
|
891
|
+
get isRewardAlreadyRedeemed() {
|
|
892
|
+
return this.code === "already_redeemed";
|
|
893
|
+
}
|
|
894
|
+
/** True when the player has no such reward (`vault_entry_not_found`, 404). */
|
|
895
|
+
get isRewardNotFound() {
|
|
896
|
+
return this.code === "vault_entry_not_found";
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* True when the reward cannot be redeemed right now (409): `inventory_exhausted` (no units or
|
|
900
|
+
* codes are left for it) or `conflict` (the reward is reserved or revoked).
|
|
901
|
+
*/
|
|
902
|
+
get isRewardUnavailable() {
|
|
903
|
+
return this.code === "inventory_exhausted" || this.code === "conflict";
|
|
904
|
+
}
|
|
905
|
+
/** True when the reward expired before it was redeemed (`vault_entry_expired`, 410). */
|
|
906
|
+
get isRewardExpired() {
|
|
907
|
+
return this.code === "vault_entry_expired";
|
|
908
|
+
}
|
|
887
909
|
/** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
|
|
888
910
|
get retryAfter() {
|
|
889
911
|
const v = this.bodyObject()["retry_after"];
|
|
@@ -1902,7 +1924,125 @@ function nothingWasCharged(r) {
|
|
|
1902
1924
|
return r.reasonCode !== null && NOTHING_CHARGED_REASONS.has(r.reasonCode);
|
|
1903
1925
|
}
|
|
1904
1926
|
|
|
1927
|
+
// src/shared/loyalty.ts
|
|
1928
|
+
var obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
1929
|
+
var rows = (v) => Array.isArray(v) ? v.filter((r) => r && typeof r === "object" && !Array.isArray(r)) : [];
|
|
1930
|
+
var str2 = (v) => v === void 0 || v === null ? "" : String(v);
|
|
1931
|
+
var strOrNull = (v) => v === void 0 || v === null ? null : String(v);
|
|
1932
|
+
var numOrNull = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
1933
|
+
var int = (v, fallback = 0) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
1934
|
+
var passThrough = (v) => v;
|
|
1935
|
+
function toLoyaltyStepProgress(value) {
|
|
1936
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1937
|
+
const v = value;
|
|
1938
|
+
const current = v["current"];
|
|
1939
|
+
const target = v["target"];
|
|
1940
|
+
if (!Number.isInteger(current) || !Number.isInteger(target)) return null;
|
|
1941
|
+
return { current, target };
|
|
1942
|
+
}
|
|
1943
|
+
function toStep(row) {
|
|
1944
|
+
return {
|
|
1945
|
+
stepId: strOrNull(row["step_id"]),
|
|
1946
|
+
index: int(row["index"]),
|
|
1947
|
+
action: str2(row["action"]),
|
|
1948
|
+
label: str2(row["label"]),
|
|
1949
|
+
summary: str2(row["summary"]),
|
|
1950
|
+
windowHours: numOrNull(row["window_hours"]),
|
|
1951
|
+
state: str2(row["state"]),
|
|
1952
|
+
progress: toLoyaltyStepProgress(row["progress"]),
|
|
1953
|
+
raw: row
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
function toCardReward(row) {
|
|
1957
|
+
return {
|
|
1958
|
+
vaultEntryId: str2(row["vault_entry_id"]),
|
|
1959
|
+
rewardId: str2(row["reward_id"]),
|
|
1960
|
+
state: str2(row["state"]),
|
|
1961
|
+
unlockedAt: str2(row["unlocked_at"]),
|
|
1962
|
+
expiresAt: str2(row["expires_at"]),
|
|
1963
|
+
redeemedAt: strOrNull(row["redeemed_at"]),
|
|
1964
|
+
codeMasked: strOrNull(row["code_masked"]),
|
|
1965
|
+
canRedeem: row["can_redeem"] === true,
|
|
1966
|
+
canRevealAgain: row["can_reveal_again"] === true,
|
|
1967
|
+
revealUntil: strOrNull(row["reveal_until"]),
|
|
1968
|
+
raw: row
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
function toLoyaltyCard(row) {
|
|
1972
|
+
const brand = obj(row["brand"]);
|
|
1973
|
+
const reward = obj(row["reward"]);
|
|
1974
|
+
const steps = rows(row["steps"]).map(toStep);
|
|
1975
|
+
return {
|
|
1976
|
+
cardVersion: passThrough(row["card_version"]),
|
|
1977
|
+
mode: str2(row["mode"]),
|
|
1978
|
+
programId: strOrNull(row["program_id"]),
|
|
1979
|
+
questId: strOrNull(row["quest_id"]),
|
|
1980
|
+
questVersion: numOrNull(row["quest_version"]),
|
|
1981
|
+
campaignId: strOrNull(row["campaign_id"]),
|
|
1982
|
+
title: str2(row["title"]),
|
|
1983
|
+
description: str2(row["description"]),
|
|
1984
|
+
brand: { name: strOrNull(brand["name"]), logoUrl: strOrNull(brand["logo_url"]) },
|
|
1985
|
+
artUrl: strOrNull(row["art_url"]),
|
|
1986
|
+
reward: { rewardId: strOrNull(reward["reward_id"]), name: strOrNull(reward["name"]) },
|
|
1987
|
+
orderMode: str2(row["order_mode"]),
|
|
1988
|
+
status: str2(row["status"]),
|
|
1989
|
+
startsAt: strOrNull(row["starts_at"]),
|
|
1990
|
+
endsAt: strOrNull(row["ends_at"]),
|
|
1991
|
+
completionHours: numOrNull(row["completion_hours"]),
|
|
1992
|
+
completionNote: strOrNull(row["completion_note"]),
|
|
1993
|
+
windowEndsAt: strOrNull(row["window_ends_at"]),
|
|
1994
|
+
completedAt: strOrNull(row["completed_at"]),
|
|
1995
|
+
stepsRequired: passThrough(row["steps_required"]),
|
|
1996
|
+
stepsComplete: passThrough(row["steps_complete"]),
|
|
1997
|
+
steps,
|
|
1998
|
+
rewards: rows(row["rewards"]).map(toCardReward),
|
|
1999
|
+
raw: row
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
function toLoyaltyCardsResult(raw) {
|
|
2003
|
+
return {
|
|
2004
|
+
cardVersion: passThrough(raw["card_version"]),
|
|
2005
|
+
cards: rows(raw["cards"]).map(toLoyaltyCard),
|
|
2006
|
+
raw
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
function toVaultEntry(row) {
|
|
2010
|
+
return {
|
|
2011
|
+
vaultEntryId: str2(row["vault_entry_id"]),
|
|
2012
|
+
rewardRef: str2(row["reward_ref"]),
|
|
2013
|
+
programId: str2(row["program_id"]),
|
|
2014
|
+
questId: strOrNull(row["quest_id"]),
|
|
2015
|
+
units: str2(row["units"]),
|
|
2016
|
+
state: str2(row["state"]),
|
|
2017
|
+
unlockedAt: strOrNull(row["unlocked_at"]),
|
|
2018
|
+
expiresAt: strOrNull(row["expires_at"]),
|
|
2019
|
+
redeemedAt: strOrNull(row["redeemed_at"]),
|
|
2020
|
+
codeMasked: strOrNull(row["code_masked"]),
|
|
2021
|
+
raw: row
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
function toLoyaltyVaultResult(raw) {
|
|
2025
|
+
return { items: rows(raw["items"]).map(toVaultEntry), raw };
|
|
2026
|
+
}
|
|
2027
|
+
function toRedeemRewardResult(raw, vaultEntryId) {
|
|
2028
|
+
return {
|
|
2029
|
+
vaultEntryId: str2(raw["vault_entry_id"] ?? vaultEntryId),
|
|
2030
|
+
rewardRef: str2(raw["reward_ref"]),
|
|
2031
|
+
state: str2(raw["state"]),
|
|
2032
|
+
redeemedAt: strOrNull(raw["redeemed_at"]),
|
|
2033
|
+
code: strOrNull(raw["code"]),
|
|
2034
|
+
codeMasked: strOrNull(raw["code_masked"]),
|
|
2035
|
+
revealedAgain: raw["revealed_again"] === true,
|
|
2036
|
+
revealUntil: strOrNull(raw["reveal_until"]),
|
|
2037
|
+
raw
|
|
2038
|
+
};
|
|
2039
|
+
}
|
|
2040
|
+
function toRewardsPageLink(raw) {
|
|
2041
|
+
return { url: str2(raw["url"]), expiresAt: str2(raw["expires_at"]), raw };
|
|
2042
|
+
}
|
|
2043
|
+
|
|
1905
2044
|
// src/index.ts
|
|
2045
|
+
var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1906
2046
|
function toPendingCollectItem(row) {
|
|
1907
2047
|
return {
|
|
1908
2048
|
transferId: String(row["transfer_id"] ?? ""),
|
|
@@ -2379,8 +2519,8 @@ var InvoClient = class {
|
|
|
2379
2519
|
"/api/sdk/transfers/pending",
|
|
2380
2520
|
opts?.signal
|
|
2381
2521
|
);
|
|
2382
|
-
const
|
|
2383
|
-
return { pending:
|
|
2522
|
+
const rows2 = Array.isArray(raw["pending"]) ? raw["pending"] : [];
|
|
2523
|
+
return { pending: rows2.map(toPendingCollectItem), raw };
|
|
2384
2524
|
});
|
|
2385
2525
|
}
|
|
2386
2526
|
/**
|
|
@@ -2407,19 +2547,85 @@ var InvoClient = class {
|
|
|
2407
2547
|
async getBalance(opts) {
|
|
2408
2548
|
return this.withTokenRetry(async () => {
|
|
2409
2549
|
const raw = await this.get("/api/sdk/balance", opts?.signal);
|
|
2410
|
-
const
|
|
2550
|
+
const rows2 = Array.isArray(raw["balances"]) ? raw["balances"] : [];
|
|
2411
2551
|
const summary = raw["summary"] ?? {};
|
|
2412
2552
|
return {
|
|
2413
2553
|
gameId: raw["game_id"] ?? "",
|
|
2414
2554
|
gameName: String(raw["game_name"] ?? ""),
|
|
2415
|
-
balances:
|
|
2555
|
+
balances: rows2.map(toBalanceRow),
|
|
2416
2556
|
totalValue: String(summary["total_value"] ?? "0"),
|
|
2417
|
-
currencyCount: Number(summary["currency_count"] ??
|
|
2557
|
+
currencyCount: Number(summary["currency_count"] ?? rows2.length),
|
|
2418
2558
|
hasFunds: summary["has_funds"] === true,
|
|
2419
2559
|
raw
|
|
2420
2560
|
};
|
|
2421
2561
|
});
|
|
2422
2562
|
}
|
|
2563
|
+
// ---- Loyalty and rewards (player token) ----
|
|
2564
|
+
/**
|
|
2565
|
+
* The signed-in player's loyalty cards in this game: one card per program, each step with
|
|
2566
|
+
* its `state` and `progress` (`{ current, target }`, or `null` when the number could not
|
|
2567
|
+
* be read this time: render `state` alone then), and the rewards the player unlocked.
|
|
2568
|
+
* A card never carries a code; a redeemed reward shows its mask. Your server reads the
|
|
2569
|
+
* same cards for any of your players with `InvoServer.getPlayerRewards(playerEmail)`.
|
|
2570
|
+
*/
|
|
2571
|
+
async getMyRewards(opts) {
|
|
2572
|
+
return this.withTokenRetry(async () => {
|
|
2573
|
+
const raw = await this.get("/api/sdk/loyalty/me/card", opts?.signal);
|
|
2574
|
+
return toLoyaltyCardsResult(raw);
|
|
2575
|
+
});
|
|
2576
|
+
}
|
|
2577
|
+
/** Every reward the signed-in player holds or held, newest first. Codes are masked. */
|
|
2578
|
+
async getMyVault(opts) {
|
|
2579
|
+
return this.withTokenRetry(async () => {
|
|
2580
|
+
const raw = await this.get("/api/sdk/loyalty/me/vault", opts?.signal);
|
|
2581
|
+
return toLoyaltyVaultResult(raw);
|
|
2582
|
+
});
|
|
2583
|
+
}
|
|
2584
|
+
/**
|
|
2585
|
+
* Redeem one unlocked reward and return its code. This is the only response that
|
|
2586
|
+
* carries a code: show it straight away and never log, cache or store it. Calling again
|
|
2587
|
+
* for a reward this player already redeemed shows the code once more while the card's
|
|
2588
|
+
* `canRevealAgain` is true (`revealedAgain: true`). Never auto-retried.
|
|
2589
|
+
*
|
|
2590
|
+
* Refusals: `409 already_redeemed` (`err.isRewardAlreadyRedeemed`), `404
|
|
2591
|
+
* vault_entry_not_found` (`err.isRewardNotFound`), `410 vault_entry_expired`
|
|
2592
|
+
* (`err.isRewardExpired`), `409 inventory_exhausted` / `409 conflict`
|
|
2593
|
+
* (`err.isRewardUnavailable`: no units or codes left, or the reward is reserved or revoked).
|
|
2594
|
+
*/
|
|
2595
|
+
async redeemReward(vaultEntryId, opts) {
|
|
2596
|
+
if (typeof vaultEntryId !== "string" || !UUID_RE.test(vaultEntryId.trim())) {
|
|
2597
|
+
throw new InvoError({
|
|
2598
|
+
message: `vaultEntryId must be a reward's vaultEntryId (got ${JSON.stringify(vaultEntryId)}).`,
|
|
2599
|
+
code: "INVALID_INPUT",
|
|
2600
|
+
status: 0
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
const id = vaultEntryId.trim();
|
|
2604
|
+
return this.withTokenRetry(async () => {
|
|
2605
|
+
const raw = await this.post(
|
|
2606
|
+
`/api/sdk/loyalty/me/vault/${encodeURIComponent(id)}/redeem`,
|
|
2607
|
+
void 0,
|
|
2608
|
+
opts?.signal
|
|
2609
|
+
);
|
|
2610
|
+
return toRedeemRewardResult(raw, id);
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* A short-lived link to INVO's hosted "My rewards" page for the signed-in player: their
|
|
2615
|
+
* cards, progress and rewards, with a Redeem button. Open `url` in a browser or web view
|
|
2616
|
+
* (it cannot be embedded in an iframe). Ask for a fresh link each time the player opens
|
|
2617
|
+
* the page; never share or store it.
|
|
2618
|
+
*/
|
|
2619
|
+
async getRewardsPageLink(opts) {
|
|
2620
|
+
return this.withTokenRetry(async () => {
|
|
2621
|
+
const raw = await this.post(
|
|
2622
|
+
"/api/sdk/loyalty/me/rewards-page",
|
|
2623
|
+
void 0,
|
|
2624
|
+
opts?.signal
|
|
2625
|
+
);
|
|
2626
|
+
return toRewardsPageLink(raw);
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2423
2629
|
/**
|
|
2424
2630
|
* First-enrollment OTP grant (§4.2). When `enrollPasskey()` throws
|
|
2425
2631
|
* `ENROLLMENT_REQUIRES_AUTHORIZATION` (`err.isEnrollmentAuthorizationRequired`), call
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult,
|
|
2
|
-
export {
|
|
1
|
+
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, l as LoyaltyCardsResult, m as LoyaltyVaultResult, R as RedeemRewardResult, n as RewardsPageLink, E as EnrollmentBeginResult, o as EnrollmentVerifyResult, p as RecoveryBeginResult, q as RecoveryCompleteResult } from './types-BwgkJoM6.cjs';
|
|
2
|
+
export { r as BalanceRow, s as CheckoutPurchaseStatus, t as DestinationGame, I as InvoError, u as InvoErrorInfo, v as InvoHooks, w as InvoRequestInfo, x as InvoResponseInfo, y as LoyaltyCard, z as LoyaltyCardReward, F as LoyaltyCardStep, G as LoyaltyRewardState, J as LoyaltyStepProgress, K as LoyaltyStepState, N as LoyaltyVaultEntry, O as PendingCollectItem, Q as PurchaseRefusalReason, S as Rail, V as VerificationMethod } from './types-BwgkJoM6.cjs';
|
|
3
3
|
|
|
4
4
|
/** The four device-approval flows (`begin.flow`). */
|
|
5
5
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
|
@@ -362,6 +362,35 @@ declare class InvoClient {
|
|
|
362
362
|
* throws. Rows include the currency symbol + icon URL (each may be null).
|
|
363
363
|
*/
|
|
364
364
|
getBalance(opts?: CallOptions): Promise<BalanceResult>;
|
|
365
|
+
/**
|
|
366
|
+
* The signed-in player's loyalty cards in this game: one card per program, each step with
|
|
367
|
+
* its `state` and `progress` (`{ current, target }`, or `null` when the number could not
|
|
368
|
+
* be read this time: render `state` alone then), and the rewards the player unlocked.
|
|
369
|
+
* A card never carries a code; a redeemed reward shows its mask. Your server reads the
|
|
370
|
+
* same cards for any of your players with `InvoServer.getPlayerRewards(playerEmail)`.
|
|
371
|
+
*/
|
|
372
|
+
getMyRewards(opts?: CallOptions): Promise<LoyaltyCardsResult>;
|
|
373
|
+
/** Every reward the signed-in player holds or held, newest first. Codes are masked. */
|
|
374
|
+
getMyVault(opts?: CallOptions): Promise<LoyaltyVaultResult>;
|
|
375
|
+
/**
|
|
376
|
+
* Redeem one unlocked reward and return its code. This is the only response that
|
|
377
|
+
* carries a code: show it straight away and never log, cache or store it. Calling again
|
|
378
|
+
* for a reward this player already redeemed shows the code once more while the card's
|
|
379
|
+
* `canRevealAgain` is true (`revealedAgain: true`). Never auto-retried.
|
|
380
|
+
*
|
|
381
|
+
* Refusals: `409 already_redeemed` (`err.isRewardAlreadyRedeemed`), `404
|
|
382
|
+
* vault_entry_not_found` (`err.isRewardNotFound`), `410 vault_entry_expired`
|
|
383
|
+
* (`err.isRewardExpired`), `409 inventory_exhausted` / `409 conflict`
|
|
384
|
+
* (`err.isRewardUnavailable`: no units or codes left, or the reward is reserved or revoked).
|
|
385
|
+
*/
|
|
386
|
+
redeemReward(vaultEntryId: string, opts?: CallOptions): Promise<RedeemRewardResult>;
|
|
387
|
+
/**
|
|
388
|
+
* A short-lived link to INVO's hosted "My rewards" page for the signed-in player: their
|
|
389
|
+
* cards, progress and rewards, with a Redeem button. Open `url` in a browser or web view
|
|
390
|
+
* (it cannot be embedded in an iframe). Ask for a fresh link each time the player opens
|
|
391
|
+
* the page; never share or store it.
|
|
392
|
+
*/
|
|
393
|
+
getRewardsPageLink(opts?: CallOptions): Promise<RewardsPageLink>;
|
|
365
394
|
/**
|
|
366
395
|
* First-enrollment OTP grant (§4.2). When `enrollPasskey()` throws
|
|
367
396
|
* `ENROLLMENT_REQUIRES_AUTHORIZATION` (`err.isEnrollmentAuthorizationRequired`), call
|
|
@@ -424,4 +453,4 @@ declare class InvoClient {
|
|
|
424
453
|
private confirmReceipt;
|
|
425
454
|
}
|
|
426
455
|
|
|
427
|
-
export { type ApproveHostedOptions, type ApproveHostedResult, ApproveResult, BalanceResult, CallOptions, CheckoutClient, CheckoutClientConfig, CheckoutMountHandle, ClientConfig, ConfirmReceiptResult, DestinationsQuery, DestinationsResult, EnrollmentBeginResult, type EnrollmentDecision, type EnrollmentRespond, EnrollmentVerifyResult, type HostedApprovalStatus, type HostedEnrollment, type HostedEnrollmentInput, type HostedFlow, InvoClient, LinkDeviceResult, MountCheckoutOptions, PendingCollectResult, PlatformCommerceClient, PurchaseCredited, PurchaseExpired, PurchaseRefunded, PurchaseRefused, PurchaseStatusInput, PurchaseStatusResult, RecoveryBeginResult, RecoveryCompleteResult, WaitForPurchaseInput, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged };
|
|
456
|
+
export { type ApproveHostedOptions, type ApproveHostedResult, ApproveResult, BalanceResult, CallOptions, CheckoutClient, CheckoutClientConfig, CheckoutMountHandle, ClientConfig, ConfirmReceiptResult, DestinationsQuery, DestinationsResult, EnrollmentBeginResult, type EnrollmentDecision, type EnrollmentRespond, EnrollmentVerifyResult, type HostedApprovalStatus, type HostedEnrollment, type HostedEnrollmentInput, type HostedFlow, InvoClient, LinkDeviceResult, LoyaltyCardsResult, LoyaltyVaultResult, MountCheckoutOptions, PendingCollectResult, PlatformCommerceClient, PurchaseCredited, PurchaseExpired, PurchaseRefunded, PurchaseRefused, PurchaseStatusInput, PurchaseStatusResult, RecoveryBeginResult, RecoveryCompleteResult, RedeemRewardResult, RewardsPageLink, WaitForPurchaseInput, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged };
|