@tinkerlandai/indiana-sdk 0.8.5 → 0.9.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 +6 -0
- package/README.md +20 -41
- package/README.zh-CN.md +17 -17
- package/dist/{ai-usage-DUlre7JC.d.ts → ai-usage-DMNKvCiq.d.ts} +3 -3
- package/dist/{api-XDc4pRlN.d.ts → api--Zf0gxfj.d.ts} +128 -124
- package/dist/chunk-3PZ4Y6UD.js +17 -0
- package/dist/chunk-5O667MKA.js +1 -0
- package/dist/chunk-7DXL3LHT.js +1 -0
- package/dist/{chunk-WWUUVURR.js → chunk-7IB7CZ5P.js} +1 -1
- package/dist/chunk-CPLLMISZ.js +1 -0
- package/dist/chunk-DAWZULXZ.js +1 -0
- package/dist/chunk-G23YNWWI.js +1 -0
- package/dist/chunk-G56XGVMS.js +1 -0
- package/dist/chunk-IH4KBLNR.js +1 -0
- package/dist/chunk-JEFEBF2H.js +1 -0
- package/dist/chunk-L7LKE3MG.js +173 -0
- package/dist/chunk-NH2PTTNK.js +2 -0
- package/dist/chunk-NTP55JMK.js +1 -0
- package/dist/chunk-SX5MO56H.js +4 -0
- package/dist/chunk-UBRLGIZE.js +1 -0
- package/dist/chunk-YAU4DI52.js +1 -0
- package/dist/{configuration-sync-Ce3dShy7.d.ts → configuration-sync-E98CqVwh.d.ts} +6 -5
- package/dist/content-YAPEUX6I.js +1 -0
- package/dist/{errors-C8lRYZ0n.d.ts → errors-0TSUIbUi.d.ts} +12 -1
- package/dist/{funnel-local-client-CUGavICI.d.ts → funnel-local-client-BjPwXlQb.d.ts} +550 -260
- package/dist/funnel-runtime-host-OZA763NT.js +1 -0
- package/dist/index.d.ts +689 -223
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +3 -3
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +6 -6
- package/dist/page.js +1 -1
- package/dist/paywall-EM7RGU56.js +1 -0
- package/dist/popup.d.ts +1 -1
- package/dist/popup.js +1 -1
- package/dist/react-native.d.ts +122 -99
- package/dist/react-native.js +1 -1
- package/dist/screen-renderer-A6VYE2QL.js +1 -0
- package/dist/server.d.ts +58 -58
- package/dist/server.js +1 -1
- package/dist/visual.d.ts +36 -1
- package/dist/visual.js +1 -2
- package/package.json +1 -1
- package/dist/chunk-3KQHKRZJ.js +0 -1
- package/dist/chunk-6A5WWFNS.js +0 -10
- package/dist/chunk-A3XRIG53.js +0 -1
- package/dist/chunk-BUDTHBFF.js +0 -173
- package/dist/chunk-FGIGKO7A.js +0 -1
- package/dist/chunk-GRLMT5PR.js +0 -1
- package/dist/chunk-HEBQUICQ.js +0 -4
- package/dist/chunk-KQCTDXVD.js +0 -17
- package/dist/chunk-LMR2TM3X.js +0 -1
- package/dist/chunk-OBYJWIRB.js +0 -1
- package/dist/chunk-RRII2DMC.js +0 -1
- package/dist/chunk-SOQO2RDZ.js +0 -1
- package/dist/chunk-SUXAWRR6.js +0 -1
- package/dist/chunk-VVV3JNS3.js +0 -1
- package/dist/content-DDMDNRCV.js +0 -1
- package/dist/funnel-runtime-host-QK6WDRPS.js +0 -1
- package/dist/paywall-4QT3JYD4.js +0 -1
- package/dist/screen-renderer-DLXDQQKK.js +0 -1
- package/dist/src-EG7RWDDY.js +0 -1
- package/dist/{screen-BpAejkn0.d.ts → screen-BITZ11jn.d.ts} +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Release facts and artifact evidence: [SDK release ledger](../../docs/sdk-releases.md).
|
|
4
4
|
|
|
5
|
+
## 0.9.1 — 2026-10-29
|
|
6
|
+
|
|
7
|
+
- Return scoped Access/Refresh credential pairs from backend issuance and Guest session resumption. Replace backend renewal with client Refresh Token rotation; backend revocation invalidates both credentials.
|
|
8
|
+
- Automatically refresh in Web, React Native, Swift and Kotlin without resetting Customer state, analytics queues, Funnel Runs or Paywalls. Fence account changes and retain Refresh Tokens after lost responses.
|
|
9
|
+
- Go owns opaque-session lifecycle and authorization policy; PostgreSQL serializes rotation and revocation. Protocol 0.9 requires the matching runtime and SQL migrations and refuses older development protocols.
|
|
10
|
+
|
|
5
11
|
## 0.8.5 — 2026-10-27
|
|
6
12
|
|
|
7
13
|
- Add direct browser script loading through `/sdk.js`, sharing the npm browser APIs and page/visual experiment factories without requiring a bundler. Website deployment distributes this entry independently of npm publication.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @tinkerlandai/indiana-sdk
|
|
2
2
|
|
|
3
|
-
These examples
|
|
3
|
+
These examples target SDK 0.9.1 and protocol 0.9 at `https://api.tinker.cash`, using a Sandbox App and credentials issued by the production deployment. Sandbox still contains production data; do not reuse credentials from the separate test deployment. Confirm runtime readiness in [environment state](../../docs/development-status.md) before running them.
|
|
4
4
|
|
|
5
5
|
[简体中文](./README.zh-CN.md)
|
|
6
6
|
|
|
@@ -9,10 +9,10 @@ The Indiana business SDK groups its capabilities as **Identity, Commerce, Growth
|
|
|
9
9
|
**IAM source scanning, generation, validation and upload belong to the independent build package `@tinkerlandai/indiana-iam`.** This business SDK retains only the runtime release binding used by GB visual changes. See [SDK boundaries](../../docs/sdk-architecture.md) and the [IAM package](../iam/README.md).
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install --save-exact @tinkerlandai/indiana-sdk@0.
|
|
12
|
+
npm install --save-exact @tinkerlandai/indiana-sdk@0.9.1
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
SDK 0.
|
|
15
|
+
SDK 0.9.1 requires HTTP protocol 0.9. Install a version that matches your runtime; publishing a package does not deploy the server. Publication and accepted environment scope are recorded in the [release ledger](../../docs/sdk-releases.md) and [development status](../../docs/development-status.md).
|
|
16
16
|
|
|
17
17
|
The data/session layer handles public JSON, integrity checks and authenticated operations. The presentation host composes that layer with the packaged screen renderer; the renderer receives supplied data and emits action intents. Client display entry points load presentation lazily. The `/server` entry has no screen presentation dependency and uses a scoped Server Key only on your backend. A local SDK guard never replaces runtime authorization or verified payment completion. Console preview supplies simulated data/session results to the same presentation host.
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ The data/session layer handles public JSON, integrity checks and authenticated o
|
|
|
21
21
|
The classic-script entry reuses the npm browser implementation, with no bundler:
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
|
-
<script src="https://
|
|
24
|
+
<script src="https://tinker.cash/sdk.js"></script>
|
|
25
25
|
<script type="module">
|
|
26
26
|
const {
|
|
27
27
|
createIndiana,
|
|
@@ -32,11 +32,11 @@ The classic-script entry reuses the npm browser implementation, with no bundler:
|
|
|
32
32
|
mountContent,
|
|
33
33
|
} = await Indiana.ready;
|
|
34
34
|
const client = createIndiana({
|
|
35
|
-
baseUrl: "https://api.
|
|
35
|
+
baseUrl: "https://api.tinker.cash",
|
|
36
36
|
scope: { projectId: "<APP_UUID>", environment: "sandbox" },
|
|
37
37
|
});
|
|
38
|
-
// Obtain
|
|
39
|
-
// client.identify(
|
|
38
|
+
// Obtain the complete session pair from your authenticated backend.
|
|
39
|
+
// client.identify(session);
|
|
40
40
|
// await client.readHoldings();
|
|
41
41
|
// client.track("page_viewed", { page: location.pathname });
|
|
42
42
|
// await client.flush();
|
|
@@ -82,32 +82,9 @@ The canonical repository policy, including production/test domain roles, package
|
|
|
82
82
|
|
|
83
83
|
Omitting `baseUrl` selects `https://api.tinker.cash`. This applies to Customer/Server, Funnel, Feature, Paywall, page and visual clients. `createConfigurationSync` also defaults its optional `origin` to that address. Swift `IndianaConfiguration(scope: ...)` and Kotlin `IndianaConfiguration(scope = ...)` uses the same default and shared release version. Explicit `baseURL` / `baseUrl` still overrides it. Funnel and Paywall shells and renderers are packaged locally; their executable code is not downloaded from that API origin.
|
|
84
84
|
|
|
85
|
-
Both `beta` and `latest` versions published with this default use the production API address. Tags select package versions, not deployments.
|
|
85
|
+
Both `beta` and `latest` versions published with this default use the production API address. Tags select package versions, not deployments. The separate test API at `https://api.dev.tinker.cash` requires its own credentials and a client matching its deployed protocol; it is outside this production 0.9 rollout.
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Set `INDIANA_TEST_BASE_URL=https://api.dev.tinker.cash` and use the native Cloud SQL test App/Key. A production Key or a retained Supabase Key cannot authenticate against that test environment.
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
const testBaseUrl = process.env.INDIANA_TEST_BASE_URL;
|
|
93
|
-
if (!testBaseUrl) throw new Error("Set INDIANA_TEST_BASE_URL explicitly");
|
|
94
|
-
|
|
95
|
-
const scope = { projectId: testProjectId, environment: "sandbox" as const };
|
|
96
|
-
const server = createIndianaServer({
|
|
97
|
-
baseUrl: testBaseUrl,
|
|
98
|
-
apiKey: testServerKey,
|
|
99
|
-
scope,
|
|
100
|
-
});
|
|
101
|
-
const customer = createIndiana({ baseUrl: testBaseUrl, scope });
|
|
102
|
-
const configuration = createConfigurationSync({
|
|
103
|
-
origin: testBaseUrl,
|
|
104
|
-
scope: { ...scope, environmentId: testEnvironmentId },
|
|
105
|
-
});
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Use the same explicit address for every client in a test run, including Funnel start/controllers and page/visual clients. Environment variables are read by the host, not automatically by the SDK. Sandbox/Live selects business scope inside the chosen service; it does not select a deployment or database. Never retry against another service automatically after an error or unknown command result.
|
|
109
|
-
|
|
110
|
-
For maintainer checks, use the [SDK testing guide](../../docs/sdk-selfserve.md#maintainer-api-origin-testing). SDK contract fixtures and actual GOP business tests have separate owners.
|
|
87
|
+
Use the same API origin for every client and configuration-sync instance in one integration. Sandbox/Live selects business scope inside that deployment, not a different service or database. Never retry against another service automatically after an error or unknown command result. Maintainer test runs require an explicit target and must not fall back to production; follow the [SDK testing guide](../../docs/sdk-selfserve.md#maintainer-api-origin-testing).
|
|
111
88
|
|
|
112
89
|
## Create a Customer Session from a trusted backend
|
|
113
90
|
|
|
@@ -126,7 +103,7 @@ const user = await requireSignedInUser(request);
|
|
|
126
103
|
const { customer } = await indiana.getOrCreateCustomer({
|
|
127
104
|
externalUserId: user.id,
|
|
128
105
|
});
|
|
129
|
-
const
|
|
106
|
+
const session = await indiana.createCustomerSession(customer.id);
|
|
130
107
|
```
|
|
131
108
|
|
|
132
109
|
Keep the Secret Key on your trusted backend. A Customer ID supplied by a browser is not proof of login. Give each Customer Token only to the corresponding authenticated user. App, Sandbox/Live environment, Customer identity, permissions, and allowed origins are checked independently. The SDK holds Customer credentials in memory; destroy the previous view and clear credentials when signing out or changing accounts.
|
|
@@ -138,13 +115,13 @@ const indiana = createIndiana({
|
|
|
138
115
|
baseUrl,
|
|
139
116
|
scope: { projectId, environment: "sandbox" },
|
|
140
117
|
});
|
|
141
|
-
indiana.identify(
|
|
118
|
+
indiana.identify(session);
|
|
142
119
|
const { holdings } = await indiana.readHoldings();
|
|
143
120
|
// On sign-out:
|
|
144
121
|
indiana.reset();
|
|
145
122
|
```
|
|
146
123
|
|
|
147
|
-
|
|
124
|
+
The SDK refreshes its Access/Refresh pair directly with GOP. Access lasts at most one hour, Refresh at most 24 hours per rotation, within the original 30-day session limit. Successful rotation preserves the Customer identity and pending work; a definitive refresh refusal or expired Refresh Token clears the credentials and requires a new verified login. Business requests do not extend expiry or automatically replay after refresh. Revocation and issuer expiry still apply. See [Customer credentials](../../docs/customer-credentials.md).
|
|
148
125
|
|
|
149
126
|
Customer updates are partial patches and do not use a Customer revision. When a Guest signs in to an existing Customer, the response reports `switched: true`. Resources and history keep their original owner; create a new Session/Funnel for the target Customer. Guest financial facts are not merged.
|
|
150
127
|
|
|
@@ -303,15 +280,15 @@ import {
|
|
|
303
280
|
createIndiana,
|
|
304
281
|
} from "@tinkerlandai/indiana-sdk";
|
|
305
282
|
|
|
306
|
-
//
|
|
307
|
-
const
|
|
283
|
+
// Use a Sandbox App and credentials issued by the production deployment.
|
|
284
|
+
const apiUrl = "https://api.tinker.cash";
|
|
308
285
|
const scope = { projectId, environment: "sandbox" as const, environmentId };
|
|
309
286
|
const configuration = createConfigurationSync({
|
|
310
|
-
origin:
|
|
287
|
+
origin: apiUrl,
|
|
311
288
|
scope,
|
|
312
289
|
});
|
|
313
290
|
const indiana = createIndiana({
|
|
314
|
-
baseUrl:
|
|
291
|
+
baseUrl: apiUrl,
|
|
315
292
|
scope: { projectId, environment: "sandbox" },
|
|
316
293
|
configuration,
|
|
317
294
|
});
|
|
@@ -403,8 +380,8 @@ export async function showBanner(
|
|
|
403
380
|
onContinue: (intent: ContentActionIntent) => Promise<void>,
|
|
404
381
|
) {
|
|
405
382
|
const indiana = createIndiana({
|
|
406
|
-
baseUrl: "https://api.
|
|
407
|
-
scope: { projectId: "<
|
|
383
|
+
baseUrl: "https://api.tinker.cash",
|
|
384
|
+
scope: { projectId: "<APP_UUID>", environment: "sandbox" },
|
|
408
385
|
});
|
|
409
386
|
indiana.identify(customerToken);
|
|
410
387
|
const { content } = await indiana.resolveContent({
|
|
@@ -448,3 +425,5 @@ openButton.addEventListener("click", () => popup.show(), {
|
|
|
448
425
|
```
|
|
449
426
|
|
|
450
427
|
Preparation waits for the first render without opening the dialog or running actions. `show()` reveals the same iframe and is idempotent; destroy and prepare a fresh handle for another presentation. Abort also cancels preparation while it is pending. This does not pre-authorize business operations or guarantee that images have decoded. For low-level ScreenDocument rendering, `/popup` provides `preparePopup(document, options)` with `ready`, `show()` and `destroy()`.
|
|
428
|
+
|
|
429
|
+
Customer sessions contain `customerId`, `sessionId`, `accessToken`, `refreshToken`, `expiresAt` and `refreshExpiresAt`. Return the pair only to the authenticated merchant user with `Cache-Control: no-store`, then call `indiana.identify(session)`. The SDK refreshes directly with GOP and keeps credentials in memory; account reset fences pending refresh. Your backend uses `revokeCustomerSessions({customerId, sessionId?})` for revocation. Share `indiana.session` through the `session` option of independent Paywall/Funnel clients to preserve one refresh lifecycle.
|
package/README.zh-CN.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[English](./README.md)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
本页示例面向 SDK 0.9.1 和协议 0.9,使用 `https://api.tinker.cash` 以及生产部署内签发的 Sandbox App/凭据。Sandbox 仍属于生产数据,不能复用独立测试部署的凭据。运行前核对[环境状态](../../docs/development-status.md),确认服务已就绪。
|
|
4
4
|
|
|
5
5
|
# @tinkerlandai/indiana-sdk
|
|
6
6
|
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
**IAM 的源码扫描、生成、校验和上传属于独立构建包 `@tinkerlandai/indiana-iam`。** 普通业务 SDK 只保留 GB visual 应用页面变更所需的运行时 release 绑定。完整定义见 [SDK 边界](../../docs/sdk-architecture.md) 与 [IAM 构建包](../iam/README.md)。
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install --save-exact @tinkerlandai/indiana-sdk@0.
|
|
12
|
+
npm install --save-exact @tinkerlandai/indiana-sdk@0.9.1
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
SDK 0.
|
|
15
|
+
SDK 0.9.1 要求 HTTP 协议 0.9。安装版本须与运行服务匹配;发布包不会部署服务端。实际发布、标签与环境验收范围见 [SDK 发布总账](../../docs/sdk-releases.md) 和 [开发状态](../../docs/development-status.md)。
|
|
16
16
|
|
|
17
17
|
数据/会话层负责公开 JSON、完整性校验和鉴权操作;展示宿主将会话接口接入打包的屏幕渲染器,渲染器消费已提供的数据并返回动作意图。客户端按需加载展示;`/server` 入口使用商户后端的受限 Server Key,不加载屏幕展示。SDK 本地检查不替代运行时授权或付款核实。后台 Preview 为同一个展示宿主提供模拟会话和数据。
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ SDK 0.8.4 要求 HTTP 协议 0.8。安装版本须与运行服务匹配;发布
|
|
|
21
21
|
普通 script 标签复用 npm 浏览器实现,无需打包工具:
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
|
-
<script src="https://
|
|
24
|
+
<script src="https://tinker.cash/sdk.js"></script>
|
|
25
25
|
<script type="module">
|
|
26
26
|
const {
|
|
27
27
|
createIndiana,
|
|
@@ -32,11 +32,11 @@ SDK 0.8.4 要求 HTTP 协议 0.8。安装版本须与运行服务匹配;发布
|
|
|
32
32
|
mountContent,
|
|
33
33
|
} = await Indiana.ready;
|
|
34
34
|
const client = createIndiana({
|
|
35
|
-
baseUrl: "https://api.
|
|
35
|
+
baseUrl: "https://api.tinker.cash",
|
|
36
36
|
scope: { projectId: "<APP_UUID>", environment: "sandbox" },
|
|
37
37
|
});
|
|
38
|
-
//
|
|
39
|
-
// client.identify(
|
|
38
|
+
// 从验证登录后的自有后端获取完整 session 凭据对。
|
|
39
|
+
// client.identify(session);
|
|
40
40
|
// await client.readHoldings();
|
|
41
41
|
// client.track("page_viewed", { page: location.pathname });
|
|
42
42
|
// await client.flush();
|
|
@@ -94,11 +94,9 @@ JavaScript 与 TypeScript 共用本包,声明文件随包提供。内部 `@ind
|
|
|
94
94
|
|
|
95
95
|
包含此默认值的版本无论标记为 `beta` 或 `latest`,都使用生产 API 地址。标签选择包版本,不选择服务环境。两套 API 入口经 Vercel 转发到各自 Go Indianapolis,入口和业务就绪分别验收。
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
同一次接入中的所有客户端与配置同步实例使用同一个 API origin。`environment: "sandbox"` 只选择该部署内的业务环境,不选择另一套服务或数据库;错误或未知写入结果不能触发跨环境自动重试。
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
维护者验证入口见[测试流程](../../docs/sdk-selfserve.md#maintainer-api-origin-testing)。SDK 契约夹具与真实 GOP 业务测试分别负责,不以旧版本通过数描述当前能力。
|
|
99
|
+
独立测试 API `https://api.dev.tinker.cash` 不在本次生产 0.9 升级范围内,必须使用与其已部署协议匹配的 SDK 和测试凭据。维护者测试必须显式指定目标,不能回落生产默认值,见[测试流程](../../docs/sdk-selfserve.md#maintainer-api-origin-testing)。
|
|
102
100
|
|
|
103
101
|
## 从可信后端创建 Customer Session
|
|
104
102
|
|
|
@@ -117,10 +115,10 @@ const user = await requireSignedInUser(request);
|
|
|
117
115
|
const { customer } = await indiana.getOrCreateCustomer({
|
|
118
116
|
externalUserId: user.id,
|
|
119
117
|
});
|
|
120
|
-
const
|
|
118
|
+
const session = await indiana.createCustomerSession(customer.id);
|
|
121
119
|
```
|
|
122
120
|
|
|
123
|
-
Secret Key 仅保存在可信后端。浏览器传入的 Customer ID
|
|
121
|
+
Secret Key 仅保存在可信后端。浏览器传入的 Customer ID 不能作为登录证明;将完整 Access/Refresh 凭据对交给对应的已登录用户。App、Sandbox/Live、Customer、权限和允许来源分别校验。SDK 在内存中持有客户凭据;退出或切换身份时销毁旧视图并清理凭据。
|
|
124
122
|
|
|
125
123
|
```ts
|
|
126
124
|
import { createIndiana } from "@tinkerlandai/indiana-sdk";
|
|
@@ -129,13 +127,13 @@ const indiana = createIndiana({
|
|
|
129
127
|
baseUrl,
|
|
130
128
|
scope: { projectId, environment: "sandbox" },
|
|
131
129
|
});
|
|
132
|
-
indiana.identify(
|
|
130
|
+
indiana.identify(session);
|
|
133
131
|
const { holdings } = await indiana.readHoldings();
|
|
134
132
|
// 退出账号时:
|
|
135
133
|
indiana.reset();
|
|
136
134
|
```
|
|
137
135
|
|
|
138
|
-
|
|
136
|
+
SDK 通过 Refresh Token 直接向 GOP 轮换凭据;Access 最长 1 小时,Refresh 每次轮换最长 24 小时,原会话最长 30 天。成功轮换保留当前 Customer 身份和待处理业务;刷新被明确拒绝或 Refresh Token 过期时清除凭据,需要重新验证登录。普通业务请求不延期,刷新不会自动重放业务写入。撤销和 Key 到期继续生效。见[Customer 凭据](../../docs/customer-credentials.md)。
|
|
139
137
|
|
|
140
138
|
Customer 使用原始业务字段;资料更新是部分 patch,没有 Customer revision。Guest 登录到已有 Customer 时返回 `switched: true`,资源和历史保留原归属,接入方应为目标 Customer 创建新 Session/Funnel;不合并旧 Guest 的财务事实。
|
|
141
139
|
|
|
@@ -308,8 +306,8 @@ export async function showBanner(
|
|
|
308
306
|
onContinue: (intent: ContentActionIntent) => Promise<void>,
|
|
309
307
|
) {
|
|
310
308
|
const indiana = createIndiana({
|
|
311
|
-
baseUrl: "https://api.
|
|
312
|
-
scope: { projectId: "<
|
|
309
|
+
baseUrl: "https://api.tinker.cash",
|
|
310
|
+
scope: { projectId: "<APP_UUID>", environment: "sandbox" },
|
|
313
311
|
});
|
|
314
312
|
indiana.identify(customerToken);
|
|
315
313
|
const { content } = await indiana.resolveContent({
|
|
@@ -336,3 +334,5 @@ export async function showBanner(
|
|
|
336
334
|
需要加快点击打开时,可提前为当前 Customer 读取内容,再调用根入口的 `prepareContent(container, options)`,参数与 `mountContent` 相同。它提前加载展示模块、校验文档并启动 iframe,等首次渲染后返回句柄;点击时同步调用 `handle.show()`,直接显示同一个 iframe。准备期间不打开弹窗、不抢焦点、不执行动作。句柄用于一次展示,重复 `show()` 不重复挂载;下一次展示需重新准备。
|
|
337
335
|
|
|
338
336
|
可传入 `signal: abortController.signal`,在卸载、退出或切换 Customer/App/环境时 `abortController.abort()`,连同仍在等待的准备一起取消并释放资源。预渲染不代替业务鉴权,也不保证图片已完成解码。直接持有已授权 ScreenDocument 的低层接入可使用 `/popup` 的 `preparePopup(document, options)`;句柄立即返回,提供 `ready`、`show()` 和 `destroy()`。
|
|
337
|
+
|
|
338
|
+
客户会话返回 `customerId`、`sessionId`、`accessToken`、`refreshToken`、`expiresAt`、`refreshExpiresAt`。后端只向当前已验证用户返回这组数据,并设置 `Cache-Control: no-store`;客户端调用 `indiana.identify(session)`。SDK 在内存中保管凭据,直接向 GOP 刷新,切换账号或 reset 后不接纳旧刷新响应。撤销由后端调用 `revokeCustomerSessions({customerId, sessionId?})`。独立 Paywall/Funnel 客户端可通过 `session: indiana.session` 共用刷新生命周期。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LanguageModelV4Usage, LanguageModelV4Middleware } from '@ai-sdk/provider';
|
|
2
|
-
import { F as FoundationApi, A as ApiInput } from './api
|
|
2
|
+
import { F as FoundationApi, A as ApiInput } from './api--Zf0gxfj.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const tokenCounts: z.ZodObject<{
|
|
@@ -104,7 +104,7 @@ declare function createAiPricing(options?: AiPricingOptions): {
|
|
|
104
104
|
accepted: boolean;
|
|
105
105
|
reason: "expired" | "unavailable" | "insufficient_balance" | "limit_exceeded" | "awaiting_topup" | "authorization_required" | "payment_blocked" | "cash_budget_exceeded" | null;
|
|
106
106
|
createdAt: string;
|
|
107
|
-
reservationStatus: "
|
|
107
|
+
reservationStatus: "expired" | "pending" | "confirmed" | "released" | null;
|
|
108
108
|
expiresAt: string | null;
|
|
109
109
|
allocations: ({
|
|
110
110
|
funding: "prepaid";
|
|
@@ -175,7 +175,7 @@ declare function createConfiguredAiPricing(client: Pick<FoundationApi, "readAiPr
|
|
|
175
175
|
accepted: boolean;
|
|
176
176
|
reason: "expired" | "unavailable" | "insufficient_balance" | "limit_exceeded" | "awaiting_topup" | "authorization_required" | "payment_blocked" | "cash_budget_exceeded" | null;
|
|
177
177
|
createdAt: string;
|
|
178
|
-
reservationStatus: "
|
|
178
|
+
reservationStatus: "expired" | "pending" | "confirmed" | "released" | null;
|
|
179
179
|
expiresAt: string | null;
|
|
180
180
|
allocations: ({
|
|
181
181
|
funding: "prepaid";
|