@indiegems/gem-web-sdk 23.3.0 → 24.0.1
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 +40 -1
- package/dist/conformance.d.ts +5 -2
- package/dist/function.d.ts +22 -1
- package/dist/game.d.ts +1588 -1466
- package/dist/gem-web-sdk.bridge.js +2 -2
- package/dist/gem-web-sdk.conformance.js +3 -3
- package/dist/gem-web-sdk.esm.js +3 -3
- package/dist/gem-web-sdk.function.js +3 -3
- package/dist/gem-web-sdk.game.js +3 -3
- package/dist/gem-web-sdk.min.js +3 -3
- package/dist/gem-web-sdk.sdk.js +3 -3
- package/dist/gem-web-sdk.server.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/sdk.d.ts +1598 -1464
- package/dist/server.d.ts +44 -1
- package/docs/api/api-reference-function.md +194 -44
- package/docs/api/api-reference-game.md +722 -32
- package/docs/api/api-reference-server.md +477 -3
- package/docs/api/reference.json +1786 -99
- package/docs/arcade-and-store.md +166 -63
- package/docs/arcade-economy.md +184 -184
- package/docs/changelog.md +40 -1
- package/docs/deprecation-policy.md +2 -0
- package/docs/getting-started.md +1 -1
- package/docs/inventory-and-catalogs.md +247 -76
- package/docs/manifest.json +20 -20
- package/docs/platform-rules.md +36 -27
- package/docs/player-sign-in.md +20 -11
- package/docs/rewarded-ads.md +1 -1
- package/docs/server-bundles.md +9 -7
- package/package.json +1 -1
- package/schema/bridge.v1.json +56 -7
package/CHANGELOG.md
CHANGED
|
@@ -8,13 +8,52 @@ Each release states its impact on a game that upgrades to it:
|
|
|
8
8
|
- **recommended**: nothing should break, but something is worth acting on: a type to rebuild against, a deprecation, or work you may stop doing.
|
|
9
9
|
- **none**: upgrading asks nothing of a game.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
A release opens with a short summary of what it is about, and its entries are grouped under up to six headings:
|
|
12
12
|
|
|
13
13
|
- **Must change**: code or behaviour a game has to change, or it stops compiling or stops working.
|
|
14
14
|
- **Should change**: something is deprecated. It keeps working for now; move off it before it is removed.
|
|
15
15
|
- **May stop**: work a game can drop, because the SDK or the Arcade now does it.
|
|
16
16
|
- **Rebuild**: a type changed. Recompile against the new version; code that compiles today keeps compiling unless the entry says otherwise.
|
|
17
17
|
- **New capability**: something a game can now do. Nothing changes unless you use it.
|
|
18
|
+
- **Fixes and improvements**: bugs fixed and behaviour improved without a change to the API. Nothing to change in your game.
|
|
19
|
+
|
|
20
|
+
## 24.0.1
|
|
21
|
+
|
|
22
|
+
Upgrading from 24.0.0. Impact: none.
|
|
23
|
+
|
|
24
|
+
This release has no public API changes, so there is nothing to change in your game and no reason to rebuild. The commits only touch the SDK's release tooling and vendored test data.
|
|
25
|
+
|
|
26
|
+
Nothing in this release asks anything of a game.
|
|
27
|
+
|
|
28
|
+
## 24.0.0
|
|
29
|
+
|
|
30
|
+
Upgrading from 23.3.0. Impact: required.
|
|
31
|
+
|
|
32
|
+
### Must change
|
|
33
|
+
|
|
34
|
+
- Stop using the store offers call answering sign_in_required as a test for a guest. A current Arcade now answers a guest with ok, because a guest can buy. Use GemPlayer.isGuest instead. It is true only when the Arcade says the player is a guest who can sign up here, and false for a full account, for a surface with no sign-up, and for an older Arcade that does not say. It follows a guest who signs up in place.
|
|
35
|
+
- Check any code that branches on the offer kind. ArcadeOffer.kind is now typed as ArcadeOfferKind, and a pack of a platform currency other than GEMS is reported as coin_pack rather than gem_pack. The gem_pack value is deprecated. Handle coin_pack wherever you handle gem_pack, or such packs will fall through your branches.
|
|
36
|
+
- If your tests run the parent conformance kit against an Arcade host or a stand-in for one, update them for kit version 9. The version constant moved from 8 to 9, there is a new storeScenario member on the parent under test, and there are six new pass cases. Supply a store scenario so those cases can run.
|
|
37
|
+
|
|
38
|
+
### Should change
|
|
39
|
+
|
|
40
|
+
- GamePass.endsAt is deprecated on the browser, function and server halves. An exact end instant is a value two games could match to link one player's identities, so the platform will stop sending it and it will read null. Move to GamePass.daysLeft, which gives whole days remaining, capped at 7. A known guest is answered as not holding the pass. See [the deprecation policy](docs/deprecation-policy.md#4-what-is-deprecated-today).
|
|
41
|
+
|
|
42
|
+
### May stop
|
|
43
|
+
|
|
44
|
+
- If your game works out expected rewards or the effect of a player's boost by hand, you can drop that arithmetic. The config preview now computes the multiplier, platform grants with their rounding, and bonus eligibility for you.
|
|
45
|
+
|
|
46
|
+
### Rebuild
|
|
47
|
+
|
|
48
|
+
- Types changed in two places. The store offers result now allows an optional pass and optional earn multipliers on each offer. The server match object gains playerPasses and playerBoost. Recompiling is enough, unless your code supplies its own stand-in for the match object, which then needs the two new members.
|
|
49
|
+
|
|
50
|
+
### New capability
|
|
51
|
+
|
|
52
|
+
- Offers now say which pass they sell and which earn multipliers they carry. Each ArcadeOffer has an optional pass and optional earnMultipliers, so a game can show what an offer raises before the player buys it.
|
|
53
|
+
- A game can sell a pass by its slug. StoreApi.passOnSale tells you whether the pass is on sale here, and StoreApi.showPass opens its sheet. The ShowPassOutcome it returns is ok only once a fresh read of the player's passes shows the pass held, and otherwise ok or pending as that type describes.
|
|
54
|
+
- A game can preview what a config change would grant before applying it. You pass a config id, never an amount or a pass. The preview works out the player's multiplier, holdings and local offers, and reports grants, platform grants with a breakdown crediting a held pass or Boost, bonuses with eligibility and unmet requirements, and upsells for passes the player could buy. Rolls are reported as a count from a table, never an outcome. Errors and targets have their own types.
|
|
55
|
+
- Earnings can be read from a receipt. The new earnings API turns a receipt's platform grant change into the same platform grant shape the preview uses, from the base amount granted and the boost source. It is available on the browser, on the function half, and on the server and match server. The function half resolves the currency from the invoking player's currencies, while the server half takes a currency id only.
|
|
56
|
+
- A dedicated game server can now read a player's passes and Boost in a match. Use the match player passes read to gate on a pass, using the same GamePass shape as the browser. The match player Boost read returns a MatchPlayerBoost with its multipliers, for display only. Both reads go through optional runtime hooks, host.passes and host.boost, and an image without a hook, or a listen host, is refused by name. A refusal surfaces as an API error that keeps its original code.
|
|
18
57
|
|
|
19
58
|
## 23.3.0
|
|
20
59
|
|
package/dist/conformance.d.ts
CHANGED
|
@@ -32,7 +32,10 @@ interface ParentUnderTest {
|
|
|
32
32
|
dismiss?(): void;
|
|
33
33
|
deliverSocket?(raw: unknown): void;
|
|
34
34
|
setTextScale?(percent: number): void;
|
|
35
|
+
storeScenario?(scenario: StoreScenario): void;
|
|
35
36
|
}
|
|
37
|
+
type StoreScenario = "adult" | "guest" | "holder" | "minor" | "off_sale";
|
|
38
|
+
declare const KIT_PASS = "vip";
|
|
36
39
|
type ParentFactory = (fixture: ParentFixture) => ParentUnderTest;
|
|
37
40
|
interface ParentConformanceOptions {
|
|
38
41
|
readonly embedderOrigin: string;
|
|
@@ -54,7 +57,7 @@ interface ParentConformanceResult {
|
|
|
54
57
|
readonly ok: boolean;
|
|
55
58
|
readonly message?: string;
|
|
56
59
|
}
|
|
57
|
-
declare const PARENT_CONFORMANCE_VERSION =
|
|
60
|
+
declare const PARENT_CONFORMANCE_VERSION = 9;
|
|
58
61
|
declare const PARENT_CONFORMANCE_CASES: readonly ParentConformanceCase[];
|
|
59
62
|
declare function runParentConformance(factory: ParentFactory, options: ParentConformanceOptions): Promise<readonly ParentConformanceResult[]>;
|
|
60
|
-
export { PARENT_CONFORMANCE_CASES, PARENT_CONFORMANCE_VERSION, type ParentConformanceCase, ParentConformanceError, type ParentConformanceOptions, type ParentConformanceResult, type ParentFactory, type ParentFixture, type ParentState, type ParentUnderTest, runParentConformance };
|
|
63
|
+
export { KIT_PASS, PARENT_CONFORMANCE_CASES, PARENT_CONFORMANCE_VERSION, type ParentConformanceCase, ParentConformanceError, type ParentConformanceOptions, type ParentConformanceResult, type ParentFactory, type ParentFixture, type ParentState, type ParentUnderTest, type StoreScenario, runParentConformance };
|
package/dist/function.d.ts
CHANGED
|
@@ -515,6 +515,7 @@ declare class OrdersApi {
|
|
|
515
515
|
interface GamePass {
|
|
516
516
|
readonly pass: string;
|
|
517
517
|
readonly held: boolean;
|
|
518
|
+
readonly daysLeft: number;
|
|
518
519
|
readonly endsAt: string | null;
|
|
519
520
|
}
|
|
520
521
|
type PassesEvent = "changed";
|
|
@@ -970,6 +971,25 @@ declare class PlatformApi {
|
|
|
970
971
|
readonly earnAllowance: PlatformEarnAllowanceApi;
|
|
971
972
|
constructor(api: GameApi, earnAllowanceSignal?: EarnAllowanceSignal, log?: ((line: string) => void) | null);
|
|
972
973
|
}
|
|
974
|
+
type PlatformGrantSource = {
|
|
975
|
+
readonly source: "pass";
|
|
976
|
+
readonly pass: string;
|
|
977
|
+
readonly amount: number;
|
|
978
|
+
} | {
|
|
979
|
+
readonly source: "boost";
|
|
980
|
+
readonly amount: number;
|
|
981
|
+
};
|
|
982
|
+
interface PlatformGrantPreview {
|
|
983
|
+
readonly currencySlug?: string;
|
|
984
|
+
readonly currencyId?: string;
|
|
985
|
+
readonly base: number;
|
|
986
|
+
readonly total: number;
|
|
987
|
+
readonly breakdown: readonly PlatformGrantSource[];
|
|
988
|
+
readonly ifComplete?: true;
|
|
989
|
+
}
|
|
990
|
+
interface EarningsApi {
|
|
991
|
+
fromReceipt(change: unknown): Promise<PlatformGrantPreview | null>;
|
|
992
|
+
}
|
|
973
993
|
interface ProfileShowcaseEntry {
|
|
974
994
|
readonly key: string;
|
|
975
995
|
readonly visibility: string;
|
|
@@ -1055,6 +1075,7 @@ interface GemFunction {
|
|
|
1055
1075
|
readonly showcase: ShowcaseApi;
|
|
1056
1076
|
readonly friends: FriendsApi;
|
|
1057
1077
|
readonly platform: PlatformApi;
|
|
1078
|
+
readonly earnings: EarningsApi;
|
|
1058
1079
|
readonly profiles: ProfilesApi;
|
|
1059
1080
|
}
|
|
1060
1081
|
declare function createGem(options?: unknown): GemFunction;
|
|
@@ -1090,4 +1111,4 @@ interface PlayerBoost {
|
|
|
1090
1111
|
readonly multipliers: readonly PlayerBoostMultiplier[];
|
|
1091
1112
|
readonly expiresInDays?: number;
|
|
1092
1113
|
}
|
|
1093
|
-
export { AnalyticsApi, type AnalyticsApiOptions, type AnalyticsFlushOptions, type AnalyticsFlushResult, type AnalyticsOptions, type AnalyticsRejection, type AnalyticsValue, AuthError, type AuthFailure, type AuthState, type Avatar3dFamily, type Base64String, type Boundary, type BucketConfig, type BucketResetInterval, type BytesResponse, CONDITIONAL_HEADERS, type CacheParam, type Challenge, type ChallengeWindow, ChallengesApi, type Character, CharactersApi, type ClientOptions, type Clock, type ConditionalRequestHeaders, type ConfiguredPurchasePayment, type ConfiguredPurchaseRequest, type ConfiguredPurchaseResult, type CreateCharacterOptions, CurrenciesApi, type CurrencyBalance, type CurrencyBucket, type CurrencyReadOptions, type CurrencyRow, type DescribeSaveOptions, type DirectPurchaseRequest, type DirectPurchaseResult, type EarnAllowance, type EarnAllowanceEvent, type EarnAllowancePeriod, type EarnAllowanceReadOptions, type EarnAllowanceSignal, type EntityLeaderboard, type EntityLeaderboardEntry, type EntityLeaderboardOptions, EntityReadCache, type EntityRef, type EntityScope, type EntityType, type Friend, type FriendChallenge, FriendChallengeError, type FriendChallengeErrorCode, type FriendChallengeOutcome, type FriendChallengeOutcomeKind, type FriendChallengeRequest, type FriendChallengesPage, FriendsApi, type FriendsApiDependencies, type FriendsPage, type FunctionContext, type FunctionFailure, type FunctionInvokeOptions, type FunctionResult, type GameApi, type GameOrderSource, type GamePass, GemApiError, GemClient, type GemErrorReason, type GemFunction, GemFunctionError, type GemFunctionIdentity, GemSaveError, type GetLeaderboardOptions, type GetSaveOptions, type GetSettingOptions, type InitiateTransferOptions, InventoryApi, type InventoryItem, type InventoryOperation, type InventorySnapshot, type ItemCategory, type Leaderboard, type LeaderboardEntry, type LeaderboardPeriod, LeaderboardsApi, type ListChallengesOptions, type ListFriendChallengesOptions, type ListFriendsOptions, type ListSavesOptions, type ListTransfersOptions, type LootRoll, MAX_PERIODS_BACK, MutationsApi, type Order, type OrderOptions, type OrderPageOptions, type OrderResult, type OrderSource, OrdersApi, type Page, type PassesApi, type PassesEvent, type PeriodOptions, PlatformApi, PlatformCurrenciesApi, type PlatformCurrency, type PlatformCurrencyAccess, type PlatformCurrencyPurchasePayment, type PlatformCurrencyPurchaseRequest, type PlatformCurrencyPurchaseResult, type PlatformCurrencyReadOptions, PlatformEarnAllowanceApi, type PlatformEventName, type PlatformPrice, type PlayInviteRequest, type PlayerBadge, type PlayerBoost, type PlayerBoostMultiplier, type PlayerIdentity, type PlayerProfile, type PlayerScope, PlayerText, type ProfileCallOptions, type ProfileShowcaseEntry, ProfilesApi, type Progression, type ProgressionAchievement, ProgressionsApi, type PurchaseOptions, type PutBytesOptions, type PutSaveOptions, type PutSettingOptions, type RankedRow, type RecipeAvailability, type RecipeChange, type RecipeLock, type RecipeResult, type RecipeUsage, type RecipeUsageList, type RefusedPurchase, type RequestOptions, type SavePage, type SaveRecord, SavesApi, type SavesOptions, type SessionEndReason, type Setting, SettingsApi, ShowcaseApi, type ShowcaseCallOptions, type ShowcaseFriendEntry, type ShowcaseFriends, type ShowcaseValue, type SlotInfo, type SnapshotCurrency, type SnapshotItem, type SnapshotOptions, type SnapshotPageOptions, type TokenGrant, type Transfer, type TransferDirection, TransfersApi, type Transport, TransportRefusal, type TransportRequest, type TransportResponse, type VersionedGetOptions, type VersionedResponse, type WornAvatar3d, asPlayerText, createGem, mapIdentity, platformIconUrl, text, toBase64 };
|
|
1114
|
+
export { AnalyticsApi, type AnalyticsApiOptions, type AnalyticsFlushOptions, type AnalyticsFlushResult, type AnalyticsOptions, type AnalyticsRejection, type AnalyticsValue, AuthError, type AuthFailure, type AuthState, type Avatar3dFamily, type Base64String, type Boundary, type BucketConfig, type BucketResetInterval, type BytesResponse, CONDITIONAL_HEADERS, type CacheParam, type Challenge, type ChallengeWindow, ChallengesApi, type Character, CharactersApi, type ClientOptions, type Clock, type ConditionalRequestHeaders, type ConfiguredPurchasePayment, type ConfiguredPurchaseRequest, type ConfiguredPurchaseResult, type CreateCharacterOptions, CurrenciesApi, type CurrencyBalance, type CurrencyBucket, type CurrencyReadOptions, type CurrencyRow, type DescribeSaveOptions, type DirectPurchaseRequest, type DirectPurchaseResult, type EarnAllowance, type EarnAllowanceEvent, type EarnAllowancePeriod, type EarnAllowanceReadOptions, type EarnAllowanceSignal, type EarningsApi, type EntityLeaderboard, type EntityLeaderboardEntry, type EntityLeaderboardOptions, EntityReadCache, type EntityRef, type EntityScope, type EntityType, type Friend, type FriendChallenge, FriendChallengeError, type FriendChallengeErrorCode, type FriendChallengeOutcome, type FriendChallengeOutcomeKind, type FriendChallengeRequest, type FriendChallengesPage, FriendsApi, type FriendsApiDependencies, type FriendsPage, type FunctionContext, type FunctionFailure, type FunctionInvokeOptions, type FunctionResult, type GameApi, type GameOrderSource, type GamePass, GemApiError, GemClient, type GemErrorReason, type GemFunction, GemFunctionError, type GemFunctionIdentity, GemSaveError, type GetLeaderboardOptions, type GetSaveOptions, type GetSettingOptions, type InitiateTransferOptions, InventoryApi, type InventoryItem, type InventoryOperation, type InventorySnapshot, type ItemCategory, type Leaderboard, type LeaderboardEntry, type LeaderboardPeriod, LeaderboardsApi, type ListChallengesOptions, type ListFriendChallengesOptions, type ListFriendsOptions, type ListSavesOptions, type ListTransfersOptions, type LootRoll, MAX_PERIODS_BACK, MutationsApi, type Order, type OrderOptions, type OrderPageOptions, type OrderResult, type OrderSource, OrdersApi, type Page, type PassesApi, type PassesEvent, type PeriodOptions, PlatformApi, PlatformCurrenciesApi, type PlatformCurrency, type PlatformCurrencyAccess, type PlatformCurrencyPurchasePayment, type PlatformCurrencyPurchaseRequest, type PlatformCurrencyPurchaseResult, type PlatformCurrencyReadOptions, PlatformEarnAllowanceApi, type PlatformEventName, type PlatformGrantPreview, type PlatformGrantSource, type PlatformPrice, type PlayInviteRequest, type PlayerBadge, type PlayerBoost, type PlayerBoostMultiplier, type PlayerIdentity, type PlayerProfile, type PlayerScope, PlayerText, type ProfileCallOptions, type ProfileShowcaseEntry, ProfilesApi, type Progression, type ProgressionAchievement, ProgressionsApi, type PurchaseOptions, type PutBytesOptions, type PutSaveOptions, type PutSettingOptions, type RankedRow, type RecipeAvailability, type RecipeChange, type RecipeLock, type RecipeResult, type RecipeUsage, type RecipeUsageList, type RefusedPurchase, type RequestOptions, type SavePage, type SaveRecord, SavesApi, type SavesOptions, type SessionEndReason, type Setting, SettingsApi, ShowcaseApi, type ShowcaseCallOptions, type ShowcaseFriendEntry, type ShowcaseFriends, type ShowcaseValue, type SlotInfo, type SnapshotCurrency, type SnapshotItem, type SnapshotOptions, type SnapshotPageOptions, type TokenGrant, type Transfer, type TransferDirection, TransfersApi, type Transport, TransportRefusal, type TransportRequest, type TransportResponse, type VersionedGetOptions, type VersionedResponse, type WornAvatar3d, asPlayerText, createGem, mapIdentity, platformIconUrl, text, toBase64 };
|