@idosgames/core 0.6.0 → 0.8.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 CHANGED
@@ -14,6 +14,78 @@ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.ht
14
14
 
15
15
  ## [Unreleased]
16
16
 
17
+ ## [0.7.0] - 2026-08-10
18
+
19
+ Real-money payment support. Every configured price becomes a **`PriceOptions` dictionary**, a
20
+ store SKU becomes one of the ways to pay, and the client now tells the server which platform it
21
+ runs on. Breaking — see below.
22
+
23
+ ### Added
24
+
25
+ - **`PriceOption` / `PriceOptions` (`zPriceOption`, `zPriceOptions`)** — the platform-wide price
26
+ standard. A `ResourceConsume` is charged as a whole ("and"); a price across platforms is a
27
+ choice ("or") — a store SKU on mobile, a token on web. The dictionary key is the `OptionID`,
28
+ and the server substitutes it when the field is empty.
29
+ - **`ResourceEntryType.Purchase` + `ResourceEntry.ProductID`** — an entry that means "paid in a
30
+ store". `ProductID` addresses `Purchase.Products`, our stable id, not a per-store SKU.
31
+ - **`PaymentProof` (`zPaymentProof`)** — the receipt attached to a request. Required exactly when
32
+ the chosen option holds a `Purchase` entry: the server never takes money itself, it verifies
33
+ what the store issued to this client.
34
+ - **`client.purchase` (`PurchaseService`)** — `getDefinitions`, `getUserState`,
35
+ `validatePurchase`, `validatePurchasesBatch`. `Resources` is applied only when `Granted` is
36
+ true: `AlreadyProcessed` and `Restored` carry the same block, and crediting it would pay the
37
+ reward twice for one payment — which is exactly what a store's re-delivered receipt looks like.
38
+ - **`client.checkout` (`CheckoutService`)** — `availableOptions`, `isAvailable`, `requirementOf`,
39
+ `storeProductOf`, `cryptoShortfallOf`. It deliberately buys nothing: the purchase belongs to the
40
+ module that owns the entity (`client.store.purchase`, `client.lootbox.open`, …), which is the
41
+ only place that knows count, target ids and the idempotency key.
42
+ - **`ClientPlatform`** (`Unknown | Web | Android | Ios`) and `IDosGamesClientConfig.clientPlatform`.
43
+ Auto-detected by `detectClientPlatform()` and sent as **`X-IG-Platform`** on every request —
44
+ once, in the transport, because a service that forgot to pass it would silently get a different
45
+ price list. Detection is conservative: a browser is `Web` even on a phone, only a real native
46
+ wrapper (Capacitor / Cordova) counts as `Android`/`Ios`, and no `navigator` at all is `Unknown`
47
+ rather than `Web`.
48
+ - `SegmentGate.Platforms` — gate any definition on the client platform.
49
+ - Optional **`selectedOptionID`** on every call that charges a configured price —
50
+ `store.purchase`, `lootbox.open`, `craft.craft`, `premium.purchaseItemOrCurrency`,
51
+ `character.unlockCharacter`, `collection.openPack`, `dealOffer.executeNode`,
52
+ `timedBoost.activate`, `item.upgradeLevel`, `coopEvent.spin`, `gameLoop.boardSpecialChoose`,
53
+ `match.createMatch`, `marketplace.createListing` / `createAuction`. Omitting it keeps
54
+ single-price entities working with no client change: the server takes the first option
55
+ available on this platform.
56
+ - Optional **`payment`** (a `PaymentProof`) on the calls the server can settle against a store
57
+ receipt: `store.purchase`, `lootbox.open`, `character.unlockCharacter`, `collection.openPack`,
58
+ `dealOffer.executeNode`, `timedBoost.activate`. The rest deliberately have none — an upgrade
59
+ priced by a level formula, a per-fact coop spin, a refundable listing fee and a P2P match stake
60
+ cannot be one store SKU, and the server rejects a `Purchase` entry in those places.
61
+
62
+ ### Changed
63
+
64
+ - **Every price field is now `PriceOptions`.** `StoreOfferDefinition.Cost`,
65
+ `CraftDefinition.RequiredResources`, `LootboxDefinition.PriceOptions` (was a list of
66
+ `LootboxPriceOption`), `PremiumDefinition.PriceOptions`, `CollectionPackDefinition.Cost`,
67
+ `CharacterDefinition.Unlock.Cost` / stat & level `BaseCostResource` / `UpgradeCost`,
68
+ `ItemUpgrade.BaseCostResource`, `TimedBoostDefinition.ActivationCost`,
69
+ `CoopEventBuildObjects.SpinCost`, `GameLoop` special-mode choice `EntryCost`,
70
+ `DealOfferPurchaseAction.DirectCost`, `MatchCreationSettings.Cost`,
71
+ `MarketplaceListingSettings.ListingFee` — all replaced by a `PriceOptions` dictionary.
72
+ - `lootbox.open`'s `selectedOptionID` is a **string** (was `number`) and is now optional.
73
+ - Prices come back **already filtered by the request's platform**, and the charge re-checks it.
74
+ The client renders what the server gave; a hidden option cannot be paid anyway.
75
+
76
+ ### Removed
77
+
78
+ - **`ResourceEntryType.UsdCent`** — it was declared but never worked (any operation with it
79
+ failed inside the inventory layer), so a price in real money looked configurable while the
80
+ entity was impossible to buy. `Purchase` replaces it.
81
+
82
+ ### Migration
83
+
84
+ Read a price through `client.checkout.availableOptions(entity.PriceOptions)` instead of the old
85
+ single cost field, and pass the chosen `OptionID` to the module's buying call. A price paid in a
86
+ store additionally needs a `PaymentProof` — buy in the store first, then hand the receipt to the
87
+ same call. Nothing else changes for entities that keep a single price.
88
+
17
89
  ## [0.6.0] - 2026-08-09
18
90
 
19
91
  ### Added