@reopt-ai/brandapp-sdk 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/README.md +10 -1
- package/dist/abort--nOBFN4M.js +50 -0
- package/dist/ai/index.d.ts +2 -314
- package/dist/ai/index.js +3 -8
- package/dist/ai-provider/index.d.ts +79 -163
- package/dist/ai-provider/index.js +752 -685
- package/dist/auth/index.d.ts +27 -27
- package/dist/auth/index.js +41 -34
- package/dist/better-auth/client.d.ts +6 -5
- package/dist/better-auth/client.js +28 -5
- package/dist/better-auth/index.d.ts +19 -17
- package/dist/better-auth/index.js +180 -144
- package/dist/client-B1q5P8rv.js +83 -0
- package/dist/client-B9QHVhdM.js +77 -0
- package/dist/client-BGGd_cpV.d.ts +103 -0
- package/dist/client-BJcy1V1a.js +140 -0
- package/dist/client-Beivhucf.js +55 -0
- package/dist/client-BruP5_nU.d.ts +147 -0
- package/dist/client-D-yNxNfk.js +28 -0
- package/dist/client-D0eBxh8j.d.ts +284 -0
- package/dist/client-D3RHHUUW.d.ts +207 -0
- package/dist/client-D6gs61w8.d.ts +53 -0
- package/dist/client-DBnK7ooQ.js +86 -0
- package/dist/client-DDw5yz_h.d.ts +53 -0
- package/dist/client-DPmoKuR9.js +305 -0
- package/dist/client-DsdakibF.js +503 -0
- package/dist/client-Dxg8_DIH.d.ts +71 -0
- package/dist/client-EbhUIhHq.js +53 -0
- package/dist/client-lk6wBu_0.d.ts +48 -0
- package/dist/client-p49ol9pg.d.ts +124 -0
- package/dist/cms/index.d.ts +52 -108
- package/dist/cms/index.js +103 -86
- package/dist/config-CRytOPPl.d.ts +394 -0
- package/dist/config-Cw0a3-C8.js +487 -0
- package/dist/dev/index.d.ts +2 -528
- package/dist/dev/index.js +2731 -2967
- package/dist/eav/coerce.d.ts +3 -1
- package/dist/eav/coerce.js +72 -46
- package/dist/eav/index.d.ts +72 -100
- package/dist/eav/index.js +158 -126
- package/dist/eav/migrate.d.ts +112 -109
- package/dist/eav/migrate.js +230 -196
- package/dist/eav/schema.d.ts +111 -150
- package/dist/eav/schema.js +624 -603
- package/dist/encoding-Bwfm3iaE.js +21 -0
- package/dist/{errors-BjDFIyA6.d.ts → errors-CRCcErNC.d.ts} +55 -53
- package/dist/feedback/index.d.ts +2 -132
- package/dist/feedback/index.js +3 -6
- package/dist/files/index.d.ts +14 -14
- package/dist/files/index.js +41 -25
- package/dist/http-client-QKUvvirs.js +386 -0
- package/dist/index-DrVaKfhs.d.ts +456 -0
- package/dist/index-Z6OGcurJ.d.ts +169 -0
- package/dist/index.d.ts +6 -230
- package/dist/index.js +119 -71
- package/dist/logout/index.d.ts +56 -53
- package/dist/logout/index.js +232 -289
- package/dist/plans/index.d.ts +2 -236
- package/dist/plans/index.js +3 -6
- package/dist/push/index.d.ts +2 -79
- package/dist/push/index.js +3 -6
- package/dist/query-BvbCiGWb.js +35 -0
- package/dist/react/hooks.d.ts +97 -99
- package/dist/react/hooks.js +742 -404
- package/dist/sse-parser-FMjxM7sY.js +86 -0
- package/dist/terms/index.d.ts +3 -79
- package/dist/terms/index.js +3 -6
- package/dist/testing/index.d.ts +52 -104
- package/dist/testing/index.js +94 -72
- package/dist/types-B-SMkH6s.d.ts +26 -0
- package/dist/types-BXDcoJHG.d.ts +131 -0
- package/dist/types-BrghN2rJ.d.ts +105 -0
- package/dist/types-DjDRszNj.js +11 -0
- package/dist/webhooks/index.d.ts +77 -50
- package/dist/webhooks/index.js +150 -127
- package/docs/api-reference.md +87 -6
- package/package.json +6 -5
- package/dist/chunk-2LSCQHAU.js +0 -21
- package/dist/chunk-4U4ZPPL4.js +0 -599
- package/dist/chunk-55KHY5GH.js +0 -96
- package/dist/chunk-C5VTRZWX.js +0 -458
- package/dist/chunk-F7BXBTZI.js +0 -54
- package/dist/chunk-FJUCWXX3.js +0 -350
- package/dist/chunk-H33OTQEN.js +0 -112
- package/dist/chunk-L4DHB36G.js +0 -75
- package/dist/chunk-OG7R3UAR.js +0 -105
- package/dist/chunk-PF24XU54.js +0 -32
- package/dist/chunk-QN3QD67K.js +0 -49
- package/dist/chunk-REIKXSMY.js +0 -7
- package/dist/chunk-UGBBXCZE.js +0 -157
- package/dist/chunk-UVT2E6KD.js +0 -81
- package/dist/chunk-YPLT3RFL.js +0 -63
- package/dist/chunk-YTKSAWV2.js +0 -463
- package/dist/client-BkcO-0C2.d.ts +0 -216
- package/dist/client-CN5_tNOC.d.ts +0 -147
- package/dist/client-DttyeM_h.d.ts +0 -102
- package/dist/config-CtxyJsDR.d.ts +0 -397
- package/dist/typed-client-BxOVIiMU.d.ts +0 -40
- package/dist/types-6E3ZLL9X.d.ts +0 -24
- package/dist/types-DskYLVb8.d.ts +0 -104
- package/dist/types-ckmDDW3N.d.ts +0 -129
package/dist/plans/index.d.ts
CHANGED
|
@@ -1,236 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Brandapp Plans types.
|
|
5
|
-
*
|
|
6
|
-
* Mirrors the response shape of `/api/v1/brandapp/{brandappId}/plans/*`.
|
|
7
|
-
*/
|
|
8
|
-
/** Prisma `BillingModel` enum. */
|
|
9
|
-
type PlanBillingModel = "recurring" | "usage";
|
|
10
|
-
/** Prisma `PlanInterval` enum. */
|
|
11
|
-
type PlanInterval = "monthly" | "yearly" | "once" | "lifetime";
|
|
12
|
-
/** Prisma `MeterPricingMode` enum. */
|
|
13
|
-
type MeterPricingMode = "flat" | "tiered";
|
|
14
|
-
type PlanMeterTier = {
|
|
15
|
-
/** 이 구간의 상한 수량. `null`이면 마지막(무제한) 구간. */
|
|
16
|
-
upTo: number | null;
|
|
17
|
-
/** 구간 단가 (통화 최소 단위 정수, 예: 원). */
|
|
18
|
-
unitPrice: number;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* usage 과금 플랜의 사용량 미터.
|
|
22
|
-
*
|
|
23
|
-
* ⚠️ 현재 미터는 **read-only 메타데이터**다 — 사용량 집계·리포팅·청구 백엔드는
|
|
24
|
-
* 아직 구현되지 않았다. 플랜 카탈로그에 "무엇을 얼마에 과금하는지" 표시하는
|
|
25
|
-
* 용도로만 노출된다.
|
|
26
|
-
*/
|
|
27
|
-
type PlanMeter = {
|
|
28
|
-
id: string;
|
|
29
|
-
name: string;
|
|
30
|
-
/** API용 미터 키 (영문 소문자+숫자+언더스코어). */
|
|
31
|
-
key: string;
|
|
32
|
-
/** 단위 레이블 (예: "건", "GB"). */
|
|
33
|
-
unitLabel: string;
|
|
34
|
-
/** 포함 무료 수량. */
|
|
35
|
-
includedQty: number;
|
|
36
|
-
pricingMode: MeterPricingMode | string;
|
|
37
|
-
/** flat 모드 단가 (통화 최소 단위 정수). */
|
|
38
|
-
unitPrice: number;
|
|
39
|
-
/** tiered 모드 구간. flat 모드이거나 미설정이면 `null`. */
|
|
40
|
-
tiers: PlanMeterTier[] | null;
|
|
41
|
-
sortOrder: number;
|
|
42
|
-
};
|
|
43
|
-
type PlanRequiredTerms = {
|
|
44
|
-
id: string;
|
|
45
|
-
title: string;
|
|
46
|
-
/** Prisma `BrandappTermsType` (termsOfService/privacyPolicy/marketingConsent/custom). */
|
|
47
|
-
type: string;
|
|
48
|
-
};
|
|
49
|
-
type Plan = {
|
|
50
|
-
id: string;
|
|
51
|
-
name: string;
|
|
52
|
-
description: string | null;
|
|
53
|
-
billingModel: PlanBillingModel | string;
|
|
54
|
-
/** 정기 구독 가격 (통화 최소 단위 정수). usage 플랜은 보통 0. */
|
|
55
|
-
priceAmount: number;
|
|
56
|
-
/** ISO 4217 통화 코드 (예: "KRW", "USD"). */
|
|
57
|
-
currency: string;
|
|
58
|
-
interval: PlanInterval | string;
|
|
59
|
-
/** usage 플랜의 기본 요금 (통화 최소 단위 정수). */
|
|
60
|
-
baseFee: number;
|
|
61
|
-
sortOrder: number;
|
|
62
|
-
features: string[];
|
|
63
|
-
/** usage 플랜의 사용량 미터 (read-only). */
|
|
64
|
-
meters: PlanMeter[];
|
|
65
|
-
/** 구독 전에 동의가 필요한 필수 약관. `sdk.terms`로 본문 조회·동의. */
|
|
66
|
-
requiredTerms: PlanRequiredTerms[];
|
|
67
|
-
};
|
|
68
|
-
/** Prisma `BrandappCheckoutStatus`. */
|
|
69
|
-
type CheckoutStatus = "pending" | "completed" | "canceled" | "expired" | "failed";
|
|
70
|
-
/** `plans.createCheckout` 입력. */
|
|
71
|
-
type CreateCheckoutInput = {
|
|
72
|
-
/** 구독할 플랜 ID (`plans.list()`가 반환하는 `Plan.id`). */
|
|
73
|
-
planId: string;
|
|
74
|
-
/**
|
|
75
|
-
* 결제 성공 후 고객을 돌려보낼 **절대** URL (내 앱의 복귀 페이지). 이 브랜드앱
|
|
76
|
-
* OAuth 클라이언트에 등록된 redirect URI와 동일 origin이거나 reopt 호스트여야 한다.
|
|
77
|
-
*/
|
|
78
|
-
successUrl: string;
|
|
79
|
-
/** 결제 취소 시 돌려보낼 절대 URL (successUrl과 동일 검증). */
|
|
80
|
-
cancelUrl: string;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* hosted-checkout 세션.
|
|
84
|
-
*
|
|
85
|
-
* `createCheckout`가 반환하면 `checkoutUrl`로 브라우저를 리다이렉트한다. 샌드박스
|
|
86
|
-
* 모드에서 이 URL은 id.reopt.ai의 가상 결제 페이지이며, 결제를 승인하면 구독이
|
|
87
|
-
* 활성화되고 `successUrl`(취소 시 `cancelUrl`)로 복귀한다. 복귀 후
|
|
88
|
-
* `getCheckout(checkoutId)` 또는 `getMyPlan(token)`으로 결과를 확인한다.
|
|
89
|
-
*/
|
|
90
|
-
type CheckoutSession = {
|
|
91
|
-
checkoutId: string;
|
|
92
|
-
/**
|
|
93
|
-
* 브라우저를 리다이렉트할 결제 URL. `createCheckout` 응답에만 존재하고
|
|
94
|
-
* `getCheckout` 응답에서는 `null`이다(capability token 재노출 방지).
|
|
95
|
-
*/
|
|
96
|
-
checkoutUrl: string | null;
|
|
97
|
-
/** 결제 제공자 — 현재 "sandbox"(가상 결제). */
|
|
98
|
-
provider: string;
|
|
99
|
-
status: CheckoutStatus | string;
|
|
100
|
-
planId: string;
|
|
101
|
-
planName: string;
|
|
102
|
-
/** 결제 금액 (통화 최소 단위 정수). */
|
|
103
|
-
amount: number;
|
|
104
|
-
currency: string;
|
|
105
|
-
interval: PlanInterval | string;
|
|
106
|
-
/** ISO-8601 만료 시각 (pending 세션 TTL). */
|
|
107
|
-
expiresAt: string;
|
|
108
|
-
/** ISO-8601 완료 시각. 미완료면 `null`. */
|
|
109
|
-
completedAt: string | null;
|
|
110
|
-
};
|
|
111
|
-
/** `plans.cancel` 결과. */
|
|
112
|
-
type CancelSubscriptionResult = {
|
|
113
|
-
status: "canceled";
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* 현재 로그인 고객의 구독 플랜 + 엔타이틀먼트.
|
|
117
|
-
*
|
|
118
|
-
* 결제 상태는 이 고객 본인 소유(brandappCustomer) BillingState/PaymentProviderLink에서
|
|
119
|
-
* 읽는다. 원시 결제 식별자(billingKey, 외부 subscription id)는 노출하지 않는다.
|
|
120
|
-
*/
|
|
121
|
-
type CurrentPlan = {
|
|
122
|
-
planId: string;
|
|
123
|
-
planName: string;
|
|
124
|
-
planDescription: string | null;
|
|
125
|
-
priceAmount: number;
|
|
126
|
-
currency: string;
|
|
127
|
-
interval: PlanInterval | string;
|
|
128
|
-
features: string[];
|
|
129
|
-
/** BillingState.status (예: "active", "trialing", "canceled"). null이면 결제 상태 없음. */
|
|
130
|
-
subscriptionStatus: string | null;
|
|
131
|
-
/** ISO-8601 문자열. */
|
|
132
|
-
planStartedAt: string | null;
|
|
133
|
-
/** ISO-8601 문자열. `null`이면 무기한. */
|
|
134
|
-
planExpiresAt: string | null;
|
|
135
|
-
/** 활성 결제 제공자 — "paddle" | "toss" | null. */
|
|
136
|
-
paymentProvider: string | null;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Brandapp Plans client — read the plan catalog, the current customer's plan,
|
|
141
|
-
* and drive a hosted checkout to subscribe & pay.
|
|
142
|
-
*
|
|
143
|
-
* - `list()` — Basic or Bearer. Active plans (catalog).
|
|
144
|
-
* - `getMyPlan(accessToken)` — Bearer. The current customer's plan, or `null`.
|
|
145
|
-
* - `createCheckout(input, accessToken)` — Bearer. Start a hosted checkout;
|
|
146
|
-
* redirect the browser to the returned `checkoutUrl`.
|
|
147
|
-
* - `getCheckout(checkoutId, accessToken)` — Bearer. Poll a checkout session.
|
|
148
|
-
* - `cancel(accessToken)` — Bearer. Cancel the current sandbox subscription.
|
|
149
|
-
*
|
|
150
|
-
* ### Sandbox checkout (payment disabled)
|
|
151
|
-
* When the Brandapp has real payment disabled (the default), `createCheckout`
|
|
152
|
-
* returns a **sandbox** `checkoutUrl` — a virtual-payment page on id.reopt.ai
|
|
153
|
-
* that activates the subscription without any real charge and redirects back to
|
|
154
|
-
* your `successUrl`/`cancelUrl`. This is the built-in way to build and test the
|
|
155
|
-
* full "list → subscribe → pay → entitlement" flow with no Toss/Paddle setup.
|
|
156
|
-
*
|
|
157
|
-
* ⚠️ Live Toss/Paddle checkout is **not** driven through the SDK yet (it needs
|
|
158
|
-
* the provider browser SDK + host callbacks and stays in the first-party
|
|
159
|
-
* brandfront flow) — `createCheckout` returns HTTP 409 `LIVE_MODE_UNSUPPORTED`
|
|
160
|
-
* when the Brandapp is set to live payments. usage-model meters remain
|
|
161
|
-
* read-only metadata (usage billing not implemented).
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```ts
|
|
165
|
-
* const sdk = createReoptSDK({ clientId, clientSecret, brandappId });
|
|
166
|
-
*
|
|
167
|
-
* // Render the plan catalog (no user context required):
|
|
168
|
-
* const plans = await sdk.plans.list();
|
|
169
|
-
*
|
|
170
|
-
* // After the customer signs in via OAuth, subscribe & pay:
|
|
171
|
-
* try {
|
|
172
|
-
* const checkout = await sdk.plans.createCheckout(
|
|
173
|
-
* { planId: plans[0].id, successUrl, cancelUrl },
|
|
174
|
-
* accessToken,
|
|
175
|
-
* );
|
|
176
|
-
* redirect(checkout.checkoutUrl!); // → sandbox payment page, then back to successUrl
|
|
177
|
-
* } catch (e) {
|
|
178
|
-
* if (isRequiredTermsError(e)) {
|
|
179
|
-
* // collect consent for e.missingTermsIds via sdk.terms, then retry
|
|
180
|
-
* }
|
|
181
|
-
* }
|
|
182
|
-
*
|
|
183
|
-
* // On the return page, confirm the entitlement:
|
|
184
|
-
* const current = await sdk.plans.getMyPlan(accessToken);
|
|
185
|
-
* if (current?.subscriptionStatus === "active") {
|
|
186
|
-
* // grant entitlement…
|
|
187
|
-
* }
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
declare class ReoptPlansClient {
|
|
192
|
-
private readonly http;
|
|
193
|
-
constructor(config: ReoptSDKConfig);
|
|
194
|
-
/**
|
|
195
|
-
* List active plans for this Brandapp (the customer-facing catalog). Works
|
|
196
|
-
* with either Basic Auth (default) or Bearer Auth — pass `accessToken` when
|
|
197
|
-
* calling from a handler that already has the customer's OAuth token to avoid
|
|
198
|
-
* sending app credentials.
|
|
199
|
-
*/
|
|
200
|
-
list(accessToken?: string): Promise<Plan[]>;
|
|
201
|
-
/**
|
|
202
|
-
* Fetch the current plan / entitlement for the OAuth customer represented by
|
|
203
|
-
* `accessToken`. Returns `null` when the customer has no active plan.
|
|
204
|
-
*/
|
|
205
|
-
getMyPlan(accessToken: string): Promise<CurrentPlan | null>;
|
|
206
|
-
/**
|
|
207
|
-
* Start a hosted checkout to subscribe the current customer (identified by
|
|
208
|
-
* `accessToken`) to `input.planId`, then redirect the browser to the returned
|
|
209
|
-
* `checkoutUrl`. In sandbox mode that URL is a virtual-payment page on
|
|
210
|
-
* id.reopt.ai which activates the subscription and returns to your
|
|
211
|
-
* `successUrl` / `cancelUrl`.
|
|
212
|
-
*
|
|
213
|
-
* @throws {RequiredTermsError} when the plan has required terms the customer
|
|
214
|
-
* has not consented to. Read `missingTermsIds`, collect consent via
|
|
215
|
-
* `sdk.terms`, then call again.
|
|
216
|
-
* @throws {ReoptSDKError} `LIVE_MODE_UNSUPPORTED` (409) when the Brandapp is
|
|
217
|
-
* configured for live Toss/Paddle payments (use the brandfront checkout).
|
|
218
|
-
*/
|
|
219
|
-
createCheckout(input: CreateCheckoutInput, accessToken: string): Promise<CheckoutSession>;
|
|
220
|
-
/**
|
|
221
|
-
* Poll a checkout session by id (e.g. on your return page) to read its
|
|
222
|
-
* `status` — `completed` means the subscription is active. `checkoutUrl` is
|
|
223
|
-
* `null` here; use the URL from {@link createCheckout} to re-redirect.
|
|
224
|
-
*/
|
|
225
|
-
getCheckout(checkoutId: string, accessToken: string): Promise<CheckoutSession>;
|
|
226
|
-
/**
|
|
227
|
-
* Cancel the current customer's active **sandbox** subscription. Access is
|
|
228
|
-
* kept until the paid period ends (the billing state becomes `canceled`).
|
|
229
|
-
* Real Toss/Paddle subscriptions are not affected — those use the provider
|
|
230
|
-
* flow.
|
|
231
|
-
*/
|
|
232
|
-
cancel(accessToken: string): Promise<CancelSubscriptionResult>;
|
|
233
|
-
}
|
|
234
|
-
declare function createReoptPlansClient(config: ReoptSDKConfig): ReoptPlansClient;
|
|
235
|
-
|
|
236
|
-
export { type CancelSubscriptionResult, type CheckoutSession, type CheckoutStatus, type CreateCheckoutInput, type CurrentPlan, type MeterPricingMode, type Plan, type PlanBillingModel, type PlanInterval, type PlanMeter, type PlanMeterTier, type PlanRequiredTerms, ReoptPlansClient, createReoptPlansClient };
|
|
1
|
+
import { a as CheckoutStatus, c as MeterPricingMode, d as PlanInterval, f as PlanMeter, i as CheckoutSession, l as Plan, m as PlanRequiredTerms, n as createReoptPlansClient, o as CreateCheckoutInput, p as PlanMeterTier, r as CancelSubscriptionResult, s as CurrentPlan, t as ReoptPlansClient, u as PlanBillingModel } from "../client-D3RHHUUW.js";
|
|
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 PlanRequiredTerms, ReoptPlansClient, createReoptPlansClient };
|
package/dist/plans/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '../chunk-C5VTRZWX.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { n as createReoptPlansClient, t as ReoptPlansClient } from "../client-B9QHVhdM.js";
|
|
2
|
+
|
|
3
|
+
export { ReoptPlansClient, createReoptPlansClient };
|
package/dist/push/index.d.ts
CHANGED
|
@@ -1,79 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** Push provider — native token kind. */
|
|
4
|
-
type PushProvider = "fcm" | "apns";
|
|
5
|
-
/** Device platform. */
|
|
6
|
-
type PushPlatform = "ios" | "android" | "web";
|
|
7
|
-
/** Input for registering a device push token. */
|
|
8
|
-
type RegisterPushTokenInput = {
|
|
9
|
-
/** Provider of the native token. */
|
|
10
|
-
provider: PushProvider;
|
|
11
|
-
/** Native device token (FCM registration token / APNs device token). */
|
|
12
|
-
token: string;
|
|
13
|
-
/** Device platform. */
|
|
14
|
-
platform: PushPlatform;
|
|
15
|
-
/** Optional device identifier (helps re-login/refresh upsert + unregister). */
|
|
16
|
-
deviceId?: string;
|
|
17
|
-
};
|
|
18
|
-
type RegisterPushTokenResult = {
|
|
19
|
-
registered: boolean;
|
|
20
|
-
};
|
|
21
|
-
/** Input for unregistering — one of token / deviceId is required. */
|
|
22
|
-
type UnregisterPushTokenInput = {
|
|
23
|
-
token?: string;
|
|
24
|
-
deviceId?: string;
|
|
25
|
-
};
|
|
26
|
-
type UnregisterPushTokenResult = {
|
|
27
|
-
unregistered: boolean;
|
|
28
|
-
};
|
|
29
|
-
/** A device currently registered for the signed-in customer. */
|
|
30
|
-
type RegisteredPushDevice = {
|
|
31
|
-
id: string;
|
|
32
|
-
platform: PushPlatform;
|
|
33
|
-
provider: PushProvider;
|
|
34
|
-
deviceId: string | null;
|
|
35
|
-
createdAt: string;
|
|
36
|
-
lastSeenAt: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Brandapp Push client.
|
|
41
|
-
*
|
|
42
|
-
* Lets a signed-in customer register/unregister their native device push token
|
|
43
|
-
* (FCM/APNs) so the workspace can send them direct push notifications from the
|
|
44
|
-
* reopt Studio send console. All methods require the end-user's OAuth access
|
|
45
|
-
* token — the server resolves the token's linked customer and scopes the token
|
|
46
|
-
* to them (unlinked users get 403 `LINK_REQUIRED`).
|
|
47
|
-
*
|
|
48
|
-
* The native token itself (FCM registration token / APNs device token) is
|
|
49
|
-
* obtained by the host app (React Native / native shell) — this client only
|
|
50
|
-
* registers/unregisters an already-obtained token.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* const sdk = createReoptSDK({ clientId, clientSecret, brandappId });
|
|
55
|
-
*
|
|
56
|
-
* // After obtaining a native token in the app:
|
|
57
|
-
* await sdk.push.registerDeviceToken(
|
|
58
|
-
* { provider: "fcm", token: fcmToken, platform: "android", deviceId },
|
|
59
|
-
* accessToken,
|
|
60
|
-
* );
|
|
61
|
-
*
|
|
62
|
-
* // On logout:
|
|
63
|
-
* await sdk.push.unregisterDeviceToken({ deviceId }, accessToken);
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
declare class ReoptPushClient {
|
|
68
|
-
private readonly http;
|
|
69
|
-
constructor(config: ReoptSDKConfig);
|
|
70
|
-
/** Register (or refresh) the signed-in customer's device push token. */
|
|
71
|
-
registerDeviceToken(input: RegisterPushTokenInput, accessToken: string): Promise<RegisterPushTokenResult>;
|
|
72
|
-
/** Unregister a device token by `token` or `deviceId` (own tokens only). */
|
|
73
|
-
unregisterDeviceToken(input: UnregisterPushTokenInput, accessToken: string): Promise<UnregisterPushTokenResult>;
|
|
74
|
-
/** List the signed-in customer's registered devices (no raw tokens). */
|
|
75
|
-
listDevices(accessToken: string): Promise<RegisteredPushDevice[]>;
|
|
76
|
-
}
|
|
77
|
-
declare function createReoptPushClient(config: ReoptSDKConfig): ReoptPushClient;
|
|
78
|
-
|
|
79
|
-
export { type PushPlatform, type PushProvider, type RegisterPushTokenInput, type RegisterPushTokenResult, type RegisteredPushDevice, ReoptPushClient, type UnregisterPushTokenInput, type UnregisterPushTokenResult, createReoptPushClient };
|
|
1
|
+
import { a as RegisterPushTokenInput, c as UnregisterPushTokenInput, i as PushProvider, l as UnregisterPushTokenResult, n as createReoptPushClient, o as RegisterPushTokenResult, r as PushPlatform, s as RegisteredPushDevice, t as ReoptPushClient } from "../client-D6gs61w8.js";
|
|
2
|
+
export { type PushPlatform, type PushProvider, type RegisterPushTokenInput, type RegisterPushTokenResult, type RegisteredPushDevice, ReoptPushClient, type UnregisterPushTokenInput, type UnregisterPushTokenResult, createReoptPushClient };
|
package/dist/push/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '../chunk-C5VTRZWX.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { n as createReoptPushClient, t as ReoptPushClient } from "../client-D-yNxNfk.js";
|
|
2
|
+
|
|
3
|
+
export { ReoptPushClient, createReoptPushClient };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { x as ReoptSDKError } from "./config-Cw0a3-C8.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/query.ts
|
|
4
|
+
/**
|
|
5
|
+
* Shared query-string builder for GET endpoints.
|
|
6
|
+
*
|
|
7
|
+
* Object/array values are JSON-serialized (e.g. EAV `filters`), everything
|
|
8
|
+
* else is stringified, then `encodeURIComponent`-escaped. Used by the EAV and
|
|
9
|
+
* CMS clients so the serialization rules stay in one place.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Maximum serialized query-string length (bytes, pre-`?`). Servers and proxies
|
|
13
|
+
* commonly reject URLs over ~8 KB with an opaque 414/400; we fail earlier with
|
|
14
|
+
* an actionable diagnostic so a caller passing too many/too-large filters
|
|
15
|
+
* learns the real cause instead of debugging a server-side rejection.
|
|
16
|
+
*/
|
|
17
|
+
const MAX_QUERY_STRING_LENGTH = 7500;
|
|
18
|
+
function buildQuery(params) {
|
|
19
|
+
const entries = Object.entries(params).filter(([, v]) => v !== void 0 && v !== null);
|
|
20
|
+
if (entries.length === 0) return "";
|
|
21
|
+
const qs = "?" + entries.map(([k, v]) => {
|
|
22
|
+
const value = typeof v === "object" ? JSON.stringify(v) : String(v);
|
|
23
|
+
return `${k}=${encodeURIComponent(value)}`;
|
|
24
|
+
}).join("&");
|
|
25
|
+
if (qs.length > 7500) throw new ReoptSDKError(`Query string is too large (${qs.length} chars, limit ${MAX_QUERY_STRING_LENGTH}). Reduce the number of filters or the size of filter values.`, 0, "QUERY_TOO_LARGE", void 0, {
|
|
26
|
+
cause: "GET 요청의 쿼리스트링이 서버/프록시의 URL 길이 한도(통상 8KB)를 초과할 위험이 있음",
|
|
27
|
+
fix: "filters 개수를 줄이거나, 큰 value(예: 긴 contains 문자열)를 분리/축소. 대량 조건은 여러 번 나눠 조회",
|
|
28
|
+
doc: "docs/errors.md#query_too_large"
|
|
29
|
+
});
|
|
30
|
+
return qs;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { buildQuery as t };
|
|
35
|
+
//# sourceMappingURL=query-BvbCiGWb.js.map
|