@invonetwork/web-sdk 3.37.0 → 3.38.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +49 -8
  3. package/dist/{chunk-AUHRMREF.js → chunk-3HK32FE4.js} +3 -3
  4. package/dist/{chunk-KWAUFFDY.js → chunk-7B7MFAQ3.js} +33 -5
  5. package/dist/chunk-MOHWLDOQ.js +6 -0
  6. package/dist/{chunk-ZHEQAZLW.js → chunk-NS33T5FB.js} +64 -15
  7. package/dist/game-server.cjs +99 -22
  8. package/dist/game-server.d.cts +4 -4
  9. package/dist/game-server.d.ts +4 -4
  10. package/dist/game-server.js +5 -5
  11. package/dist/game.cjs +32 -4
  12. package/dist/game.d.cts +3 -3
  13. package/dist/game.d.ts +3 -3
  14. package/dist/game.js +3 -3
  15. package/dist/{hosted-approval-DS9gcCF5.d.cts → hosted-approval-B-kbdFDL.d.cts} +1 -1
  16. package/dist/{hosted-approval-Dv462L4e.d.ts → hosted-approval-CtAZ1Rzt.d.ts} +1 -1
  17. package/dist/index.cjs +31 -3
  18. package/dist/index.d.cts +4 -4
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +2 -2
  21. package/dist/{server-B9PtYZaM.d.cts → server-BWGl9v5j.d.cts} +93 -13
  22. package/dist/{server-B7Pw1HMp.d.ts → server-CaaP-Nc3.d.ts} +93 -13
  23. package/dist/server.cjs +99 -22
  24. package/dist/server.d.cts +3 -3
  25. package/dist/server.d.ts +3 -3
  26. package/dist/server.js +3 -3
  27. package/dist/{types-BdKpJX93.d.cts → types-DGgWWX1v.d.cts} +89 -9
  28. package/dist/{types-BdKpJX93.d.ts → types-DGgWWX1v.d.ts} +89 -9
  29. package/dist/{version-CuhMO-6s.d.cts → version-D_cJUvMp.d.cts} +1 -1
  30. package/dist/{version-CuhMO-6s.d.ts → version-D_cJUvMp.d.ts} +1 -1
  31. package/docs/merchant-of-record-tax.md +176 -0
  32. package/package.json +2 -1
  33. package/dist/chunk-MENRG67H.js +0 -6
@@ -256,7 +256,11 @@ var InvoError = class _InvoError extends Error {
256
256
  * - registration/token-mint (phone already on another INVO account), and
257
257
  * - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
258
258
  * `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
259
- * so INVO holds the money and texts the phone owner to approve.
259
+ * so INVO holds the money and asks the phone owner to approve.
260
+ *
261
+ * Either way the 409 has already created an approval request and contacted the phone's
262
+ * existing owner: by email when INVO has verified their address, otherwise by a text code
263
+ * (the body's `consent_channel` says which).
260
264
  *
261
265
  * NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
262
266
  * `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
@@ -273,7 +277,8 @@ var InvoError = class _InvoError extends Error {
273
277
  const v = this.bodyObject()["approval_id"];
274
278
  return typeof v === "string" && v ? v : void 0;
275
279
  }
276
- /** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
280
+ /** Last 4 digits of the phone that must approve (`phone_last4`, a string such as `"4567"`),
281
+ * for the UI message. `undefined` when the body has none (an older server). */
277
282
  get phoneShareLast4() {
278
283
  const v = this.bodyObject()["phone_last4"];
279
284
  return typeof v === "string" && v ? v : void 0;
@@ -712,6 +717,26 @@ var InvoError = class _InvoError extends Error {
712
717
  const v = this.bodyObject()["untaxed_total_usd"];
713
718
  return typeof v === "string" && v ? v : void 0;
714
719
  }
720
+ /**
721
+ * Additive (3.38.0). True when a Merchant of Record card sale was refused because the buyer is in
722
+ * a country where INVO does not yet sell as Merchant of Record (`SALE_NOT_AVAILABLE_IN_COUNTRY`,
723
+ * 409; today the EU member states until January 1, 2027). NOTHING WAS CHARGED. The body carries
724
+ * `retryable: false`: do not retry, and do not ask for another card (the refusal follows where
725
+ * the buyer is). Show the message (`err.message`), for example "Purchases aren't available in
726
+ * your country yet. Nothing was charged." Returned by the quote, the purchase, hosted checkout
727
+ * and Platform Commerce card purchases. Branch on this, never on a country list.
728
+ * See https://docs.invo.network/docs/merchant-of-record-tax#sale-not-available
729
+ */
730
+ get isSaleNotAvailableInCountry() {
731
+ return this.code === "SALE_NOT_AVAILABLE_IN_COUNTRY";
732
+ }
733
+ /** On `SALE_NOT_AVAILABLE_IN_COUNTRY`: the buyer's country, ISO 3166-1 alpha-2 (`country`), or
734
+ * `undefined` when INVO did not know it. */
735
+ get unavailableCountry() {
736
+ if (!this.isSaleNotAvailableInCountry) return void 0;
737
+ const v = this.bodyObject()["country"];
738
+ return typeof v === "string" && v ? v : void 0;
739
+ }
715
740
  /**
716
741
  * True if a Platform Commerce refund targeted an order that was already refunded
717
742
  * (409). Idempotent outcome — the original refund did happen, so treat this as
@@ -1246,7 +1271,10 @@ var InvoError = class _InvoError extends Error {
1246
1271
  /**
1247
1272
  * True when the phone you supplied belongs to another email
1248
1273
  * (`PHONE_SHARE_APPROVAL_REQUIRED`, 409) on `mintPlayerToken`, `registerPlayer` or
1249
- * `updatePlayerPhone`. Nothing was created or changed. The same condition as
1274
+ * `updatePlayerPhone`. The phone may be held by a player in any game or by an INVO wallet
1275
+ * (including one created in the INVO app). No player was created or changed, but INVO has
1276
+ * created an approval request and asked the phone's owner to approve; retry the same call
1277
+ * once they have and it succeeds. The same condition as
1250
1278
  * {@link isPhoneShareApprovalRequired}, named for these registration calls.
1251
1279
  */
1252
1280
  get isPhoneShareRefused() {
@@ -1974,6 +2002,39 @@ function toReportGameEventResult(raw, eventId) {
1974
2002
  };
1975
2003
  }
1976
2004
 
2005
+ // src/shared/tax-fields.ts
2006
+ function str3(v) {
2007
+ return v == null ? void 0 : String(v);
2008
+ }
2009
+ function includedTaxFields(raw) {
2010
+ const out = {};
2011
+ if (typeof raw["tax_included"] === "boolean") out.taxIncluded = raw["tax_included"];
2012
+ const inc = str3(raw["tax_included_usd"]);
2013
+ if (inc !== void 0) out.taxIncludedUsd = inc;
2014
+ const display = str3(raw["tax_price_display"]);
2015
+ if (display !== void 0) out.taxPriceDisplay = display;
2016
+ const label = str3(raw["tax_label"]);
2017
+ if (label !== void 0) out.taxLabel = label;
2018
+ const line = str3(raw["tax_line"]);
2019
+ if (line !== void 0) out.taxLine = line;
2020
+ return out;
2021
+ }
2022
+ function includedTaxBreakdownFields(raw) {
2023
+ const out = includedTaxFields(raw);
2024
+ const added = str3(raw["tax_added_usd"]);
2025
+ if (added !== void 0) out.taxAddedUsd = added;
2026
+ return out;
2027
+ }
2028
+ function includedTaxPurchaseFields(raw) {
2029
+ const out = includedTaxFields(raw);
2030
+ if (out.taxIncluded !== true) return out;
2031
+ const tax = str3(raw["tax_usd"]);
2032
+ if (tax !== void 0) out.taxUsd = tax;
2033
+ if (Object.prototype.hasOwnProperty.call(raw, "tax_jurisdiction")) out.taxJurisdiction = str3(raw["tax_jurisdiction"]) ?? null;
2034
+ if (Object.prototype.hasOwnProperty.call(raw, "tax_rate_pct")) out.taxRatePct = str3(raw["tax_rate_pct"]) ?? null;
2035
+ return out;
2036
+ }
2037
+
1977
2038
  // src/shared/phone-change.ts
1978
2039
  function requireField(value, field, raw) {
1979
2040
  const s = value == null ? "" : String(value);
@@ -1987,16 +2048,16 @@ function requireField(value, field, raw) {
1987
2048
  }
1988
2049
  return s;
1989
2050
  }
1990
- var str3 = (v) => v == null ? "" : String(v);
2051
+ var str4 = (v) => v == null ? "" : String(v);
1991
2052
  var strOrNull2 = (v) => typeof v === "string" ? v : v == null ? null : String(v);
1992
2053
  function toRequestPhoneChangeResult(raw) {
1993
2054
  return {
1994
2055
  changeRequestId: requireField(raw["change_request_id"], "change_request_id", raw),
1995
2056
  status: requireField(raw["status"], "status", raw),
1996
- expiresAt: str3(raw["expires_at"]),
1997
- delivery: str3(raw["delivery"]),
1998
- confirmation: str3(raw["confirmation"]),
1999
- message: str3(raw["message"]),
2057
+ expiresAt: str4(raw["expires_at"]),
2058
+ delivery: str4(raw["delivery"]),
2059
+ confirmation: str4(raw["confirmation"]),
2060
+ message: str4(raw["message"]),
2000
2061
  raw
2001
2062
  };
2002
2063
  }
@@ -2004,8 +2065,8 @@ function toPhoneChangeRequest(raw) {
2004
2065
  return {
2005
2066
  changeRequestId: requireField(raw["change_request_id"], "change_request_id", raw),
2006
2067
  status: requireField(raw["status"], "status", raw),
2007
- confirmation: str3(raw["confirmation"]),
2008
- delivery: str3(raw["delivery"]),
2068
+ confirmation: str4(raw["confirmation"]),
2069
+ delivery: str4(raw["delivery"]),
2009
2070
  newPhoneMasked: strOrNull2(raw["new_phone_masked"]),
2010
2071
  createdAt: strOrNull2(raw["created_at"]),
2011
2072
  expiresAt: strOrNull2(raw["expires_at"]),
@@ -2016,7 +2077,7 @@ function toPhoneChangeRequest(raw) {
2016
2077
  }
2017
2078
 
2018
2079
  // src/version.ts
2019
- var SDK_VERSION = "3.37.0";
2080
+ var SDK_VERSION = "3.38.0";
2020
2081
 
2021
2082
  // src/payouts.ts
2022
2083
  var AMOUNT = /^\d+(\.\d{1,2})?$/;
@@ -2368,6 +2429,7 @@ function toQuoteBreakdown(row) {
2368
2429
  totalUsd: String(r["total_usd"] ?? ""),
2369
2430
  coins: String(r["coins"] ?? ""),
2370
2431
  currencyName: String(r["currency_name"] ?? ""),
2432
+ ...includedTaxBreakdownFields(r),
2371
2433
  raw: r
2372
2434
  };
2373
2435
  }
@@ -4263,11 +4325,16 @@ var InvoServer = class {
4263
4325
  * Create a player in your game without moving money (`POST /api/sdk/players`), so a
4264
4326
  * first-time receiver can collect in-game. Sends no message to the player.
4265
4327
  *
4266
- * Returns `status: "created"` (new) or `"exists"` (already in your game with that
4267
- * phone), with a player token when INVO can issue one. Refusals: 409
4268
- * `err.isPhoneMismatch` (already in your game with a different phone; use
4269
- * `updatePlayerPhone`), 409 `err.isPhoneShareRefused` (the phone belongs to another
4270
- * email), 400 `INVALID_INPUT` / `INVALID_PHONE`, 429 (`err.retryAfter`).
4328
+ * Returns `status: "created"` (201, new to your game) or `"exists"` (200, already in
4329
+ * your game with that phone), with a player token when INVO can issue one (the token
4330
+ * fields are omitted otherwise). "created" can mean joining an existing INVO wallet:
4331
+ * the same email and phone as a wallet the person already has, so `identityId` is the
4332
+ * same one other games see. Refusals: 409 `err.isPhoneMismatch` (already in your game
4333
+ * with a different phone; use `updatePlayerPhone`), 409 `err.isPhoneShareRefused` (the
4334
+ * phone is held under another email, by a player or an INVO wallet: INVO asks the
4335
+ * phone's owner to approve, and the same call succeeds once they have), 400
4336
+ * `INVALID_INPUT` / `INVALID_PHONE`, 429 (`err.retryAfter`), 503
4337
+ * `sdk_verification_disabled` (the SDK player routes are switched off).
4271
4338
  */
4272
4339
  async registerPlayer(input, opts) {
4273
4340
  if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
@@ -4586,6 +4653,7 @@ var InvoServer = class {
4586
4653
  chargeTotalUsd: optionalDecimalString(raw["charge_total_usd"]),
4587
4654
  ...pricingFields(raw),
4588
4655
  ...receiptFields(raw),
4656
+ ...includedTaxPurchaseFields(raw),
4589
4657
  raw
4590
4658
  };
4591
4659
  }
@@ -4606,8 +4674,14 @@ var InvoServer = class {
4606
4674
  * accepted. Card purchases only; purchases through a third-party storefront or payment
4607
4675
  * rail are unaffected.
4608
4676
  *
4677
+ * Merchant of Record: in the US tax is added on top (`totalUsd` above the price); outside the
4678
+ * US the price includes the tax, and `breakdown.taxIncluded` is `true` with
4679
+ * `breakdown.taxLine` ("Includes VAT 20% ($1.67)") to show under `totalUsd`.
4680
+ *
4609
4681
  * Refusals: `400 INVALID_INPUT` (amount missing, not above zero, or above INVO's card
4610
- * maximum), `400 CURRENCY_NOT_CONFIGURED`, `503 RATE_UNAVAILABLE`.
4682
+ * maximum), `400 CURRENCY_NOT_CONFIGURED`, `503 RATE_UNAVAILABLE`, and on Merchant of Record
4683
+ * `409 SALE_NOT_AVAILABLE_IN_COUNTRY` (`err.isSaleNotAvailableInCountry`) for a buyer in a
4684
+ * country where INVO does not yet sell as Merchant of Record.
4611
4685
  */
4612
4686
  async quoteCurrencyPurchase(input, opts) {
4613
4687
  assertUsdAmount(input.usdAmount);
@@ -5443,7 +5517,9 @@ var InvoServer = class {
5443
5517
  *
5444
5518
  * These three endpoints are UNAUTHENTICATED (phone-owner-driven: no game secret,
5445
5519
  * no player token) — a partner backend relays the handshake. The triggering 409
5446
- * carries `approval_id, expires_at, code_sent, existing_account_hints[], next_endpoint`.
5520
+ * carries `approval_id, expires_at, code_sent, existing_account_hints[], next_endpoint`,
5521
+ * `phone_last4` and `consent_channel` (`"email"` when the owner was emailed a link,
5522
+ * so there is no code to collect; `"sms"` when a text code went out).
5447
5523
  *
5448
5524
  * `phoneShareInitiate` is the fallback OTP send (use when the 409 didn't already
5449
5525
  * dispatch a code). NOT idempotent — never auto-retried. OTP TTL ~10 min.
@@ -5466,10 +5542,11 @@ var InvoServer = class {
5466
5542
  return toPhoneShareInitiateResult(raw);
5467
5543
  }
5468
5544
  /**
5469
- * Approve a phone-share with the OTP the phone owner received. On success the grant
5470
- * is stored server-side, keyed by (phone, requesting_email) and auto-consumed — the
5471
- * caller simply RE-ISSUES the identical original request. UNAUTHENTICATED. NOT
5472
- * idempotent (attempts are counted) — never auto-retried.
5545
+ * Approve a phone-share with the OTP the phone owner received. On success the approval
5546
+ * is stored server-side, keyed by (phone, requesting_email), permanently and
5547
+ * network-wide (there is no revoke) — the caller simply RE-ISSUES the identical
5548
+ * original request. UNAUTHENTICATED. NOT idempotent (attempts are counted) — never
5549
+ * auto-retried.
5473
5550
  */
5474
5551
  async phoneShareApprove(input, opts) {
5475
5552
  if (typeof input.approvalId !== "string" || !input.approvalId.trim()) {
@@ -1,9 +1,9 @@
1
- import { I as InvoServer, a as InvoEnvironment } from './server-B9PtYZaM.cjs';
2
- export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, K as KeyEnvironmentMismatchError, L as LIVE_KEY_PREFIX, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, T as TEST_KEY_PREFIX, b as baseUrlForKey, e as environmentForBaseUrl, c as environmentFromKeyPrefix, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-B9PtYZaM.cjs';
1
+ import { I as InvoServer, a as InvoEnvironment } from './server-BWGl9v5j.cjs';
2
+ export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, K as KeyEnvironmentMismatchError, L as LIVE_KEY_PREFIX, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, T as TEST_KEY_PREFIX, b as baseUrlForKey, e as environmentForBaseUrl, c as environmentFromKeyPrefix, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-BWGl9v5j.cjs';
3
3
  import { G as GameCurrencyKind, a as GamePurchaseStatus, b as GameEconomyConfig } from './types-jUxfYjiD.cjs';
4
4
  export { c as GameCatalog, d as GameCatalogItem, e as GameCheckout, f as GameCurrencyBalance, g as GameErrorBody, h as GameItemPurchase, i as GamePlayer, j as GamePremiumPack, k as GamePurchase, l as GameSession, m as GameTransferInput, n as GameTransferKind, o as GameTransferStart, p as GameTransferStatus, q as GameWallet } from './types-jUxfYjiD.cjs';
5
- export { I as InvoError } from './types-BdKpJX93.cjs';
6
- export { S as SDK_VERSION } from './version-CuhMO-6s.cjs';
5
+ export { I as InvoError } from './types-DGgWWX1v.cjs';
6
+ export { S as SDK_VERSION } from './version-D_cJUvMp.cjs';
7
7
  import './loyalty-events-CmDw2ZoR.cjs';
8
8
 
9
9
  interface StoredPlayer {
@@ -1,9 +1,9 @@
1
- import { I as InvoServer, a as InvoEnvironment } from './server-B7Pw1HMp.js';
2
- export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, K as KeyEnvironmentMismatchError, L as LIVE_KEY_PREFIX, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, T as TEST_KEY_PREFIX, b as baseUrlForKey, e as environmentForBaseUrl, c as environmentFromKeyPrefix, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-B7Pw1HMp.js';
1
+ import { I as InvoServer, a as InvoEnvironment } from './server-CaaP-Nc3.js';
2
+ export { D as DEMO_KEY_PREFIX, E as EnvironmentUnknownError, K as KeyEnvironmentMismatchError, L as LIVE_KEY_PREFIX, P as PRODUCTION_BASE_URL, S as SANDBOX_BASE_URL, T as TEST_KEY_PREFIX, b as baseUrlForKey, e as environmentForBaseUrl, c as environmentFromKeyPrefix, i as isDemoKey, r as resolveEnvironment, v as verifyInvoSignature } from './server-CaaP-Nc3.js';
3
3
  import { G as GameCurrencyKind, a as GamePurchaseStatus, b as GameEconomyConfig } from './types-jUxfYjiD.js';
4
4
  export { c as GameCatalog, d as GameCatalogItem, e as GameCheckout, f as GameCurrencyBalance, g as GameErrorBody, h as GameItemPurchase, i as GamePlayer, j as GamePremiumPack, k as GamePurchase, l as GameSession, m as GameTransferInput, n as GameTransferKind, o as GameTransferStart, p as GameTransferStatus, q as GameWallet } from './types-jUxfYjiD.js';
5
- export { I as InvoError } from './types-BdKpJX93.js';
6
- export { S as SDK_VERSION } from './version-CuhMO-6s.js';
5
+ export { I as InvoError } from './types-DGgWWX1v.js';
6
+ export { S as SDK_VERSION } from './version-D_cJUvMp.js';
7
7
  import './loyalty-events-CmDw2ZoR.js';
8
8
 
9
9
  interface StoredPlayer {
@@ -1,8 +1,8 @@
1
- import { isDemoKey, SANDBOX_BASE_URL, environmentFromKeyPrefix, assertKeyMatchesEnvironment, assertKeyMatchesBaseUrl, PRODUCTION_BASE_URL, InvoServer, resolveEnvironment, verifyWebhook } from './chunk-ZHEQAZLW.js';
2
- export { DEMO_KEY_PREFIX, EnvironmentUnknownError, InvoServer, KeyEnvironmentMismatchError, LIVE_KEY_PREFIX, PRODUCTION_BASE_URL, SANDBOX_BASE_URL, TEST_KEY_PREFIX, baseUrlForKey, environmentForBaseUrl, environmentFromKeyPrefix, isDemoKey, resolveEnvironment, verifyInvoSignature } from './chunk-ZHEQAZLW.js';
3
- export { SDK_VERSION } from './chunk-MENRG67H.js';
4
- import { InvoError } from './chunk-KWAUFFDY.js';
5
- export { InvoError } from './chunk-KWAUFFDY.js';
1
+ import { isDemoKey, SANDBOX_BASE_URL, environmentFromKeyPrefix, assertKeyMatchesEnvironment, assertKeyMatchesBaseUrl, PRODUCTION_BASE_URL, InvoServer, resolveEnvironment, verifyWebhook } from './chunk-NS33T5FB.js';
2
+ export { DEMO_KEY_PREFIX, EnvironmentUnknownError, InvoServer, KeyEnvironmentMismatchError, LIVE_KEY_PREFIX, PRODUCTION_BASE_URL, SANDBOX_BASE_URL, TEST_KEY_PREFIX, baseUrlForKey, environmentForBaseUrl, environmentFromKeyPrefix, isDemoKey, resolveEnvironment, verifyInvoSignature } from './chunk-NS33T5FB.js';
3
+ export { SDK_VERSION } from './chunk-MOHWLDOQ.js';
4
+ import { InvoError } from './chunk-7B7MFAQ3.js';
5
+ export { InvoError } from './chunk-7B7MFAQ3.js';
6
6
  import { createHash, randomBytes } from 'crypto';
7
7
  import { promises, readFileSync, mkdirSync, writeFileSync } from 'fs';
8
8
  import * as path from 'path';
package/dist/game.cjs CHANGED
@@ -84,7 +84,11 @@ var InvoError = class _InvoError extends Error {
84
84
  * - registration/token-mint (phone already on another INVO account), and
85
85
  * - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
86
86
  * `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
87
- * so INVO holds the money and texts the phone owner to approve.
87
+ * so INVO holds the money and asks the phone owner to approve.
88
+ *
89
+ * Either way the 409 has already created an approval request and contacted the phone's
90
+ * existing owner: by email when INVO has verified their address, otherwise by a text code
91
+ * (the body's `consent_channel` says which).
88
92
  *
89
93
  * NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
90
94
  * `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
@@ -101,7 +105,8 @@ var InvoError = class _InvoError extends Error {
101
105
  const v = this.bodyObject()["approval_id"];
102
106
  return typeof v === "string" && v ? v : void 0;
103
107
  }
104
- /** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
108
+ /** Last 4 digits of the phone that must approve (`phone_last4`, a string such as `"4567"`),
109
+ * for the UI message. `undefined` when the body has none (an older server). */
105
110
  get phoneShareLast4() {
106
111
  const v = this.bodyObject()["phone_last4"];
107
112
  return typeof v === "string" && v ? v : void 0;
@@ -540,6 +545,26 @@ var InvoError = class _InvoError extends Error {
540
545
  const v = this.bodyObject()["untaxed_total_usd"];
541
546
  return typeof v === "string" && v ? v : void 0;
542
547
  }
548
+ /**
549
+ * Additive (3.38.0). True when a Merchant of Record card sale was refused because the buyer is in
550
+ * a country where INVO does not yet sell as Merchant of Record (`SALE_NOT_AVAILABLE_IN_COUNTRY`,
551
+ * 409; today the EU member states until January 1, 2027). NOTHING WAS CHARGED. The body carries
552
+ * `retryable: false`: do not retry, and do not ask for another card (the refusal follows where
553
+ * the buyer is). Show the message (`err.message`), for example "Purchases aren't available in
554
+ * your country yet. Nothing was charged." Returned by the quote, the purchase, hosted checkout
555
+ * and Platform Commerce card purchases. Branch on this, never on a country list.
556
+ * See https://docs.invo.network/docs/merchant-of-record-tax#sale-not-available
557
+ */
558
+ get isSaleNotAvailableInCountry() {
559
+ return this.code === "SALE_NOT_AVAILABLE_IN_COUNTRY";
560
+ }
561
+ /** On `SALE_NOT_AVAILABLE_IN_COUNTRY`: the buyer's country, ISO 3166-1 alpha-2 (`country`), or
562
+ * `undefined` when INVO did not know it. */
563
+ get unavailableCountry() {
564
+ if (!this.isSaleNotAvailableInCountry) return void 0;
565
+ const v = this.bodyObject()["country"];
566
+ return typeof v === "string" && v ? v : void 0;
567
+ }
543
568
  /**
544
569
  * True if a Platform Commerce refund targeted an order that was already refunded
545
570
  * (409). Idempotent outcome — the original refund did happen, so treat this as
@@ -1074,7 +1099,10 @@ var InvoError = class _InvoError extends Error {
1074
1099
  /**
1075
1100
  * True when the phone you supplied belongs to another email
1076
1101
  * (`PHONE_SHARE_APPROVAL_REQUIRED`, 409) on `mintPlayerToken`, `registerPlayer` or
1077
- * `updatePlayerPhone`. Nothing was created or changed. The same condition as
1102
+ * `updatePlayerPhone`. The phone may be held by a player in any game or by an INVO wallet
1103
+ * (including one created in the INVO app). No player was created or changed, but INVO has
1104
+ * created an approval request and asked the phone's owner to approve; retry the same call
1105
+ * once they have and it succeeds. The same condition as
1078
1106
  * {@link isPhoneShareApprovalRequired}, named for these registration calls.
1079
1107
  */
1080
1108
  get isPhoneShareRefused() {
@@ -5017,7 +5045,7 @@ function mountInvoUI(container, economy, options = {}) {
5017
5045
  }
5018
5046
 
5019
5047
  // src/version.ts
5020
- var SDK_VERSION = "3.37.0";
5048
+ var SDK_VERSION = "3.38.0";
5021
5049
 
5022
5050
  exports.InvoGameEconomy = InvoGameEconomy;
5023
5051
  exports.InvoGameError = InvoGameError;
package/dist/game.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { i as GamePlayer, q as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, n as GameTransferKind, d as GameCatalogItem, f as GameCurrencyBalance, p as GameTransferStatus, m as GameTransferInput, o as GameTransferStart } from './types-jUxfYjiD.cjs';
2
2
  export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-jUxfYjiD.cjs';
3
- import { A as ApproveHostedResult } from './hosted-approval-DS9gcCF5.cjs';
4
- import { D as DestinationGame, P as PendingCollectItem } from './types-BdKpJX93.cjs';
5
- export { S as SDK_VERSION } from './version-CuhMO-6s.cjs';
3
+ import { A as ApproveHostedResult } from './hosted-approval-B-kbdFDL.cjs';
4
+ import { D as DestinationGame, P as PendingCollectItem } from './types-DGgWWX1v.cjs';
5
+ export { S as SDK_VERSION } from './version-D_cJUvMp.cjs';
6
6
 
7
7
  /**
8
8
  * INVO game economy client (3.27.0), the browser half. It talks ONLY to your game server
package/dist/game.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { i as GamePlayer, q as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, n as GameTransferKind, d as GameCatalogItem, f as GameCurrencyBalance, p as GameTransferStatus, m as GameTransferInput, o as GameTransferStart } from './types-jUxfYjiD.js';
2
2
  export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-jUxfYjiD.js';
3
- import { A as ApproveHostedResult } from './hosted-approval-Dv462L4e.js';
4
- import { D as DestinationGame, P as PendingCollectItem } from './types-BdKpJX93.js';
5
- export { S as SDK_VERSION } from './version-CuhMO-6s.js';
3
+ import { A as ApproveHostedResult } from './hosted-approval-CtAZ1Rzt.js';
4
+ import { D as DestinationGame, P as PendingCollectItem } from './types-DGgWWX1v.js';
5
+ export { S as SDK_VERSION } from './version-D_cJUvMp.js';
6
6
 
7
7
  /**
8
8
  * INVO game economy client (3.27.0), the browser half. It talks ONLY to your game server
package/dist/game.js CHANGED
@@ -1,6 +1,6 @@
1
- import { InvoClient } from './chunk-AUHRMREF.js';
2
- export { SDK_VERSION } from './chunk-MENRG67H.js';
3
- import { newEventId } from './chunk-KWAUFFDY.js';
1
+ import { InvoClient } from './chunk-3HK32FE4.js';
2
+ export { SDK_VERSION } from './chunk-MOHWLDOQ.js';
3
+ import { newEventId } from './chunk-7B7MFAQ3.js';
4
4
 
5
5
  // src/game/client.ts
6
6
  var InvoGameError = class extends Error {
@@ -1,4 +1,4 @@
1
- import { A as ApproveResult, j as ConfirmReceiptResult } from './types-BdKpJX93.cjs';
1
+ import { A as ApproveResult, j as ConfirmReceiptResult } from './types-DGgWWX1v.cjs';
2
2
 
3
3
  /** The four device-approval flows (`begin.flow`). */
4
4
  type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
@@ -1,4 +1,4 @@
1
- import { A as ApproveResult, j as ConfirmReceiptResult } from './types-BdKpJX93.js';
1
+ import { A as ApproveResult, j as ConfirmReceiptResult } from './types-DGgWWX1v.js';
2
2
 
3
3
  /** The four device-approval flows (`begin.flow`). */
4
4
  type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
package/dist/index.cjs CHANGED
@@ -84,7 +84,11 @@ var InvoError = class _InvoError extends Error {
84
84
  * - registration/token-mint (phone already on another INVO account), and
85
85
  * - **claim + confirm-receipt** (`claimTransfer`/`claimCurrency`,
86
86
  * `confirmReceiptSend`/`confirmReceiptTransfer`) — the receiver phone is contested,
87
- * so INVO holds the money and texts the phone owner to approve.
87
+ * so INVO holds the money and asks the phone owner to approve.
88
+ *
89
+ * Either way the 409 has already created an approval request and contacted the phone's
90
+ * existing owner: by email when INVO has verified their address, otherwise by a text code
91
+ * (the body's `consent_channel` says which).
88
92
  *
89
93
  * NOT a failure. Show `err.message` verbatim (the backend supplies the user-facing text;
90
94
  * `phoneShareLast4` tells the UI which phone), keep the funds pending, and **retry the same
@@ -101,7 +105,8 @@ var InvoError = class _InvoError extends Error {
101
105
  const v = this.bodyObject()["approval_id"];
102
106
  return typeof v === "string" && v ? v : void 0;
103
107
  }
104
- /** Last 4 digits of the phone that must approve (`phone_last4`), for the UI message. */
108
+ /** Last 4 digits of the phone that must approve (`phone_last4`, a string such as `"4567"`),
109
+ * for the UI message. `undefined` when the body has none (an older server). */
105
110
  get phoneShareLast4() {
106
111
  const v = this.bodyObject()["phone_last4"];
107
112
  return typeof v === "string" && v ? v : void 0;
@@ -540,6 +545,26 @@ var InvoError = class _InvoError extends Error {
540
545
  const v = this.bodyObject()["untaxed_total_usd"];
541
546
  return typeof v === "string" && v ? v : void 0;
542
547
  }
548
+ /**
549
+ * Additive (3.38.0). True when a Merchant of Record card sale was refused because the buyer is in
550
+ * a country where INVO does not yet sell as Merchant of Record (`SALE_NOT_AVAILABLE_IN_COUNTRY`,
551
+ * 409; today the EU member states until January 1, 2027). NOTHING WAS CHARGED. The body carries
552
+ * `retryable: false`: do not retry, and do not ask for another card (the refusal follows where
553
+ * the buyer is). Show the message (`err.message`), for example "Purchases aren't available in
554
+ * your country yet. Nothing was charged." Returned by the quote, the purchase, hosted checkout
555
+ * and Platform Commerce card purchases. Branch on this, never on a country list.
556
+ * See https://docs.invo.network/docs/merchant-of-record-tax#sale-not-available
557
+ */
558
+ get isSaleNotAvailableInCountry() {
559
+ return this.code === "SALE_NOT_AVAILABLE_IN_COUNTRY";
560
+ }
561
+ /** On `SALE_NOT_AVAILABLE_IN_COUNTRY`: the buyer's country, ISO 3166-1 alpha-2 (`country`), or
562
+ * `undefined` when INVO did not know it. */
563
+ get unavailableCountry() {
564
+ if (!this.isSaleNotAvailableInCountry) return void 0;
565
+ const v = this.bodyObject()["country"];
566
+ return typeof v === "string" && v ? v : void 0;
567
+ }
543
568
  /**
544
569
  * True if a Platform Commerce refund targeted an order that was already refunded
545
570
  * (409). Idempotent outcome — the original refund did happen, so treat this as
@@ -1074,7 +1099,10 @@ var InvoError = class _InvoError extends Error {
1074
1099
  /**
1075
1100
  * True when the phone you supplied belongs to another email
1076
1101
  * (`PHONE_SHARE_APPROVAL_REQUIRED`, 409) on `mintPlayerToken`, `registerPlayer` or
1077
- * `updatePlayerPhone`. Nothing was created or changed. The same condition as
1102
+ * `updatePlayerPhone`. The phone may be held by a player in any game or by an INVO wallet
1103
+ * (including one created in the INVO app). No player was created or changed, but INVO has
1104
+ * created an approval request and asked the phone's owner to approve; retry the same call
1105
+ * once they have and it succeeds. The same condition as
1078
1106
  * {@link isPhoneShareApprovalRequired}, named for these registration calls.
1079
1107
  */
1080
1108
  get isPhoneShareRefused() {
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-BdKpJX93.cjs';
2
- export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-BdKpJX93.cjs';
3
- import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-DS9gcCF5.cjs';
4
- export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-DS9gcCF5.cjs';
1
+ import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-DGgWWX1v.cjs';
2
+ export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-DGgWWX1v.cjs';
3
+ import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-B-kbdFDL.cjs';
4
+ export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-B-kbdFDL.cjs';
5
5
  import { R as ReportGameEventInput, a as ReportGameEventResult } from './loyalty-events-CmDw2ZoR.cjs';
6
6
  export { G as GameEventType } from './loyalty-events-CmDw2ZoR.cjs';
7
7
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-BdKpJX93.js';
2
- export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-BdKpJX93.js';
3
- import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-Dv462L4e.js';
4
- export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-Dv462L4e.js';
1
+ import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-DGgWWX1v.js';
2
+ export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-DGgWWX1v.js';
3
+ import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-CtAZ1Rzt.js';
4
+ export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-CtAZ1Rzt.js';
5
5
  import { R as ReportGameEventInput, a as ReportGameEventResult } from './loyalty-events-CmDw2ZoR.js';
6
6
  export { G as GameEventType } from './loyalty-events-CmDw2ZoR.js';
7
7
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { CheckoutClient, InvoClient, PlatformCommerceClient } from './chunk-AUHRMREF.js';
2
- export { InvoError, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage } from './chunk-KWAUFFDY.js';
1
+ export { CheckoutClient, InvoClient, PlatformCommerceClient } from './chunk-3HK32FE4.js';
2
+ export { InvoError, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage } from './chunk-7B7MFAQ3.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map