@bstage-sdk/bridge 0.15.1 → 0.17.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/README.md +42 -6
- package/dist/{chunk-TPKNGW34.js → chunk-B3TKEEX3.js} +2 -0
- package/dist/{chunk-QMYFZ7I6.js → chunk-LGCWV4TV.js} +35 -3
- package/dist/frame.cjs +2 -0
- package/dist/frame.d.cts +2 -2
- package/dist/frame.d.ts +2 -2
- package/dist/frame.js +1 -1
- package/dist/host.cjs +138 -13
- package/dist/host.d.cts +40 -4
- package/dist/host.d.ts +40 -4
- package/dist/host.js +106 -14
- package/dist/index.cjs +40 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -4
- package/dist/{messages-_p1yCNj9.d.cts → messages-pMXAlatW.d.cts} +30 -5
- package/dist/{messages-_p1yCNj9.d.ts → messages-pMXAlatW.d.ts} +30 -5
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** 브리지 오류 코드. */
|
|
2
|
-
declare const BRIDGE_ERROR_CODES: readonly ["FORBIDDEN_DESTINATION", "FORBIDDEN_METHOD", "BODY_TOO_LARGE", "RATE_LIMITED", "BAD_REQUEST", "TIMEOUT", "NETWORK_ERROR", "UNSUPPORTED", "NOT_ALLOWED"];
|
|
2
|
+
declare const BRIDGE_ERROR_CODES: readonly ["FORBIDDEN_DESTINATION", "FORBIDDEN_METHOD", "BODY_TOO_LARGE", "RATE_LIMITED", "BAD_REQUEST", "TIMEOUT", "NETWORK_ERROR", "UNSUPPORTED", "NOT_ALLOWED", "STORAGE_UNAVAILABLE"];
|
|
3
3
|
type BridgeErrorCode = (typeof BRIDGE_ERROR_CODES)[number];
|
|
4
4
|
/** 코드가 붙은 브리지 오류. 호스트는 이 코드만 프레임에 돌려준다(내부 예외 메시지는 싣지 않는다). */
|
|
5
5
|
declare class BridgeError extends Error {
|
|
@@ -19,10 +19,10 @@ declare function isBridgeErrorLike(value: unknown): value is BridgeErrorLike;
|
|
|
19
19
|
/** 프레임 요청 타임아웃. */
|
|
20
20
|
declare const REQUEST_TIMEOUT_MS = 15000;
|
|
21
21
|
/** 프레임 → 호스트 요청 종류(브리지 프로토콜 표). */
|
|
22
|
-
declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "toast", "resize", "track", "storage", "log", "report", "session", "otp"];
|
|
22
|
+
declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "navigateExternal", "toast", "resize", "track", "storage", "log", "report", "session", "otp"];
|
|
23
23
|
type BridgeRequestType = (typeof REQUEST_TYPES)[number];
|
|
24
24
|
/** 호스트 → 프레임 이벤트 종류. */
|
|
25
|
-
declare const HOST_EVENT_TYPES: readonly ["slot.context", "locale", "member", "theme", "visibility"];
|
|
25
|
+
declare const HOST_EVENT_TYPES: readonly ["slot.context", "locale", "member", "theme", "visibility", "page"];
|
|
26
26
|
type BridgeHostEventType = (typeof HOST_EVENT_TYPES)[number];
|
|
27
27
|
/** 프레임 → 호스트 핸드셰이크 이벤트. */
|
|
28
28
|
declare const READY_EVENT = "ready";
|
|
@@ -44,6 +44,18 @@ interface MemberState {
|
|
|
44
44
|
readonly signedIn: boolean;
|
|
45
45
|
readonly nickname?: string;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* 호스트 페이지의 현재 위치(경로·쿼리). 해시는 싣지 않는다.
|
|
49
|
+
* `path`는 `/`로 시작, `search`는 빈 문자열이거나 `?`로 시작한다. 각각 `PAGE_LOCATION_MAX_LENGTH`자 이하.
|
|
50
|
+
*/
|
|
51
|
+
interface PageLocationState {
|
|
52
|
+
readonly path: string;
|
|
53
|
+
readonly search: string;
|
|
54
|
+
}
|
|
55
|
+
/** page 위치 path·search 각각의 최대 길이(자). 호스트 `validatePath`의 경로 상한과 같은 값이다. */
|
|
56
|
+
declare const PAGE_LOCATION_MAX_LENGTH = 2048;
|
|
57
|
+
/** page 위치 형식 검사. 맞으면 path·search만 담은 새 객체, 아니면 undefined. 호스트·프레임 공용. */
|
|
58
|
+
declare function toPageLocation(value: unknown): PageLocationState | undefined;
|
|
47
59
|
interface SlotState {
|
|
48
60
|
readonly id: string;
|
|
49
61
|
readonly context: unknown;
|
|
@@ -61,7 +73,7 @@ type BridgeTranslations = Readonly<Record<string, string>>;
|
|
|
61
73
|
/**
|
|
62
74
|
* `res:init` payload. 회원 id·이메일·토큰은 넣지 않는다.
|
|
63
75
|
* `translations`는 현재 locale 사전(선택, 브리지 프로토콜) — core i18n이 CDN 대신 이 값을 쓴다.
|
|
64
|
-
* `placementId`는 호스트가 만든 스코프 키다(예: `page:{경로}
|
|
76
|
+
* `placementId`는 호스트가 만든 스코프 키다(예: 페이지 `page:{경로}`, 위젯 `slot:{id}|{url}`).
|
|
65
77
|
*/
|
|
66
78
|
interface BridgeInit {
|
|
67
79
|
readonly placementId: string;
|
|
@@ -83,6 +95,11 @@ interface BridgeInit {
|
|
|
83
95
|
readonly limits: BridgeLimits;
|
|
84
96
|
readonly partnerOrigins: readonly string[];
|
|
85
97
|
readonly translations?: BridgeTranslations;
|
|
98
|
+
/**
|
|
99
|
+
* 호스트 페이지의 현재 경로·쿼리. 호스트가 싣기로 한 배치에만 있다(계정 세션 배치·플랫폼 인증 콜백 경로에는
|
|
100
|
+
* 싣지 않는다 — 판단은 호스트 몫). 이후 변화는 `page` 이벤트로 온다. 없는 옛 호스트도 있다.
|
|
101
|
+
*/
|
|
102
|
+
readonly page?: PageLocationState;
|
|
86
103
|
/** 이 배치에 허용된 기능. 알려진 값만 싣는다(`ACCOUNT_SESSION_CAPABILITY`). 없으면 필드 자체가 없다. */
|
|
87
104
|
readonly capabilities?: readonly string[];
|
|
88
105
|
/** 아래 계정 필드는 `account-session` 권한이 있는 배치에만 실린다. */
|
|
@@ -225,6 +242,13 @@ interface BridgeRequestMap {
|
|
|
225
242
|
};
|
|
226
243
|
res: Record<string, never>;
|
|
227
244
|
};
|
|
245
|
+
/** 같은 탭에서 외부 https 사이트로 이동. 호스트가 확인 창을 띄우고 거절할 수 있다. */
|
|
246
|
+
navigateExternal: {
|
|
247
|
+
req: {
|
|
248
|
+
readonly url: string;
|
|
249
|
+
};
|
|
250
|
+
res: Record<string, never>;
|
|
251
|
+
};
|
|
228
252
|
toast: {
|
|
229
253
|
req: {
|
|
230
254
|
readonly message: string;
|
|
@@ -287,6 +311,7 @@ interface BridgeEventMap {
|
|
|
287
311
|
visibility: {
|
|
288
312
|
readonly visible: boolean;
|
|
289
313
|
};
|
|
314
|
+
page: PageLocationState;
|
|
290
315
|
}
|
|
291
316
|
/** `res` payload — 성공이면 `data`, 실패면 코드만 담긴 `error`. */
|
|
292
317
|
type BridgeResult<T> = {
|
|
@@ -308,4 +333,4 @@ declare const IFRAME_ATTRIBUTES: {
|
|
|
308
333
|
declare function isRequestType(value: unknown): value is BridgeRequestType;
|
|
309
334
|
declare function isHostEventType(value: unknown): value is BridgeHostEventType;
|
|
310
335
|
|
|
311
|
-
export {
|
|
336
|
+
export { type ToastKind as $, ACCOUNT_SESSION_CAPABILITY as A, BRIDGE_ERROR_CODES as B, REPORT_MAX_FRAMES as C, REPORT_MESSAGE_MAX_LENGTH as D, REQUEST_TIMEOUT_MS as E, FRAME_UNLOAD_EVENT as F, REQUEST_TYPES as G, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, type ReverificationStatus as J, KNOWN_CAPABILITIES as K, type LogLevel as L, type MemberState as M, type NavigateOptions as N, OTP_OPS as O, PAGE_LOCATION_MAX_LENGTH as P, type SessionOp as Q, READY_EVENT as R, SESSION_OPS as S, type SessionRequest as T, type SessionResult as U, type SlotState as V, type StorageOp as W, TEMPLATE_REPORT_KINDS as X, type TemplateReport as Y, type TemplateReportKind as Z, type ThemeState as _, type AccountHostQuery as a, type WithSession as a0, isBridgeErrorCode as a1, isBridgeErrorLike as a2, isBridgeSurface as a3, isHostEventType as a4, isRequestType as a5, toPageLocation as a6, type AccountSpaceInfo as b, BRIDGE_SURFACES as c, BridgeError as d, type BridgeErrorCode as e, type BridgeErrorLike as f, type BridgeEventMap as g, type BridgeHostEventType as h, type BridgeInit as i, type BridgeLimits as j, type BridgeRequestMap as k, type BridgeRequestType as l, type BridgeResult as m, type BridgeSurface as n, type BridgeTranslations as o, type FetchRequest as p, type FetchResult as q, INIT_RESPONSE as r, type OtpOp as s, type OtpPurpose as t, type OtpRequest as u, type OtpResult as v, type PageLocationState as w, REPORTS_PER_SESSION as x, REPORT_COUNT_MAX as y, REPORT_FRAME_MAX_LENGTH as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bstage-sdk/bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "bstage SDK bridge — isolated template iframe protocol, host policy and frame client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"tsup": "^8.0.0",
|
|
64
64
|
"typescript": "^5.5.0",
|
|
65
|
-
"@bstage-sdk/design": "0.
|
|
65
|
+
"@bstage-sdk/design": "0.17.0"
|
|
66
66
|
},
|
|
67
67
|
"license": "MIT",
|
|
68
68
|
"scripts": {
|