@apps-in-toss/web-bridge 0.0.0-dev.1765876894045 → 0.0.0-dev.1765878631929
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/built/appsInTossSignTossCert.d.ts +2 -0
- package/built/getTossShareLink.d.ts +16 -12
- package/built/index.cjs +0 -287
- package/built/index.d.cts +5 -190
- package/built/index.d.ts +5 -190
- package/built/index.js +0 -284
- package/package.json +5 -5
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface AppsInTossSignTossCertParams {
|
|
2
2
|
txId: string;
|
|
3
|
+
skipConfirmDoc?: boolean;
|
|
3
4
|
}
|
|
4
5
|
/**
|
|
5
6
|
* @public
|
|
@@ -9,6 +10,7 @@ export interface AppsInTossSignTossCertParams {
|
|
|
9
10
|
*
|
|
10
11
|
* @param {AppsInTossSignTossCertParams} params - 서명에 필요한 파라미터를 포함하는 객체예요.
|
|
11
12
|
* @param {string} params.txId - 토스인증서를 사용한 본인확인이나 간편인증, 전자서명에서 사용하는 Transaction Id예요.
|
|
13
|
+
* @param {boolean} params.skipConfirmDoc - (선택) 토스 원터치 인증방식을 사용하기 위한 옵션이예요. true 설정 시 최소 버전: Android 5.236.0, iOS 5.236.0 (default: false)
|
|
12
14
|
*
|
|
13
15
|
* @example
|
|
14
16
|
* ```tsx
|
|
@@ -4,29 +4,33 @@
|
|
|
4
4
|
* @kind function
|
|
5
5
|
* @name getTossShareLink
|
|
6
6
|
* @description
|
|
7
|
-
*
|
|
8
|
-
* 이 링크를 다른 사람과 공유하면 토스 앱이 실행되면서 지정한 경로로 진입해요. 토스앱이 없는 사람은 iOS 일 때는 앱스토어로 이동하고, Android 일 때는 플레이스토어로 이동해요.
|
|
7
|
+
* 사용자가 지정한 경로를 토스 앱에서 열 수 있는 공유 링크를 생성해요.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* 생성된 링크를 다른 사람과 공유하면:
|
|
10
|
+
* - 토스 앱이 설치되어 있으면: 토스 앱이 실행되면서 지정한 경로로 이동해요.
|
|
11
|
+
* - 토스 앱이 없으면: iOS는 앱스토어로, Android는 플레이스토어로 이동해요.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
16
|
-
* @returns {Promise<string>} `deep_link_value`가 포함된 토스 공유 링크를 반환해요.
|
|
13
|
+
* @param path - 딥링크 경로예요. `intoss://`로 시작하는 문자열이어야 해요. (예: `intoss://my-app`, `intoss://my-app/detail?id=123`)
|
|
14
|
+
* @param ogImageUrl - (선택) 공유 시 표시될 커스텀 OG 이미지 URL이에요. 최소 버전: Android 5.240.0, iOS 5.239.0
|
|
15
|
+
* @returns {Promise<string>} 생성된 토스 공유 링크
|
|
17
16
|
*
|
|
18
17
|
* @example
|
|
19
18
|
* ```tsx
|
|
20
19
|
* import { share } from '@apps-in-toss/web-framework';
|
|
21
20
|
* import { getTossShareLink } from '@apps-in-toss/web-framework';
|
|
22
21
|
*
|
|
23
|
-
* //
|
|
22
|
+
* // 기본 사용법
|
|
24
23
|
* const tossLink = await getTossShareLink('intoss://my-app');
|
|
25
|
-
*
|
|
26
|
-
* // 생성한 링크를 메시지로 공유해요.
|
|
27
24
|
* await share({ message: tossLink });
|
|
25
|
+
*
|
|
26
|
+
* // 커스텀 OG 이미지와 함께 사용
|
|
27
|
+
* const linkWithImage = await getTossShareLink(
|
|
28
|
+
* 'intoss://my-app/event',
|
|
29
|
+
* 'https://example.com/og-image.png'
|
|
30
|
+
* );
|
|
31
|
+
* await share({ message: linkWithImage });
|
|
28
32
|
* ```
|
|
29
33
|
*/
|
|
30
|
-
export declare function getTossShareLink(path: string): Promise<string>;
|
|
34
|
+
export declare function getTossShareLink(path: string, ogImageUrl?: string): Promise<string>;
|
|
31
35
|
|
|
32
36
|
export {};
|
package/built/index.cjs
CHANGED
|
@@ -26,7 +26,6 @@ __export(index_exports, {
|
|
|
26
26
|
IAP: () => IAP,
|
|
27
27
|
SafeAreaInsets: () => SafeAreaInsets,
|
|
28
28
|
Storage: () => Storage,
|
|
29
|
-
TossAds: () => TossAds,
|
|
30
29
|
appsInTossEvent: () => appsInTossEvent,
|
|
31
30
|
env: () => env,
|
|
32
31
|
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
@@ -37,11 +36,9 @@ __export(index_exports, {
|
|
|
37
36
|
getSafeAreaInsets: () => getSafeAreaInsets,
|
|
38
37
|
graniteEvent: () => graniteEvent,
|
|
39
38
|
isMinVersionSupported: () => isMinVersionSupported,
|
|
40
|
-
loadFullScreenAd: () => loadFullScreenAd,
|
|
41
39
|
openCamera: () => openCamera,
|
|
42
40
|
partner: () => partner,
|
|
43
41
|
setClipboardText: () => setClipboardText,
|
|
44
|
-
showFullScreenAd: () => showFullScreenAd,
|
|
45
42
|
startUpdateLocation: () => startUpdateLocation,
|
|
46
43
|
tdsEvent: () => tdsEvent
|
|
47
44
|
});
|
|
@@ -1063,287 +1060,6 @@ var startUpdateLocation = (params) => {
|
|
|
1063
1060
|
startUpdateLocation.getPermission = () => getPermission2({ name: "geolocation", access: "access" });
|
|
1064
1061
|
startUpdateLocation.openPermissionDialog = () => openPermissionDialog2({ name: "geolocation", access: "access" });
|
|
1065
1062
|
|
|
1066
|
-
// src/integratedAd.ts
|
|
1067
|
-
var import_bridge_core21 = require("@apps-in-toss/bridge-core");
|
|
1068
|
-
var loadFullScreenAd = Object.assign((0, import_bridge_core21.createEventBridge)("loadFullScreenAd"), {
|
|
1069
|
-
isSupported: (0, import_bridge_core21.createConstantBridge)("loadFullScreenAd_isSupported")
|
|
1070
|
-
});
|
|
1071
|
-
var showFullScreenAd = Object.assign((0, import_bridge_core21.createEventBridge)("showFullScreenAd"), {
|
|
1072
|
-
isSupported: (0, import_bridge_core21.createConstantBridge)("showFullScreenAd_isSupported")
|
|
1073
|
-
});
|
|
1074
|
-
|
|
1075
|
-
// src/toss-ad/index.ts
|
|
1076
|
-
var import_bridge_core23 = require("@apps-in-toss/bridge-core");
|
|
1077
|
-
|
|
1078
|
-
// src/toss-ad/opener.ts
|
|
1079
|
-
var import_bridge_core22 = require("@apps-in-toss/bridge-core");
|
|
1080
|
-
var openURL = (0, import_bridge_core22.createAsyncBridge)("openURL");
|
|
1081
|
-
function openUrlOpener(url) {
|
|
1082
|
-
const transformed = getWebSchemeOrUri(url);
|
|
1083
|
-
return openURL(transformed);
|
|
1084
|
-
}
|
|
1085
|
-
function getWebSchemeOrUri(uri) {
|
|
1086
|
-
const isHttp = ["http://", "https://"].some((protocol) => uri.startsWith(protocol));
|
|
1087
|
-
return isHttp ? supertossWeb(uri) : uri;
|
|
1088
|
-
}
|
|
1089
|
-
function supertossWeb(uri) {
|
|
1090
|
-
return `supertoss://web?url=${encodeURIComponent(uri)}&external=true`;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
// src/toss-ad/scriptLoader.ts
|
|
1094
|
-
var DEFAULT_SDK_URL = "https://static.toss.im/ads/sdk/toss-ads-space-kit-1.3.0.js";
|
|
1095
|
-
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
1096
|
-
var pendingLoad = null;
|
|
1097
|
-
function getAdsSdk() {
|
|
1098
|
-
if (typeof window === "undefined") {
|
|
1099
|
-
return void 0;
|
|
1100
|
-
}
|
|
1101
|
-
return window.TossAdsSpaceKit;
|
|
1102
|
-
}
|
|
1103
|
-
function loadAdsSdk() {
|
|
1104
|
-
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1105
|
-
return Promise.reject(new Error("Ads SDK can only be loaded in a browser environment."));
|
|
1106
|
-
}
|
|
1107
|
-
const existing = getAdsSdk();
|
|
1108
|
-
if (existing) {
|
|
1109
|
-
return Promise.resolve(existing);
|
|
1110
|
-
}
|
|
1111
|
-
if (pendingLoad) {
|
|
1112
|
-
return pendingLoad;
|
|
1113
|
-
}
|
|
1114
|
-
const promise = new Promise((resolve, reject) => {
|
|
1115
|
-
const script = document.createElement("script");
|
|
1116
|
-
const cleanup = () => {
|
|
1117
|
-
script.removeEventListener("load", handleLoad);
|
|
1118
|
-
script.removeEventListener("error", handleError);
|
|
1119
|
-
window.clearTimeout(timeoutId);
|
|
1120
|
-
pendingLoad = null;
|
|
1121
|
-
};
|
|
1122
|
-
const handleLoad = () => {
|
|
1123
|
-
const sdk = getAdsSdk();
|
|
1124
|
-
if (sdk) {
|
|
1125
|
-
cleanup();
|
|
1126
|
-
resolve(sdk);
|
|
1127
|
-
return;
|
|
1128
|
-
}
|
|
1129
|
-
cleanup();
|
|
1130
|
-
reject(new Error("Ads SDK script loaded but window.TossAdsSpaceKit was not exposed."));
|
|
1131
|
-
};
|
|
1132
|
-
const handleError = () => {
|
|
1133
|
-
cleanup();
|
|
1134
|
-
reject(new Error(`Failed to load Ads SDK script from ${DEFAULT_SDK_URL}.`));
|
|
1135
|
-
};
|
|
1136
|
-
const timeoutId = window.setTimeout(() => {
|
|
1137
|
-
cleanup();
|
|
1138
|
-
reject(new Error(`Loading Ads SDK timed out after ${DEFAULT_TIMEOUT_MS}ms.`));
|
|
1139
|
-
}, DEFAULT_TIMEOUT_MS);
|
|
1140
|
-
script.addEventListener("load", handleLoad);
|
|
1141
|
-
script.addEventListener("error", handleError);
|
|
1142
|
-
script.async = true;
|
|
1143
|
-
script.src = DEFAULT_SDK_URL;
|
|
1144
|
-
document.head.appendChild(script);
|
|
1145
|
-
});
|
|
1146
|
-
pendingLoad = promise;
|
|
1147
|
-
return promise;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
// src/toss-ad/index.ts
|
|
1151
|
-
var fetchTossAd = Object.assign((0, import_bridge_core23.createEventBridge)("fetchTossAd"), {
|
|
1152
|
-
isSupported: (0, import_bridge_core23.createConstantBridge)("fetchTossAd_isSupported")
|
|
1153
|
-
});
|
|
1154
|
-
var tossAdEventLog = (0, import_bridge_core23.createAsyncBridge)("tossAdEventLog");
|
|
1155
|
-
var SUPPORTED_STYLE_IDS = /* @__PURE__ */ new Set(["1", "2"]);
|
|
1156
|
-
function fetchTossAdPromise(options) {
|
|
1157
|
-
return new Promise((resolve, reject) => {
|
|
1158
|
-
if (!fetchTossAd.isSupported()) {
|
|
1159
|
-
reject(new Error("fetchTossAd is not supported in this environment."));
|
|
1160
|
-
return;
|
|
1161
|
-
}
|
|
1162
|
-
return fetchTossAd({
|
|
1163
|
-
options,
|
|
1164
|
-
onEvent: resolve,
|
|
1165
|
-
onError: reject
|
|
1166
|
-
});
|
|
1167
|
-
});
|
|
1168
|
-
}
|
|
1169
|
-
function normalizeAdResponse(adResponse) {
|
|
1170
|
-
const ads = Array.isArray(adResponse.ads) ? adResponse.ads.filter((ad) => SUPPORTED_STYLE_IDS.has(String(ad.styleId))) : [];
|
|
1171
|
-
return {
|
|
1172
|
-
requestId: adResponse.requestId ?? "",
|
|
1173
|
-
status: adResponse.status ?? "OK",
|
|
1174
|
-
ads,
|
|
1175
|
-
ext: adResponse.ext
|
|
1176
|
-
};
|
|
1177
|
-
}
|
|
1178
|
-
function normalizeApiResponse(raw) {
|
|
1179
|
-
if (isApiResponse(raw)) {
|
|
1180
|
-
if (raw.resultType !== "SUCCESS") {
|
|
1181
|
-
return raw;
|
|
1182
|
-
}
|
|
1183
|
-
if (!raw.success) {
|
|
1184
|
-
return {
|
|
1185
|
-
resultType: "FAIL",
|
|
1186
|
-
error: { reason: "fetchTossAd returned SUCCESS without payload" }
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
return { ...raw, success: normalizeAdResponse(raw.success) };
|
|
1190
|
-
}
|
|
1191
|
-
if (isAdResponse(raw)) {
|
|
1192
|
-
return {
|
|
1193
|
-
resultType: "SUCCESS",
|
|
1194
|
-
success: normalizeAdResponse(raw)
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
return { resultType: "FAIL", error: { reason: "Invalid response from fetchTossAd" } };
|
|
1198
|
-
}
|
|
1199
|
-
function isApiResponse(payload) {
|
|
1200
|
-
return Boolean(payload && typeof payload === "object" && "resultType" in payload);
|
|
1201
|
-
}
|
|
1202
|
-
function isAdResponse(payload) {
|
|
1203
|
-
return Boolean(payload && typeof payload === "object" && "ads" in payload);
|
|
1204
|
-
}
|
|
1205
|
-
function createCustomAdFetcher() {
|
|
1206
|
-
return async (_endpoint, request) => {
|
|
1207
|
-
try {
|
|
1208
|
-
const raw = await fetchTossAdPromise({
|
|
1209
|
-
adGroupId: request.spaceUnitId,
|
|
1210
|
-
sdkId: "108",
|
|
1211
|
-
availableStyleIds: ["1", "2"]
|
|
1212
|
-
});
|
|
1213
|
-
return normalizeApiResponse(raw);
|
|
1214
|
-
} catch (error) {
|
|
1215
|
-
return {
|
|
1216
|
-
resultType: "FAIL",
|
|
1217
|
-
error: {
|
|
1218
|
-
reason: error instanceof Error ? error.message : "Unknown fetchTossAd error"
|
|
1219
|
-
}
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
};
|
|
1223
|
-
}
|
|
1224
|
-
var pendingLoad2 = null;
|
|
1225
|
-
function initialize(options) {
|
|
1226
|
-
const { callbacks } = options;
|
|
1227
|
-
if (window.TossAdsSpaceKit != null && window.TossAdsSpaceKit.isInitialized()) {
|
|
1228
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] Already initialized."));
|
|
1229
|
-
return;
|
|
1230
|
-
}
|
|
1231
|
-
if (pendingLoad2 != null) {
|
|
1232
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] initialization already in progress."));
|
|
1233
|
-
}
|
|
1234
|
-
const resolveInitialized = () => callbacks?.onInitialized?.();
|
|
1235
|
-
const rejectInitialized = (error) => {
|
|
1236
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1237
|
-
callbacks?.onInitializationFailed?.(normalizedError);
|
|
1238
|
-
};
|
|
1239
|
-
pendingLoad2 = loadAdsSdk().then((sdk) => {
|
|
1240
|
-
const customAdFetcher = createCustomAdFetcher();
|
|
1241
|
-
const config = { environment: "live", customAdFetcher, opener: openUrlOpener };
|
|
1242
|
-
sdk.init(config);
|
|
1243
|
-
resolveInitialized();
|
|
1244
|
-
}).catch((error) => {
|
|
1245
|
-
pendingLoad2 = null;
|
|
1246
|
-
rejectInitialized(error);
|
|
1247
|
-
});
|
|
1248
|
-
}
|
|
1249
|
-
function attach(adGroupId, target, options = {}) {
|
|
1250
|
-
const { callbacks } = options;
|
|
1251
|
-
const rejectAttached = (error) => {
|
|
1252
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1253
|
-
callbacks?.onAdFailedToRender?.({
|
|
1254
|
-
slotId: "",
|
|
1255
|
-
adGroupId,
|
|
1256
|
-
adMetadata: {},
|
|
1257
|
-
error: { code: 0, message: normalizedError.message }
|
|
1258
|
-
});
|
|
1259
|
-
};
|
|
1260
|
-
try {
|
|
1261
|
-
const spaceId = adGroupId;
|
|
1262
|
-
const sdk = getAdsSdk();
|
|
1263
|
-
if (!sdk) {
|
|
1264
|
-
throw new Error("[toss-ad] Call initialize() before attaching an ad.");
|
|
1265
|
-
}
|
|
1266
|
-
if (!sdk.banner) {
|
|
1267
|
-
throw new Error("[toss-ad] Loaded TossAdsSpaceKit does not support banner ads.");
|
|
1268
|
-
}
|
|
1269
|
-
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
1270
|
-
if (!element) {
|
|
1271
|
-
throw new Error(`[toss-ad] Failed to find target element: ${target}`);
|
|
1272
|
-
}
|
|
1273
|
-
const slotOptions = {
|
|
1274
|
-
spaceId,
|
|
1275
|
-
autoLoad: true,
|
|
1276
|
-
theme: options.theme,
|
|
1277
|
-
padding: options.padding,
|
|
1278
|
-
callbacks: wrapCallbacks(adGroupId, options.callbacks)
|
|
1279
|
-
};
|
|
1280
|
-
sdk.banner.createSlot(element, slotOptions);
|
|
1281
|
-
} catch (error) {
|
|
1282
|
-
rejectAttached(error);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
function destroy(slotId) {
|
|
1286
|
-
const sdk = getAdsSdk();
|
|
1287
|
-
if (!sdk?.banner) {
|
|
1288
|
-
return;
|
|
1289
|
-
}
|
|
1290
|
-
sdk.banner.destroy(slotId);
|
|
1291
|
-
}
|
|
1292
|
-
function destroyAll() {
|
|
1293
|
-
const sdk = getAdsSdk();
|
|
1294
|
-
if (!sdk?.banner) {
|
|
1295
|
-
return;
|
|
1296
|
-
}
|
|
1297
|
-
sdk.banner.destroyAll();
|
|
1298
|
-
}
|
|
1299
|
-
function wrapCallbacks(adGroupId, callbacks) {
|
|
1300
|
-
if (!callbacks) {
|
|
1301
|
-
return void 0;
|
|
1302
|
-
}
|
|
1303
|
-
const mapEvent = (payload) => {
|
|
1304
|
-
const next = { ...payload ?? {} };
|
|
1305
|
-
next.adGroupId = next.adGroupId ?? next.spaceId ?? adGroupId;
|
|
1306
|
-
delete next.spaceId;
|
|
1307
|
-
return next;
|
|
1308
|
-
};
|
|
1309
|
-
return {
|
|
1310
|
-
onAdRendered: (payload) => callbacks.onAdRendered?.(mapEvent(payload)),
|
|
1311
|
-
onAdViewable: (payload) => callbacks.onAdViewable?.(mapEvent(payload)),
|
|
1312
|
-
onAdClicked: (payload) => callbacks.onAdClicked?.(mapEvent(payload)),
|
|
1313
|
-
onAdImpression: (payload) => {
|
|
1314
|
-
tossAdEventLog({
|
|
1315
|
-
log_name: "display_ads_all::impression__1px_banner",
|
|
1316
|
-
log_type: "event",
|
|
1317
|
-
params: {
|
|
1318
|
-
event_type: "impression",
|
|
1319
|
-
schema_id: 1812034,
|
|
1320
|
-
request_id: payload?.adMetadata?.requestId ?? ""
|
|
1321
|
-
}
|
|
1322
|
-
});
|
|
1323
|
-
callbacks.onAdImpression?.(mapEvent(payload));
|
|
1324
|
-
},
|
|
1325
|
-
onAdFailedToRender: (payload) => callbacks.onAdFailedToRender?.({
|
|
1326
|
-
...mapEvent(payload),
|
|
1327
|
-
error: payload?.error ?? { code: 0, message: "UNKNOWN" }
|
|
1328
|
-
}),
|
|
1329
|
-
onNoFill: (payload) => callbacks.onNoFill?.(mapEvent(payload))
|
|
1330
|
-
};
|
|
1331
|
-
}
|
|
1332
|
-
var TossAds = {
|
|
1333
|
-
initialize: Object.assign(initialize, {
|
|
1334
|
-
isSupported: fetchTossAd.isSupported
|
|
1335
|
-
}),
|
|
1336
|
-
attach: Object.assign(attach, {
|
|
1337
|
-
isSupported: fetchTossAd.isSupported
|
|
1338
|
-
}),
|
|
1339
|
-
destroy: Object.assign(destroy, {
|
|
1340
|
-
isSupported: fetchTossAd.isSupported
|
|
1341
|
-
}),
|
|
1342
|
-
destroyAll: Object.assign(destroyAll, {
|
|
1343
|
-
isSupported: fetchTossAd.isSupported
|
|
1344
|
-
})
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
1063
|
// src/index.ts
|
|
1348
1064
|
__reExport(index_exports, require("@apps-in-toss/types"), module.exports);
|
|
1349
1065
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1352,7 +1068,6 @@ __reExport(index_exports, require("@apps-in-toss/types"), module.exports);
|
|
|
1352
1068
|
IAP,
|
|
1353
1069
|
SafeAreaInsets,
|
|
1354
1070
|
Storage,
|
|
1355
|
-
TossAds,
|
|
1356
1071
|
appsInTossEvent,
|
|
1357
1072
|
env,
|
|
1358
1073
|
fetchAlbumPhotos,
|
|
@@ -1363,11 +1078,9 @@ __reExport(index_exports, require("@apps-in-toss/types"), module.exports);
|
|
|
1363
1078
|
getSafeAreaInsets,
|
|
1364
1079
|
graniteEvent,
|
|
1365
1080
|
isMinVersionSupported,
|
|
1366
|
-
loadFullScreenAd,
|
|
1367
1081
|
openCamera,
|
|
1368
1082
|
partner,
|
|
1369
1083
|
setClipboardText,
|
|
1370
|
-
showFullScreenAd,
|
|
1371
1084
|
startUpdateLocation,
|
|
1372
1085
|
tdsEvent,
|
|
1373
1086
|
...require("@apps-in-toss/bridge-core"),
|
package/built/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './bridge';
|
|
2
2
|
export * from '@apps-in-toss/bridge-core';
|
|
3
|
-
import { LoadAdMobInterstitialAdEvent, LoadAdMobInterstitialAdOptions, ShowAdMobInterstitialAdEvent, ShowAdMobInterstitialAdOptions, LoadAdMobRewardedAdEvent, LoadAdMobRewardedAdOptions, ShowAdMobRewardedAdEvent, ShowAdMobRewardedAdOptions, LoadAdMobEvent, LoadAdMobOptions, ShowAdMobEvent, ShowAdMobOptions
|
|
3
|
+
import { LoadAdMobInterstitialAdEvent, LoadAdMobInterstitialAdOptions, ShowAdMobInterstitialAdEvent, ShowAdMobInterstitialAdOptions, LoadAdMobRewardedAdEvent, LoadAdMobRewardedAdOptions, ShowAdMobRewardedAdEvent, ShowAdMobRewardedAdOptions, LoadAdMobEvent, LoadAdMobOptions, ShowAdMobEvent, ShowAdMobOptions } from '@apps-in-toss/framework';
|
|
4
4
|
import * as _apps_in_toss_types from '@apps-in-toss/types';
|
|
5
5
|
import { FetchAlbumPhotos, FetchContacts, GetCurrentLocation, OpenCamera, SetClipboardText, GetClipboardText, StartUpdateLocationEventParams } from '@apps-in-toss/types';
|
|
6
6
|
export * from '@apps-in-toss/types';
|
|
@@ -342,15 +342,15 @@ declare function getSafeAreaInsets(): {
|
|
|
342
342
|
* ```
|
|
343
343
|
*/
|
|
344
344
|
declare function subscribeSafeAreaInsets({ onEvent }: {
|
|
345
|
-
onEvent: (data: SafeAreaInsets
|
|
345
|
+
onEvent: (data: SafeAreaInsets) => void;
|
|
346
346
|
}): () => void;
|
|
347
|
-
interface SafeAreaInsets
|
|
347
|
+
interface SafeAreaInsets {
|
|
348
348
|
top: number;
|
|
349
349
|
bottom: number;
|
|
350
350
|
left: number;
|
|
351
351
|
right: number;
|
|
352
352
|
}
|
|
353
|
-
declare const SafeAreaInsets
|
|
353
|
+
declare const SafeAreaInsets: {
|
|
354
354
|
get: typeof getSafeAreaInsets;
|
|
355
355
|
subscribe: typeof subscribeSafeAreaInsets;
|
|
356
356
|
};
|
|
@@ -961,189 +961,4 @@ declare const startUpdateLocation: {
|
|
|
961
961
|
openPermissionDialog(): Promise<"denied" | "allowed">;
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
|
|
965
|
-
onEvent: (data: LoadFullScreenAdEvent) => void;
|
|
966
|
-
onError: (error: Error) => void;
|
|
967
|
-
options?: LoadFullScreenAdOptions | undefined;
|
|
968
|
-
}) => () => void) & {
|
|
969
|
-
isSupported: () => boolean;
|
|
970
|
-
};
|
|
971
|
-
declare const showFullScreenAd: ((args: {
|
|
972
|
-
onEvent: (data: ShowFullScreenAdEvent) => void;
|
|
973
|
-
onError: (error: Error) => void;
|
|
974
|
-
options?: ShowFullScreenAdOptions | undefined;
|
|
975
|
-
}) => () => void) & {
|
|
976
|
-
isSupported: () => boolean;
|
|
977
|
-
};
|
|
978
|
-
|
|
979
|
-
type Environment = 'alpha' | 'live';
|
|
980
|
-
type DeviceOS = 'IOS' | 'ANDROID';
|
|
981
|
-
type DeviceAttStatus = 'NOT_DETERMINED' | 'RESTRICTED' | 'DENIED' | 'AUTHORIZED';
|
|
982
|
-
type DeviceCarrier = 'SKT' | 'KT' | 'LGU' | 'SKT_MVNO' | 'KT_MVNO' | 'LG_MVNO';
|
|
983
|
-
type RequestHeaders = Record<string, string>;
|
|
984
|
-
interface DeviceInfo {
|
|
985
|
-
os?: DeviceOS;
|
|
986
|
-
osVersion?: string;
|
|
987
|
-
ua?: string;
|
|
988
|
-
ifa?: string;
|
|
989
|
-
ifv?: string | null;
|
|
990
|
-
attStatus?: DeviceAttStatus | null;
|
|
991
|
-
model?: string;
|
|
992
|
-
carrier?: DeviceCarrier;
|
|
993
|
-
}
|
|
994
|
-
interface SafeAreaInsets {
|
|
995
|
-
top: string;
|
|
996
|
-
bottom: string;
|
|
997
|
-
left: string;
|
|
998
|
-
right: string;
|
|
999
|
-
}
|
|
1000
|
-
interface RuntimeInfo {
|
|
1001
|
-
safeAreaInsets?: SafeAreaInsets;
|
|
1002
|
-
}
|
|
1003
|
-
type AdOpener = (url: string, target?: string, features?: string) => void;
|
|
1004
|
-
interface AdConfig {
|
|
1005
|
-
environment: Environment;
|
|
1006
|
-
apiEndpoint?: string;
|
|
1007
|
-
deviceInfo?: DeviceInfo;
|
|
1008
|
-
requestHeaders?: RequestHeaders;
|
|
1009
|
-
runtimeInfo?: RuntimeInfo;
|
|
1010
|
-
opener?: AdOpener;
|
|
1011
|
-
customAdFetcher?: CustomAdFetcher;
|
|
1012
|
-
}
|
|
1013
|
-
interface AdRequest {
|
|
1014
|
-
spaceUnitId: string;
|
|
1015
|
-
options?: {
|
|
1016
|
-
dummyAdFormat?: string;
|
|
1017
|
-
maxSize?: number;
|
|
1018
|
-
video?: {
|
|
1019
|
-
maxDurationMs?: number;
|
|
1020
|
-
};
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
type AdResponseStatus = 'OK' | 'NO_AD' | 'BLOCKED' | 'ERROR' | 'TIMEOUT' | 'INVALID_SPACE' | 'INVALID_REQUEST' | 'LIMITED_AD' | 'CONSENT_REQUIRED' | 'TEST_MODE';
|
|
1024
|
-
interface AdResponse {
|
|
1025
|
-
requestId?: string;
|
|
1026
|
-
status?: AdResponseStatus;
|
|
1027
|
-
ads: Ad[];
|
|
1028
|
-
ext?: AdResponseExt;
|
|
1029
|
-
}
|
|
1030
|
-
interface Ad {
|
|
1031
|
-
styleId: string;
|
|
1032
|
-
creative: Record<string, any>;
|
|
1033
|
-
eventTrackingUrls?: string[];
|
|
1034
|
-
eventTypes?: string[];
|
|
1035
|
-
eventPayload?: string;
|
|
1036
|
-
requestId?: string;
|
|
1037
|
-
}
|
|
1038
|
-
interface AdResponseExt {
|
|
1039
|
-
skippableOffsetSeconds?: number;
|
|
1040
|
-
reward?: {
|
|
1041
|
-
type: string;
|
|
1042
|
-
amount: number;
|
|
1043
|
-
};
|
|
1044
|
-
isAdBadgeEnabled?: boolean;
|
|
1045
|
-
refetchSeconds?: number | null;
|
|
1046
|
-
}
|
|
1047
|
-
interface ApiResponse<T> {
|
|
1048
|
-
resultType: 'SUCCESS' | 'HTTP_TIMEOUT' | 'NETWORK_ERROR' | 'EXECUTION_FAIL' | 'INTERRUPTED' | 'INTERNAL_ERROR' | 'FAIL';
|
|
1049
|
-
success?: T;
|
|
1050
|
-
error?: {
|
|
1051
|
-
errorType?: number;
|
|
1052
|
-
errorCode?: string;
|
|
1053
|
-
reason?: string;
|
|
1054
|
-
data?: Record<string, any>;
|
|
1055
|
-
title?: string;
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
type CustomAdFetcher = (endpoint: string, request: AdRequest, headers?: RequestHeaders) => Promise<ApiResponse<AdResponse>>;
|
|
1059
|
-
interface InitializeOptions {
|
|
1060
|
-
callbacks?: {
|
|
1061
|
-
onInitialized?: () => void;
|
|
1062
|
-
onInitializationFailed?: (error: Error) => void;
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
interface BannerSlotEventPayload {
|
|
1066
|
-
slotId: string;
|
|
1067
|
-
adGroupId: string;
|
|
1068
|
-
adMetadata: {
|
|
1069
|
-
creativeId: string;
|
|
1070
|
-
requestId: string;
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
interface BannerSlotErrorPayload {
|
|
1074
|
-
slotId: string;
|
|
1075
|
-
adGroupId: string;
|
|
1076
|
-
adMetadata: Record<string, never>;
|
|
1077
|
-
error: {
|
|
1078
|
-
code: number;
|
|
1079
|
-
message: string;
|
|
1080
|
-
domain?: string;
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
interface BannerSlotCallbacks {
|
|
1084
|
-
onAdRendered?: (payload: BannerSlotEventPayload) => void;
|
|
1085
|
-
onAdViewable?: (payload: BannerSlotEventPayload) => void;
|
|
1086
|
-
onAdClicked?: (payload: BannerSlotEventPayload) => void;
|
|
1087
|
-
onAdImpression?: (payload: BannerSlotEventPayload) => void;
|
|
1088
|
-
onAdFailedToRender?: (payload: BannerSlotErrorPayload) => void;
|
|
1089
|
-
onNoFill?: (payload: {
|
|
1090
|
-
slotId: string;
|
|
1091
|
-
adGroupId: string;
|
|
1092
|
-
adMetadata: Record<string, never>;
|
|
1093
|
-
}) => void;
|
|
1094
|
-
}
|
|
1095
|
-
interface BannerSlotOptions {
|
|
1096
|
-
spaceId: string;
|
|
1097
|
-
autoLoad?: boolean;
|
|
1098
|
-
dummyAdFormat?: string;
|
|
1099
|
-
maxVideoDurationMs?: number;
|
|
1100
|
-
refetchIntervalMs?: number;
|
|
1101
|
-
theme?: 'light' | 'dark';
|
|
1102
|
-
padding?: string;
|
|
1103
|
-
callbacks?: BannerSlotCallbacks;
|
|
1104
|
-
}
|
|
1105
|
-
interface BannerSlot {
|
|
1106
|
-
load(): void | Promise<void>;
|
|
1107
|
-
destroy(): void;
|
|
1108
|
-
}
|
|
1109
|
-
interface BannerNamespace {
|
|
1110
|
-
createSlot(target: string | HTMLElement, options: BannerSlotOptions): BannerSlot;
|
|
1111
|
-
destroy(slotId: string): void;
|
|
1112
|
-
destroyAll(): void;
|
|
1113
|
-
}
|
|
1114
|
-
interface AdsSdkGlobal {
|
|
1115
|
-
init(config: AdConfig): void;
|
|
1116
|
-
banner: BannerNamespace;
|
|
1117
|
-
isInitialized(): boolean;
|
|
1118
|
-
}
|
|
1119
|
-
declare global {
|
|
1120
|
-
interface Window {
|
|
1121
|
-
TossAdsSpaceKit?: AdsSdkGlobal;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
interface AttachOptions {
|
|
1125
|
-
theme?: 'light' | 'dark';
|
|
1126
|
-
padding?: string;
|
|
1127
|
-
callbacks?: BannerSlotCallbacks;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
declare function initialize(options: InitializeOptions): void;
|
|
1131
|
-
declare function attach(adGroupId: string, target: string | HTMLElement, options?: AttachOptions): void;
|
|
1132
|
-
declare function destroy(slotId: string): void;
|
|
1133
|
-
declare function destroyAll(): void;
|
|
1134
|
-
declare const TossAds: {
|
|
1135
|
-
initialize: typeof initialize & {
|
|
1136
|
-
isSupported: () => boolean;
|
|
1137
|
-
};
|
|
1138
|
-
attach: typeof attach & {
|
|
1139
|
-
isSupported: () => boolean;
|
|
1140
|
-
};
|
|
1141
|
-
destroy: typeof destroy & {
|
|
1142
|
-
isSupported: () => boolean;
|
|
1143
|
-
};
|
|
1144
|
-
destroyAll: typeof destroyAll & {
|
|
1145
|
-
isSupported: () => boolean;
|
|
1146
|
-
};
|
|
1147
|
-
};
|
|
1148
|
-
|
|
1149
|
-
export { type AddAccessoryButtonOptions, type AppsInTossEvent, type AppsInTossGlobals, type CompletedOrRefundedOrdersResult, GoogleAdMob, type GraniteEvent, IAP, type IapCreateOneTimePurchaseOrderOptions, type IapProductListItem, SafeAreaInsets$1 as SafeAreaInsets, Storage, type TdsEvent, TossAds, type AttachOptions as TossAdsAttachOptions, type BannerSlotCallbacks as TossAdsBannerSlotCallbacks, type BannerSlotErrorPayload as TossAdsBannerSlotErrorPayload, type BannerSlotEventPayload as TossAdsBannerSlotEventPayload, type InitializeOptions as TossAdsInitializeOptions, appsInTossEvent, env, fetchAlbumPhotos, fetchContacts, getAppsInTossGlobals, getClipboardText, getCurrentLocation, getSafeAreaInsets, graniteEvent, isMinVersionSupported, loadFullScreenAd, openCamera, partner, setClipboardText, showFullScreenAd, startUpdateLocation, tdsEvent };
|
|
964
|
+
export { type AddAccessoryButtonOptions, type AppsInTossEvent, type AppsInTossGlobals, type CompletedOrRefundedOrdersResult, GoogleAdMob, type GraniteEvent, IAP, type IapCreateOneTimePurchaseOrderOptions, type IapProductListItem, SafeAreaInsets, Storage, type TdsEvent, appsInTossEvent, env, fetchAlbumPhotos, fetchContacts, getAppsInTossGlobals, getClipboardText, getCurrentLocation, getSafeAreaInsets, graniteEvent, isMinVersionSupported, openCamera, partner, setClipboardText, startUpdateLocation, tdsEvent };
|
package/built/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './bridge';
|
|
2
2
|
export * from '@apps-in-toss/bridge-core';
|
|
3
|
-
import { LoadAdMobInterstitialAdEvent, LoadAdMobInterstitialAdOptions, ShowAdMobInterstitialAdEvent, ShowAdMobInterstitialAdOptions, LoadAdMobRewardedAdEvent, LoadAdMobRewardedAdOptions, ShowAdMobRewardedAdEvent, ShowAdMobRewardedAdOptions, LoadAdMobEvent, LoadAdMobOptions, ShowAdMobEvent, ShowAdMobOptions
|
|
3
|
+
import { LoadAdMobInterstitialAdEvent, LoadAdMobInterstitialAdOptions, ShowAdMobInterstitialAdEvent, ShowAdMobInterstitialAdOptions, LoadAdMobRewardedAdEvent, LoadAdMobRewardedAdOptions, ShowAdMobRewardedAdEvent, ShowAdMobRewardedAdOptions, LoadAdMobEvent, LoadAdMobOptions, ShowAdMobEvent, ShowAdMobOptions } from '@apps-in-toss/framework';
|
|
4
4
|
import * as _apps_in_toss_types from '@apps-in-toss/types';
|
|
5
5
|
import { FetchAlbumPhotos, FetchContacts, GetCurrentLocation, OpenCamera, SetClipboardText, GetClipboardText, StartUpdateLocationEventParams } from '@apps-in-toss/types';
|
|
6
6
|
export * from '@apps-in-toss/types';
|
|
@@ -342,15 +342,15 @@ declare function getSafeAreaInsets(): {
|
|
|
342
342
|
* ```
|
|
343
343
|
*/
|
|
344
344
|
declare function subscribeSafeAreaInsets({ onEvent }: {
|
|
345
|
-
onEvent: (data: SafeAreaInsets
|
|
345
|
+
onEvent: (data: SafeAreaInsets) => void;
|
|
346
346
|
}): () => void;
|
|
347
|
-
interface SafeAreaInsets
|
|
347
|
+
interface SafeAreaInsets {
|
|
348
348
|
top: number;
|
|
349
349
|
bottom: number;
|
|
350
350
|
left: number;
|
|
351
351
|
right: number;
|
|
352
352
|
}
|
|
353
|
-
declare const SafeAreaInsets
|
|
353
|
+
declare const SafeAreaInsets: {
|
|
354
354
|
get: typeof getSafeAreaInsets;
|
|
355
355
|
subscribe: typeof subscribeSafeAreaInsets;
|
|
356
356
|
};
|
|
@@ -961,189 +961,4 @@ declare const startUpdateLocation: {
|
|
|
961
961
|
openPermissionDialog(): Promise<"denied" | "allowed">;
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
|
|
965
|
-
onEvent: (data: LoadFullScreenAdEvent) => void;
|
|
966
|
-
onError: (error: Error) => void;
|
|
967
|
-
options?: LoadFullScreenAdOptions | undefined;
|
|
968
|
-
}) => () => void) & {
|
|
969
|
-
isSupported: () => boolean;
|
|
970
|
-
};
|
|
971
|
-
declare const showFullScreenAd: ((args: {
|
|
972
|
-
onEvent: (data: ShowFullScreenAdEvent) => void;
|
|
973
|
-
onError: (error: Error) => void;
|
|
974
|
-
options?: ShowFullScreenAdOptions | undefined;
|
|
975
|
-
}) => () => void) & {
|
|
976
|
-
isSupported: () => boolean;
|
|
977
|
-
};
|
|
978
|
-
|
|
979
|
-
type Environment = 'alpha' | 'live';
|
|
980
|
-
type DeviceOS = 'IOS' | 'ANDROID';
|
|
981
|
-
type DeviceAttStatus = 'NOT_DETERMINED' | 'RESTRICTED' | 'DENIED' | 'AUTHORIZED';
|
|
982
|
-
type DeviceCarrier = 'SKT' | 'KT' | 'LGU' | 'SKT_MVNO' | 'KT_MVNO' | 'LG_MVNO';
|
|
983
|
-
type RequestHeaders = Record<string, string>;
|
|
984
|
-
interface DeviceInfo {
|
|
985
|
-
os?: DeviceOS;
|
|
986
|
-
osVersion?: string;
|
|
987
|
-
ua?: string;
|
|
988
|
-
ifa?: string;
|
|
989
|
-
ifv?: string | null;
|
|
990
|
-
attStatus?: DeviceAttStatus | null;
|
|
991
|
-
model?: string;
|
|
992
|
-
carrier?: DeviceCarrier;
|
|
993
|
-
}
|
|
994
|
-
interface SafeAreaInsets {
|
|
995
|
-
top: string;
|
|
996
|
-
bottom: string;
|
|
997
|
-
left: string;
|
|
998
|
-
right: string;
|
|
999
|
-
}
|
|
1000
|
-
interface RuntimeInfo {
|
|
1001
|
-
safeAreaInsets?: SafeAreaInsets;
|
|
1002
|
-
}
|
|
1003
|
-
type AdOpener = (url: string, target?: string, features?: string) => void;
|
|
1004
|
-
interface AdConfig {
|
|
1005
|
-
environment: Environment;
|
|
1006
|
-
apiEndpoint?: string;
|
|
1007
|
-
deviceInfo?: DeviceInfo;
|
|
1008
|
-
requestHeaders?: RequestHeaders;
|
|
1009
|
-
runtimeInfo?: RuntimeInfo;
|
|
1010
|
-
opener?: AdOpener;
|
|
1011
|
-
customAdFetcher?: CustomAdFetcher;
|
|
1012
|
-
}
|
|
1013
|
-
interface AdRequest {
|
|
1014
|
-
spaceUnitId: string;
|
|
1015
|
-
options?: {
|
|
1016
|
-
dummyAdFormat?: string;
|
|
1017
|
-
maxSize?: number;
|
|
1018
|
-
video?: {
|
|
1019
|
-
maxDurationMs?: number;
|
|
1020
|
-
};
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
type AdResponseStatus = 'OK' | 'NO_AD' | 'BLOCKED' | 'ERROR' | 'TIMEOUT' | 'INVALID_SPACE' | 'INVALID_REQUEST' | 'LIMITED_AD' | 'CONSENT_REQUIRED' | 'TEST_MODE';
|
|
1024
|
-
interface AdResponse {
|
|
1025
|
-
requestId?: string;
|
|
1026
|
-
status?: AdResponseStatus;
|
|
1027
|
-
ads: Ad[];
|
|
1028
|
-
ext?: AdResponseExt;
|
|
1029
|
-
}
|
|
1030
|
-
interface Ad {
|
|
1031
|
-
styleId: string;
|
|
1032
|
-
creative: Record<string, any>;
|
|
1033
|
-
eventTrackingUrls?: string[];
|
|
1034
|
-
eventTypes?: string[];
|
|
1035
|
-
eventPayload?: string;
|
|
1036
|
-
requestId?: string;
|
|
1037
|
-
}
|
|
1038
|
-
interface AdResponseExt {
|
|
1039
|
-
skippableOffsetSeconds?: number;
|
|
1040
|
-
reward?: {
|
|
1041
|
-
type: string;
|
|
1042
|
-
amount: number;
|
|
1043
|
-
};
|
|
1044
|
-
isAdBadgeEnabled?: boolean;
|
|
1045
|
-
refetchSeconds?: number | null;
|
|
1046
|
-
}
|
|
1047
|
-
interface ApiResponse<T> {
|
|
1048
|
-
resultType: 'SUCCESS' | 'HTTP_TIMEOUT' | 'NETWORK_ERROR' | 'EXECUTION_FAIL' | 'INTERRUPTED' | 'INTERNAL_ERROR' | 'FAIL';
|
|
1049
|
-
success?: T;
|
|
1050
|
-
error?: {
|
|
1051
|
-
errorType?: number;
|
|
1052
|
-
errorCode?: string;
|
|
1053
|
-
reason?: string;
|
|
1054
|
-
data?: Record<string, any>;
|
|
1055
|
-
title?: string;
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
type CustomAdFetcher = (endpoint: string, request: AdRequest, headers?: RequestHeaders) => Promise<ApiResponse<AdResponse>>;
|
|
1059
|
-
interface InitializeOptions {
|
|
1060
|
-
callbacks?: {
|
|
1061
|
-
onInitialized?: () => void;
|
|
1062
|
-
onInitializationFailed?: (error: Error) => void;
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
interface BannerSlotEventPayload {
|
|
1066
|
-
slotId: string;
|
|
1067
|
-
adGroupId: string;
|
|
1068
|
-
adMetadata: {
|
|
1069
|
-
creativeId: string;
|
|
1070
|
-
requestId: string;
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
interface BannerSlotErrorPayload {
|
|
1074
|
-
slotId: string;
|
|
1075
|
-
adGroupId: string;
|
|
1076
|
-
adMetadata: Record<string, never>;
|
|
1077
|
-
error: {
|
|
1078
|
-
code: number;
|
|
1079
|
-
message: string;
|
|
1080
|
-
domain?: string;
|
|
1081
|
-
};
|
|
1082
|
-
}
|
|
1083
|
-
interface BannerSlotCallbacks {
|
|
1084
|
-
onAdRendered?: (payload: BannerSlotEventPayload) => void;
|
|
1085
|
-
onAdViewable?: (payload: BannerSlotEventPayload) => void;
|
|
1086
|
-
onAdClicked?: (payload: BannerSlotEventPayload) => void;
|
|
1087
|
-
onAdImpression?: (payload: BannerSlotEventPayload) => void;
|
|
1088
|
-
onAdFailedToRender?: (payload: BannerSlotErrorPayload) => void;
|
|
1089
|
-
onNoFill?: (payload: {
|
|
1090
|
-
slotId: string;
|
|
1091
|
-
adGroupId: string;
|
|
1092
|
-
adMetadata: Record<string, never>;
|
|
1093
|
-
}) => void;
|
|
1094
|
-
}
|
|
1095
|
-
interface BannerSlotOptions {
|
|
1096
|
-
spaceId: string;
|
|
1097
|
-
autoLoad?: boolean;
|
|
1098
|
-
dummyAdFormat?: string;
|
|
1099
|
-
maxVideoDurationMs?: number;
|
|
1100
|
-
refetchIntervalMs?: number;
|
|
1101
|
-
theme?: 'light' | 'dark';
|
|
1102
|
-
padding?: string;
|
|
1103
|
-
callbacks?: BannerSlotCallbacks;
|
|
1104
|
-
}
|
|
1105
|
-
interface BannerSlot {
|
|
1106
|
-
load(): void | Promise<void>;
|
|
1107
|
-
destroy(): void;
|
|
1108
|
-
}
|
|
1109
|
-
interface BannerNamespace {
|
|
1110
|
-
createSlot(target: string | HTMLElement, options: BannerSlotOptions): BannerSlot;
|
|
1111
|
-
destroy(slotId: string): void;
|
|
1112
|
-
destroyAll(): void;
|
|
1113
|
-
}
|
|
1114
|
-
interface AdsSdkGlobal {
|
|
1115
|
-
init(config: AdConfig): void;
|
|
1116
|
-
banner: BannerNamespace;
|
|
1117
|
-
isInitialized(): boolean;
|
|
1118
|
-
}
|
|
1119
|
-
declare global {
|
|
1120
|
-
interface Window {
|
|
1121
|
-
TossAdsSpaceKit?: AdsSdkGlobal;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
interface AttachOptions {
|
|
1125
|
-
theme?: 'light' | 'dark';
|
|
1126
|
-
padding?: string;
|
|
1127
|
-
callbacks?: BannerSlotCallbacks;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
declare function initialize(options: InitializeOptions): void;
|
|
1131
|
-
declare function attach(adGroupId: string, target: string | HTMLElement, options?: AttachOptions): void;
|
|
1132
|
-
declare function destroy(slotId: string): void;
|
|
1133
|
-
declare function destroyAll(): void;
|
|
1134
|
-
declare const TossAds: {
|
|
1135
|
-
initialize: typeof initialize & {
|
|
1136
|
-
isSupported: () => boolean;
|
|
1137
|
-
};
|
|
1138
|
-
attach: typeof attach & {
|
|
1139
|
-
isSupported: () => boolean;
|
|
1140
|
-
};
|
|
1141
|
-
destroy: typeof destroy & {
|
|
1142
|
-
isSupported: () => boolean;
|
|
1143
|
-
};
|
|
1144
|
-
destroyAll: typeof destroyAll & {
|
|
1145
|
-
isSupported: () => boolean;
|
|
1146
|
-
};
|
|
1147
|
-
};
|
|
1148
|
-
|
|
1149
|
-
export { type AddAccessoryButtonOptions, type AppsInTossEvent, type AppsInTossGlobals, type CompletedOrRefundedOrdersResult, GoogleAdMob, type GraniteEvent, IAP, type IapCreateOneTimePurchaseOrderOptions, type IapProductListItem, SafeAreaInsets$1 as SafeAreaInsets, Storage, type TdsEvent, TossAds, type AttachOptions as TossAdsAttachOptions, type BannerSlotCallbacks as TossAdsBannerSlotCallbacks, type BannerSlotErrorPayload as TossAdsBannerSlotErrorPayload, type BannerSlotEventPayload as TossAdsBannerSlotEventPayload, type InitializeOptions as TossAdsInitializeOptions, appsInTossEvent, env, fetchAlbumPhotos, fetchContacts, getAppsInTossGlobals, getClipboardText, getCurrentLocation, getSafeAreaInsets, graniteEvent, isMinVersionSupported, loadFullScreenAd, openCamera, partner, setClipboardText, showFullScreenAd, startUpdateLocation, tdsEvent };
|
|
964
|
+
export { type AddAccessoryButtonOptions, type AppsInTossEvent, type AppsInTossGlobals, type CompletedOrRefundedOrdersResult, GoogleAdMob, type GraniteEvent, IAP, type IapCreateOneTimePurchaseOrderOptions, type IapProductListItem, SafeAreaInsets, Storage, type TdsEvent, appsInTossEvent, env, fetchAlbumPhotos, fetchContacts, getAppsInTossGlobals, getClipboardText, getCurrentLocation, getSafeAreaInsets, graniteEvent, isMinVersionSupported, openCamera, partner, setClipboardText, startUpdateLocation, tdsEvent };
|
package/built/index.js
CHANGED
|
@@ -1022,287 +1022,6 @@ var startUpdateLocation = (params) => {
|
|
|
1022
1022
|
startUpdateLocation.getPermission = () => getPermission2({ name: "geolocation", access: "access" });
|
|
1023
1023
|
startUpdateLocation.openPermissionDialog = () => openPermissionDialog2({ name: "geolocation", access: "access" });
|
|
1024
1024
|
|
|
1025
|
-
// src/integratedAd.ts
|
|
1026
|
-
import { createConstantBridge as createConstantBridge6, createEventBridge as createEventBridge8 } from "@apps-in-toss/bridge-core";
|
|
1027
|
-
var loadFullScreenAd = Object.assign(createEventBridge8("loadFullScreenAd"), {
|
|
1028
|
-
isSupported: createConstantBridge6("loadFullScreenAd_isSupported")
|
|
1029
|
-
});
|
|
1030
|
-
var showFullScreenAd = Object.assign(createEventBridge8("showFullScreenAd"), {
|
|
1031
|
-
isSupported: createConstantBridge6("showFullScreenAd_isSupported")
|
|
1032
|
-
});
|
|
1033
|
-
|
|
1034
|
-
// src/toss-ad/index.ts
|
|
1035
|
-
import { createAsyncBridge as createAsyncBridge13, createConstantBridge as createConstantBridge7, createEventBridge as createEventBridge9 } from "@apps-in-toss/bridge-core";
|
|
1036
|
-
|
|
1037
|
-
// src/toss-ad/opener.ts
|
|
1038
|
-
import { createAsyncBridge as createAsyncBridge12 } from "@apps-in-toss/bridge-core";
|
|
1039
|
-
var openURL = createAsyncBridge12("openURL");
|
|
1040
|
-
function openUrlOpener(url) {
|
|
1041
|
-
const transformed = getWebSchemeOrUri(url);
|
|
1042
|
-
return openURL(transformed);
|
|
1043
|
-
}
|
|
1044
|
-
function getWebSchemeOrUri(uri) {
|
|
1045
|
-
const isHttp = ["http://", "https://"].some((protocol) => uri.startsWith(protocol));
|
|
1046
|
-
return isHttp ? supertossWeb(uri) : uri;
|
|
1047
|
-
}
|
|
1048
|
-
function supertossWeb(uri) {
|
|
1049
|
-
return `supertoss://web?url=${encodeURIComponent(uri)}&external=true`;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
// src/toss-ad/scriptLoader.ts
|
|
1053
|
-
var DEFAULT_SDK_URL = "https://static.toss.im/ads/sdk/toss-ads-space-kit-1.3.0.js";
|
|
1054
|
-
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
1055
|
-
var pendingLoad = null;
|
|
1056
|
-
function getAdsSdk() {
|
|
1057
|
-
if (typeof window === "undefined") {
|
|
1058
|
-
return void 0;
|
|
1059
|
-
}
|
|
1060
|
-
return window.TossAdsSpaceKit;
|
|
1061
|
-
}
|
|
1062
|
-
function loadAdsSdk() {
|
|
1063
|
-
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
1064
|
-
return Promise.reject(new Error("Ads SDK can only be loaded in a browser environment."));
|
|
1065
|
-
}
|
|
1066
|
-
const existing = getAdsSdk();
|
|
1067
|
-
if (existing) {
|
|
1068
|
-
return Promise.resolve(existing);
|
|
1069
|
-
}
|
|
1070
|
-
if (pendingLoad) {
|
|
1071
|
-
return pendingLoad;
|
|
1072
|
-
}
|
|
1073
|
-
const promise = new Promise((resolve, reject) => {
|
|
1074
|
-
const script = document.createElement("script");
|
|
1075
|
-
const cleanup = () => {
|
|
1076
|
-
script.removeEventListener("load", handleLoad);
|
|
1077
|
-
script.removeEventListener("error", handleError);
|
|
1078
|
-
window.clearTimeout(timeoutId);
|
|
1079
|
-
pendingLoad = null;
|
|
1080
|
-
};
|
|
1081
|
-
const handleLoad = () => {
|
|
1082
|
-
const sdk = getAdsSdk();
|
|
1083
|
-
if (sdk) {
|
|
1084
|
-
cleanup();
|
|
1085
|
-
resolve(sdk);
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
cleanup();
|
|
1089
|
-
reject(new Error("Ads SDK script loaded but window.TossAdsSpaceKit was not exposed."));
|
|
1090
|
-
};
|
|
1091
|
-
const handleError = () => {
|
|
1092
|
-
cleanup();
|
|
1093
|
-
reject(new Error(`Failed to load Ads SDK script from ${DEFAULT_SDK_URL}.`));
|
|
1094
|
-
};
|
|
1095
|
-
const timeoutId = window.setTimeout(() => {
|
|
1096
|
-
cleanup();
|
|
1097
|
-
reject(new Error(`Loading Ads SDK timed out after ${DEFAULT_TIMEOUT_MS}ms.`));
|
|
1098
|
-
}, DEFAULT_TIMEOUT_MS);
|
|
1099
|
-
script.addEventListener("load", handleLoad);
|
|
1100
|
-
script.addEventListener("error", handleError);
|
|
1101
|
-
script.async = true;
|
|
1102
|
-
script.src = DEFAULT_SDK_URL;
|
|
1103
|
-
document.head.appendChild(script);
|
|
1104
|
-
});
|
|
1105
|
-
pendingLoad = promise;
|
|
1106
|
-
return promise;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
// src/toss-ad/index.ts
|
|
1110
|
-
var fetchTossAd = Object.assign(createEventBridge9("fetchTossAd"), {
|
|
1111
|
-
isSupported: createConstantBridge7("fetchTossAd_isSupported")
|
|
1112
|
-
});
|
|
1113
|
-
var tossAdEventLog = createAsyncBridge13("tossAdEventLog");
|
|
1114
|
-
var SUPPORTED_STYLE_IDS = /* @__PURE__ */ new Set(["1", "2"]);
|
|
1115
|
-
function fetchTossAdPromise(options) {
|
|
1116
|
-
return new Promise((resolve, reject) => {
|
|
1117
|
-
if (!fetchTossAd.isSupported()) {
|
|
1118
|
-
reject(new Error("fetchTossAd is not supported in this environment."));
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
return fetchTossAd({
|
|
1122
|
-
options,
|
|
1123
|
-
onEvent: resolve,
|
|
1124
|
-
onError: reject
|
|
1125
|
-
});
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
function normalizeAdResponse(adResponse) {
|
|
1129
|
-
const ads = Array.isArray(adResponse.ads) ? adResponse.ads.filter((ad) => SUPPORTED_STYLE_IDS.has(String(ad.styleId))) : [];
|
|
1130
|
-
return {
|
|
1131
|
-
requestId: adResponse.requestId ?? "",
|
|
1132
|
-
status: adResponse.status ?? "OK",
|
|
1133
|
-
ads,
|
|
1134
|
-
ext: adResponse.ext
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
function normalizeApiResponse(raw) {
|
|
1138
|
-
if (isApiResponse(raw)) {
|
|
1139
|
-
if (raw.resultType !== "SUCCESS") {
|
|
1140
|
-
return raw;
|
|
1141
|
-
}
|
|
1142
|
-
if (!raw.success) {
|
|
1143
|
-
return {
|
|
1144
|
-
resultType: "FAIL",
|
|
1145
|
-
error: { reason: "fetchTossAd returned SUCCESS without payload" }
|
|
1146
|
-
};
|
|
1147
|
-
}
|
|
1148
|
-
return { ...raw, success: normalizeAdResponse(raw.success) };
|
|
1149
|
-
}
|
|
1150
|
-
if (isAdResponse(raw)) {
|
|
1151
|
-
return {
|
|
1152
|
-
resultType: "SUCCESS",
|
|
1153
|
-
success: normalizeAdResponse(raw)
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
return { resultType: "FAIL", error: { reason: "Invalid response from fetchTossAd" } };
|
|
1157
|
-
}
|
|
1158
|
-
function isApiResponse(payload) {
|
|
1159
|
-
return Boolean(payload && typeof payload === "object" && "resultType" in payload);
|
|
1160
|
-
}
|
|
1161
|
-
function isAdResponse(payload) {
|
|
1162
|
-
return Boolean(payload && typeof payload === "object" && "ads" in payload);
|
|
1163
|
-
}
|
|
1164
|
-
function createCustomAdFetcher() {
|
|
1165
|
-
return async (_endpoint, request) => {
|
|
1166
|
-
try {
|
|
1167
|
-
const raw = await fetchTossAdPromise({
|
|
1168
|
-
adGroupId: request.spaceUnitId,
|
|
1169
|
-
sdkId: "108",
|
|
1170
|
-
availableStyleIds: ["1", "2"]
|
|
1171
|
-
});
|
|
1172
|
-
return normalizeApiResponse(raw);
|
|
1173
|
-
} catch (error) {
|
|
1174
|
-
return {
|
|
1175
|
-
resultType: "FAIL",
|
|
1176
|
-
error: {
|
|
1177
|
-
reason: error instanceof Error ? error.message : "Unknown fetchTossAd error"
|
|
1178
|
-
}
|
|
1179
|
-
};
|
|
1180
|
-
}
|
|
1181
|
-
};
|
|
1182
|
-
}
|
|
1183
|
-
var pendingLoad2 = null;
|
|
1184
|
-
function initialize(options) {
|
|
1185
|
-
const { callbacks } = options;
|
|
1186
|
-
if (window.TossAdsSpaceKit != null && window.TossAdsSpaceKit.isInitialized()) {
|
|
1187
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] Already initialized."));
|
|
1188
|
-
return;
|
|
1189
|
-
}
|
|
1190
|
-
if (pendingLoad2 != null) {
|
|
1191
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] initialization already in progress."));
|
|
1192
|
-
}
|
|
1193
|
-
const resolveInitialized = () => callbacks?.onInitialized?.();
|
|
1194
|
-
const rejectInitialized = (error) => {
|
|
1195
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1196
|
-
callbacks?.onInitializationFailed?.(normalizedError);
|
|
1197
|
-
};
|
|
1198
|
-
pendingLoad2 = loadAdsSdk().then((sdk) => {
|
|
1199
|
-
const customAdFetcher = createCustomAdFetcher();
|
|
1200
|
-
const config = { environment: "live", customAdFetcher, opener: openUrlOpener };
|
|
1201
|
-
sdk.init(config);
|
|
1202
|
-
resolveInitialized();
|
|
1203
|
-
}).catch((error) => {
|
|
1204
|
-
pendingLoad2 = null;
|
|
1205
|
-
rejectInitialized(error);
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1208
|
-
function attach(adGroupId, target, options = {}) {
|
|
1209
|
-
const { callbacks } = options;
|
|
1210
|
-
const rejectAttached = (error) => {
|
|
1211
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1212
|
-
callbacks?.onAdFailedToRender?.({
|
|
1213
|
-
slotId: "",
|
|
1214
|
-
adGroupId,
|
|
1215
|
-
adMetadata: {},
|
|
1216
|
-
error: { code: 0, message: normalizedError.message }
|
|
1217
|
-
});
|
|
1218
|
-
};
|
|
1219
|
-
try {
|
|
1220
|
-
const spaceId = adGroupId;
|
|
1221
|
-
const sdk = getAdsSdk();
|
|
1222
|
-
if (!sdk) {
|
|
1223
|
-
throw new Error("[toss-ad] Call initialize() before attaching an ad.");
|
|
1224
|
-
}
|
|
1225
|
-
if (!sdk.banner) {
|
|
1226
|
-
throw new Error("[toss-ad] Loaded TossAdsSpaceKit does not support banner ads.");
|
|
1227
|
-
}
|
|
1228
|
-
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
1229
|
-
if (!element) {
|
|
1230
|
-
throw new Error(`[toss-ad] Failed to find target element: ${target}`);
|
|
1231
|
-
}
|
|
1232
|
-
const slotOptions = {
|
|
1233
|
-
spaceId,
|
|
1234
|
-
autoLoad: true,
|
|
1235
|
-
theme: options.theme,
|
|
1236
|
-
padding: options.padding,
|
|
1237
|
-
callbacks: wrapCallbacks(adGroupId, options.callbacks)
|
|
1238
|
-
};
|
|
1239
|
-
sdk.banner.createSlot(element, slotOptions);
|
|
1240
|
-
} catch (error) {
|
|
1241
|
-
rejectAttached(error);
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
function destroy(slotId) {
|
|
1245
|
-
const sdk = getAdsSdk();
|
|
1246
|
-
if (!sdk?.banner) {
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
sdk.banner.destroy(slotId);
|
|
1250
|
-
}
|
|
1251
|
-
function destroyAll() {
|
|
1252
|
-
const sdk = getAdsSdk();
|
|
1253
|
-
if (!sdk?.banner) {
|
|
1254
|
-
return;
|
|
1255
|
-
}
|
|
1256
|
-
sdk.banner.destroyAll();
|
|
1257
|
-
}
|
|
1258
|
-
function wrapCallbacks(adGroupId, callbacks) {
|
|
1259
|
-
if (!callbacks) {
|
|
1260
|
-
return void 0;
|
|
1261
|
-
}
|
|
1262
|
-
const mapEvent = (payload) => {
|
|
1263
|
-
const next = { ...payload ?? {} };
|
|
1264
|
-
next.adGroupId = next.adGroupId ?? next.spaceId ?? adGroupId;
|
|
1265
|
-
delete next.spaceId;
|
|
1266
|
-
return next;
|
|
1267
|
-
};
|
|
1268
|
-
return {
|
|
1269
|
-
onAdRendered: (payload) => callbacks.onAdRendered?.(mapEvent(payload)),
|
|
1270
|
-
onAdViewable: (payload) => callbacks.onAdViewable?.(mapEvent(payload)),
|
|
1271
|
-
onAdClicked: (payload) => callbacks.onAdClicked?.(mapEvent(payload)),
|
|
1272
|
-
onAdImpression: (payload) => {
|
|
1273
|
-
tossAdEventLog({
|
|
1274
|
-
log_name: "display_ads_all::impression__1px_banner",
|
|
1275
|
-
log_type: "event",
|
|
1276
|
-
params: {
|
|
1277
|
-
event_type: "impression",
|
|
1278
|
-
schema_id: 1812034,
|
|
1279
|
-
request_id: payload?.adMetadata?.requestId ?? ""
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
callbacks.onAdImpression?.(mapEvent(payload));
|
|
1283
|
-
},
|
|
1284
|
-
onAdFailedToRender: (payload) => callbacks.onAdFailedToRender?.({
|
|
1285
|
-
...mapEvent(payload),
|
|
1286
|
-
error: payload?.error ?? { code: 0, message: "UNKNOWN" }
|
|
1287
|
-
}),
|
|
1288
|
-
onNoFill: (payload) => callbacks.onNoFill?.(mapEvent(payload))
|
|
1289
|
-
};
|
|
1290
|
-
}
|
|
1291
|
-
var TossAds = {
|
|
1292
|
-
initialize: Object.assign(initialize, {
|
|
1293
|
-
isSupported: fetchTossAd.isSupported
|
|
1294
|
-
}),
|
|
1295
|
-
attach: Object.assign(attach, {
|
|
1296
|
-
isSupported: fetchTossAd.isSupported
|
|
1297
|
-
}),
|
|
1298
|
-
destroy: Object.assign(destroy, {
|
|
1299
|
-
isSupported: fetchTossAd.isSupported
|
|
1300
|
-
}),
|
|
1301
|
-
destroyAll: Object.assign(destroyAll, {
|
|
1302
|
-
isSupported: fetchTossAd.isSupported
|
|
1303
|
-
})
|
|
1304
|
-
};
|
|
1305
|
-
|
|
1306
1025
|
// src/index.ts
|
|
1307
1026
|
export * from "@apps-in-toss/types";
|
|
1308
1027
|
export {
|
|
@@ -1310,7 +1029,6 @@ export {
|
|
|
1310
1029
|
IAP,
|
|
1311
1030
|
SafeAreaInsets,
|
|
1312
1031
|
Storage,
|
|
1313
|
-
TossAds,
|
|
1314
1032
|
appsInTossEvent,
|
|
1315
1033
|
env,
|
|
1316
1034
|
fetchAlbumPhotos,
|
|
@@ -1321,11 +1039,9 @@ export {
|
|
|
1321
1039
|
getSafeAreaInsets,
|
|
1322
1040
|
graniteEvent,
|
|
1323
1041
|
isMinVersionSupported,
|
|
1324
|
-
loadFullScreenAd,
|
|
1325
1042
|
openCamera,
|
|
1326
1043
|
partner,
|
|
1327
1044
|
setClipboardText,
|
|
1328
|
-
showFullScreenAd,
|
|
1329
1045
|
startUpdateLocation,
|
|
1330
1046
|
tdsEvent
|
|
1331
1047
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/web-bridge",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-dev.
|
|
4
|
+
"version": "0.0.0-dev.1765878631929",
|
|
5
5
|
"description": "Web Bridge for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"built"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@apps-in-toss/types": "0.0.0-dev.
|
|
31
|
+
"@apps-in-toss/types": "0.0.0-dev.1765878631929"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@apps-in-toss/bridge-core": "0.0.0-dev.
|
|
35
|
-
"@apps-in-toss/framework": "0.0.0-dev.
|
|
34
|
+
"@apps-in-toss/bridge-core": "0.0.0-dev.1765878631929",
|
|
35
|
+
"@apps-in-toss/framework": "0.0.0-dev.1765878631929",
|
|
36
36
|
"@swc/core": "^1.12.7",
|
|
37
37
|
"picocolors": "^1.1.1",
|
|
38
38
|
"ts-morph": "^26.0.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "f54ad0a6526e1b4752239cb0670dedbab5170c67"
|
|
50
50
|
}
|