@indiegems/gem-web-sdk 16.2.0 → 16.3.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 +14 -0
- package/README.md +2 -1
- package/dist/game.d.ts +50 -1
- package/dist/gem-web-sdk.conformance.js +2 -2
- package/dist/gem-web-sdk.esm.js +1 -1
- package/dist/gem-web-sdk.function.js +1 -1
- 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 +1 -1
- package/dist/sdk.d.ts +50 -1
- package/docs/api/api-reference-function.md +1 -1
- package/docs/api/api-reference-game.md +468 -34
- package/docs/api/api-reference-server.md +1 -1
- package/docs/api/reference.json +625 -9
- package/docs/arcade-and-store.md +28 -17
- package/docs/arcade-economy.md +4 -4
- package/docs/brand-art.md +17 -4
- package/docs/branding.md +160 -0
- package/docs/changelog.md +14 -0
- package/docs/getting-started.md +1 -1
- package/docs/inventory-and-catalogs.md +4 -3
- package/docs/manifest.json +21 -16
- package/docs/server-bundles.md +2 -2
- package/docs/what-a-game-must-do.md +75 -23
- package/package.json +1 -1
- package/schema/bridge.v1.json +29 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The browser surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk` v16.
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v16.3.1, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/game` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|
|
@@ -4590,7 +4590,7 @@ interface StoreApi
|
|
|
4590
4590
|
```
|
|
4591
4591
|
|
|
4592
4592
|
**Real money.** The Arcade Store's own Gem packs, Boosts, passes and bundles,
|
|
4593
|
-
bought with the player's money through the
|
|
4593
|
+
bought with the player's money through the Arcade Store's own checkout.
|
|
4594
4594
|
`gem.store` is one of these. To spend Gems or Coins on your game's own items,
|
|
4595
4595
|
use `gem.purchases`.
|
|
4596
4596
|
|
|
@@ -4628,20 +4628,24 @@ is withheld. Re-read on resume: what is on sale can change.
|
|
|
4628
4628
|
purchase(skuId: string): Promise<ArcadeOutcome>
|
|
4629
4629
|
```
|
|
4630
4630
|
|
|
4631
|
-
Ask the arcade to open
|
|
4632
|
-
|
|
4631
|
+
Ask the arcade to open checkout for one SKU from [StoreApi.offers](#storeapi-offers):
|
|
4632
|
+
the payment provider's page on the web, the app store's purchase sheet in
|
|
4633
|
+
the Arcade's apps, straight away, with no confirmation screen of the
|
|
4634
|
+
arcade's own first. **Call it from the player's press handler** — the
|
|
4633
4635
|
arcade refuses an ask no person pressed for, `declined` / `busy`.
|
|
4634
4636
|
|
|
4635
4637
|
- `ok` — the player paid. Re-read balances and inventory through `gem.me`;
|
|
4636
4638
|
nothing here carries an amount. With `reason: 'pending'`, the provider
|
|
4637
4639
|
has not settled yet: [StoreApi.onSettled](#storeapi-onsettled) hears when it does.
|
|
4638
|
-
- `declined` — nothing was bought: `cancelled` (the player
|
|
4639
|
-
|
|
4640
|
+
- `declined` — nothing was bought: `cancelled` (the player closed the
|
|
4641
|
+
checkout, or the offer cannot be bought again yet) or `busy` (after a
|
|
4642
|
+
closed checkout the arcade refuses the next ask for a while). Return to
|
|
4643
|
+
your screen silently, and do not ask again unprompted.
|
|
4640
4644
|
- `unavailable` with `store_off`, `sign_in_required`, `not_found`,
|
|
4641
4645
|
`unsupported`, `invalid_argument` or a payment provider's failure code —
|
|
4642
4646
|
nothing was bought.
|
|
4643
4647
|
- `unavailable` / `error` — **the outcome is unknown, and the player may
|
|
4644
|
-
have paid.** It is what you get when the bridge closes while
|
|
4648
|
+
have paid.** It is what you get when the bridge closes while checkout
|
|
4645
4649
|
is open, or the arcade has no reliable answer. Never tell the player
|
|
4646
4650
|
nothing was bought: re-read balances and inventory through `gem.me`,
|
|
4647
4651
|
and keep listening with [StoreApi.onSettled](#storeapi-onsettled).
|
|
@@ -5587,6 +5591,406 @@ only if you are instrumenting something that runs before the SDK exists.
|
|
|
5587
5591
|
| --- | --- |
|
|
5588
5592
|
| `options` | `BootTimelineOptions` |
|
|
5589
5593
|
|
|
5594
|
+
<a id="brandingtheme"></a>
|
|
5595
|
+
|
|
5596
|
+
## BrandingTheme
|
|
5597
|
+
|
|
5598
|
+
```ts
|
|
5599
|
+
type BrandingTheme = "light" | "dark"
|
|
5600
|
+
```
|
|
5601
|
+
|
|
5602
|
+
A theme a variant is drawn for.
|
|
5603
|
+
|
|
5604
|
+
<a id="brandingvariant"></a>
|
|
5605
|
+
|
|
5606
|
+
## BrandingVariant
|
|
5607
|
+
|
|
5608
|
+
```ts
|
|
5609
|
+
interface BrandingVariant
|
|
5610
|
+
```
|
|
5611
|
+
|
|
5612
|
+
One file of a [BrandingAsset](#brandingasset): a render at one size and density, a
|
|
5613
|
+
scalable image, or the one file of a sound or a font.
|
|
5614
|
+
|
|
5615
|
+
<a id="brandingvariant-url"></a>
|
|
5616
|
+
|
|
5617
|
+
## BrandingVariant.url
|
|
5618
|
+
|
|
5619
|
+
```ts
|
|
5620
|
+
readonly url: string
|
|
5621
|
+
```
|
|
5622
|
+
|
|
5623
|
+
The file's URL, absolute and on the platform's own host. Content-hashed,
|
|
5624
|
+
so a re-render is a new URL: look it up each session rather than storing
|
|
5625
|
+
one in a save or your build.
|
|
5626
|
+
|
|
5627
|
+
<a id="brandingvariant-type"></a>
|
|
5628
|
+
|
|
5629
|
+
## BrandingVariant.type
|
|
5630
|
+
|
|
5631
|
+
```ts
|
|
5632
|
+
readonly type: string
|
|
5633
|
+
```
|
|
5634
|
+
|
|
5635
|
+
Its MIME type, such as `image/png` or `image/svg+xml`.
|
|
5636
|
+
|
|
5637
|
+
<a id="brandingvariant-bytes"></a>
|
|
5638
|
+
|
|
5639
|
+
## BrandingVariant.bytes
|
|
5640
|
+
|
|
5641
|
+
```ts
|
|
5642
|
+
readonly bytes: number
|
|
5643
|
+
```
|
|
5644
|
+
|
|
5645
|
+
Its size in bytes.
|
|
5646
|
+
|
|
5647
|
+
<a id="brandingvariant-width"></a>
|
|
5648
|
+
|
|
5649
|
+
## BrandingVariant.width
|
|
5650
|
+
|
|
5651
|
+
```ts
|
|
5652
|
+
readonly width?: number
|
|
5653
|
+
```
|
|
5654
|
+
|
|
5655
|
+
An image's width in pixels (an SVG's in its viewBox units).
|
|
5656
|
+
|
|
5657
|
+
<a id="brandingvariant-height"></a>
|
|
5658
|
+
|
|
5659
|
+
## BrandingVariant.height
|
|
5660
|
+
|
|
5661
|
+
```ts
|
|
5662
|
+
readonly height?: number
|
|
5663
|
+
```
|
|
5664
|
+
|
|
5665
|
+
An image's height in pixels (an SVG's in its viewBox units).
|
|
5666
|
+
|
|
5667
|
+
<a id="brandingvariant-size"></a>
|
|
5668
|
+
|
|
5669
|
+
## BrandingVariant.size
|
|
5670
|
+
|
|
5671
|
+
```ts
|
|
5672
|
+
readonly size?: number
|
|
5673
|
+
```
|
|
5674
|
+
|
|
5675
|
+
The CSS px box this render was made for, with [BrandingVariant.density](#brandingvariant-density).
|
|
5676
|
+
Absent on a render meant for any box up to its width.
|
|
5677
|
+
|
|
5678
|
+
<a id="brandingvariant-density"></a>
|
|
5679
|
+
|
|
5680
|
+
## BrandingVariant.density
|
|
5681
|
+
|
|
5682
|
+
```ts
|
|
5683
|
+
readonly density?: number
|
|
5684
|
+
```
|
|
5685
|
+
|
|
5686
|
+
Device pixels per CSS px of a render made for [BrandingVariant.size](#brandingvariant-size).
|
|
5687
|
+
|
|
5688
|
+
<a id="brandingvariant-vector"></a>
|
|
5689
|
+
|
|
5690
|
+
## BrandingVariant.vector
|
|
5691
|
+
|
|
5692
|
+
```ts
|
|
5693
|
+
readonly vector?: true
|
|
5694
|
+
```
|
|
5695
|
+
|
|
5696
|
+
`true` on a scalable image: it draws crisply at any size.
|
|
5697
|
+
|
|
5698
|
+
<a id="brandingvariant-theme"></a>
|
|
5699
|
+
|
|
5700
|
+
## BrandingVariant.theme
|
|
5701
|
+
|
|
5702
|
+
```ts
|
|
5703
|
+
readonly theme?: BrandingTheme
|
|
5704
|
+
```
|
|
5705
|
+
|
|
5706
|
+
The one theme the file is for. Absent: either theme.
|
|
5707
|
+
|
|
5708
|
+
<a id="brandingasset"></a>
|
|
5709
|
+
|
|
5710
|
+
## BrandingAsset
|
|
5711
|
+
|
|
5712
|
+
```ts
|
|
5713
|
+
interface BrandingAsset
|
|
5714
|
+
```
|
|
5715
|
+
|
|
5716
|
+
One asset in the platform's branding manifest.
|
|
5717
|
+
|
|
5718
|
+
<a id="brandingasset-id"></a>
|
|
5719
|
+
|
|
5720
|
+
## BrandingAsset.id
|
|
5721
|
+
|
|
5722
|
+
```ts
|
|
5723
|
+
readonly id: string
|
|
5724
|
+
```
|
|
5725
|
+
|
|
5726
|
+
What a game asks for: `'gem-logo'`, `'gems-mark'`. Never renamed.
|
|
5727
|
+
|
|
5728
|
+
<a id="brandingasset-kind"></a>
|
|
5729
|
+
|
|
5730
|
+
## BrandingAsset.kind
|
|
5731
|
+
|
|
5732
|
+
```ts
|
|
5733
|
+
readonly kind: string
|
|
5734
|
+
```
|
|
5735
|
+
|
|
5736
|
+
`'image'`, `'audio'` or `'font'` today. The platform may add more, so
|
|
5737
|
+
compare it rather than switching on it exhaustively.
|
|
5738
|
+
|
|
5739
|
+
<a id="brandingasset-variants"></a>
|
|
5740
|
+
|
|
5741
|
+
## BrandingAsset.variants
|
|
5742
|
+
|
|
5743
|
+
```ts
|
|
5744
|
+
readonly variants: readonly BrandingVariant[]
|
|
5745
|
+
```
|
|
5746
|
+
|
|
5747
|
+
Every file of it, smallest first. Never empty.
|
|
5748
|
+
|
|
5749
|
+
<a id="brandinglookup"></a>
|
|
5750
|
+
|
|
5751
|
+
## BrandingLookup
|
|
5752
|
+
|
|
5753
|
+
```ts
|
|
5754
|
+
type BrandingLookup = { outcome: "ok"; url: string; variant: BrandingVariant; asset: BrandingAsset } | { outcome: "not_found" | "unavailable" }
|
|
5755
|
+
```
|
|
5756
|
+
|
|
5757
|
+
What a branding lookup resolves with. Only `ok` carries a URL.
|
|
5758
|
+
|
|
5759
|
+
- `ok`: the platform has it, and `url` is the file picked for what you asked.
|
|
5760
|
+
- `not_found`: the manifest was read and has no asset with that id and kind,
|
|
5761
|
+
or none of its files fits the theme you asked for. Draw nothing for it.
|
|
5762
|
+
- `unavailable`: the manifest could not be read — offline, a network error,
|
|
5763
|
+
a Content-Security-Policy that leaves out `https://gemarcade.com`. Draw the
|
|
5764
|
+
copy you bundled from the package's `brand/` folder, if there is one.
|
|
5765
|
+
|
|
5766
|
+
<a id="brandinglist"></a>
|
|
5767
|
+
|
|
5768
|
+
## BrandingList
|
|
5769
|
+
|
|
5770
|
+
```ts
|
|
5771
|
+
type BrandingList = { outcome: "ok"; assets: readonly BrandingAsset[] } | { outcome: "unavailable" }
|
|
5772
|
+
```
|
|
5773
|
+
|
|
5774
|
+
What [BrandingApi.list](#brandingapi-list) resolves with.
|
|
5775
|
+
|
|
5776
|
+
<a id="brandingimageoptions"></a>
|
|
5777
|
+
|
|
5778
|
+
## BrandingImageOptions
|
|
5779
|
+
|
|
5780
|
+
```ts
|
|
5781
|
+
interface BrandingImageOptions
|
|
5782
|
+
```
|
|
5783
|
+
|
|
5784
|
+
How to pick one image from an asset's variants.
|
|
5785
|
+
|
|
5786
|
+
<a id="brandingimageoptions-size"></a>
|
|
5787
|
+
|
|
5788
|
+
## BrandingImageOptions.size
|
|
5789
|
+
|
|
5790
|
+
```ts
|
|
5791
|
+
readonly size?: number
|
|
5792
|
+
```
|
|
5793
|
+
|
|
5794
|
+
The CSS px box you draw it in. A render made for exactly that box wins;
|
|
5795
|
+
then a scalable image; then the narrowest render wide enough for
|
|
5796
|
+
`size × density`. Leave it out for the largest: the scalable image, or
|
|
5797
|
+
else the widest render.
|
|
5798
|
+
|
|
5799
|
+
<a id="brandingimageoptions-density"></a>
|
|
5800
|
+
|
|
5801
|
+
## BrandingImageOptions.density
|
|
5802
|
+
|
|
5803
|
+
```ts
|
|
5804
|
+
readonly density?: number
|
|
5805
|
+
```
|
|
5806
|
+
|
|
5807
|
+
Device pixels per CSS px. Defaults to the screen's `devicePixelRatio`;
|
|
5808
|
+
pass `3` for a canvas or texture you scale down yourself.
|
|
5809
|
+
|
|
5810
|
+
<a id="brandingimageoptions-theme"></a>
|
|
5811
|
+
|
|
5812
|
+
## BrandingImageOptions.theme
|
|
5813
|
+
|
|
5814
|
+
```ts
|
|
5815
|
+
readonly theme?: BrandingTheme
|
|
5816
|
+
```
|
|
5817
|
+
|
|
5818
|
+
Prefer a file drawn for this theme. Files for the other theme are never picked.
|
|
5819
|
+
|
|
5820
|
+
<a id="brandingassetoptions"></a>
|
|
5821
|
+
|
|
5822
|
+
## BrandingAssetOptions
|
|
5823
|
+
|
|
5824
|
+
```ts
|
|
5825
|
+
interface BrandingAssetOptions
|
|
5826
|
+
```
|
|
5827
|
+
|
|
5828
|
+
What [BrandingApi.get](#brandingapi-get) takes: the asset's kind, and how to pick a file.
|
|
5829
|
+
|
|
5830
|
+
<a id="brandingassetoptions-size"></a>
|
|
5831
|
+
|
|
5832
|
+
## BrandingAssetOptions.size
|
|
5833
|
+
|
|
5834
|
+
```ts
|
|
5835
|
+
readonly size?: number
|
|
5836
|
+
```
|
|
5837
|
+
|
|
5838
|
+
The CSS px box you draw it in. A render made for exactly that box wins;
|
|
5839
|
+
then a scalable image; then the narrowest render wide enough for
|
|
5840
|
+
`size × density`. Leave it out for the largest: the scalable image, or
|
|
5841
|
+
else the widest render.
|
|
5842
|
+
|
|
5843
|
+
<a id="brandingassetoptions-density"></a>
|
|
5844
|
+
|
|
5845
|
+
## BrandingAssetOptions.density
|
|
5846
|
+
|
|
5847
|
+
```ts
|
|
5848
|
+
readonly density?: number
|
|
5849
|
+
```
|
|
5850
|
+
|
|
5851
|
+
Device pixels per CSS px. Defaults to the screen's `devicePixelRatio`;
|
|
5852
|
+
pass `3` for a canvas or texture you scale down yourself.
|
|
5853
|
+
|
|
5854
|
+
<a id="brandingassetoptions-theme"></a>
|
|
5855
|
+
|
|
5856
|
+
## BrandingAssetOptions.theme
|
|
5857
|
+
|
|
5858
|
+
```ts
|
|
5859
|
+
readonly theme?: BrandingTheme
|
|
5860
|
+
```
|
|
5861
|
+
|
|
5862
|
+
Prefer a file drawn for this theme. Files for the other theme are never picked.
|
|
5863
|
+
|
|
5864
|
+
<a id="brandingassetoptions-kind"></a>
|
|
5865
|
+
|
|
5866
|
+
## BrandingAssetOptions.kind
|
|
5867
|
+
|
|
5868
|
+
```ts
|
|
5869
|
+
readonly kind: string
|
|
5870
|
+
```
|
|
5871
|
+
|
|
5872
|
+
The kind you expect: `'image'`, `'audio'` or `'font'`. An asset of another
|
|
5873
|
+
kind answers `not_found`. `size` and `density` apply to images only; for
|
|
5874
|
+
any other kind the first file wins.
|
|
5875
|
+
|
|
5876
|
+
<a id="brandingcurrency"></a>
|
|
5877
|
+
|
|
5878
|
+
## BrandingCurrency
|
|
5879
|
+
|
|
5880
|
+
```ts
|
|
5881
|
+
type BrandingCurrency = "GEMS" | "ARCADE_TICKETS"
|
|
5882
|
+
```
|
|
5883
|
+
|
|
5884
|
+
The platform currencies with a mark: Gems and Coins.
|
|
5885
|
+
|
|
5886
|
+
<a id="brandingapi"></a>
|
|
5887
|
+
|
|
5888
|
+
## BrandingApi
|
|
5889
|
+
|
|
5890
|
+
```ts
|
|
5891
|
+
interface BrandingApi
|
|
5892
|
+
```
|
|
5893
|
+
|
|
5894
|
+
The platform's branding, as the platform serves it now. `gem.branding` is
|
|
5895
|
+
one of these. Nothing here rejects but a bad argument.
|
|
5896
|
+
|
|
5897
|
+
<a id="brandingapi-get"></a>
|
|
5898
|
+
|
|
5899
|
+
## BrandingApi.get
|
|
5900
|
+
|
|
5901
|
+
```ts
|
|
5902
|
+
get(id: string, options: BrandingAssetOptions): Promise<BrandingLookup>
|
|
5903
|
+
```
|
|
5904
|
+
|
|
5905
|
+
Any asset in the platform's branding manifest, by id and kind — including
|
|
5906
|
+
ones added after this SDK was released.
|
|
5907
|
+
|
|
5908
|
+
```js
|
|
5909
|
+
const logo = await gem.branding.get('gem-logo', { kind: 'image', size: 64 });
|
|
5910
|
+
if (logo.outcome === 'ok') img.src = logo.url;
|
|
5911
|
+
```
|
|
5912
|
+
|
|
5913
|
+
| Parameter | Type |
|
|
5914
|
+
| --- | --- |
|
|
5915
|
+
| `id` | `string` |
|
|
5916
|
+
| `options` | `BrandingAssetOptions` |
|
|
5917
|
+
|
|
5918
|
+
**Returns.** Resolves `ok`, `not_found` or `unavailable`. Rejects only for an
|
|
5919
|
+
argument that is not one (an empty id, a size that is not a positive
|
|
5920
|
+
number).
|
|
5921
|
+
|
|
5922
|
+
<a id="brandingapi-logo"></a>
|
|
5923
|
+
|
|
5924
|
+
## BrandingApi.logo
|
|
5925
|
+
|
|
5926
|
+
```ts
|
|
5927
|
+
logo(options?: BrandingImageOptions): Promise<BrandingLookup>
|
|
5928
|
+
```
|
|
5929
|
+
|
|
5930
|
+
The Indie Gems logo, the brand gem. Scalable: draw it at 32 CSS px or more,
|
|
5931
|
+
as served (`docs/branding.md` has the usage rules).
|
|
5932
|
+
|
|
5933
|
+
| Parameter | Type |
|
|
5934
|
+
| --- | --- |
|
|
5935
|
+
| `options` | `BrandingImageOptions` |
|
|
5936
|
+
|
|
5937
|
+
<a id="brandingapi-wordmark"></a>
|
|
5938
|
+
|
|
5939
|
+
## BrandingApi.wordmark
|
|
5940
|
+
|
|
5941
|
+
```ts
|
|
5942
|
+
wordmark(options?: BrandingImageOptions): Promise<BrandingLookup>
|
|
5943
|
+
```
|
|
5944
|
+
|
|
5945
|
+
The Gem Arcade wordmark. Draw it at 60 CSS px wide or more, as served.
|
|
5946
|
+
|
|
5947
|
+
| Parameter | Type |
|
|
5948
|
+
| --- | --- |
|
|
5949
|
+
| `options` | `BrandingImageOptions` |
|
|
5950
|
+
|
|
5951
|
+
<a id="brandingapi-currencymark"></a>
|
|
5952
|
+
|
|
5953
|
+
## BrandingApi.currencyMark
|
|
5954
|
+
|
|
5955
|
+
```ts
|
|
5956
|
+
currencyMark(currency: BrandingCurrency, options?: BrandingImageOptions): Promise<BrandingLookup>
|
|
5957
|
+
```
|
|
5958
|
+
|
|
5959
|
+
The mark of a platform currency, by its slug: `'GEMS'` or
|
|
5960
|
+
`'ARCADE_TICKETS'` (Coins). Pass `size: 20` or `32` for the inline icon
|
|
5961
|
+
beside an amount, or leave it out for the hero art of a reward screen.
|
|
5962
|
+
`docs/brand-art.md` says where each may be drawn.
|
|
5963
|
+
|
|
5964
|
+
| Parameter | Type |
|
|
5965
|
+
| --- | --- |
|
|
5966
|
+
| `currency` | `BrandingCurrency` |
|
|
5967
|
+
| `options` | `BrandingImageOptions` |
|
|
5968
|
+
|
|
5969
|
+
<a id="brandingapi-trophy"></a>
|
|
5970
|
+
|
|
5971
|
+
## BrandingApi.trophy
|
|
5972
|
+
|
|
5973
|
+
```ts
|
|
5974
|
+
trophy(options?: BrandingImageOptions): Promise<BrandingLookup>
|
|
5975
|
+
```
|
|
5976
|
+
|
|
5977
|
+
The trophy, for where your game shows what a player has achieved.
|
|
5978
|
+
|
|
5979
|
+
| Parameter | Type |
|
|
5980
|
+
| --- | --- |
|
|
5981
|
+
| `options` | `BrandingImageOptions` |
|
|
5982
|
+
|
|
5983
|
+
<a id="brandingapi-list"></a>
|
|
5984
|
+
|
|
5985
|
+
## BrandingApi.list
|
|
5986
|
+
|
|
5987
|
+
```ts
|
|
5988
|
+
list(): Promise<BrandingList>
|
|
5989
|
+
```
|
|
5990
|
+
|
|
5991
|
+
Every asset the platform serves, or `unavailable` when the manifest could
|
|
5992
|
+
not be read.
|
|
5993
|
+
|
|
5590
5994
|
<a id="listchallengesoptions"></a>
|
|
5591
5995
|
|
|
5592
5996
|
## ListChallengesOptions
|
|
@@ -10078,9 +10482,9 @@ readonly reserved: readonly GemReservedArea[]
|
|
|
10078
10482
|
```
|
|
10079
10483
|
|
|
10080
10484
|
Rectangles of your frame the arcade's own controls cover — in the Gem
|
|
10081
|
-
Arcade, its Gem button in whichever corner it sits,
|
|
10082
|
-
beside it while the player shows it
|
|
10083
|
-
|
|
10485
|
+
Arcade, its Gem button in whichever corner it sits, the frame-rate readout
|
|
10486
|
+
beside it while the player shows it, and the wallets beside it while your
|
|
10487
|
+
game asks for them (see `setWalletVisible`). Keep essential UI and touch
|
|
10084
10488
|
targets out of them. Empty when the arcade covers nothing.
|
|
10085
10489
|
|
|
10086
10490
|
Each is a keep-out area, grown out to the frame edges it sits nearest — not
|
|
@@ -10229,10 +10633,10 @@ readonly only?: readonly string[]
|
|
|
10229
10633
|
|
|
10230
10634
|
While shown, show ONLY these: platform currency slugs as
|
|
10231
10635
|
`gem.platform.currencies.get()` lists them (`GEMS`, `ARCADE_TICKETS`),
|
|
10232
|
-
matched exactly, and the literal `'score'` for the achievement score.
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10636
|
+
matched exactly, and the literal `'score'` for the achievement score. Leave
|
|
10637
|
+
it out and every wallet shows, the achievement score's included. The Gem
|
|
10638
|
+
Arcade honours it: `{ only: ['GEMS', 'ARCADE_TICKETS'] }` shows those two
|
|
10639
|
+
and no achievement score; a slug the platform does not serve names nothing.
|
|
10236
10640
|
|
|
10237
10641
|
<a id="gamemenuitem"></a>
|
|
10238
10642
|
|
|
@@ -10288,7 +10692,8 @@ interface GameMenu
|
|
|
10288
10692
|
```
|
|
10289
10693
|
|
|
10290
10694
|
What your game adds to the arcade's menu — see `gem.setMenu`. Your settings
|
|
10291
|
-
|
|
10695
|
+
screen is not part of it: it opens from your own settings button. An action
|
|
10696
|
+
on that screen (Replay the tutorial, How to play) may also be an entry here.
|
|
10292
10697
|
|
|
10293
10698
|
<a id="gamemenu-items"></a>
|
|
10294
10699
|
|
|
@@ -10816,6 +11221,31 @@ exactly as given, and call `purchase(skuId)` from the player's press. After
|
|
|
10816
11221
|
|
|
10817
11222
|
**Guides.** [arcade-and-store](../arcade-and-store.md)
|
|
10818
11223
|
|
|
11224
|
+
<a id="gem-branding"></a>
|
|
11225
|
+
|
|
11226
|
+
## Gem.branding
|
|
11227
|
+
|
|
11228
|
+
```ts
|
|
11229
|
+
readonly branding: BrandingApi
|
|
11230
|
+
```
|
|
11231
|
+
|
|
11232
|
+
The platform's branding — the Indie Gems logo, the Gem Arcade wordmark,
|
|
11233
|
+
the Gems and Coins marks and the trophy — as the platform serves it now,
|
|
11234
|
+
so a changed mark reaches your game with no republish.
|
|
11235
|
+
|
|
11236
|
+
Look up any asset by id and kind with `get`, or use `logo`, `wordmark`,
|
|
11237
|
+
`currencyMark` and `trophy`. Every URL is on the platform's own host.
|
|
11238
|
+
Nothing rejects but a bad argument: an asset the platform does not list is
|
|
11239
|
+
`not_found`, and a manifest that could not be read is `unavailable`, when
|
|
11240
|
+
you draw the copy you bundled from `brand/` instead.
|
|
11241
|
+
|
|
11242
|
+
```js
|
|
11243
|
+
const logo = await gem.branding.logo();
|
|
11244
|
+
if (logo.outcome === 'ok') menuLogo.src = logo.url;
|
|
11245
|
+
```
|
|
11246
|
+
|
|
11247
|
+
**Guides.** [branding](../branding.md)
|
|
11248
|
+
|
|
10819
11249
|
<a id="gem-avatarpickeravailable"></a>
|
|
10820
11250
|
|
|
10821
11251
|
## Gem.avatarPickerAvailable
|
|
@@ -11371,9 +11801,10 @@ Tell the arcade a platform-currency reward is on its way, so it **shows it
|
|
|
11371
11801
|
landing**: in the Gem Arcade the currency flies from `origin` into the Gem
|
|
11372
11802
|
button, wherever on your frame it sits, which pops as each mark lands, and
|
|
11373
11803
|
the player's total moves once the platform confirms the grant. The Gem
|
|
11374
|
-
Arcade draws no wallet over your game
|
|
11375
|
-
Coins in the Gem menu. A payout you do not
|
|
11376
|
-
middle of your frame, so cue the ones the player
|
|
11804
|
+
Arcade draws no wallet over your game unless you ask (`setWalletVisible`):
|
|
11805
|
+
the player sees their Gems and Coins in the Gem menu. A payout you do not
|
|
11806
|
+
cue still flies, from the middle of your frame, so cue the ones the player
|
|
11807
|
+
earns on screen.
|
|
11377
11808
|
|
|
11378
11809
|
Call it the moment your game decides to award — when your server has moved
|
|
11379
11810
|
(or is about to move) the progression mapped onto a platform currency —
|
|
@@ -11418,26 +11849,25 @@ landed — which it does on every channel, dev and test included.
|
|
|
11418
11849
|
setWalletVisible(visible: boolean, options?: WalletVisibleOptions): boolean
|
|
11419
11850
|
```
|
|
11420
11851
|
|
|
11421
|
-
|
|
11422
|
-
|
|
11852
|
+
Ask the arcade to show, or stop showing, the player's wallets — Gems,
|
|
11853
|
+
Coins, the achievement score — over your game.
|
|
11423
11854
|
|
|
11424
|
-
**The Gem Arcade draws
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
while you play, show them on your menus.
|
|
11855
|
+
**The Gem Arcade draws them on request** (the owner, 2026-10-29): a game
|
|
11856
|
+
that says nothing gets no wallet over it, as since 2026-10-11, and the
|
|
11857
|
+
player sees their balances in the Gem menu; a game that asks gets them
|
|
11858
|
+
drawn beside the Gem, from the platform's own figures. An Arcade from
|
|
11859
|
+
before that ignores the call, harmlessly.
|
|
11430
11860
|
|
|
11431
11861
|
```js
|
|
11432
|
-
|
|
11433
|
-
|
|
11862
|
+
gem.setWalletVisible(true, { only: ['GEMS', 'ARCADE_TICKETS'] }); // every screen
|
|
11863
|
+
level.onStart = () => gem.setWalletVisible(false); // or put them away during play
|
|
11434
11864
|
```
|
|
11435
11865
|
|
|
11436
11866
|
**It is screen state, not a toggle.** Each call is the whole answer and
|
|
11437
|
-
replaces the last.
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11867
|
+
replaces the last. Shown wallets arrive as rectangles in
|
|
11868
|
+
`gem.viewport.reserved` (and widen the Gem's corner in the
|
|
11869
|
+
`--gem-reserved-*` variables), and hiding them gives that space back.
|
|
11870
|
+
`only` narrows what shows.
|
|
11441
11871
|
|
|
11442
11872
|
**Never draw a platform balance yourself**, and never show a pending state
|
|
11443
11873
|
for one: the arcade takes every figure from the platform. If this returns
|
|
@@ -11470,10 +11900,14 @@ gem.setMenu({
|
|
|
11470
11900
|
});
|
|
11471
11901
|
```
|
|
11472
11902
|
|
|
11473
|
-
**Your settings
|
|
11903
|
+
**Your settings screen is not in it: draw your own settings button** —
|
|
11474
11904
|
top-right, with your Back button just to its left, clear of
|
|
11475
11905
|
`gem.viewport.reserved`. The Arcade's menu never opens your settings
|
|
11476
|
-
screen.
|
|
11906
|
+
screen. Inside the Gem Arcade you may leave the button out while this
|
|
11907
|
+
returns `true`, when every setting on your screen is declared with
|
|
11908
|
+
`gem.settings` and every action on it is one of these entries; it returns
|
|
11909
|
+
`false` before the bridge is up and under an embedder with no menu, and the
|
|
11910
|
+
button stays there.
|
|
11477
11911
|
|
|
11478
11912
|
**It is screen state, not a toggle.** Each call is the whole answer and
|
|
11479
11913
|
replaces the last, so call it again when the entries change — a new
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The server surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk` v16.
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v16.3.1, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/server` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|