@invonetwork/web-sdk 3.26.1 → 3.27.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 +1369 -1358
- package/README.md +118 -0
- package/dist/chunk-2DYTV74W.js +3681 -0
- package/dist/chunk-3YDO7GSH.js +6 -0
- package/dist/chunk-6CN236QH.js +473 -0
- package/dist/{chunk-7BYAUHTA.js → chunk-VP3OK4J4.js} +56 -459
- package/dist/game-server.cjs +5933 -0
- package/dist/game-server.d.cts +185 -0
- package/dist/game-server.d.ts +185 -0
- package/dist/game-server.js +716 -0
- package/dist/game.cjs +2172 -0
- package/dist/game.d.cts +197 -0
- package/dist/game.d.ts +197 -0
- package/dist/game.js +1034 -0
- package/dist/index.cjs +87 -0
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +26 -2
- package/dist/server.cjs +97 -1
- package/dist/server.d.cts +21 -10
- package/dist/server.d.ts +21 -10
- package/dist/server.js +4 -3650
- package/dist/types-CoW9LopI.d.cts +143 -0
- package/dist/types-CoW9LopI.d.ts +143 -0
- package/dist/{types-Cjd4SAR8.d.cts → types-_lIm74kd.d.cts} +40 -1
- package/dist/{types-Cjd4SAR8.d.ts → types-_lIm74kd.d.ts} +40 -1
- package/dist/version-BXFwI0-s.d.cts +8 -0
- package/dist/version-BXFwI0-s.d.ts +8 -0
- package/package.json +91 -77
package/dist/index.cjs
CHANGED
|
@@ -2237,6 +2237,71 @@ function toRewardsPageLink(raw) {
|
|
|
2237
2237
|
return { url: str2(raw["url"]), expiresAt: str2(raw["expires_at"]), raw };
|
|
2238
2238
|
}
|
|
2239
2239
|
|
|
2240
|
+
// src/shared/loyalty-events.ts
|
|
2241
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
2242
|
+
var ISO_WITH_ZONE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})$/;
|
|
2243
|
+
function invalid(label, value, why) {
|
|
2244
|
+
return new InvoError({
|
|
2245
|
+
message: `${label} ${why} (got ${JSON.stringify(value)}).`,
|
|
2246
|
+
code: "INVALID_INPUT",
|
|
2247
|
+
status: 0
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
function newEventId() {
|
|
2251
|
+
const c = globalThis.crypto;
|
|
2252
|
+
if (c && typeof c.randomUUID === "function") return c.randomUUID();
|
|
2253
|
+
const bytes = new Uint8Array(16);
|
|
2254
|
+
if (c && typeof c.getRandomValues === "function") {
|
|
2255
|
+
c.getRandomValues(bytes);
|
|
2256
|
+
} else {
|
|
2257
|
+
throw new InvoError({
|
|
2258
|
+
message: "No Web Crypto available to generate an eventId; pass `eventId` yourself.",
|
|
2259
|
+
code: "INVALID_INPUT",
|
|
2260
|
+
status: 0
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
2264
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
2265
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
2266
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
2267
|
+
}
|
|
2268
|
+
function buildGameEventBody(input) {
|
|
2269
|
+
if (!input || typeof input !== "object") throw invalid("input", input, "must be an object");
|
|
2270
|
+
const { eventType, payload } = input;
|
|
2271
|
+
if (typeof eventType !== "string" || !eventType.startsWith("game.") || eventType.length > 120) {
|
|
2272
|
+
throw invalid("eventType", eventType, "must be a game.* event type");
|
|
2273
|
+
}
|
|
2274
|
+
const eventId = input.eventId === void 0 ? newEventId() : input.eventId;
|
|
2275
|
+
if (typeof eventId !== "string" || !UUID.test(eventId)) {
|
|
2276
|
+
throw invalid("eventId", eventId, "must be a UUID");
|
|
2277
|
+
}
|
|
2278
|
+
const body = { event_type: eventType, event_id: eventId };
|
|
2279
|
+
if (input.occurredAt !== void 0) {
|
|
2280
|
+
const at = input.occurredAt instanceof Date ? input.occurredAt.toISOString() : input.occurredAt;
|
|
2281
|
+
if (typeof at !== "string" || !ISO_WITH_ZONE.test(at) || Number.isNaN(Date.parse(at))) {
|
|
2282
|
+
throw invalid("occurredAt", input.occurredAt, "must be ISO 8601 with a timezone, or a Date");
|
|
2283
|
+
}
|
|
2284
|
+
body["occurred_at"] = at;
|
|
2285
|
+
}
|
|
2286
|
+
if (payload !== void 0) {
|
|
2287
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
2288
|
+
throw invalid("payload", payload, "must be a plain object");
|
|
2289
|
+
}
|
|
2290
|
+
body["payload"] = payload;
|
|
2291
|
+
} else {
|
|
2292
|
+
body["payload"] = {};
|
|
2293
|
+
}
|
|
2294
|
+
return { body, eventId };
|
|
2295
|
+
}
|
|
2296
|
+
function toReportGameEventResult(raw, eventId) {
|
|
2297
|
+
const echoed = raw["event_id"];
|
|
2298
|
+
return {
|
|
2299
|
+
accepted: true,
|
|
2300
|
+
eventId: typeof echoed === "string" && echoed ? echoed : eventId,
|
|
2301
|
+
raw
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2240
2305
|
// src/shared/phone-change.ts
|
|
2241
2306
|
function phoneChangeSignalMessage(changeRequestId, nonce, timestamp, decision = "approve") {
|
|
2242
2307
|
const action = decision === "deny" ? "phone-change-deny" : "phone-change";
|
|
@@ -2999,6 +3064,28 @@ var InvoClient = class {
|
|
|
2999
3064
|
return toRewardsPageLink(raw);
|
|
3000
3065
|
});
|
|
3001
3066
|
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Report a gameplay event for the signed-in player to INVO's loyalty engine
|
|
3069
|
+
* (`POST /api/sdk/loyalty/events`, player token). Use it for sessions, milestones and
|
|
3070
|
+
* registered custom events (see {@link GameEventType}). Events your SERVER reports with
|
|
3071
|
+
* `InvoServer.reportGameEvent` are the ones trusted for rewards; prefer those when a
|
|
3072
|
+
* reward depends on the event.
|
|
3073
|
+
*
|
|
3074
|
+
* Pass your own `eventId` (a UUID) or reuse the returned one if you retry, so INVO counts
|
|
3075
|
+
* the event once. Not auto-retried from the browser.
|
|
3076
|
+
*
|
|
3077
|
+
* Refusals: `INVALID_INPUT` before the network (non-`game.*` type, malformed `eventId`,
|
|
3078
|
+
* `occurredAt` without a timezone, non-object payload); `400 RESERVED_EVENT_TYPE` /
|
|
3079
|
+
* `EVENT_TYPE_NOT_ALLOWED`; `401 SDK_TOKEN_MISSING` / `SDK_TOKEN_WRONG_SCOPE`;
|
|
3080
|
+
* `422 validation_failed`.
|
|
3081
|
+
*/
|
|
3082
|
+
async reportGameEvent(input, opts) {
|
|
3083
|
+
const { body, eventId } = buildGameEventBody(input);
|
|
3084
|
+
return this.withTokenRetry(async () => {
|
|
3085
|
+
const raw = await this.post("/api/sdk/loyalty/events", body, opts?.signal);
|
|
3086
|
+
return toReportGameEventResult(raw ?? {}, eventId);
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
3002
3089
|
/**
|
|
3003
3090
|
* First-enrollment OTP grant (§4.2). When `enrollPasskey()` throws
|
|
3004
3091
|
* `ENROLLMENT_REQUIRES_AUTHORIZATION` (`err.isEnrollmentAuthorizationRequired`), call
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, j as PhoneChangeApprovalsResult, k as ApprovePhoneChangeInput, l as ApprovePhoneChangeResult, L as LinkDeviceResult, m as PendingCollectResult, D as DestinationsQuery, n as DestinationsResult, B as BalanceResult, o as LoyaltyCardsResult, p as LoyaltyVaultResult, R as RedeemRewardResult, q as RewardsPageLink, E as EnrollmentBeginResult,
|
|
2
|
-
export {
|
|
1
|
+
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, j as PhoneChangeApprovalsResult, k as ApprovePhoneChangeInput, l as ApprovePhoneChangeResult, L as LinkDeviceResult, m as PendingCollectResult, D as DestinationsQuery, n as DestinationsResult, B as BalanceResult, o as LoyaltyCardsResult, p as LoyaltyVaultResult, R as RedeemRewardResult, q as RewardsPageLink, r as ReportGameEventInput, s as ReportGameEventResult, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-_lIm74kd.cjs';
|
|
2
|
+
export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, z as DestinationGame, G as GameEventType, I as InvoError, F as InvoErrorInfo, J as InvoHooks, K as InvoRequestInfo, N as InvoResponseInfo, O as LoyaltyCard, Q as LoyaltyCardReward, S as LoyaltyCardStep, T as LoyaltyRewardState, U as LoyaltyStepProgress, V as LoyaltyStepState, X as LoyaltyVaultEntry, Y as PendingCollectItem, Z as PhoneChangeApproval, _ as PhoneChangeDeviceSignal, $ as PurchaseRefusalReason, a0 as Rail, a1 as VerificationMethod } from './types-_lIm74kd.cjs';
|
|
3
3
|
|
|
4
4
|
/** The four device-approval flows (`begin.flow`). */
|
|
5
5
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
|
@@ -444,6 +444,22 @@ declare class InvoClient {
|
|
|
444
444
|
* the page; never share or store it.
|
|
445
445
|
*/
|
|
446
446
|
getRewardsPageLink(opts?: CallOptions): Promise<RewardsPageLink>;
|
|
447
|
+
/**
|
|
448
|
+
* Report a gameplay event for the signed-in player to INVO's loyalty engine
|
|
449
|
+
* (`POST /api/sdk/loyalty/events`, player token). Use it for sessions, milestones and
|
|
450
|
+
* registered custom events (see {@link GameEventType}). Events your SERVER reports with
|
|
451
|
+
* `InvoServer.reportGameEvent` are the ones trusted for rewards; prefer those when a
|
|
452
|
+
* reward depends on the event.
|
|
453
|
+
*
|
|
454
|
+
* Pass your own `eventId` (a UUID) or reuse the returned one if you retry, so INVO counts
|
|
455
|
+
* the event once. Not auto-retried from the browser.
|
|
456
|
+
*
|
|
457
|
+
* Refusals: `INVALID_INPUT` before the network (non-`game.*` type, malformed `eventId`,
|
|
458
|
+
* `occurredAt` without a timezone, non-object payload); `400 RESERVED_EVENT_TYPE` /
|
|
459
|
+
* `EVENT_TYPE_NOT_ALLOWED`; `401 SDK_TOKEN_MISSING` / `SDK_TOKEN_WRONG_SCOPE`;
|
|
460
|
+
* `422 validation_failed`.
|
|
461
|
+
*/
|
|
462
|
+
reportGameEvent(input: ReportGameEventInput, opts?: CallOptions): Promise<ReportGameEventResult>;
|
|
447
463
|
/**
|
|
448
464
|
* First-enrollment OTP grant (§4.2). When `enrollPasskey()` throws
|
|
449
465
|
* `ENROLLMENT_REQUIRES_AUTHORIZATION` (`err.isEnrollmentAuthorizationRequired`), call
|
|
@@ -506,4 +522,4 @@ declare class InvoClient {
|
|
|
506
522
|
private confirmReceipt;
|
|
507
523
|
}
|
|
508
524
|
|
|
509
|
-
export { type ApproveHostedOptions, type ApproveHostedResult, ApprovePhoneChangeInput, ApprovePhoneChangeResult, ApproveResult, BalanceResult, CallOptions, CheckoutClient, CheckoutClientConfig, CheckoutMountHandle, ClientConfig, ConfirmReceiptResult, DestinationsQuery, DestinationsResult, EnrollmentBeginResult, type EnrollmentDecision, type EnrollmentRespond, EnrollmentVerifyResult, type HostedApprovalStatus, type HostedEnrollment, type HostedEnrollmentInput, type HostedFlow, InvoClient, LinkDeviceResult, LoyaltyCardsResult, LoyaltyVaultResult, MountCheckoutOptions, PendingCollectResult, PhoneChangeApprovalsResult, PlatformCommerceClient, PurchaseCredited, PurchaseExpired, PurchaseRefunded, PurchaseRefused, PurchaseStatusInput, PurchaseStatusResult, RecoveryBeginResult, RecoveryCompleteResult, RedeemRewardResult, RewardsPageLink, WaitForPurchaseInput, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage };
|
|
525
|
+
export { type ApproveHostedOptions, type ApproveHostedResult, ApprovePhoneChangeInput, ApprovePhoneChangeResult, ApproveResult, BalanceResult, CallOptions, CheckoutClient, CheckoutClientConfig, CheckoutMountHandle, ClientConfig, ConfirmReceiptResult, DestinationsQuery, DestinationsResult, EnrollmentBeginResult, type EnrollmentDecision, type EnrollmentRespond, EnrollmentVerifyResult, type HostedApprovalStatus, type HostedEnrollment, type HostedEnrollmentInput, type HostedFlow, InvoClient, LinkDeviceResult, LoyaltyCardsResult, LoyaltyVaultResult, MountCheckoutOptions, PendingCollectResult, PhoneChangeApprovalsResult, PlatformCommerceClient, PurchaseCredited, PurchaseExpired, PurchaseRefunded, PurchaseRefused, PurchaseStatusInput, PurchaseStatusResult, RecoveryBeginResult, RecoveryCompleteResult, RedeemRewardResult, ReportGameEventInput, ReportGameEventResult, RewardsPageLink, WaitForPurchaseInput, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, j as PhoneChangeApprovalsResult, k as ApprovePhoneChangeInput, l as ApprovePhoneChangeResult, L as LinkDeviceResult, m as PendingCollectResult, D as DestinationsQuery, n as DestinationsResult, B as BalanceResult, o as LoyaltyCardsResult, p as LoyaltyVaultResult, R as RedeemRewardResult, q as RewardsPageLink, E as EnrollmentBeginResult,
|
|
2
|
-
export {
|
|
1
|
+
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, j as PhoneChangeApprovalsResult, k as ApprovePhoneChangeInput, l as ApprovePhoneChangeResult, L as LinkDeviceResult, m as PendingCollectResult, D as DestinationsQuery, n as DestinationsResult, B as BalanceResult, o as LoyaltyCardsResult, p as LoyaltyVaultResult, R as RedeemRewardResult, q as RewardsPageLink, r as ReportGameEventInput, s as ReportGameEventResult, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-_lIm74kd.js';
|
|
2
|
+
export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, z as DestinationGame, G as GameEventType, I as InvoError, F as InvoErrorInfo, J as InvoHooks, K as InvoRequestInfo, N as InvoResponseInfo, O as LoyaltyCard, Q as LoyaltyCardReward, S as LoyaltyCardStep, T as LoyaltyRewardState, U as LoyaltyStepProgress, V as LoyaltyStepState, X as LoyaltyVaultEntry, Y as PendingCollectItem, Z as PhoneChangeApproval, _ as PhoneChangeDeviceSignal, $ as PurchaseRefusalReason, a0 as Rail, a1 as VerificationMethod } from './types-_lIm74kd.js';
|
|
3
3
|
|
|
4
4
|
/** The four device-approval flows (`begin.flow`). */
|
|
5
5
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
|
@@ -444,6 +444,22 @@ declare class InvoClient {
|
|
|
444
444
|
* the page; never share or store it.
|
|
445
445
|
*/
|
|
446
446
|
getRewardsPageLink(opts?: CallOptions): Promise<RewardsPageLink>;
|
|
447
|
+
/**
|
|
448
|
+
* Report a gameplay event for the signed-in player to INVO's loyalty engine
|
|
449
|
+
* (`POST /api/sdk/loyalty/events`, player token). Use it for sessions, milestones and
|
|
450
|
+
* registered custom events (see {@link GameEventType}). Events your SERVER reports with
|
|
451
|
+
* `InvoServer.reportGameEvent` are the ones trusted for rewards; prefer those when a
|
|
452
|
+
* reward depends on the event.
|
|
453
|
+
*
|
|
454
|
+
* Pass your own `eventId` (a UUID) or reuse the returned one if you retry, so INVO counts
|
|
455
|
+
* the event once. Not auto-retried from the browser.
|
|
456
|
+
*
|
|
457
|
+
* Refusals: `INVALID_INPUT` before the network (non-`game.*` type, malformed `eventId`,
|
|
458
|
+
* `occurredAt` without a timezone, non-object payload); `400 RESERVED_EVENT_TYPE` /
|
|
459
|
+
* `EVENT_TYPE_NOT_ALLOWED`; `401 SDK_TOKEN_MISSING` / `SDK_TOKEN_WRONG_SCOPE`;
|
|
460
|
+
* `422 validation_failed`.
|
|
461
|
+
*/
|
|
462
|
+
reportGameEvent(input: ReportGameEventInput, opts?: CallOptions): Promise<ReportGameEventResult>;
|
|
447
463
|
/**
|
|
448
464
|
* First-enrollment OTP grant (§4.2). When `enrollPasskey()` throws
|
|
449
465
|
* `ENROLLMENT_REQUIRES_AUTHORIZATION` (`err.isEnrollmentAuthorizationRequired`), call
|
|
@@ -506,4 +522,4 @@ declare class InvoClient {
|
|
|
506
522
|
private confirmReceipt;
|
|
507
523
|
}
|
|
508
524
|
|
|
509
|
-
export { type ApproveHostedOptions, type ApproveHostedResult, ApprovePhoneChangeInput, ApprovePhoneChangeResult, ApproveResult, BalanceResult, CallOptions, CheckoutClient, CheckoutClientConfig, CheckoutMountHandle, ClientConfig, ConfirmReceiptResult, DestinationsQuery, DestinationsResult, EnrollmentBeginResult, type EnrollmentDecision, type EnrollmentRespond, EnrollmentVerifyResult, type HostedApprovalStatus, type HostedEnrollment, type HostedEnrollmentInput, type HostedFlow, InvoClient, LinkDeviceResult, LoyaltyCardsResult, LoyaltyVaultResult, MountCheckoutOptions, PendingCollectResult, PhoneChangeApprovalsResult, PlatformCommerceClient, PurchaseCredited, PurchaseExpired, PurchaseRefunded, PurchaseRefused, PurchaseStatusInput, PurchaseStatusResult, RecoveryBeginResult, RecoveryCompleteResult, RedeemRewardResult, RewardsPageLink, WaitForPurchaseInput, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage };
|
|
525
|
+
export { type ApproveHostedOptions, type ApproveHostedResult, ApprovePhoneChangeInput, ApprovePhoneChangeResult, ApproveResult, BalanceResult, CallOptions, CheckoutClient, CheckoutClientConfig, CheckoutMountHandle, ClientConfig, ConfirmReceiptResult, DestinationsQuery, DestinationsResult, EnrollmentBeginResult, type EnrollmentDecision, type EnrollmentRespond, EnrollmentVerifyResult, type HostedApprovalStatus, type HostedEnrollment, type HostedEnrollmentInput, type HostedFlow, InvoClient, LinkDeviceResult, LoyaltyCardsResult, LoyaltyVaultResult, MountCheckoutOptions, PendingCollectResult, PhoneChangeApprovalsResult, PlatformCommerceClient, PurchaseCredited, PurchaseExpired, PurchaseRefunded, PurchaseRefused, PurchaseStatusInput, PurchaseStatusResult, RecoveryBeginResult, RecoveryCompleteResult, RedeemRewardResult, ReportGameEventInput, ReportGameEventResult, RewardsPageLink, WaitForPurchaseInput, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { assertSecureBaseUrl, Http, toPhoneChangeApprovalsResult, phoneChangeSignalMessage, toApprovePhoneChangeResult, toDestinationsResult, toLoyaltyCardsResult, toLoyaltyVaultResult, toRedeemRewardResult, toRewardsPageLink, receiptFields } from './chunk-6CN236QH.js';
|
|
2
|
+
export { phoneChangeSignalMessage } from './chunk-6CN236QH.js';
|
|
3
|
+
import { InvoError, buildGameEventBody, toReportGameEventResult } from './chunk-VP3OK4J4.js';
|
|
4
|
+
export { InvoError } from './chunk-VP3OK4J4.js';
|
|
3
5
|
|
|
4
6
|
// src/shared/webauthn.ts
|
|
5
7
|
function malformedOptions(field) {
|
|
@@ -1429,6 +1431,28 @@ var InvoClient = class {
|
|
|
1429
1431
|
return toRewardsPageLink(raw);
|
|
1430
1432
|
});
|
|
1431
1433
|
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Report a gameplay event for the signed-in player to INVO's loyalty engine
|
|
1436
|
+
* (`POST /api/sdk/loyalty/events`, player token). Use it for sessions, milestones and
|
|
1437
|
+
* registered custom events (see {@link GameEventType}). Events your SERVER reports with
|
|
1438
|
+
* `InvoServer.reportGameEvent` are the ones trusted for rewards; prefer those when a
|
|
1439
|
+
* reward depends on the event.
|
|
1440
|
+
*
|
|
1441
|
+
* Pass your own `eventId` (a UUID) or reuse the returned one if you retry, so INVO counts
|
|
1442
|
+
* the event once. Not auto-retried from the browser.
|
|
1443
|
+
*
|
|
1444
|
+
* Refusals: `INVALID_INPUT` before the network (non-`game.*` type, malformed `eventId`,
|
|
1445
|
+
* `occurredAt` without a timezone, non-object payload); `400 RESERVED_EVENT_TYPE` /
|
|
1446
|
+
* `EVENT_TYPE_NOT_ALLOWED`; `401 SDK_TOKEN_MISSING` / `SDK_TOKEN_WRONG_SCOPE`;
|
|
1447
|
+
* `422 validation_failed`.
|
|
1448
|
+
*/
|
|
1449
|
+
async reportGameEvent(input, opts) {
|
|
1450
|
+
const { body, eventId } = buildGameEventBody(input);
|
|
1451
|
+
return this.withTokenRetry(async () => {
|
|
1452
|
+
const raw = await this.post("/api/sdk/loyalty/events", body, opts?.signal);
|
|
1453
|
+
return toReportGameEventResult(raw ?? {}, eventId);
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1432
1456
|
/**
|
|
1433
1457
|
* First-enrollment OTP grant (§4.2). When `enrollPasskey()` throws
|
|
1434
1458
|
* `ENROLLMENT_REQUIRES_AUTHORIZATION` (`err.isEnrollmentAuthorizationRequired`), call
|
package/dist/server.cjs
CHANGED
|
@@ -1469,6 +1469,71 @@ function toLoyaltyCardsResult(raw) {
|
|
|
1469
1469
|
};
|
|
1470
1470
|
}
|
|
1471
1471
|
|
|
1472
|
+
// src/shared/loyalty-events.ts
|
|
1473
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
1474
|
+
var ISO_WITH_ZONE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})$/;
|
|
1475
|
+
function invalid(label, value, why) {
|
|
1476
|
+
return new InvoError({
|
|
1477
|
+
message: `${label} ${why} (got ${JSON.stringify(value)}).`,
|
|
1478
|
+
code: "INVALID_INPUT",
|
|
1479
|
+
status: 0
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
function newEventId() {
|
|
1483
|
+
const c = globalThis.crypto;
|
|
1484
|
+
if (c && typeof c.randomUUID === "function") return c.randomUUID();
|
|
1485
|
+
const bytes = new Uint8Array(16);
|
|
1486
|
+
if (c && typeof c.getRandomValues === "function") {
|
|
1487
|
+
c.getRandomValues(bytes);
|
|
1488
|
+
} else {
|
|
1489
|
+
throw new InvoError({
|
|
1490
|
+
message: "No Web Crypto available to generate an eventId; pass `eventId` yourself.",
|
|
1491
|
+
code: "INVALID_INPUT",
|
|
1492
|
+
status: 0
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
1496
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
1497
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
1498
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
1499
|
+
}
|
|
1500
|
+
function buildGameEventBody(input) {
|
|
1501
|
+
if (!input || typeof input !== "object") throw invalid("input", input, "must be an object");
|
|
1502
|
+
const { eventType, payload } = input;
|
|
1503
|
+
if (typeof eventType !== "string" || !eventType.startsWith("game.") || eventType.length > 120) {
|
|
1504
|
+
throw invalid("eventType", eventType, "must be a game.* event type");
|
|
1505
|
+
}
|
|
1506
|
+
const eventId = input.eventId === void 0 ? newEventId() : input.eventId;
|
|
1507
|
+
if (typeof eventId !== "string" || !UUID.test(eventId)) {
|
|
1508
|
+
throw invalid("eventId", eventId, "must be a UUID");
|
|
1509
|
+
}
|
|
1510
|
+
const body = { event_type: eventType, event_id: eventId };
|
|
1511
|
+
if (input.occurredAt !== void 0) {
|
|
1512
|
+
const at = input.occurredAt instanceof Date ? input.occurredAt.toISOString() : input.occurredAt;
|
|
1513
|
+
if (typeof at !== "string" || !ISO_WITH_ZONE.test(at) || Number.isNaN(Date.parse(at))) {
|
|
1514
|
+
throw invalid("occurredAt", input.occurredAt, "must be ISO 8601 with a timezone, or a Date");
|
|
1515
|
+
}
|
|
1516
|
+
body["occurred_at"] = at;
|
|
1517
|
+
}
|
|
1518
|
+
if (payload !== void 0) {
|
|
1519
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
1520
|
+
throw invalid("payload", payload, "must be a plain object");
|
|
1521
|
+
}
|
|
1522
|
+
body["payload"] = payload;
|
|
1523
|
+
} else {
|
|
1524
|
+
body["payload"] = {};
|
|
1525
|
+
}
|
|
1526
|
+
return { body, eventId };
|
|
1527
|
+
}
|
|
1528
|
+
function toReportGameEventResult(raw, eventId) {
|
|
1529
|
+
const echoed = raw["event_id"];
|
|
1530
|
+
return {
|
|
1531
|
+
accepted: true,
|
|
1532
|
+
eventId: typeof echoed === "string" && echoed ? echoed : eventId,
|
|
1533
|
+
raw
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1472
1537
|
// src/shared/receipt-fields.ts
|
|
1473
1538
|
function creditFields(raw) {
|
|
1474
1539
|
const c = raw["credited"];
|
|
@@ -1528,7 +1593,7 @@ function toPhoneChangeRequest(raw) {
|
|
|
1528
1593
|
}
|
|
1529
1594
|
|
|
1530
1595
|
// src/version.ts
|
|
1531
|
-
var SDK_VERSION = "3.
|
|
1596
|
+
var SDK_VERSION = "3.27.0";
|
|
1532
1597
|
|
|
1533
1598
|
// src/payouts.ts
|
|
1534
1599
|
var AMOUNT = /^\d+(\.\d{1,2})?$/;
|
|
@@ -4554,6 +4619,37 @@ var InvoServer = class {
|
|
|
4554
4619
|
);
|
|
4555
4620
|
return toLoyaltyCardsResult(raw);
|
|
4556
4621
|
}
|
|
4622
|
+
/**
|
|
4623
|
+
* Report a gameplay event for one player to INVO's loyalty engine from your SERVER
|
|
4624
|
+
* (`POST /api/sdk/loyalty/server-events`, game secret). Server-reported events are the
|
|
4625
|
+
* ones trusted for rewards. Use it for sessions, level milestones and custom events
|
|
4626
|
+
* registered in the console (see {@link GameEventType}); currency steps are tracked by
|
|
4627
|
+
* INVO itself and are never reported.
|
|
4628
|
+
*
|
|
4629
|
+
* Idempotent on `eventId`: pass your own UUID, or let the SDK generate one, and reuse the
|
|
4630
|
+
* returned `eventId` if you retry. Transient failures (429, 5xx) are retried with it.
|
|
4631
|
+
*
|
|
4632
|
+
* Refusals (all `InvoError`): `INVALID_INPUT` before the network for a non-`game.*` type,
|
|
4633
|
+
* a malformed `eventId`, an `occurredAt` without a timezone or a non-object payload;
|
|
4634
|
+
* `400 RESERVED_EVENT_TYPE` / `EVENT_TYPE_NOT_ALLOWED`; `401 INVALID_GAME_SECRET`;
|
|
4635
|
+
* `404 PLAYER_NOT_FOUND` (`err.isPlayerNotFound`); `422 validation_failed` (for example an
|
|
4636
|
+
* unregistered `event_name`).
|
|
4637
|
+
*/
|
|
4638
|
+
async reportGameEvent(input, opts) {
|
|
4639
|
+
if (!input || typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
4640
|
+
throw invalidInput2("playerEmail", input?.playerEmail, "is required");
|
|
4641
|
+
}
|
|
4642
|
+
const { body, eventId } = buildGameEventBody(input);
|
|
4643
|
+
body["player_email"] = input.playerEmail.trim();
|
|
4644
|
+
const raw = await this.http.post(
|
|
4645
|
+
"/api/sdk/loyalty/server-events",
|
|
4646
|
+
body,
|
|
4647
|
+
this.auth,
|
|
4648
|
+
// event_id makes this safe to retry: INVO counts one event per id.
|
|
4649
|
+
{ idempotent: true, signal: opts?.signal }
|
|
4650
|
+
);
|
|
4651
|
+
return toReportGameEventResult(raw ?? {}, eventId);
|
|
4652
|
+
}
|
|
4557
4653
|
/**
|
|
4558
4654
|
* List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
|
|
4559
4655
|
* the source of truth for a "you have X to collect" badge. Pass the player's email
|
package/dist/server.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { I as InvoError, H as Http,
|
|
2
|
-
export {
|
|
1
|
+
import { I as InvoError, H as Http, a2 as AuthHeader, g as CallOptions, a3 as PlatformPurchaseInput, a4 as PlatformPurchaseResult, a5 as PlatformOrderStatusResult, a6 as PlatformPurchaseHistoryQuery, a7 as PlatformPurchaseHistoryResult, a8 as PlatformRefundInput, a9 as PlatformRefundResult, aa as CreateSubscriptionInput, ab as SubscriptionResult, ac as GetSubscriptionOptions, ad as GetSubscriptionResult, ae as ListSubscriptionsOptions, af as SubscriptionListResult, ag as CancelSubscriptionOptions, ah as CancelResult, ai as ChangeAmountResult, aj as SetPaymentMethodInput, ak as SetPaymentMethodResult, al as RefundSubscriptionInput, am as RefundResult, an as SteamSubscriptionInitInput, ao as SteamInitResult, ap as SteamFinalizeSubscriptionResult, aq as CardSetupSessionInput, ar as CardSetupSessionResult, as as CardSetupInput, at as CardSetupResult, au as CardSetupConfirmInput, av as CardSetupConfirmResult, aw as PlayerCardsResult, ax as SandboxClockResult, ay as SandboxFailureOutcome, az as SandboxForceFailureOptions, aA as SandboxForceAuthChallengeOptions, aB as ServerConfig, aC as MintPlayerTokenInput, aD as PlayerToken, aE as RegisterPlayerInput, aF as RegisterPlayerResult, aG as UpdatePlayerPhoneInput, aH as UpdatePlayerPhoneResult, aI as RequestPhoneChangeInput, aJ as RequestPhoneChangeResult, aK as PhoneChangeRequest, aL as InitiateSendInput, aM as InitiateResult, aN as InitiateTransferInput, aO as CreateCheckoutInput, aP as CreateCheckoutResult, aQ as PurchaseInput, aR as PurchaseResult, aS as CurrencyPurchaseQuoteInput, aT as CurrencyPurchaseQuote, aU as ConfirmPaymentResult, aV as OrderDetailsResult, aW as SteamPacksQuery, aX as SteamPacksResult, aY as SteamInitPurchaseInput, aZ as SteamInitPurchaseResult, a_ as SteamFinalizeInput, a$ as SteamFinalizeResult, b0 as PurchaseItemInput, b1 as PurchaseItemResult, b2 as ItemHistoryQuery, b3 as ItemHistoryResult, b4 as ItemOrderQuery, b5 as PlayerActivityQuery, b6 as PlayerActivityResult, b7 as PlayerActivityEntry, b8 as PlayerBalanceQuery, b9 as PlayerBalanceResult, o as LoyaltyCardsResult, ba as ReportServerGameEventInput, s as ReportGameEventResult, bb as InboundPendingQuery, bc as InboundPendingResult, bd as LinkedIdentitiesQuery, be as LinkedIdentitiesResult, bf as SmsVerifyResult, bg as ClaimTransferInput, bh as ClaimResult, bi as ClaimCurrencyInput, bj as TransactionStatusResult, bk as GuardianApprovalStatusResult, bl as ServerDestinationsQuery, n as DestinationsResult, bm as PhoneShareContact, bn as PhoneShareInitiateResult, bo as PhoneShareApproveInput, bp as PhoneShareApproveResult, bq as PhoneShareStatusResult, br as BeginDeviceApprovalInput, bs as DeviceApprovalGrant, bt as PollDeviceApprovalInput, bu as DeviceApprovalPollResult, bv as ConfirmDeviceEnrollmentInput, bw as ConfirmDeviceEnrollmentResult, bx as ApproveWithDeviceCodeInput, by as DeviceApprovalSettleResult, bz as CompleteDeviceApprovalInput, bA as CompleteDeviceApprovalResult } from './types-_lIm74kd.cjs';
|
|
2
|
+
export { bB as CardSetupStatus, bC as CheckoutWarning, y as ClaimDelivery, bD as CurrencyBalance, bE as CurrencyPurchaseQuoteBreakdown, z as DestinationGame, bF as DeviceApprovalChannel, bG as DeviceApprovalEnrollment, bH as DeviceApprovalFlow, bI as DeviceApprovalPollStatus, bJ as DeviceEnrollmentDecision, bK as DeviceEnrollmentRespond, bL as ExpiryReason, bM as FeeTakenFrom, bN as FirstCharge, bO as FirstChargeStatus, bP as FundingSource, G as GameEventType, bQ as InboundPendingItem, F as InvoErrorInfo, J as InvoHooks, K as InvoRequestInfo, N as InvoResponseInfo, bR as LinkedIdentityEmail, O as LoyaltyCard, Q as LoyaltyCardReward, S as LoyaltyCardStep, T as LoyaltyRewardState, U as LoyaltyStepProgress, V as LoyaltyStepState, bS as MinPurchaseWarning, bT as PhoneChangeConfirmation, bU as PhoneChangeRequestStatus, bV as PlatformPurchaseStatus, bW as PlayerActivityType, a0 as Rail, bX as RefundInitiation, bY as RefundPendingApproval, bZ as RefundProcessingFeeBasis, b_ as RefundReceipt, b$ as RefundRevenueShareAttribution, c0 as RefundWarning, r as ReportGameEventInput, c1 as SandboxClockState, c2 as SavedCard, c3 as SteamPack, c4 as SteamUserSession, c5 as Subscription, c6 as SubscriptionBaseInput, c7 as SubscriptionConsent, c8 as SubscriptionConsentInput, c9 as SubscriptionFundingRail, ca as SubscriptionInterval, cb as SubscriptionRevenueShare, cc as SubscriptionRevenueShareInput, cd as SubscriptionStatus, ce as UnacknowledgedPurchaseOutcome, a1 as VerificationMethod, cf as isRefundPendingApproval } from './types-_lIm74kd.cjs';
|
|
3
|
+
export { S as SDK_VERSION } from './version-BXFwI0-s.cjs';
|
|
3
4
|
|
|
4
5
|
interface VerifyWebhookOptions {
|
|
5
6
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -1108,13 +1109,6 @@ declare class PayoutsServer {
|
|
|
1108
1109
|
cancelPayout(payoutIdValue: number, opts?: CallOptions): Promise<Payout>;
|
|
1109
1110
|
}
|
|
1110
1111
|
|
|
1111
|
-
/**
|
|
1112
|
-
* The package version, as sent in the server User-Agent. A test pins this to
|
|
1113
|
-
* `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
|
|
1114
|
-
* Bump it with the changeset flow.
|
|
1115
|
-
*/
|
|
1116
|
-
declare const SDK_VERSION = "3.26.1";
|
|
1117
|
-
|
|
1118
1112
|
/**
|
|
1119
1113
|
* @invonetwork/web-sdk/server — NODE entry.
|
|
1120
1114
|
*
|
|
@@ -1900,6 +1894,23 @@ declare class InvoServer {
|
|
|
1900
1894
|
* timed out): retry later. A GET, so transient failures are retried automatically.
|
|
1901
1895
|
*/
|
|
1902
1896
|
getPlayerRewards(playerEmail: string, opts?: CallOptions): Promise<LoyaltyCardsResult>;
|
|
1897
|
+
/**
|
|
1898
|
+
* Report a gameplay event for one player to INVO's loyalty engine from your SERVER
|
|
1899
|
+
* (`POST /api/sdk/loyalty/server-events`, game secret). Server-reported events are the
|
|
1900
|
+
* ones trusted for rewards. Use it for sessions, level milestones and custom events
|
|
1901
|
+
* registered in the console (see {@link GameEventType}); currency steps are tracked by
|
|
1902
|
+
* INVO itself and are never reported.
|
|
1903
|
+
*
|
|
1904
|
+
* Idempotent on `eventId`: pass your own UUID, or let the SDK generate one, and reuse the
|
|
1905
|
+
* returned `eventId` if you retry. Transient failures (429, 5xx) are retried with it.
|
|
1906
|
+
*
|
|
1907
|
+
* Refusals (all `InvoError`): `INVALID_INPUT` before the network for a non-`game.*` type,
|
|
1908
|
+
* a malformed `eventId`, an `occurredAt` without a timezone or a non-object payload;
|
|
1909
|
+
* `400 RESERVED_EVENT_TYPE` / `EVENT_TYPE_NOT_ALLOWED`; `401 INVALID_GAME_SECRET`;
|
|
1910
|
+
* `404 PLAYER_NOT_FOUND` (`err.isPlayerNotFound`); `422 validation_failed` (for example an
|
|
1911
|
+
* unregistered `event_name`).
|
|
1912
|
+
*/
|
|
1913
|
+
reportGameEvent(input: ReportServerGameEventInput, opts?: CallOptions): Promise<ReportGameEventResult>;
|
|
1903
1914
|
/**
|
|
1904
1915
|
* List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
|
|
1905
1916
|
* the source of truth for a "you have X to collect" badge. Pass the player's email
|
|
@@ -2113,4 +2124,4 @@ declare class InvoServer {
|
|
|
2113
2124
|
private toInitiateResult;
|
|
2114
2125
|
}
|
|
2115
2126
|
|
|
2116
|
-
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, type IdentityPasskeyResetData, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, type ListPayeesQuery, type ListPayeesResult, type ListPayoutsQuery, type ListPayoutsResult, ListSubscriptionsOptions, LoyaltyCardsResult, MintPlayerTokenInput, OrderDetailsResult, type PayableBlocker, type Payee, type PayeeInvite, type PayeeStatus, type PayeeStatusChangedData, type Payout, type PayoutStatus, type PayoutStatusChangedData, PayoutsServer, PhoneChangeRequest, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseHistoryQuery, PlatformPurchaseHistoryResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerActivityEntry, PlayerActivityQuery, PlayerActivityResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, type PlayerPhoneChangedData, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, type RegisterPayeeInput, type RegisterPayeeResult, RegisterPlayerInput, RegisterPlayerResult, type RequestPayoutInput, type RequestPayoutResult, RequestPhoneChangeInput, RequestPhoneChangeResult, type ReturnReasonCode,
|
|
2127
|
+
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, type IdentityPasskeyResetData, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, type ListPayeesQuery, type ListPayeesResult, type ListPayoutsQuery, type ListPayoutsResult, ListSubscriptionsOptions, LoyaltyCardsResult, MintPlayerTokenInput, OrderDetailsResult, type PayableBlocker, type Payee, type PayeeInvite, type PayeeStatus, type PayeeStatusChangedData, type Payout, type PayoutStatus, type PayoutStatusChangedData, PayoutsServer, PhoneChangeRequest, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseHistoryQuery, PlatformPurchaseHistoryResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerActivityEntry, PlayerActivityQuery, PlayerActivityResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, type PlayerPhoneChangedData, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, type RegisterPayeeInput, type RegisterPayeeResult, RegisterPlayerInput, RegisterPlayerResult, ReportGameEventResult, ReportServerGameEventInput, type RequestPayoutInput, type RequestPayoutResult, RequestPhoneChangeInput, RequestPhoneChangeResult, type ReturnReasonCode, 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,5 +1,6 @@
|
|
|
1
|
-
import { I as InvoError, H as Http,
|
|
2
|
-
export {
|
|
1
|
+
import { I as InvoError, H as Http, a2 as AuthHeader, g as CallOptions, a3 as PlatformPurchaseInput, a4 as PlatformPurchaseResult, a5 as PlatformOrderStatusResult, a6 as PlatformPurchaseHistoryQuery, a7 as PlatformPurchaseHistoryResult, a8 as PlatformRefundInput, a9 as PlatformRefundResult, aa as CreateSubscriptionInput, ab as SubscriptionResult, ac as GetSubscriptionOptions, ad as GetSubscriptionResult, ae as ListSubscriptionsOptions, af as SubscriptionListResult, ag as CancelSubscriptionOptions, ah as CancelResult, ai as ChangeAmountResult, aj as SetPaymentMethodInput, ak as SetPaymentMethodResult, al as RefundSubscriptionInput, am as RefundResult, an as SteamSubscriptionInitInput, ao as SteamInitResult, ap as SteamFinalizeSubscriptionResult, aq as CardSetupSessionInput, ar as CardSetupSessionResult, as as CardSetupInput, at as CardSetupResult, au as CardSetupConfirmInput, av as CardSetupConfirmResult, aw as PlayerCardsResult, ax as SandboxClockResult, ay as SandboxFailureOutcome, az as SandboxForceFailureOptions, aA as SandboxForceAuthChallengeOptions, aB as ServerConfig, aC as MintPlayerTokenInput, aD as PlayerToken, aE as RegisterPlayerInput, aF as RegisterPlayerResult, aG as UpdatePlayerPhoneInput, aH as UpdatePlayerPhoneResult, aI as RequestPhoneChangeInput, aJ as RequestPhoneChangeResult, aK as PhoneChangeRequest, aL as InitiateSendInput, aM as InitiateResult, aN as InitiateTransferInput, aO as CreateCheckoutInput, aP as CreateCheckoutResult, aQ as PurchaseInput, aR as PurchaseResult, aS as CurrencyPurchaseQuoteInput, aT as CurrencyPurchaseQuote, aU as ConfirmPaymentResult, aV as OrderDetailsResult, aW as SteamPacksQuery, aX as SteamPacksResult, aY as SteamInitPurchaseInput, aZ as SteamInitPurchaseResult, a_ as SteamFinalizeInput, a$ as SteamFinalizeResult, b0 as PurchaseItemInput, b1 as PurchaseItemResult, b2 as ItemHistoryQuery, b3 as ItemHistoryResult, b4 as ItemOrderQuery, b5 as PlayerActivityQuery, b6 as PlayerActivityResult, b7 as PlayerActivityEntry, b8 as PlayerBalanceQuery, b9 as PlayerBalanceResult, o as LoyaltyCardsResult, ba as ReportServerGameEventInput, s as ReportGameEventResult, bb as InboundPendingQuery, bc as InboundPendingResult, bd as LinkedIdentitiesQuery, be as LinkedIdentitiesResult, bf as SmsVerifyResult, bg as ClaimTransferInput, bh as ClaimResult, bi as ClaimCurrencyInput, bj as TransactionStatusResult, bk as GuardianApprovalStatusResult, bl as ServerDestinationsQuery, n as DestinationsResult, bm as PhoneShareContact, bn as PhoneShareInitiateResult, bo as PhoneShareApproveInput, bp as PhoneShareApproveResult, bq as PhoneShareStatusResult, br as BeginDeviceApprovalInput, bs as DeviceApprovalGrant, bt as PollDeviceApprovalInput, bu as DeviceApprovalPollResult, bv as ConfirmDeviceEnrollmentInput, bw as ConfirmDeviceEnrollmentResult, bx as ApproveWithDeviceCodeInput, by as DeviceApprovalSettleResult, bz as CompleteDeviceApprovalInput, bA as CompleteDeviceApprovalResult } from './types-_lIm74kd.js';
|
|
2
|
+
export { bB as CardSetupStatus, bC as CheckoutWarning, y as ClaimDelivery, bD as CurrencyBalance, bE as CurrencyPurchaseQuoteBreakdown, z as DestinationGame, bF as DeviceApprovalChannel, bG as DeviceApprovalEnrollment, bH as DeviceApprovalFlow, bI as DeviceApprovalPollStatus, bJ as DeviceEnrollmentDecision, bK as DeviceEnrollmentRespond, bL as ExpiryReason, bM as FeeTakenFrom, bN as FirstCharge, bO as FirstChargeStatus, bP as FundingSource, G as GameEventType, bQ as InboundPendingItem, F as InvoErrorInfo, J as InvoHooks, K as InvoRequestInfo, N as InvoResponseInfo, bR as LinkedIdentityEmail, O as LoyaltyCard, Q as LoyaltyCardReward, S as LoyaltyCardStep, T as LoyaltyRewardState, U as LoyaltyStepProgress, V as LoyaltyStepState, bS as MinPurchaseWarning, bT as PhoneChangeConfirmation, bU as PhoneChangeRequestStatus, bV as PlatformPurchaseStatus, bW as PlayerActivityType, a0 as Rail, bX as RefundInitiation, bY as RefundPendingApproval, bZ as RefundProcessingFeeBasis, b_ as RefundReceipt, b$ as RefundRevenueShareAttribution, c0 as RefundWarning, r as ReportGameEventInput, c1 as SandboxClockState, c2 as SavedCard, c3 as SteamPack, c4 as SteamUserSession, c5 as Subscription, c6 as SubscriptionBaseInput, c7 as SubscriptionConsent, c8 as SubscriptionConsentInput, c9 as SubscriptionFundingRail, ca as SubscriptionInterval, cb as SubscriptionRevenueShare, cc as SubscriptionRevenueShareInput, cd as SubscriptionStatus, ce as UnacknowledgedPurchaseOutcome, a1 as VerificationMethod, cf as isRefundPendingApproval } from './types-_lIm74kd.js';
|
|
3
|
+
export { S as SDK_VERSION } from './version-BXFwI0-s.js';
|
|
3
4
|
|
|
4
5
|
interface VerifyWebhookOptions {
|
|
5
6
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -1108,13 +1109,6 @@ declare class PayoutsServer {
|
|
|
1108
1109
|
cancelPayout(payoutIdValue: number, opts?: CallOptions): Promise<Payout>;
|
|
1109
1110
|
}
|
|
1110
1111
|
|
|
1111
|
-
/**
|
|
1112
|
-
* The package version, as sent in the server User-Agent. A test pins this to
|
|
1113
|
-
* `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
|
|
1114
|
-
* Bump it with the changeset flow.
|
|
1115
|
-
*/
|
|
1116
|
-
declare const SDK_VERSION = "3.26.1";
|
|
1117
|
-
|
|
1118
1112
|
/**
|
|
1119
1113
|
* @invonetwork/web-sdk/server — NODE entry.
|
|
1120
1114
|
*
|
|
@@ -1900,6 +1894,23 @@ declare class InvoServer {
|
|
|
1900
1894
|
* timed out): retry later. A GET, so transient failures are retried automatically.
|
|
1901
1895
|
*/
|
|
1902
1896
|
getPlayerRewards(playerEmail: string, opts?: CallOptions): Promise<LoyaltyCardsResult>;
|
|
1897
|
+
/**
|
|
1898
|
+
* Report a gameplay event for one player to INVO's loyalty engine from your SERVER
|
|
1899
|
+
* (`POST /api/sdk/loyalty/server-events`, game secret). Server-reported events are the
|
|
1900
|
+
* ones trusted for rewards. Use it for sessions, level milestones and custom events
|
|
1901
|
+
* registered in the console (see {@link GameEventType}); currency steps are tracked by
|
|
1902
|
+
* INVO itself and are never reported.
|
|
1903
|
+
*
|
|
1904
|
+
* Idempotent on `eventId`: pass your own UUID, or let the SDK generate one, and reuse the
|
|
1905
|
+
* returned `eventId` if you retry. Transient failures (429, 5xx) are retried with it.
|
|
1906
|
+
*
|
|
1907
|
+
* Refusals (all `InvoError`): `INVALID_INPUT` before the network for a non-`game.*` type,
|
|
1908
|
+
* a malformed `eventId`, an `occurredAt` without a timezone or a non-object payload;
|
|
1909
|
+
* `400 RESERVED_EVENT_TYPE` / `EVENT_TYPE_NOT_ALLOWED`; `401 INVALID_GAME_SECRET`;
|
|
1910
|
+
* `404 PLAYER_NOT_FOUND` (`err.isPlayerNotFound`); `422 validation_failed` (for example an
|
|
1911
|
+
* unregistered `event_name`).
|
|
1912
|
+
*/
|
|
1913
|
+
reportGameEvent(input: ReportServerGameEventInput, opts?: CallOptions): Promise<ReportGameEventResult>;
|
|
1903
1914
|
/**
|
|
1904
1915
|
* List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
|
|
1905
1916
|
* the source of truth for a "you have X to collect" badge. Pass the player's email
|
|
@@ -2113,4 +2124,4 @@ declare class InvoServer {
|
|
|
2113
2124
|
private toInitiateResult;
|
|
2114
2125
|
}
|
|
2115
2126
|
|
|
2116
|
-
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, type IdentityPasskeyResetData, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, type ListPayeesQuery, type ListPayeesResult, type ListPayoutsQuery, type ListPayoutsResult, ListSubscriptionsOptions, LoyaltyCardsResult, MintPlayerTokenInput, OrderDetailsResult, type PayableBlocker, type Payee, type PayeeInvite, type PayeeStatus, type PayeeStatusChangedData, type Payout, type PayoutStatus, type PayoutStatusChangedData, PayoutsServer, PhoneChangeRequest, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseHistoryQuery, PlatformPurchaseHistoryResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerActivityEntry, PlayerActivityQuery, PlayerActivityResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, type PlayerPhoneChangedData, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, type RegisterPayeeInput, type RegisterPayeeResult, RegisterPlayerInput, RegisterPlayerResult, type RequestPayoutInput, type RequestPayoutResult, RequestPhoneChangeInput, RequestPhoneChangeResult, type ReturnReasonCode,
|
|
2127
|
+
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, type IdentityPasskeyResetData, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, LinkedIdentitiesQuery, LinkedIdentitiesResult, type ListPayeesQuery, type ListPayeesResult, type ListPayoutsQuery, type ListPayoutsResult, ListSubscriptionsOptions, LoyaltyCardsResult, MintPlayerTokenInput, OrderDetailsResult, type PayableBlocker, type Payee, type PayeeInvite, type PayeeStatus, type PayeeStatusChangedData, type Payout, type PayoutStatus, type PayoutStatusChangedData, PayoutsServer, PhoneChangeRequest, PhoneShareApproveInput, PhoneShareApproveResult, PhoneShareContact, PhoneShareInitiateResult, PhoneShareStatusResult, type PlatformCommercePurchasedData, type PlatformCommerceRefundedData, PlatformCommerceServer, PlatformOrderStatusResult, PlatformPurchaseHistoryQuery, PlatformPurchaseHistoryResult, PlatformPurchaseInput, PlatformPurchaseResult, PlatformRefundInput, PlatformRefundResult, PlayerActivityEntry, PlayerActivityQuery, PlayerActivityResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerCardsResult, type PlayerPhoneChangedData, PlayerToken, PollDeviceApprovalInput, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, RefundResult, RefundSubscriptionInput, type RegisterPayeeInput, type RegisterPayeeResult, RegisterPlayerInput, RegisterPlayerResult, ReportGameEventResult, ReportServerGameEventInput, type RequestPayoutInput, type RequestPayoutResult, RequestPhoneChangeInput, RequestPhoneChangeResult, type ReturnReasonCode, 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 };
|