@tinkerlandai/indiana-react-native 0.0.0-stage → 0.6.3
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/README.md +52 -2
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +379 -0
- package/dist/index.d.ts +379 -0
- package/dist/index.js +1 -0
- package/package.json +57 -4
package/README.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Indiana React Native SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Customer identity, holdings, entitlement checks and backend-mediated usage reporting for React Native 0.79+ / Metro 0.82+. This independent npm package uses Fetch and AbortController. It needs no DOM, WebView, native linking or React peer dependency. It does not include store purchases or Funnel native UI.
|
|
4
|
+
|
|
5
|
+
Install the exact package version:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --save-exact @tinkerlandai/indiana-react-native@0.6.3
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { createIndianaReactNative } from "@tinkerlandai/indiana-react-native";
|
|
13
|
+
|
|
14
|
+
const indiana = createIndianaReactNative({
|
|
15
|
+
scope: { projectId: "YOUR_APP_UUID", environment: "sandbox" },
|
|
16
|
+
baseUrl: "https://api.dev.tinker.cash",
|
|
17
|
+
usageReporter: async (command) => {
|
|
18
|
+
const response = await fetch("https://your-app.example/api/usage", {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers: {
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
Authorization: `Bearer ${yourAppSessionToken}`,
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify(command),
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) throw new Error("Usage reporting failed");
|
|
27
|
+
return response.json();
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Your backend issues a Customer Token for its authenticated app user.
|
|
32
|
+
indiana.identify(customerToken);
|
|
33
|
+
const holdings = await indiana.readHoldings();
|
|
34
|
+
const entitlement = await indiana.checkEntitlement({
|
|
35
|
+
requirement: {
|
|
36
|
+
internal_feature_id: "YOUR_FEATURE_UUID",
|
|
37
|
+
quantity: "1",
|
|
38
|
+
properties: {},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
await indiana.trackUsage({
|
|
42
|
+
eventName: "images",
|
|
43
|
+
quantity: "1",
|
|
44
|
+
idempotencyKey: "stable-id-for-this-usage-event",
|
|
45
|
+
});
|
|
46
|
+
indiana.reset();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Never ship a Server Key in the app. `usageReporter` receives only a validated usage command. Your backend authenticates its own app session, selects the Customer and invokes the server SDK with its Server Key; return that SDK's complete usage response unchanged. Preserve the event's idempotency key across retries. The SDK validates response schema and App/environment and rejects results if identity changes while reporting. The callback owns its network timeout and retry policy.
|
|
50
|
+
|
|
51
|
+
Credentials stay in memory. Call `reset()` at logout. Customer creation and token issuance belong on your backend. The existing `@tinkerlandai/indiana-sdk/react-native` subpath uses the same source implementation; install only one entry in an application.
|
|
52
|
+
|
|
53
|
+
Package versions use the shared `sdk-vX.Y.Z` release. The package includes ESM, CommonJS and TypeScript declarations and a portable URL parser for React Native hosts whose built-in URL is incomplete. It does not replace application globals; its only runtime dependency is Zod. See the repository's [mobile integration guide](https://github.com/tinkerlandai/Indiana/blob/main/docs/mobile-sdk.md) and [release commands](https://github.com/tinkerlandai/Indiana/blob/main/docs/automated-releases.md).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# whatwg-url-minimum 0.2.0
|
|
2
|
+
|
|
3
|
+
Bundled URL implementation from https://github.com/expo/whatwg-url-minimum.
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) Phil Pluckthun,
|
|
8
|
+
Copyright (c) 650 Industries, Inc. (aka Expo),
|
|
9
|
+
Copyright (c) Sebastian Mayr
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|