@reopt-ai/brandapp-sdk 4.7.0-rc.12 → 4.7.0-rc.13

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 +38 -0
  2. package/README.md +28 -19
  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 +35 -26
  8. package/dist/better-auth/index.js +71 -46
  9. package/dist/{client-Bzk7eqy5.js → client-B2nwOzdZ.js} +3 -3
  10. package/dist/{client-BtFoViKj.js → client-BBfRO86C.js} +3 -3
  11. package/dist/{client-Ccw-FJlt.js → client-BF94tdhy.js} +4 -4
  12. package/dist/{client-BL7vOv_M.js → client-BvgSoqAc.js} +2 -2
  13. package/dist/{client-BvLrx0Ai.js → client-CDeaH7JC.js} +2 -2
  14. package/dist/{client-CB1A7gg4.js → client-Ca_5meV_.js} +2 -2
  15. package/dist/{client-BHoS1dGr.js → client-CoaQxuaG.js} +2 -2
  16. package/dist/{client-tFChmi6z.js → client-D38XGQRR.js} +4 -4
  17. package/dist/{client-l7dQ_fLm.js → client-Do7Eny_J.js} +3 -3
  18. package/dist/{client-BUfDFULW.js → client-DoK8YCd_.js} +2 -2
  19. package/dist/{client-BvUK6AxL.js → client-RnJg4AGr.js} +2 -2
  20. package/dist/{client-BHX14FpH.js → client-v7ed6KdC.js} +2 -2
  21. package/dist/cms/index.js +1 -1
  22. package/dist/{config-D21ZcDET.js → config-Cxv010M9.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-CVwg2EAl.js → http-client-COcHWJzo.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-C_qce1vC.js → query-Ch_JZ5Bd.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,44 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.7.0-rc.13] — 2026-11-08
11
+
12
+ Pre-release (`npm i @reopt-ai/brandapp-sdk@next`) — 앱 심사용 번호를 리옵트 콘솔로 옮기고, 전화번호 정본을 E.164로
13
+ 바꾼다. 🔴 rc.11·12로 받은 사용자가 있으면 배포 전에 번호를 옮긴다(아래 Changed 둘째 항목).
14
+
15
+ ### Removed
16
+
17
+ - **`createReoptPhoneNumber`의 `reviewAccounts` 옵션과 `ReoptPhoneReviewAccounts` 타입**(rc.12). 앱 심사용 번호는
18
+ 이제 리옵트 콘솔(브랜드앱 설정 → 앱 심사용 번호)에서 등록한다 — 앱을 다시 배포하지 않고 번호·코드를 바꾸거나 지울
19
+ 수 있고, 코드는 앱 env가 아니라 리옵트에 암호화돼 남는다. 옮길 때: 옵션과 그 env를 지우고 같은 번호·코드를
20
+ 콘솔에 등록한다(등록은 2단계 인증으로 로그인한 지 5분 안에).
21
+
22
+ ### Changed
23
+
24
+ - 콘솔에 등록된 심사용 번호면 리옵트가 문자를 보내지 않고 고정 코드를 돌려주고(`{ sent: false, via: "review", code }`),
25
+ 플러그인이 그 코드를 이번 인증번호로 저장한다. 검증·시도 횟수·만료·가입은 다른 번호와 같다. 코드 길이가
26
+ `otpLength`와 다르면 `REVIEW_CODE_LENGTH_MISMATCH`(Better Auth 503). 플러그인은 요청에 `acceptsReviewCode: true`를
27
+ 싣는다 — 싣지 않는 호출자(rc.12 이하, 직접 배선한 앱)에게 리옵트는 그 번호를 409 `REVIEW_ACCOUNT_SDK_OUTDATED`로
28
+ 거절한다(코드를 돌려줘도 버려지기 때문). `createReoptOtpSmsSender`의 입력에 `acceptsReviewCode`, 결과 타입
29
+ `ReoptOtpSmsResult`에 `review`가 생겼다.
30
+
31
+ - **전화번호 정본이 E.164로 바뀐다**(`+821012345678`, rc.11·12는 국내 표기 `01012345678`). 해외 번호를 받을 준비다 —
32
+ 리옵트 서버는 두 표기를 모두 받아 E.164로 저장하고 기존 행도 옮기므로 rc.11·12와도 함께 동작한다.
33
+ 🔴 **앱의 Better Auth 사용자 행은 앱이 옮긴다** — rc.11·12는 `user.phoneNumber`에 `01012345678`을 저장했고 rc.13은
34
+ `+821012345678`로 찾는다. 옮기지 않으면 그 사용자가 같은 번호로 **새로 가입**된다. 업그레이드 배포 전에 한 번
35
+ (테이블·컬럼 이름은 앱 스키마에 맞춘다):
36
+ `UPDATE "user" SET "phoneNumber" = '+82' || substr("phoneNumber", 2) WHERE "phoneNumber" ~ '^01[016789][0-9]{7,8}$';`
37
+ 번호를 앱 저장소의 다른 곳에도 두었다면 그 값도 E.164로 맞춘다. 임시 이메일은 `+`를 뺀 숫자다
38
+ (`821012345678.<난수>@…`). 기존 사용자의 임시 이메일은 바뀌지 않는다.
39
+ - `+국가코드`로 쓴 다른 국가 번호는 SDK가 거절하지 않고 리옵트로 넘긴다 — 리옵트가 브랜드앱 설정(지금은 한국만)으로
40
+ 판정해 `PHONE_COUNTRY_NOT_ALLOWED`(Better Auth 400)로 거절한다. 표기가 이상한 번호는 종전대로 `INVALID_PHONE_NUMBER`.
41
+
42
+ ### Added
43
+
44
+ - `formatReoptPhoneNumber` — 저장된 번호를 화면 표기로(`010-1234-5678`, 다른 국가는 E.164 그대로).
45
+ - 리옵트 거절 코드 `PHONE_LOGIN_DISABLED`(콘솔에서 전화번호 로그인을 끈 앱, Better Auth 403)·
46
+ `PHONE_COUNTRY_NOT_ALLOWED`(400)를 Better Auth 오류로 넘긴다.
47
+
10
48
  ## [4.7.0-rc.12] — 2026-11-07
11
49
 
12
50
  Pre-release (`npm i @reopt-ai/brandapp-sdk@next`) — 전화번호 로그인 앱 심사 계정.
package/README.md CHANGED
@@ -201,10 +201,21 @@ export const auth = betterAuth({
201
201
  // await authClient.phoneNumber.verify({ phoneNumber: "010-1234-5678", code });
202
202
  ```
203
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.
204
+ - **Numbers are stored in E.164** (`+821012345678`). Every `/phone-number/*`
205
+ request is canonicalized before the plugin sees it, so different formats
206
+ (`010-1234-5678`, `+82 10 1234 5678`) never split one person into two
207
+ accounts; malformed numbers get a 400 (`INVALID_PHONE_NUMBER`).
208
+ **Upgrading from 4.7.0-rc.11/rc.12:** those stored domestic numbers
209
+ (`01012345678`). Move existing `user.phoneNumber` rows to E.164 before you
210
+ deploy, or those users sign up again as new accounts — see the CHANGELOG
211
+ entry for 4.7.0-rc.13.
212
+ - **Reopt sends to Korean mobile numbers only for now.** Other countries are
213
+ refused with `PHONE_COUNTRY_NOT_ALLOWED` (Better Auth 400). Which countries an
214
+ app accepts is its phone-login setting in the Platform console (Korea only
215
+ until international SMS opens); turning phone login off there returns
216
+ `PHONE_LOGIN_DISABLED` (403). Foreign numbers are the main SMS-pumping vector.
217
+ - `formatReoptPhoneNumber` turns a stored number back into a display form
218
+ (`010-1234-5678`, or E.164 for other countries).
208
219
  - Without an SMS connection the send fails with `SMS_NOT_CONNECTED` (Better
209
220
  Auth 503 to your client). Reopt's own system brands and test workspaces fall
210
221
  back to Reopt's number (test workspaces: 30/hour, 100/day).
@@ -221,21 +232,19 @@ export const auth = betterAuth({
221
232
  store unverified numbers on sign-up; the factory throws).
222
233
  - Already wiring the plugin yourself? `createReoptOtpSmsSender(config)` returns
223
234
  just the sender for your own `sendOTP` — pass canonical numbers
224
- (`canonicalizeReoptPhoneNumber`) and `clientIp`.
225
- - **App-store review accounts** — reviewers cannot receive texts. Give them a
226
- number and a fixed code:
227
-
228
- ```ts
229
- createReoptPhoneNumber(config, {
230
- reviewAccounts: { phoneNumbers: ["010-0000-1234"], code: "246810" },
231
- });
232
- ```
233
-
234
- Those numbers never reach Reopt (no SMS, no cost); the stored code becomes
235
- `code`, and verification, attempt limits, expiry and sign-up run as usual.
236
- `code` must be `otpLength` digits. Use numbers that are **not in service** —
237
- a real number would lock its owner out and let anyone with the code into the
238
- account. Read both values from env and omit the option to turn it off.
235
+ (`canonicalizeReoptPhoneNumber`) and `clientIp`. If you also pass
236
+ `acceptsReviewCode: true`, store the `code` of a `{ via: "review" }` result
237
+ as that number's OTP (without the flag, review numbers are refused with 409
238
+ `REVIEW_ACCOUNT_SDK_OUTDATED`).
239
+ - **App-store review numbers** — reviewers cannot receive texts. Register a
240
+ number and a fixed code in the Reopt console (brandapp settings → 앱 심사용
241
+ 번호); nothing goes in your code. For those numbers Reopt sends no SMS and
242
+ returns the fixed code, the plugin stores it as the OTP, and verification,
243
+ attempt limits, expiry and sign-up run as usual. The code must be `otpLength`
244
+ digits (otherwise the send fails with `REVIEW_CODE_LENGTH_MISMATCH`). Use
245
+ numbers that are **not in service** — a real number would lock its owner out
246
+ and let anyone with the code into the account. Reopt does not create a CRM
247
+ customer for a review-number sign-up.
239
248
 
240
249
  ### External marketing site (1.8+)
241
250
 
package/dist/ai/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { S as ReoptSDKError } from "../config-D21ZcDET.js";
2
- import { n as createReoptAiClient, t as ReoptAiClient } from "../client-tFChmi6z.js";
1
+ import { S as ReoptSDKError } from "../config-Cxv010M9.js";
2
+ import { n as createReoptAiClient, t as ReoptAiClient } from "../client-D38XGQRR.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-D21ZcDET.js";
1
+ import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-Cxv010M9.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-BUfDFULW.js";
1
+ import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-DoK8YCd_.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-CB1A7gg4.js";
1
+ import { n as createReoptAuthClient, t as ReoptAuthClient } from "../client-Ca_5meV_.js";
2
2
 
3
3
  //#region src/auth/session.ts
4
4
  /**
@@ -113,14 +113,19 @@ declare function createReoptOAuth(options: ReoptOAuthOptions): BetterAuthPlugin;
113
113
  * Phone-number login vocabulary. Mirrors `@reopt/constants/brandapp-phone-login` on reopt's
114
114
  * server (the SDK cannot import it) — a reopt web test compares the two.
115
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.
116
+ * The canonical form is **E.164** (`+821012345678`): Better Auth's plugin looks users up by the exact
117
+ * input string, so without one canonical form `010-1234-5678` and `+82 10-1234-5678` would become two
118
+ * accounts. Domestic Korean input (`010…`, `82…`) is read as a Korean mobile; other countries must be
119
+ * written with `+` and are only shape-checked here — whether reopt sends to that country is the
120
+ * brandapp's setting on reopt (today: Korea only; other countries are refused with
121
+ * `PHONE_COUNTRY_NOT_ALLOWED`). Foreign numbers are the main SMS-pumping (toll fraud) vector.
120
122
  */
121
123
  declare const REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN = "phone-login.reopt.app";
122
124
  declare const DEFAULT_REOPT_PHONE_OTP_EXPIRES_IN = 300;
123
- /** Canonical Korean mobile digits (`01012345678`) or null. `+82 10-…`, `82-10-…`, `010.…` all canonicalize. */
125
+ /**
126
+ * Canonical E.164 number or null. `010-1234-5678`, `+82 10-…`, `82-10-…` → `+821012345678`;
127
+ * `+1 415 555 0100` → `+14155550100` (shape only). Korean landlines and malformed input → null.
128
+ */
124
129
  declare function canonicalizeReoptPhoneNumber(raw: string | null | undefined): string | null;
125
130
  declare function isValidReoptPhoneNumber(raw: string): boolean;
126
131
  /**
@@ -129,6 +134,8 @@ declare function isValidReoptPhoneNumber(raw: string): boolean;
129
134
  * reopt reads this domain as "no email" (CRM linking, console).
130
135
  */
131
136
  declare function buildReoptPhoneLoginTempEmail(raw: string): string;
137
+ /** Display form — Korean 010 numbers as `010-1234-5678`, other Korean numbers domestic, other countries E.164. */
138
+ declare function formatReoptPhoneNumber(raw: string): string;
132
139
  type ReoptPhoneNumberOptions = {
133
140
  /** OTP length, 4–8. Default 6. */
134
141
  otpLength?: number;
@@ -147,25 +154,13 @@ type ReoptPhoneNumberOptions = {
147
154
  getTempName?: (phoneNumber: string) => string;
148
155
  /** Called after a verification succeeds (`callbackOnVerification` of the plugin). */
149
156
  callbackOnVerification?: PhoneNumberOptions["callbackOnVerification"];
150
- /**
151
- * App-store review accounts — numbers that never get an SMS and accept one fixed code, so a
152
- * reviewer (who cannot receive texts) can sign in. Omit to disable.
153
- *
154
- * For these numbers reopt is not called (no SMS, no cost); the code the plugin just stored is
155
- * replaced with `code`. Verification, attempt limits, expiry and sign-up then run exactly as for
156
- * any other number.
157
- *
158
- * 🔴 Use numbers that are **not in service**. A real number here locks its owner out (they never
159
- * get a text) and lets anyone who knows `code` into that account.
160
- */
161
- reviewAccounts?: ReoptPhoneReviewAccounts;
162
- };
163
- type ReoptPhoneReviewAccounts = {
164
- /** Any format — canonicalized like every other number. Must not be empty. */
165
- phoneNumbers: readonly string[];
166
- /** Digits only, exactly `otpLength` long. */
167
- code: string;
168
157
  };
158
+ /**
159
+ * - `workspace` / `reopt` — an SMS went out (through the workspace's Solapi or reopt's own number).
160
+ * - `review` — the number is an **app-review number** registered in the reopt console: no SMS was
161
+ * sent, and `code` is the fixed code the reviewer will type. The caller must store it as this
162
+ * number's OTP (the plugin from `createReoptPhoneNumber` does).
163
+ */
169
164
  type ReoptOtpSmsResult = {
170
165
  sent: true;
171
166
  via: "workspace";
@@ -173,17 +168,26 @@ type ReoptOtpSmsResult = {
173
168
  sent: true;
174
169
  via: "reopt";
175
170
  reason: string;
171
+ } | {
172
+ sent: false;
173
+ via: "review";
174
+ code: string;
176
175
  };
177
176
  /**
178
177
  * Sends one OTP SMS through reopt (`POST /auth/otp/sms`). Exposed for apps that wire the
179
178
  * `phoneNumber` plugin themselves and only want reopt as the SMS sender. Pass `clientIp`
180
179
  * (the end user's IP as your server sees it) so reopt can rate-limit per user, not per server.
180
+ *
181
+ * Pass `acceptsReviewCode: true` only if you handle `{ via: "review", code }` by storing `code` as
182
+ * that number's OTP. Without it reopt refuses app-review numbers with 409
183
+ * `REVIEW_ACCOUNT_SDK_OUTDATED` instead of returning a code you would drop.
181
184
  */
182
185
  declare function createReoptOtpSmsSender(config: ReoptSDKConfig): (input: {
183
186
  phoneNumber: string;
184
187
  code: string;
185
188
  expiresInSeconds?: number;
186
189
  clientIp?: string | null;
190
+ acceptsReviewCode?: boolean;
187
191
  }) => Promise<ReoptOtpSmsResult>;
188
192
  /**
189
193
  * Phone-number login for a brandapp — Better Auth's `phoneNumber` plugin with reopt as the SMS
@@ -191,8 +195,13 @@ declare function createReoptOtpSmsSender(config: ReoptSDKConfig): (input: {
191
195
  * Solapi account (or, for reopt's own system brands and test workspaces, through reopt's own
192
196
  * number). If the workspace has no SMS connection the send fails with `SMS_NOT_CONNECTED`.
193
197
  *
194
- * - Korean mobile numbers only; every `/phone-number/*` request is canonicalized to `01012345678`
195
- * before the plugin sees it (so formats never split one person into two accounts).
198
+ * - Every `/phone-number/*` request is canonicalized to E.164 (`+821012345678`) before the plugin
199
+ * sees it (so formats never split one person into two accounts). reopt decides which countries it
200
+ * sends to (the brandapp's phone-login setting — today Korea only).
201
+ * - **App-review numbers** (Apple/Google reviewers cannot receive texts) are registered in the reopt
202
+ * console, not in your code. For those numbers reopt sends no SMS and returns the fixed code; the
203
+ * plugin stores it as the number's OTP, so verification, attempt limits, expiry and sign-up run
204
+ * exactly as for any other number. Changing or removing a number needs no redeploy.
196
205
  * - The end user's IP (per your Better Auth `advanced.ipAddress` settings) is forwarded so reopt can
197
206
  * rate-limit per user. Keep Better Auth's own rate limiter on with shared storage as well.
198
207
  * - Requires better-auth >= 1.7.16.
@@ -246,5 +255,5 @@ type ReoptBetterAuthBundle = {
246
255
  */
247
256
  declare function createReoptBetterAuth(options: ReoptBetterAuthOptions): ReoptBetterAuthBundle;
248
257
  //#endregion
249
- 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 ReoptPhoneReviewAccounts, type ReoptSDKConfig, ReoptSDKError, STEP_UP_MAX_AUTH_AGE_SECONDS, ServerError, buildReoptPhoneLoginTempEmail, canonicalizeReoptPhoneNumber, createReoptAdapter, createReoptBetterAuth, createReoptOAuth, createReoptOtpSmsSender, createReoptPhoneNumber, isReoptSDKError, isValidReoptPhoneNumber };
258
+ 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, formatReoptPhoneNumber, isReoptSDKError, isValidReoptPhoneNumber };
250
259
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
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-D21ZcDET.js";
2
- import { t as BaseHttpClient } from "../http-client-CVwg2EAl.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-Cxv010M9.js";
2
+ import { t as BaseHttpClient } from "../http-client-COcHWJzo.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";
@@ -217,10 +217,12 @@ function createReoptOAuth(options) {
217
217
  * Phone-number login vocabulary. Mirrors `@reopt/constants/brandapp-phone-login` on reopt's
218
218
  * server (the SDK cannot import it) — a reopt web test compares the two.
219
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.
220
+ * The canonical form is **E.164** (`+821012345678`): Better Auth's plugin looks users up by the exact
221
+ * input string, so without one canonical form `010-1234-5678` and `+82 10-1234-5678` would become two
222
+ * accounts. Domestic Korean input (`010…`, `82…`) is read as a Korean mobile; other countries must be
223
+ * written with `+` and are only shape-checked here — whether reopt sends to that country is the
224
+ * brandapp's setting on reopt (today: Korea only; other countries are refused with
225
+ * `PHONE_COUNTRY_NOT_ALLOWED`). Foreign numbers are the main SMS-pumping (toll fraud) vector.
224
226
  */
225
227
  const REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN = "phone-login.reopt.app";
226
228
  const DEFAULT_REOPT_PHONE_OTP_EXPIRES_IN = 300;
@@ -232,18 +234,29 @@ const MIN_BETTER_AUTH_VERSION = [
232
234
  ];
233
235
  const PHONE_INPUT_PATTERN = /^\+?[0-9 ().-]+$/;
234
236
  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. */
237
+ const E164_PATTERN = /^\+[1-9][0-9]{7,14}$/;
238
+ const KOREA_DIAL_CODE = "82";
239
+ /**
240
+ * Canonical E.164 number or null. `010-1234-5678`, `+82 10-…`, `82-10-…` → `+821012345678`;
241
+ * `+1 415 555 0100` → `+14155550100` (shape only). Korean landlines and malformed input → null.
242
+ */
236
243
  function canonicalizeReoptPhoneNumber(raw) {
237
244
  if (typeof raw !== "string") return null;
238
245
  const trimmed = raw.trim();
239
246
  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}`;
247
+ const digits = trimmed.replace(/\D/g, "");
248
+ const international = trimmed.startsWith("+");
249
+ if (!international || digits.startsWith(KOREA_DIAL_CODE)) {
250
+ let national = digits;
251
+ if (national.startsWith(KOREA_DIAL_CODE)) {
252
+ national = national.slice(2);
253
+ if (!national.startsWith("0")) national = `0${national}`;
254
+ } else if (international) return null;
255
+ if (!KOREAN_MOBILE_PATTERN.test(national)) return null;
256
+ return `+${KOREA_DIAL_CODE}${national.slice(1)}`;
245
257
  }
246
- return KOREAN_MOBILE_PATTERN.test(digits) ? digits : null;
258
+ const candidate = `+${digits}`;
259
+ return E164_PATTERN.test(candidate) ? candidate : null;
247
260
  }
248
261
  function isValidReoptPhoneNumber(raw) {
249
262
  return canonicalizeReoptPhoneNumber(raw) !== null;
@@ -259,15 +272,24 @@ function randomNonce() {
259
272
  * reopt reads this domain as "no email" (CRM linking, console).
260
273
  */
261
274
  function buildReoptPhoneLoginTempEmail(raw) {
262
- return `${canonicalizeReoptPhoneNumber(raw) ?? raw.replace(/\D/g, "")}.${randomNonce()}@${REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN}`;
275
+ return `${(canonicalizeReoptPhoneNumber(raw) ?? raw).replace(/\D/g, "")}.${randomNonce()}@${REOPT_PHONE_LOGIN_TEMP_EMAIL_DOMAIN}`;
263
276
  }
264
- function formatKoreanMobile(canonical) {
265
- return /^010\d{8}$/.test(canonical) ? `${canonical.slice(0, 3)}-${canonical.slice(3, 7)}-${canonical.slice(7)}` : canonical;
277
+ /** Display form — Korean 010 numbers as `010-1234-5678`, other Korean numbers domestic, other countries E.164. */
278
+ function formatReoptPhoneNumber(raw) {
279
+ const canonical = canonicalizeReoptPhoneNumber(raw);
280
+ if (!canonical) return raw;
281
+ if (!canonical.startsWith(`+${KOREA_DIAL_CODE}`)) return canonical;
282
+ const national = `0${canonical.slice(3)}`;
283
+ return /^010\d{8}$/.test(national) ? `${national.slice(0, 3)}-${national.slice(3, 7)}-${national.slice(7)}` : national;
266
284
  }
267
285
  /**
268
286
  * Sends one OTP SMS through reopt (`POST /auth/otp/sms`). Exposed for apps that wire the
269
287
  * `phoneNumber` plugin themselves and only want reopt as the SMS sender. Pass `clientIp`
270
288
  * (the end user's IP as your server sees it) so reopt can rate-limit per user, not per server.
289
+ *
290
+ * Pass `acceptsReviewCode: true` only if you handle `{ via: "review", code }` by storing `code` as
291
+ * that number's OTP. Without it reopt refuses app-review numbers with 409
292
+ * `REVIEW_ACCOUNT_SDK_OUTDATED` instead of returning a code you would drop.
271
293
  */
272
294
  function createReoptOtpSmsSender(config) {
273
295
  const http = new BaseHttpClient(config, `/api/v1/brandapp/${config.brandappId}/auth`);
@@ -276,7 +298,8 @@ function createReoptOtpSmsSender(config) {
276
298
  phoneNumber: input.phoneNumber,
277
299
  code: input.code,
278
300
  expiresInSeconds: input.expiresInSeconds ?? 300,
279
- ...input.clientIp ? { clientIp: input.clientIp } : {}
301
+ ...input.clientIp ? { clientIp: input.clientIp } : {},
302
+ ...input.acceptsReviewCode ? { acceptsReviewCode: true } : {}
280
303
  })).data;
281
304
  };
282
305
  }
@@ -295,9 +318,17 @@ function toAuthError(error) {
295
318
  code: "OTP_UNAVAILABLE",
296
319
  message: error.message
297
320
  });
321
+ if (error.status === 403 && error.code === "PHONE_LOGIN_DISABLED") return new APIError("FORBIDDEN", {
322
+ code: "PHONE_LOGIN_DISABLED",
323
+ message: "Phone login is turned off for this app."
324
+ });
325
+ if (error.status === 400 && error.code === "PHONE_COUNTRY_NOT_ALLOWED") return new APIError("BAD_REQUEST", {
326
+ code: "PHONE_COUNTRY_NOT_ALLOWED",
327
+ message: "Phone login is not available for numbers from this country."
328
+ });
298
329
  if (error.status === 400) return new APIError("BAD_REQUEST", {
299
330
  code: "INVALID_PHONE_NUMBER",
300
- message: "Enter a Korean mobile number."
331
+ message: "Enter a valid mobile number."
301
332
  });
302
333
  return error;
303
334
  }
@@ -305,21 +336,6 @@ function assertBetterAuthVersion(version) {
305
336
  const parts = typeof version === "string" ? version.split(/[.-]/).slice(0, 3).map((part) => Number.parseInt(part, 10)) : [];
306
337
  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
338
  }
308
- function resolveReviewAccounts(review, otpLength) {
309
- if (!review) return null;
310
- if (review.phoneNumbers.length === 0) throw new Error("[@reopt-ai/brandapp-sdk] reviewAccounts.phoneNumbers is empty — omit reviewAccounts to disable it.");
311
- const numbers = /* @__PURE__ */ new Set();
312
- for (const raw of review.phoneNumbers) {
313
- const canonical = canonicalizeReoptPhoneNumber(raw);
314
- if (!canonical) throw new Error(`[@reopt-ai/brandapp-sdk] reviewAccounts.phoneNumbers has a value that is not a Korean mobile number.`);
315
- numbers.add(canonical);
316
- }
317
- if (!/^[0-9]+$/.test(review.code) || review.code.length !== otpLength) throw new Error(`[@reopt-ai/brandapp-sdk] reviewAccounts.code must be ${otpLength} digits (otpLength).`);
318
- return {
319
- numbers,
320
- code: review.code
321
- };
322
- }
323
339
  /**
324
340
  * The plugin's verification row for a phone OTP. Mirrors `phoneNumberOTPIdentifier` in
325
341
  * better-auth's phone-number plugin (not exported) — the review round-trip test runs the real plugin
@@ -330,7 +346,7 @@ function phoneOtpIdentifier(phone) {
330
346
  }
331
347
  async function pinReviewCode(ctx, phone, code, expiresIn) {
332
348
  const adapter = ctx?.context?.internalAdapter;
333
- if (!adapter) throw new Error("[@reopt-ai/brandapp-sdk] reviewAccounts needs the Better Auth endpoint context in sendOTP.");
349
+ if (!adapter) throw new Error("[@reopt-ai/brandapp-sdk] An app-review number needs the Better Auth endpoint context in sendOTP.");
334
350
  const identifier = phoneOtpIdentifier(phone);
335
351
  await adapter.deleteVerificationByIdentifier(identifier);
336
352
  await adapter.createVerificationValue({
@@ -348,8 +364,13 @@ function assertRange(name, value, min, max) {
348
364
  * Solapi account (or, for reopt's own system brands and test workspaces, through reopt's own
349
365
  * number). If the workspace has no SMS connection the send fails with `SMS_NOT_CONNECTED`.
350
366
  *
351
- * - Korean mobile numbers only; every `/phone-number/*` request is canonicalized to `01012345678`
352
- * before the plugin sees it (so formats never split one person into two accounts).
367
+ * - Every `/phone-number/*` request is canonicalized to E.164 (`+821012345678`) before the plugin
368
+ * sees it (so formats never split one person into two accounts). reopt decides which countries it
369
+ * sends to (the brandapp's phone-login setting — today Korea only).
370
+ * - **App-review numbers** (Apple/Google reviewers cannot receive texts) are registered in the reopt
371
+ * console, not in your code. For those numbers reopt sends no SMS and returns the fixed code; the
372
+ * plugin stores it as the number's OTP, so verification, attempt limits, expiry and sign-up run
373
+ * exactly as for any other number. Changing or removing a number needs no redeploy.
353
374
  * - The end user's IP (per your Better Auth `advanced.ipAddress` settings) is forwarded so reopt can
354
375
  * rate-limit per user. Keep Better Auth's own rate limiter on with shared storage as well.
355
376
  * - Requires better-auth >= 1.7.16.
@@ -361,9 +382,8 @@ function createReoptPhoneNumber(config, options = {}) {
361
382
  const expiresIn = options.expiresIn ?? 300;
362
383
  assertRange("otpLength", otpLength, 4, 8);
363
384
  assertRange("expiresIn", expiresIn, 60, 1800);
364
- const review = resolveReviewAccounts(options.reviewAccounts, otpLength);
365
385
  const sendOtpSms = createReoptOtpSmsSender(config);
366
- const getTempName = options.getTempName ?? ((phone) => formatKoreanMobile(canonicalizeReoptPhoneNumber(phone) ?? phone));
386
+ const getTempName = options.getTempName ?? ((phone) => formatReoptPhoneNumber(phone));
367
387
  const base = phoneNumber({
368
388
  otpLength,
369
389
  expiresIn,
@@ -371,21 +391,26 @@ function createReoptPhoneNumber(config, options = {}) {
371
391
  requireVerification: options.requireVerification ?? true,
372
392
  phoneNumberValidator: (phone) => isValidReoptPhoneNumber(phone),
373
393
  sendOTP: async ({ phoneNumber: phone, code }, ctx) => {
374
- if (review?.numbers.has(phone)) {
375
- await pinReviewCode(ctx, phone, review.code, expiresIn);
376
- return;
377
- }
378
394
  const clientIp = ctx?.request || ctx?.headers ? getIP(ctx.request ?? ctx.headers, ctx.context.options) : null;
395
+ let result;
379
396
  try {
380
- await sendOtpSms({
397
+ result = await sendOtpSms({
381
398
  phoneNumber: phone,
382
399
  code,
383
400
  expiresInSeconds: expiresIn,
384
- clientIp
401
+ clientIp,
402
+ acceptsReviewCode: true
385
403
  });
386
404
  } catch (error) {
387
405
  throw toAuthError(error);
388
406
  }
407
+ if (result.via === "review") {
408
+ if (result.code.length !== otpLength) throw new APIError("SERVICE_UNAVAILABLE", {
409
+ code: "REVIEW_CODE_LENGTH_MISMATCH",
410
+ message: `The review code registered in the reopt console must be ${otpLength} digits (otpLength).`
411
+ });
412
+ await pinReviewCode(ctx, phone, result.code, expiresIn);
413
+ }
389
414
  },
390
415
  ...options.signUpOnVerification === false ? {} : { signUpOnVerification: {
391
416
  getTempEmail: (phone) => buildReoptPhoneLoginTempEmail(phone),
@@ -401,7 +426,7 @@ function createReoptPhoneNumber(config, options = {}) {
401
426
  const canonical = canonicalizeReoptPhoneNumber(body.phoneNumber);
402
427
  if (!canonical) throw new APIError("BAD_REQUEST", {
403
428
  code: "INVALID_PHONE_NUMBER",
404
- message: "Enter a Korean mobile number."
429
+ message: "Enter a mobile number — Korean (010-…) or international (+country code)."
405
430
  });
406
431
  return { context: { body: {
407
432
  ...body,
@@ -461,5 +486,5 @@ function createReoptBetterAuth(options) {
461
486
  }
462
487
 
463
488
  //#endregion
464
- 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 };
489
+ 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, formatReoptPhoneNumber, isReoptSDKError, isValidReoptPhoneNumber };
465
490
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- import { n as SDK_VERSION } from "./config-D21ZcDET.js";
1
+ import { n as SDK_VERSION } from "./config-Cxv010M9.js";
2
2
  import { o as readClientKeyRing } from "./keys-B_R_lsyF.js";
3
- import { r as createMachineClient } from "./client-BvLrx0Ai.js";
3
+ import { r as createMachineClient } from "./client-CDeaH7JC.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-Bzk7eqy5.js.map
745
+ //# sourceMappingURL=client-B2nwOzdZ.js.map
@@ -1,5 +1,5 @@
1
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
2
- import { t as buildQuery } from "./query-C_qce1vC.js";
1
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.js";
2
+ import { t as buildQuery } from "./query-Ch_JZ5Bd.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-BtFoViKj.js.map
55
+ //# sourceMappingURL=client-BBfRO86C.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, u as BadRequestError } from "./config-D21ZcDET.js";
2
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
3
- import { t as buildQuery } from "./query-C_qce1vC.js";
1
+ import { S as ReoptSDKError, u as BadRequestError } from "./config-Cxv010M9.js";
2
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.js";
3
+ import { t as buildQuery } from "./query-Ch_JZ5Bd.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-Ccw-FJlt.js.map
606
+ //# sourceMappingURL=client-BF94tdhy.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
1
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.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-BL7vOv_M.js.map
146
+ //# sourceMappingURL=client-BvgSoqAc.js.map
@@ -1,4 +1,4 @@
1
- import { a as resolveIdBaseUrl } from "./config-D21ZcDET.js";
1
+ import { a as resolveIdBaseUrl } from "./config-Cxv010M9.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-BvLrx0Ai.js.map
194
+ //# sourceMappingURL=client-CDeaH7JC.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
1
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.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-CB1A7gg4.js.map
53
+ //# sourceMappingURL=client-Ca_5meV_.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
1
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.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-BHoS1dGr.js.map
86
+ //# sourceMappingURL=client-CoaQxuaG.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-D21ZcDET.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-Cxv010M9.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
3
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.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.12"}-${url.length}`;
265
+ const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.7.0-rc.13"}-${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-tFChmi6z.js.map
346
+ //# sourceMappingURL=client-D38XGQRR.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-D21ZcDET.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-Cxv010M9.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
3
+ import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-COcHWJzo.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-l7dQ_fLm.js.map
279
+ //# sourceMappingURL=client-Do7Eny_J.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
1
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.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-BUfDFULW.js.map
20
+ //# sourceMappingURL=client-DoK8YCd_.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
1
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.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-BvUK6AxL.js.map
83
+ //# sourceMappingURL=client-RnJg4AGr.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
1
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.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-BHX14FpH.js.map
28
+ //# sourceMappingURL=client-v7ed6KdC.js.map
package/dist/cms/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createReoptCmsClient } from "../client-BtFoViKj.js";
1
+ import { t as createReoptCmsClient } from "../client-BBfRO86C.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.12";
373
+ const SDK_VERSION = "4.7.0-rc.13";
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-D21ZcDET.js.map
555
+ //# sourceMappingURL=config-Cxv010M9.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-D21ZcDET.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-Ccw-FJlt.js";
1
+ import { c as AuthUserNotFoundError, g as LimitExceededError, l as AuthUserRecordExistsError, m as DuplicateAuthUserError } from "../config-Cxv010M9.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-BF94tdhy.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-BHoS1dGr.js";
1
+ import { n as createReoptFeedbackClient, t as ReoptFeedbackClient } from "../client-CoaQxuaG.js";
2
2
 
3
3
  export { ReoptFeedbackClient, createReoptFeedbackClient };
@@ -1,4 +1,4 @@
1
- import { n as createReoptFileClient, t as ReoptFileClient } from "../client-l7dQ_fLm.js";
1
+ import { n as createReoptFileClient, t as ReoptFileClient } from "../client-Do7Eny_J.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-D21ZcDET.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-Cxv010M9.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-CVwg2EAl.js.map
415
+ //# sourceMappingURL=http-client-COcHWJzo.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-D21ZcDET.js";
2
- import { t as BaseHttpClient } from "./http-client-CVwg2EAl.js";
3
- import { n as createReoptAiClient } from "./client-tFChmi6z.js";
4
- import { n as createReoptAuthClient } from "./client-CB1A7gg4.js";
5
- import { t as createReoptCmsClient } from "./client-BtFoViKj.js";
6
- import { t as createReoptEavClient } from "./client-Ccw-FJlt.js";
7
- import { n as createReoptFeedbackClient } from "./client-BHoS1dGr.js";
8
- import { n as createReoptFileClient } from "./client-l7dQ_fLm.js";
9
- import { n as createReoptAnalyticsClient } from "./client-BUfDFULW.js";
10
- import { n as createReoptPlansClient } from "./client-BL7vOv_M.js";
11
- import { n as createReoptPushClient } from "./client-BHX14FpH.js";
12
- import { n as createReoptTermsClient } from "./client-BvUK6AxL.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-Cxv010M9.js";
2
+ import { t as BaseHttpClient } from "./http-client-COcHWJzo.js";
3
+ import { n as createReoptAiClient } from "./client-D38XGQRR.js";
4
+ import { n as createReoptAuthClient } from "./client-Ca_5meV_.js";
5
+ import { t as createReoptCmsClient } from "./client-BBfRO86C.js";
6
+ import { t as createReoptEavClient } from "./client-BF94tdhy.js";
7
+ import { n as createReoptFeedbackClient } from "./client-CoaQxuaG.js";
8
+ import { n as createReoptFileClient } from "./client-Do7Eny_J.js";
9
+ import { n as createReoptAnalyticsClient } from "./client-DoK8YCd_.js";
10
+ import { n as createReoptPlansClient } from "./client-BvgSoqAc.js";
11
+ import { n as createReoptPushClient } from "./client-v7ed6KdC.js";
12
+ import { n as createReoptTermsClient } from "./client-RnJg4AGr.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-D21ZcDET.js";
1
+ import { n as SDK_VERSION } from "../config-Cxv010M9.js";
2
2
  import { o as readClientKeyRing } from "../keys-B_R_lsyF.js";
3
- import { r as createMachineClient } from "../client-BvLrx0Ai.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-Bzk7eqy5.js";
3
+ import { r as createMachineClient } from "../client-CDeaH7JC.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-B2nwOzdZ.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-D21ZcDET.js";
1
+ import { S as ReoptSDKError, a as resolveIdBaseUrl } from "../config-Cxv010M9.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-BvLrx0Ai.js";
2
+ import { n as createDpopProof, r as createMachineClient, t as MachineTokenError } from "../client-CDeaH7JC.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-BL7vOv_M.js";
1
+ import { n as createReoptPlansClient, t as ReoptPlansClient } from "../client-BvgSoqAc.js";
2
2
 
3
3
  export { ReoptPlansClient, createReoptPlansClient };
@@ -1,3 +1,3 @@
1
- import { n as createReoptPushClient, t as ReoptPushClient } from "../client-BHX14FpH.js";
1
+ import { n as createReoptPushClient, t as ReoptPushClient } from "../client-v7ed6KdC.js";
2
2
 
3
3
  export { ReoptPushClient, createReoptPushClient };
@@ -1,4 +1,4 @@
1
- import { S as ReoptSDKError } from "./config-D21ZcDET.js";
1
+ import { S as ReoptSDKError } from "./config-Cxv010M9.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-C_qce1vC.js.map
35
+ //# sourceMappingURL=query-Ch_JZ5Bd.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-Bzk7eqy5.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-B2nwOzdZ.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-BvUK6AxL.js";
1
+ import { n as createReoptTermsClient, t as ReoptTermsClient } from "../client-RnJg4AGr.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-Bzk7eqy5.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-B2nwOzdZ.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.12",
3
+ "version": "4.7.0-rc.13",
4
4
  "description": "Reopt Brandapp SDK — Better Auth adapter, OAuth login, and EAV client",
5
5
  "author": "Reopt",
6
6
  "license": "MIT",