@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/dist/index.d.ts 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, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-CCqgVhzf.js';
2
- export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-CCqgVhzf.js';
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.js';
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.js';
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 };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult, receiptFields } from './chunk-YW2PYARQ.js';
2
- export { InvoError } from './chunk-YW2PYARQ.js';
1
+ import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult, toLoyaltyCardsResult, toLoyaltyVaultResult, toRedeemRewardResult, toRewardsPageLink, receiptFields } from './chunk-6IY4473A.js';
2
+ export { InvoError } from './chunk-6IY4473A.js';
3
3
 
4
4
  // src/shared/webauthn.ts
5
5
  function malformedOptions(field) {
@@ -730,6 +730,7 @@ function nothingWasCharged(r) {
730
730
  }
731
731
 
732
732
  // src/index.ts
733
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
733
734
  function toPendingCollectItem(row) {
734
735
  return {
735
736
  transferId: String(row["transfer_id"] ?? ""),
@@ -1247,6 +1248,72 @@ var InvoClient = class {
1247
1248
  };
1248
1249
  });
1249
1250
  }
1251
+ // ---- Loyalty and rewards (player token) ----
1252
+ /**
1253
+ * The signed-in player's loyalty cards in this game: one card per program, each step with
1254
+ * its `state` and `progress` (`{ current, target }`, or `null` when the number could not
1255
+ * be read this time: render `state` alone then), and the rewards the player unlocked.
1256
+ * A card never carries a code; a redeemed reward shows its mask. Your server reads the
1257
+ * same cards for any of your players with `InvoServer.getPlayerRewards(playerEmail)`.
1258
+ */
1259
+ async getMyRewards(opts) {
1260
+ return this.withTokenRetry(async () => {
1261
+ const raw = await this.get("/api/sdk/loyalty/me/card", opts?.signal);
1262
+ return toLoyaltyCardsResult(raw);
1263
+ });
1264
+ }
1265
+ /** Every reward the signed-in player holds or held, newest first. Codes are masked. */
1266
+ async getMyVault(opts) {
1267
+ return this.withTokenRetry(async () => {
1268
+ const raw = await this.get("/api/sdk/loyalty/me/vault", opts?.signal);
1269
+ return toLoyaltyVaultResult(raw);
1270
+ });
1271
+ }
1272
+ /**
1273
+ * Redeem one unlocked reward and return its code. This is the only response that
1274
+ * carries a code: show it straight away and never log, cache or store it. Calling again
1275
+ * for a reward this player already redeemed shows the code once more while the card's
1276
+ * `canRevealAgain` is true (`revealedAgain: true`). Never auto-retried.
1277
+ *
1278
+ * Refusals: `409 already_redeemed` (`err.isRewardAlreadyRedeemed`), `404
1279
+ * vault_entry_not_found` (`err.isRewardNotFound`), `410 vault_entry_expired`
1280
+ * (`err.isRewardExpired`), `409 inventory_exhausted` / `409 conflict`
1281
+ * (`err.isRewardUnavailable`: no units or codes left, or the reward is reserved or revoked).
1282
+ */
1283
+ async redeemReward(vaultEntryId, opts) {
1284
+ if (typeof vaultEntryId !== "string" || !UUID_RE.test(vaultEntryId.trim())) {
1285
+ throw new InvoError({
1286
+ message: `vaultEntryId must be a reward's vaultEntryId (got ${JSON.stringify(vaultEntryId)}).`,
1287
+ code: "INVALID_INPUT",
1288
+ status: 0
1289
+ });
1290
+ }
1291
+ const id = vaultEntryId.trim();
1292
+ return this.withTokenRetry(async () => {
1293
+ const raw = await this.post(
1294
+ `/api/sdk/loyalty/me/vault/${encodeURIComponent(id)}/redeem`,
1295
+ void 0,
1296
+ opts?.signal
1297
+ );
1298
+ return toRedeemRewardResult(raw, id);
1299
+ });
1300
+ }
1301
+ /**
1302
+ * A short-lived link to INVO's hosted "My rewards" page for the signed-in player: their
1303
+ * cards, progress and rewards, with a Redeem button. Open `url` in a browser or web view
1304
+ * (it cannot be embedded in an iframe). Ask for a fresh link each time the player opens
1305
+ * the page; never share or store it.
1306
+ */
1307
+ async getRewardsPageLink(opts) {
1308
+ return this.withTokenRetry(async () => {
1309
+ const raw = await this.post(
1310
+ "/api/sdk/loyalty/me/rewards-page",
1311
+ void 0,
1312
+ opts?.signal
1313
+ );
1314
+ return toRewardsPageLink(raw);
1315
+ });
1316
+ }
1250
1317
  /**
1251
1318
  * First-enrollment OTP grant (§4.2). When `enrollPasskey()` throws
1252
1319
  * `ENROLLMENT_REQUIRES_AUTHORIZATION` (`err.isEnrollmentAuthorizationRequired`), call
package/dist/server.cjs CHANGED
@@ -821,6 +821,7 @@ var InvoError = class _InvoError extends Error {
821
821
  * The same code comes back from `cards.beginSetup` and from `mintPlayerToken` for the
822
822
  * same reason; those two never create players, so create the member first (for
823
823
  * example with `createSetupSession` and a `playerName`, or a currency purchase).
824
+ * `getPlayerRewards` answers it when no player has that email in this game.
824
825
  */
825
826
  get isPlayerNotFound() {
826
827
  return this.code === "PLAYER_NOT_FOUND";
@@ -835,7 +836,8 @@ var InvoError = class _InvoError extends Error {
835
836
  }
836
837
  /**
837
838
  * True when `cards.createSetupSession` was refused because `playerEmail` was missing or
838
- * is not an email address (`INVALID_PLAYER_EMAIL`, 400).
839
+ * is not an email address (`INVALID_PLAYER_EMAIL`, 400). `getPlayerRewards` answers it
840
+ * for an email that is not an email address (a blank one never leaves the SDK).
839
841
  */
840
842
  get isInvalidPlayerEmail() {
841
843
  return this.code === "INVALID_PLAYER_EMAIL";
@@ -886,6 +888,26 @@ var InvoError = class _InvoError extends Error {
886
888
  get isIdentityCheckUnavailable() {
887
889
  return this.code === "IDENTITY_CHECK_UNAVAILABLE";
888
890
  }
891
+ // ---- Loyalty rewards (InvoClient.redeemReward) ----
892
+ /** True when a reward was already redeemed and its code can no longer be shown (`already_redeemed`, 409). */
893
+ get isRewardAlreadyRedeemed() {
894
+ return this.code === "already_redeemed";
895
+ }
896
+ /** True when the player has no such reward (`vault_entry_not_found`, 404). */
897
+ get isRewardNotFound() {
898
+ return this.code === "vault_entry_not_found";
899
+ }
900
+ /**
901
+ * True when the reward cannot be redeemed right now (409): `inventory_exhausted` (no units or
902
+ * codes are left for it) or `conflict` (the reward is reserved or revoked).
903
+ */
904
+ get isRewardUnavailable() {
905
+ return this.code === "inventory_exhausted" || this.code === "conflict";
906
+ }
907
+ /** True when the reward expired before it was redeemed (`vault_entry_expired`, 410). */
908
+ get isRewardExpired() {
909
+ return this.code === "vault_entry_expired";
910
+ }
889
911
  /** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
890
912
  get retryAfter() {
891
913
  const v = this.bodyObject()["retry_after"];
@@ -1168,6 +1190,89 @@ function toDestinationsResult(raw, direction) {
1168
1190
  };
1169
1191
  }
1170
1192
 
1193
+ // src/shared/loyalty.ts
1194
+ var obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
1195
+ var rows = (v) => Array.isArray(v) ? v.filter((r) => r && typeof r === "object" && !Array.isArray(r)) : [];
1196
+ var str = (v) => v === void 0 || v === null ? "" : String(v);
1197
+ var strOrNull = (v) => v === void 0 || v === null ? null : String(v);
1198
+ var numOrNull = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
1199
+ var int = (v, fallback = 0) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
1200
+ var passThrough = (v) => v;
1201
+ function toLoyaltyStepProgress(value) {
1202
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
1203
+ const v = value;
1204
+ const current = v["current"];
1205
+ const target = v["target"];
1206
+ if (!Number.isInteger(current) || !Number.isInteger(target)) return null;
1207
+ return { current, target };
1208
+ }
1209
+ function toStep(row) {
1210
+ return {
1211
+ stepId: strOrNull(row["step_id"]),
1212
+ index: int(row["index"]),
1213
+ action: str(row["action"]),
1214
+ label: str(row["label"]),
1215
+ summary: str(row["summary"]),
1216
+ windowHours: numOrNull(row["window_hours"]),
1217
+ state: str(row["state"]),
1218
+ progress: toLoyaltyStepProgress(row["progress"]),
1219
+ raw: row
1220
+ };
1221
+ }
1222
+ function toCardReward(row) {
1223
+ return {
1224
+ vaultEntryId: str(row["vault_entry_id"]),
1225
+ rewardId: str(row["reward_id"]),
1226
+ state: str(row["state"]),
1227
+ unlockedAt: str(row["unlocked_at"]),
1228
+ expiresAt: str(row["expires_at"]),
1229
+ redeemedAt: strOrNull(row["redeemed_at"]),
1230
+ codeMasked: strOrNull(row["code_masked"]),
1231
+ canRedeem: row["can_redeem"] === true,
1232
+ canRevealAgain: row["can_reveal_again"] === true,
1233
+ revealUntil: strOrNull(row["reveal_until"]),
1234
+ raw: row
1235
+ };
1236
+ }
1237
+ function toLoyaltyCard(row) {
1238
+ const brand = obj(row["brand"]);
1239
+ const reward = obj(row["reward"]);
1240
+ const steps = rows(row["steps"]).map(toStep);
1241
+ return {
1242
+ cardVersion: passThrough(row["card_version"]),
1243
+ mode: str(row["mode"]),
1244
+ programId: strOrNull(row["program_id"]),
1245
+ questId: strOrNull(row["quest_id"]),
1246
+ questVersion: numOrNull(row["quest_version"]),
1247
+ campaignId: strOrNull(row["campaign_id"]),
1248
+ title: str(row["title"]),
1249
+ description: str(row["description"]),
1250
+ brand: { name: strOrNull(brand["name"]), logoUrl: strOrNull(brand["logo_url"]) },
1251
+ artUrl: strOrNull(row["art_url"]),
1252
+ reward: { rewardId: strOrNull(reward["reward_id"]), name: strOrNull(reward["name"]) },
1253
+ orderMode: str(row["order_mode"]),
1254
+ status: str(row["status"]),
1255
+ startsAt: strOrNull(row["starts_at"]),
1256
+ endsAt: strOrNull(row["ends_at"]),
1257
+ completionHours: numOrNull(row["completion_hours"]),
1258
+ completionNote: strOrNull(row["completion_note"]),
1259
+ windowEndsAt: strOrNull(row["window_ends_at"]),
1260
+ completedAt: strOrNull(row["completed_at"]),
1261
+ stepsRequired: passThrough(row["steps_required"]),
1262
+ stepsComplete: passThrough(row["steps_complete"]),
1263
+ steps,
1264
+ rewards: rows(row["rewards"]).map(toCardReward),
1265
+ raw: row
1266
+ };
1267
+ }
1268
+ function toLoyaltyCardsResult(raw) {
1269
+ return {
1270
+ cardVersion: passThrough(raw["card_version"]),
1271
+ cards: rows(raw["cards"]).map(toLoyaltyCard),
1272
+ raw
1273
+ };
1274
+ }
1275
+
1171
1276
  // src/shared/receipt-fields.ts
1172
1277
  function creditFields(raw) {
1173
1278
  const c = raw["credited"];
@@ -1186,7 +1291,7 @@ function receiptFields(raw) {
1186
1291
  }
1187
1292
 
1188
1293
  // src/version.ts
1189
- var SDK_VERSION = "3.19.0";
1294
+ var SDK_VERSION = "3.20.0";
1190
1295
 
1191
1296
  // src/shared/types.ts
1192
1297
  function isRefundPendingApproval(r) {
@@ -2419,13 +2524,13 @@ var SubscriptionsServer = class {
2419
2524
  this.auth,
2420
2525
  { signal: opts?.signal }
2421
2526
  );
2422
- const rows = Array.isArray(raw["subscriptions"]) ? raw["subscriptions"] : [];
2527
+ const rows2 = Array.isArray(raw["subscriptions"]) ? raw["subscriptions"] : [];
2423
2528
  const p = raw["pagination"] ?? {};
2424
2529
  return {
2425
2530
  playerEmail: String(raw["player_email"] ?? playerEmail),
2426
- subscriptions: rows.map(toSubscription),
2531
+ subscriptions: rows2.map(toSubscription),
2427
2532
  pagination: {
2428
- totalCount: Number(p["total_count"] ?? rows.length),
2533
+ totalCount: Number(p["total_count"] ?? rows2.length),
2429
2534
  limit: Number(p["limit"] ?? 50),
2430
2535
  offset: Number(p["offset"] ?? 0),
2431
2536
  hasMore: p["has_more"] === true
@@ -2924,9 +3029,9 @@ var CardsServer = class {
2924
3029
  this.auth,
2925
3030
  { signal: opts?.signal }
2926
3031
  );
2927
- const rows = Array.isArray(raw["cards"]) ? raw["cards"] : [];
3032
+ const rows2 = Array.isArray(raw["cards"]) ? raw["cards"] : [];
2928
3033
  return {
2929
- cards: rows.map(toSavedCard).filter((c) => c !== null),
3034
+ cards: rows2.map(toSavedCard).filter((c) => c !== null),
2930
3035
  raw
2931
3036
  };
2932
3037
  }
@@ -3634,14 +3739,40 @@ var InvoServer = class {
3634
3739
  });
3635
3740
  }
3636
3741
  const raw = await this.http.get(path, this.auth, { signal: opts?.signal });
3637
- const rows = Array.isArray(raw["balances"]) ? raw["balances"] : [];
3742
+ const rows2 = Array.isArray(raw["balances"]) ? raw["balances"] : [];
3638
3743
  return {
3639
3744
  player: raw["player"] ?? {},
3640
- balances: rows.map(toCurrencyBalance),
3745
+ balances: rows2.map(toCurrencyBalance),
3641
3746
  summary: raw["summary"] ?? {},
3642
3747
  raw
3643
3748
  };
3644
3749
  }
3750
+ /**
3751
+ * One player's loyalty cards, read by your SERVER with the game secret: the same cards
3752
+ * the player sees through `InvoClient.getMyRewards()`, for the player with this email in
3753
+ * your game. Each step carries `state` and `progress` (`{ current, target }`, or `null`
3754
+ * when the number could not be read this time: render `state` alone then). Rewards carry
3755
+ * their masked code only; a code is never returned here.
3756
+ *
3757
+ * Refusals (all `InvoError`): a blank email throws `INVALID_INPUT` before the network;
3758
+ * `400 INVALID_PLAYER_EMAIL` (`err.isInvalidPlayerEmail`), `401 INVALID_GAME_SECRET` for a missing or wrong key, or
3759
+ * a per-channel key (this read takes the game's server secret only), `404 PLAYER_NOT_FOUND`
3760
+ * (`err.isPlayerNotFound`: no player with this email in this game), `429` (back off;
3761
+ * `err.retryAfter`). Also `409 NO_TENANT` (the game is not set up for loyalty), `503`
3762
+ * (temporarily unavailable) and `502` / `504` (the loyalty service could not be reached or
3763
+ * timed out): retry later. A GET, so transient failures are retried automatically.
3764
+ */
3765
+ async getPlayerRewards(playerEmail, opts) {
3766
+ if (typeof playerEmail !== "string" || !playerEmail.trim()) {
3767
+ throw invalidInput("playerEmail", playerEmail, "is required");
3768
+ }
3769
+ const raw = await this.http.get(
3770
+ `/api/sdk/loyalty/players/rewards?player_email=${encodeURIComponent(playerEmail.trim())}`,
3771
+ this.auth,
3772
+ { signal: opts?.signal }
3773
+ );
3774
+ return toLoyaltyCardsResult(raw);
3775
+ }
3645
3776
  /**
3646
3777
  * List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
3647
3778
  * the source of truth for a "you have X to collect" badge. Pass the player's email
@@ -3663,8 +3794,8 @@ var InvoServer = class {
3663
3794
  this.auth,
3664
3795
  { signal: opts?.signal }
3665
3796
  );
3666
- const rows = Array.isArray(raw["inbound_pending"]) ? raw["inbound_pending"] : [];
3667
- return { inboundPending: rows.map(toInboundPendingItem), raw };
3797
+ const rows2 = Array.isArray(raw["inbound_pending"]) ? raw["inbound_pending"] : [];
3798
+ return { inboundPending: rows2.map(toInboundPendingItem), raw };
3668
3799
  }
3669
3800
  /**
3670
3801
  * Look up a player's linked wallet identities (SERVER-only, game-secret). Game-scoped:
package/dist/server.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { I as InvoError, H as Http, x as AuthHeader, y as CardSetupSessionInput, g as CallOptions, z as CardSetupSessionResult, F as CardSetupInput, G as CardSetupResult, J as CardSetupConfirmInput, K as CardSetupConfirmResult, N as PlayerCardsResult, O as PlatformPurchaseInput, Q as PlatformPurchaseResult, S as PlatformOrderStatusResult, T as PlatformRefundInput, U as PlatformRefundResult, X as CreateSubscriptionInput, Y as SubscriptionResult, Z as GetSubscriptionOptions, _ as GetSubscriptionResult, $ as ListSubscriptionsOptions, a0 as SubscriptionListResult, a1 as CancelSubscriptionOptions, a2 as CancelResult, a3 as ChangeAmountResult, a4 as SetPaymentMethodInput, a5 as SetPaymentMethodResult, a6 as RefundSubscriptionInput, a7 as RefundResult, a8 as SteamSubscriptionInitInput, a9 as SteamInitResult, aa as SteamFinalizeSubscriptionResult, ab as SandboxClockResult, ac as SandboxFailureOutcome, ad as SandboxForceFailureOptions, ae as SandboxForceAuthChallengeOptions, af as ServerConfig, ag as PlayerToken, ah as InitiateSendInput, ai as InitiateResult, aj as InitiateTransferInput, ak as CreateCheckoutInput, al as CreateCheckoutResult, am as PurchaseInput, an as PurchaseResult, ao as CurrencyPurchaseQuoteInput, ap as CurrencyPurchaseQuote, aq as ConfirmPaymentResult, ar as OrderDetailsResult, as as SteamPacksQuery, at as SteamPacksResult, au as SteamInitPurchaseInput, av as SteamInitPurchaseResult, aw as SteamFinalizeInput, ax as SteamFinalizeResult, ay as PurchaseItemInput, az as PurchaseItemResult, aA as ItemHistoryQuery, aB as ItemHistoryResult, aC as ItemOrderQuery, aD as PlayerBalanceQuery, aE as PlayerBalanceResult, aF as InboundPendingQuery, aG as InboundPendingResult, aH as LinkedIdentitiesQuery, aI as LinkedIdentitiesResult, aJ as SmsVerifyResult, aK as ClaimTransferInput, aL as ClaimResult, aM as ClaimCurrencyInput, aN as TransactionStatusResult, aO as GuardianApprovalStatusResult, aP as ServerDestinationsQuery, k as DestinationsResult, aQ as PhoneShareContact, aR as PhoneShareInitiateResult, aS as PhoneShareApproveInput, aT as PhoneShareApproveResult, aU as PhoneShareStatusResult, aV as BeginDeviceApprovalInput, aW as DeviceApprovalGrant, aX as PollDeviceApprovalInput, aY as DeviceApprovalPollResult, aZ as ConfirmDeviceEnrollmentInput, a_ as ConfirmDeviceEnrollmentResult, a$ as ApproveWithDeviceCodeInput, b0 as DeviceApprovalSettleResult, b1 as CompleteDeviceApprovalInput, b2 as CompleteDeviceApprovalResult } from './types-CCqgVhzf.cjs';
2
- export { b3 as CardSetupStatus, b4 as CheckoutWarning, b5 as CurrencyBalance, b6 as CurrencyPurchaseQuoteBreakdown, p as DestinationGame, b7 as DeviceApprovalChannel, b8 as DeviceApprovalEnrollment, b9 as DeviceApprovalFlow, ba as DeviceApprovalPollStatus, bb as DeviceEnrollmentDecision, bc as DeviceEnrollmentRespond, bd as FeeTakenFrom, be as FirstCharge, bf as FirstChargeStatus, bg as FundingSource, bh as InboundPendingItem, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, bi as LinkedIdentityEmail, bj as MinPurchaseWarning, bk as PlatformPurchaseStatus, w as Rail, bl as RefundInitiation, bm as RefundPendingApproval, bn as RefundProcessingFeeBasis, bo as RefundReceipt, bp as RefundRevenueShareAttribution, bq as RefundWarning, br as SandboxClockState, bs as SavedCard, bt as SteamPack, bu as SteamUserSession, bv as Subscription, bw as SubscriptionBaseInput, bx as SubscriptionConsent, by as SubscriptionConsentInput, bz as SubscriptionFundingRail, bA as SubscriptionInterval, bB as SubscriptionRevenueShare, bC as SubscriptionRevenueShareInput, bD as SubscriptionStatus, bE as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bF as isRefundPendingApproval } from './types-CCqgVhzf.cjs';
1
+ import { I as InvoError, H as Http, T as AuthHeader, U as CardSetupSessionInput, g as CallOptions, X as CardSetupSessionResult, Y as CardSetupInput, Z as CardSetupResult, _ as CardSetupConfirmInput, $ as CardSetupConfirmResult, a0 as PlayerCardsResult, a1 as PlatformPurchaseInput, a2 as PlatformPurchaseResult, a3 as PlatformOrderStatusResult, a4 as PlatformRefundInput, a5 as PlatformRefundResult, a6 as CreateSubscriptionInput, a7 as SubscriptionResult, a8 as GetSubscriptionOptions, a9 as GetSubscriptionResult, aa as ListSubscriptionsOptions, ab as SubscriptionListResult, ac as CancelSubscriptionOptions, ad as CancelResult, ae as ChangeAmountResult, af as SetPaymentMethodInput, ag as SetPaymentMethodResult, ah as RefundSubscriptionInput, ai as RefundResult, aj as SteamSubscriptionInitInput, ak as SteamInitResult, al as SteamFinalizeSubscriptionResult, am as SandboxClockResult, an as SandboxFailureOutcome, ao as SandboxForceFailureOptions, ap as SandboxForceAuthChallengeOptions, aq as ServerConfig, ar as PlayerToken, as as InitiateSendInput, at as InitiateResult, au as InitiateTransferInput, av as CreateCheckoutInput, aw as CreateCheckoutResult, ax as PurchaseInput, ay as PurchaseResult, az as CurrencyPurchaseQuoteInput, aA as CurrencyPurchaseQuote, aB as ConfirmPaymentResult, aC as OrderDetailsResult, aD as SteamPacksQuery, aE as SteamPacksResult, aF as SteamInitPurchaseInput, aG as SteamInitPurchaseResult, aH as SteamFinalizeInput, aI as SteamFinalizeResult, aJ as PurchaseItemInput, aK as PurchaseItemResult, aL as ItemHistoryQuery, aM as ItemHistoryResult, aN as ItemOrderQuery, aO as PlayerBalanceQuery, aP as PlayerBalanceResult, l as LoyaltyCardsResult, aQ as InboundPendingQuery, aR as InboundPendingResult, aS as LinkedIdentitiesQuery, aT as LinkedIdentitiesResult, aU as SmsVerifyResult, aV as ClaimTransferInput, aW as ClaimResult, aX as ClaimCurrencyInput, aY as TransactionStatusResult, aZ as GuardianApprovalStatusResult, a_ as ServerDestinationsQuery, k as DestinationsResult, a$ as PhoneShareContact, b0 as PhoneShareInitiateResult, b1 as PhoneShareApproveInput, b2 as PhoneShareApproveResult, b3 as PhoneShareStatusResult, b4 as BeginDeviceApprovalInput, b5 as DeviceApprovalGrant, b6 as PollDeviceApprovalInput, b7 as DeviceApprovalPollResult, b8 as ConfirmDeviceEnrollmentInput, b9 as ConfirmDeviceEnrollmentResult, ba as ApproveWithDeviceCodeInput, bb as DeviceApprovalSettleResult, bc as CompleteDeviceApprovalInput, bd as CompleteDeviceApprovalResult } from './types-BwgkJoM6.cjs';
2
+ export { be as CardSetupStatus, bf as CheckoutWarning, bg as CurrencyBalance, bh as CurrencyPurchaseQuoteBreakdown, t as DestinationGame, bi as DeviceApprovalChannel, bj as DeviceApprovalEnrollment, bk as DeviceApprovalFlow, bl as DeviceApprovalPollStatus, bm as DeviceEnrollmentDecision, bn as DeviceEnrollmentRespond, bo as FeeTakenFrom, bp as FirstCharge, bq as FirstChargeStatus, br as FundingSource, bs as InboundPendingItem, u as InvoErrorInfo, v as InvoHooks, w as InvoRequestInfo, x as InvoResponseInfo, bt as LinkedIdentityEmail, y as LoyaltyCard, z as LoyaltyCardReward, F as LoyaltyCardStep, G as LoyaltyRewardState, J as LoyaltyStepProgress, K as LoyaltyStepState, bu as MinPurchaseWarning, bv as PlatformPurchaseStatus, S as Rail, bw as RefundInitiation, bx as RefundPendingApproval, by as RefundProcessingFeeBasis, bz as RefundReceipt, bA as RefundRevenueShareAttribution, bB as RefundWarning, bC as SandboxClockState, bD as SavedCard, bE as SteamPack, bF as SteamUserSession, bG as Subscription, bH as SubscriptionBaseInput, bI as SubscriptionConsent, bJ as SubscriptionConsentInput, bK as SubscriptionFundingRail, bL as SubscriptionInterval, bM as SubscriptionRevenueShare, bN as SubscriptionRevenueShareInput, bO as SubscriptionStatus, bP as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bQ as isRefundPendingApproval } from './types-BwgkJoM6.cjs';
3
3
 
4
4
  /**
5
5
  * The package version, as sent in the server User-Agent. A test pins this to
6
6
  * `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
7
7
  * Bump it with the changeset flow.
8
8
  */
9
- declare const SDK_VERSION = "3.19.0";
9
+ declare const SDK_VERSION = "3.20.0";
10
10
 
11
11
  interface VerifyWebhookOptions {
12
12
  /** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
@@ -1408,6 +1408,22 @@ declare class InvoServer {
1408
1408
  * client-side read, or `playerEmail` here server-side.
1409
1409
  */
1410
1410
  getPlayerBalance(query: PlayerBalanceQuery, opts?: CallOptions): Promise<PlayerBalanceResult>;
1411
+ /**
1412
+ * One player's loyalty cards, read by your SERVER with the game secret: the same cards
1413
+ * the player sees through `InvoClient.getMyRewards()`, for the player with this email in
1414
+ * your game. Each step carries `state` and `progress` (`{ current, target }`, or `null`
1415
+ * when the number could not be read this time: render `state` alone then). Rewards carry
1416
+ * their masked code only; a code is never returned here.
1417
+ *
1418
+ * Refusals (all `InvoError`): a blank email throws `INVALID_INPUT` before the network;
1419
+ * `400 INVALID_PLAYER_EMAIL` (`err.isInvalidPlayerEmail`), `401 INVALID_GAME_SECRET` for a missing or wrong key, or
1420
+ * a per-channel key (this read takes the game's server secret only), `404 PLAYER_NOT_FOUND`
1421
+ * (`err.isPlayerNotFound`: no player with this email in this game), `429` (back off;
1422
+ * `err.retryAfter`). Also `409 NO_TENANT` (the game is not set up for loyalty), `503`
1423
+ * (temporarily unavailable) and `502` / `504` (the loyalty service could not be reached or
1424
+ * timed out): retry later. A GET, so transient failures are retried automatically.
1425
+ */
1426
+ getPlayerRewards(playerEmail: string, opts?: CallOptions): Promise<LoyaltyCardsResult>;
1411
1427
  /**
1412
1428
  * List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
1413
1429
  * the source of truth for a "you have X to collect" badge. Pass the player's email
@@ -1619,4 +1635,4 @@ declare class InvoServer {
1619
1635
  private toInitiateResult;
1620
1636
  }
1621
1637
 
1622
- export { ApproveWithDeviceCodeInput, BeginDeviceApprovalInput, CallOptions, CancelResult, CancelSubscriptionOptions, CardSetupConfirmInput, CardSetupConfirmResult, CardSetupInput, CardSetupResult, CardSetupSessionInput, CardSetupSessionResult, CardsServer, ChangeAmountResult, ClaimCurrencyInput, ClaimResult, ClaimTransferInput, CompleteDeviceApprovalInput, CompleteDeviceApprovalResult, ConfirmDeviceEnrollmentInput, ConfirmDeviceEnrollmentResult, ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, CreateSubscriptionInput, CurrencyPurchaseQuote, CurrencyPurchaseQuoteInput, DestinationsResult, DeviceApprovalGrant, DeviceApprovalPollResult, DeviceApprovalSettleResult, GetSubscriptionOptions, GetSubscriptionResult, GuardianApprovalStatusResult, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, ListSubscriptionsOptions, OrderDetailsResult, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, SDK_VERSION, SandboxClockResult, SandboxFailureOutcome, SandboxForceAuthChallengeOptions, SandboxForceFailureOptions, SandboxServer, SandboxSubscriptionsServer, ServerConfig, ServerDestinationsQuery, SetPaymentMethodInput, SetPaymentMethodResult, SmsVerifyResult, SteamFinalizeInput, SteamFinalizeResult, SteamFinalizeSubscriptionResult, SteamInitPurchaseInput, SteamInitPurchaseResult, SteamInitResult, SteamPacksQuery, SteamPacksResult, SteamSubscriptionInitInput, type SubscriptionAuthenticationRequiredData, type SubscriptionCanceledData, type SubscriptionEventCommon, type SubscriptionExpiredData, SubscriptionListResult, type SubscriptionPastDueData, type SubscriptionPaymentFailedData, type SubscriptionRefundApprovedData, type SubscriptionRefundDetail, type SubscriptionRefundRejectedData, type SubscriptionRefundRequestData, type SubscriptionRefundedData, type SubscriptionRenewalFunding, type SubscriptionRenewalSplit, type SubscriptionRenewedData, SubscriptionResult, type SubscriptionRevenueShareAttribution, type SubscriptionTrialEventFields, SubscriptionsServer, TransactionStatusResult, type TransferEventData, type VerifyWebhookOptions, type WebhookHandlerOptions, createWebhookHandler, verifyWebhook, verifyWebhookAsync };
1638
+ export { ApproveWithDeviceCodeInput, BeginDeviceApprovalInput, CallOptions, CancelResult, CancelSubscriptionOptions, CardSetupConfirmInput, CardSetupConfirmResult, CardSetupInput, CardSetupResult, CardSetupSessionInput, CardSetupSessionResult, CardsServer, ChangeAmountResult, ClaimCurrencyInput, ClaimResult, ClaimTransferInput, CompleteDeviceApprovalInput, CompleteDeviceApprovalResult, ConfirmDeviceEnrollmentInput, ConfirmDeviceEnrollmentResult, ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, CreateSubscriptionInput, CurrencyPurchaseQuote, CurrencyPurchaseQuoteInput, DestinationsResult, DeviceApprovalGrant, DeviceApprovalPollResult, DeviceApprovalSettleResult, GetSubscriptionOptions, GetSubscriptionResult, GuardianApprovalStatusResult, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, ListSubscriptionsOptions, LoyaltyCardsResult, OrderDetailsResult, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, SDK_VERSION, SandboxClockResult, SandboxFailureOutcome, SandboxForceAuthChallengeOptions, SandboxForceFailureOptions, SandboxServer, SandboxSubscriptionsServer, ServerConfig, ServerDestinationsQuery, SetPaymentMethodInput, SetPaymentMethodResult, SmsVerifyResult, SteamFinalizeInput, SteamFinalizeResult, SteamFinalizeSubscriptionResult, SteamInitPurchaseInput, SteamInitPurchaseResult, SteamInitResult, SteamPacksQuery, SteamPacksResult, SteamSubscriptionInitInput, type SubscriptionAuthenticationRequiredData, type SubscriptionCanceledData, type SubscriptionEventCommon, type SubscriptionExpiredData, SubscriptionListResult, type SubscriptionPastDueData, type SubscriptionPaymentFailedData, type SubscriptionRefundApprovedData, type SubscriptionRefundDetail, type SubscriptionRefundRejectedData, type SubscriptionRefundRequestData, type SubscriptionRefundedData, type SubscriptionRenewalFunding, type SubscriptionRenewalSplit, type SubscriptionRenewedData, SubscriptionResult, type SubscriptionRevenueShareAttribution, type SubscriptionTrialEventFields, SubscriptionsServer, TransactionStatusResult, type TransferEventData, type VerifyWebhookOptions, type WebhookHandlerOptions, createWebhookHandler, verifyWebhook, verifyWebhookAsync };
package/dist/server.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { I as InvoError, H as Http, x as AuthHeader, y as CardSetupSessionInput, g as CallOptions, z as CardSetupSessionResult, F as CardSetupInput, G as CardSetupResult, J as CardSetupConfirmInput, K as CardSetupConfirmResult, N as PlayerCardsResult, O as PlatformPurchaseInput, Q as PlatformPurchaseResult, S as PlatformOrderStatusResult, T as PlatformRefundInput, U as PlatformRefundResult, X as CreateSubscriptionInput, Y as SubscriptionResult, Z as GetSubscriptionOptions, _ as GetSubscriptionResult, $ as ListSubscriptionsOptions, a0 as SubscriptionListResult, a1 as CancelSubscriptionOptions, a2 as CancelResult, a3 as ChangeAmountResult, a4 as SetPaymentMethodInput, a5 as SetPaymentMethodResult, a6 as RefundSubscriptionInput, a7 as RefundResult, a8 as SteamSubscriptionInitInput, a9 as SteamInitResult, aa as SteamFinalizeSubscriptionResult, ab as SandboxClockResult, ac as SandboxFailureOutcome, ad as SandboxForceFailureOptions, ae as SandboxForceAuthChallengeOptions, af as ServerConfig, ag as PlayerToken, ah as InitiateSendInput, ai as InitiateResult, aj as InitiateTransferInput, ak as CreateCheckoutInput, al as CreateCheckoutResult, am as PurchaseInput, an as PurchaseResult, ao as CurrencyPurchaseQuoteInput, ap as CurrencyPurchaseQuote, aq as ConfirmPaymentResult, ar as OrderDetailsResult, as as SteamPacksQuery, at as SteamPacksResult, au as SteamInitPurchaseInput, av as SteamInitPurchaseResult, aw as SteamFinalizeInput, ax as SteamFinalizeResult, ay as PurchaseItemInput, az as PurchaseItemResult, aA as ItemHistoryQuery, aB as ItemHistoryResult, aC as ItemOrderQuery, aD as PlayerBalanceQuery, aE as PlayerBalanceResult, aF as InboundPendingQuery, aG as InboundPendingResult, aH as LinkedIdentitiesQuery, aI as LinkedIdentitiesResult, aJ as SmsVerifyResult, aK as ClaimTransferInput, aL as ClaimResult, aM as ClaimCurrencyInput, aN as TransactionStatusResult, aO as GuardianApprovalStatusResult, aP as ServerDestinationsQuery, k as DestinationsResult, aQ as PhoneShareContact, aR as PhoneShareInitiateResult, aS as PhoneShareApproveInput, aT as PhoneShareApproveResult, aU as PhoneShareStatusResult, aV as BeginDeviceApprovalInput, aW as DeviceApprovalGrant, aX as PollDeviceApprovalInput, aY as DeviceApprovalPollResult, aZ as ConfirmDeviceEnrollmentInput, a_ as ConfirmDeviceEnrollmentResult, a$ as ApproveWithDeviceCodeInput, b0 as DeviceApprovalSettleResult, b1 as CompleteDeviceApprovalInput, b2 as CompleteDeviceApprovalResult } from './types-CCqgVhzf.js';
2
- export { b3 as CardSetupStatus, b4 as CheckoutWarning, b5 as CurrencyBalance, b6 as CurrencyPurchaseQuoteBreakdown, p as DestinationGame, b7 as DeviceApprovalChannel, b8 as DeviceApprovalEnrollment, b9 as DeviceApprovalFlow, ba as DeviceApprovalPollStatus, bb as DeviceEnrollmentDecision, bc as DeviceEnrollmentRespond, bd as FeeTakenFrom, be as FirstCharge, bf as FirstChargeStatus, bg as FundingSource, bh as InboundPendingItem, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, bi as LinkedIdentityEmail, bj as MinPurchaseWarning, bk as PlatformPurchaseStatus, w as Rail, bl as RefundInitiation, bm as RefundPendingApproval, bn as RefundProcessingFeeBasis, bo as RefundReceipt, bp as RefundRevenueShareAttribution, bq as RefundWarning, br as SandboxClockState, bs as SavedCard, bt as SteamPack, bu as SteamUserSession, bv as Subscription, bw as SubscriptionBaseInput, bx as SubscriptionConsent, by as SubscriptionConsentInput, bz as SubscriptionFundingRail, bA as SubscriptionInterval, bB as SubscriptionRevenueShare, bC as SubscriptionRevenueShareInput, bD as SubscriptionStatus, bE as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bF as isRefundPendingApproval } from './types-CCqgVhzf.js';
1
+ import { I as InvoError, H as Http, T as AuthHeader, U as CardSetupSessionInput, g as CallOptions, X as CardSetupSessionResult, Y as CardSetupInput, Z as CardSetupResult, _ as CardSetupConfirmInput, $ as CardSetupConfirmResult, a0 as PlayerCardsResult, a1 as PlatformPurchaseInput, a2 as PlatformPurchaseResult, a3 as PlatformOrderStatusResult, a4 as PlatformRefundInput, a5 as PlatformRefundResult, a6 as CreateSubscriptionInput, a7 as SubscriptionResult, a8 as GetSubscriptionOptions, a9 as GetSubscriptionResult, aa as ListSubscriptionsOptions, ab as SubscriptionListResult, ac as CancelSubscriptionOptions, ad as CancelResult, ae as ChangeAmountResult, af as SetPaymentMethodInput, ag as SetPaymentMethodResult, ah as RefundSubscriptionInput, ai as RefundResult, aj as SteamSubscriptionInitInput, ak as SteamInitResult, al as SteamFinalizeSubscriptionResult, am as SandboxClockResult, an as SandboxFailureOutcome, ao as SandboxForceFailureOptions, ap as SandboxForceAuthChallengeOptions, aq as ServerConfig, ar as PlayerToken, as as InitiateSendInput, at as InitiateResult, au as InitiateTransferInput, av as CreateCheckoutInput, aw as CreateCheckoutResult, ax as PurchaseInput, ay as PurchaseResult, az as CurrencyPurchaseQuoteInput, aA as CurrencyPurchaseQuote, aB as ConfirmPaymentResult, aC as OrderDetailsResult, aD as SteamPacksQuery, aE as SteamPacksResult, aF as SteamInitPurchaseInput, aG as SteamInitPurchaseResult, aH as SteamFinalizeInput, aI as SteamFinalizeResult, aJ as PurchaseItemInput, aK as PurchaseItemResult, aL as ItemHistoryQuery, aM as ItemHistoryResult, aN as ItemOrderQuery, aO as PlayerBalanceQuery, aP as PlayerBalanceResult, l as LoyaltyCardsResult, aQ as InboundPendingQuery, aR as InboundPendingResult, aS as LinkedIdentitiesQuery, aT as LinkedIdentitiesResult, aU as SmsVerifyResult, aV as ClaimTransferInput, aW as ClaimResult, aX as ClaimCurrencyInput, aY as TransactionStatusResult, aZ as GuardianApprovalStatusResult, a_ as ServerDestinationsQuery, k as DestinationsResult, a$ as PhoneShareContact, b0 as PhoneShareInitiateResult, b1 as PhoneShareApproveInput, b2 as PhoneShareApproveResult, b3 as PhoneShareStatusResult, b4 as BeginDeviceApprovalInput, b5 as DeviceApprovalGrant, b6 as PollDeviceApprovalInput, b7 as DeviceApprovalPollResult, b8 as ConfirmDeviceEnrollmentInput, b9 as ConfirmDeviceEnrollmentResult, ba as ApproveWithDeviceCodeInput, bb as DeviceApprovalSettleResult, bc as CompleteDeviceApprovalInput, bd as CompleteDeviceApprovalResult } from './types-BwgkJoM6.js';
2
+ export { be as CardSetupStatus, bf as CheckoutWarning, bg as CurrencyBalance, bh as CurrencyPurchaseQuoteBreakdown, t as DestinationGame, bi as DeviceApprovalChannel, bj as DeviceApprovalEnrollment, bk as DeviceApprovalFlow, bl as DeviceApprovalPollStatus, bm as DeviceEnrollmentDecision, bn as DeviceEnrollmentRespond, bo as FeeTakenFrom, bp as FirstCharge, bq as FirstChargeStatus, br as FundingSource, bs as InboundPendingItem, u as InvoErrorInfo, v as InvoHooks, w as InvoRequestInfo, x as InvoResponseInfo, bt as LinkedIdentityEmail, y as LoyaltyCard, z as LoyaltyCardReward, F as LoyaltyCardStep, G as LoyaltyRewardState, J as LoyaltyStepProgress, K as LoyaltyStepState, bu as MinPurchaseWarning, bv as PlatformPurchaseStatus, S as Rail, bw as RefundInitiation, bx as RefundPendingApproval, by as RefundProcessingFeeBasis, bz as RefundReceipt, bA as RefundRevenueShareAttribution, bB as RefundWarning, bC as SandboxClockState, bD as SavedCard, bE as SteamPack, bF as SteamUserSession, bG as Subscription, bH as SubscriptionBaseInput, bI as SubscriptionConsent, bJ as SubscriptionConsentInput, bK as SubscriptionFundingRail, bL as SubscriptionInterval, bM as SubscriptionRevenueShare, bN as SubscriptionRevenueShareInput, bO as SubscriptionStatus, bP as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bQ as isRefundPendingApproval } from './types-BwgkJoM6.js';
3
3
 
4
4
  /**
5
5
  * The package version, as sent in the server User-Agent. A test pins this to
6
6
  * `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
7
7
  * Bump it with the changeset flow.
8
8
  */
9
- declare const SDK_VERSION = "3.19.0";
9
+ declare const SDK_VERSION = "3.20.0";
10
10
 
11
11
  interface VerifyWebhookOptions {
12
12
  /** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
@@ -1408,6 +1408,22 @@ declare class InvoServer {
1408
1408
  * client-side read, or `playerEmail` here server-side.
1409
1409
  */
1410
1410
  getPlayerBalance(query: PlayerBalanceQuery, opts?: CallOptions): Promise<PlayerBalanceResult>;
1411
+ /**
1412
+ * One player's loyalty cards, read by your SERVER with the game secret: the same cards
1413
+ * the player sees through `InvoClient.getMyRewards()`, for the player with this email in
1414
+ * your game. Each step carries `state` and `progress` (`{ current, target }`, or `null`
1415
+ * when the number could not be read this time: render `state` alone then). Rewards carry
1416
+ * their masked code only; a code is never returned here.
1417
+ *
1418
+ * Refusals (all `InvoError`): a blank email throws `INVALID_INPUT` before the network;
1419
+ * `400 INVALID_PLAYER_EMAIL` (`err.isInvalidPlayerEmail`), `401 INVALID_GAME_SECRET` for a missing or wrong key, or
1420
+ * a per-channel key (this read takes the game's server secret only), `404 PLAYER_NOT_FOUND`
1421
+ * (`err.isPlayerNotFound`: no player with this email in this game), `429` (back off;
1422
+ * `err.retryAfter`). Also `409 NO_TENANT` (the game is not set up for loyalty), `503`
1423
+ * (temporarily unavailable) and `502` / `504` (the loyalty service could not be reached or
1424
+ * timed out): retry later. A GET, so transient failures are retried automatically.
1425
+ */
1426
+ getPlayerRewards(playerEmail: string, opts?: CallOptions): Promise<LoyaltyCardsResult>;
1411
1427
  /**
1412
1428
  * List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
1413
1429
  * the source of truth for a "you have X to collect" badge. Pass the player's email
@@ -1619,4 +1635,4 @@ declare class InvoServer {
1619
1635
  private toInitiateResult;
1620
1636
  }
1621
1637
 
1622
- export { ApproveWithDeviceCodeInput, BeginDeviceApprovalInput, CallOptions, CancelResult, CancelSubscriptionOptions, CardSetupConfirmInput, CardSetupConfirmResult, CardSetupInput, CardSetupResult, CardSetupSessionInput, CardSetupSessionResult, CardsServer, ChangeAmountResult, ClaimCurrencyInput, ClaimResult, ClaimTransferInput, CompleteDeviceApprovalInput, CompleteDeviceApprovalResult, ConfirmDeviceEnrollmentInput, ConfirmDeviceEnrollmentResult, ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, CreateSubscriptionInput, CurrencyPurchaseQuote, CurrencyPurchaseQuoteInput, DestinationsResult, DeviceApprovalGrant, DeviceApprovalPollResult, DeviceApprovalSettleResult, GetSubscriptionOptions, GetSubscriptionResult, GuardianApprovalStatusResult, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, ListSubscriptionsOptions, OrderDetailsResult, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, SDK_VERSION, SandboxClockResult, SandboxFailureOutcome, SandboxForceAuthChallengeOptions, SandboxForceFailureOptions, SandboxServer, SandboxSubscriptionsServer, ServerConfig, ServerDestinationsQuery, SetPaymentMethodInput, SetPaymentMethodResult, SmsVerifyResult, SteamFinalizeInput, SteamFinalizeResult, SteamFinalizeSubscriptionResult, SteamInitPurchaseInput, SteamInitPurchaseResult, SteamInitResult, SteamPacksQuery, SteamPacksResult, SteamSubscriptionInitInput, type SubscriptionAuthenticationRequiredData, type SubscriptionCanceledData, type SubscriptionEventCommon, type SubscriptionExpiredData, SubscriptionListResult, type SubscriptionPastDueData, type SubscriptionPaymentFailedData, type SubscriptionRefundApprovedData, type SubscriptionRefundDetail, type SubscriptionRefundRejectedData, type SubscriptionRefundRequestData, type SubscriptionRefundedData, type SubscriptionRenewalFunding, type SubscriptionRenewalSplit, type SubscriptionRenewedData, SubscriptionResult, type SubscriptionRevenueShareAttribution, type SubscriptionTrialEventFields, SubscriptionsServer, TransactionStatusResult, type TransferEventData, type VerifyWebhookOptions, type WebhookHandlerOptions, createWebhookHandler, verifyWebhook, verifyWebhookAsync };
1638
+ export { ApproveWithDeviceCodeInput, BeginDeviceApprovalInput, CallOptions, CancelResult, CancelSubscriptionOptions, CardSetupConfirmInput, CardSetupConfirmResult, CardSetupInput, CardSetupResult, CardSetupSessionInput, CardSetupSessionResult, CardsServer, ChangeAmountResult, ClaimCurrencyInput, ClaimResult, ClaimTransferInput, CompleteDeviceApprovalInput, CompleteDeviceApprovalResult, ConfirmDeviceEnrollmentInput, ConfirmDeviceEnrollmentResult, ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, CreateSubscriptionInput, CurrencyPurchaseQuote, CurrencyPurchaseQuoteInput, DestinationsResult, DeviceApprovalGrant, DeviceApprovalPollResult, DeviceApprovalSettleResult, GetSubscriptionOptions, GetSubscriptionResult, GuardianApprovalStatusResult, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, ListSubscriptionsOptions, LoyaltyCardsResult, OrderDetailsResult, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, SDK_VERSION, SandboxClockResult, SandboxFailureOutcome, SandboxForceAuthChallengeOptions, SandboxForceFailureOptions, SandboxServer, SandboxSubscriptionsServer, ServerConfig, ServerDestinationsQuery, SetPaymentMethodInput, SetPaymentMethodResult, SmsVerifyResult, SteamFinalizeInput, SteamFinalizeResult, SteamFinalizeSubscriptionResult, SteamInitPurchaseInput, SteamInitPurchaseResult, SteamInitResult, SteamPacksQuery, SteamPacksResult, SteamSubscriptionInitInput, type SubscriptionAuthenticationRequiredData, type SubscriptionCanceledData, type SubscriptionEventCommon, type SubscriptionExpiredData, SubscriptionListResult, type SubscriptionPastDueData, type SubscriptionPaymentFailedData, type SubscriptionRefundApprovedData, type SubscriptionRefundDetail, type SubscriptionRefundRejectedData, type SubscriptionRefundRequestData, type SubscriptionRefundedData, type SubscriptionRenewalFunding, type SubscriptionRenewalSplit, type SubscriptionRenewedData, SubscriptionResult, type SubscriptionRevenueShareAttribution, type SubscriptionTrialEventFields, SubscriptionsServer, TransactionStatusResult, type TransferEventData, type VerifyWebhookOptions, type WebhookHandlerOptions, createWebhookHandler, verifyWebhook, verifyWebhookAsync };
package/dist/server.js CHANGED
@@ -1,9 +1,9 @@
1
- import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toDestinationsResult } from './chunk-YW2PYARQ.js';
2
- export { InvoError } from './chunk-YW2PYARQ.js';
1
+ import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toLoyaltyCardsResult, toDestinationsResult } from './chunk-6IY4473A.js';
2
+ export { InvoError } from './chunk-6IY4473A.js';
3
3
  import { createHmac, timingSafeEqual } from 'crypto';
4
4
 
5
5
  // src/version.ts
6
- var SDK_VERSION = "3.19.0";
6
+ var SDK_VERSION = "3.20.0";
7
7
 
8
8
  // src/shared/types.ts
9
9
  function isRefundPendingApproval(r) {
@@ -2459,6 +2459,32 @@ var InvoServer = class {
2459
2459
  raw
2460
2460
  };
2461
2461
  }
2462
+ /**
2463
+ * One player's loyalty cards, read by your SERVER with the game secret: the same cards
2464
+ * the player sees through `InvoClient.getMyRewards()`, for the player with this email in
2465
+ * your game. Each step carries `state` and `progress` (`{ current, target }`, or `null`
2466
+ * when the number could not be read this time: render `state` alone then). Rewards carry
2467
+ * their masked code only; a code is never returned here.
2468
+ *
2469
+ * Refusals (all `InvoError`): a blank email throws `INVALID_INPUT` before the network;
2470
+ * `400 INVALID_PLAYER_EMAIL` (`err.isInvalidPlayerEmail`), `401 INVALID_GAME_SECRET` for a missing or wrong key, or
2471
+ * a per-channel key (this read takes the game's server secret only), `404 PLAYER_NOT_FOUND`
2472
+ * (`err.isPlayerNotFound`: no player with this email in this game), `429` (back off;
2473
+ * `err.retryAfter`). Also `409 NO_TENANT` (the game is not set up for loyalty), `503`
2474
+ * (temporarily unavailable) and `502` / `504` (the loyalty service could not be reached or
2475
+ * timed out): retry later. A GET, so transient failures are retried automatically.
2476
+ */
2477
+ async getPlayerRewards(playerEmail, opts) {
2478
+ if (typeof playerEmail !== "string" || !playerEmail.trim()) {
2479
+ throw invalidInput("playerEmail", playerEmail, "is required");
2480
+ }
2481
+ const raw = await this.http.get(
2482
+ `/api/sdk/loyalty/players/rewards?player_email=${encodeURIComponent(playerEmail.trim())}`,
2483
+ this.auth,
2484
+ { signal: opts?.signal }
2485
+ );
2486
+ return toLoyaltyCardsResult(raw);
2487
+ }
2462
2488
  /**
2463
2489
  * List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
2464
2490
  * the source of truth for a "you have X to collect" badge. Pass the player's email