@reopt-ai/brandapp-sdk 3.6.0 → 4.1.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 +60 -0
- package/README.md +12 -13
- package/dist/ai/index.js +1 -1
- package/dist/ai-provider/index.js +1 -1
- package/dist/analytics/index.d.ts +22 -0
- package/dist/analytics/index.js +44 -0
- package/dist/auth/index.js +1 -1
- package/dist/better-auth/client.d.ts +56 -12
- package/dist/better-auth/client.js +27 -11
- package/dist/better-auth/index.d.ts +29 -1
- package/dist/better-auth/index.js +22 -3
- package/dist/client-2IaU8yUs.js +20 -0
- package/dist/{client-DVydvzc2.js → client-CHp-oNJB.js} +3 -3
- package/dist/{client-D4Z2xj4t.js → client-CP9RSAzn.js} +2 -2
- package/dist/{client-CiCPE2MW.js → client-CTefnLKY.js} +3 -3
- package/dist/{client-WP3Xsxri.js → client-DE3FvPFs.js} +2 -2
- package/dist/client-DZu4msTG.d.ts +24 -0
- package/dist/{client-B84P9y2F.js → client-D_7G37OB.js} +2 -2
- package/dist/{client-C_YUxs_X.js → client-Dnp7_J0-.js} +2 -2
- package/dist/{client-BFM7OGqI.js → client-Dx3sYx7V.js} +4 -4
- package/dist/{client-CxyXO_0C.js → client-SwByFT8p.js} +2 -2
- package/dist/{client-m29R8F0R.js → client-mvcEj1Vq.js} +3 -3
- package/dist/cms/index.js +1 -1
- package/dist/{config-BV8Fn7Uo.js → config-tEsB7QhQ.js} +2 -2
- package/dist/eav/index.js +2 -2
- package/dist/feedback/index.js +1 -1
- package/dist/files/index.js +1 -1
- package/dist/{http-client-6XUgrg3k.js → http-client-CCFmwnaQ.js} +2 -2
- package/dist/{index-CvNJ8zp1.d.ts → index-DJMr3ixA.d.ts} +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -11
- package/dist/logout/index.js +1 -1
- package/dist/plans/index.js +1 -1
- package/dist/push/index.js +1 -1
- package/dist/{query-C98fDfVW.js → query-Bsgb85OE.js} +2 -2
- package/dist/react/hooks.d.ts +1 -1
- package/dist/terms/index.js +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/{types-B-SMkH6s.d.ts → types-MXLudLBP.d.ts} +6 -2
- package/package.json +15 -6
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,66 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.1.0] — 2026-08-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `sdk.analytics.getConfig()` + `@reopt-ai/brandapp-sdk/analytics` 서브패스
|
|
15
|
+
`startBrandappAnalytics(sdk)` — 브랜드의 reopt-data 수집 설정(`baseUrl`·`writeKey`)을
|
|
16
|
+
브랜드앱 자격으로 받아 `@reopt-ai/data-sdk`를 한 번에 초기화한다(RFC-0023).
|
|
17
|
+
`@reopt-ai/data-sdk`는 optional peer — 이 서브패스를 쓰는 소비자만 설치한다.
|
|
18
|
+
|
|
19
|
+
## [4.0.0] — 2026-08-21
|
|
20
|
+
|
|
21
|
+
Better Auth **1.7** 이행. 1.7이 generic OAuth를 소셜 제공자 경로로 재작성하고
|
|
22
|
+
커스텀 어댑터에 원자 연산 두 개를 필수화하면서 공개 표면이 바뀌어 major다.
|
|
23
|
+
`better-auth` peer는 `^1.7.1`이며 1.6 이하와 함께 쓸 수 없다.
|
|
24
|
+
|
|
25
|
+
### Breaking — `./better-auth/client`
|
|
26
|
+
|
|
27
|
+
- **`createReoptOAuthClient()` 제거.** 1.7에 `genericOAuthClient`가 없다 — 클라이언트
|
|
28
|
+
플러그인 없이 표준 `signIn.social({ provider: "reopt" })`를 쓴다. 헬퍼
|
|
29
|
+
**`signInWithReopt(authClient, { callbackURL })`** / **`linkReoptAccount(authClient)`**가
|
|
30
|
+
provider id를 고정해 준다.
|
|
31
|
+
- **`authClient.signIn.oauth2({ providerId })` → `signIn.social({ provider })`**,
|
|
32
|
+
`oauth2.link()` → `linkSocial()` (better-auth 변경).
|
|
33
|
+
|
|
34
|
+
### Breaking — 콜백 경로
|
|
35
|
+
|
|
36
|
+
- Reopt 로그인 콜백이 **`${baseURL}/api/auth/callback/reopt`**로 옮겨졌다
|
|
37
|
+
(1.6: `/api/auth/oauth2/callback/reopt`). Reopt 시스템 브랜드앱 클라이언트는 두 경로가
|
|
38
|
+
모두 등록돼 있어 바로 동작한다. 직접 등록한 redirect URI가 있으면 **업그레이드 전에**
|
|
39
|
+
새 경로를 추가할 것(exact-match).
|
|
40
|
+
|
|
41
|
+
### Breaking — 토큰 엔드포인트 인증 방식
|
|
42
|
+
|
|
43
|
+
- 1.7 Reopt 인가 서버는 클라이언트가 **등록된** `token_endpoint_auth_method`와 다른
|
|
44
|
+
방식으로 보낸 자격을 거절한다. SDK는 Reopt 브랜드앱 클라이언트의 기본값인
|
|
45
|
+
`client_secret_post`를 명시해 보내며, 다르게 등록된 클라이언트는
|
|
46
|
+
`createReoptOAuth({ tokenEndpointAuthMethod: "client_secret_basic" })`로 맞춘다.
|
|
47
|
+
|
|
48
|
+
### Added — 원격 어댑터
|
|
49
|
+
|
|
50
|
+
- `createReoptAdapter()`가 1.7 필수 원자 연산 **`consumeOne`**(단일 행 읽고 지우기 —
|
|
51
|
+
1회용 토큰)과 **`incrementOne`**(guard 달린 카운터 증가)을 Reopt API에 위임한다.
|
|
52
|
+
Reopt API가 같은 날 배포한 어댑터 엔드포인트를 요구하므로, 서버 응답에
|
|
53
|
+
`Unsupported operation`이 보이면 Reopt 쪽 배포가 아직인 것이다.
|
|
54
|
+
- 소비자 앱의 1.7이 계정을 `(issuer, accountId)`로 찾는다. 1.6 시절 만들어진 계정 행은
|
|
55
|
+
Reopt API가 **첫 조회에서 issuer를 기록**해 주므로 기존 사용자의 로그인이 끊기지
|
|
56
|
+
않는다(소비자 쪽 백필 불필요).
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- **`signOut()`은 계속 앱 세션만 끝낸다.** better-auth 1.7은 generic OAuth `signOut()`을
|
|
61
|
+
OP의 `end_session_endpoint`로 자동 리다이렉트하는데(RP-Initiated Logout), Reopt
|
|
62
|
+
클라이언트 대부분은 로그아웃 개시 권한이 없어 "The client is not allowed to initiate
|
|
63
|
+
logout"으로 끝난다. SDK는 `disableProviderLogout`을 기본으로 켜고, Reopt 세션까지
|
|
64
|
+
끝내려면 `createReoptOAuth({ providerLogout: true | { postLogoutRedirectURI } })`로
|
|
65
|
+
옵트인한다(클라이언트에 `enableEndSession`·post-logout URI 등록 필요).
|
|
66
|
+
- `pkce`는 better-auth 기본값(켜짐)을 따르고, discovery가 돌려주는 `issuer`가 계정
|
|
67
|
+
네임스페이스(`account.issuer`)가 된다 — `idBaseUrl`을 배포 간에 바꾸면 같은 사용자가
|
|
68
|
+
새 계정으로 보이므로 고정할 것.
|
|
69
|
+
|
|
10
70
|
## [3.6.0] — 2026-08-08
|
|
11
71
|
|
|
12
72
|
EAV 목록에서 필요한 값만 받을 수 있는 응답 projection을 추가했다. 기존 호출은
|
package/README.md
CHANGED
|
@@ -38,23 +38,22 @@ export const auth = betterAuth({
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
```typescript
|
|
41
|
-
// auth-client.ts
|
|
41
|
+
// auth-client.ts — better-auth ≥1.7: no client plugin needed
|
|
42
42
|
import { createAuthClient } from "better-auth/client";
|
|
43
|
-
import {
|
|
44
|
-
createReoptOAuthClient,
|
|
45
|
-
REOPT_PROVIDER_ID,
|
|
46
|
-
} from "@reopt-ai/brandapp-sdk/better-auth/client";
|
|
43
|
+
import { signInWithReopt } from "@reopt-ai/brandapp-sdk/better-auth/client";
|
|
47
44
|
|
|
48
|
-
export const authClient = createAuthClient(
|
|
49
|
-
plugins: [createReoptOAuthClient()],
|
|
50
|
-
});
|
|
45
|
+
export const authClient = createAuthClient();
|
|
51
46
|
|
|
52
|
-
authClient.signIn.
|
|
53
|
-
|
|
54
|
-
callbackURL: "/dashboard",
|
|
55
|
-
});
|
|
47
|
+
// = authClient.signIn.social({ provider: "reopt", callbackURL: "/dashboard" })
|
|
48
|
+
signInWithReopt(authClient, { callbackURL: "/dashboard" });
|
|
56
49
|
```
|
|
57
50
|
|
|
51
|
+
> **Callback URL.** Better Auth 1.7 serves the Reopt callback at
|
|
52
|
+
> `${baseURL}/api/auth/callback/reopt` (1.6 used
|
|
53
|
+
> `/api/auth/oauth2/callback/reopt`). Reopt's own system clients have both
|
|
54
|
+
> registered; if you registered a custom redirect URI, add the new path in the
|
|
55
|
+
> studio before upgrading.
|
|
56
|
+
|
|
58
57
|
### Unified SDK
|
|
59
58
|
|
|
60
59
|
```typescript
|
|
@@ -286,7 +285,7 @@ const meta = asJson<Meta>(record.values.meta); // Meta | undefined
|
|
|
286
285
|
| ---------------------------- | -------------------------------------------------------------------------------------- | ---------------------- |
|
|
287
286
|
| `"."` | `createReoptSDK`, `createLazySDK`, `initReoptSDK`, `getReoptSDK`, errors | No |
|
|
288
287
|
| `"./better-auth"` | `createReoptBetterAuth`, `createReoptAdapter`, `createReoptOAuth` | Yes |
|
|
289
|
-
| `"./better-auth/client"` | `
|
|
288
|
+
| `"./better-auth/client"` | `signInWithReopt`, `linkReoptAccount`, `REOPT_PROVIDER_ID` | Yes |
|
|
290
289
|
| `"./eav"` | `createReoptEavClient`, `collectAll`, EAV types, `TypedEavRecord`, `EntityClient` | No |
|
|
291
290
|
| `"./eav/schema"` | `defineEntity`, `defineSchema`, `syncSchema`, `computeDiff`, schema/sync types | No |
|
|
292
291
|
| `"./eav/coerce"` | `asString`, `asNumber`, `asBoolean`, `asDate`, `asJson`, `asStringArray` | No |
|
package/dist/ai/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as mapHttpStatusToError, i as resolveBaseUrl, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-
|
|
1
|
+
import { A as mapHttpStatusToError, i as resolveBaseUrl, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-tEsB7QhQ.js";
|
|
2
2
|
import { t as createManagedAbort } from "../abort--nOBFN4M.js";
|
|
3
3
|
import { t as createAuthHeader } from "../encoding-Bwfm3iaE.js";
|
|
4
4
|
import { t as createSSELineProcessor } from "../sse-parser-FMjxM7sY.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as createReoptAnalyticsClient, r as AnalyticsConfig, t as ReoptAnalyticsClient } from "../client-DZu4msTG.js";
|
|
2
|
+
import { identify, pageView, setConsent, track } from "@reopt-ai/data-sdk";
|
|
3
|
+
//#region src/analytics/browser.d.ts
|
|
4
|
+
type BrandappAnalytics = {
|
|
5
|
+
track: typeof track;
|
|
6
|
+
identify: typeof identify;
|
|
7
|
+
pageView: typeof pageView;
|
|
8
|
+
setConsent: typeof setConsent;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Fetches the config and initialises the SDK. Returns `null` when analytics is
|
|
12
|
+
* not enabled for the brand (project not provisioned) — callers can `?.` every
|
|
13
|
+
* call and ship the same code either way.
|
|
14
|
+
*/
|
|
15
|
+
declare function startBrandappAnalytics(sdk: {
|
|
16
|
+
analytics: ReoptAnalyticsClient;
|
|
17
|
+
}, options?: {
|
|
18
|
+
accessToken?: string;
|
|
19
|
+
}): Promise<BrandappAnalytics | null>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { type AnalyticsConfig, type BrandappAnalytics, ReoptAnalyticsClient, createReoptAnalyticsClient, startBrandappAnalytics };
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-2IaU8yUs.js";
|
|
2
|
+
import { getInstance, identify, init, pageView, setConsent, track } from "@reopt-ai/data-sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/analytics/browser.ts
|
|
5
|
+
/**
|
|
6
|
+
* Browser helper — wires `@reopt-ai/data-sdk` with the brand's collection config
|
|
7
|
+
* in one call, so a brandapp page needs no separate analytics credential.
|
|
8
|
+
*
|
|
9
|
+
* `@reopt-ai/data-sdk` is an optional peer dependency: import this module only
|
|
10
|
+
* from code that installs it.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { startBrandappAnalytics } from "@reopt-ai/brandapp-sdk/analytics";
|
|
15
|
+
*
|
|
16
|
+
* const analytics = await startBrandappAnalytics(sdk);
|
|
17
|
+
* analytics?.pageView();
|
|
18
|
+
* analytics?.track("signup_clicked", { plan: "pro" });
|
|
19
|
+
* analytics?.identify(customerId); // profileId = studio Customer.id
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Fetches the config and initialises the SDK. Returns `null` when analytics is
|
|
24
|
+
* not enabled for the brand (project not provisioned) — callers can `?.` every
|
|
25
|
+
* call and ship the same code either way.
|
|
26
|
+
*/
|
|
27
|
+
async function startBrandappAnalytics(sdk, options = {}) {
|
|
28
|
+
const config = await sdk.analytics.getConfig(options.accessToken);
|
|
29
|
+
if (!config.enabled) return null;
|
|
30
|
+
if (!getInstance()) init({
|
|
31
|
+
baseUrl: config.baseUrl,
|
|
32
|
+
writeKey: config.writeKey
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
track,
|
|
36
|
+
identify,
|
|
37
|
+
pageView,
|
|
38
|
+
setConsent
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { ReoptAnalyticsClient, createReoptAnalyticsClient, startBrandappAnalytics };
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
package/dist/auth/index.js
CHANGED
|
@@ -1,16 +1,58 @@
|
|
|
1
|
-
import { i as REOPT_PROVIDER_ID } from "../types-
|
|
2
|
-
import { genericOAuthClient } from "better-auth/client/plugins";
|
|
1
|
+
import { i as REOPT_PROVIDER_ID } from "../types-MXLudLBP.js";
|
|
3
2
|
//#region src/better-auth/client.d.ts
|
|
4
|
-
type GenericOAuthClientPlugin = ReturnType<typeof genericOAuthClient>;
|
|
5
3
|
/**
|
|
6
|
-
*
|
|
4
|
+
* Minimal shape of a Better Auth client that can start a social sign-in /
|
|
5
|
+
* account link. Structural on purpose: the SDK must not pin the consumer's
|
|
6
|
+
* `createAuthClient` plugin inference (which leaks zod internals into the
|
|
7
|
+
* DTS bundle) — any Better Auth ≥1.7 client satisfies this.
|
|
8
|
+
*/
|
|
9
|
+
type ReoptSocialAuthClient = {
|
|
10
|
+
signIn: {
|
|
11
|
+
social: (input: {
|
|
12
|
+
provider: string;
|
|
13
|
+
callbackURL?: string;
|
|
14
|
+
errorCallbackURL?: string;
|
|
15
|
+
newUserCallbackURL?: string;
|
|
16
|
+
disableRedirect?: boolean;
|
|
17
|
+
requestSignUp?: boolean;
|
|
18
|
+
loginHint?: string;
|
|
19
|
+
additionalData?: Record<string, unknown>;
|
|
20
|
+
}) => Promise<unknown>;
|
|
21
|
+
};
|
|
22
|
+
linkSocial?: (input: {
|
|
23
|
+
provider: string;
|
|
24
|
+
callbackURL?: string;
|
|
25
|
+
errorCallbackURL?: string;
|
|
26
|
+
disableRedirect?: boolean;
|
|
27
|
+
}) => Promise<unknown>;
|
|
28
|
+
};
|
|
29
|
+
type ReoptSignInOptions = {
|
|
30
|
+
/** Where the browser lands after a successful sign-in (relative or absolute). */
|
|
31
|
+
callbackURL?: string;
|
|
32
|
+
/** Where the browser lands when the provider returns an error. */
|
|
33
|
+
errorCallbackURL?: string;
|
|
34
|
+
/** Where first-time users land after sign-up. */
|
|
35
|
+
newUserCallbackURL?: string;
|
|
36
|
+
/** Resolve with the redirect URL instead of navigating (e.g. for a popup). */
|
|
37
|
+
disableRedirect?: boolean;
|
|
38
|
+
/** Opaque client data round-tripped through the flow (read back server-side, treat as untrusted). */
|
|
39
|
+
additionalData?: Record<string, unknown>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Start Reopt sign-in through a Better Auth client.
|
|
43
|
+
*
|
|
44
|
+
* Better Auth 1.7 rebuilt generic OAuth on the social-provider path, so there
|
|
45
|
+
* is no client plugin to install any more: `genericOAuthClient()` and
|
|
46
|
+
* `signIn.oauth2()` are gone, and Reopt is reached through the standard
|
|
47
|
+
* `signIn.social({ provider: "reopt" })`. This helper only fixes the provider
|
|
48
|
+
* id so call sites don't repeat the string.
|
|
7
49
|
*
|
|
8
50
|
* @example
|
|
9
51
|
* ```ts
|
|
10
|
-
* import {
|
|
52
|
+
* import { createAuthClient } from "better-auth/react";
|
|
53
|
+
* import { signInWithReopt } from "@reopt-ai/brandapp-sdk/better-auth/client";
|
|
11
54
|
*
|
|
12
55
|
* const authClient = createAuthClient({
|
|
13
|
-
* plugins: [createReoptOAuthClient()],
|
|
14
56
|
* // ⚡ 탭 포커스마다 /api/auth/get-session을 재요청하는 better-auth 기본
|
|
15
57
|
* // 동작(refetchOnWindowFocus: true)을 끈다. 세션은 cross-subdomain 쿠키로
|
|
16
58
|
* // 공유되고 로그인/로그아웃은 명시적 전환·브로드캐스트로 동기화되므로
|
|
@@ -18,13 +60,15 @@ type GenericOAuthClientPlugin = ReturnType<typeof genericOAuthClient>;
|
|
|
18
60
|
* sessionOptions: { refetchOnWindowFocus: false },
|
|
19
61
|
* });
|
|
20
62
|
*
|
|
21
|
-
* authClient
|
|
22
|
-
* providerId: REOPT_PROVIDER_ID,
|
|
23
|
-
* callbackURL: "/dashboard",
|
|
24
|
-
* });
|
|
63
|
+
* await signInWithReopt(authClient, { callbackURL: "/dashboard" });
|
|
25
64
|
* ```
|
|
26
65
|
*/
|
|
27
|
-
declare function
|
|
66
|
+
declare function signInWithReopt(authClient: ReoptSocialAuthClient, options?: ReoptSignInOptions): Promise<unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* Link the current Better Auth user to their Reopt account
|
|
69
|
+
* (`linkSocial({ provider: "reopt" })`).
|
|
70
|
+
*/
|
|
71
|
+
declare function linkReoptAccount(authClient: ReoptSocialAuthClient, options?: Pick<ReoptSignInOptions, "callbackURL" | "errorCallbackURL" | "disableRedirect">): Promise<unknown>;
|
|
28
72
|
//#endregion
|
|
29
|
-
export { REOPT_PROVIDER_ID,
|
|
73
|
+
export { REOPT_PROVIDER_ID, ReoptSignInOptions, ReoptSocialAuthClient, linkReoptAccount, signInWithReopt };
|
|
30
74
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { n as REOPT_PROVIDER_ID } from "../types-DjDRszNj.js";
|
|
2
|
-
import { genericOAuthClient } from "better-auth/client/plugins";
|
|
3
2
|
|
|
4
3
|
//#region src/better-auth/client.ts
|
|
5
4
|
/**
|
|
6
|
-
* Reopt
|
|
5
|
+
* Start Reopt sign-in through a Better Auth client.
|
|
6
|
+
*
|
|
7
|
+
* Better Auth 1.7 rebuilt generic OAuth on the social-provider path, so there
|
|
8
|
+
* is no client plugin to install any more: `genericOAuthClient()` and
|
|
9
|
+
* `signIn.oauth2()` are gone, and Reopt is reached through the standard
|
|
10
|
+
* `signIn.social({ provider: "reopt" })`. This helper only fixes the provider
|
|
11
|
+
* id so call sites don't repeat the string.
|
|
7
12
|
*
|
|
8
13
|
* @example
|
|
9
14
|
* ```ts
|
|
10
|
-
* import {
|
|
15
|
+
* import { createAuthClient } from "better-auth/react";
|
|
16
|
+
* import { signInWithReopt } from "@reopt-ai/brandapp-sdk/better-auth/client";
|
|
11
17
|
*
|
|
12
18
|
* const authClient = createAuthClient({
|
|
13
|
-
* plugins: [createReoptOAuthClient()],
|
|
14
19
|
* // ⚡ 탭 포커스마다 /api/auth/get-session을 재요청하는 better-auth 기본
|
|
15
20
|
* // 동작(refetchOnWindowFocus: true)을 끈다. 세션은 cross-subdomain 쿠키로
|
|
16
21
|
* // 공유되고 로그인/로그아웃은 명시적 전환·브로드캐스트로 동기화되므로
|
|
@@ -18,16 +23,27 @@ import { genericOAuthClient } from "better-auth/client/plugins";
|
|
|
18
23
|
* sessionOptions: { refetchOnWindowFocus: false },
|
|
19
24
|
* });
|
|
20
25
|
*
|
|
21
|
-
* authClient
|
|
22
|
-
* providerId: REOPT_PROVIDER_ID,
|
|
23
|
-
* callbackURL: "/dashboard",
|
|
24
|
-
* });
|
|
26
|
+
* await signInWithReopt(authClient, { callbackURL: "/dashboard" });
|
|
25
27
|
* ```
|
|
26
28
|
*/
|
|
27
|
-
function
|
|
28
|
-
return
|
|
29
|
+
function signInWithReopt(authClient, options = {}) {
|
|
30
|
+
return authClient.signIn.social({
|
|
31
|
+
provider: "reopt",
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Link the current Better Auth user to their Reopt account
|
|
37
|
+
* (`linkSocial({ provider: "reopt" })`).
|
|
38
|
+
*/
|
|
39
|
+
function linkReoptAccount(authClient, options = {}) {
|
|
40
|
+
if (!authClient.linkSocial) throw new Error("[@reopt-ai/brandapp-sdk] linkReoptAccount() needs a Better Auth client with linkSocial().");
|
|
41
|
+
return authClient.linkSocial({
|
|
42
|
+
provider: "reopt",
|
|
43
|
+
...options
|
|
44
|
+
});
|
|
29
45
|
}
|
|
30
46
|
|
|
31
47
|
//#endregion
|
|
32
|
-
export { REOPT_PROVIDER_ID,
|
|
48
|
+
export { REOPT_PROVIDER_ID, linkReoptAccount, signInWithReopt };
|
|
33
49
|
//# sourceMappingURL=client.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ReoptSDKConfig, t as REOPT_BASE_URLS } from "../config-C7WQtC3l.js";
|
|
2
|
-
import { i as REOPT_PROVIDER_ID, n as AdapterRequestBody, r as REOPT_DEFAULT_SCOPES, t as AdapterOperation } from "../types-
|
|
2
|
+
import { i as REOPT_PROVIDER_ID, n as AdapterRequestBody, r as REOPT_DEFAULT_SCOPES, t as AdapterOperation } from "../types-MXLudLBP.js";
|
|
3
3
|
import { _ as ReoptSDKError, b as ServerError, g as RateLimitError, t as AuthError, w as isReoptSDKError } from "../errors-CRCcErNC.js";
|
|
4
4
|
import { AdapterFactory } from "better-auth/adapters";
|
|
5
5
|
import { BetterAuthOptions, BetterAuthPlugin } from "better-auth";
|
|
@@ -25,6 +25,34 @@ declare function createReoptAdapter(config: ReoptSDKConfig): AdapterFactory<Bett
|
|
|
25
25
|
type ReoptOAuthOptions = ReoptSDKConfig & {
|
|
26
26
|
/** Additional OAuth scopes */
|
|
27
27
|
additionalScopes?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* How this client authenticates at Reopt's token endpoint. Must equal the
|
|
30
|
+
* `token_endpoint_auth_method` the client was **registered** with — Better
|
|
31
|
+
* Auth 1.7's OAuth provider rejects credentials sent through any other
|
|
32
|
+
* method (`invalid_client`). Reopt brandapp clients are registered with
|
|
33
|
+
* `client_secret_post` unless noted otherwise in the studio.
|
|
34
|
+
*
|
|
35
|
+
* @default "client_secret_post"
|
|
36
|
+
*/
|
|
37
|
+
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic";
|
|
38
|
+
/**
|
|
39
|
+
* Also end the user's Reopt (identity provider) session when your app calls
|
|
40
|
+
* `authClient.signOut()` — OIDC RP-Initiated Logout through Reopt's
|
|
41
|
+
* `end_session_endpoint`.
|
|
42
|
+
*
|
|
43
|
+
* Off by default: sign-out only clears your app's own session, which is
|
|
44
|
+
* what Better Auth ≤1.6 did. Turning it on requires the Reopt OAuth client
|
|
45
|
+
* to be allowed to initiate logout (`enableEndSession`) and, if you pass
|
|
46
|
+
* `postLogoutRedirectURI`, that URL to be registered as a post-logout
|
|
47
|
+
* redirect URI — otherwise Reopt answers "The client is not allowed to
|
|
48
|
+
* initiate logout".
|
|
49
|
+
*
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
providerLogout?: boolean | {
|
|
53
|
+
/** Where Reopt sends the browser after ending its session (must be registered). */
|
|
54
|
+
postLogoutRedirectURI?: string;
|
|
55
|
+
};
|
|
28
56
|
};
|
|
29
57
|
/**
|
|
30
58
|
* Reopt OAuth Login Plugin
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ServerError, D as isReoptSDKError, a as resolveIdBaseUrl, b as RateLimitError, s as AuthError, t as REOPT_BASE_URLS, x as ReoptSDKError } from "../config-
|
|
2
|
-
import { t as BaseHttpClient } from "../http-client-
|
|
1
|
+
import { C as ServerError, D as isReoptSDKError, a as resolveIdBaseUrl, b as RateLimitError, s as AuthError, t as REOPT_BASE_URLS, x as ReoptSDKError } from "../config-tEsB7QhQ.js";
|
|
2
|
+
import { t as BaseHttpClient } from "../http-client-CCFmwnaQ.js";
|
|
3
3
|
import { n as REOPT_PROVIDER_ID, t as REOPT_DEFAULT_SCOPES } from "../types-DjDRszNj.js";
|
|
4
4
|
import { createAdapterFactory } from "better-auth/adapters";
|
|
5
5
|
import { genericOAuth } from "better-auth/plugins";
|
|
@@ -116,6 +116,22 @@ function createReoptAdapter(config) {
|
|
|
116
116
|
model,
|
|
117
117
|
where
|
|
118
118
|
});
|
|
119
|
+
},
|
|
120
|
+
async consumeOne({ model, where }) {
|
|
121
|
+
return request({
|
|
122
|
+
operation: "consumeOne",
|
|
123
|
+
model,
|
|
124
|
+
where
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
async incrementOne({ model, where, increment, set }) {
|
|
128
|
+
return request({
|
|
129
|
+
operation: "incrementOne",
|
|
130
|
+
model,
|
|
131
|
+
where,
|
|
132
|
+
increment,
|
|
133
|
+
set
|
|
134
|
+
});
|
|
119
135
|
}
|
|
120
136
|
};
|
|
121
137
|
}
|
|
@@ -142,13 +158,16 @@ function createReoptAdapter(config) {
|
|
|
142
158
|
* ```
|
|
143
159
|
*/
|
|
144
160
|
function createReoptOAuth(options) {
|
|
145
|
-
if (typeof window !== "undefined") throw new Error("[@reopt-ai/brandapp-sdk] createReoptOAuth() must be called on the server. It uses clientSecret — exposing it to the browser is a security risk. For client-side OAuth sign-in, use
|
|
161
|
+
if (typeof window !== "undefined") throw new Error("[@reopt-ai/brandapp-sdk] createReoptOAuth() must be called on the server. It uses clientSecret — exposing it to the browser is a security risk. For client-side OAuth sign-in, use signInWithReopt() from '@reopt-ai/brandapp-sdk/better-auth/client' instead.");
|
|
146
162
|
if (!options.clientId || !options.clientSecret) throw new Error("[@reopt-ai/brandapp-sdk] createReoptOAuth() requires clientId and clientSecret.");
|
|
147
163
|
return genericOAuth({ config: [{
|
|
148
164
|
providerId: REOPT_PROVIDER_ID,
|
|
149
165
|
discoveryUrl: `${resolveIdBaseUrl(options)}/api/auth/.well-known/openid-configuration`,
|
|
150
166
|
clientId: options.clientId,
|
|
151
167
|
clientSecret: options.clientSecret,
|
|
168
|
+
tokenEndpointAuth: { method: options.tokenEndpointAuthMethod ?? "client_secret_post" },
|
|
169
|
+
disableProviderLogout: !options.providerLogout,
|
|
170
|
+
...typeof options.providerLogout === "object" && options.providerLogout.postLogoutRedirectURI ? { postLogoutRedirectURI: options.providerLogout.postLogoutRedirectURI } : {},
|
|
152
171
|
scopes: Array.from(/* @__PURE__ */ new Set([...REOPT_DEFAULT_SCOPES, ...options.additionalScopes ?? []])),
|
|
153
172
|
pkce: true
|
|
154
173
|
}] });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
|
+
|
|
3
|
+
//#region src/analytics/client.ts
|
|
4
|
+
var ReoptAnalyticsClient = class {
|
|
5
|
+
http;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.http = new BaseHttpClient(config, `/api/v1/brandapp/${config.brandappId}/analytics`);
|
|
8
|
+
}
|
|
9
|
+
/** Basic or Bearer. `{ enabled: false }` until the brand's project is provisioned. */
|
|
10
|
+
async getConfig(accessToken) {
|
|
11
|
+
return (await this.http.fetch("GET", "/config", void 0, accessToken ? { bearerToken: accessToken } : void 0)).data;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function createReoptAnalyticsClient(config) {
|
|
15
|
+
return new ReoptAnalyticsClient(config);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { createReoptAnalyticsClient as n, ReoptAnalyticsClient as t };
|
|
20
|
+
//# sourceMappingURL=client-2IaU8yUs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
2
|
-
import { t as buildQuery } from "./query-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
|
+
import { t as buildQuery } from "./query-Bsgb85OE.js";
|
|
3
3
|
|
|
4
4
|
//#region src/eav/cache.ts
|
|
5
5
|
var SchemaCache = class {
|
|
@@ -500,4 +500,4 @@ function createReoptEavClient(config) {
|
|
|
500
500
|
|
|
501
501
|
//#endregion
|
|
502
502
|
export { createReoptEavClient as t };
|
|
503
|
-
//# sourceMappingURL=client-
|
|
503
|
+
//# sourceMappingURL=client-CHp-oNJB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/auth/client.ts
|
|
4
4
|
function unwrap(body) {
|
|
@@ -50,4 +50,4 @@ function createReoptAuthClient(config) {
|
|
|
50
50
|
|
|
51
51
|
//#endregion
|
|
52
52
|
export { createReoptAuthClient as n, ReoptAuthClient as t };
|
|
53
|
-
//# sourceMappingURL=client-
|
|
53
|
+
//# sourceMappingURL=client-CP9RSAzn.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
2
|
-
import { t as buildQuery } from "./query-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
|
+
import { t as buildQuery } from "./query-Bsgb85OE.js";
|
|
3
3
|
|
|
4
4
|
//#region src/cms/client.ts
|
|
5
5
|
function createReoptCmsClient(config) {
|
|
@@ -52,4 +52,4 @@ async list(query) {
|
|
|
52
52
|
|
|
53
53
|
//#endregion
|
|
54
54
|
export { createReoptCmsClient as t };
|
|
55
|
-
//# sourceMappingURL=client-
|
|
55
|
+
//# sourceMappingURL=client-CTefnLKY.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plans/client.ts
|
|
4
4
|
function unwrap(body) {
|
|
@@ -78,4 +78,4 @@ function createReoptPlansClient(config) {
|
|
|
78
78
|
|
|
79
79
|
//#endregion
|
|
80
80
|
export { createReoptPlansClient as n, ReoptPlansClient as t };
|
|
81
|
-
//# sourceMappingURL=client-
|
|
81
|
+
//# sourceMappingURL=client-DE3FvPFs.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
|
|
2
|
+
//#region src/analytics/types.d.ts
|
|
3
|
+
/** `GET /brandapp/{id}/analytics/config` — 브랜드의 reopt-data 브라우저 수집 설정. */
|
|
4
|
+
type AnalyticsConfig = {
|
|
5
|
+
enabled: false;
|
|
6
|
+
} | {
|
|
7
|
+
enabled: true;
|
|
8
|
+
/** reopt-data base URL — data-sdk `init({ baseUrl })`에 그대로. */
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
/** 브라우저 수집 키(scopes ingest). 공개 값 — 읽기 권한이 없다. */
|
|
11
|
+
writeKey: string;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/analytics/client.d.ts
|
|
15
|
+
declare class ReoptAnalyticsClient {
|
|
16
|
+
private readonly http;
|
|
17
|
+
constructor(config: ReoptSDKConfig);
|
|
18
|
+
/** Basic or Bearer. `{ enabled: false }` until the brand's project is provisioned. */
|
|
19
|
+
getConfig(accessToken?: string): Promise<AnalyticsConfig>;
|
|
20
|
+
}
|
|
21
|
+
declare function createReoptAnalyticsClient(config: ReoptSDKConfig): ReoptAnalyticsClient;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { createReoptAnalyticsClient as n, AnalyticsConfig as r, ReoptAnalyticsClient as t };
|
|
24
|
+
//# sourceMappingURL=client-DZu4msTG.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/push/client.ts
|
|
4
4
|
var ReoptPushClient = class {
|
|
@@ -25,4 +25,4 @@ function createReoptPushClient(config) {
|
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { createReoptPushClient as n, ReoptPushClient as t };
|
|
28
|
-
//# sourceMappingURL=client-
|
|
28
|
+
//# sourceMappingURL=client-D_7G37OB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/terms/client.ts
|
|
4
4
|
function unwrap(body) {
|
|
@@ -80,4 +80,4 @@ function createReoptTermsClient(config) {
|
|
|
80
80
|
|
|
81
81
|
//#endregion
|
|
82
82
|
export { createReoptTermsClient as n, ReoptTermsClient as t };
|
|
83
|
-
//# sourceMappingURL=client-
|
|
83
|
+
//# sourceMappingURL=client-Dnp7_J0-.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-
|
|
1
|
+
import { A as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-tEsB7QhQ.js";
|
|
2
2
|
import { t as createManagedAbort } from "./abort--nOBFN4M.js";
|
|
3
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
3
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
4
4
|
import { n as parseSSEStream } from "./sse-parser-FMjxM7sY.js";
|
|
5
5
|
|
|
6
6
|
//#region src/ai/client.ts
|
|
@@ -224,7 +224,7 @@ var ReoptAiClient = class {
|
|
|
224
224
|
}
|
|
225
225
|
async fetchSSE(options) {
|
|
226
226
|
const url = `${this.http.requestBaseUrl}/chat/completions`;
|
|
227
|
-
const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"
|
|
227
|
+
const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.1.0"}-${url.length}`;
|
|
228
228
|
const ctx = {
|
|
229
229
|
method: "POST",
|
|
230
230
|
url,
|
|
@@ -302,4 +302,4 @@ function createReoptAiClient(config) {
|
|
|
302
302
|
|
|
303
303
|
//#endregion
|
|
304
304
|
export { createReoptAiClient as n, ReoptAiClient as t };
|
|
305
|
-
//# sourceMappingURL=client-
|
|
305
|
+
//# sourceMappingURL=client-Dx3sYx7V.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/feedback/client.ts
|
|
4
4
|
function buildListQuery(query) {
|
|
@@ -83,4 +83,4 @@ function createReoptFeedbackClient(config) {
|
|
|
83
83
|
|
|
84
84
|
//#endregion
|
|
85
85
|
export { createReoptFeedbackClient as n, ReoptFeedbackClient as t };
|
|
86
|
-
//# sourceMappingURL=client-
|
|
86
|
+
//# sourceMappingURL=client-SwByFT8p.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-
|
|
1
|
+
import { A as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-tEsB7QhQ.js";
|
|
2
2
|
import { t as createManagedAbort } from "./abort--nOBFN4M.js";
|
|
3
|
-
import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-
|
|
3
|
+
import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
4
4
|
|
|
5
5
|
//#region src/files/client.ts
|
|
6
6
|
var ReoptFileClient = class {
|
|
@@ -270,4 +270,4 @@ function createReoptFileClient(config) {
|
|
|
270
270
|
|
|
271
271
|
//#endregion
|
|
272
272
|
export { createReoptFileClient as n, ReoptFileClient as t };
|
|
273
|
-
//# sourceMappingURL=client-
|
|
273
|
+
//# sourceMappingURL=client-mvcEj1Vq.js.map
|
package/dist/cms/index.js
CHANGED
|
@@ -305,7 +305,7 @@ function mapHttpStatusToError(status, code, message, ctx, fieldErrors) {
|
|
|
305
305
|
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/core/config.ts
|
|
308
|
-
const SDK_VERSION = "
|
|
308
|
+
const SDK_VERSION = "4.1.0";
|
|
309
309
|
/**
|
|
310
310
|
* Default API host for EAV / AI / Files / CMS / Terms. Consumers can override
|
|
311
311
|
* via `config.baseUrl` or the `REOPT_BASE_URL` env var.
|
|
@@ -484,4 +484,4 @@ function deriveIdFromBaseUrl(baseUrl) {
|
|
|
484
484
|
|
|
485
485
|
//#endregion
|
|
486
486
|
export { mapHttpStatusToError as A, ServerError as C, isReoptSDKError as D, isModelAccessError as E, isRequiredTermsError as O, RequiredTermsError as S, isCreditLimitError as T, ModelAccessError as _, resolveIdBaseUrl as a, RateLimitError as b, AuthUserNotFoundError as c, ConflictError as d, ContentFilterError as f, LimitExceededError as g, ForbiddenError as h, resolveBaseUrl as i, isValidationError as k, AuthUserRecordExistsError as l, DuplicateAuthUserError as m, SDK_VERSION as n, validateConfig as o, CreditLimitError as p, assertBrowserSafe as r, AuthError as s, REOPT_BASE_URLS as t, BadRequestError as u, ModelNotFoundError as v, ValidationError as w, ReoptSDKError as x, NotFoundError as y };
|
|
487
|
-
//# sourceMappingURL=config-
|
|
487
|
+
//# sourceMappingURL=config-tEsB7QhQ.js.map
|
package/dist/eav/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as AuthUserNotFoundError, g as LimitExceededError, l as AuthUserRecordExistsError, m as DuplicateAuthUserError } from "../config-
|
|
2
|
-
import { t as createReoptEavClient } from "../client-
|
|
1
|
+
import { c as AuthUserNotFoundError, g as LimitExceededError, l as AuthUserRecordExistsError, m as DuplicateAuthUserError } from "../config-tEsB7QhQ.js";
|
|
2
|
+
import { t as createReoptEavClient } from "../client-CHp-oNJB.js";
|
|
3
3
|
|
|
4
4
|
//#region src/eav/verify.ts
|
|
5
5
|
async function verifyEavSchema(input) {
|
package/dist/feedback/index.js
CHANGED
package/dist/files/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as mapHttpStatusToError, C as ServerError, a as resolveIdBaseUrl, b as RateLimitError, i as resolveBaseUrl, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-
|
|
1
|
+
import { A as mapHttpStatusToError, C as ServerError, a as resolveIdBaseUrl, b as RateLimitError, i as resolveBaseUrl, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-tEsB7QhQ.js";
|
|
2
2
|
import { t as createAuthHeader } from "./encoding-Bwfm3iaE.js";
|
|
3
3
|
|
|
4
4
|
//#region src/core/debug.ts
|
|
@@ -383,4 +383,4 @@ function parseFieldErrors(body) {
|
|
|
383
383
|
|
|
384
384
|
//#endregion
|
|
385
385
|
export { parseFieldErrors as n, BaseHttpClient as t };
|
|
386
|
-
//# sourceMappingURL=http-client-
|
|
386
|
+
//# sourceMappingURL=http-client-CCFmwnaQ.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { l as SchemaDef, n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
|
|
2
2
|
import { t as ReoptAiClient } from "./client-DPbXH8tr.js";
|
|
3
|
+
import { t as ReoptAnalyticsClient } from "./client-DZu4msTG.js";
|
|
3
4
|
import { t as ReoptAuthClient } from "./client-yBQen4Yi.js";
|
|
4
5
|
import { t as ReoptCmsClient } from "./client-BTS6Ewv_.js";
|
|
5
6
|
import { t as ReoptEavClient } from "./client-CAGo56KO.js";
|
|
@@ -154,6 +155,7 @@ type ReoptSDK<S extends SchemaDef = SchemaDef> = {
|
|
|
154
155
|
debug: NonNullable<ReoptSDKConfig["debug"]>;
|
|
155
156
|
};
|
|
156
157
|
ai: ReoptAiClient;
|
|
158
|
+
analytics: ReoptAnalyticsClient;
|
|
157
159
|
auth: ReoptAuthClient;
|
|
158
160
|
cms: ReoptCmsClient;
|
|
159
161
|
eav: ReoptEavClient<S>;
|
|
@@ -166,4 +168,4 @@ type ReoptSDK<S extends SchemaDef = SchemaDef> = {
|
|
|
166
168
|
declare function createReoptSDK<S extends SchemaDef = SchemaDef>(config: ReoptSDKConfig<S>): ReoptSDK<S>;
|
|
167
169
|
//#endregion
|
|
168
170
|
export { initReoptSDK as a, getReoptSDK as i, createReoptSDK as n, resetSDK as o, createLazySDK as r, BaseHttpClient as s, ReoptSDK as t };
|
|
169
|
-
//# sourceMappingURL=index-
|
|
171
|
+
//# sourceMappingURL=index-DJMr3ixA.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { a as DebugLogger, i as DebugLevel, n as ReoptSDKConfig, r as resolveBas
|
|
|
2
2
|
import { a as CompletionOptions, c as FinishReason, d as MessageRole, f as ModelInfo, i as ChatMessage, l as ImageGenerateOptions, m as StreamEvent, o as CompletionResult, p as StreamDoneData, r as AgentInfo, s as CreditInfo, u as ImageGenerateResult } from "./client-DPbXH8tr.js";
|
|
3
3
|
import { C as isModelAccessError, D as mapHttpStatusToError, E as isValidationError, S as isCreditLimitError, T as isRequiredTermsError, _ as ReoptSDKError, a as ConflictError, b as ServerError, c as DuplicateAuthUserError, d as ForbiddenError, f as LimitExceededError, g as RateLimitError, h as NotFoundError, i as BadRequestError, l as ErrorDiagnostic, m as ModelNotFoundError, n as AuthUserNotFoundError, o as ContentFilterError, p as ModelAccessError, r as AuthUserRecordExistsError, s as CreditLimitError, t as AuthError, u as FieldError, v as ReoptSDKErrorContext, w as isReoptSDKError, x as ValidationError, y as RequiredTermsError } from "./errors-CRCcErNC.js";
|
|
4
4
|
import { i as TypedEavRecord, r as EntityClient } from "./client-CAGo56KO.js";
|
|
5
|
-
import { a as initReoptSDK, i as getReoptSDK, n as createReoptSDK, o as resetSDK, r as createLazySDK, s as BaseHttpClient, t as ReoptSDK } from "./index-
|
|
5
|
+
import { a as initReoptSDK, i as getReoptSDK, n as createReoptSDK, o as resetSDK, r as createLazySDK, s as BaseHttpClient, t as ReoptSDK } from "./index-DJMr3ixA.js";
|
|
6
6
|
export { type AgentInfo, AuthError, AuthUserNotFoundError, AuthUserRecordExistsError, BadRequestError, BaseHttpClient, type ChatMessage, type CompletionOptions, type CompletionResult, ConflictError, ContentFilterError, type CreditInfo, CreditLimitError, type DebugLevel, type DebugLogger, DuplicateAuthUserError, type EntityClient, type ErrorDiagnostic, type FieldError, type FinishReason, ForbiddenError, type ImageGenerateOptions, type ImageGenerateResult, LimitExceededError, type MessageRole, ModelAccessError, type ModelInfo, ModelNotFoundError, NotFoundError, REOPT_BASE_URLS, RateLimitError, ReoptSDK, type ReoptSDKConfig, ReoptSDKError, type ReoptSDKErrorContext, RequiredTermsError, ServerError, type StreamDoneData, type StreamEvent, type TypedEavRecord, ValidationError, createLazySDK, createReoptSDK, getReoptSDK, initReoptSDK, isCreditLimitError, isModelAccessError, isReoptSDKError, isRequiredTermsError, isValidationError, mapHttpStatusToError, resetSDK, resolveBaseUrl };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { A as mapHttpStatusToError, C as ServerError, D as isReoptSDKError, E as isModelAccessError, O as isRequiredTermsError, S as RequiredTermsError, T as isCreditLimitError, _ as ModelAccessError, b as RateLimitError, c as AuthUserNotFoundError, d as ConflictError, f as ContentFilterError, g as LimitExceededError, h as ForbiddenError, i as resolveBaseUrl, k as isValidationError, l as AuthUserRecordExistsError, m as DuplicateAuthUserError, p as CreditLimitError, r as assertBrowserSafe, s as AuthError, t as REOPT_BASE_URLS, u as BadRequestError, v as ModelNotFoundError, w as ValidationError, x as ReoptSDKError, y as NotFoundError } from "./config-
|
|
2
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
3
|
-
import { n as createReoptAiClient } from "./client-
|
|
4
|
-
import { n as createReoptAuthClient } from "./client-
|
|
5
|
-
import { t as createReoptCmsClient } from "./client-
|
|
6
|
-
import { t as createReoptEavClient } from "./client-
|
|
7
|
-
import { n as createReoptFeedbackClient } from "./client-
|
|
8
|
-
import { n as createReoptFileClient } from "./client-
|
|
9
|
-
import { n as
|
|
10
|
-
import { n as
|
|
11
|
-
import { n as
|
|
1
|
+
import { A as mapHttpStatusToError, C as ServerError, D as isReoptSDKError, E as isModelAccessError, O as isRequiredTermsError, S as RequiredTermsError, T as isCreditLimitError, _ as ModelAccessError, b as RateLimitError, c as AuthUserNotFoundError, d as ConflictError, f as ContentFilterError, g as LimitExceededError, h as ForbiddenError, i as resolveBaseUrl, k as isValidationError, l as AuthUserRecordExistsError, m as DuplicateAuthUserError, p as CreditLimitError, r as assertBrowserSafe, s as AuthError, t as REOPT_BASE_URLS, u as BadRequestError, v as ModelNotFoundError, w as ValidationError, x as ReoptSDKError, y as NotFoundError } from "./config-tEsB7QhQ.js";
|
|
2
|
+
import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
|
|
3
|
+
import { n as createReoptAiClient } from "./client-Dx3sYx7V.js";
|
|
4
|
+
import { n as createReoptAuthClient } from "./client-CP9RSAzn.js";
|
|
5
|
+
import { t as createReoptCmsClient } from "./client-CTefnLKY.js";
|
|
6
|
+
import { t as createReoptEavClient } from "./client-CHp-oNJB.js";
|
|
7
|
+
import { n as createReoptFeedbackClient } from "./client-SwByFT8p.js";
|
|
8
|
+
import { n as createReoptFileClient } from "./client-mvcEj1Vq.js";
|
|
9
|
+
import { n as createReoptAnalyticsClient } from "./client-2IaU8yUs.js";
|
|
10
|
+
import { n as createReoptPlansClient } from "./client-DE3FvPFs.js";
|
|
11
|
+
import { n as createReoptPushClient } from "./client-D_7G37OB.js";
|
|
12
|
+
import { n as createReoptTermsClient } from "./client-Dnp7_J0-.js";
|
|
12
13
|
|
|
13
14
|
//#region src/singleton.ts
|
|
14
15
|
let _instance;
|
|
@@ -117,6 +118,7 @@ function createReoptSDK(config) {
|
|
|
117
118
|
debug: config.debug ?? false
|
|
118
119
|
},
|
|
119
120
|
ai: createReoptAiClient(config),
|
|
121
|
+
analytics: createReoptAnalyticsClient(config),
|
|
120
122
|
auth: createReoptAuthClient(config),
|
|
121
123
|
cms: createReoptCmsClient(config),
|
|
122
124
|
eav: createReoptEavClient(config),
|
package/dist/logout/index.js
CHANGED
package/dist/plans/index.js
CHANGED
package/dist/push/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { x as ReoptSDKError } from "./config-
|
|
1
|
+
import { x as ReoptSDKError } from "./config-tEsB7QhQ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/query.ts
|
|
4
4
|
/**
|
|
@@ -32,4 +32,4 @@ function buildQuery(params) {
|
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { buildQuery as t };
|
|
35
|
-
//# sourceMappingURL=query-
|
|
35
|
+
//# sourceMappingURL=query-Bsgb85OE.js.map
|
package/dist/react/hooks.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { a as CompletionOptions, f as ModelInfo, l as ImageGenerateOptions, o as
|
|
|
3
3
|
import { _ as ReoptSDKError } from "../errors-CRCcErNC.js";
|
|
4
4
|
import { a as ListTagsQuery, c as PostGroup, d as Tag, i as ListPostsQuery, o as Post, r as ListPostGroupsQuery, s as PostDetail, t as CmsPaginatedResponse } from "../types-BXDcoJHG.js";
|
|
5
5
|
import { a as FileListQuery, c as FolderInfo, d as UpdateFolderInput, f as UploadOptions, i as FileInfo, l as FolderListQuery, o as FileListResponse, r as CreateFolderInput, s as FileUsageInfo, u as UpdateFileInput } from "../client-A4YrHjDc.js";
|
|
6
|
-
import { t as ReoptSDK } from "../index-
|
|
6
|
+
import { t as ReoptSDK } from "../index-DJMr3ixA.js";
|
|
7
7
|
import { UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
8
8
|
//#region src/react/use-ai-stream.d.ts
|
|
9
9
|
type UseAiStreamOptions = {
|
package/dist/terms/index.js
CHANGED
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as SeedAllInput, c as SeedPostGroupInput, d as SeedTermsItem, l as SeedPostInput, n as DevServer, o as SeedData, t as DevSchema } from "../index-DV_OWwx5.js";
|
|
2
|
-
import { t as ReoptSDK } from "../index-
|
|
2
|
+
import { t as ReoptSDK } from "../index-DJMr3ixA.js";
|
|
3
3
|
//#region src/testing/index.d.ts
|
|
4
4
|
type TestSDKOptions = {
|
|
5
5
|
/** EAV schema to seed entities and attributes */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/better-auth/types.d.ts
|
|
2
2
|
declare const REOPT_PROVIDER_ID: "reopt";
|
|
3
3
|
declare const REOPT_DEFAULT_SCOPES: readonly ["openid", "profile", "email"];
|
|
4
|
-
type AdapterOperation = "create" | "findOne" | "findMany" | "update" | "updateMany" | "delete" | "deleteMany" | "count";
|
|
4
|
+
type AdapterOperation = "create" | "findOne" | "findMany" | "update" | "updateMany" | "delete" | "deleteMany" | "count" | "consumeOne" | "incrementOne";
|
|
5
5
|
type AdapterRequestBody = {
|
|
6
6
|
operation: AdapterOperation;
|
|
7
7
|
model: "user" | "session" | "account" | "verification";
|
|
@@ -13,6 +13,10 @@ type AdapterRequestBody = {
|
|
|
13
13
|
connector?: "AND" | "OR";
|
|
14
14
|
}>;
|
|
15
15
|
update?: Record<string, unknown>;
|
|
16
|
+
/** incrementOne: signed per-field deltas (`field = field + delta`) */
|
|
17
|
+
increment?: Record<string, number>;
|
|
18
|
+
/** incrementOne: absolute assignments applied in the same atomic step */
|
|
19
|
+
set?: Record<string, unknown>;
|
|
16
20
|
select?: string[];
|
|
17
21
|
limit?: number;
|
|
18
22
|
offset?: number;
|
|
@@ -23,4 +27,4 @@ type AdapterRequestBody = {
|
|
|
23
27
|
};
|
|
24
28
|
//#endregion
|
|
25
29
|
export { REOPT_PROVIDER_ID as i, AdapterRequestBody as n, REOPT_DEFAULT_SCOPES as r, AdapterOperation as t };
|
|
26
|
-
//# sourceMappingURL=types-
|
|
30
|
+
//# sourceMappingURL=types-MXLudLBP.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reopt-ai/brandapp-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Reopt Brandapp SDK — Better Auth adapter, OAuth login, and EAV client",
|
|
5
5
|
"author": "Reopt",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/ai-provider/index.d.ts",
|
|
22
22
|
"import": "./dist/ai-provider/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./analytics": {
|
|
25
|
+
"types": "./dist/analytics/index.d.ts",
|
|
26
|
+
"import": "./dist/analytics/index.js"
|
|
27
|
+
},
|
|
24
28
|
"./auth": {
|
|
25
29
|
"types": "./dist/auth/index.d.ts",
|
|
26
30
|
"import": "./dist/auth/index.js"
|
|
@@ -111,9 +115,10 @@
|
|
|
111
115
|
"@ai-sdk/provider": ">=4.0.0",
|
|
112
116
|
"@reopt-ai/opt-editor": ">=1.0.0",
|
|
113
117
|
"@tanstack/react-query": ">=5.0.0",
|
|
114
|
-
"better-auth": "^1.
|
|
118
|
+
"better-auth": "^1.7.1",
|
|
115
119
|
"hono": ">=4.0.0",
|
|
116
|
-
"react": ">=18.0.0"
|
|
120
|
+
"react": ">=18.0.0",
|
|
121
|
+
"@reopt-ai/data-sdk": ">=0.1.1"
|
|
117
122
|
},
|
|
118
123
|
"peerDependenciesMeta": {
|
|
119
124
|
"@ai-sdk/provider": {
|
|
@@ -133,19 +138,23 @@
|
|
|
133
138
|
},
|
|
134
139
|
"react": {
|
|
135
140
|
"optional": true
|
|
141
|
+
},
|
|
142
|
+
"@reopt-ai/data-sdk": {
|
|
143
|
+
"optional": true
|
|
136
144
|
}
|
|
137
145
|
},
|
|
138
146
|
"devDependencies": {
|
|
139
|
-
"@ai-sdk/provider": "4.0.
|
|
140
|
-
"@reopt-ai/opt-editor": "
|
|
147
|
+
"@ai-sdk/provider": "4.0.7",
|
|
148
|
+
"@reopt-ai/opt-editor": "2.0.0",
|
|
141
149
|
"@testing-library/react": "^16.3.2",
|
|
142
150
|
"@types/node": "22.13.9",
|
|
143
|
-
"better-auth": "^1.
|
|
151
|
+
"better-auth": "^1.7.1",
|
|
144
152
|
"happy-dom": "^20.8.9",
|
|
145
153
|
"hono": "^4.7.0",
|
|
146
154
|
"tsdown": "^0.22.14",
|
|
147
155
|
"typescript": "^7",
|
|
148
156
|
"vitest": "^4.1.2",
|
|
157
|
+
"@reopt-ai/data-sdk": "^0.1.1",
|
|
149
158
|
"@reopt/typescript-config": "0.0.0"
|
|
150
159
|
},
|
|
151
160
|
"keywords": [
|