@invonetwork/web-sdk 3.20.0 → 3.21.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 +17 -0
- package/README.md +78 -14
- package/dist/{chunk-6IY4473A.js → chunk-7L4O5Q7K.js} +40 -3
- package/dist/index.cjs +49 -3
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +13 -4
- package/dist/server.cjs +156 -15
- package/dist/server.d.cts +48 -19
- package/dist/server.d.ts +48 -19
- package/dist/server.js +120 -16
- package/dist/{types-BwgkJoM6.d.cts → types-BXcPz6Xw.d.cts} +113 -1
- package/dist/{types-BwgkJoM6.d.ts → types-BXcPz6Xw.d.ts} +113 -1
- package/package.json +1 -1
package/dist/server.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { I as InvoError, H as Http,
|
|
2
|
-
export {
|
|
1
|
+
import { I as InvoError, H as Http, U as AuthHeader, X as CardSetupSessionInput, g as CallOptions, Y as CardSetupSessionResult, Z as CardSetupInput, _ as CardSetupResult, $ as CardSetupConfirmInput, a0 as CardSetupConfirmResult, a1 as PlayerCardsResult, a2 as PlatformPurchaseInput, a3 as PlatformPurchaseResult, a4 as PlatformOrderStatusResult, a5 as PlatformRefundInput, a6 as PlatformRefundResult, a7 as CreateSubscriptionInput, a8 as SubscriptionResult, a9 as GetSubscriptionOptions, aa as GetSubscriptionResult, ab as ListSubscriptionsOptions, ac as SubscriptionListResult, ad as CancelSubscriptionOptions, ae as CancelResult, af as ChangeAmountResult, ag as SetPaymentMethodInput, ah as SetPaymentMethodResult, ai as RefundSubscriptionInput, aj as RefundResult, ak as SteamSubscriptionInitInput, al as SteamInitResult, am as SteamFinalizeSubscriptionResult, an as SandboxClockResult, ao as SandboxFailureOutcome, ap as SandboxForceFailureOptions, aq as SandboxForceAuthChallengeOptions, ar as ServerConfig, as as MintPlayerTokenInput, at as PlayerToken, au as RegisterPlayerInput, av as RegisterPlayerResult, aw as UpdatePlayerPhoneInput, ax as UpdatePlayerPhoneResult, ay as InitiateSendInput, az as InitiateResult, aA as InitiateTransferInput, aB as CreateCheckoutInput, aC as CreateCheckoutResult, aD as PurchaseInput, aE as PurchaseResult, aF as CurrencyPurchaseQuoteInput, aG as CurrencyPurchaseQuote, aH as ConfirmPaymentResult, aI as OrderDetailsResult, aJ as SteamPacksQuery, aK as SteamPacksResult, aL as SteamInitPurchaseInput, aM as SteamInitPurchaseResult, aN as SteamFinalizeInput, aO as SteamFinalizeResult, aP as PurchaseItemInput, aQ as PurchaseItemResult, aR as ItemHistoryQuery, aS as ItemHistoryResult, aT as ItemOrderQuery, aU as PlayerBalanceQuery, aV as PlayerBalanceResult, l as LoyaltyCardsResult, aW as InboundPendingQuery, aX as InboundPendingResult, aY as LinkedIdentitiesQuery, aZ as LinkedIdentitiesResult, a_ as SmsVerifyResult, a$ as ClaimTransferInput, b0 as ClaimResult, b1 as ClaimCurrencyInput, b2 as TransactionStatusResult, b3 as GuardianApprovalStatusResult, b4 as ServerDestinationsQuery, k as DestinationsResult, b5 as PhoneShareContact, b6 as PhoneShareInitiateResult, b7 as PhoneShareApproveInput, b8 as PhoneShareApproveResult, b9 as PhoneShareStatusResult, ba as BeginDeviceApprovalInput, bb as DeviceApprovalGrant, bc as PollDeviceApprovalInput, bd as DeviceApprovalPollResult, be as ConfirmDeviceEnrollmentInput, bf as ConfirmDeviceEnrollmentResult, bg as ApproveWithDeviceCodeInput, bh as DeviceApprovalSettleResult, bi as CompleteDeviceApprovalInput, bj as CompleteDeviceApprovalResult } from './types-BXcPz6Xw.cjs';
|
|
2
|
+
export { bk as CardSetupStatus, bl as CheckoutWarning, t as ClaimDelivery, bm as CurrencyBalance, bn as CurrencyPurchaseQuoteBreakdown, u as DestinationGame, bo as DeviceApprovalChannel, bp as DeviceApprovalEnrollment, bq as DeviceApprovalFlow, br as DeviceApprovalPollStatus, bs as DeviceEnrollmentDecision, bt as DeviceEnrollmentRespond, bu as FeeTakenFrom, bv as FirstCharge, bw as FirstChargeStatus, bx as FundingSource, by as InboundPendingItem, v as InvoErrorInfo, w as InvoHooks, x as InvoRequestInfo, y as InvoResponseInfo, bz as LinkedIdentityEmail, z as LoyaltyCard, F as LoyaltyCardReward, G as LoyaltyCardStep, J as LoyaltyRewardState, K as LoyaltyStepProgress, N as LoyaltyStepState, bA as MinPurchaseWarning, bB as PlatformPurchaseStatus, T as Rail, bC as RefundInitiation, bD as RefundPendingApproval, bE as RefundProcessingFeeBasis, bF as RefundReceipt, bG as RefundRevenueShareAttribution, bH as RefundWarning, bI as SandboxClockState, bJ as SavedCard, bK as SteamPack, bL as SteamUserSession, bM as Subscription, bN as SubscriptionBaseInput, bO as SubscriptionConsent, bP as SubscriptionConsentInput, bQ as SubscriptionFundingRail, bR as SubscriptionInterval, bS as SubscriptionRevenueShare, bT as SubscriptionRevenueShareInput, bU as SubscriptionStatus, bV as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bW as isRefundPendingApproval } from './types-BXcPz6Xw.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.
|
|
9
|
+
declare const SDK_VERSION = "3.21.0";
|
|
10
10
|
|
|
11
11
|
interface VerifyWebhookOptions {
|
|
12
12
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -1216,21 +1216,48 @@ declare class InvoServer {
|
|
|
1216
1216
|
/**
|
|
1217
1217
|
* Mint a short-lived, game-scoped player token to hand to the browser InvoClient.
|
|
1218
1218
|
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
* network identity (which encodes the player's phone) is established when the player
|
|
1223
|
-
* is created and on the money-routing calls, so phone is NOT required or read here.
|
|
1219
|
+
* For a player who already exists in your game, this is a session mint: INVO looks the
|
|
1220
|
+
* player up by `playerEmail` and returns a token for their identity. `playerPhone` and
|
|
1221
|
+
* `playerName` do not change an existing player.
|
|
1224
1222
|
*
|
|
1225
|
-
*
|
|
1226
|
-
*
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1223
|
+
* For a player who is NOT in your game yet: without `playerPhone` INVO answers 404
|
|
1224
|
+
* (`err.isPlayerNotFound`); with `playerPhone` INVO creates the player and the result
|
|
1225
|
+
* carries `created: true`, so a first-time receiver can collect without buying first.
|
|
1226
|
+
* Use `registerPlayer` when you want creation to be explicit.
|
|
1227
|
+
*
|
|
1228
|
+
* `phoneMismatch: true` means the existing player has a different phone than the one
|
|
1229
|
+
* you passed; the token is still for that player and their phone is unchanged
|
|
1230
|
+
* (`updatePlayerPhone` changes it). A phone already held by another email is a 409
|
|
1231
|
+
* (`err.isPhoneShareRefused`).
|
|
1229
1232
|
*/
|
|
1230
|
-
mintPlayerToken(input:
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1233
|
+
mintPlayerToken(input: MintPlayerTokenInput, opts?: CallOptions): Promise<PlayerToken>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Create a player in your game without moving money (`POST /api/sdk/players`), so a
|
|
1236
|
+
* first-time receiver can collect in-game. Sends no message to the player.
|
|
1237
|
+
*
|
|
1238
|
+
* Returns `status: "created"` (new) or `"exists"` (already in your game with that
|
|
1239
|
+
* phone), with a player token when INVO can issue one. Refusals: 409
|
|
1240
|
+
* `err.isPhoneMismatch` (already in your game with a different phone; use
|
|
1241
|
+
* `updatePlayerPhone`), 409 `err.isPhoneShareRefused` (the phone belongs to another
|
|
1242
|
+
* email), 400 `INVALID_INPUT` / `INVALID_PHONE`, 429 (`err.retryAfter`).
|
|
1243
|
+
*/
|
|
1244
|
+
registerPlayer(input: RegisterPlayerInput, opts?: CallOptions): Promise<RegisterPlayerResult>;
|
|
1245
|
+
/**
|
|
1246
|
+
* Set a player's phone from your server (`POST /api/sdk/players/phone`). A phone change
|
|
1247
|
+
* can give the player a new INVO identity: `identityRekeyed: true`, and the result
|
|
1248
|
+
* carries a fresh `playerToken` for it (tokens minted before the change are then out
|
|
1249
|
+
* of date).
|
|
1250
|
+
*
|
|
1251
|
+
* Refusals: 409 `err.isPhoneChangeRequiresVerification` (the player has secured this
|
|
1252
|
+
* account, so the change needs the player's own confirmation; contact INVO support
|
|
1253
|
+
* meanwhile), 409 `err.isPhoneShareRefused` (the number belongs to another email),
|
|
1254
|
+
* 404 `err.isPlayerNotFound`, 400 `INVALID_INPUT` / `INVALID_PHONE`, 429
|
|
1255
|
+
* (`err.retryAfter`), 503 (could not be checked right now; try again shortly).
|
|
1256
|
+
*
|
|
1257
|
+
* Never auto-retried: a retry after a change that landed would answer `"unchanged"` and
|
|
1258
|
+
* hide `identityRekeyed`.
|
|
1259
|
+
*/
|
|
1260
|
+
updatePlayerPhone(input: UpdatePlayerPhoneInput, opts?: CallOptions): Promise<UpdatePlayerPhoneResult>;
|
|
1234
1261
|
/**
|
|
1235
1262
|
* Initiate a cross-game currency SEND. Inspect result.verificationMethod.
|
|
1236
1263
|
*
|
|
@@ -1591,8 +1618,10 @@ declare class InvoServer {
|
|
|
1591
1618
|
*
|
|
1592
1619
|
* Throws `InvoError`: `err.isDeviceApprovalNotApproved` (400 — wrong/foreign code,
|
|
1593
1620
|
* wrong flow, or the poll never said approved), `err.isPasskeyRecoveryCooldown` (403,
|
|
1594
|
-
* money-out after a passkey recovery — `err.retryAfterAt`),
|
|
1595
|
-
* (
|
|
1621
|
+
* money-out after a passkey recovery — `err.retryAfterAt`), `err.isPlayerTokenStale`
|
|
1622
|
+
* (403, the player token predates the sender's phone being added: re-mint, or use the
|
|
1623
|
+
* initiate's `playerToken`, and retry once), guardian terminal states (410). Never
|
|
1624
|
+
* auto-retried: the device_code is a single-use factor.
|
|
1596
1625
|
*
|
|
1597
1626
|
* **A FAILURE HERE IS AMBIGUOUS ABOUT THE MONEY.** The backend commits the transfer and
|
|
1598
1627
|
* *then* builds its 200 by reading the transaction back, so a fault raised after that
|
|
@@ -1635,4 +1664,4 @@ declare class InvoServer {
|
|
|
1635
1664
|
private toInitiateResult;
|
|
1636
1665
|
}
|
|
1637
1666
|
|
|
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 };
|
|
1667
|
+
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, MintPlayerTokenInput, 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, RegisterPlayerInput, RegisterPlayerResult, 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, UpdatePlayerPhoneInput, UpdatePlayerPhoneResult, 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,
|
|
2
|
-
export {
|
|
1
|
+
import { I as InvoError, H as Http, U as AuthHeader, X as CardSetupSessionInput, g as CallOptions, Y as CardSetupSessionResult, Z as CardSetupInput, _ as CardSetupResult, $ as CardSetupConfirmInput, a0 as CardSetupConfirmResult, a1 as PlayerCardsResult, a2 as PlatformPurchaseInput, a3 as PlatformPurchaseResult, a4 as PlatformOrderStatusResult, a5 as PlatformRefundInput, a6 as PlatformRefundResult, a7 as CreateSubscriptionInput, a8 as SubscriptionResult, a9 as GetSubscriptionOptions, aa as GetSubscriptionResult, ab as ListSubscriptionsOptions, ac as SubscriptionListResult, ad as CancelSubscriptionOptions, ae as CancelResult, af as ChangeAmountResult, ag as SetPaymentMethodInput, ah as SetPaymentMethodResult, ai as RefundSubscriptionInput, aj as RefundResult, ak as SteamSubscriptionInitInput, al as SteamInitResult, am as SteamFinalizeSubscriptionResult, an as SandboxClockResult, ao as SandboxFailureOutcome, ap as SandboxForceFailureOptions, aq as SandboxForceAuthChallengeOptions, ar as ServerConfig, as as MintPlayerTokenInput, at as PlayerToken, au as RegisterPlayerInput, av as RegisterPlayerResult, aw as UpdatePlayerPhoneInput, ax as UpdatePlayerPhoneResult, ay as InitiateSendInput, az as InitiateResult, aA as InitiateTransferInput, aB as CreateCheckoutInput, aC as CreateCheckoutResult, aD as PurchaseInput, aE as PurchaseResult, aF as CurrencyPurchaseQuoteInput, aG as CurrencyPurchaseQuote, aH as ConfirmPaymentResult, aI as OrderDetailsResult, aJ as SteamPacksQuery, aK as SteamPacksResult, aL as SteamInitPurchaseInput, aM as SteamInitPurchaseResult, aN as SteamFinalizeInput, aO as SteamFinalizeResult, aP as PurchaseItemInput, aQ as PurchaseItemResult, aR as ItemHistoryQuery, aS as ItemHistoryResult, aT as ItemOrderQuery, aU as PlayerBalanceQuery, aV as PlayerBalanceResult, l as LoyaltyCardsResult, aW as InboundPendingQuery, aX as InboundPendingResult, aY as LinkedIdentitiesQuery, aZ as LinkedIdentitiesResult, a_ as SmsVerifyResult, a$ as ClaimTransferInput, b0 as ClaimResult, b1 as ClaimCurrencyInput, b2 as TransactionStatusResult, b3 as GuardianApprovalStatusResult, b4 as ServerDestinationsQuery, k as DestinationsResult, b5 as PhoneShareContact, b6 as PhoneShareInitiateResult, b7 as PhoneShareApproveInput, b8 as PhoneShareApproveResult, b9 as PhoneShareStatusResult, ba as BeginDeviceApprovalInput, bb as DeviceApprovalGrant, bc as PollDeviceApprovalInput, bd as DeviceApprovalPollResult, be as ConfirmDeviceEnrollmentInput, bf as ConfirmDeviceEnrollmentResult, bg as ApproveWithDeviceCodeInput, bh as DeviceApprovalSettleResult, bi as CompleteDeviceApprovalInput, bj as CompleteDeviceApprovalResult } from './types-BXcPz6Xw.js';
|
|
2
|
+
export { bk as CardSetupStatus, bl as CheckoutWarning, t as ClaimDelivery, bm as CurrencyBalance, bn as CurrencyPurchaseQuoteBreakdown, u as DestinationGame, bo as DeviceApprovalChannel, bp as DeviceApprovalEnrollment, bq as DeviceApprovalFlow, br as DeviceApprovalPollStatus, bs as DeviceEnrollmentDecision, bt as DeviceEnrollmentRespond, bu as FeeTakenFrom, bv as FirstCharge, bw as FirstChargeStatus, bx as FundingSource, by as InboundPendingItem, v as InvoErrorInfo, w as InvoHooks, x as InvoRequestInfo, y as InvoResponseInfo, bz as LinkedIdentityEmail, z as LoyaltyCard, F as LoyaltyCardReward, G as LoyaltyCardStep, J as LoyaltyRewardState, K as LoyaltyStepProgress, N as LoyaltyStepState, bA as MinPurchaseWarning, bB as PlatformPurchaseStatus, T as Rail, bC as RefundInitiation, bD as RefundPendingApproval, bE as RefundProcessingFeeBasis, bF as RefundReceipt, bG as RefundRevenueShareAttribution, bH as RefundWarning, bI as SandboxClockState, bJ as SavedCard, bK as SteamPack, bL as SteamUserSession, bM as Subscription, bN as SubscriptionBaseInput, bO as SubscriptionConsent, bP as SubscriptionConsentInput, bQ as SubscriptionFundingRail, bR as SubscriptionInterval, bS as SubscriptionRevenueShare, bT as SubscriptionRevenueShareInput, bU as SubscriptionStatus, bV as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bW as isRefundPendingApproval } from './types-BXcPz6Xw.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.
|
|
9
|
+
declare const SDK_VERSION = "3.21.0";
|
|
10
10
|
|
|
11
11
|
interface VerifyWebhookOptions {
|
|
12
12
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -1216,21 +1216,48 @@ declare class InvoServer {
|
|
|
1216
1216
|
/**
|
|
1217
1217
|
* Mint a short-lived, game-scoped player token to hand to the browser InvoClient.
|
|
1218
1218
|
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
* network identity (which encodes the player's phone) is established when the player
|
|
1223
|
-
* is created and on the money-routing calls, so phone is NOT required or read here.
|
|
1219
|
+
* For a player who already exists in your game, this is a session mint: INVO looks the
|
|
1220
|
+
* player up by `playerEmail` and returns a token for their identity. `playerPhone` and
|
|
1221
|
+
* `playerName` do not change an existing player.
|
|
1224
1222
|
*
|
|
1225
|
-
*
|
|
1226
|
-
*
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1223
|
+
* For a player who is NOT in your game yet: without `playerPhone` INVO answers 404
|
|
1224
|
+
* (`err.isPlayerNotFound`); with `playerPhone` INVO creates the player and the result
|
|
1225
|
+
* carries `created: true`, so a first-time receiver can collect without buying first.
|
|
1226
|
+
* Use `registerPlayer` when you want creation to be explicit.
|
|
1227
|
+
*
|
|
1228
|
+
* `phoneMismatch: true` means the existing player has a different phone than the one
|
|
1229
|
+
* you passed; the token is still for that player and their phone is unchanged
|
|
1230
|
+
* (`updatePlayerPhone` changes it). A phone already held by another email is a 409
|
|
1231
|
+
* (`err.isPhoneShareRefused`).
|
|
1229
1232
|
*/
|
|
1230
|
-
mintPlayerToken(input:
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1233
|
+
mintPlayerToken(input: MintPlayerTokenInput, opts?: CallOptions): Promise<PlayerToken>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Create a player in your game without moving money (`POST /api/sdk/players`), so a
|
|
1236
|
+
* first-time receiver can collect in-game. Sends no message to the player.
|
|
1237
|
+
*
|
|
1238
|
+
* Returns `status: "created"` (new) or `"exists"` (already in your game with that
|
|
1239
|
+
* phone), with a player token when INVO can issue one. Refusals: 409
|
|
1240
|
+
* `err.isPhoneMismatch` (already in your game with a different phone; use
|
|
1241
|
+
* `updatePlayerPhone`), 409 `err.isPhoneShareRefused` (the phone belongs to another
|
|
1242
|
+
* email), 400 `INVALID_INPUT` / `INVALID_PHONE`, 429 (`err.retryAfter`).
|
|
1243
|
+
*/
|
|
1244
|
+
registerPlayer(input: RegisterPlayerInput, opts?: CallOptions): Promise<RegisterPlayerResult>;
|
|
1245
|
+
/**
|
|
1246
|
+
* Set a player's phone from your server (`POST /api/sdk/players/phone`). A phone change
|
|
1247
|
+
* can give the player a new INVO identity: `identityRekeyed: true`, and the result
|
|
1248
|
+
* carries a fresh `playerToken` for it (tokens minted before the change are then out
|
|
1249
|
+
* of date).
|
|
1250
|
+
*
|
|
1251
|
+
* Refusals: 409 `err.isPhoneChangeRequiresVerification` (the player has secured this
|
|
1252
|
+
* account, so the change needs the player's own confirmation; contact INVO support
|
|
1253
|
+
* meanwhile), 409 `err.isPhoneShareRefused` (the number belongs to another email),
|
|
1254
|
+
* 404 `err.isPlayerNotFound`, 400 `INVALID_INPUT` / `INVALID_PHONE`, 429
|
|
1255
|
+
* (`err.retryAfter`), 503 (could not be checked right now; try again shortly).
|
|
1256
|
+
*
|
|
1257
|
+
* Never auto-retried: a retry after a change that landed would answer `"unchanged"` and
|
|
1258
|
+
* hide `identityRekeyed`.
|
|
1259
|
+
*/
|
|
1260
|
+
updatePlayerPhone(input: UpdatePlayerPhoneInput, opts?: CallOptions): Promise<UpdatePlayerPhoneResult>;
|
|
1234
1261
|
/**
|
|
1235
1262
|
* Initiate a cross-game currency SEND. Inspect result.verificationMethod.
|
|
1236
1263
|
*
|
|
@@ -1591,8 +1618,10 @@ declare class InvoServer {
|
|
|
1591
1618
|
*
|
|
1592
1619
|
* Throws `InvoError`: `err.isDeviceApprovalNotApproved` (400 — wrong/foreign code,
|
|
1593
1620
|
* wrong flow, or the poll never said approved), `err.isPasskeyRecoveryCooldown` (403,
|
|
1594
|
-
* money-out after a passkey recovery — `err.retryAfterAt`),
|
|
1595
|
-
* (
|
|
1621
|
+
* money-out after a passkey recovery — `err.retryAfterAt`), `err.isPlayerTokenStale`
|
|
1622
|
+
* (403, the player token predates the sender's phone being added: re-mint, or use the
|
|
1623
|
+
* initiate's `playerToken`, and retry once), guardian terminal states (410). Never
|
|
1624
|
+
* auto-retried: the device_code is a single-use factor.
|
|
1596
1625
|
*
|
|
1597
1626
|
* **A FAILURE HERE IS AMBIGUOUS ABOUT THE MONEY.** The backend commits the transfer and
|
|
1598
1627
|
* *then* builds its 200 by reading the transaction back, so a fault raised after that
|
|
@@ -1635,4 +1664,4 @@ declare class InvoServer {
|
|
|
1635
1664
|
private toInitiateResult;
|
|
1636
1665
|
}
|
|
1637
1666
|
|
|
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 };
|
|
1667
|
+
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, MintPlayerTokenInput, 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, RegisterPlayerInput, RegisterPlayerResult, 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, UpdatePlayerPhoneInput, UpdatePlayerPhoneResult, type VerifyWebhookOptions, type WebhookHandlerOptions, createWebhookHandler, verifyWebhook, verifyWebhookAsync };
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toLoyaltyCardsResult, toDestinationsResult } from './chunk-
|
|
2
|
-
export { InvoError } from './chunk-
|
|
1
|
+
import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toLoyaltyCardsResult, toDestinationsResult } from './chunk-7L4O5Q7K.js';
|
|
2
|
+
export { InvoError } from './chunk-7L4O5Q7K.js';
|
|
3
3
|
import { createHmac, timingSafeEqual } from 'crypto';
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
6
|
-
var SDK_VERSION = "3.
|
|
6
|
+
var SDK_VERSION = "3.21.0";
|
|
7
7
|
|
|
8
8
|
// src/shared/types.ts
|
|
9
9
|
function isRefundPendingApproval(r) {
|
|
@@ -558,6 +558,16 @@ function toCurrencyBalance(row) {
|
|
|
558
558
|
raw: row
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
|
+
function playerTokenFields(raw) {
|
|
562
|
+
const out = {};
|
|
563
|
+
if (typeof raw["player_token"] === "string" && raw["player_token"]) {
|
|
564
|
+
out.playerToken = raw["player_token"];
|
|
565
|
+
if (typeof raw["player_token_expires_at"] === "string") {
|
|
566
|
+
out.playerTokenExpiresAt = raw["player_token_expires_at"];
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return out;
|
|
570
|
+
}
|
|
561
571
|
function requireField(value, field, raw) {
|
|
562
572
|
const s = value == null ? "" : String(value);
|
|
563
573
|
if (!s) {
|
|
@@ -1855,16 +1865,19 @@ var InvoServer = class {
|
|
|
1855
1865
|
/**
|
|
1856
1866
|
* Mint a short-lived, game-scoped player token to hand to the browser InvoClient.
|
|
1857
1867
|
*
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
1860
|
-
*
|
|
1861
|
-
*
|
|
1862
|
-
*
|
|
1868
|
+
* For a player who already exists in your game, this is a session mint: INVO looks the
|
|
1869
|
+
* player up by `playerEmail` and returns a token for their identity. `playerPhone` and
|
|
1870
|
+
* `playerName` do not change an existing player.
|
|
1871
|
+
*
|
|
1872
|
+
* For a player who is NOT in your game yet: without `playerPhone` INVO answers 404
|
|
1873
|
+
* (`err.isPlayerNotFound`); with `playerPhone` INVO creates the player and the result
|
|
1874
|
+
* carries `created: true`, so a first-time receiver can collect without buying first.
|
|
1875
|
+
* Use `registerPlayer` when you want creation to be explicit.
|
|
1863
1876
|
*
|
|
1864
|
-
* `
|
|
1865
|
-
*
|
|
1866
|
-
*
|
|
1867
|
-
*
|
|
1877
|
+
* `phoneMismatch: true` means the existing player has a different phone than the one
|
|
1878
|
+
* you passed; the token is still for that player and their phone is unchanged
|
|
1879
|
+
* (`updatePlayerPhone` changes it). A phone already held by another email is a 409
|
|
1880
|
+
* (`err.isPhoneShareRefused`).
|
|
1868
1881
|
*/
|
|
1869
1882
|
async mintPlayerToken(input, opts) {
|
|
1870
1883
|
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
@@ -1875,18 +1888,103 @@ var InvoServer = class {
|
|
|
1875
1888
|
assertE164(input.playerPhone, "playerPhone");
|
|
1876
1889
|
body["player_phone"] = input.playerPhone;
|
|
1877
1890
|
}
|
|
1891
|
+
if (input.playerName !== void 0) {
|
|
1892
|
+
if (typeof input.playerName !== "string") {
|
|
1893
|
+
throw invalidInput("playerName", input.playerName, "must be a string");
|
|
1894
|
+
}
|
|
1895
|
+
body["player_name"] = input.playerName;
|
|
1896
|
+
}
|
|
1878
1897
|
const raw = await this.http.post(
|
|
1879
1898
|
"/api/sdk/player-token",
|
|
1880
1899
|
body,
|
|
1881
1900
|
this.auth,
|
|
1901
|
+
// Safe to retry: a re-mint issues a fresh token, and a create that already happened
|
|
1902
|
+
// answers the retry for the existing player.
|
|
1882
1903
|
{ idempotent: true, signal: opts?.signal }
|
|
1883
|
-
// safe to retry: re-mint just issues a fresh token
|
|
1884
1904
|
);
|
|
1885
|
-
|
|
1905
|
+
const out = {
|
|
1886
1906
|
token: requireField(raw["token"], "token", raw),
|
|
1887
1907
|
expiresAt: String(raw["expires_at"] ?? ""),
|
|
1888
1908
|
identityId: String(raw["identity_id"] ?? "")
|
|
1889
1909
|
};
|
|
1910
|
+
if (raw["created"] === true) out.created = true;
|
|
1911
|
+
if (raw["phone_mismatch"] === true) out.phoneMismatch = true;
|
|
1912
|
+
return out;
|
|
1913
|
+
}
|
|
1914
|
+
/**
|
|
1915
|
+
* Create a player in your game without moving money (`POST /api/sdk/players`), so a
|
|
1916
|
+
* first-time receiver can collect in-game. Sends no message to the player.
|
|
1917
|
+
*
|
|
1918
|
+
* Returns `status: "created"` (new) or `"exists"` (already in your game with that
|
|
1919
|
+
* phone), with a player token when INVO can issue one. Refusals: 409
|
|
1920
|
+
* `err.isPhoneMismatch` (already in your game with a different phone; use
|
|
1921
|
+
* `updatePlayerPhone`), 409 `err.isPhoneShareRefused` (the phone belongs to another
|
|
1922
|
+
* email), 400 `INVALID_INPUT` / `INVALID_PHONE`, 429 (`err.retryAfter`).
|
|
1923
|
+
*/
|
|
1924
|
+
async registerPlayer(input, opts) {
|
|
1925
|
+
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
1926
|
+
throw invalidInput("playerEmail", input.playerEmail, "is required");
|
|
1927
|
+
}
|
|
1928
|
+
assertE164(input.playerPhone, "playerPhone");
|
|
1929
|
+
const body = {
|
|
1930
|
+
player_email: input.playerEmail,
|
|
1931
|
+
player_phone: input.playerPhone
|
|
1932
|
+
};
|
|
1933
|
+
if (input.playerName !== void 0) {
|
|
1934
|
+
if (typeof input.playerName !== "string") {
|
|
1935
|
+
throw invalidInput("playerName", input.playerName, "must be a string");
|
|
1936
|
+
}
|
|
1937
|
+
body["player_name"] = input.playerName;
|
|
1938
|
+
}
|
|
1939
|
+
const raw = await this.http.post(
|
|
1940
|
+
"/api/sdk/players",
|
|
1941
|
+
body,
|
|
1942
|
+
this.auth,
|
|
1943
|
+
// Find-or-create, no money: a retry after a create answers "exists".
|
|
1944
|
+
{ idempotent: true, signal: opts?.signal }
|
|
1945
|
+
);
|
|
1946
|
+
const status = requireField(raw["status"], "status", raw);
|
|
1947
|
+
return {
|
|
1948
|
+
status: status === "created" ? "created" : "exists",
|
|
1949
|
+
identityId: String(raw["identity_id"] ?? ""),
|
|
1950
|
+
...playerTokenFields(raw),
|
|
1951
|
+
raw
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Set a player's phone from your server (`POST /api/sdk/players/phone`). A phone change
|
|
1956
|
+
* can give the player a new INVO identity: `identityRekeyed: true`, and the result
|
|
1957
|
+
* carries a fresh `playerToken` for it (tokens minted before the change are then out
|
|
1958
|
+
* of date).
|
|
1959
|
+
*
|
|
1960
|
+
* Refusals: 409 `err.isPhoneChangeRequiresVerification` (the player has secured this
|
|
1961
|
+
* account, so the change needs the player's own confirmation; contact INVO support
|
|
1962
|
+
* meanwhile), 409 `err.isPhoneShareRefused` (the number belongs to another email),
|
|
1963
|
+
* 404 `err.isPlayerNotFound`, 400 `INVALID_INPUT` / `INVALID_PHONE`, 429
|
|
1964
|
+
* (`err.retryAfter`), 503 (could not be checked right now; try again shortly).
|
|
1965
|
+
*
|
|
1966
|
+
* Never auto-retried: a retry after a change that landed would answer `"unchanged"` and
|
|
1967
|
+
* hide `identityRekeyed`.
|
|
1968
|
+
*/
|
|
1969
|
+
async updatePlayerPhone(input, opts) {
|
|
1970
|
+
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
1971
|
+
throw invalidInput("playerEmail", input.playerEmail, "is required");
|
|
1972
|
+
}
|
|
1973
|
+
assertE164(input.newPhone, "newPhone");
|
|
1974
|
+
const raw = await this.http.post(
|
|
1975
|
+
"/api/sdk/players/phone",
|
|
1976
|
+
{ player_email: input.playerEmail, new_phone: input.newPhone },
|
|
1977
|
+
this.auth,
|
|
1978
|
+
{ signal: opts?.signal }
|
|
1979
|
+
);
|
|
1980
|
+
const status = requireField(raw["status"], "status", raw);
|
|
1981
|
+
return {
|
|
1982
|
+
status: status === "updated" ? "updated" : "unchanged",
|
|
1983
|
+
identityRekeyed: raw["identity_rekeyed"] === true,
|
|
1984
|
+
identityId: String(raw["identity_id"] ?? ""),
|
|
1985
|
+
...playerTokenFields(raw),
|
|
1986
|
+
raw
|
|
1987
|
+
};
|
|
1890
1988
|
}
|
|
1891
1989
|
/**
|
|
1892
1990
|
* Initiate a cross-game currency SEND. Inspect result.verificationMethod.
|
|
@@ -2934,8 +3032,10 @@ var InvoServer = class {
|
|
|
2934
3032
|
*
|
|
2935
3033
|
* Throws `InvoError`: `err.isDeviceApprovalNotApproved` (400 — wrong/foreign code,
|
|
2936
3034
|
* wrong flow, or the poll never said approved), `err.isPasskeyRecoveryCooldown` (403,
|
|
2937
|
-
* money-out after a passkey recovery — `err.retryAfterAt`),
|
|
2938
|
-
* (
|
|
3035
|
+
* money-out after a passkey recovery — `err.retryAfterAt`), `err.isPlayerTokenStale`
|
|
3036
|
+
* (403, the player token predates the sender's phone being added: re-mint, or use the
|
|
3037
|
+
* initiate's `playerToken`, and retry once), guardian terminal states (410). Never
|
|
3038
|
+
* auto-retried: the device_code is a single-use factor.
|
|
2939
3039
|
*
|
|
2940
3040
|
* **A FAILURE HERE IS AMBIGUOUS ABOUT THE MONEY.** The backend commits the transfer and
|
|
2941
3041
|
* *then* builds its 200 by reading the transaction back, so a fault raised after that
|
|
@@ -3092,6 +3192,10 @@ var InvoServer = class {
|
|
|
3092
3192
|
transactionId: String(raw["transaction_id"] ?? ""),
|
|
3093
3193
|
verificationMethod: guardian ? void 0 : vm === "in_app" || vm === "sms" ? vm : void 0,
|
|
3094
3194
|
guardianApproval: guardian ?? void 0,
|
|
3195
|
+
...raw["identity_rekeyed"] === true ? { identityRekeyed: true } : {},
|
|
3196
|
+
...playerTokenFields(raw),
|
|
3197
|
+
...typeof raw["identity_id"] === "string" && raw["identity_id"] ? { identityId: raw["identity_id"] } : {},
|
|
3198
|
+
...typeof raw["claim_delivery_planned"] === "string" && raw["claim_delivery_planned"] ? { claimDeliveryPlanned: raw["claim_delivery_planned"] } : {},
|
|
3095
3199
|
raw
|
|
3096
3200
|
};
|
|
3097
3201
|
}
|
|
@@ -620,6 +620,33 @@ declare class InvoError extends Error {
|
|
|
620
620
|
* `getPlayerRewards` answers it when no player has that email in this game.
|
|
621
621
|
*/
|
|
622
622
|
get isPlayerNotFound(): boolean;
|
|
623
|
+
/**
|
|
624
|
+
* True when an approve was refused because the player token predates a change to the
|
|
625
|
+
* sender's identity (`PLAYER_TOKEN_STALE`, 403): their phone was added (for example on
|
|
626
|
+
* the initiate), which gives them a new identity. Nothing moved and the token stays
|
|
627
|
+
* refused. Re-mint the player token (or use the `playerToken` from the initiate result)
|
|
628
|
+
* and retry once. The SDK never retries a money call on its own.
|
|
629
|
+
*/
|
|
630
|
+
get isPlayerTokenStale(): boolean;
|
|
631
|
+
/**
|
|
632
|
+
* True when `updatePlayerPhone` was refused because the player has secured this account,
|
|
633
|
+
* so the change needs the player's own confirmation (`PHONE_CHANGE_REQUIRES_VERIFICATION`,
|
|
634
|
+
* 409). Nothing changed. Until that confirmation flow is available, contact INVO support.
|
|
635
|
+
*/
|
|
636
|
+
get isPhoneChangeRequiresVerification(): boolean;
|
|
637
|
+
/**
|
|
638
|
+
* True when `registerPlayer` found the player already in your game with a DIFFERENT
|
|
639
|
+
* phone (`PHONE_MISMATCH`, 409). Nothing changed; use `updatePlayerPhone` to change it.
|
|
640
|
+
* (`mintPlayerToken` reports the same situation as `phoneMismatch: true` on success.)
|
|
641
|
+
*/
|
|
642
|
+
get isPhoneMismatch(): boolean;
|
|
643
|
+
/**
|
|
644
|
+
* True when the phone you supplied belongs to another email
|
|
645
|
+
* (`PHONE_SHARE_APPROVAL_REQUIRED`, 409) on `mintPlayerToken`, `registerPlayer` or
|
|
646
|
+
* `updatePlayerPhone`. Nothing was created or changed. The same condition as
|
|
647
|
+
* {@link isPhoneShareApprovalRequired}, named for these registration calls.
|
|
648
|
+
*/
|
|
649
|
+
get isPhoneShareRefused(): boolean;
|
|
623
650
|
/**
|
|
624
651
|
* True when `cards.createSetupSession` was asked to create a new member (`playerName`
|
|
625
652
|
* sent) and INVO could not create them (`PLAYER_CREATE_FAILED`, 503). Nothing was
|
|
@@ -831,7 +858,76 @@ interface PlayerToken {
|
|
|
831
858
|
token: string;
|
|
832
859
|
expiresAt: string;
|
|
833
860
|
identityId: string;
|
|
861
|
+
/**
|
|
862
|
+
* `true` when this call CREATED the player in your game (you passed `playerPhone` and
|
|
863
|
+
* no player with `playerEmail` existed). Absent otherwise.
|
|
864
|
+
*/
|
|
865
|
+
created?: boolean;
|
|
866
|
+
/**
|
|
867
|
+
* `true` when the player already exists in your game with a DIFFERENT phone than the
|
|
868
|
+
* `playerPhone` you passed. The token is still minted for the existing player and their
|
|
869
|
+
* phone is NOT changed; use `updatePlayerPhone` to change it. Absent otherwise.
|
|
870
|
+
*/
|
|
871
|
+
phoneMismatch?: boolean;
|
|
872
|
+
}
|
|
873
|
+
/** Input to `InvoServer.mintPlayerToken`. */
|
|
874
|
+
interface MintPlayerTokenInput {
|
|
875
|
+
playerEmail: string;
|
|
876
|
+
/**
|
|
877
|
+
* Optional, E.164. When the player is not in your game yet, passing it CREATES the
|
|
878
|
+
* player (so a first-time receiver can collect without buying first). An existing
|
|
879
|
+
* player's phone is never changed here. Without it, an unknown player is a 404.
|
|
880
|
+
*/
|
|
881
|
+
playerPhone?: string;
|
|
882
|
+
/** Optional display name, used only when the player is created. */
|
|
883
|
+
playerName?: string;
|
|
884
|
+
}
|
|
885
|
+
/** Input to `InvoServer.registerPlayer`. */
|
|
886
|
+
interface RegisterPlayerInput {
|
|
887
|
+
playerEmail: string;
|
|
888
|
+
/** Required, E.164. */
|
|
889
|
+
playerPhone: string;
|
|
890
|
+
/** Optional display name for the new player. */
|
|
891
|
+
playerName?: string;
|
|
892
|
+
}
|
|
893
|
+
/** Result of `InvoServer.registerPlayer`. */
|
|
894
|
+
interface RegisterPlayerResult {
|
|
895
|
+
/** `"created"` (HTTP 201) or `"exists"` (HTTP 200, already in your game with that phone). */
|
|
896
|
+
status: "created" | "exists";
|
|
897
|
+
identityId: string;
|
|
898
|
+
/** A player token for this player, when INVO can issue one for your game. */
|
|
899
|
+
playerToken?: string;
|
|
900
|
+
playerTokenExpiresAt?: string;
|
|
901
|
+
raw: Record<string, unknown>;
|
|
902
|
+
}
|
|
903
|
+
/** Input to `InvoServer.updatePlayerPhone`. */
|
|
904
|
+
interface UpdatePlayerPhoneInput {
|
|
905
|
+
playerEmail: string;
|
|
906
|
+
/** The player's new phone, E.164. */
|
|
907
|
+
newPhone: string;
|
|
834
908
|
}
|
|
909
|
+
/** Result of `InvoServer.updatePlayerPhone`. */
|
|
910
|
+
interface UpdatePlayerPhoneResult {
|
|
911
|
+
/** `"updated"`, or `"unchanged"` when the player already has that phone. */
|
|
912
|
+
status: "updated" | "unchanged";
|
|
913
|
+
/**
|
|
914
|
+
* `true` when the change gave the player a new INVO identity. Any player token minted
|
|
915
|
+
* before this call is then out of date: use `playerToken` below (or mint a new one).
|
|
916
|
+
*/
|
|
917
|
+
identityRekeyed: boolean;
|
|
918
|
+
identityId: string;
|
|
919
|
+
/** A player token for the player's current identity, when INVO can issue one for your game. */
|
|
920
|
+
playerToken?: string;
|
|
921
|
+
playerTokenExpiresAt?: string;
|
|
922
|
+
raw: Record<string, unknown>;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* How INVO will deliver (initiate: `claimDeliveryPlanned`) or delivered (approve:
|
|
926
|
+
* `claimDelivery`) the claim link or code: `"email"`, `"none"` (nothing is sent), or
|
|
927
|
+
* `"sms"` (legacy, only when no email is on file). Typed as `string` so a value added
|
|
928
|
+
* later is passed through rather than dropped.
|
|
929
|
+
*/
|
|
930
|
+
type ClaimDelivery = "email" | "none" | "sms" | (string & {});
|
|
835
931
|
interface InitiateSendInput {
|
|
836
932
|
clientRequestId: string;
|
|
837
933
|
senderPlayerName: string;
|
|
@@ -869,6 +965,20 @@ interface InitiateResult {
|
|
|
869
965
|
verificationMethod: VerificationMethod | undefined;
|
|
870
966
|
/** Present on the minor/guardian path (HTTP 202): the backend's guardian_approval block. */
|
|
871
967
|
guardianApproval?: unknown;
|
|
968
|
+
/**
|
|
969
|
+
* `true` when THIS initiate gave the sender a new INVO identity (for example their phone
|
|
970
|
+
* was added to an email-only player). A player token minted before the initiate is then
|
|
971
|
+
* out of date and approve refuses it (`err.isPlayerTokenStale`). Hand the browser
|
|
972
|
+
* `playerToken` below before it approves. Absent when the identity did not change.
|
|
973
|
+
*/
|
|
974
|
+
identityRekeyed?: boolean;
|
|
975
|
+
/** A fresh player token for the sender's new identity; present only with `identityRekeyed`. */
|
|
976
|
+
playerToken?: string;
|
|
977
|
+
playerTokenExpiresAt?: string;
|
|
978
|
+
/** The sender's identity id after the re-key; present only with `identityRekeyed`. */
|
|
979
|
+
identityId?: string;
|
|
980
|
+
/** How the claim link or code will be delivered. See {@link ClaimDelivery}. */
|
|
981
|
+
claimDeliveryPlanned?: ClaimDelivery;
|
|
872
982
|
/** Full raw backend body (fees preview, order id, new balance, guardian block, …). */
|
|
873
983
|
raw: Record<string, unknown>;
|
|
874
984
|
}
|
|
@@ -1642,6 +1752,8 @@ interface ApproveResult {
|
|
|
1642
1752
|
guardianApproval?: unknown;
|
|
1643
1753
|
/** Poll endpoint for guardian status (transfer holds only). */
|
|
1644
1754
|
pollEndpoint?: string;
|
|
1755
|
+
/** How the claim link or code was delivered, on success. See {@link ClaimDelivery}. */
|
|
1756
|
+
claimDelivery?: ClaimDelivery;
|
|
1645
1757
|
raw: Record<string, unknown>;
|
|
1646
1758
|
}
|
|
1647
1759
|
interface ConfirmReceiptResult {
|
|
@@ -3245,4 +3357,4 @@ interface RewardsPageLink {
|
|
|
3245
3357
|
raw: Record<string, unknown>;
|
|
3246
3358
|
}
|
|
3247
3359
|
|
|
3248
|
-
export { type
|
|
3360
|
+
export { type CardSetupConfirmInput as $, type ApproveResult as A, type BalanceResult as B, type ConfirmReceiptResult as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type LoyaltyCardReward as F, type LoyaltyCardStep as G, Http as H, InvoError as I, type LoyaltyRewardState as J, type LoyaltyStepProgress as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type LoyaltyStepState as N, type LoyaltyVaultEntry as O, type PurchaseStatusResult as P, type PendingCollectItem as Q, type RedeemRewardResult as R, type PurchaseRefusalReason as S, type Rail as T, type AuthHeader as U, type VerificationMethod as V, type WaitForPurchaseInput as W, type CardSetupSessionInput as X, type CardSetupSessionResult as Y, type CardSetupInput as Z, type CardSetupResult as _, type PurchaseCredited as a, type ClaimTransferInput as a$, type CardSetupConfirmResult as a0, type PlayerCardsResult as a1, type PlatformPurchaseInput as a2, type PlatformPurchaseResult as a3, type PlatformOrderStatusResult as a4, type PlatformRefundInput as a5, type PlatformRefundResult as a6, type CreateSubscriptionInput as a7, type SubscriptionResult as a8, type GetSubscriptionOptions as a9, type InitiateTransferInput as aA, type CreateCheckoutInput as aB, type CreateCheckoutResult as aC, type PurchaseInput as aD, type PurchaseResult as aE, type CurrencyPurchaseQuoteInput as aF, type CurrencyPurchaseQuote as aG, type ConfirmPaymentResult as aH, type OrderDetailsResult as aI, type SteamPacksQuery as aJ, type SteamPacksResult as aK, type SteamInitPurchaseInput as aL, type SteamInitPurchaseResult as aM, type SteamFinalizeInput as aN, type SteamFinalizeResult as aO, type PurchaseItemInput as aP, type PurchaseItemResult as aQ, type ItemHistoryQuery as aR, type ItemHistoryResult as aS, type ItemOrderQuery as aT, type PlayerBalanceQuery as aU, type PlayerBalanceResult as aV, type InboundPendingQuery as aW, type InboundPendingResult as aX, type LinkedIdentitiesQuery as aY, type LinkedIdentitiesResult as aZ, type SmsVerifyResult as a_, type GetSubscriptionResult as aa, type ListSubscriptionsOptions as ab, type SubscriptionListResult as ac, type CancelSubscriptionOptions as ad, type CancelResult as ae, type ChangeAmountResult as af, type SetPaymentMethodInput as ag, type SetPaymentMethodResult as ah, type RefundSubscriptionInput as ai, type RefundResult as aj, type SteamSubscriptionInitInput as ak, type SteamInitResult as al, type SteamFinalizeSubscriptionResult as am, type SandboxClockResult as an, type SandboxFailureOutcome as ao, type SandboxForceFailureOptions as ap, type SandboxForceAuthChallengeOptions as aq, type ServerConfig as ar, type MintPlayerTokenInput as as, type PlayerToken as at, type RegisterPlayerInput as au, type RegisterPlayerResult as av, type UpdatePlayerPhoneInput as aw, type UpdatePlayerPhoneResult as ax, type InitiateSendInput as ay, type InitiateResult as az, type PurchaseExpired as b, type ClaimResult as b0, type ClaimCurrencyInput as b1, type TransactionStatusResult as b2, type GuardianApprovalStatusResult as b3, type ServerDestinationsQuery as b4, type PhoneShareContact as b5, type PhoneShareInitiateResult as b6, type PhoneShareApproveInput as b7, type PhoneShareApproveResult as b8, type PhoneShareStatusResult as b9, type MinPurchaseWarning as bA, type PlatformPurchaseStatus as bB, type RefundInitiation as bC, type RefundPendingApproval as bD, type RefundProcessingFeeBasis as bE, type RefundReceipt as bF, type RefundRevenueShareAttribution as bG, type RefundWarning as bH, type SandboxClockState as bI, type SavedCard as bJ, type SteamPack as bK, type SteamUserSession as bL, type Subscription as bM, type SubscriptionBaseInput as bN, type SubscriptionConsent as bO, type SubscriptionConsentInput as bP, type SubscriptionFundingRail as bQ, type SubscriptionInterval as bR, type SubscriptionRevenueShare as bS, type SubscriptionRevenueShareInput as bT, type SubscriptionStatus as bU, type UnacknowledgedPurchaseOutcome as bV, isRefundPendingApproval as bW, type BeginDeviceApprovalInput as ba, type DeviceApprovalGrant as bb, type PollDeviceApprovalInput as bc, type DeviceApprovalPollResult as bd, type ConfirmDeviceEnrollmentInput as be, type ConfirmDeviceEnrollmentResult as bf, type ApproveWithDeviceCodeInput as bg, type DeviceApprovalSettleResult as bh, type CompleteDeviceApprovalInput as bi, type CompleteDeviceApprovalResult as bj, type CardSetupStatus as bk, type CheckoutWarning as bl, type CurrencyBalance as bm, type CurrencyPurchaseQuoteBreakdown as bn, type DeviceApprovalChannel as bo, type DeviceApprovalEnrollment as bp, type DeviceApprovalFlow as bq, type DeviceApprovalPollStatus as br, type DeviceEnrollmentDecision as bs, type DeviceEnrollmentRespond as bt, type FeeTakenFrom as bu, type FirstCharge as bv, type FirstChargeStatus as bw, type FundingSource as bx, type InboundPendingItem as by, type LinkedIdentityEmail as bz, type PurchaseRefunded as c, type PurchaseRefused as d, type CheckoutClientConfig as e, type PurchaseStatusInput as f, type CallOptions as g, type CheckoutMountHandle as h, type ClientConfig as i, type PendingCollectResult as j, type DestinationsResult as k, type LoyaltyCardsResult as l, type LoyaltyVaultResult as m, type RewardsPageLink as n, type EnrollmentVerifyResult as o, type RecoveryBeginResult as p, type RecoveryCompleteResult as q, type BalanceRow as r, type CheckoutPurchaseStatus as s, type ClaimDelivery as t, type DestinationGame as u, type InvoErrorInfo as v, type InvoHooks as w, type InvoRequestInfo as x, type InvoResponseInfo as y, type LoyaltyCard as z };
|