You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align OpenIAP literal unions across generated types and runtime helpers
to match the updated schema. Refresh docs, examples, and tests so
consumers see the lowercase literals while preserving native
compatibility.
Complies with
https://github.com/hyodotdev/openiap-gql/releases/tag/1.0.1
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Public APIs now normalize purchase types to "in-app"
(backward-compatible with "inapp"), standardize platform values to
"ios"/"android", and introduce updated purchase/subscription request
typing and an auto-sync option.
- **Documentation**
- Guides, migration notes, examples, and API docs updated to use
"in-app" and the new string-union terminology for product types,
platforms, events, and states.
- **Tests**
- Unit and example tests updated to reflect "in-app" and standardized
platform/purchase string values.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy file name to clipboardExpand all lines: CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ For complete type definitions and documentation, see: <https://www.openiap.dev/d
62
62
63
63
The library follows the OpenIAP type specifications with platform-specific extensions using iOS/Android suffixes.
64
64
65
-
> **Note:**`src/types.ts` is generated from the OpenIAP schema. Do **not**edit this file manually—run `npm run generate` after updating any `*.graphql` schema instead.
65
+
> **Important:**`src/types.ts` is generated from the OpenIAP schema. Never edit this file manually or commit hand-written changes. After updating any `*.graphql` schema, run `bun run generate:types` (or the equivalent script in your package manager) to refresh the file.
Copy file name to clipboardExpand all lines: docs/docs/api/types.md
+23-30Lines changed: 23 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ import AdFitTopFixed from "@site/src/uis/AdFitTopFixed";
4
4
5
5
<AdFitTopFixed />
6
6
7
-
The expo-iap type surface is now generated in one place: `src/types.ts`. The file is produced by our GraphQL schema and represents the canonical source for all product, purchase, subscription, and request shapes. After updating any schema definitions, run `npm run generate` to refresh the file.
7
+
The expo-iap type surface is now generated in one place: `src/types.ts`. The file is produced by our GraphQL schema and represents the canonical source for all product, purchase, subscription, and request shapes. After updating any schema definitions, run `bun run generate:types` to refresh the file.
8
8
9
9
Key runtime helpers that build on these types live alongside them:
10
10
@@ -14,27 +14,20 @@ Key runtime helpers that build on these types live alongside them:
14
14
15
15
Below is a curated overview of the most commonly used types. Consult `src/types.ts` for the full schema.
16
16
17
-
## Core Enumerations
17
+
## Core Type Aliases
18
18
19
19
```ts
20
-
exportenumPlatform {
21
-
Android='ANDROID',
22
-
Ios='IOS',
23
-
}
20
+
exporttypeIapPlatform='android'|'ios';
24
21
25
-
exportenumProductType {
26
-
InApp='IN_APP',
27
-
Subs='SUBS',
28
-
}
22
+
exporttypeProductType='in-app'|'subs';
29
23
30
-
exportenumPurchaseState {
31
-
Deferred='DEFERRED',
32
-
Failed='FAILED',
33
-
Pending='PENDING',
34
-
Purchased='PURCHASED',
35
-
Restored='RESTORED',
36
-
Unknown='UNKNOWN',
37
-
}
24
+
exporttypePurchaseState=
25
+
|'deferred'
26
+
|'failed'
27
+
|'pending'
28
+
|'purchased'
29
+
|'restored'
30
+
|'unknown';
38
31
```
39
32
40
33
The `ErrorCode` enum now mirrors the OpenIAP schema without the legacy `E_` prefix:
@@ -54,7 +47,7 @@ Use `PurchaseError` from `src/purchase-error.ts` to work with typed errors and p
54
47
55
48
## Product Types
56
49
57
-
All products share the generated `ProductCommon` interface. Platform extensions discriminate on the `platform` field via the `Platform` enum.
50
+
All products share the generated `ProductCommon` interface. Platform extensions discriminate on the `platform` field via the `IapPlatform` string union.
Purchases share the `PurchaseCommon` shape and discriminate on the same `platform`enum. Both variants expose the unified `purchaseToken` field for server validation.
89
+
Purchases share the `PurchaseCommon` shape and discriminate on the same `platform`union. Both variants expose the unified `purchaseToken` field for server validation.
-**Description**: Fetch products or subscriptions and update `products` / `subscriptions` state. In the hook this returns `void` (no data result), by design.
224
224
-**Do not await for data**: Call it, then consume `products` / `subscriptions` state from the hook.
0 commit comments