@bstage-sdk/bridge 0.16.0 → 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
package/dist/host.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as BridgeHostEventType, g as BridgeEventMap, N as NavigateOptions,
|
|
2
|
-
export { A as ACCOUNT_SESSION_CAPABILITY, c as BRIDGE_SURFACES, I as IFRAME_ATTRIBUTES,
|
|
1
|
+
import { h as BridgeHostEventType, g as BridgeEventMap, N as NavigateOptions, $ as ToastKind, L as LogLevel, n as BridgeSurface, _ as ThemeState, V as SlotState, M as MemberState, o as BridgeTranslations, w as PageLocationState, a as AccountHostQuery, b as AccountSpaceInfo, J as ReverificationStatus, Q as SessionOp, s as OtpOp, t as OtpPurpose, Y as TemplateReport } from './messages-pMXAlatW.js';
|
|
2
|
+
export { A as ACCOUNT_SESSION_CAPABILITY, c as BRIDGE_SURFACES, I as IFRAME_ATTRIBUTES, x as REPORTS_PER_SESSION, Z as TemplateReportKind, a3 as isBridgeSurface } from './messages-pMXAlatW.js';
|
|
3
3
|
export { C as CreateSrcdocOptions, c as createNonce, d as createSession, e as createSrcdoc, f as isValidSession } from './createSrcdoc-DYZk6dDJ.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -30,6 +30,24 @@ interface AccountStateStore {
|
|
|
30
30
|
set(value: string): void;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** placement당 키 수 상한. */
|
|
34
|
+
declare const STORAGE_MAX_KEYS = 50;
|
|
35
|
+
/** 값 상한(문자열 길이, 브리지 프로토콜의 4KB). */
|
|
36
|
+
declare const STORAGE_MAX_VALUE_LENGTH = 4096;
|
|
37
|
+
/** 키 길이 상한 — 프로토콜에 정해지지 않은 값(구현 선택). */
|
|
38
|
+
declare const STORAGE_MAX_KEY_LENGTH = 200;
|
|
39
|
+
/**
|
|
40
|
+
* 호스트가 주입하는 storage 저장소(`CreateBridgeHostOptions.storageBackend`). 동기 API다.
|
|
41
|
+
* 키는 브리지가 만든 전체 키(`${scope}\u0000${key}`)이고, `keys(prefix)`는 그 접두사로 시작하는 **전체 키**를
|
|
42
|
+
* 돌려준다. 예외를 던지면 브리지가 처리한다 — set은 `STORAGE_UNAVAILABLE`, get은 없음(null), remove는 무시.
|
|
43
|
+
*/
|
|
44
|
+
interface StorageBackend {
|
|
45
|
+
get(key: string): string | null;
|
|
46
|
+
set(key: string, value: string): void;
|
|
47
|
+
remove(key: string): void;
|
|
48
|
+
keys(prefix: string): readonly string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
33
51
|
/** 호스트 fetch 정책. */
|
|
34
52
|
interface BridgePolicy {
|
|
35
53
|
/** 같은 origin에서 허용할 경로 접두사. 기본 `["/gw/"]`(`/gw` 정확 일치 포함). */
|
|
@@ -196,7 +214,7 @@ interface IframeLike {
|
|
|
196
214
|
* 호스트가 넘기는 init 원본. `hostOrigin`·`gatewayBase`·`limits`는 호스트 옵션·정책에서 채운다.
|
|
197
215
|
*/
|
|
198
216
|
interface BridgeInitInput {
|
|
199
|
-
/** 호스트가 만든 placement 스코프 키(예: `page:{경로}
|
|
217
|
+
/** 호스트가 만든 placement 스코프 키(예: 페이지 `page:{경로}`, 위젯 `slot:{id}|{url}`). storage 스코프에도 쓴다. */
|
|
200
218
|
readonly placementId: string;
|
|
201
219
|
/** 커스텀 페이지(`page`) 또는 슬롯 위젯(`slot`). 그 밖의 값은 생성 시 TypeError. */
|
|
202
220
|
readonly surface: BridgeSurface;
|
|
@@ -208,6 +226,12 @@ interface BridgeInitInput {
|
|
|
208
226
|
readonly member: MemberState;
|
|
209
227
|
readonly partnerOrigins: readonly string[];
|
|
210
228
|
readonly translations?: BridgeTranslations;
|
|
229
|
+
/**
|
|
230
|
+
* 호스트 페이지의 현재 경로(`/`로 시작)·쿼리(빈 문자열 또는 `?`로 시작), 각 2048자 이하. 형식이 틀리면 init에서 뺀다.
|
|
231
|
+
* 어느 배치에 실을지는 호스트가 정한다 — 계정 세션 배치·플랫폼 인증 콜백 경로(OAuth `code`·`state`가 쿼리에 있다)에는
|
|
232
|
+
* 싣지 말 것. 이후 변화는 `send('page', …)`로 보낸다.
|
|
233
|
+
*/
|
|
234
|
+
readonly page?: PageLocationState;
|
|
211
235
|
/**
|
|
212
236
|
* 이 배치에 허용된 기능. `account-session`이 있고 page 배치일 때만 계정 세션 요청(session·otp)을 처리한다.
|
|
213
237
|
* 판정 근거는 호스트가 가진 배치 설정이어야 한다 — manifest·프레임 메시지를 근거로 채우지 말 것.
|
|
@@ -257,6 +281,11 @@ interface BridgeHostHandlers {
|
|
|
257
281
|
readonly back?: () => void;
|
|
258
282
|
/** 없으면 `window.open(url, '_blank', 'noopener,noreferrer')`. */
|
|
259
283
|
readonly openExternal?: (url: string) => void;
|
|
284
|
+
/**
|
|
285
|
+
* 같은 탭 외부 이동(https만, userinfo 없음 — 검증된 href). 확인 창을 띄우고 사용자가 거절하면 이동하지 않는다.
|
|
286
|
+
* 없으면 `UNSUPPORTED`(window.open 등 기본 동작으로 대신하지 않는다).
|
|
287
|
+
*/
|
|
288
|
+
readonly navigateExternal?: (url: string) => void;
|
|
260
289
|
readonly toast?: (message: string, kind?: ToastKind) => void;
|
|
261
290
|
/** rAF로 디바운스된 높이(px, 0~200000). */
|
|
262
291
|
readonly resize?: (height: number) => void;
|
|
@@ -305,6 +334,13 @@ interface CreateBridgeHostOptions {
|
|
|
305
334
|
* sessionStorage(접근 불가면 메모리). 테스트·SSR에서 바꿔 끼운다.
|
|
306
335
|
*/
|
|
307
336
|
readonly accountStateStore?: AccountStateStore;
|
|
337
|
+
/**
|
|
338
|
+
* `storage` 요청의 저장소. 생략하면 페이지 세션 메모리(리로드하면 사라진다). 주입하면 그 저장소에
|
|
339
|
+
* `${spaceId}\u0000${placementId}\u0000${key}` 키로 쓴다(예: 호스트 localStorage 래퍼 — 리로드 뒤에도 남는다).
|
|
340
|
+
* 상한(placement당 키 50개·값 4096자·키 200자)은 같다. 템플릿이 쓰는 값이므로 토큰·시크릿·개인정보를 담는
|
|
341
|
+
* 저장소와 섞지 말 것.
|
|
342
|
+
*/
|
|
343
|
+
readonly storageBackend?: StorageBackend;
|
|
308
344
|
readonly policy?: Partial<BridgePolicy>;
|
|
309
345
|
/**
|
|
310
346
|
* 호스트가 dispose될 때 한 번 불린다. `frame-unload`(프레임 문서가 내려감)·`frame-mismatch`(토큰이 없거나 다른
|
|
@@ -378,4 +414,4 @@ interface PathCheck {
|
|
|
378
414
|
*/
|
|
379
415
|
declare function checkPath(pathname: string, options?: PathCheckOptions): PathCheck;
|
|
380
416
|
|
|
381
|
-
export { ALLOWED_METHODS, ALLOWED_REQUEST_HEADERS, type BridgeDisposeReason, type BridgeHost, type BridgeHostHandlers, type BridgeInitInput, type BridgePolicy, BridgeSurface, CREDENTIAL_HEADERS, type CreateBridgeHostOptions, DEFAULT_GATEWAY_DENY_SEGMENTS, DEFAULT_POLICY, type Destination, type DestinationContext, type DestinationKind, type FrameWindow, HOST_ONLY_HEADERS, type HostFetch, type HostWindow, type IframeLike, LOGIN_BINDING_MS, MAX_DECODE_PASSES, MAX_PARTNER_ORIGINS, MAX_PASS_THROUGH_HEADERS, type MessageEventLike, NavigateOptions, OTP_SEND_PER_MINUTE, OTP_VERIFY_PER_MINUTE, type OtpImpl, OtpOp, OtpPurpose, type PathCheck, type PathCheckOptions, type PreparedFetch, ROUTING_HEADERS, ROUTING_HEADER_PREFIXES, SESSION_PER_FRAME, SESSION_PER_MINUTE, type SessionImpl, SessionOp, TemplateReport, checkPath, classifyDestination, createBridgeHost, hasAccountCapability, isAllowedGatewayPath, normalizePartnerOrigins, normalizePinnedHeaders, prepareFetch, resolveDestination, resolvePolicy, stripTokenKeys };
|
|
417
|
+
export { ALLOWED_METHODS, ALLOWED_REQUEST_HEADERS, type BridgeDisposeReason, type BridgeHost, type BridgeHostHandlers, type BridgeInitInput, type BridgePolicy, BridgeSurface, CREDENTIAL_HEADERS, type CreateBridgeHostOptions, DEFAULT_GATEWAY_DENY_SEGMENTS, DEFAULT_POLICY, type Destination, type DestinationContext, type DestinationKind, type FrameWindow, HOST_ONLY_HEADERS, type HostFetch, type HostWindow, type IframeLike, LOGIN_BINDING_MS, MAX_DECODE_PASSES, MAX_PARTNER_ORIGINS, MAX_PASS_THROUGH_HEADERS, type MessageEventLike, NavigateOptions, OTP_SEND_PER_MINUTE, OTP_VERIFY_PER_MINUTE, type OtpImpl, OtpOp, OtpPurpose, PageLocationState, type PathCheck, type PathCheckOptions, type PreparedFetch, ROUTING_HEADERS, ROUTING_HEADER_PREFIXES, SESSION_PER_FRAME, SESSION_PER_MINUTE, STORAGE_MAX_KEYS, STORAGE_MAX_KEY_LENGTH, STORAGE_MAX_VALUE_LENGTH, type SessionImpl, SessionOp, type StorageBackend, TemplateReport, checkPath, classifyDestination, createBridgeHost, hasAccountCapability, isAllowedGatewayPath, normalizePartnerOrigins, normalizePinnedHeaders, prepareFetch, resolveDestination, resolvePolicy, stripTokenKeys };
|
package/dist/host.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
MAX_PARTNER_ORIGINS,
|
|
17
17
|
MAX_PASS_THROUGH_HEADERS,
|
|
18
18
|
OTP_OPS,
|
|
19
|
+
PAGE_LOCATION_MAX_LENGTH,
|
|
19
20
|
READY_EVENT,
|
|
20
21
|
REPORTS_PER_SESSION,
|
|
21
22
|
REPORT_COUNT_MAX,
|
|
@@ -45,9 +46,10 @@ import {
|
|
|
45
46
|
normalizePinnedHeaders,
|
|
46
47
|
prepareFetch,
|
|
47
48
|
resolveDestination,
|
|
48
|
-
resolvePolicy
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
resolvePolicy,
|
|
50
|
+
toPageLocation
|
|
51
|
+
} from "./chunk-LGCWV4TV.js";
|
|
52
|
+
import "./chunk-B3TKEEX3.js";
|
|
51
53
|
|
|
52
54
|
// src/host/rateLimiter.ts
|
|
53
55
|
var DEFAULT_WINDOW_MS = 6e4;
|
|
@@ -67,7 +69,7 @@ function createRateLimiter(max, windowMs = DEFAULT_WINDOW_MS) {
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
// src/host/validators.ts
|
|
70
|
-
var MAX_PATH_LENGTH =
|
|
72
|
+
var MAX_PATH_LENGTH = PAGE_LOCATION_MAX_LENGTH;
|
|
71
73
|
var TOAST_MAX_LENGTH = 500;
|
|
72
74
|
var TRACK_NAME_MAX_LENGTH = 100;
|
|
73
75
|
var TRACK_PARAMS_MAX_BYTES = 4096;
|
|
@@ -574,6 +576,10 @@ function sanitizeTranslations(value) {
|
|
|
574
576
|
)
|
|
575
577
|
);
|
|
576
578
|
}
|
|
579
|
+
function sanitizePage(value) {
|
|
580
|
+
const page = toPageLocation(value);
|
|
581
|
+
return page ? Object.freeze(page) : void 0;
|
|
582
|
+
}
|
|
577
583
|
function sanitizeEvent(type, payload) {
|
|
578
584
|
const p = obj2(payload);
|
|
579
585
|
switch (type) {
|
|
@@ -595,6 +601,8 @@ function sanitizeEvent(type, payload) {
|
|
|
595
601
|
const translations = sanitizeTranslations(p.translations);
|
|
596
602
|
return { locale: p.locale, ...translations ? { translations } : {} };
|
|
597
603
|
}
|
|
604
|
+
case "page":
|
|
605
|
+
return sanitizePage(p);
|
|
598
606
|
default:
|
|
599
607
|
throw new TypeError(`[bstage-bridge] \uC54C \uC218 \uC5C6\uB294 \uC774\uBCA4\uD2B8: ${String(type)}`);
|
|
600
608
|
}
|
|
@@ -602,6 +610,7 @@ function sanitizeEvent(type, payload) {
|
|
|
602
610
|
function buildInit(init, hostOrigin, partnerOrigins, policy) {
|
|
603
611
|
const slot = init.slot ? sanitizeSlot(init.slot) : void 0;
|
|
604
612
|
const translations = sanitizeTranslations(init.translations);
|
|
613
|
+
const page = hasAccountCapability(init) ? void 0 : sanitizePage(init.page);
|
|
605
614
|
return Object.freeze({
|
|
606
615
|
placementId: String(init.placementId),
|
|
607
616
|
surface: init.surface,
|
|
@@ -620,6 +629,7 @@ function buildInit(init, hostOrigin, partnerOrigins, policy) {
|
|
|
620
629
|
},
|
|
621
630
|
partnerOrigins,
|
|
622
631
|
...translations ? { translations } : {},
|
|
632
|
+
...page ? { page } : {},
|
|
623
633
|
...buildAccountInit(init)
|
|
624
634
|
});
|
|
625
635
|
}
|
|
@@ -640,6 +650,8 @@ function applyEvent(init, type, payload) {
|
|
|
640
650
|
return Object.freeze({ ...init, theme: payload });
|
|
641
651
|
case "slot.context":
|
|
642
652
|
return Object.freeze({ ...init, slot: payload });
|
|
653
|
+
case "page":
|
|
654
|
+
return Object.freeze({ ...init, page: payload });
|
|
643
655
|
default:
|
|
644
656
|
return init;
|
|
645
657
|
}
|
|
@@ -650,11 +662,61 @@ var STORAGE_MAX_KEYS = 50;
|
|
|
650
662
|
var STORAGE_MAX_VALUE_LENGTH = 4096;
|
|
651
663
|
var STORAGE_MAX_KEY_LENGTH = 200;
|
|
652
664
|
var stores = /* @__PURE__ */ new Map();
|
|
653
|
-
function
|
|
654
|
-
const { op, key, value } = req;
|
|
665
|
+
function assertKey(key) {
|
|
655
666
|
if (typeof key !== "string" || key.length === 0 || key.length > STORAGE_MAX_KEY_LENGTH) {
|
|
656
667
|
throw new BridgeError("BAD_REQUEST", "invalid storage key");
|
|
657
668
|
}
|
|
669
|
+
}
|
|
670
|
+
function assertValue(value) {
|
|
671
|
+
if (typeof value !== "string" || value.length > STORAGE_MAX_VALUE_LENGTH) {
|
|
672
|
+
throw new BridgeError("BAD_REQUEST", "invalid storage value");
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
var KEY_LIMIT = () => new BridgeError("BAD_REQUEST", "storage key limit reached");
|
|
676
|
+
var UNAVAILABLE = () => new BridgeError("STORAGE_UNAVAILABLE", "storage unavailable");
|
|
677
|
+
function handleBackendStorage(backend, scope, req) {
|
|
678
|
+
const { op, key, value } = req;
|
|
679
|
+
assertKey(key);
|
|
680
|
+
if (key.includes("\0")) throw new BridgeError("BAD_REQUEST", "invalid storage key");
|
|
681
|
+
const prefix = `${scope}\0`;
|
|
682
|
+
const fullKey = prefix + key;
|
|
683
|
+
if (op === "get") {
|
|
684
|
+
try {
|
|
685
|
+
const stored = backend.get(fullKey);
|
|
686
|
+
return { value: typeof stored === "string" ? stored : null };
|
|
687
|
+
} catch {
|
|
688
|
+
return { value: null };
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (op === "remove") {
|
|
692
|
+
try {
|
|
693
|
+
backend.remove(fullKey);
|
|
694
|
+
} catch {
|
|
695
|
+
}
|
|
696
|
+
return { value: null };
|
|
697
|
+
}
|
|
698
|
+
if (op === "set") {
|
|
699
|
+
assertValue(value);
|
|
700
|
+
let existing;
|
|
701
|
+
try {
|
|
702
|
+
existing = backend.keys(prefix);
|
|
703
|
+
} catch {
|
|
704
|
+
throw UNAVAILABLE();
|
|
705
|
+
}
|
|
706
|
+
if (!existing.includes(fullKey) && existing.length >= STORAGE_MAX_KEYS) throw KEY_LIMIT();
|
|
707
|
+
try {
|
|
708
|
+
backend.set(fullKey, value);
|
|
709
|
+
} catch {
|
|
710
|
+
throw UNAVAILABLE();
|
|
711
|
+
}
|
|
712
|
+
return { value };
|
|
713
|
+
}
|
|
714
|
+
throw new BridgeError("BAD_REQUEST", "invalid storage op");
|
|
715
|
+
}
|
|
716
|
+
function handleStorage(scope, req, backend) {
|
|
717
|
+
if (backend) return handleBackendStorage(backend, scope, req);
|
|
718
|
+
const { op, key, value } = req;
|
|
719
|
+
assertKey(key);
|
|
658
720
|
const current = stores.get(scope) ?? {};
|
|
659
721
|
const has = Object.prototype.hasOwnProperty.call(current, key);
|
|
660
722
|
if (op === "get") return { value: has ? current[key] : null };
|
|
@@ -666,12 +728,8 @@ function handleStorage(scope, req) {
|
|
|
666
728
|
return { value: null };
|
|
667
729
|
}
|
|
668
730
|
if (op === "set") {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
if (!has && Object.keys(current).length >= STORAGE_MAX_KEYS) {
|
|
673
|
-
throw new BridgeError("BAD_REQUEST", "storage key limit reached");
|
|
674
|
-
}
|
|
731
|
+
assertValue(value);
|
|
732
|
+
if (!has && Object.keys(current).length >= STORAGE_MAX_KEYS) throw KEY_LIMIT();
|
|
675
733
|
stores = new Map([...stores, [scope, { ...current, [key]: value }]]);
|
|
676
734
|
return { value };
|
|
677
735
|
}
|
|
@@ -684,6 +742,7 @@ var UNLIMITED_REQUESTS = ["resize"];
|
|
|
684
742
|
var EMPTY = Object.freeze({});
|
|
685
743
|
var MAX_IN_FLIGHT_FETCHES = 16;
|
|
686
744
|
var TOAST_PER_MINUTE = 5;
|
|
745
|
+
var NAVIGATE_EXTERNAL_PER_MINUTE = 3;
|
|
687
746
|
var READY_PER_SECOND = 2;
|
|
688
747
|
var RESIZE_PER_SECOND = 30;
|
|
689
748
|
var defaultUncredentialedFetch = (url, init) => globalThis.fetch(url, {
|
|
@@ -794,6 +853,15 @@ async function dispatch(ctx, type, payload) {
|
|
|
794
853
|
else unsupported();
|
|
795
854
|
return EMPTY;
|
|
796
855
|
}
|
|
856
|
+
case "navigateExternal": {
|
|
857
|
+
const url = validateExternalUrl(payload);
|
|
858
|
+
if (!h.navigateExternal) unsupported();
|
|
859
|
+
if (!ctx.navigateExternalLimiter.take()) {
|
|
860
|
+
throw new BridgeError("RATE_LIMITED", "too many external navigations");
|
|
861
|
+
}
|
|
862
|
+
h.navigateExternal(url);
|
|
863
|
+
return EMPTY;
|
|
864
|
+
}
|
|
797
865
|
case "toast": {
|
|
798
866
|
const { message, kind } = validateToast(payload);
|
|
799
867
|
if (!h.toast) unsupported();
|
|
@@ -811,7 +879,11 @@ async function dispatch(ctx, type, payload) {
|
|
|
811
879
|
return EMPTY;
|
|
812
880
|
}
|
|
813
881
|
case "storage":
|
|
814
|
-
return handleStorage(
|
|
882
|
+
return handleStorage(
|
|
883
|
+
ctx.storageScope,
|
|
884
|
+
payload ?? {},
|
|
885
|
+
ctx.storageBackend
|
|
886
|
+
);
|
|
815
887
|
case "log": {
|
|
816
888
|
const { level, message } = validateLog(payload);
|
|
817
889
|
if (ctx.phase === "real") return EMPTY;
|
|
@@ -842,6 +914,14 @@ function toFailure(err) {
|
|
|
842
914
|
if (err instanceof BridgeError || isBridgeErrorLike(err)) return failure(err.code, err.message);
|
|
843
915
|
return failure("BAD_REQUEST", "request failed");
|
|
844
916
|
}
|
|
917
|
+
function storageScopeOf(spaceId, placementId) {
|
|
918
|
+
return `${encodeURIComponent(spaceId)}\0${encodeURIComponent(placementId)}`;
|
|
919
|
+
}
|
|
920
|
+
function isStorageBackend(value) {
|
|
921
|
+
if (typeof value !== "object" || value === null) return false;
|
|
922
|
+
const b = value;
|
|
923
|
+
return ["get", "set", "remove", "keys"].every((name) => typeof b[name] === "function");
|
|
924
|
+
}
|
|
845
925
|
function assertOptions(options) {
|
|
846
926
|
if (!options || typeof options !== "object") {
|
|
847
927
|
throw new TypeError("[bstage-bridge] createBridgeHost \uC635\uC158\uC774 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
@@ -885,6 +965,9 @@ function assertOptions(options) {
|
|
|
885
965
|
if (options.onTemplateReport !== void 0 && typeof options.onTemplateReport !== "function") {
|
|
886
966
|
throw new TypeError("[bstage-bridge] onTemplateReport\uB294 \uD568\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4");
|
|
887
967
|
}
|
|
968
|
+
if (options.storageBackend !== void 0 && !isStorageBackend(options.storageBackend)) {
|
|
969
|
+
throw new TypeError("[bstage-bridge] storageBackend\uB294 get\xB7set\xB7remove\xB7keys \uD568\uC218\uB97C \uAC00\uC838\uC57C \uD569\uB2C8\uB2E4");
|
|
970
|
+
}
|
|
888
971
|
if (!options.iframe || !options.init) {
|
|
889
972
|
throw new TypeError("[bstage-bridge] iframe\xB7init\uC774 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
890
973
|
}
|
|
@@ -929,13 +1012,17 @@ function createBridgeHost(options) {
|
|
|
929
1012
|
handlers,
|
|
930
1013
|
win,
|
|
931
1014
|
destination: { hostOrigin, partnerOrigins, policy, pinnedHeaders },
|
|
932
|
-
|
|
1015
|
+
// 각 성분을 인코딩해 잇는다 — 인코딩한 값에는 NUL이 없으므로 구분자가 모호해지지 않아, NUL이 든
|
|
1016
|
+
// spaceId·placementId로 다른 배치의 스코프 접두사를 만들 수 없다.
|
|
1017
|
+
storageScope: storageScopeOf(options.init.spaceId, options.init.placementId),
|
|
1018
|
+
...options.storageBackend ? { storageBackend: options.storageBackend } : {},
|
|
933
1019
|
phase: options.init.phase,
|
|
934
1020
|
fetchImpl: options.fetchImpl,
|
|
935
1021
|
partnerFetchImpl: options.partnerFetchImpl ?? defaultUncredentialedFetch,
|
|
936
1022
|
externalFetchImpl: options.externalFetchImpl ?? defaultUncredentialedFetch,
|
|
937
1023
|
hostOrigin,
|
|
938
1024
|
toastLimiter: createRateLimiter(TOAST_PER_MINUTE),
|
|
1025
|
+
navigateExternalLimiter: createRateLimiter(NAVIGATE_EXTERNAL_PER_MINUTE),
|
|
939
1026
|
scheduleResize,
|
|
940
1027
|
takeReportSlot() {
|
|
941
1028
|
if (reportsTaken >= REPORTS_PER_SESSION) return false;
|
|
@@ -1033,7 +1120,9 @@ function createBridgeHost(options) {
|
|
|
1033
1120
|
if (typeof payload !== "object" || payload === null) {
|
|
1034
1121
|
throw new TypeError("[bstage-bridge] \uC774\uBCA4\uD2B8 payload\uB294 \uAC1D\uCCB4\uC5EC\uC57C \uD569\uB2C8\uB2E4");
|
|
1035
1122
|
}
|
|
1123
|
+
if (type === "page" && hasAccountCapability(options.init)) return;
|
|
1036
1124
|
const clean = sanitizeEvent(type, payload);
|
|
1125
|
+
if (clean === void 0) return;
|
|
1037
1126
|
current = applyEvent(current, type, clean);
|
|
1038
1127
|
if (boundFrame === void 0) {
|
|
1039
1128
|
if (type === "visibility") pendingVisibility = clean;
|
|
@@ -1068,6 +1157,9 @@ export {
|
|
|
1068
1157
|
ROUTING_HEADER_PREFIXES,
|
|
1069
1158
|
SESSION_PER_FRAME,
|
|
1070
1159
|
SESSION_PER_MINUTE,
|
|
1160
|
+
STORAGE_MAX_KEYS,
|
|
1161
|
+
STORAGE_MAX_KEY_LENGTH,
|
|
1162
|
+
STORAGE_MAX_VALUE_LENGTH,
|
|
1071
1163
|
checkPath,
|
|
1072
1164
|
classifyDestination,
|
|
1073
1165
|
createBridgeHost,
|
package/dist/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ __export(src_exports, {
|
|
|
36
36
|
MAX_ENVELOPE_TYPE_LENGTH: () => MAX_ENVELOPE_TYPE_LENGTH,
|
|
37
37
|
MAX_MEDIA_ORIGINS: () => MAX_MEDIA_ORIGINS,
|
|
38
38
|
OTP_OPS: () => OTP_OPS,
|
|
39
|
+
PAGE_LOCATION_MAX_LENGTH: () => PAGE_LOCATION_MAX_LENGTH,
|
|
39
40
|
READY_EVENT: () => READY_EVENT,
|
|
40
41
|
REPORTS_PER_SESSION: () => REPORTS_PER_SESSION,
|
|
41
42
|
REPORT_COUNT_MAX: () => REPORT_COUNT_MAX,
|
|
@@ -60,7 +61,8 @@ __export(src_exports, {
|
|
|
60
61
|
isHostEventType: () => isHostEventType,
|
|
61
62
|
isRequestType: () => isRequestType,
|
|
62
63
|
isValidNonce: () => isValidNonce,
|
|
63
|
-
isValidSession: () => isValidSession
|
|
64
|
+
isValidSession: () => isValidSession,
|
|
65
|
+
toPageLocation: () => toPageLocation
|
|
64
66
|
});
|
|
65
67
|
module.exports = __toCommonJS(src_exports);
|
|
66
68
|
|
|
@@ -96,7 +98,9 @@ var BRIDGE_ERROR_CODES = [
|
|
|
96
98
|
"NETWORK_ERROR",
|
|
97
99
|
"UNSUPPORTED",
|
|
98
100
|
// 권한(capability) 없는 배치의 계정 요청, 또는 결속 조건을 벗어난 세션 요청.
|
|
99
|
-
"NOT_ALLOWED"
|
|
101
|
+
"NOT_ALLOWED",
|
|
102
|
+
// 호스트가 주입한 storage 저장소에 쓸 수 없음(용량 초과·접근 차단 등).
|
|
103
|
+
"STORAGE_UNAVAILABLE"
|
|
100
104
|
];
|
|
101
105
|
var BridgeError = class extends Error {
|
|
102
106
|
constructor(code, message) {
|
|
@@ -119,6 +123,7 @@ var REQUEST_TYPES = [
|
|
|
119
123
|
"navigate",
|
|
120
124
|
"back",
|
|
121
125
|
"openExternal",
|
|
126
|
+
"navigateExternal",
|
|
122
127
|
"toast",
|
|
123
128
|
"resize",
|
|
124
129
|
"track",
|
|
@@ -128,10 +133,37 @@ var REQUEST_TYPES = [
|
|
|
128
133
|
"session",
|
|
129
134
|
"otp"
|
|
130
135
|
];
|
|
131
|
-
var HOST_EVENT_TYPES = [
|
|
136
|
+
var HOST_EVENT_TYPES = [
|
|
137
|
+
"slot.context",
|
|
138
|
+
"locale",
|
|
139
|
+
"member",
|
|
140
|
+
"theme",
|
|
141
|
+
"visibility",
|
|
142
|
+
"page"
|
|
143
|
+
];
|
|
132
144
|
var READY_EVENT = "ready";
|
|
133
145
|
var INIT_RESPONSE = "init";
|
|
134
146
|
var FRAME_UNLOAD_EVENT = "frame-unload";
|
|
147
|
+
var PAGE_LOCATION_MAX_LENGTH = 2048;
|
|
148
|
+
var UNSAFE_PATH_CHARS = /[\s\\\u0000-\u001f\u007f]/;
|
|
149
|
+
function isSafePagePath(path) {
|
|
150
|
+
if (!path.startsWith("/") || path.startsWith("//")) return false;
|
|
151
|
+
if (UNSAFE_PATH_CHARS.test(path) || path.includes("?") || path.includes("#")) return false;
|
|
152
|
+
try {
|
|
153
|
+
const resolved = new URL(path, "https://page.invalid");
|
|
154
|
+
return resolved.origin === "https://page.invalid" && !resolved.pathname.startsWith("//");
|
|
155
|
+
} catch {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function toPageLocation(value) {
|
|
160
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
161
|
+
const { path, search } = value;
|
|
162
|
+
if (typeof path !== "string" || typeof search !== "string" || path.length > PAGE_LOCATION_MAX_LENGTH || !isSafePagePath(path) || search !== "" && !search.startsWith("?") || search.length > PAGE_LOCATION_MAX_LENGTH) {
|
|
163
|
+
return void 0;
|
|
164
|
+
}
|
|
165
|
+
return { path, search };
|
|
166
|
+
}
|
|
135
167
|
var BRIDGE_SURFACES = ["page", "slot"];
|
|
136
168
|
function isBridgeSurface(value) {
|
|
137
169
|
return BRIDGE_SURFACES.includes(value);
|
|
@@ -288,6 +320,8 @@ function bridgeRuntime(g, makeFetch, config) {
|
|
|
288
320
|
init = Object.assign({}, init, { theme: payload });
|
|
289
321
|
} else if (type === "slot.context" && typeof p.id === "string") {
|
|
290
322
|
init = Object.assign({}, init, { slot: payload });
|
|
323
|
+
} else if (type === "page" && typeof p.path === "string" && typeof p.search === "string") {
|
|
324
|
+
init = Object.assign({}, init, { page: { path: p.path, search: p.search } });
|
|
291
325
|
}
|
|
292
326
|
}
|
|
293
327
|
function onMessage(ev) {
|
|
@@ -1615,6 +1649,7 @@ ${script}
|
|
|
1615
1649
|
MAX_ENVELOPE_TYPE_LENGTH,
|
|
1616
1650
|
MAX_MEDIA_ORIGINS,
|
|
1617
1651
|
OTP_OPS,
|
|
1652
|
+
PAGE_LOCATION_MAX_LENGTH,
|
|
1618
1653
|
READY_EVENT,
|
|
1619
1654
|
REPORTS_PER_SESSION,
|
|
1620
1655
|
REPORT_COUNT_MAX,
|
|
@@ -1639,5 +1674,6 @@ ${script}
|
|
|
1639
1674
|
isHostEventType,
|
|
1640
1675
|
isRequestType,
|
|
1641
1676
|
isValidNonce,
|
|
1642
|
-
isValidSession
|
|
1677
|
+
isValidSession,
|
|
1678
|
+
toPageLocation
|
|
1643
1679
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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,
|
|
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, P as PAGE_LOCATION_MAX_LENGTH, w as PageLocationState, R as READY_EVENT, x as REPORTS_PER_SESSION, y as REPORT_COUNT_MAX, z as REPORT_FRAME_MAX_LENGTH, C as REPORT_MAX_FRAMES, D as REPORT_MESSAGE_MAX_LENGTH, E as REQUEST_TIMEOUT_MS, G as REQUEST_TYPES, J as ReverificationStatus, S as SESSION_OPS, Q as SessionOp, T as SessionRequest, U as SessionResult, V as SlotState, W as StorageOp, X as TEMPLATE_REPORT_KINDS, Y as TemplateReport, Z as TemplateReportKind, _ as ThemeState, $ as ToastKind, a0 as WithSession, a1 as isBridgeErrorCode, a2 as isBridgeErrorLike, a3 as isBridgeSurface, a4 as isHostEventType, a5 as isRequestType, a6 as toPageLocation } from './messages-pMXAlatW.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 { 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,
|
|
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, P as PAGE_LOCATION_MAX_LENGTH, w as PageLocationState, R as READY_EVENT, x as REPORTS_PER_SESSION, y as REPORT_COUNT_MAX, z as REPORT_FRAME_MAX_LENGTH, C as REPORT_MAX_FRAMES, D as REPORT_MESSAGE_MAX_LENGTH, E as REQUEST_TIMEOUT_MS, G as REQUEST_TYPES, J as ReverificationStatus, S as SESSION_OPS, Q as SessionOp, T as SessionRequest, U as SessionResult, V as SlotState, W as StorageOp, X as TEMPLATE_REPORT_KINDS, Y as TemplateReport, Z as TemplateReportKind, _ as ThemeState, $ as ToastKind, a0 as WithSession, a1 as isBridgeErrorCode, a2 as isBridgeErrorLike, a3 as isBridgeSurface, a4 as isHostEventType, a5 as isRequestType, a6 as toPageLocation } from './messages-pMXAlatW.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
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
MAX_ENVELOPE_TYPE_LENGTH,
|
|
16
16
|
MAX_MEDIA_ORIGINS,
|
|
17
17
|
OTP_OPS,
|
|
18
|
+
PAGE_LOCATION_MAX_LENGTH,
|
|
18
19
|
READY_EVENT,
|
|
19
20
|
REPORTS_PER_SESSION,
|
|
20
21
|
REPORT_COUNT_MAX,
|
|
@@ -39,9 +40,10 @@ import {
|
|
|
39
40
|
isHostEventType,
|
|
40
41
|
isRequestType,
|
|
41
42
|
isValidNonce,
|
|
42
|
-
isValidSession
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
isValidSession,
|
|
44
|
+
toPageLocation
|
|
45
|
+
} from "./chunk-LGCWV4TV.js";
|
|
46
|
+
import "./chunk-B3TKEEX3.js";
|
|
45
47
|
export {
|
|
46
48
|
ACCOUNT_SESSION_CAPABILITY,
|
|
47
49
|
BRIDGE_ERROR_CODES,
|
|
@@ -59,6 +61,7 @@ export {
|
|
|
59
61
|
MAX_ENVELOPE_TYPE_LENGTH,
|
|
60
62
|
MAX_MEDIA_ORIGINS,
|
|
61
63
|
OTP_OPS,
|
|
64
|
+
PAGE_LOCATION_MAX_LENGTH,
|
|
62
65
|
READY_EVENT,
|
|
63
66
|
REPORTS_PER_SESSION,
|
|
64
67
|
REPORT_COUNT_MAX,
|
|
@@ -83,5 +86,6 @@ export {
|
|
|
83
86
|
isHostEventType,
|
|
84
87
|
isRequestType,
|
|
85
88
|
isValidNonce,
|
|
86
|
-
isValidSession
|
|
89
|
+
isValidSession,
|
|
90
|
+
toPageLocation
|
|
87
91
|
};
|
|
@@ -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 };
|