@bstage-sdk/bridge 0.14.2 → 0.15.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/dist/index.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ ACCOUNT_SESSION_CAPABILITY: () => ACCOUNT_SESSION_CAPABILITY,
23
24
  BRIDGE_ERROR_CODES: () => BRIDGE_ERROR_CODES,
24
25
  BRIDGE_NAMESPACE: () => BRIDGE_NAMESPACE,
25
26
  BRIDGE_SURFACES: () => BRIDGE_SURFACES,
@@ -29,10 +30,12 @@ __export(src_exports, {
29
30
  HOST_EVENT_TYPES: () => HOST_EVENT_TYPES,
30
31
  IFRAME_ATTRIBUTES: () => IFRAME_ATTRIBUTES,
31
32
  INIT_RESPONSE: () => INIT_RESPONSE,
33
+ KNOWN_CAPABILITIES: () => KNOWN_CAPABILITIES,
32
34
  MAX_ELEMENT_NAME_LENGTH: () => MAX_ELEMENT_NAME_LENGTH,
33
35
  MAX_ENVELOPE_ID_LENGTH: () => MAX_ENVELOPE_ID_LENGTH,
34
36
  MAX_ENVELOPE_TYPE_LENGTH: () => MAX_ENVELOPE_TYPE_LENGTH,
35
37
  MAX_MEDIA_ORIGINS: () => MAX_MEDIA_ORIGINS,
38
+ OTP_OPS: () => OTP_OPS,
36
39
  READY_EVENT: () => READY_EVENT,
37
40
  REPORTS_PER_SESSION: () => REPORTS_PER_SESSION,
38
41
  REPORT_COUNT_MAX: () => REPORT_COUNT_MAX,
@@ -42,6 +45,7 @@ __export(src_exports, {
42
45
  REPORT_MESSAGE_MAX_LENGTH: () => REPORT_MESSAGE_MAX_LENGTH,
43
46
  REQUEST_TIMEOUT_MS: () => REQUEST_TIMEOUT_MS,
44
47
  REQUEST_TYPES: () => REQUEST_TYPES,
48
+ SESSION_OPS: () => SESSION_OPS,
45
49
  TEMPLATE_REPORT_KINDS: () => TEMPLATE_REPORT_KINDS,
46
50
  buildFrameCsp: () => buildFrameCsp,
47
51
  createEnvelope: () => createEnvelope,
@@ -90,7 +94,9 @@ var BRIDGE_ERROR_CODES = [
90
94
  "BAD_REQUEST",
91
95
  "TIMEOUT",
92
96
  "NETWORK_ERROR",
93
- "UNSUPPORTED"
97
+ "UNSUPPORTED",
98
+ // 권한(capability) 없는 배치의 계정 요청, 또는 결속 조건을 벗어난 세션 요청.
99
+ "NOT_ALLOWED"
94
100
  ];
95
101
  var BridgeError = class extends Error {
96
102
  constructor(code, message) {
@@ -118,7 +124,9 @@ var REQUEST_TYPES = [
118
124
  "track",
119
125
  "storage",
120
126
  "log",
121
- "report"
127
+ "report",
128
+ "session",
129
+ "otp"
122
130
  ];
123
131
  var HOST_EVENT_TYPES = ["slot.context", "locale", "member", "theme", "visibility"];
124
132
  var READY_EVENT = "ready";
@@ -128,6 +136,15 @@ var BRIDGE_SURFACES = ["page", "slot"];
128
136
  function isBridgeSurface(value) {
129
137
  return BRIDGE_SURFACES.includes(value);
130
138
  }
139
+ var ACCOUNT_SESSION_CAPABILITY = "account-session";
140
+ var KNOWN_CAPABILITIES = [ACCOUNT_SESSION_CAPABILITY];
141
+ var SESSION_OPS = ["signup", "signupSocial", "loginAfterSignup", "phoneReverify"];
142
+ var OTP_OPS = [
143
+ "sendSignup",
144
+ "sendPhoneChange",
145
+ "verifySignup",
146
+ "verifyPhoneChange"
147
+ ];
131
148
  var TEMPLATE_REPORT_KINDS = ["error", "rejection", "load"];
132
149
  var REPORT_MESSAGE_MAX_LENGTH = 300;
133
150
  var REPORT_MAX_FRAMES = 10;
@@ -1025,6 +1042,7 @@ ${script}
1025
1042
  }
1026
1043
  // Annotate the CommonJS export names for ESM import in node:
1027
1044
  0 && (module.exports = {
1045
+ ACCOUNT_SESSION_CAPABILITY,
1028
1046
  BRIDGE_ERROR_CODES,
1029
1047
  BRIDGE_NAMESPACE,
1030
1048
  BRIDGE_SURFACES,
@@ -1034,10 +1052,12 @@ ${script}
1034
1052
  HOST_EVENT_TYPES,
1035
1053
  IFRAME_ATTRIBUTES,
1036
1054
  INIT_RESPONSE,
1055
+ KNOWN_CAPABILITIES,
1037
1056
  MAX_ELEMENT_NAME_LENGTH,
1038
1057
  MAX_ENVELOPE_ID_LENGTH,
1039
1058
  MAX_ENVELOPE_TYPE_LENGTH,
1040
1059
  MAX_MEDIA_ORIGINS,
1060
+ OTP_OPS,
1041
1061
  READY_EVENT,
1042
1062
  REPORTS_PER_SESSION,
1043
1063
  REPORT_COUNT_MAX,
@@ -1047,6 +1067,7 @@ ${script}
1047
1067
  REPORT_MESSAGE_MAX_LENGTH,
1048
1068
  REQUEST_TIMEOUT_MS,
1049
1069
  REQUEST_TYPES,
1070
+ SESSION_OPS,
1050
1071
  TEMPLATE_REPORT_KINDS,
1051
1072
  buildFrameCsp,
1052
1073
  createEnvelope,
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BRIDGE_ERROR_CODES, a as BRIDGE_SURFACES, b as BridgeError, c as BridgeErrorCode, d as BridgeErrorLike, e as BridgeEventMap, f as BridgeHostEventType, g as BridgeInit, h as BridgeLimits, i as BridgeRequestMap, j as BridgeRequestType, k as BridgeResult, l as BridgeSurface, m as BridgeTranslations, F as FRAME_UNLOAD_EVENT, n as FetchRequest, o as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, p as INIT_RESPONSE, L as LogLevel, M as MemberState, R as READY_EVENT, q as REPORTS_PER_SESSION, r as REPORT_COUNT_MAX, s as REPORT_FRAME_MAX_LENGTH, t as REPORT_MAX_FRAMES, u as REPORT_MESSAGE_MAX_LENGTH, v as REQUEST_TIMEOUT_MS, w as REQUEST_TYPES, S as SlotState, x as StorageOp, T as TEMPLATE_REPORT_KINDS, y as TemplateReport, z as TemplateReportKind, A as ThemeState, C as ToastKind, W as WithSession, D as isBridgeErrorCode, E as isBridgeErrorLike, G as isBridgeSurface, J as isHostEventType, K as isRequestType } from './messages-Cdjpvu2S.cjs';
1
+ export { A as ACCOUNT_SESSION_CAPABILITY, a as AccountHostQuery, b as AccountSpaceInfo, B as BRIDGE_ERROR_CODES, c as BRIDGE_SURFACES, d as BridgeError, e as BridgeErrorCode, f as BridgeErrorLike, g as BridgeEventMap, h as BridgeHostEventType, i as BridgeInit, j as BridgeLimits, k as BridgeRequestMap, l as BridgeRequestType, m as BridgeResult, n as BridgeSurface, o as BridgeTranslations, F as FRAME_UNLOAD_EVENT, p as FetchRequest, q as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, r as INIT_RESPONSE, K as KNOWN_CAPABILITIES, L as LogLevel, M as MemberState, N as NavigateOptions, O as OTP_OPS, s as OtpOp, t as OtpPurpose, u as OtpRequest, v as OtpResult, R as READY_EVENT, w as REPORTS_PER_SESSION, x as REPORT_COUNT_MAX, y as REPORT_FRAME_MAX_LENGTH, z as REPORT_MAX_FRAMES, C as REPORT_MESSAGE_MAX_LENGTH, D as REQUEST_TIMEOUT_MS, E as REQUEST_TYPES, G as ReverificationStatus, S as SESSION_OPS, J as SessionOp, P as SessionRequest, Q as SessionResult, T as SlotState, U as StorageOp, V as TEMPLATE_REPORT_KINDS, W as TemplateReport, X as TemplateReportKind, Y as ThemeState, Z as ToastKind, _ as WithSession, $ as isBridgeErrorCode, a0 as isBridgeErrorLike, a1 as isBridgeSurface, a2 as isHostEventType, a3 as isRequestType } from './messages-_p1yCNj9.cjs';
2
2
  export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS, b as buildFrameCsp, c as createNonce, d as createSession, e as createSrcdoc, i as isValidNonce, f as isValidSession } from './createSrcdoc-DYZk6dDJ.cjs';
3
3
 
4
4
  /** 봉투 버전. 형식이 하위 호환되지 않게 바뀔 때만 올린다. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BRIDGE_ERROR_CODES, a as BRIDGE_SURFACES, b as BridgeError, c as BridgeErrorCode, d as BridgeErrorLike, e as BridgeEventMap, f as BridgeHostEventType, g as BridgeInit, h as BridgeLimits, i as BridgeRequestMap, j as BridgeRequestType, k as BridgeResult, l as BridgeSurface, m as BridgeTranslations, F as FRAME_UNLOAD_EVENT, n as FetchRequest, o as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, p as INIT_RESPONSE, L as LogLevel, M as MemberState, R as READY_EVENT, q as REPORTS_PER_SESSION, r as REPORT_COUNT_MAX, s as REPORT_FRAME_MAX_LENGTH, t as REPORT_MAX_FRAMES, u as REPORT_MESSAGE_MAX_LENGTH, v as REQUEST_TIMEOUT_MS, w as REQUEST_TYPES, S as SlotState, x as StorageOp, T as TEMPLATE_REPORT_KINDS, y as TemplateReport, z as TemplateReportKind, A as ThemeState, C as ToastKind, W as WithSession, D as isBridgeErrorCode, E as isBridgeErrorLike, G as isBridgeSurface, J as isHostEventType, K as isRequestType } from './messages-Cdjpvu2S.js';
1
+ export { A as ACCOUNT_SESSION_CAPABILITY, a as AccountHostQuery, b as AccountSpaceInfo, B as BRIDGE_ERROR_CODES, c as BRIDGE_SURFACES, d as BridgeError, e as BridgeErrorCode, f as BridgeErrorLike, g as BridgeEventMap, h as BridgeHostEventType, i as BridgeInit, j as BridgeLimits, k as BridgeRequestMap, l as BridgeRequestType, m as BridgeResult, n as BridgeSurface, o as BridgeTranslations, F as FRAME_UNLOAD_EVENT, p as FetchRequest, q as FetchResult, H as HOST_EVENT_TYPES, I as IFRAME_ATTRIBUTES, r as INIT_RESPONSE, K as KNOWN_CAPABILITIES, L as LogLevel, M as MemberState, N as NavigateOptions, O as OTP_OPS, s as OtpOp, t as OtpPurpose, u as OtpRequest, v as OtpResult, R as READY_EVENT, w as REPORTS_PER_SESSION, x as REPORT_COUNT_MAX, y as REPORT_FRAME_MAX_LENGTH, z as REPORT_MAX_FRAMES, C as REPORT_MESSAGE_MAX_LENGTH, D as REQUEST_TIMEOUT_MS, E as REQUEST_TYPES, G as ReverificationStatus, S as SESSION_OPS, J as SessionOp, P as SessionRequest, Q as SessionResult, T as SlotState, U as StorageOp, V as TEMPLATE_REPORT_KINDS, W as TemplateReport, X as TemplateReportKind, Y as ThemeState, Z as ToastKind, _ as WithSession, $ as isBridgeErrorCode, a0 as isBridgeErrorLike, a1 as isBridgeSurface, a2 as isHostEventType, a3 as isRequestType } from './messages-_p1yCNj9.js';
2
2
  export { C as CreateSrcdocOptions, M as MAX_ELEMENT_NAME_LENGTH, a as MAX_MEDIA_ORIGINS, R as REPORT_FLUSH_DELAY_MS, b as buildFrameCsp, c as createNonce, d as createSession, e as createSrcdoc, i as isValidNonce, f as isValidSession } from './createSrcdoc-DYZk6dDJ.js';
3
3
 
4
4
  /** 봉투 버전. 형식이 하위 호환되지 않게 바뀔 때만 올린다. */
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ ACCOUNT_SESSION_CAPABILITY,
2
3
  BRIDGE_ERROR_CODES,
3
4
  BRIDGE_NAMESPACE,
4
5
  BRIDGE_SURFACES,
@@ -8,10 +9,12 @@ import {
8
9
  HOST_EVENT_TYPES,
9
10
  IFRAME_ATTRIBUTES,
10
11
  INIT_RESPONSE,
12
+ KNOWN_CAPABILITIES,
11
13
  MAX_ELEMENT_NAME_LENGTH,
12
14
  MAX_ENVELOPE_ID_LENGTH,
13
15
  MAX_ENVELOPE_TYPE_LENGTH,
14
16
  MAX_MEDIA_ORIGINS,
17
+ OTP_OPS,
15
18
  READY_EVENT,
16
19
  REPORTS_PER_SESSION,
17
20
  REPORT_COUNT_MAX,
@@ -21,6 +24,7 @@ import {
21
24
  REPORT_MESSAGE_MAX_LENGTH,
22
25
  REQUEST_TIMEOUT_MS,
23
26
  REQUEST_TYPES,
27
+ SESSION_OPS,
24
28
  TEMPLATE_REPORT_KINDS,
25
29
  buildFrameCsp,
26
30
  createEnvelope,
@@ -36,9 +40,10 @@ import {
36
40
  isRequestType,
37
41
  isValidNonce,
38
42
  isValidSession
39
- } from "./chunk-5OWBSJ6E.js";
43
+ } from "./chunk-GWUVHC56.js";
40
44
  import "./chunk-TPKNGW34.js";
41
45
  export {
46
+ ACCOUNT_SESSION_CAPABILITY,
42
47
  BRIDGE_ERROR_CODES,
43
48
  BRIDGE_NAMESPACE,
44
49
  BRIDGE_SURFACES,
@@ -48,10 +53,12 @@ export {
48
53
  HOST_EVENT_TYPES,
49
54
  IFRAME_ATTRIBUTES,
50
55
  INIT_RESPONSE,
56
+ KNOWN_CAPABILITIES,
51
57
  MAX_ELEMENT_NAME_LENGTH,
52
58
  MAX_ENVELOPE_ID_LENGTH,
53
59
  MAX_ENVELOPE_TYPE_LENGTH,
54
60
  MAX_MEDIA_ORIGINS,
61
+ OTP_OPS,
55
62
  READY_EVENT,
56
63
  REPORTS_PER_SESSION,
57
64
  REPORT_COUNT_MAX,
@@ -61,6 +68,7 @@ export {
61
68
  REPORT_MESSAGE_MAX_LENGTH,
62
69
  REQUEST_TIMEOUT_MS,
63
70
  REQUEST_TYPES,
71
+ SESSION_OPS,
64
72
  TEMPLATE_REPORT_KINDS,
65
73
  buildFrameCsp,
66
74
  createEnvelope,
@@ -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"];
2
+ declare const BRIDGE_ERROR_CODES: readonly ["FORBIDDEN_DESTINATION", "FORBIDDEN_METHOD", "BODY_TOO_LARGE", "RATE_LIMITED", "BAD_REQUEST", "TIMEOUT", "NETWORK_ERROR", "UNSUPPORTED", "NOT_ALLOWED"];
3
3
  type BridgeErrorCode = (typeof BRIDGE_ERROR_CODES)[number];
4
4
  /** 코드가 붙은 브리지 오류. 호스트는 이 코드만 프레임에 돌려준다(내부 예외 메시지는 싣지 않는다). */
5
5
  declare class BridgeError extends Error {
@@ -19,7 +19,7 @@ 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"];
22
+ declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "toast", "resize", "track", "storage", "log", "report", "session", "otp"];
23
23
  type BridgeRequestType = (typeof REQUEST_TYPES)[number];
24
24
  /** 호스트 → 프레임 이벤트 종류. */
25
25
  declare const HOST_EVENT_TYPES: readonly ["slot.context", "locale", "member", "theme", "visibility"];
@@ -83,6 +83,85 @@ interface BridgeInit {
83
83
  readonly limits: BridgeLimits;
84
84
  readonly partnerOrigins: readonly string[];
85
85
  readonly translations?: BridgeTranslations;
86
+ /** 이 배치에 허용된 기능. 알려진 값만 싣는다(`ACCOUNT_SESSION_CAPABILITY`). 없으면 필드 자체가 없다. */
87
+ readonly capabilities?: readonly string[];
88
+ /** 아래 계정 필드는 `account-session` 권한이 있는 배치에만 실린다. */
89
+ readonly query?: AccountHostQuery;
90
+ /** 호스트의 국가 코드(가입 폼 기본 국가). */
91
+ readonly country?: string;
92
+ readonly space?: AccountSpaceInfo;
93
+ /** 재인증 임시토큰 보관 상태. 토큰 값은 싣지 않는다. */
94
+ readonly reverification?: ReverificationStatus;
95
+ }
96
+ /** 계정 세션 요청(session·otp)을 여는 배치 권한. 호스트가 이 값을 받아야만 처리한다(fail-closed). */
97
+ declare const ACCOUNT_SESSION_CAPABILITY = "account-session";
98
+ /** init.capabilities에 실을 수 있는 값. 그 밖의 값은 버린다. */
99
+ declare const KNOWN_CAPABILITIES: readonly string[];
100
+ /** 호스트 URL 쿼리 중 프레임에 주는 키(허용 목록). OAuth `code`·`state`는 싣지 않는다. */
101
+ interface AccountHostQuery {
102
+ readonly socialType?: string;
103
+ }
104
+ interface AccountSpaceInfo {
105
+ readonly title?: string;
106
+ readonly corporation?: {
107
+ readonly name?: string;
108
+ readonly country?: string;
109
+ };
110
+ }
111
+ interface ReverificationStatus {
112
+ readonly available: boolean;
113
+ readonly expiresAt?: string;
114
+ }
115
+ /** 호스트가 대신 호출하는 계정 세션 작업. 엔드포인트는 호스트가 고정한다. */
116
+ declare const SESSION_OPS: readonly ["signup", "signupSocial", "loginAfterSignup", "phoneReverify"];
117
+ type SessionOp = (typeof SESSION_OPS)[number];
118
+ /** SMS OTP 작업. 목적(purpose)은 op로 호스트가 고정한다 — 프레임이 고르지 않는다. */
119
+ declare const OTP_OPS: readonly ["sendSignup", "sendPhoneChange", "verifySignup", "verifyPhoneChange"];
120
+ type OtpOp = (typeof OTP_OPS)[number];
121
+ type OtpPurpose = 'SIGNUP' | 'PHONE_CHANGE';
122
+ interface SessionRequest {
123
+ readonly op: SessionOp;
124
+ readonly body: Readonly<Record<string, unknown>>;
125
+ }
126
+ /**
127
+ * `session` 결과. 토큰·회원 식별자는 싣지 않는다(허용 목록). `next`가 있으면 프레임 SDK가
128
+ * 그 경로로 전체 리로드 이동을 요청한다(호스트가 새 로그인 상태로 페이지를 다시 그리게).
129
+ */
130
+ interface SessionResult {
131
+ readonly ok: boolean;
132
+ readonly status?: string;
133
+ readonly code?: number;
134
+ readonly message?: string;
135
+ readonly httpStatus?: number;
136
+ /** signup·signupSocial 성공 시 가입 시각. */
137
+ readonly createdAt?: string;
138
+ readonly next?: {
139
+ readonly path: string;
140
+ readonly reload: true;
141
+ };
142
+ }
143
+ interface OtpRequest {
144
+ readonly op: OtpOp;
145
+ readonly body: Readonly<Record<string, unknown>>;
146
+ }
147
+ interface OtpResult {
148
+ readonly ok: boolean;
149
+ /** 게이트웨이 HTTP 상태. 응답을 받지 못했으면 0. */
150
+ readonly status: number;
151
+ readonly data?: Readonly<Record<string, string | number>>;
152
+ readonly error?: {
153
+ readonly code?: string;
154
+ readonly message?: {
155
+ readonly en?: string;
156
+ readonly vi?: string;
157
+ };
158
+ readonly retryAfterSeconds?: number;
159
+ };
160
+ }
161
+ /** navigate 옵션. `reload`는 같은 origin 경로로 전체 리로드 이동(로그인 직후 등). */
162
+ interface NavigateOptions {
163
+ readonly replace?: boolean;
164
+ readonly reload?: boolean;
86
165
  }
87
166
  interface FetchRequest {
88
167
  readonly url: string;
@@ -133,7 +212,7 @@ interface BridgeRequestMap {
133
212
  navigate: {
134
213
  req: {
135
214
  readonly path: string;
136
- };
215
+ } & NavigateOptions;
137
216
  res: Record<string, never>;
138
217
  };
139
218
  back: {
@@ -187,6 +266,14 @@ interface BridgeRequestMap {
187
266
  req: TemplateReport;
188
267
  res: Record<string, never>;
189
268
  };
269
+ session: {
270
+ req: SessionRequest;
271
+ res: SessionResult;
272
+ };
273
+ otp: {
274
+ req: OtpRequest;
275
+ res: OtpResult;
276
+ };
190
277
  }
191
278
  /** 이벤트 type별 payload. */
192
279
  interface BridgeEventMap {
@@ -221,4 +308,4 @@ declare const IFRAME_ATTRIBUTES: {
221
308
  declare function isRequestType(value: unknown): value is BridgeRequestType;
222
309
  declare function isHostEventType(value: unknown): value is BridgeHostEventType;
223
310
 
224
- export { type ThemeState as A, BRIDGE_ERROR_CODES as B, type ToastKind as C, isBridgeErrorCode as D, isBridgeErrorLike as E, FRAME_UNLOAD_EVENT as F, isBridgeSurface as G, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, isHostEventType as J, isRequestType as K, type LogLevel as L, type MemberState as M, READY_EVENT as R, type SlotState as S, TEMPLATE_REPORT_KINDS as T, type WithSession as W, BRIDGE_SURFACES as a, BridgeError as b, type BridgeErrorCode as c, type BridgeErrorLike as d, type BridgeEventMap as e, type BridgeHostEventType as f, type BridgeInit as g, type BridgeLimits as h, type BridgeRequestMap as i, type BridgeRequestType as j, type BridgeResult as k, type BridgeSurface as l, type BridgeTranslations as m, type FetchRequest as n, type FetchResult as o, INIT_RESPONSE as p, REPORTS_PER_SESSION as q, REPORT_COUNT_MAX as r, REPORT_FRAME_MAX_LENGTH as s, REPORT_MAX_FRAMES as t, REPORT_MESSAGE_MAX_LENGTH as u, REQUEST_TIMEOUT_MS as v, REQUEST_TYPES as w, type StorageOp as x, type TemplateReport as y, type TemplateReportKind as z };
311
+ export { isBridgeErrorCode as $, ACCOUNT_SESSION_CAPABILITY as A, BRIDGE_ERROR_CODES as B, REPORT_MESSAGE_MAX_LENGTH as C, REQUEST_TIMEOUT_MS as D, REQUEST_TYPES as E, FRAME_UNLOAD_EVENT as F, type ReverificationStatus as G, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, type SessionOp as J, KNOWN_CAPABILITIES as K, type LogLevel as L, type MemberState as M, type NavigateOptions as N, OTP_OPS as O, type SessionRequest as P, type SessionResult as Q, READY_EVENT as R, SESSION_OPS as S, type SlotState as T, type StorageOp as U, TEMPLATE_REPORT_KINDS as V, type TemplateReport as W, type TemplateReportKind as X, type ThemeState as Y, type ToastKind as Z, type WithSession as _, type AccountHostQuery as a, isBridgeErrorLike as a0, isBridgeSurface as a1, isHostEventType as a2, isRequestType as a3, 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, REPORTS_PER_SESSION as w, REPORT_COUNT_MAX as x, REPORT_FRAME_MAX_LENGTH as y, REPORT_MAX_FRAMES as z };
@@ -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"];
2
+ declare const BRIDGE_ERROR_CODES: readonly ["FORBIDDEN_DESTINATION", "FORBIDDEN_METHOD", "BODY_TOO_LARGE", "RATE_LIMITED", "BAD_REQUEST", "TIMEOUT", "NETWORK_ERROR", "UNSUPPORTED", "NOT_ALLOWED"];
3
3
  type BridgeErrorCode = (typeof BRIDGE_ERROR_CODES)[number];
4
4
  /** 코드가 붙은 브리지 오류. 호스트는 이 코드만 프레임에 돌려준다(내부 예외 메시지는 싣지 않는다). */
5
5
  declare class BridgeError extends Error {
@@ -19,7 +19,7 @@ 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"];
22
+ declare const REQUEST_TYPES: readonly ["fetch", "navigate", "back", "openExternal", "toast", "resize", "track", "storage", "log", "report", "session", "otp"];
23
23
  type BridgeRequestType = (typeof REQUEST_TYPES)[number];
24
24
  /** 호스트 → 프레임 이벤트 종류. */
25
25
  declare const HOST_EVENT_TYPES: readonly ["slot.context", "locale", "member", "theme", "visibility"];
@@ -83,6 +83,85 @@ interface BridgeInit {
83
83
  readonly limits: BridgeLimits;
84
84
  readonly partnerOrigins: readonly string[];
85
85
  readonly translations?: BridgeTranslations;
86
+ /** 이 배치에 허용된 기능. 알려진 값만 싣는다(`ACCOUNT_SESSION_CAPABILITY`). 없으면 필드 자체가 없다. */
87
+ readonly capabilities?: readonly string[];
88
+ /** 아래 계정 필드는 `account-session` 권한이 있는 배치에만 실린다. */
89
+ readonly query?: AccountHostQuery;
90
+ /** 호스트의 국가 코드(가입 폼 기본 국가). */
91
+ readonly country?: string;
92
+ readonly space?: AccountSpaceInfo;
93
+ /** 재인증 임시토큰 보관 상태. 토큰 값은 싣지 않는다. */
94
+ readonly reverification?: ReverificationStatus;
95
+ }
96
+ /** 계정 세션 요청(session·otp)을 여는 배치 권한. 호스트가 이 값을 받아야만 처리한다(fail-closed). */
97
+ declare const ACCOUNT_SESSION_CAPABILITY = "account-session";
98
+ /** init.capabilities에 실을 수 있는 값. 그 밖의 값은 버린다. */
99
+ declare const KNOWN_CAPABILITIES: readonly string[];
100
+ /** 호스트 URL 쿼리 중 프레임에 주는 키(허용 목록). OAuth `code`·`state`는 싣지 않는다. */
101
+ interface AccountHostQuery {
102
+ readonly socialType?: string;
103
+ }
104
+ interface AccountSpaceInfo {
105
+ readonly title?: string;
106
+ readonly corporation?: {
107
+ readonly name?: string;
108
+ readonly country?: string;
109
+ };
110
+ }
111
+ interface ReverificationStatus {
112
+ readonly available: boolean;
113
+ readonly expiresAt?: string;
114
+ }
115
+ /** 호스트가 대신 호출하는 계정 세션 작업. 엔드포인트는 호스트가 고정한다. */
116
+ declare const SESSION_OPS: readonly ["signup", "signupSocial", "loginAfterSignup", "phoneReverify"];
117
+ type SessionOp = (typeof SESSION_OPS)[number];
118
+ /** SMS OTP 작업. 목적(purpose)은 op로 호스트가 고정한다 — 프레임이 고르지 않는다. */
119
+ declare const OTP_OPS: readonly ["sendSignup", "sendPhoneChange", "verifySignup", "verifyPhoneChange"];
120
+ type OtpOp = (typeof OTP_OPS)[number];
121
+ type OtpPurpose = 'SIGNUP' | 'PHONE_CHANGE';
122
+ interface SessionRequest {
123
+ readonly op: SessionOp;
124
+ readonly body: Readonly<Record<string, unknown>>;
125
+ }
126
+ /**
127
+ * `session` 결과. 토큰·회원 식별자는 싣지 않는다(허용 목록). `next`가 있으면 프레임 SDK가
128
+ * 그 경로로 전체 리로드 이동을 요청한다(호스트가 새 로그인 상태로 페이지를 다시 그리게).
129
+ */
130
+ interface SessionResult {
131
+ readonly ok: boolean;
132
+ readonly status?: string;
133
+ readonly code?: number;
134
+ readonly message?: string;
135
+ readonly httpStatus?: number;
136
+ /** signup·signupSocial 성공 시 가입 시각. */
137
+ readonly createdAt?: string;
138
+ readonly next?: {
139
+ readonly path: string;
140
+ readonly reload: true;
141
+ };
142
+ }
143
+ interface OtpRequest {
144
+ readonly op: OtpOp;
145
+ readonly body: Readonly<Record<string, unknown>>;
146
+ }
147
+ interface OtpResult {
148
+ readonly ok: boolean;
149
+ /** 게이트웨이 HTTP 상태. 응답을 받지 못했으면 0. */
150
+ readonly status: number;
151
+ readonly data?: Readonly<Record<string, string | number>>;
152
+ readonly error?: {
153
+ readonly code?: string;
154
+ readonly message?: {
155
+ readonly en?: string;
156
+ readonly vi?: string;
157
+ };
158
+ readonly retryAfterSeconds?: number;
159
+ };
160
+ }
161
+ /** navigate 옵션. `reload`는 같은 origin 경로로 전체 리로드 이동(로그인 직후 등). */
162
+ interface NavigateOptions {
163
+ readonly replace?: boolean;
164
+ readonly reload?: boolean;
86
165
  }
87
166
  interface FetchRequest {
88
167
  readonly url: string;
@@ -133,7 +212,7 @@ interface BridgeRequestMap {
133
212
  navigate: {
134
213
  req: {
135
214
  readonly path: string;
136
- };
215
+ } & NavigateOptions;
137
216
  res: Record<string, never>;
138
217
  };
139
218
  back: {
@@ -187,6 +266,14 @@ interface BridgeRequestMap {
187
266
  req: TemplateReport;
188
267
  res: Record<string, never>;
189
268
  };
269
+ session: {
270
+ req: SessionRequest;
271
+ res: SessionResult;
272
+ };
273
+ otp: {
274
+ req: OtpRequest;
275
+ res: OtpResult;
276
+ };
190
277
  }
191
278
  /** 이벤트 type별 payload. */
192
279
  interface BridgeEventMap {
@@ -221,4 +308,4 @@ declare const IFRAME_ATTRIBUTES: {
221
308
  declare function isRequestType(value: unknown): value is BridgeRequestType;
222
309
  declare function isHostEventType(value: unknown): value is BridgeHostEventType;
223
310
 
224
- export { type ThemeState as A, BRIDGE_ERROR_CODES as B, type ToastKind as C, isBridgeErrorCode as D, isBridgeErrorLike as E, FRAME_UNLOAD_EVENT as F, isBridgeSurface as G, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, isHostEventType as J, isRequestType as K, type LogLevel as L, type MemberState as M, READY_EVENT as R, type SlotState as S, TEMPLATE_REPORT_KINDS as T, type WithSession as W, BRIDGE_SURFACES as a, BridgeError as b, type BridgeErrorCode as c, type BridgeErrorLike as d, type BridgeEventMap as e, type BridgeHostEventType as f, type BridgeInit as g, type BridgeLimits as h, type BridgeRequestMap as i, type BridgeRequestType as j, type BridgeResult as k, type BridgeSurface as l, type BridgeTranslations as m, type FetchRequest as n, type FetchResult as o, INIT_RESPONSE as p, REPORTS_PER_SESSION as q, REPORT_COUNT_MAX as r, REPORT_FRAME_MAX_LENGTH as s, REPORT_MAX_FRAMES as t, REPORT_MESSAGE_MAX_LENGTH as u, REQUEST_TIMEOUT_MS as v, REQUEST_TYPES as w, type StorageOp as x, type TemplateReport as y, type TemplateReportKind as z };
311
+ export { isBridgeErrorCode as $, ACCOUNT_SESSION_CAPABILITY as A, BRIDGE_ERROR_CODES as B, REPORT_MESSAGE_MAX_LENGTH as C, REQUEST_TIMEOUT_MS as D, REQUEST_TYPES as E, FRAME_UNLOAD_EVENT as F, type ReverificationStatus as G, HOST_EVENT_TYPES as H, IFRAME_ATTRIBUTES as I, type SessionOp as J, KNOWN_CAPABILITIES as K, type LogLevel as L, type MemberState as M, type NavigateOptions as N, OTP_OPS as O, type SessionRequest as P, type SessionResult as Q, READY_EVENT as R, SESSION_OPS as S, type SlotState as T, type StorageOp as U, TEMPLATE_REPORT_KINDS as V, type TemplateReport as W, type TemplateReportKind as X, type ThemeState as Y, type ToastKind as Z, type WithSession as _, type AccountHostQuery as a, isBridgeErrorLike as a0, isBridgeSurface as a1, isHostEventType as a2, isRequestType as a3, 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, REPORTS_PER_SESSION as w, REPORT_COUNT_MAX as x, REPORT_FRAME_MAX_LENGTH as y, REPORT_MAX_FRAMES as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bstage-sdk/bridge",
3
- "version": "0.14.2",
3
+ "version": "0.15.0",
4
4
  "description": "bstage SDK bridge — isolated template iframe protocol, host policy and frame client",
5
5
  "type": "module",
6
6
  "publishConfig": {