@reopt-ai/brandapp-sdk 4.7.0-rc.4 → 4.7.0-rc.6

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 (45) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/ai/index.js +1 -1
  3. package/dist/ai-provider/index.js +1 -1
  4. package/dist/analytics/index.js +1 -1
  5. package/dist/auth/index.js +1 -1
  6. package/dist/better-auth/index.d.ts +1 -1
  7. package/dist/better-auth/index.js +2 -2
  8. package/dist/{client-DrxN768l.js → client-4x4xlk9N.js} +3 -3
  9. package/dist/{client-BojYI4jP.js → client-BrR3dzC_.js} +4 -4
  10. package/dist/{client-CQmuEZik.js → client-C1yI9DiK.js} +2 -2
  11. package/dist/{client-Cj92U3fu.js → client-C7k9bCwh.js} +2 -2
  12. package/dist/{client-ZmjLpkjt.js → client-CLsqp1Jn.js} +46 -2
  13. package/dist/{client-ywlujscY.js → client-COlwskCB.js} +2 -2
  14. package/dist/{client-BPLSaCrs.js → client-DEMD0Wo5.js} +4 -4
  15. package/dist/{client-DAyfkqrY.js → client-DMvufVds.js} +3 -3
  16. package/dist/{client-GSy6AKsZ.js → client-DVIuxsN7.js} +2 -2
  17. package/dist/{client-BIO9amcp.js → client-DZZEzs2l.js} +2 -2
  18. package/dist/{client-BO7-GuXP.d.ts → client-Dsz0BzpO.d.ts} +44 -4
  19. package/dist/{client-DTFxSfCG.js → client-UI1-_F9P.js} +3 -3
  20. package/dist/{client-CD8WQsmF.js → client-t7ASsw2Q.js} +2 -2
  21. package/dist/cms/index.js +1 -1
  22. package/dist/{config-DKINyq4g.js → config-Cb96ydFD.js} +8 -5
  23. package/dist/eav/index.d.ts +1 -1
  24. package/dist/eav/index.js +2 -2
  25. package/dist/{errors-U3TsyWVq.d.ts → errors-D-Va8oeC.d.ts} +5 -2
  26. package/dist/feedback/index.js +1 -1
  27. package/dist/files/index.js +1 -1
  28. package/dist/{http-client-aggnrSsb.js → http-client-DIewtTz2.js} +2 -2
  29. package/dist/{index-CiZ5VkDS.d.ts → index-VolJHcFS.d.ts} +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +12 -12
  32. package/dist/installation/index.js +3 -3
  33. package/dist/logout/index.js +1 -1
  34. package/dist/machine/index.js +1 -1
  35. package/dist/plans/index.d.ts +1 -1
  36. package/dist/plans/index.js +1 -1
  37. package/dist/push/index.js +1 -1
  38. package/dist/{query-BFqEr2OW.js → query-jbkDQ1o2.js} +2 -2
  39. package/dist/react/hooks.d.ts +2 -2
  40. package/dist/terms/index.js +1 -1
  41. package/dist/testing/index.d.ts +1 -1
  42. package/dist/workspace/index.js +1 -1
  43. package/docs/api-reference.md +19 -0
  44. package/docs/errors.md +23 -0
  45. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,41 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.7.0-rc.6] — 2026-10-15
11
+
12
+ Pre-release (`npm i @reopt-ai/brandapp-sdk@next`) — 해지 예약 구독 재개(`plans.resume`)와 해지 기간 중 새 결제 차단.
13
+
14
+ ### Added
15
+
16
+ - `plans.resume(accessToken)` — 결제한 기간이 남은 해지 예약 구독을 되살린다(`POST /me/subscription/resume`, Lemon
17
+ Squeezy). 같은 구독이 갱신일 그대로 이어지고 바뀐 플랜(`getMyPlan`과 같은 모양)을 돌려준다. 거절은
18
+ `NO_RESUMABLE_SUBSCRIPTION`(409), 결제사 실패는 `PROVIDER_ERROR`(502, 재시도).
19
+
20
+ ### Changed
21
+
22
+ - `plans.createCheckout` — 해지 예약 구독이 결제한 기간을 남기고 있으면 `SUBSCRIPTION_CANCEL_PENDING`(409)으로
23
+ 거절한다. 새 구독을 열면 옛 구독과 겹친 기간을 두 번 내기 때문이다 — `resume` 뒤 다른 플랜이면 `changePlan`.
24
+
25
+ ## [4.7.0-rc.5] — 2026-10-14
26
+
27
+ Pre-release (`npm i @reopt-ai/brandapp-sdk@next`) — 구독 중 플랜 변경(`plans.changePlan`)과 Lemon Squeezy 해지 계약, 5xx 오류 코드 보존.
28
+
29
+ ### Added
30
+
31
+ - `plans.changePlan(planId, accessToken)` — 구독 중인 플랜을 바꾼다(`POST /me/subscription/change`).
32
+ 새 체크아웃 없이 결제사 구독의 가격을 그 자리에서 바꾸므로 구독은 하나이고 갱신일이 이어진다.
33
+ 즉시 적용되고 바뀐 플랜(`getMyPlan`과 같은 모양)을 돌려준다. 올리면 차액을 지금 청구하고 내리면
34
+ 다음 청구서에서 차감한다. Lemon Squeezy 구독만 지원한다.
35
+
36
+ ### Changed
37
+
38
+ - 5xx 오류가 서버가 준 코드와 실제 상태를 담는다 — 상류(결제사) 실패는 `ServerError`이면서 `code`가
39
+ `PROVIDER_ERROR`·`PROVIDER_CANCEL_FAILED`, `status`가 502다. 코드 없는 5xx는 예전처럼 `SERVER_ERROR`이고
40
+ `status`는 실제 응답 상태다(전에는 항상 500).
41
+ - `plans.cancel` — Lemon Squeezy 구독은 결제사 해지가 먼저다. 결제사 해지가 실패하면 아무것도 바뀌지
42
+ 않고 `PROVIDER_CANCEL_FAILED`(HTTP 502)로 실패한다 — 다시 시도하면 된다. 성공하면 `accessUntil`이
43
+ 결제사의 결제 기간 끝이다.
44
+
10
45
  ## [4.7.0-rc.4] — 2026-10-14
11
46
 
12
47
  Pre-release (`npm i @reopt-ai/brandapp-sdk@next`) — EAV `listAll()` 커서 훑기와 설치 back-channel 재생 거절 보강.
package/dist/ai/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as createReoptAiClient, t as ReoptAiClient } from "../client-BojYI4jP.js";
1
+ import { n as createReoptAiClient, t as ReoptAiClient } from "../client-BrR3dzC_.js";
2
2
 
3
3
  export { ReoptAiClient, createReoptAiClient };
@@ -1,4 +1,4 @@
1
- import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-DKINyq4g.js";
1
+ import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-Cb96ydFD.js";
2
2
  import { t as createManagedAbort } from "../abort--nOBFN4M.js";
3
3
  import { t as createAuthHeader } from "../encoding-Bwfm3iaE.js";
4
4
  import { t as createSSELineProcessor } from "../sse-parser-FMjxM7sY.js";
@@ -1,4 +1,4 @@
1
- import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-ywlujscY.js";
1
+ import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-COlwskCB.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-BIO9amcp.js";
1
+ import { n as createReoptAuthClient, t as ReoptAuthClient } from "../client-DZZEzs2l.js";
2
2
 
3
3
  //#region src/auth/session.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import { n as ReoptSDKConfig, t as REOPT_BASE_URLS } from "../config-BGT9h1OW.js";
2
2
  import { a as REOPT_PROVIDER_IDS, i as REOPT_PROVIDER_ID, n as AdapterRequestBody, o as REOPT_STEP_UP_PROVIDER_ID, r as REOPT_DEFAULT_SCOPES, s as STEP_UP_MAX_AUTH_AGE_SECONDS, t as AdapterOperation } from "../types-FazBnzhg.js";
3
3
  import { i as ClientPrivateJwk } from "../keys-B2pA8EkU.js";
4
- import { T as isReoptSDKError, _ as RateLimitError, t as AuthError, v as ReoptSDKError, x as ServerError } from "../errors-U3TsyWVq.js";
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
6
  import { BetterAuthOptions, BetterAuthPlugin } from "better-auth";
7
7
  //#region src/better-auth/adapter.d.ts
@@ -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-DKINyq4g.js";
2
- import { t as BaseHttpClient } from "../http-client-aggnrSsb.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-Cb96ydFD.js";
2
+ import { t as BaseHttpClient } from "../http-client-DIewtTz2.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";
@@ -1,5 +1,5 @@
1
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
2
- import { t as buildQuery } from "./query-BFqEr2OW.js";
1
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.js";
2
+ import { t as buildQuery } from "./query-jbkDQ1o2.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-DrxN768l.js.map
55
+ //# sourceMappingURL=client-4x4xlk9N.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-DKINyq4g.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-Cb96ydFD.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
3
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.js";
4
4
  import { n as parseSSEStream } from "./sse-parser-FMjxM7sY.js";
5
5
 
6
6
  //#region src/ai/client.ts
@@ -231,7 +231,7 @@ var ReoptAiClient = class {
231
231
  }
232
232
  async fetchSSE(options) {
233
233
  const url = `${this.http.requestBaseUrl}/chat/completions`;
234
- const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.7.0-rc.4"}-${url.length}`;
234
+ const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.7.0-rc.6"}-${url.length}`;
235
235
  const ctx = {
236
236
  method: "POST",
237
237
  url,
@@ -309,4 +309,4 @@ function createReoptAiClient(config) {
309
309
 
310
310
  //#endregion
311
311
  export { createReoptAiClient as n, ReoptAiClient as t };
312
- //# sourceMappingURL=client-BojYI4jP.js.map
312
+ //# sourceMappingURL=client-BrR3dzC_.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
1
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.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-CQmuEZik.js.map
83
+ //# sourceMappingURL=client-C1yI9DiK.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
1
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.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-Cj92U3fu.js.map
28
+ //# sourceMappingURL=client-C7k9bCwh.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
1
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.js";
2
2
 
3
3
  //#region src/plans/client.ts
4
4
  function unwrap(body) {
@@ -88,10 +88,54 @@ var ReoptPlansClient = class {
88
88
  * always stopped; the provider-side cancellation is best-effort and reported
89
89
  * through `providerCanceled`. Apple/Google subscriptions are canceled in the
90
90
  * store, so no remote call is made for those.
91
+ *
92
+ * Lemon Squeezy charges renewals on its own, so for those the provider is
93
+ * canceled first: if that fails nothing changes (the subscription stays
94
+ * active) and the call fails with `PROVIDER_CANCEL_FAILED` (HTTP 502) — retry
95
+ * it. On success `accessUntil` is the provider's end of the paid period.
91
96
  */
92
97
  async cancel(accessToken) {
93
98
  return unwrap(await this.http.fetch("POST", "/me/subscription/cancel", {}, { bearerToken: accessToken }));
94
99
  }
100
+ /**
101
+ * Switch the current customer's subscription to another plan — no new
102
+ * checkout: the provider subscription changes price in place, so it stays one
103
+ * subscription and keeps its renewal date. Lemon Squeezy subscriptions only
104
+ * (since 4.7); others fail with `PLAN_CHANGE_UNSUPPORTED` (cancel, then check
105
+ * out the new plan).
106
+ *
107
+ * Takes effect immediately and resolves to the changed plan (same shape as
108
+ * {@link getMyPlan}). Moving to a pricier plan charges the prorated
109
+ * difference now; moving to a cheaper one credits it on the next invoice.
110
+ *
111
+ * Errors (`ReoptSDKError.code`): `NO_ACTIVE_SUBSCRIPTION`, `SAME_PLAN`,
112
+ * `PLAN_NOT_FOUND` (404), `PLAN_INACTIVE`, `PLAN_PRICE_NOT_LINKED`,
113
+ * `TERMS_REQUIRED`, `SUBSCRIPTION_NOT_ACTIVE` (cancel scheduled or past due),
114
+ * `PROVIDER_PORTAL_REQUIRED` (PayPal subscriptions are changed in the
115
+ * provider's customer portal), `PROVIDER_ERROR` (HTTP 502 — nothing changed,
116
+ * retry).
117
+ */
118
+ async changePlan(planId, accessToken) {
119
+ return unwrap(await this.http.fetch("POST", "/me/subscription/change", { planId }, { bearerToken: accessToken }));
120
+ }
121
+ /**
122
+ * Resume the current customer's canceled subscription while its paid period
123
+ * is still running (Lemon Squeezy, since 4.7) — the same provider
124
+ * subscription continues with its renewal date. Resolves to the resumed plan
125
+ * (same shape as {@link getMyPlan}).
126
+ *
127
+ * During that period {@link createCheckout} refuses with
128
+ * `SUBSCRIPTION_CANCEL_PENDING` (409): a new checkout would start a second
129
+ * subscription and bill the overlap twice. Resume instead, then
130
+ * {@link changePlan} if the customer wants another plan.
131
+ *
132
+ * Errors (`ReoptSDKError.code`): `NO_RESUMABLE_SUBSCRIPTION` (409 — nothing
133
+ * canceled, or the paid period is over), `PROVIDER_ERROR` (HTTP 502 —
134
+ * nothing changed, retry).
135
+ */
136
+ async resume(accessToken) {
137
+ return unwrap(await this.http.fetch("POST", "/me/subscription/resume", {}, { bearerToken: accessToken }));
138
+ }
95
139
  };
96
140
  function createReoptPlansClient(config) {
97
141
  return new ReoptPlansClient(config);
@@ -99,4 +143,4 @@ function createReoptPlansClient(config) {
99
143
 
100
144
  //#endregion
101
145
  export { createReoptPlansClient as n, ReoptPlansClient as t };
102
- //# sourceMappingURL=client-ZmjLpkjt.js.map
146
+ //# sourceMappingURL=client-CLsqp1Jn.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
1
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.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-ywlujscY.js.map
20
+ //# sourceMappingURL=client-COlwskCB.js.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, u as BadRequestError } from "./config-DKINyq4g.js";
2
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
3
- import { t as buildQuery } from "./query-BFqEr2OW.js";
1
+ import { S as ReoptSDKError, u as BadRequestError } from "./config-Cb96ydFD.js";
2
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.js";
3
+ import { t as buildQuery } from "./query-jbkDQ1o2.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-BPLSaCrs.js.map
606
+ //# sourceMappingURL=client-DEMD0Wo5.js.map
@@ -1,6 +1,6 @@
1
- import { n as SDK_VERSION } from "./config-DKINyq4g.js";
1
+ import { n as SDK_VERSION } from "./config-Cb96ydFD.js";
2
2
  import { o as readClientKeyRing } from "./keys-B_R_lsyF.js";
3
- import { r as createMachineClient } from "./client-CD8WQsmF.js";
3
+ import { r as createMachineClient } from "./client-t7ASsw2Q.js";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/workspace/schemas.ts
@@ -733,4 +733,4 @@ function createPlatformClient(config) {
733
733
 
734
734
  //#endregion
735
735
  export { platformWorkTaskStageChangedEventSchema as $, platformErrorSchema as A, platformPipelineSchema as B, platformBrandappUpsertInputSchema as C, platformEavSchemaApplyInputSchema as D, platformEavEntityResourceSchema as E, platformOAuthClientImportInputSchema as F, platformResourcesV2Schema as G, platformPipelineUpsertInputSchema as H, platformOAuthClientResourceSchema as I, platformTaskStageSchema as J, platformTaskSchema as K, platformOAuthClientUpsertInputSchema as L, platformLockAcquiredSchema as M, platformLockReleasedSchema as N, platformEavSchemaApplyResultSchema as O, platformMeSchema as P, platformWebhookUpsertInputSchema as Q, platformPipelineImportInputSchema as R, platformBrandappResourceSchema as S, platformEavBrandappResourcesSchema as T, platformResourceKeySchema as U, platformPipelineStageInputSchema as V, platformResourcesSchema as W, platformWebhookResourceSchema as X, platformTaskUpsertInputSchema as Y, platformWebhookSchema as Z, PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS as _, createPlatformClient as a, platformBrandResourceSchema as b, PLATFORM_BRANDAPP_STATUSES as c, PLATFORM_OAUTH_APPLICATION_TYPES as d, platformWriteMetaSchema as et, PLATFORM_OAUTH_CLIENT_PURPOSES as f, PLATFORM_TASK_PRIORITIES as g, PLATFORM_TASK_OUTCOMES as h, REOPT_PLATFORM_URLS as i, platformExternalIdSchema as j, platformEavSchemaOperationSchema as k, PLATFORM_DOMAIN_STATUSES as l, PLATFORM_STAGE_COLORS as m, PlatformApiError as n, resolvePlatformUrls as o, PLATFORM_OAUTH_GRANT_TYPES as p, platformTaskStageInputSchema as q, REOPT_PLATFORM_ID_URLS as r, PLATFORM_ADMIN_SCOPE as s, DEFAULT_PLATFORM_SCOPES as t, PLATFORM_MANAGED_BY_VALUES as u, PLATFORM_WEBHOOK_TRIGGERS as v, platformCustomerUpsertInputSchema as w, platformBrandUpsertInputSchema as x, platformBrandImportInputSchema as y, platformPipelineResourceSchema as z };
736
- //# sourceMappingURL=client-DAyfkqrY.js.map
736
+ //# sourceMappingURL=client-DMvufVds.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
1
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.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-GSy6AKsZ.js.map
86
+ //# sourceMappingURL=client-DVIuxsN7.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
1
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.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-BIO9amcp.js.map
53
+ //# sourceMappingURL=client-DZZEzs2l.js.map
@@ -96,7 +96,7 @@ type CheckoutSession = {
96
96
  * `getCheckout` 응답에서는 `null`이다(capability token 재노출 방지).
97
97
  */
98
98
  checkoutUrl: string | null;
99
- /** 결제 제공자 — 현재 "sandbox"(가상 결제). */
99
+ /** 결제 제공자 — "sandbox"(가상 결제) 또는 "lemonsqueezy"(실 결제, id 주문 확인 화면을 거친다). */
100
100
  provider: string;
101
101
  status: CheckoutStatus | string;
102
102
  planId: string;
@@ -114,7 +114,7 @@ type CheckoutSession = {
114
114
  type CancelSubscriptionResult = {
115
115
  status: "canceled";
116
116
  /**
117
- * 해지된 구독의 결제 수단 (`sandbox` | `paddle` | `toss` | `apple` | `google` …).
117
+ * 해지된 구독의 결제 수단 (`sandbox` | `lemonsqueezy` | `toss` | `apple` | `google` | 옛 `paddle` …).
118
118
  * 안내 문구를 결제 수단별로 가를 때 쓴다. 구버전 서버는 내려주지 않는다.
119
119
  */
120
120
  provider?: string;
@@ -151,7 +151,7 @@ type CurrentPlan = {
151
151
  /** ISO-8601 문자열. `null`이면 무기한. */
152
152
  planExpiresAt: string | null;
153
153
  /**
154
- * **활성** 결제 연결의 제공자 — "paddle" | "toss" | null.
154
+ * **활성** 결제 연결의 제공자 — "lemonsqueezy" | "toss" | (옛) "paddle" | null.
155
155
  *
156
156
  * ⚠️ "실 결제인가"의 근거로 쓰지 말 것. 해지하면 연결이 보관되어 남은 이용 기간 동안
157
157
  * `null`이 되고, 가상 결제·스토어 구독·운영자 배정도 모두 `null`이다. 그 판정에는
@@ -242,10 +242,50 @@ declare class ReoptPlansClient {
242
242
  * always stopped; the provider-side cancellation is best-effort and reported
243
243
  * through `providerCanceled`. Apple/Google subscriptions are canceled in the
244
244
  * store, so no remote call is made for those.
245
+ *
246
+ * Lemon Squeezy charges renewals on its own, so for those the provider is
247
+ * canceled first: if that fails nothing changes (the subscription stays
248
+ * active) and the call fails with `PROVIDER_CANCEL_FAILED` (HTTP 502) — retry
249
+ * it. On success `accessUntil` is the provider's end of the paid period.
245
250
  */
246
251
  cancel(accessToken: string): Promise<CancelSubscriptionResult>;
252
+ /**
253
+ * Switch the current customer's subscription to another plan — no new
254
+ * checkout: the provider subscription changes price in place, so it stays one
255
+ * subscription and keeps its renewal date. Lemon Squeezy subscriptions only
256
+ * (since 4.7); others fail with `PLAN_CHANGE_UNSUPPORTED` (cancel, then check
257
+ * out the new plan).
258
+ *
259
+ * Takes effect immediately and resolves to the changed plan (same shape as
260
+ * {@link getMyPlan}). Moving to a pricier plan charges the prorated
261
+ * difference now; moving to a cheaper one credits it on the next invoice.
262
+ *
263
+ * Errors (`ReoptSDKError.code`): `NO_ACTIVE_SUBSCRIPTION`, `SAME_PLAN`,
264
+ * `PLAN_NOT_FOUND` (404), `PLAN_INACTIVE`, `PLAN_PRICE_NOT_LINKED`,
265
+ * `TERMS_REQUIRED`, `SUBSCRIPTION_NOT_ACTIVE` (cancel scheduled or past due),
266
+ * `PROVIDER_PORTAL_REQUIRED` (PayPal subscriptions are changed in the
267
+ * provider's customer portal), `PROVIDER_ERROR` (HTTP 502 — nothing changed,
268
+ * retry).
269
+ */
270
+ changePlan(planId: string, accessToken: string): Promise<CurrentPlan>;
271
+ /**
272
+ * Resume the current customer's canceled subscription while its paid period
273
+ * is still running (Lemon Squeezy, since 4.7) — the same provider
274
+ * subscription continues with its renewal date. Resolves to the resumed plan
275
+ * (same shape as {@link getMyPlan}).
276
+ *
277
+ * During that period {@link createCheckout} refuses with
278
+ * `SUBSCRIPTION_CANCEL_PENDING` (409): a new checkout would start a second
279
+ * subscription and bill the overlap twice. Resume instead, then
280
+ * {@link changePlan} if the customer wants another plan.
281
+ *
282
+ * Errors (`ReoptSDKError.code`): `NO_RESUMABLE_SUBSCRIPTION` (409 — nothing
283
+ * canceled, or the paid period is over), `PROVIDER_ERROR` (HTTP 502 —
284
+ * nothing changed, retry).
285
+ */
286
+ resume(accessToken: string): Promise<CurrentPlan>;
247
287
  }
248
288
  declare function createReoptPlansClient(config: ReoptSDKConfig): ReoptPlansClient;
249
289
  //#endregion
250
290
  export { CheckoutStatus as a, MeterPricingMode as c, PlanInterval as d, PlanMeter as f, PlanRequiredTerms as h, CheckoutSession as i, Plan as l, PlanPaymentEnvironment as m, createReoptPlansClient as n, CreateCheckoutInput as o, PlanMeterTier as p, CancelSubscriptionResult as r, CurrentPlan as s, ReoptPlansClient as t, PlanBillingModel as u };
251
- //# sourceMappingURL=client-BO7-GuXP.d.ts.map
291
+ //# sourceMappingURL=client-Dsz0BzpO.d.ts.map
@@ -1,6 +1,6 @@
1
- import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-DKINyq4g.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-Cb96ydFD.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-aggnrSsb.js";
3
+ import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-DIewtTz2.js";
4
4
 
5
5
  //#region src/files/client.ts
6
6
  var ReoptFileClient = class {
@@ -270,4 +270,4 @@ function createReoptFileClient(config) {
270
270
 
271
271
  //#endregion
272
272
  export { createReoptFileClient as n, ReoptFileClient as t };
273
- //# sourceMappingURL=client-DTFxSfCG.js.map
273
+ //# sourceMappingURL=client-UI1-_F9P.js.map
@@ -1,4 +1,4 @@
1
- import { a as resolveIdBaseUrl } from "./config-DKINyq4g.js";
1
+ import { a as resolveIdBaseUrl } from "./config-Cb96ydFD.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-CD8WQsmF.js.map
194
+ //# sourceMappingURL=client-t7ASsw2Q.js.map
package/dist/cms/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createReoptCmsClient } from "../client-DrxN768l.js";
1
+ import { t as createReoptCmsClient } from "../client-4x4xlk9N.js";
2
2
 
3
3
  //#region src/cms/helpers.ts
4
4
  function joinUrl(siteUrl, path) {
@@ -35,8 +35,8 @@ var RateLimitError = class extends ReoptSDKError {
35
35
  }
36
36
  };
37
37
  var ServerError = class extends ReoptSDKError {
38
- constructor(message = "Internal server error", context) {
39
- super(message, 500, "SERVER_ERROR", context, {
38
+ constructor(message = "Internal server error", context, reported) {
39
+ super(message, reported?.status ?? 500, reported?.code ?? "SERVER_ERROR", context, {
40
40
  cause: "서버 내부 오류",
41
41
  fix: "잠시 후 재시도. 반복되면 서버 상태 확인",
42
42
  doc: "docs/errors.md#server_error"
@@ -312,14 +312,17 @@ function mapHttpStatusToError(status, code, message, ctx, fieldErrors) {
312
312
  return new ReoptSDKError(message ?? `Request failed with status ${status}`, 422, code ?? "REQUEST_ERROR", ctx);
313
313
  case 429: return new RateLimitError(message ?? "Rate limit exceeded", void 0, ctx);
314
314
  default:
315
- if (status >= 500) return new ServerError(message ?? "Internal server error", ctx);
315
+ if (status >= 500) return new ServerError(message ?? "Internal server error", ctx, {
316
+ status,
317
+ code
318
+ });
316
319
  return new ReoptSDKError(message ?? `Unexpected status: ${status}`, status, code ?? "UNEXPECTED_ERROR", ctx);
317
320
  }
318
321
  }
319
322
 
320
323
  //#endregion
321
324
  //#region src/core/config.ts
322
- const SDK_VERSION = "4.7.0-rc.4";
325
+ const SDK_VERSION = "4.7.0-rc.6";
323
326
  /**
324
327
  * Default API host for EAV / AI / Files / CMS / Terms. Consumers can override
325
328
  * via `config.baseUrl` or the `REOPT_BASE_URL` env var.
@@ -501,4 +504,4 @@ function deriveIdFromBaseUrl(baseUrl) {
501
504
 
502
505
  //#endregion
503
506
  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 };
504
- //# sourceMappingURL=config-DKINyq4g.js.map
507
+ //# sourceMappingURL=config-Cb96ydFD.js.map
@@ -1,5 +1,5 @@
1
1
  import { A as ListRecordsQuery, C as EavAttribute, D as EavRecord, E as EavEntity, F as UpdateRecordInput, I as UpsertRecordInput, L as UpsertRecordResult, M as RECORDS_PAGE_LIMIT_MAX, N as UpdateAttributeInput, O as EavSchemaLinkedTo, P as UpdateEntityInput, S as DeleteWhereInput, T as EavDataType, _ as BulkUpdateItem, b as CreateEntityInput, d as ATTRIBUTE_FILTER_OPERATORS, f as AttributeFilter, j as PaginatedResponse, k as EavValidation, m as AttributeFilterOperator, n as ReoptSDKConfig, p as AttributeFilterListValue, u as ATTRIBUTE_FILTER_LIST_MAX, v as CountRecordsQuery, w as EavAttributeOption, x as CreateRecordInput, y as CreateAttributeInput } from "../config-BGT9h1OW.js";
2
- import { c as DuplicateAuthUserError, f as LimitExceededError, n as AuthUserNotFoundError, r as AuthUserRecordExistsError } from "../errors-U3TsyWVq.js";
2
+ import { c as DuplicateAuthUserError, f as LimitExceededError, n as AuthUserNotFoundError, r as AuthUserRecordExistsError } from "../errors-D-Va8oeC.js";
3
3
  import { i as TypedEavRecord, n as createReoptEavClient, r as EntityClient, t as ReoptEavClient } from "../client-CJRjPSf7.js";
4
4
  //#region src/eav/verify.d.ts
5
5
  /**
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-DKINyq4g.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-BPLSaCrs.js";
1
+ import { c as AuthUserNotFoundError, g as LimitExceededError, l as AuthUserRecordExistsError, m as DuplicateAuthUserError } from "../config-Cb96ydFD.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-DEMD0Wo5.js";
3
3
 
4
4
  //#region src/eav/verify.ts
5
5
  async function verifyEavSchema(input) {
@@ -35,7 +35,10 @@ declare class RateLimitError extends ReoptSDKError {
35
35
  constructor(message?: string, retryAfterMs?: number, context?: ReoptSDKErrorContext);
36
36
  }
37
37
  declare class ServerError extends ReoptSDKError {
38
- constructor(message?: string, context?: ReoptSDKErrorContext);
38
+ constructor(message?: string, context?: ReoptSDKErrorContext, reported?: {
39
+ status?: number;
40
+ code?: string;
41
+ });
39
42
  }
40
43
  /** AI 사용량 잔액 부족 (HTTP 402). */
41
44
  declare class CreditLimitError extends ReoptSDKError {
@@ -186,4 +189,4 @@ declare function isModelAccessError(error: unknown): error is ModelAccessError;
186
189
  declare function mapHttpStatusToError(status: number, code: string | undefined, message: string | undefined, ctx?: ReoptSDKErrorContext, fieldErrors?: FieldError[]): ReoptSDKError;
187
190
  //#endregion
188
191
  export { isCreditLimitError as C, isValidationError as D, isRequiredTermsError as E, mapHttpStatusToError as O, ValidationError as S, isReoptSDKError as T, RateLimitError as _, ConflictError as a, RequiredTermsError as b, DuplicateAuthUserError as c, ForbiddenError as d, LimitExceededError as f, PreconditionFailedError as g, NotFoundError as h, BadRequestError as i, ErrorDiagnostic as l, ModelNotFoundError as m, AuthUserNotFoundError as n, ContentFilterError as o, ModelAccessError as p, AuthUserRecordExistsError as r, CreditLimitError as s, AuthError as t, FieldError as u, ReoptSDKError as v, isModelAccessError as w, ServerError as x, ReoptSDKErrorContext as y };
189
- //# sourceMappingURL=errors-U3TsyWVq.d.ts.map
192
+ //# sourceMappingURL=errors-D-Va8oeC.d.ts.map
@@ -1,3 +1,3 @@
1
- import { n as createReoptFeedbackClient, t as ReoptFeedbackClient } from "../client-GSy6AKsZ.js";
1
+ import { n as createReoptFeedbackClient, t as ReoptFeedbackClient } from "../client-DVIuxsN7.js";
2
2
 
3
3
  export { ReoptFeedbackClient, createReoptFeedbackClient };
@@ -1,4 +1,4 @@
1
- import { n as createReoptFileClient, t as ReoptFileClient } from "../client-DTFxSfCG.js";
1
+ import { n as createReoptFileClient, t as ReoptFileClient } from "../client-UI1-_F9P.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-DKINyq4g.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-Cb96ydFD.js";
2
2
  import { t as createAuthHeader } from "./encoding-Bwfm3iaE.js";
3
3
 
4
4
  //#region src/core/debug.ts
@@ -389,4 +389,4 @@ function parseFieldErrors(body) {
389
389
 
390
390
  //#endregion
391
391
  export { parseFieldErrors as n, BaseHttpClient as t };
392
- //# sourceMappingURL=http-client-aggnrSsb.js.map
392
+ //# sourceMappingURL=http-client-DIewtTz2.js.map
@@ -6,7 +6,7 @@ import { t as ReoptCmsClient } from "./client-NUhpPkl2.js";
6
6
  import { t as ReoptEavClient } from "./client-CJRjPSf7.js";
7
7
  import { t as ReoptFeedbackClient } from "./client-DF-tOyrY.js";
8
8
  import { t as ReoptFileClient } from "./client-wNzcgEJu.js";
9
- import { t as ReoptPlansClient } from "./client-BO7-GuXP.js";
9
+ import { t as ReoptPlansClient } from "./client-Dsz0BzpO.js";
10
10
  import { t as ReoptPushClient } from "./client-BbmslwWV.js";
11
11
  import { t as ReoptTermsClient } from "./client-Dwf6UuGH.js";
12
12
  //#region src/core/http-client.d.ts
@@ -178,4 +178,4 @@ type ReoptSDK<S extends SchemaDef = SchemaDef> = {
178
178
  declare function createReoptSDK<S extends SchemaDef = SchemaDef>(config: ReoptSDKConfig<S>): ReoptSDK<S>;
179
179
  //#endregion
180
180
  export { initReoptSDK as a, getReoptSDK as i, createReoptSDK as n, resetSDK as o, createLazySDK as r, BaseHttpClient as s, ReoptSDK as t };
181
- //# sourceMappingURL=index-CiZ5VkDS.d.ts.map
181
+ //# sourceMappingURL=index-VolJHcFS.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as DebugLogger, i as DebugLevel, n as ReoptSDKConfig, r as resolveBaseUrl, t as REOPT_BASE_URLS } from "./config-BGT9h1OW.js";
2
2
  import { a as CompletionOptions, c as FinishReason, d as MessageRole, f as ModelInfo, i as ChatMessage, l as ImageGenerateOptions, m as StreamEvent, o as CompletionResult, p as StreamDoneData, r as AgentInfo, s as CreditInfo, u as ImageGenerateResult } from "./client-Bi-KSU_r.js";
3
- import { C as isCreditLimitError, D as isValidationError, E as isRequiredTermsError, O as mapHttpStatusToError, S as ValidationError, T as isReoptSDKError, _ as RateLimitError, a as ConflictError, b as RequiredTermsError, c as DuplicateAuthUserError, d as ForbiddenError, f as LimitExceededError, g as PreconditionFailedError, h as NotFoundError, i as BadRequestError, l as ErrorDiagnostic, m as ModelNotFoundError, n as AuthUserNotFoundError, o as ContentFilterError, p as ModelAccessError, r as AuthUserRecordExistsError, s as CreditLimitError, t as AuthError, u as FieldError, v as ReoptSDKError, w as isModelAccessError, x as ServerError, y as ReoptSDKErrorContext } from "./errors-U3TsyWVq.js";
3
+ import { C as isCreditLimitError, D as isValidationError, E as isRequiredTermsError, O as mapHttpStatusToError, S as ValidationError, T as isReoptSDKError, _ as RateLimitError, a as ConflictError, b as RequiredTermsError, c as DuplicateAuthUserError, d as ForbiddenError, f as LimitExceededError, g as PreconditionFailedError, h as NotFoundError, i as BadRequestError, l as ErrorDiagnostic, m as ModelNotFoundError, n as AuthUserNotFoundError, o as ContentFilterError, p as ModelAccessError, r as AuthUserRecordExistsError, s as CreditLimitError, t as AuthError, u as FieldError, v as ReoptSDKError, w as isModelAccessError, x as ServerError, y as ReoptSDKErrorContext } from "./errors-D-Va8oeC.js";
4
4
  import { i as TypedEavRecord, r as EntityClient } from "./client-CJRjPSf7.js";
5
- import { a as initReoptSDK, i as getReoptSDK, n as createReoptSDK, o as resetSDK, r as createLazySDK, s as BaseHttpClient, t as ReoptSDK } from "./index-CiZ5VkDS.js";
5
+ import { a as initReoptSDK, i as getReoptSDK, n as createReoptSDK, o as resetSDK, r as createLazySDK, s as BaseHttpClient, t as ReoptSDK } from "./index-VolJHcFS.js";
6
6
  export { type AgentInfo, AuthError, AuthUserNotFoundError, AuthUserRecordExistsError, BadRequestError, BaseHttpClient, type ChatMessage, type CompletionOptions, type CompletionResult, ConflictError, ContentFilterError, type CreditInfo, CreditLimitError, type DebugLevel, type DebugLogger, DuplicateAuthUserError, type EntityClient, type ErrorDiagnostic, type FieldError, type FinishReason, ForbiddenError, type ImageGenerateOptions, type ImageGenerateResult, LimitExceededError, type MessageRole, ModelAccessError, type ModelInfo, ModelNotFoundError, NotFoundError, PreconditionFailedError, REOPT_BASE_URLS, RateLimitError, ReoptSDK, type ReoptSDKConfig, ReoptSDKError, type ReoptSDKErrorContext, RequiredTermsError, ServerError, type StreamDoneData, type StreamEvent, type TypedEavRecord, ValidationError, createLazySDK, createReoptSDK, getReoptSDK, initReoptSDK, isCreditLimitError, isModelAccessError, isReoptSDKError, isRequiredTermsError, isValidationError, mapHttpStatusToError, resetSDK, resolveBaseUrl };
package/dist/index.js CHANGED
@@ -1,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-DKINyq4g.js";
2
- import { t as BaseHttpClient } from "./http-client-aggnrSsb.js";
3
- import { n as createReoptAiClient } from "./client-BojYI4jP.js";
4
- import { n as createReoptAuthClient } from "./client-BIO9amcp.js";
5
- import { t as createReoptCmsClient } from "./client-DrxN768l.js";
6
- import { t as createReoptEavClient } from "./client-BPLSaCrs.js";
7
- import { n as createReoptFeedbackClient } from "./client-GSy6AKsZ.js";
8
- import { n as createReoptFileClient } from "./client-DTFxSfCG.js";
9
- import { n as createReoptAnalyticsClient } from "./client-ywlujscY.js";
10
- import { n as createReoptPlansClient } from "./client-ZmjLpkjt.js";
11
- import { n as createReoptPushClient } from "./client-Cj92U3fu.js";
12
- import { n as createReoptTermsClient } from "./client-CQmuEZik.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-Cb96ydFD.js";
2
+ import { t as BaseHttpClient } from "./http-client-DIewtTz2.js";
3
+ import { n as createReoptAiClient } from "./client-BrR3dzC_.js";
4
+ import { n as createReoptAuthClient } from "./client-DZZEzs2l.js";
5
+ import { t as createReoptCmsClient } from "./client-4x4xlk9N.js";
6
+ import { t as createReoptEavClient } from "./client-DEMD0Wo5.js";
7
+ import { n as createReoptFeedbackClient } from "./client-DVIuxsN7.js";
8
+ import { n as createReoptFileClient } from "./client-UI1-_F9P.js";
9
+ import { n as createReoptAnalyticsClient } from "./client-COlwskCB.js";
10
+ import { n as createReoptPlansClient } from "./client-CLsqp1Jn.js";
11
+ import { n as createReoptPushClient } from "./client-C7k9bCwh.js";
12
+ import { n as createReoptTermsClient } from "./client-C1yI9DiK.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-DKINyq4g.js";
1
+ import { n as SDK_VERSION } from "../config-Cb96ydFD.js";
2
2
  import { o as readClientKeyRing } from "../keys-B_R_lsyF.js";
3
- import { r as createMachineClient } from "../client-CD8WQsmF.js";
4
- import { A as platformErrorSchema, C as platformBrandappUpsertInputSchema, H as platformPipelineUpsertInputSchema, U as platformResourceKeySchema, f as PLATFORM_OAUTH_CLIENT_PURPOSES, n as PlatformApiError, o as resolvePlatformUrls, v as PLATFORM_WEBHOOK_TRIGGERS, x as platformBrandUpsertInputSchema } from "../client-DAyfkqrY.js";
3
+ import { r as createMachineClient } from "../client-t7ASsw2Q.js";
4
+ import { A as platformErrorSchema, C as platformBrandappUpsertInputSchema, H as platformPipelineUpsertInputSchema, U as platformResourceKeySchema, f as PLATFORM_OAUTH_CLIENT_PURPOSES, n as PlatformApiError, o as resolvePlatformUrls, v as PLATFORM_WEBHOOK_TRIGGERS, x as platformBrandUpsertInputSchema } from "../client-DMvufVds.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-DKINyq4g.js";
1
+ import { S as ReoptSDKError, a as resolveIdBaseUrl } from "../config-Cb96ydFD.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-CD8WQsmF.js";
2
+ import { n as createDpopProof, r as createMachineClient, t as MachineTokenError } from "../client-t7ASsw2Q.js";
3
3
 
4
4
  export { CLIENT_JWKS_PATH, DEFAULT_CLIENT_KEY_ALGORITHM, MachineTokenError, buildClientJwks, createDpopProof, createMachineClient, generateClientKeyPair, parseClientPrivateJwk, readClientKeyRing, toPublicJwk };
@@ -1,2 +1,2 @@
1
- import { a as CheckoutStatus, c as MeterPricingMode, d as PlanInterval, f as PlanMeter, h as PlanRequiredTerms, i as CheckoutSession, l as Plan, m as PlanPaymentEnvironment, n as createReoptPlansClient, o as CreateCheckoutInput, p as PlanMeterTier, r as CancelSubscriptionResult, s as CurrentPlan, t as ReoptPlansClient, u as PlanBillingModel } from "../client-BO7-GuXP.js";
1
+ import { a as CheckoutStatus, c as MeterPricingMode, d as PlanInterval, f as PlanMeter, h as PlanRequiredTerms, i as CheckoutSession, l as Plan, m as PlanPaymentEnvironment, n as createReoptPlansClient, o as CreateCheckoutInput, p as PlanMeterTier, r as CancelSubscriptionResult, s as CurrentPlan, t as ReoptPlansClient, u as PlanBillingModel } from "../client-Dsz0BzpO.js";
2
2
  export { type CancelSubscriptionResult, type CheckoutSession, type CheckoutStatus, type CreateCheckoutInput, type CurrentPlan, type MeterPricingMode, type Plan, type PlanBillingModel, type PlanInterval, type PlanMeter, type PlanMeterTier, type PlanPaymentEnvironment, type PlanRequiredTerms, ReoptPlansClient, createReoptPlansClient };
@@ -1,3 +1,3 @@
1
- import { n as createReoptPlansClient, t as ReoptPlansClient } from "../client-ZmjLpkjt.js";
1
+ import { n as createReoptPlansClient, t as ReoptPlansClient } from "../client-CLsqp1Jn.js";
2
2
 
3
3
  export { ReoptPlansClient, createReoptPlansClient };
@@ -1,3 +1,3 @@
1
- import { n as createReoptPushClient, t as ReoptPushClient } from "../client-Cj92U3fu.js";
1
+ import { n as createReoptPushClient, t as ReoptPushClient } from "../client-C7k9bCwh.js";
2
2
 
3
3
  export { ReoptPushClient, createReoptPushClient };
@@ -1,4 +1,4 @@
1
- import { S as ReoptSDKError } from "./config-DKINyq4g.js";
1
+ import { S as ReoptSDKError } from "./config-Cb96ydFD.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-BFqEr2OW.js.map
35
+ //# sourceMappingURL=query-jbkDQ1o2.js.map
@@ -1,9 +1,9 @@
1
1
  import { A as ListRecordsQuery, C as EavAttribute, D as EavRecord, E as EavEntity, F as UpdateRecordInput, I as UpsertRecordInput, L as UpsertRecordResult, S as DeleteWhereInput, _ as BulkUpdateItem, j as PaginatedResponse, x as CreateRecordInput } from "../config-BGT9h1OW.js";
2
2
  import { a as CompletionOptions, f as ModelInfo, l as ImageGenerateOptions, o as CompletionResult, p as StreamDoneData, r as AgentInfo, s as CreditInfo, u as ImageGenerateResult } from "../client-Bi-KSU_r.js";
3
- import { v as ReoptSDKError } from "../errors-U3TsyWVq.js";
3
+ import { v as ReoptSDKError } from "../errors-D-Va8oeC.js";
4
4
  import { a as ListTagsQuery, c as PostGroup, d as Tag, i as ListPostsQuery, o as Post, r as ListPostGroupsQuery, s as PostDetail, t as CmsPaginatedResponse } from "../types-BXDcoJHG.js";
5
5
  import { a as FileListQuery, c as FolderInfo, d as UpdateFolderInput, f as UploadOptions, i as FileInfo, l as FolderListQuery, o as FileListResponse, r as CreateFolderInput, s as FileUsageInfo, u as UpdateFileInput } from "../client-wNzcgEJu.js";
6
- import { t as ReoptSDK } from "../index-CiZ5VkDS.js";
6
+ import { t as ReoptSDK } from "../index-VolJHcFS.js";
7
7
  import { UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
8
8
  //#region src/react/use-ai-stream.d.ts
9
9
  type UseAiStreamOptions = {
@@ -1,3 +1,3 @@
1
- import { n as createReoptTermsClient, t as ReoptTermsClient } from "../client-CQmuEZik.js";
1
+ import { n as createReoptTermsClient, t as ReoptTermsClient } from "../client-C1yI9DiK.js";
2
2
 
3
3
  export { ReoptTermsClient, createReoptTermsClient };
@@ -1,5 +1,5 @@
1
1
  import { a as SeedAllInput, c as SeedPostGroupInput, d as SeedTermsItem, l as SeedPostInput, n as DevServer, o as SeedData, t as DevSchema } from "../index-Dh8XMVFF.js";
2
- import { t as ReoptSDK } from "../index-CiZ5VkDS.js";
2
+ import { t as ReoptSDK } from "../index-VolJHcFS.js";
3
3
  //#region src/testing/index.d.ts
4
4
  type TestSDKOptions = {
5
5
  /** EAV schema to seed entities and attributes */
@@ -1,3 +1,3 @@
1
- import { $ as platformWorkTaskStageChangedEventSchema, A as platformErrorSchema, B as platformPipelineSchema, C as platformBrandappUpsertInputSchema, D as platformEavSchemaApplyInputSchema, E as platformEavEntityResourceSchema, F as platformOAuthClientImportInputSchema, G as platformResourcesV2Schema, H as platformPipelineUpsertInputSchema, I as platformOAuthClientResourceSchema, J as platformTaskStageSchema, K as platformTaskSchema, L as platformOAuthClientUpsertInputSchema, M as platformLockAcquiredSchema, N as platformLockReleasedSchema, O as platformEavSchemaApplyResultSchema, P as platformMeSchema, Q as platformWebhookUpsertInputSchema, R as platformPipelineImportInputSchema, S as platformBrandappResourceSchema, T as platformEavBrandappResourcesSchema, U as platformResourceKeySchema, V as platformPipelineStageInputSchema, W as platformResourcesSchema, X as platformWebhookResourceSchema, Y as platformTaskUpsertInputSchema, Z as platformWebhookSchema, _ as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, a as createPlatformClient, b as platformBrandResourceSchema, c as PLATFORM_BRANDAPP_STATUSES, d as PLATFORM_OAUTH_APPLICATION_TYPES, et as platformWriteMetaSchema, f as PLATFORM_OAUTH_CLIENT_PURPOSES, g as PLATFORM_TASK_PRIORITIES, h as PLATFORM_TASK_OUTCOMES, i as REOPT_PLATFORM_URLS, j as platformExternalIdSchema, k as platformEavSchemaOperationSchema, l as PLATFORM_DOMAIN_STATUSES, m as PLATFORM_STAGE_COLORS, n as PlatformApiError, o as resolvePlatformUrls, p as PLATFORM_OAUTH_GRANT_TYPES, q as platformTaskStageInputSchema, r as REOPT_PLATFORM_ID_URLS, s as PLATFORM_ADMIN_SCOPE, t as DEFAULT_PLATFORM_SCOPES, u as PLATFORM_MANAGED_BY_VALUES, v as PLATFORM_WEBHOOK_TRIGGERS, w as platformCustomerUpsertInputSchema, x as platformBrandUpsertInputSchema, y as platformBrandImportInputSchema, z as platformPipelineResourceSchema } from "../client-DAyfkqrY.js";
1
+ import { $ as platformWorkTaskStageChangedEventSchema, A as platformErrorSchema, B as platformPipelineSchema, C as platformBrandappUpsertInputSchema, D as platformEavSchemaApplyInputSchema, E as platformEavEntityResourceSchema, F as platformOAuthClientImportInputSchema, G as platformResourcesV2Schema, H as platformPipelineUpsertInputSchema, I as platformOAuthClientResourceSchema, J as platformTaskStageSchema, K as platformTaskSchema, L as platformOAuthClientUpsertInputSchema, M as platformLockAcquiredSchema, N as platformLockReleasedSchema, O as platformEavSchemaApplyResultSchema, P as platformMeSchema, Q as platformWebhookUpsertInputSchema, R as platformPipelineImportInputSchema, S as platformBrandappResourceSchema, T as platformEavBrandappResourcesSchema, U as platformResourceKeySchema, V as platformPipelineStageInputSchema, W as platformResourcesSchema, X as platformWebhookResourceSchema, Y as platformTaskUpsertInputSchema, Z as platformWebhookSchema, _ as PLATFORM_TOKEN_ENDPOINT_AUTH_METHODS, a as createPlatformClient, b as platformBrandResourceSchema, c as PLATFORM_BRANDAPP_STATUSES, d as PLATFORM_OAUTH_APPLICATION_TYPES, et as platformWriteMetaSchema, f as PLATFORM_OAUTH_CLIENT_PURPOSES, g as PLATFORM_TASK_PRIORITIES, h as PLATFORM_TASK_OUTCOMES, i as REOPT_PLATFORM_URLS, j as platformExternalIdSchema, k as platformEavSchemaOperationSchema, l as PLATFORM_DOMAIN_STATUSES, m as PLATFORM_STAGE_COLORS, n as PlatformApiError, o as resolvePlatformUrls, p as PLATFORM_OAUTH_GRANT_TYPES, q as platformTaskStageInputSchema, r as REOPT_PLATFORM_ID_URLS, s as PLATFORM_ADMIN_SCOPE, t as DEFAULT_PLATFORM_SCOPES, u as PLATFORM_MANAGED_BY_VALUES, v as PLATFORM_WEBHOOK_TRIGGERS, w as platformCustomerUpsertInputSchema, x as platformBrandUpsertInputSchema, y as platformBrandImportInputSchema, z as platformPipelineResourceSchema } from "../client-DMvufVds.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 };
@@ -639,6 +639,25 @@ canceled.providerCanceled; // false → local subscription is definitely over (n
639
639
  // remnant that an operator should check (3.4+)
640
640
  ```
641
641
 
642
+ ```ts
643
+ // Switch plans while subscribed (Lemon Squeezy, 4.7+) — no new checkout.
644
+ // Immediate; resolves to the changed plan (same shape as getMyPlan).
645
+ // Upgrades charge the prorated difference now, downgrades credit the next invoice.
646
+ const plan: CurrentPlan = await sdk.plans.changePlan(proPlanId, accessToken);
647
+ plan.planId; // proPlanId
648
+ // e.code: NO_ACTIVE_SUBSCRIPTION | SAME_PLAN | PLAN_NOT_FOUND | PLAN_INACTIVE |
649
+ // PLAN_PRICE_NOT_LINKED | TERMS_REQUIRED | SUBSCRIPTION_NOT_ACTIVE |
650
+ // PROVIDER_PORTAL_REQUIRED (PayPal → provider portal) | PROVIDER_ERROR (502, retry)
651
+ ```
652
+
653
+ ```ts
654
+ // Resume a canceled subscription while its paid period runs (Lemon Squeezy, 4.7+).
655
+ // During that period createCheckout refuses with SUBSCRIPTION_CANCEL_PENDING (409) —
656
+ // a second subscription would bill the overlap twice. Resume, then changePlan if needed.
657
+ const resumed: CurrentPlan = await sdk.plans.resume(accessToken);
658
+ // e.code: NO_RESUMABLE_SUBSCRIPTION (409) | PROVIDER_ERROR (502, retry)
659
+ ```
660
+
642
661
  > The three fields added in 3.4 are optional — an older platform deployment
643
662
  > simply omits them. Apple/Google (IAP) subscriptions are canceled in the store,
644
663
  > so no remote call is made and `providerCanceled` stays `false`.
package/docs/errors.md CHANGED
@@ -266,6 +266,29 @@ try {
266
266
  }
267
267
  ```
268
268
 
269
+ ### Plan change, cancel & resume (`sdk.plans.changePlan` / `cancel` / `resume`, 4.7+)
270
+
271
+ Refusals come back as `ConflictError` (409) with these `code`s — nothing was
272
+ changed and no provider call was made:
273
+
274
+ | code | meaning | what to do |
275
+ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
276
+ | `NO_ACTIVE_SUBSCRIPTION` | no subscription to change | check out the plan instead |
277
+ | `SAME_PLAN` | already on that plan | re-read `getMyPlan` — after a retry this means the first call landed |
278
+ | `PLAN_INACTIVE` / `PLAN_SCOPE_MISMATCH` | the target plan is not sellable here | refresh the plan list |
279
+ | `PLAN_CHANGE_UNSUPPORTED` | not a Lemon Squeezy subscription, or a different currency / non-recurring plan | cancel, then check out |
280
+ | `PLAN_PRICE_NOT_LINKED` | the plan has no provider price yet | ask the app operator |
281
+ | `TERMS_REQUIRED` | the new plan needs terms consent | collect consent via `sdk.terms`, retry |
282
+ | `SUBSCRIPTION_NOT_ACTIVE` | cancel scheduled or payment past due | resume / fix payment first |
283
+ | `PROVIDER_PORTAL_REQUIRED` | PayPal subscription — the provider API cannot change it | send the customer to the provider's customer portal (receipt e-mail link) |
284
+ | `NO_RESUMABLE_SUBSCRIPTION` | `resume` — nothing canceled, or the paid period is over | check out again |
285
+ | `SUBSCRIPTION_CANCEL_PENDING` | `createCheckout` — a canceled subscription still runs its paid period; a new one would bill the overlap twice | `resume`, then `changePlan` for another plan |
286
+
287
+ `PLAN_NOT_FOUND` is a `NotFoundError` (404). A provider-side failure is a
288
+ `ServerError` with `status: 502` and `code: "PROVIDER_ERROR"` (changePlan) or
289
+ `"PROVIDER_CANCEL_FAILED"` (cancel) — nothing changed, retry. POST calls are
290
+ not retried automatically.
291
+
269
292
  ### FORBIDDEN: `Forbidden` / `Model tier not available` (403)
270
293
 
271
294
  - **Cause**: No permission for the resource — e.g. the requested model
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reopt-ai/brandapp-sdk",
3
- "version": "4.7.0-rc.4",
3
+ "version": "4.7.0-rc.6",
4
4
  "description": "Reopt Brandapp SDK — Better Auth adapter, OAuth login, and EAV client",
5
5
  "author": "Reopt",
6
6
  "license": "MIT",