@invonetwork/web-sdk 3.8.1 → 3.10.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.
@@ -530,6 +530,82 @@ var InvoError = class _InvoError extends Error {
530
530
  get isSteamRefundNotSupported() {
531
531
  return this.code === "STEAM_REFUND_NOT_SUPPORTED";
532
532
  }
533
+ /**
534
+ * True when `subscriptions.refund` was refused because refunds are turned off for this
535
+ * game (`REFUNDS_NOT_ENABLED`, 403). Refunds are on by default for every game; INVO turns
536
+ * them off per game. Contact INVO.
537
+ */
538
+ get isRefundsNotEnabled() {
539
+ return this.code === "REFUNDS_NOT_ENABLED";
540
+ }
541
+ /**
542
+ * True when `subscriptions.refund` targeted a period charged more than 30 days ago
543
+ * (`REFUND_WINDOW_CLOSED`, 409). See `periodChargedAt`, `refundWindowDays` and
544
+ * `refundWindowClosedAt`. A retry of a refund that already ran still returns its receipt.
545
+ */
546
+ get isRefundWindowClosed() {
547
+ return this.code === "REFUND_WINDOW_CLOSED";
548
+ }
549
+ /**
550
+ * True when a refund request for this period is waiting for INVO's review
551
+ * (`REFUND_REQUEST_PENDING`, 409). No other refund of the period can run until it is
552
+ * decided. The request id is on `refundRequestId`.
553
+ */
554
+ get isRefundRequestPending() {
555
+ return this.code === "REFUND_REQUEST_PENDING";
556
+ }
557
+ /**
558
+ * True when this `clientRequestId` was filed as a refund request and INVO rejected it
559
+ * (`REFUND_REQUEST_REJECTED`, 409). See `refundRequestId` and `decisionReason`. To try
560
+ * again use a NEW `clientRequestId`.
561
+ */
562
+ get isRefundRequestRejected() {
563
+ return this.code === "REFUND_REQUEST_REJECTED";
564
+ }
565
+ /**
566
+ * True when two requests collided (`CONCURRENT_REQUEST`, 409): two creates for a
567
+ * brand-new player, or two refund requests for one period filed at the same moment.
568
+ * Retry with the SAME key.
569
+ */
570
+ get isConcurrentRequest() {
571
+ return this.code === "CONCURRENT_REQUEST";
572
+ }
573
+ /**
574
+ * True when a subscription refund needs manual reconciliation (`REFUND_MISMATCH`, 502):
575
+ * the card processor already holds a refund for this request with a different amount, or
576
+ * the charge was already fully refunded outside this flow. Contact INVO; do not retry-loop.
577
+ */
578
+ get isRefundMismatch() {
579
+ return this.code === "REFUND_MISMATCH";
580
+ }
581
+ /**
582
+ * The refund request id (`request_id`) on `REFUND_REQUEST_PENDING` and
583
+ * `REFUND_REQUEST_REJECTED`. Not the backend request id, which is {@link requestId}.
584
+ */
585
+ get refundRequestId() {
586
+ const v = this.bodyObject()["request_id"];
587
+ return typeof v === "string" && v ? v : void 0;
588
+ }
589
+ /** INVO's reason on `REFUND_REQUEST_REJECTED` (may be absent). */
590
+ get decisionReason() {
591
+ const v = this.bodyObject()["decision_reason"];
592
+ return typeof v === "string" && v ? v : void 0;
593
+ }
594
+ /** On `REFUND_WINDOW_CLOSED`: when the period was charged (ISO 8601). */
595
+ get periodChargedAt() {
596
+ const v = this.bodyObject()["period_charged_at"];
597
+ return typeof v === "string" && v ? v : void 0;
598
+ }
599
+ /** On `REFUND_WINDOW_CLOSED`: the window length in days (30). */
600
+ get refundWindowDays() {
601
+ const v = this.bodyObject()["refund_window_days"];
602
+ return typeof v === "number" && Number.isFinite(v) ? v : void 0;
603
+ }
604
+ /** On `REFUND_WINDOW_CLOSED`: when the window closed (ISO 8601). */
605
+ get refundWindowClosedAt() {
606
+ const v = this.bodyObject()["window_closed_at"];
607
+ return typeof v === "string" && v ? v : void 0;
608
+ }
533
609
  /** True when the subscription is `canceled` or `expired` and the call cannot apply (`SUBSCRIPTION_TERMINAL`, 409). Start a new one. */
534
610
  get isSubscriptionTerminal() {
535
611
  return this.code === "SUBSCRIPTION_TERMINAL";
@@ -563,6 +639,34 @@ var InvoError = class _InvoError extends Error {
563
639
  get isGameNotLive() {
564
640
  return this.code === "GAME_NOT_LIVE";
565
641
  }
642
+ // ---- Card setup session (the INVO-hosted card page) ----
643
+ /**
644
+ * True when `cards.createSetupSession` was refused because the member does not exist
645
+ * in this game yet (`PLAYER_NOT_FOUND`, 404). The card page never creates players;
646
+ * create the member first (any endpoint that creates players, for example a currency
647
+ * purchase), then mint the session again. The same code comes back from
648
+ * `cards.beginSetup` and from `mintPlayerToken` for the same reason.
649
+ */
650
+ get isPlayerNotFound() {
651
+ return this.code === "PLAYER_NOT_FOUND";
652
+ }
653
+ /**
654
+ * True when `cards.createSetupSession` was refused because `playerEmail` was missing or
655
+ * is not an email address (`INVALID_PLAYER_EMAIL`, 400).
656
+ */
657
+ get isInvalidPlayerEmail() {
658
+ return this.code === "INVALID_PLAYER_EMAIL";
659
+ }
660
+ /**
661
+ * True on an `INVALID_INPUT` refusal. Two sources, told apart by `status`:
662
+ * `status === 0` is this SDK refusing a value before the network (every client-side
663
+ * guard uses this code); `status === 400` is INVO refusing one, on
664
+ * `cards.createSetupSession` a `successUrl` / `cancelUrl` that uses a script scheme
665
+ * (`javascript:`, `data:`, `vbscript:`). http(s) and app deep-link schemes are fine.
666
+ */
667
+ get isInvalidInput() {
668
+ return this.code === "INVALID_INPUT";
669
+ }
566
670
  /** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
567
671
  get retryAfter() {
568
672
  const v = this.bodyObject()["retry_after"];
@@ -846,5 +950,5 @@ function toDestinationsResult(raw, direction) {
846
950
  }
847
951
 
848
952
  export { Http, InvoError, assertSecureBaseUrl, toDestinationsResult };
849
- //# sourceMappingURL=chunk-HYGBTUEJ.js.map
850
- //# sourceMappingURL=chunk-HYGBTUEJ.js.map
953
+ //# sourceMappingURL=chunk-L4A6OV54.js.map
954
+ //# sourceMappingURL=chunk-L4A6OV54.js.map
package/dist/index.cjs CHANGED
@@ -532,6 +532,82 @@ var InvoError = class _InvoError extends Error {
532
532
  get isSteamRefundNotSupported() {
533
533
  return this.code === "STEAM_REFUND_NOT_SUPPORTED";
534
534
  }
535
+ /**
536
+ * True when `subscriptions.refund` was refused because refunds are turned off for this
537
+ * game (`REFUNDS_NOT_ENABLED`, 403). Refunds are on by default for every game; INVO turns
538
+ * them off per game. Contact INVO.
539
+ */
540
+ get isRefundsNotEnabled() {
541
+ return this.code === "REFUNDS_NOT_ENABLED";
542
+ }
543
+ /**
544
+ * True when `subscriptions.refund` targeted a period charged more than 30 days ago
545
+ * (`REFUND_WINDOW_CLOSED`, 409). See `periodChargedAt`, `refundWindowDays` and
546
+ * `refundWindowClosedAt`. A retry of a refund that already ran still returns its receipt.
547
+ */
548
+ get isRefundWindowClosed() {
549
+ return this.code === "REFUND_WINDOW_CLOSED";
550
+ }
551
+ /**
552
+ * True when a refund request for this period is waiting for INVO's review
553
+ * (`REFUND_REQUEST_PENDING`, 409). No other refund of the period can run until it is
554
+ * decided. The request id is on `refundRequestId`.
555
+ */
556
+ get isRefundRequestPending() {
557
+ return this.code === "REFUND_REQUEST_PENDING";
558
+ }
559
+ /**
560
+ * True when this `clientRequestId` was filed as a refund request and INVO rejected it
561
+ * (`REFUND_REQUEST_REJECTED`, 409). See `refundRequestId` and `decisionReason`. To try
562
+ * again use a NEW `clientRequestId`.
563
+ */
564
+ get isRefundRequestRejected() {
565
+ return this.code === "REFUND_REQUEST_REJECTED";
566
+ }
567
+ /**
568
+ * True when two requests collided (`CONCURRENT_REQUEST`, 409): two creates for a
569
+ * brand-new player, or two refund requests for one period filed at the same moment.
570
+ * Retry with the SAME key.
571
+ */
572
+ get isConcurrentRequest() {
573
+ return this.code === "CONCURRENT_REQUEST";
574
+ }
575
+ /**
576
+ * True when a subscription refund needs manual reconciliation (`REFUND_MISMATCH`, 502):
577
+ * the card processor already holds a refund for this request with a different amount, or
578
+ * the charge was already fully refunded outside this flow. Contact INVO; do not retry-loop.
579
+ */
580
+ get isRefundMismatch() {
581
+ return this.code === "REFUND_MISMATCH";
582
+ }
583
+ /**
584
+ * The refund request id (`request_id`) on `REFUND_REQUEST_PENDING` and
585
+ * `REFUND_REQUEST_REJECTED`. Not the backend request id, which is {@link requestId}.
586
+ */
587
+ get refundRequestId() {
588
+ const v = this.bodyObject()["request_id"];
589
+ return typeof v === "string" && v ? v : void 0;
590
+ }
591
+ /** INVO's reason on `REFUND_REQUEST_REJECTED` (may be absent). */
592
+ get decisionReason() {
593
+ const v = this.bodyObject()["decision_reason"];
594
+ return typeof v === "string" && v ? v : void 0;
595
+ }
596
+ /** On `REFUND_WINDOW_CLOSED`: when the period was charged (ISO 8601). */
597
+ get periodChargedAt() {
598
+ const v = this.bodyObject()["period_charged_at"];
599
+ return typeof v === "string" && v ? v : void 0;
600
+ }
601
+ /** On `REFUND_WINDOW_CLOSED`: the window length in days (30). */
602
+ get refundWindowDays() {
603
+ const v = this.bodyObject()["refund_window_days"];
604
+ return typeof v === "number" && Number.isFinite(v) ? v : void 0;
605
+ }
606
+ /** On `REFUND_WINDOW_CLOSED`: when the window closed (ISO 8601). */
607
+ get refundWindowClosedAt() {
608
+ const v = this.bodyObject()["window_closed_at"];
609
+ return typeof v === "string" && v ? v : void 0;
610
+ }
535
611
  /** True when the subscription is `canceled` or `expired` and the call cannot apply (`SUBSCRIPTION_TERMINAL`, 409). Start a new one. */
536
612
  get isSubscriptionTerminal() {
537
613
  return this.code === "SUBSCRIPTION_TERMINAL";
@@ -565,6 +641,34 @@ var InvoError = class _InvoError extends Error {
565
641
  get isGameNotLive() {
566
642
  return this.code === "GAME_NOT_LIVE";
567
643
  }
644
+ // ---- Card setup session (the INVO-hosted card page) ----
645
+ /**
646
+ * True when `cards.createSetupSession` was refused because the member does not exist
647
+ * in this game yet (`PLAYER_NOT_FOUND`, 404). The card page never creates players;
648
+ * create the member first (any endpoint that creates players, for example a currency
649
+ * purchase), then mint the session again. The same code comes back from
650
+ * `cards.beginSetup` and from `mintPlayerToken` for the same reason.
651
+ */
652
+ get isPlayerNotFound() {
653
+ return this.code === "PLAYER_NOT_FOUND";
654
+ }
655
+ /**
656
+ * True when `cards.createSetupSession` was refused because `playerEmail` was missing or
657
+ * is not an email address (`INVALID_PLAYER_EMAIL`, 400).
658
+ */
659
+ get isInvalidPlayerEmail() {
660
+ return this.code === "INVALID_PLAYER_EMAIL";
661
+ }
662
+ /**
663
+ * True on an `INVALID_INPUT` refusal. Two sources, told apart by `status`:
664
+ * `status === 0` is this SDK refusing a value before the network (every client-side
665
+ * guard uses this code); `status === 400` is INVO refusing one, on
666
+ * `cards.createSetupSession` a `successUrl` / `cancelUrl` that uses a script scheme
667
+ * (`javascript:`, `data:`, `vbscript:`). http(s) and app deep-link schemes are fine.
668
+ */
669
+ get isInvalidInput() {
670
+ return this.code === "INVALID_INPUT";
671
+ }
568
672
  /** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
569
673
  get retryAfter() {
570
674
  const v = this.bodyObject()["retry_after"];
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as ApproveResult, C as ConfirmReceiptResult, M as MountCheckoutOptions, a as CheckoutMountHandle, b as ClientConfig, c as CallOptions, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, d as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, e as EnrollmentVerifyResult, R as RecoveryBeginResult, f as RecoveryCompleteResult } from './types-DqRuqbqI.cjs';
2
- export { g as BalanceRow, h as DestinationGame, I as InvoError, i as InvoErrorInfo, j as InvoHooks, k as InvoRequestInfo, l as InvoResponseInfo, m as PendingCollectItem, n as Rail, V as VerificationMethod } from './types-DqRuqbqI.cjs';
1
+ import { A as ApproveResult, C as ConfirmReceiptResult, M as MountCheckoutOptions, a as CheckoutMountHandle, b as ClientConfig, c as CallOptions, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, d as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, e as EnrollmentVerifyResult, R as RecoveryBeginResult, f as RecoveryCompleteResult } from './types-CBxpXgAM.cjs';
2
+ export { g as BalanceRow, h as DestinationGame, I as InvoError, i as InvoErrorInfo, j as InvoHooks, k as InvoRequestInfo, l as InvoResponseInfo, m as PendingCollectItem, n as Rail, V as VerificationMethod } from './types-CBxpXgAM.cjs';
3
3
 
4
4
  /** The four device-approval flows (`begin.flow`). */
5
5
  type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as ApproveResult, C as ConfirmReceiptResult, M as MountCheckoutOptions, a as CheckoutMountHandle, b as ClientConfig, c as CallOptions, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, d as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, e as EnrollmentVerifyResult, R as RecoveryBeginResult, f as RecoveryCompleteResult } from './types-DqRuqbqI.js';
2
- export { g as BalanceRow, h as DestinationGame, I as InvoError, i as InvoErrorInfo, j as InvoHooks, k as InvoRequestInfo, l as InvoResponseInfo, m as PendingCollectItem, n as Rail, V as VerificationMethod } from './types-DqRuqbqI.js';
1
+ import { A as ApproveResult, C as ConfirmReceiptResult, M as MountCheckoutOptions, a as CheckoutMountHandle, b as ClientConfig, c as CallOptions, L as LinkDeviceResult, P as PendingCollectResult, D as DestinationsQuery, d as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, e as EnrollmentVerifyResult, R as RecoveryBeginResult, f as RecoveryCompleteResult } from './types-CBxpXgAM.js';
2
+ export { g as BalanceRow, h as DestinationGame, I as InvoError, i as InvoErrorInfo, j as InvoHooks, k as InvoRequestInfo, l as InvoResponseInfo, m as PendingCollectItem, n as Rail, V as VerificationMethod } from './types-CBxpXgAM.js';
3
3
 
4
4
  /** The four device-approval flows (`begin.flow`). */
5
5
  type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-HYGBTUEJ.js';
2
- export { InvoError } from './chunk-HYGBTUEJ.js';
1
+ import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-L4A6OV54.js';
2
+ export { InvoError } from './chunk-L4A6OV54.js';
3
3
 
4
4
  // src/shared/webauthn.ts
5
5
  function malformedOptions(field) {