@reopt-ai/brandapp-sdk 4.7.0-rc.10 → 4.7.0-rc.11

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +53 -1
  3. package/dist/ai/index.js +2 -2
  4. package/dist/ai-provider/index.js +1 -1
  5. package/dist/analytics/index.js +1 -1
  6. package/dist/auth/index.js +1 -1
  7. package/dist/better-auth/index.d.ts +84 -1
  8. package/dist/better-auth/index.js +180 -4
  9. package/dist/{client-Dv7WwJr-.js → client-9X3vG2r3.js} +2 -2
  10. package/dist/{client-C7z5-izC.js → client-Bao2z7Lj.js} +3 -3
  11. package/dist/{client-Brv0KsDM.js → client-Bw0W5V5G.js} +2 -2
  12. package/dist/{client-D8d3xsYm.js → client-CZPZqbFg.js} +4 -4
  13. package/dist/{client-CmV48bW0.js → client-CmdGfdqb.js} +3 -3
  14. package/dist/{client-BxrWT0mi.js → client-CpF98_Vy.js} +2 -2
  15. package/dist/{client-ey80gKM_.js → client-DCTRprTm.js} +3 -3
  16. package/dist/{client-BPcoDnOd.js → client-DXMw9sYi.js} +2 -2
  17. package/dist/{client-D97Ylva1.js → client-DpJIK4dZ.js} +4 -4
  18. package/dist/{client-CGy4Z0JO.js → client-DriOmKty.js} +2 -2
  19. package/dist/{client-B281w6RL.js → client-fzvZmhTG.js} +2 -2
  20. package/dist/{client-m4e-HwMX.js → client-qWKpE68O.js} +2 -2
  21. package/dist/cms/index.js +1 -1
  22. package/dist/{config-DaSeKofC.js → config-D5mJJNdR.js} +2 -2
  23. package/dist/eav/index.js +2 -2
  24. package/dist/feedback/index.js +1 -1
  25. package/dist/files/index.js +1 -1
  26. package/dist/{http-client-BCZhLtY5.js → http-client-D9FO4wJR.js} +2 -2
  27. package/dist/index.js +12 -12
  28. package/dist/installation/index.js +3 -3
  29. package/dist/logout/index.js +1 -1
  30. package/dist/machine/index.js +1 -1
  31. package/dist/plans/index.js +1 -1
  32. package/dist/push/index.js +1 -1
  33. package/dist/{query-B8Hg9bub.js → query-Cm8NkHG3.js} +2 -2
  34. package/dist/social/index.js +1 -1
  35. package/dist/terms/index.js +1 -1
  36. package/dist/workspace/index.js +1 -1
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.7.0-rc.11] — 2026-11-07
11
+
12
+ Pre-release (`npm i @reopt-ai/brandapp-sdk@next`) — 전화번호 로그인. 어댑터 모드 앱(앱이 Better Auth를 직접
13
+ 돌리는 앱)이 리옵트 계정이나 소셜 API 키 없이 문자 인증번호로 가입·로그인할 수 있다. `better-auth` 1.7.16 이상 필요.
14
+
15
+ ### Added
16
+
17
+ - 전화번호 로그인 — `createReoptPhoneNumber(config, options?)`(`/better-auth`)가 Better Auth `phoneNumber`
18
+ 플러그인을 리옵트 문자 발송(`POST /api/v1/brandapp/{id}/auth/otp/sms`, 어댑터 자격)과 함께 돌려준다.
19
+ `createReoptBetterAuth()` 번들에도 `phoneNumber`가 실린다. 번호만으로 가입하면 임시 이메일이 들어가고,
20
+ 리옵트 콘솔은 그 사용자를 번호로 보이며 **인증된** 번호가 같은 CRM 고객에 잇는다.
21
+ 플러그인 없이 발송만 쓰려면 `createReoptOtpSmsSender(config)`. 서버가 워크스페이스 Solapi 연결이 없으면
22
+ `409 SMS_NOT_CONNECTED`로 거절한다(리옵트 시스템 브랜드·데모·테스트 조직은 리옵트 번호로 대신 보낸다).
23
+ 번호 정본화·형식 판정 `canonicalizeReoptPhoneNumber`·`isValidReoptPhoneNumber`는 서버와 같은 규칙이다.
24
+ - 보안: **국내 휴대폰만** 받고 `/phone-number/*` 요청의 번호를 플러그인이 보기 전에 `01012345678`로 맞춘다
25
+ (플러그인은 입력 문자열 그대로 사용자를 찾아, 표기만 다른 같은 번호가 두 계정이 될 수 있었다). 임시 이메일은
26
+ `<숫자>.<난수>@phone-login.reopt.app`(번호가 다른 사람에게 넘어가도 유일). 최종 사용자 IP를 함께 보내 리옵트가
27
+ IP 단위 상한을 건다. 리옵트의 거절은 Better Auth 오류로 바꿔 앱 사용자에게 429·503·400이 간다. `better-auth`
28
+ 1.7.16 미만이면 만들 때 던진다(그 전 판은 가입 때 미인증 번호를 저장한다). `otpLength` 4~8·`expiresIn` 60~1800.
29
+ `createReoptBetterAuth().phoneNumber`는 접근할 때 만든다.
30
+
10
31
  ## [4.7.0-rc.10] — 2026-11-02
11
32
 
12
33
  Pre-release (`npm i @reopt-ai/brandapp-sdk@next`) — 스트리밍 줄바꿈 결함 수정. rc.9에서 `sdk.ai.stream`으로 받은
package/README.md CHANGED
@@ -163,7 +163,8 @@ signInWithReopt(authClient, { callbackURL: "/dashboard" });
163
163
  > `${baseURL}/api/auth/callback/reopt` (1.6 used
164
164
  > `/api/auth/oauth2/callback/reopt`). Reopt's own system clients have both
165
165
  > registered; if you registered a custom redirect URI, add the new path in the
166
- > studio before upgrading.
166
+ > platform console (brandapp settings → OAuth → 수정) before upgrading — the
167
+ > client id and secret stay the same.
167
168
 
168
169
  > **Shared secret (transitional).** `createReoptSDK({ clientId, clientSecret })`
169
170
  > and `createReoptBetterAuth({ clientId, clientSecret })` still work for login
@@ -171,6 +172,57 @@ signInWithReopt(authClient, { callbackURL: "/dashboard" });
171
172
  > app has moved to a key — new integrations should start with server
172
173
  > credentials.
173
174
 
175
+ ### Phone-number login (no provider keys)
176
+
177
+ Users sign up and sign in with a phone number and an SMS code — no Reopt
178
+ account, no Google/Apple keys. This is Better Auth's `phoneNumber` plugin;
179
+ Reopt sends the SMS through the workspace's connected Solapi account and brand
180
+ sender number (Studio → workspace settings → 연동). It uses the same `adapter`
181
+ credential as the remote adapter.
182
+
183
+ ```typescript
184
+ import { betterAuth } from "better-auth";
185
+ import { createReoptBetterAuth } from "@reopt-ai/brandapp-sdk/better-auth";
186
+
187
+ const reopt = createReoptBetterAuth({
188
+ brandappId: process.env.BRANDAPP_ID!,
189
+ clientId: adapter.clientId, // adapter credential (brandapp:auth-adapter)
190
+ authorization: adapter.headers,
191
+ phoneNumber: { otpLength: 6, expiresIn: 300 },
192
+ });
193
+
194
+ export const auth = betterAuth({
195
+ database: reopt.database,
196
+ plugins: [reopt.phoneNumber],
197
+ });
198
+
199
+ // client (phoneNumberClient from "better-auth/client/plugins"):
200
+ // await authClient.phoneNumber.sendOtp({ phoneNumber: "010-1234-5678" });
201
+ // await authClient.phoneNumber.verify({ phoneNumber: "010-1234-5678", code });
202
+ ```
203
+
204
+ - **Korean mobile numbers only.** Every `/phone-number/*` request is
205
+ canonicalized to `01012345678` before the plugin sees it, so different
206
+ formats never split one person into two accounts; other numbers get a 400
207
+ (`INVALID_PHONE_NUMBER`). Foreign numbers are the main SMS-pumping vector.
208
+ - Without an SMS connection the send fails with `SMS_NOT_CONNECTED` (Better
209
+ Auth 503 to your client). Reopt's own system brands and test workspaces fall
210
+ back to Reopt's number (test workspaces: 30/hour, 100/day).
211
+ - Limits (Better Auth 429 to your client): 3/min and 10/hour per number,
212
+ 5/min and 20/hour per end-user IP (forwarded per your
213
+ `advanced.ipAddress` settings), 60/min and 1,000/hour per app. Keep Better
214
+ Auth's own rate limiter on with shared storage too.
215
+ - Phone-only users get a placeholder email
216
+ `<digits>.<random>@phone-login.reopt.app` (unique even when a number moves
217
+ to someone else). Reopt shows them by number and links a **verified** number
218
+ to the CRM customer with the same number.
219
+ - The code is generated and verified by your Better Auth; Reopt only delivers
220
+ it and never stores it. Requires `better-auth >= 1.7.16` (older versions
221
+ store unverified numbers on sign-up; the factory throws).
222
+ - Already wiring the plugin yourself? `createReoptOtpSmsSender(config)` returns
223
+ just the sender for your own `sendOTP` — pass canonical numbers
224
+ (`canonicalizeReoptPhoneNumber`) and `clientIp`.
225
+
174
226
  ### External marketing site (1.8+)
175
227
 
176
228
  블로그·약관·sitemap·RSS·세션 인식까지 SDK 호출만으로 외부 Next.js
package/dist/ai/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { S as ReoptSDKError } from "../config-DaSeKofC.js";
2
- import { n as createReoptAiClient, t as ReoptAiClient } from "../client-D97Ylva1.js";
1
+ import { S as ReoptSDKError } from "../config-D5mJJNdR.js";
2
+ import { n as createReoptAiClient, t as ReoptAiClient } from "../client-DpJIK4dZ.js";
3
3
 
4
4
  //#region src/ai/evaluator.ts
5
5
  function createBrandappEvaluator(source, options = {}) {
@@ -1,4 +1,4 @@
1
- import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-DaSeKofC.js";
1
+ import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-D5mJJNdR.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-D65dmL4A.js";
@@ -1,4 +1,4 @@
1
- import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-Dv7WwJr-.js";
1
+ import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-9X3vG2r3.js";
2
2
  import { getInstance, identify, init, pageView, setConsent, track } from "@reopt-ai/data-sdk";
3
3
 
4
4
  //#region src/analytics/browser.ts
@@ -1,4 +1,4 @@
1
- import { n as createReoptAuthClient, t as ReoptAuthClient } from "../client-BxrWT0mi.js";
1
+ import { n as createReoptAuthClient, t as ReoptAuthClient } from "../client-CpF98_Vy.js";
2
2
 
3
3
  //#region src/auth/session.ts
4
4
  /**
@@ -3,6 +3,7 @@ import { a as REOPT_PROVIDER_IDS, i as REOPT_PROVIDER_ID, n as AdapterRequestBod
3
3
  import { i as ClientPrivateJwk } from "../keys-B2pA8EkU.js";
4
4
  import { T as isReoptSDKError, _ as RateLimitError, t as AuthError, v as ReoptSDKError, x as ServerError } from "../errors-D-Va8oeC.js";
5
5
  import { AdapterFactory } from "better-auth/adapters";
6
+ import { PhoneNumberOptions } from "better-auth/plugins/phone-number";
6
7
  import { BetterAuthOptions, BetterAuthPlugin } from "better-auth";
7
8
  //#region src/better-auth/adapter.d.ts
8
9
  /**
@@ -107,14 +108,96 @@ type ReoptOAuthOptions = ReoptSDKConfig & {
107
108
  */
108
109
  declare function createReoptOAuth(options: ReoptOAuthOptions): BetterAuthPlugin;
109
110
  //#endregion
111
+ //#region src/better-auth/phone-number.d.ts
112
+ /**
113
+ * Phone-number login vocabulary. Mirrors `@reopt/constants/brandapp-phone-login` on reopt's
114
+ * server (the SDK cannot import it) — a reopt web test compares the two.
115
+ *
116
+ * Only **Korean mobile numbers** are accepted, and the canonical form is the domestic digits
117
+ * (`01012345678`): Better Auth's plugin looks users up by the exact input string, so without a
118
+ * canonical form `010-1234-5678` and `01012345678` would become two accounts; reopt's SMS route
119
+ * sends domestic numbers only; foreign numbers are the main SMS-pumping (toll fraud) vector.
120
+ */
121
+ declare const REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN = "phone-login.reopt.app";
122
+ declare const DEFAULT_REOPT_PHONE_OTP_EXPIRES_IN = 300;
123
+ /** Canonical Korean mobile digits (`01012345678`) or null. `+82 10-…`, `82-10-…`, `010.…` all canonicalize. */
124
+ declare function canonicalizeReoptPhoneNumber(raw: string | null | undefined): string | null;
125
+ declare function isValidReoptPhoneNumber(raw: string): boolean;
126
+ /**
127
+ * Placeholder email for phone-only sign-ups: `<digits>.<random>@phone-login.reopt.app`. The random part
128
+ * keeps it unique when a number moves to another person after its first owner changed numbers.
129
+ * reopt reads this domain as "no email" (CRM linking, console).
130
+ */
131
+ declare function buildReoptPhoneLoginTempEmail(raw: string): string;
132
+ type ReoptPhoneNumberOptions = {
133
+ /** OTP length, 4–8. Default 6. */
134
+ otpLength?: number;
135
+ /** OTP lifetime in seconds, 60–1800. Default 300. Sent to reopt only for the "enter within N minutes" copy. */
136
+ expiresIn?: number;
137
+ /** Wrong-code attempts before the code is invalidated. Default 5. */
138
+ allowedAttempts?: number;
139
+ /** Require a verified number before sign-in. Default true. */
140
+ requireVerification?: boolean;
141
+ /**
142
+ * Whether a verified number may create an account on its own (`signUpOnVerification`).
143
+ * Default true — the temp email/name are derived from the number.
144
+ */
145
+ signUpOnVerification?: boolean;
146
+ /** Override the generated display name for phone-only sign-ups. Default: `010-1234-5678`. */
147
+ getTempName?: (phoneNumber: string) => string;
148
+ /** Called after a verification succeeds (`callbackOnVerification` of the plugin). */
149
+ callbackOnVerification?: PhoneNumberOptions["callbackOnVerification"];
150
+ };
151
+ type ReoptOtpSmsResult = {
152
+ sent: true;
153
+ via: "workspace";
154
+ } | {
155
+ sent: true;
156
+ via: "reopt";
157
+ reason: string;
158
+ };
159
+ /**
160
+ * Sends one OTP SMS through reopt (`POST /auth/otp/sms`). Exposed for apps that wire the
161
+ * `phoneNumber` plugin themselves and only want reopt as the SMS sender. Pass `clientIp`
162
+ * (the end user's IP as your server sees it) so reopt can rate-limit per user, not per server.
163
+ */
164
+ declare function createReoptOtpSmsSender(config: ReoptSDKConfig): (input: {
165
+ phoneNumber: string;
166
+ code: string;
167
+ expiresInSeconds?: number;
168
+ clientIp?: string | null;
169
+ }) => Promise<ReoptOtpSmsResult>;
170
+ /**
171
+ * Phone-number login for a brandapp — Better Auth's `phoneNumber` plugin with reopt as the SMS
172
+ * sender. The app never holds an SMS provider key: reopt sends through the workspace's connected
173
+ * Solapi account (or, for reopt's own system brands and test workspaces, through reopt's own
174
+ * number). If the workspace has no SMS connection the send fails with `SMS_NOT_CONNECTED`.
175
+ *
176
+ * - Korean mobile numbers only; every `/phone-number/*` request is canonicalized to `01012345678`
177
+ * before the plugin sees it (so formats never split one person into two accounts).
178
+ * - The end user's IP (per your Better Auth `advanced.ipAddress` settings) is forwarded so reopt can
179
+ * rate-limit per user. Keep Better Auth's own rate limiter on with shared storage as well.
180
+ * - Requires better-auth >= 1.7.16.
181
+ *
182
+ * Needs the same adapter credential as `createReoptAdapter` (scope `brandapp:auth-adapter`).
183
+ */
184
+ declare function createReoptPhoneNumber(config: ReoptSDKConfig, options?: ReoptPhoneNumberOptions): BetterAuthPlugin;
185
+ //#endregion
110
186
  //#region src/better-auth/helper.d.ts
111
187
  type ReoptBetterAuthOptions = ReoptSDKConfig & {
112
188
  /** Additional OAuth scopes */
113
189
  additionalScopes?: string[];
190
+ /** Phone-number login (OTP SMS sent by reopt). See `createReoptPhoneNumber`. */
191
+ phoneNumber?: ReoptPhoneNumberOptions;
114
192
  };
115
193
  type ReoptBetterAuthBundle = {
116
194
  database: AdapterFactory<BetterAuthOptions>;
117
195
  oauth: BetterAuthPlugin;
196
+ /**
197
+ * Better Auth `phoneNumber` plugin with reopt as the SMS sender — add to `plugins` to let users
198
+ * sign in with a phone number and no reopt account. Needs the adapter credential (same as `database`).
199
+ */
200
+ phoneNumber: BetterAuthPlugin;
118
201
  };
119
202
  /**
120
203
  * Config 한 번으로 adapter + OAuth plugin을 함께 생성
@@ -145,5 +228,5 @@ type ReoptBetterAuthBundle = {
145
228
  */
146
229
  declare function createReoptBetterAuth(options: ReoptBetterAuthOptions): ReoptBetterAuthBundle;
147
230
  //#endregion
148
- export { type AdapterOperation, type AdapterRequestBody, AuthError, REOPT_BASE_URLS, REOPT_DEFAULT_SCOPES, REOPT_PROVIDER_ID, REOPT_PROVIDER_IDS, REOPT_STEP_UP_PROVIDER_ID, RateLimitError, type ReoptBetterAuthOptions, type ReoptOAuthOptions, type ReoptSDKConfig, ReoptSDKError, STEP_UP_MAX_AUTH_AGE_SECONDS, ServerError, createReoptAdapter, createReoptBetterAuth, createReoptOAuth, isReoptSDKError };
231
+ export { type AdapterOperation, type AdapterRequestBody, AuthError, DEFAULT_REOPT_PHONE_OTP_EXPIRES_IN, REOPT_BASE_URLS, REOPT_DEFAULT_SCOPES, REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN, REOPT_PROVIDER_ID, REOPT_PROVIDER_IDS, REOPT_STEP_UP_PROVIDER_ID, RateLimitError, type ReoptBetterAuthOptions, type ReoptOAuthOptions, type ReoptOtpSmsResult, type ReoptPhoneNumberOptions, type ReoptSDKConfig, ReoptSDKError, STEP_UP_MAX_AUTH_AGE_SECONDS, ServerError, buildReoptPhoneLoginTempEmail, canonicalizeReoptPhoneNumber, createReoptAdapter, createReoptBetterAuth, createReoptOAuth, createReoptOtpSmsSender, createReoptPhoneNumber, isReoptSDKError, isValidReoptPhoneNumber };
149
232
  //# sourceMappingURL=index.d.ts.map
@@ -1,10 +1,12 @@
1
- import { O as isReoptSDKError, S as ReoptSDKError, a as resolveIdBaseUrl, s as AuthError, t as REOPT_BASE_URLS, w as ServerError, x as RateLimitError } from "../config-DaSeKofC.js";
2
- import { t as BaseHttpClient } from "../http-client-BCZhLtY5.js";
1
+ import { O as isReoptSDKError, S as ReoptSDKError, a as resolveIdBaseUrl, s as AuthError, t as REOPT_BASE_URLS, w as ServerError, x as RateLimitError } from "../config-D5mJJNdR.js";
2
+ import { t as BaseHttpClient } from "../http-client-D9FO4wJR.js";
3
3
  import { o as readClientKeyRing } from "../keys-B_R_lsyF.js";
4
4
  import { a as STEP_UP_MAX_AUTH_AGE_SECONDS, i as REOPT_STEP_UP_PROVIDER_ID, n as REOPT_PROVIDER_ID, r as REOPT_PROVIDER_IDS, t as REOPT_DEFAULT_SCOPES } from "../types-DGAVaUCc.js";
5
5
  import { createAdapterFactory } from "better-auth/adapters";
6
6
  import { createPrivateKeyJwtClientAssertionGetter } from "@better-auth/core/oauth2";
7
7
  import { genericOAuth } from "better-auth/plugins";
8
+ import { phoneNumber } from "better-auth/plugins/phone-number";
9
+ import { APIError, createAuthMiddleware, getIP } from "better-auth/api";
8
10
 
9
11
  //#region src/better-auth/adapter.ts
10
12
  /**
@@ -209,6 +211,175 @@ function createReoptOAuth(options) {
209
211
  }]] });
210
212
  }
211
213
 
214
+ //#endregion
215
+ //#region src/better-auth/phone-number.ts
216
+ /**
217
+ * Phone-number login vocabulary. Mirrors `@reopt/constants/brandapp-phone-login` on reopt's
218
+ * server (the SDK cannot import it) — a reopt web test compares the two.
219
+ *
220
+ * Only **Korean mobile numbers** are accepted, and the canonical form is the domestic digits
221
+ * (`01012345678`): Better Auth's plugin looks users up by the exact input string, so without a
222
+ * canonical form `010-1234-5678` and `01012345678` would become two accounts; reopt's SMS route
223
+ * sends domestic numbers only; foreign numbers are the main SMS-pumping (toll fraud) vector.
224
+ */
225
+ const REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN = "phone-login.reopt.app";
226
+ const DEFAULT_REOPT_PHONE_OTP_EXPIRES_IN = 300;
227
+ /** better-auth 1.7.16 stopped storing unverified phone numbers on sign-up — older plugins must not be used. */
228
+ const MIN_BETTER_AUTH_VERSION = [
229
+ 1,
230
+ 7,
231
+ 16
232
+ ];
233
+ const PHONE_INPUT_PATTERN = /^\+?[0-9 ().-]+$/;
234
+ const KOREAN_MOBILE_PATTERN = /^01[016789][0-9]{7,8}$/;
235
+ /** Canonical Korean mobile digits (`01012345678`) or null. `+82 10-…`, `82-10-…`, `010.…` all canonicalize. */
236
+ function canonicalizeReoptPhoneNumber(raw) {
237
+ if (typeof raw !== "string") return null;
238
+ const trimmed = raw.trim();
239
+ if (!trimmed || !PHONE_INPUT_PATTERN.test(trimmed)) return null;
240
+ let digits = trimmed.replace(/\D/g, "");
241
+ if (trimmed.startsWith("+") || digits.startsWith("82")) {
242
+ if (!digits.startsWith("82")) return null;
243
+ digits = digits.slice(2);
244
+ if (!digits.startsWith("0")) digits = `0${digits}`;
245
+ }
246
+ return KOREAN_MOBILE_PATTERN.test(digits) ? digits : null;
247
+ }
248
+ function isValidReoptPhoneNumber(raw) {
249
+ return canonicalizeReoptPhoneNumber(raw) !== null;
250
+ }
251
+ function randomNonce() {
252
+ const bytes = /* @__PURE__ */ new Uint8Array(6);
253
+ globalThis.crypto.getRandomValues(bytes);
254
+ return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
255
+ }
256
+ /**
257
+ * Placeholder email for phone-only sign-ups: `<digits>.<random>@phone-login.reopt.app`. The random part
258
+ * keeps it unique when a number moves to another person after its first owner changed numbers.
259
+ * reopt reads this domain as "no email" (CRM linking, console).
260
+ */
261
+ function buildReoptPhoneLoginTempEmail(raw) {
262
+ return `${canonicalizeReoptPhoneNumber(raw) ?? raw.replace(/\D/g, "")}.${randomNonce()}@${REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN}`;
263
+ }
264
+ function formatKoreanMobile(canonical) {
265
+ return /^010\d{8}$/.test(canonical) ? `${canonical.slice(0, 3)}-${canonical.slice(3, 7)}-${canonical.slice(7)}` : canonical;
266
+ }
267
+ /**
268
+ * Sends one OTP SMS through reopt (`POST /auth/otp/sms`). Exposed for apps that wire the
269
+ * `phoneNumber` plugin themselves and only want reopt as the SMS sender. Pass `clientIp`
270
+ * (the end user's IP as your server sees it) so reopt can rate-limit per user, not per server.
271
+ */
272
+ function createReoptOtpSmsSender(config) {
273
+ const http = new BaseHttpClient(config, `/api/v1/brandapp/${config.brandappId}/auth`);
274
+ return async function sendOtpSms(input) {
275
+ return (await http.fetch("POST", "/otp/sms", {
276
+ phoneNumber: input.phoneNumber,
277
+ code: input.code,
278
+ expiresInSeconds: input.expiresInSeconds ?? 300,
279
+ ...input.clientIp ? { clientIp: input.clientIp } : {}
280
+ })).data;
281
+ };
282
+ }
283
+ /** reopt's refusals → Better Auth errors, so the app's client sees a meaningful status instead of a 500. */
284
+ function toAuthError(error) {
285
+ if (!(error instanceof ReoptSDKError)) return error;
286
+ if (error.status === 429) return new APIError("TOO_MANY_REQUESTS", {
287
+ code: "OTP_RATE_LIMITED",
288
+ message: error.message
289
+ });
290
+ if (error.status === 409 && error.code === "SMS_NOT_CONNECTED") return new APIError("SERVICE_UNAVAILABLE", {
291
+ code: "SMS_NOT_CONNECTED",
292
+ message: "Phone login is not available for this app yet."
293
+ });
294
+ if (error.status === 503) return new APIError("SERVICE_UNAVAILABLE", {
295
+ code: "OTP_UNAVAILABLE",
296
+ message: error.message
297
+ });
298
+ if (error.status === 400) return new APIError("BAD_REQUEST", {
299
+ code: "INVALID_PHONE_NUMBER",
300
+ message: "Enter a Korean mobile number."
301
+ });
302
+ return error;
303
+ }
304
+ function assertBetterAuthVersion(version) {
305
+ const parts = typeof version === "string" ? version.split(/[.-]/).slice(0, 3).map((part) => Number.parseInt(part, 10)) : [];
306
+ if (!(parts.length === 3 && parts.every(Number.isFinite) && (parts[0] > MIN_BETTER_AUTH_VERSION[0] || parts[0] === MIN_BETTER_AUTH_VERSION[0] && (parts[1] > MIN_BETTER_AUTH_VERSION[1] || parts[1] === MIN_BETTER_AUTH_VERSION[1] && parts[2] >= MIN_BETTER_AUTH_VERSION[2])))) throw new Error(`[@reopt-ai/brandapp-sdk] Phone login needs better-auth >= ${MIN_BETTER_AUTH_VERSION.join(".")} (found ${String(version ?? "unknown")}). Older versions store unverified phone numbers on sign-up.`);
307
+ }
308
+ function assertRange(name, value, min, max) {
309
+ if (!Number.isInteger(value) || value < min || value > max) throw new Error(`[@reopt-ai/brandapp-sdk] ${name} must be an integer between ${min} and ${max} (got ${value}).`);
310
+ }
311
+ /**
312
+ * Phone-number login for a brandapp — Better Auth's `phoneNumber` plugin with reopt as the SMS
313
+ * sender. The app never holds an SMS provider key: reopt sends through the workspace's connected
314
+ * Solapi account (or, for reopt's own system brands and test workspaces, through reopt's own
315
+ * number). If the workspace has no SMS connection the send fails with `SMS_NOT_CONNECTED`.
316
+ *
317
+ * - Korean mobile numbers only; every `/phone-number/*` request is canonicalized to `01012345678`
318
+ * before the plugin sees it (so formats never split one person into two accounts).
319
+ * - The end user's IP (per your Better Auth `advanced.ipAddress` settings) is forwarded so reopt can
320
+ * rate-limit per user. Keep Better Auth's own rate limiter on with shared storage as well.
321
+ * - Requires better-auth >= 1.7.16.
322
+ *
323
+ * Needs the same adapter credential as `createReoptAdapter` (scope `brandapp:auth-adapter`).
324
+ */
325
+ function createReoptPhoneNumber(config, options = {}) {
326
+ const otpLength = options.otpLength ?? 6;
327
+ const expiresIn = options.expiresIn ?? 300;
328
+ assertRange("otpLength", otpLength, 4, 8);
329
+ assertRange("expiresIn", expiresIn, 60, 1800);
330
+ const sendOtpSms = createReoptOtpSmsSender(config);
331
+ const getTempName = options.getTempName ?? ((phone) => formatKoreanMobile(canonicalizeReoptPhoneNumber(phone) ?? phone));
332
+ const base = phoneNumber({
333
+ otpLength,
334
+ expiresIn,
335
+ allowedAttempts: options.allowedAttempts ?? 5,
336
+ requireVerification: options.requireVerification ?? true,
337
+ phoneNumberValidator: (phone) => isValidReoptPhoneNumber(phone),
338
+ sendOTP: async ({ phoneNumber: phone, code }, ctx) => {
339
+ const clientIp = ctx?.request || ctx?.headers ? getIP(ctx.request ?? ctx.headers, ctx.context.options) : null;
340
+ try {
341
+ await sendOtpSms({
342
+ phoneNumber: phone,
343
+ code,
344
+ expiresInSeconds: expiresIn,
345
+ clientIp
346
+ });
347
+ } catch (error) {
348
+ throw toAuthError(error);
349
+ }
350
+ },
351
+ ...options.signUpOnVerification === false ? {} : { signUpOnVerification: {
352
+ getTempEmail: (phone) => buildReoptPhoneLoginTempEmail(phone),
353
+ getTempName
354
+ } },
355
+ ...options.callbackOnVerification ? { callbackOnVerification: options.callbackOnVerification } : {}
356
+ });
357
+ assertBetterAuthVersion(base.version);
358
+ const canonicalize = {
359
+ matcher: (ctx) => typeof ctx.path === "string" && ctx.path.startsWith("/phone-number/") && typeof ctx.body?.phoneNumber === "string",
360
+ handler: createAuthMiddleware(async (ctx) => {
361
+ const body = ctx.body;
362
+ const canonical = canonicalizeReoptPhoneNumber(body.phoneNumber);
363
+ if (!canonical) throw new APIError("BAD_REQUEST", {
364
+ code: "INVALID_PHONE_NUMBER",
365
+ message: "Enter a Korean mobile number."
366
+ });
367
+ return { context: { body: {
368
+ ...body,
369
+ phoneNumber: canonical
370
+ } } };
371
+ })
372
+ };
373
+ const baseHooks = base.hooks;
374
+ return {
375
+ ...base,
376
+ hooks: {
377
+ ...baseHooks,
378
+ before: [canonicalize, ...baseHooks?.before ?? []]
379
+ }
380
+ };
381
+ }
382
+
212
383
  //#endregion
213
384
  //#region src/better-auth/helper.ts
214
385
  /**
@@ -239,12 +410,17 @@ function createReoptOAuth(options) {
239
410
  * ```
240
411
  */
241
412
  function createReoptBetterAuth(options) {
413
+ let phonePlugin;
242
414
  return {
243
415
  database: createReoptAdapter(options),
244
- oauth: createReoptOAuth(options)
416
+ oauth: createReoptOAuth(options),
417
+ get phoneNumber() {
418
+ phonePlugin ??= createReoptPhoneNumber(options, options.phoneNumber);
419
+ return phonePlugin;
420
+ }
245
421
  };
246
422
  }
247
423
 
248
424
  //#endregion
249
- export { AuthError, REOPT_BASE_URLS, REOPT_DEFAULT_SCOPES, REOPT_PROVIDER_ID, REOPT_PROVIDER_IDS, REOPT_STEP_UP_PROVIDER_ID, RateLimitError, ReoptSDKError, STEP_UP_MAX_AUTH_AGE_SECONDS, ServerError, createReoptAdapter, createReoptBetterAuth, createReoptOAuth, isReoptSDKError };
425
+ export { AuthError, DEFAULT_REOPT_PHONE_OTP_EXPIRES_IN, REOPT_BASE_URLS, REOPT_DEFAULT_SCOPES, REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN, REOPT_PROVIDER_ID, REOPT_PROVIDER_IDS, REOPT_STEP_UP_PROVIDER_ID, RateLimitError, ReoptSDKError, STEP_UP_MAX_AUTH_AGE_SECONDS, ServerError, buildReoptPhoneLoginTempEmail, canonicalizeReoptPhoneNumber, createReoptAdapter, createReoptBetterAuth, createReoptOAuth, createReoptOtpSmsSender, createReoptPhoneNumber, isReoptSDKError, isValidReoptPhoneNumber };
250
426
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
1
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.js";
2
2
 
3
3
  //#region src/analytics/client.ts
4
4
  var ReoptAnalyticsClient = class {
@@ -17,4 +17,4 @@ function createReoptAnalyticsClient(config) {
17
17
 
18
18
  //#endregion
19
19
  export { createReoptAnalyticsClient as n, ReoptAnalyticsClient as t };
20
- //# sourceMappingURL=client-Dv7WwJr-.js.map
20
+ //# sourceMappingURL=client-9X3vG2r3.js.map
@@ -1,6 +1,6 @@
1
- import { n as SDK_VERSION } from "./config-DaSeKofC.js";
1
+ import { n as SDK_VERSION } from "./config-D5mJJNdR.js";
2
2
  import { o as readClientKeyRing } from "./keys-B_R_lsyF.js";
3
- import { r as createMachineClient } from "./client-BPcoDnOd.js";
3
+ import { r as createMachineClient } from "./client-DXMw9sYi.js";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/workspace/schemas.ts
@@ -742,4 +742,4 @@ function createPlatformClient(config) {
742
742
 
743
743
  //#endregion
744
744
  export { platformWebhookUpsertInputSchema as $, platformEavSchemaOperationSchema as A, platformPipelineResourceSchema as B, platformBrandappResourceSchema as C, platformEavEntityResourceSchema as D, platformEavBrandappResourcesSchema as E, platformMeSchema as F, platformResourcesSchema as G, platformPipelineStageInputSchema as H, platformOAuthClientImportInputSchema as I, platformTaskStageInputSchema as J, platformResourcesV2Schema as K, platformOAuthClientResourceSchema as L, platformExternalIdSchema as M, platformLockAcquiredSchema as N, platformEavSchemaApplyInputSchema as O, platformLockReleasedSchema as P, platformWebhookSchema as Q, platformOAuthClientUpsertInputSchema as R, platformBrandUpsertInputSchema as S, platformCustomerUpsertInputSchema as T, platformPipelineUpsertInputSchema as U, platformPipelineSchema as V, platformResourceKeySchema as W, platformTaskUpsertInputSchema as X, platformTaskStageSchema as Y, platformWebhookResourceSchema as Z, PLATFORM_TASK_PRIORITIES as _, createPlatformClient as a, platformBrandImportInputSchema as b, PLATFORM_ADMIN_SCOPE as c, PLATFORM_MANAGED_BY_VALUES as d, platformWorkTaskStageChangedEventSchema as et, PLATFORM_OAUTH_APPLICATION_TYPES as f, PLATFORM_TASK_OUTCOMES as g, PLATFORM_STAGE_COLORS as h, REOPT_PLATFORM_URLS as i, platformErrorSchema as j, platformEavSchemaApplyResultSchema as k, PLATFORM_BRANDAPP_STATUSES as l, PLATFORM_OAUTH_GRANT_TYPES as m, PlatformApiError as n, createPlatformRequester as o, PLATFORM_OAUTH_CLIENT_PURPOSES as p, platformTaskSchema as q, REOPT_PLATFORM_ID_URLS as r, resolvePlatformUrls as s, DEFAULT_PLATFORM_SCOPES as t, platformWriteMetaSchema as tt, PLATFORM_DOMAIN_STATUSES as u, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as v, platformBrandappUpsertInputSchema as w, platformBrandResourceSchema as x, PLATFORM_WEBHOOK_TRIGGERS as y, platformPipelineImportInputSchema as z };
745
- //# sourceMappingURL=client-C7z5-izC.js.map
745
+ //# sourceMappingURL=client-Bao2z7Lj.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
1
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.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-Brv0KsDM.js.map
86
+ //# sourceMappingURL=client-Bw0W5V5G.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, u as BadRequestError } from "./config-DaSeKofC.js";
2
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
3
- import { t as buildQuery } from "./query-B8Hg9bub.js";
1
+ import { S as ReoptSDKError, u as BadRequestError } from "./config-D5mJJNdR.js";
2
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.js";
3
+ import { t as buildQuery } from "./query-Cm8NkHG3.js";
4
4
 
5
5
  //#region src/eav/cache.ts
6
6
  var SchemaCache = class {
@@ -603,4 +603,4 @@ function createReoptEavClient(config) {
603
603
 
604
604
  //#endregion
605
605
  export { RECORDS_PAGE_LIMIT_MAX as i, ATTRIBUTE_FILTER_LIST_MAX as n, ATTRIBUTE_FILTER_OPERATORS as r, createReoptEavClient as t };
606
- //# sourceMappingURL=client-D8d3xsYm.js.map
606
+ //# sourceMappingURL=client-CZPZqbFg.js.map
@@ -1,5 +1,5 @@
1
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
2
- import { t as buildQuery } from "./query-B8Hg9bub.js";
1
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.js";
2
+ import { t as buildQuery } from "./query-Cm8NkHG3.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-CmV48bW0.js.map
55
+ //# sourceMappingURL=client-CmdGfdqb.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
1
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.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-BxrWT0mi.js.map
53
+ //# sourceMappingURL=client-CpF98_Vy.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-DaSeKofC.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-D5mJJNdR.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
3
+ import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-D9FO4wJR.js";
4
4
 
5
5
  //#region src/files/client.ts
6
6
  var ReoptFileClient = class {
@@ -276,4 +276,4 @@ function createReoptFileClient(config) {
276
276
 
277
277
  //#endregion
278
278
  export { createReoptFileClient as n, ReoptFileClient as t };
279
- //# sourceMappingURL=client-ey80gKM_.js.map
279
+ //# sourceMappingURL=client-DCTRprTm.js.map
@@ -1,4 +1,4 @@
1
- import { a as resolveIdBaseUrl } from "./config-DaSeKofC.js";
1
+ import { a as resolveIdBaseUrl } from "./config-D5mJJNdR.js";
2
2
  import { o as readClientKeyRing, s as toPublicJwk } from "./keys-B_R_lsyF.js";
3
3
  import { createPrivateKeyJwtClientAssertionGetter } from "@better-auth/core/oauth2";
4
4
  import * as jose from "jose";
@@ -191,4 +191,4 @@ function createMachineClient(config) {
191
191
 
192
192
  //#endregion
193
193
  export { createDpopProof as n, createMachineClient as r, MachineTokenError as t };
194
- //# sourceMappingURL=client-BPcoDnOd.js.map
194
+ //# sourceMappingURL=client-DXMw9sYi.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-DaSeKofC.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-D5mJJNdR.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
3
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.js";
4
4
  import { n as parseSSEStream } from "./sse-parser-D65dmL4A.js";
5
5
 
6
6
  //#region src/ai/client.ts
@@ -262,7 +262,7 @@ var ReoptAiClient = class {
262
262
  }
263
263
  async fetchSSE(options) {
264
264
  const url = `${this.http.requestBaseUrl}/chat/completions`;
265
- const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.7.0-rc.10"}-${url.length}`;
265
+ const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.7.0-rc.11"}-${url.length}`;
266
266
  const ctx = {
267
267
  method: "POST",
268
268
  url,
@@ -343,4 +343,4 @@ function createReoptAiClient(config) {
343
343
 
344
344
  //#endregion
345
345
  export { createReoptAiClient as n, ReoptAiClient as t };
346
- //# sourceMappingURL=client-D97Ylva1.js.map
346
+ //# sourceMappingURL=client-DpJIK4dZ.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
1
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.js";
2
2
 
3
3
  //#region src/plans/client.ts
4
4
  function unwrap(body) {
@@ -143,4 +143,4 @@ function createReoptPlansClient(config) {
143
143
 
144
144
  //#endregion
145
145
  export { createReoptPlansClient as n, ReoptPlansClient as t };
146
- //# sourceMappingURL=client-CGy4Z0JO.js.map
146
+ //# sourceMappingURL=client-DriOmKty.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
1
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.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-B281w6RL.js.map
83
+ //# sourceMappingURL=client-fzvZmhTG.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
1
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.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-m4e-HwMX.js.map
28
+ //# sourceMappingURL=client-qWKpE68O.js.map
package/dist/cms/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createReoptCmsClient } from "../client-CmV48bW0.js";
1
+ import { t as createReoptCmsClient } from "../client-CmdGfdqb.js";
2
2
 
3
3
  //#region src/cms/helpers.ts
4
4
  function joinUrl(siteUrl, path) {
@@ -370,7 +370,7 @@ function mapHttpStatusToError(status, code, message, ctx, fieldErrors) {
370
370
 
371
371
  //#endregion
372
372
  //#region src/core/config.ts
373
- const SDK_VERSION = "4.7.0-rc.10";
373
+ const SDK_VERSION = "4.7.0-rc.11";
374
374
  /**
375
375
  * Default API host for EAV / AI / Files / CMS / Terms. Consumers can override
376
376
  * via `config.baseUrl` or the `REOPT_BASE_URL` env var.
@@ -552,4 +552,4 @@ function deriveIdFromBaseUrl(baseUrl) {
552
552
 
553
553
  //#endregion
554
554
  export { isValidationError as A, RequiredTermsError as C, isModelAccessError as D, isCreditLimitError as E, isReoptSDKError as O, ReoptSDKError as S, ValidationError as T, ModelAccessError as _, resolveIdBaseUrl as a, PreconditionFailedError as b, AuthUserNotFoundError as c, ConflictError as d, ContentFilterError as f, LimitExceededError as g, ForbiddenError as h, resolveBaseUrl as i, mapHttpStatusToError as j, isRequiredTermsError 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, ServerError as w, RateLimitError as x, NotFoundError as y };
555
- //# sourceMappingURL=config-DaSeKofC.js.map
555
+ //# sourceMappingURL=config-D5mJJNdR.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-DaSeKofC.js";
2
- import { i as RECORDS_PAGE_LIMIT_MAX, n as ATTRIBUTE_FILTER_LIST_MAX, r as ATTRIBUTE_FILTER_OPERATORS, t as createReoptEavClient } from "../client-D8d3xsYm.js";
1
+ import { c as AuthUserNotFoundError, g as LimitExceededError, l as AuthUserRecordExistsError, m as DuplicateAuthUserError } from "../config-D5mJJNdR.js";
2
+ import { i as RECORDS_PAGE_LIMIT_MAX, n as ATTRIBUTE_FILTER_LIST_MAX, r as ATTRIBUTE_FILTER_OPERATORS, t as createReoptEavClient } from "../client-CZPZqbFg.js";
3
3
 
4
4
  //#region src/eav/verify.ts
5
5
  async function verifyEavSchema(input) {
@@ -1,3 +1,3 @@
1
- import { n as createReoptFeedbackClient, t as ReoptFeedbackClient } from "../client-Brv0KsDM.js";
1
+ import { n as createReoptFeedbackClient, t as ReoptFeedbackClient } from "../client-Bw0W5V5G.js";
2
2
 
3
3
  export { ReoptFeedbackClient, createReoptFeedbackClient };
@@ -1,4 +1,4 @@
1
- import { n as createReoptFileClient, t as ReoptFileClient } from "../client-ey80gKM_.js";
1
+ import { n as createReoptFileClient, t as ReoptFileClient } from "../client-DCTRprTm.js";
2
2
 
3
3
  //#region src/files/helpers.ts
4
4
  const REOPT_IMAGE_REMOTE_PATTERNS = [{
@@ -1,4 +1,4 @@
1
- import { S as ReoptSDKError, a as resolveIdBaseUrl, i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, w as ServerError, x as RateLimitError } from "./config-DaSeKofC.js";
1
+ import { S as ReoptSDKError, a as resolveIdBaseUrl, i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, w as ServerError, x as RateLimitError } from "./config-D5mJJNdR.js";
2
2
  import { t as createAuthHeader } from "./encoding-Bwfm3iaE.js";
3
3
 
4
4
  //#region src/core/debug.ts
@@ -412,4 +412,4 @@ function parseFieldErrors(body) {
412
412
 
413
413
  //#endregion
414
414
  export { parseFieldErrors as n, BaseHttpClient as t };
415
- //# sourceMappingURL=http-client-BCZhLtY5.js.map
415
+ //# sourceMappingURL=http-client-D9FO4wJR.js.map
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { A as isValidationError, C as RequiredTermsError, D as isModelAccessError, E as isCreditLimitError, O as isReoptSDKError, S as ReoptSDKError, T as ValidationError, _ as ModelAccessError, b as PreconditionFailedError, c as AuthUserNotFoundError, d as ConflictError, f as ContentFilterError, g as LimitExceededError, h as ForbiddenError, i as resolveBaseUrl, j as mapHttpStatusToError, k as isRequiredTermsError, 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 ServerError, x as RateLimitError, y as NotFoundError } from "./config-DaSeKofC.js";
2
- import { t as BaseHttpClient } from "./http-client-BCZhLtY5.js";
3
- import { n as createReoptAiClient } from "./client-D97Ylva1.js";
4
- import { n as createReoptAuthClient } from "./client-BxrWT0mi.js";
5
- import { t as createReoptCmsClient } from "./client-CmV48bW0.js";
6
- import { t as createReoptEavClient } from "./client-D8d3xsYm.js";
7
- import { n as createReoptFeedbackClient } from "./client-Brv0KsDM.js";
8
- import { n as createReoptFileClient } from "./client-ey80gKM_.js";
9
- import { n as createReoptAnalyticsClient } from "./client-Dv7WwJr-.js";
10
- import { n as createReoptPlansClient } from "./client-CGy4Z0JO.js";
11
- import { n as createReoptPushClient } from "./client-m4e-HwMX.js";
12
- import { n as createReoptTermsClient } from "./client-B281w6RL.js";
1
+ import { A as isValidationError, C as RequiredTermsError, D as isModelAccessError, E as isCreditLimitError, O as isReoptSDKError, S as ReoptSDKError, T as ValidationError, _ as ModelAccessError, b as PreconditionFailedError, c as AuthUserNotFoundError, d as ConflictError, f as ContentFilterError, g as LimitExceededError, h as ForbiddenError, i as resolveBaseUrl, j as mapHttpStatusToError, k as isRequiredTermsError, 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 ServerError, x as RateLimitError, y as NotFoundError } from "./config-D5mJJNdR.js";
2
+ import { t as BaseHttpClient } from "./http-client-D9FO4wJR.js";
3
+ import { n as createReoptAiClient } from "./client-DpJIK4dZ.js";
4
+ import { n as createReoptAuthClient } from "./client-CpF98_Vy.js";
5
+ import { t as createReoptCmsClient } from "./client-CmdGfdqb.js";
6
+ import { t as createReoptEavClient } from "./client-CZPZqbFg.js";
7
+ import { n as createReoptFeedbackClient } from "./client-Bw0W5V5G.js";
8
+ import { n as createReoptFileClient } from "./client-DCTRprTm.js";
9
+ import { n as createReoptAnalyticsClient } from "./client-9X3vG2r3.js";
10
+ import { n as createReoptPlansClient } from "./client-DriOmKty.js";
11
+ import { n as createReoptPushClient } from "./client-qWKpE68O.js";
12
+ import { n as createReoptTermsClient } from "./client-fzvZmhTG.js";
13
13
 
14
14
  //#region src/singleton.ts
15
15
  let _instance;
@@ -1,7 +1,7 @@
1
- import { n as SDK_VERSION } from "../config-DaSeKofC.js";
1
+ import { n as SDK_VERSION } from "../config-D5mJJNdR.js";
2
2
  import { o as readClientKeyRing } from "../keys-B_R_lsyF.js";
3
- import { r as createMachineClient } from "../client-BPcoDnOd.js";
4
- import { S as platformBrandUpsertInputSchema, U as platformPipelineUpsertInputSchema, W as platformResourceKeySchema, j as platformErrorSchema, n as PlatformApiError, p as PLATFORM_OAUTH_CLIENT_PURPOSES, s as resolvePlatformUrls, w as platformBrandappUpsertInputSchema, y as PLATFORM_WEBHOOK_TRIGGERS } from "../client-C7z5-izC.js";
3
+ import { r as createMachineClient } from "../client-DXMw9sYi.js";
4
+ import { S as platformBrandUpsertInputSchema, U as platformPipelineUpsertInputSchema, W as platformResourceKeySchema, j as platformErrorSchema, n as PlatformApiError, p as PLATFORM_OAUTH_CLIENT_PURPOSES, s as resolvePlatformUrls, w as platformBrandappUpsertInputSchema, y as PLATFORM_WEBHOOK_TRIGGERS } from "../client-Bao2z7Lj.js";
5
5
  import * as jose from "jose";
6
6
  import { z } from "zod";
7
7
 
@@ -1,4 +1,4 @@
1
- import { S as ReoptSDKError, a as resolveIdBaseUrl } from "../config-DaSeKofC.js";
1
+ import { S as ReoptSDKError, a as resolveIdBaseUrl } from "../config-D5mJJNdR.js";
2
2
 
3
3
  //#region src/logout/verify.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
1
  import { a as parseClientPrivateJwk, i as generateClientKeyPair, n as DEFAULT_CLIENT_KEY_ALGORITHM, o as readClientKeyRing, r as buildClientJwks, s as toPublicJwk, t as CLIENT_JWKS_PATH } from "../keys-B_R_lsyF.js";
2
- import { n as createDpopProof, r as createMachineClient, t as MachineTokenError } from "../client-BPcoDnOd.js";
2
+ import { n as createDpopProof, r as createMachineClient, t as MachineTokenError } from "../client-DXMw9sYi.js";
3
3
 
4
4
  export { CLIENT_JWKS_PATH, DEFAULT_CLIENT_KEY_ALGORITHM, MachineTokenError, buildClientJwks, createDpopProof, createMachineClient, generateClientKeyPair, parseClientPrivateJwk, readClientKeyRing, toPublicJwk };
@@ -1,3 +1,3 @@
1
- import { n as createReoptPlansClient, t as ReoptPlansClient } from "../client-CGy4Z0JO.js";
1
+ import { n as createReoptPlansClient, t as ReoptPlansClient } from "../client-DriOmKty.js";
2
2
 
3
3
  export { ReoptPlansClient, createReoptPlansClient };
@@ -1,3 +1,3 @@
1
- import { n as createReoptPushClient, t as ReoptPushClient } from "../client-m4e-HwMX.js";
1
+ import { n as createReoptPushClient, t as ReoptPushClient } from "../client-qWKpE68O.js";
2
2
 
3
3
  export { ReoptPushClient, createReoptPushClient };
@@ -1,4 +1,4 @@
1
- import { S as ReoptSDKError } from "./config-DaSeKofC.js";
1
+ import { S as ReoptSDKError } from "./config-D5mJJNdR.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-B8Hg9bub.js.map
35
+ //# sourceMappingURL=query-Cm8NkHG3.js.map
@@ -1,4 +1,4 @@
1
- import { i as REOPT_PLATFORM_URLS, n as PlatformApiError, o as createPlatformRequester, r as REOPT_PLATFORM_ID_URLS, s as resolvePlatformUrls } from "../client-C7z5-izC.js";
1
+ import { i as REOPT_PLATFORM_URLS, n as PlatformApiError, o as createPlatformRequester, r as REOPT_PLATFORM_ID_URLS, s as resolvePlatformUrls } from "../client-Bao2z7Lj.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/social/schemas.ts
@@ -1,3 +1,3 @@
1
- import { n as createReoptTermsClient, t as ReoptTermsClient } from "../client-B281w6RL.js";
1
+ import { n as createReoptTermsClient, t as ReoptTermsClient } from "../client-fzvZmhTG.js";
2
2
 
3
3
  export { ReoptTermsClient, createReoptTermsClient };
@@ -1,3 +1,3 @@
1
- import { $ as platformWebhookUpsertInputSchema, A as platformEavSchemaOperationSchema, B as platformPipelineResourceSchema, C as platformBrandappResourceSchema, D as platformEavEntityResourceSchema, E as platformEavBrandappResourcesSchema, F as platformMeSchema, G as platformResourcesSchema, H as platformPipelineStageInputSchema, I as platformOAuthClientImportInputSchema, J as platformTaskStageInputSchema, K as platformResourcesV2Schema, L as platformOAuthClientResourceSchema, M as platformExternalIdSchema, N as platformLockAcquiredSchema, O as platformEavSchemaApplyInputSchema, P as platformLockReleasedSchema, Q as platformWebhookSchema, R as platformOAuthClientUpsertInputSchema, S as platformBrandUpsertInputSchema, T as platformCustomerUpsertInputSchema, U as platformPipelineUpsertInputSchema, V as platformPipelineSchema, W as platformResourceKeySchema, X as platformTaskUpsertInputSchema, Y as platformTaskStageSchema, Z as platformWebhookResourceSchema, _ as PLATFORM_TASK_PRIORITIES, a as createPlatformClient, b as platformBrandImportInputSchema, c as PLATFORM_ADMIN_SCOPE, d as PLATFORM_MANAGED_BY_VALUES, et as platformWorkTaskStageChangedEventSchema, f as PLATFORM_OAUTH_APPLICATION_TYPES, g as PLATFORM_TASK_OUTCOMES, h as PLATFORM_STAGE_COLORS, i as REOPT_PLATFORM_URLS, j as platformErrorSchema, k as platformEavSchemaApplyResultSchema, l as PLATFORM_BRANDAPP_STATUSES, m as PLATFORM_OAUTH_GRANT_TYPES, n as PlatformApiError, p as PLATFORM_OAUTH_CLIENT_PURPOSES, q as platformTaskSchema, r as REOPT_PLATFORM_ID_URLS, s as resolvePlatformUrls, t as DEFAULT_PLATFORM_SCOPES, tt as platformWriteMetaSchema, u as PLATFORM_DOMAIN_STATUSES, v as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, w as platformBrandappUpsertInputSchema, x as platformBrandResourceSchema, y as PLATFORM_WEBHOOK_TRIGGERS, z as platformPipelineImportInputSchema } from "../client-C7z5-izC.js";
1
+ import { $ as platformWebhookUpsertInputSchema, A as platformEavSchemaOperationSchema, B as platformPipelineResourceSchema, C as platformBrandappResourceSchema, D as platformEavEntityResourceSchema, E as platformEavBrandappResourcesSchema, F as platformMeSchema, G as platformResourcesSchema, H as platformPipelineStageInputSchema, I as platformOAuthClientImportInputSchema, J as platformTaskStageInputSchema, K as platformResourcesV2Schema, L as platformOAuthClientResourceSchema, M as platformExternalIdSchema, N as platformLockAcquiredSchema, O as platformEavSchemaApplyInputSchema, P as platformLockReleasedSchema, Q as platformWebhookSchema, R as platformOAuthClientUpsertInputSchema, S as platformBrandUpsertInputSchema, T as platformCustomerUpsertInputSchema, U as platformPipelineUpsertInputSchema, V as platformPipelineSchema, W as platformResourceKeySchema, X as platformTaskUpsertInputSchema, Y as platformTaskStageSchema, Z as platformWebhookResourceSchema, _ as PLATFORM_TASK_PRIORITIES, a as createPlatformClient, b as platformBrandImportInputSchema, c as PLATFORM_ADMIN_SCOPE, d as PLATFORM_MANAGED_BY_VALUES, et as platformWorkTaskStageChangedEventSchema, f as PLATFORM_OAUTH_APPLICATION_TYPES, g as PLATFORM_TASK_OUTCOMES, h as PLATFORM_STAGE_COLORS, i as REOPT_PLATFORM_URLS, j as platformErrorSchema, k as platformEavSchemaApplyResultSchema, l as PLATFORM_BRANDAPP_STATUSES, m as PLATFORM_OAUTH_GRANT_TYPES, n as PlatformApiError, p as PLATFORM_OAUTH_CLIENT_PURPOSES, q as platformTaskSchema, r as REOPT_PLATFORM_ID_URLS, s as resolvePlatformUrls, t as DEFAULT_PLATFORM_SCOPES, tt as platformWriteMetaSchema, u as PLATFORM_DOMAIN_STATUSES, v as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, w as platformBrandappUpsertInputSchema, x as platformBrandResourceSchema, y as PLATFORM_WEBHOOK_TRIGGERS, z as platformPipelineImportInputSchema } from "../client-Bao2z7Lj.js";
2
2
 
3
3
  export { DEFAULT_PLATFORM_SCOPES, PLATFORM_ADMIN_SCOPE, PLATFORM_BRANDAPP_STATUSES, PLATFORM_DOMAIN_STATUSES, PLATFORM_MANAGED_BY_VALUES, PLATFORM_OAUTH_APPLICATION_TYPES, PLATFORM_OAUTH_CLIENT_PURPOSES, PLATFORM_OAUTH_GRANT_TYPES, PLATFORM_STAGE_COLORS, PLATFORM_TASK_OUTCOMES, PLATFORM_TASK_PRIORITIES, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, PLATFORM_WEBHOOK_TRIGGERS, PlatformApiError, REOPT_PLATFORM_ID_URLS, REOPT_PLATFORM_URLS, createPlatformClient, platformBrandImportInputSchema, platformBrandResourceSchema, platformBrandUpsertInputSchema, platformBrandappResourceSchema, platformBrandappUpsertInputSchema, platformCustomerUpsertInputSchema, platformEavBrandappResourcesSchema, platformEavEntityResourceSchema, platformEavSchemaApplyInputSchema, platformEavSchemaApplyResultSchema, platformEavSchemaOperationSchema, platformErrorSchema, platformExternalIdSchema, platformLockAcquiredSchema, platformLockReleasedSchema, platformMeSchema, platformOAuthClientImportInputSchema, platformOAuthClientResourceSchema, platformOAuthClientUpsertInputSchema, platformPipelineImportInputSchema, platformPipelineResourceSchema, platformPipelineSchema, platformPipelineStageInputSchema, platformPipelineUpsertInputSchema, platformResourceKeySchema, platformResourcesSchema, platformResourcesV2Schema, platformTaskSchema, platformTaskStageInputSchema, platformTaskStageSchema, platformTaskUpsertInputSchema, platformWebhookResourceSchema, platformWebhookSchema, platformWebhookUpsertInputSchema, platformWorkTaskStageChangedEventSchema, platformWriteMetaSchema, resolvePlatformUrls };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reopt-ai/brandapp-sdk",
3
- "version": "4.7.0-rc.10",
3
+ "version": "4.7.0-rc.11",
4
4
  "description": "Reopt Brandapp SDK — Better Auth adapter, OAuth login, and EAV client",
5
5
  "author": "Reopt",
6
6
  "license": "MIT",