@apps-in-toss/web-bridge 0.0.0-dev.1764816865438 → 0.0.0-dev.1765732023607
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/eventLog.d.ts +2 -2
- package/built/index.cjs +0 -283
- package/built/index.d.cts +6 -197
- package/built/index.d.ts +6 -197
- package/built/index.js +0 -280
- package/package.json +5 -5
package/built/eventLog.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type Primitive = string | number | boolean | null | undefined | symbol;
|
|
2
2
|
export interface EventLogParams {
|
|
3
3
|
log_name: string;
|
|
4
|
-
log_type: "debug" | "info" | "warn" | "error" | "screen" | "impression" | "click";
|
|
4
|
+
log_type: "debug" | "info" | "warn" | "error" | "event" | "screen" | "impression" | "click";
|
|
5
5
|
params: Record<string, Primitive>;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -15,7 +15,7 @@ export interface EventLogParams {
|
|
|
15
15
|
*
|
|
16
16
|
* @param {Object} params 로그 기록에 필요한 매개변수 객체예요.
|
|
17
17
|
* @param {string} params.log_name 로그의 이름이에요.
|
|
18
|
-
* @param {'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click'} params.log_type 로그의 유형이에요.
|
|
18
|
+
* @param {'debug' | 'info' | 'warn' | 'error' | 'event' | 'screen' | 'impression' | 'click'} params.log_type 로그의 유형이에요.
|
|
19
19
|
* @param {Record<string, Primitive>} params.params 로그에 포함할 추가 매개변수 객체예요.
|
|
20
20
|
*
|
|
21
21
|
* @returns {Promise<void>} 로그 기록이 완료되면 해결되는 Promise예요.
|
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,283 +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.0.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({ adGroupId: request.spaceUnitId });
|
|
1209
|
-
return normalizeApiResponse(raw);
|
|
1210
|
-
} catch (error) {
|
|
1211
|
-
return {
|
|
1212
|
-
resultType: "FAIL",
|
|
1213
|
-
error: {
|
|
1214
|
-
reason: error instanceof Error ? error.message : "Unknown fetchTossAd error"
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
}
|
|
1218
|
-
};
|
|
1219
|
-
}
|
|
1220
|
-
var pendingLoad2 = null;
|
|
1221
|
-
function initialize(options) {
|
|
1222
|
-
const { callbacks } = options;
|
|
1223
|
-
if (window.TossAdsSpaceKit != null && window.TossAdsSpaceKit.isInitialized()) {
|
|
1224
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] Already initialized."));
|
|
1225
|
-
return;
|
|
1226
|
-
}
|
|
1227
|
-
if (pendingLoad2 != null) {
|
|
1228
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] initialization already in progress."));
|
|
1229
|
-
}
|
|
1230
|
-
const resolveInitialized = () => callbacks?.onInitialized?.();
|
|
1231
|
-
const rejectInitialized = (error) => {
|
|
1232
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1233
|
-
callbacks?.onInitializationFailed?.(normalizedError);
|
|
1234
|
-
};
|
|
1235
|
-
pendingLoad2 = loadAdsSdk().then((sdk) => {
|
|
1236
|
-
const customAdFetcher = createCustomAdFetcher();
|
|
1237
|
-
const config = { environment: "live", customAdFetcher, opener: openUrlOpener };
|
|
1238
|
-
sdk.init(config);
|
|
1239
|
-
resolveInitialized();
|
|
1240
|
-
}).catch((error) => {
|
|
1241
|
-
pendingLoad2 = null;
|
|
1242
|
-
rejectInitialized(error);
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
function attach(adGroupId, target, options = {}) {
|
|
1246
|
-
const { callbacks } = options;
|
|
1247
|
-
const rejectAttached = (error) => {
|
|
1248
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1249
|
-
callbacks?.onAdFailedToRender?.({
|
|
1250
|
-
slotId: "",
|
|
1251
|
-
adGroupId,
|
|
1252
|
-
adMetadata: {},
|
|
1253
|
-
error: { code: 0, message: normalizedError.message }
|
|
1254
|
-
});
|
|
1255
|
-
};
|
|
1256
|
-
try {
|
|
1257
|
-
const spaceId = adGroupId;
|
|
1258
|
-
const sdk = getAdsSdk();
|
|
1259
|
-
if (!sdk) {
|
|
1260
|
-
throw new Error("[toss-ad] Call initialize() before attaching an ad.");
|
|
1261
|
-
}
|
|
1262
|
-
if (!sdk.banner) {
|
|
1263
|
-
throw new Error("[toss-ad] Loaded TossAdsSpaceKit does not support banner ads.");
|
|
1264
|
-
}
|
|
1265
|
-
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
1266
|
-
if (!element) {
|
|
1267
|
-
throw new Error(`[toss-ad] Failed to find target element: ${target}`);
|
|
1268
|
-
}
|
|
1269
|
-
const slotOptions = {
|
|
1270
|
-
spaceId,
|
|
1271
|
-
autoLoad: true,
|
|
1272
|
-
theme: options.theme,
|
|
1273
|
-
padding: options.padding,
|
|
1274
|
-
callbacks: wrapCallbacks(adGroupId, options.callbacks)
|
|
1275
|
-
};
|
|
1276
|
-
sdk.banner.createSlot(element, slotOptions);
|
|
1277
|
-
} catch (error) {
|
|
1278
|
-
rejectAttached(error);
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
function destroy(slotId) {
|
|
1282
|
-
const sdk = getAdsSdk();
|
|
1283
|
-
if (!sdk?.banner) {
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
sdk.banner.destroy(slotId);
|
|
1287
|
-
}
|
|
1288
|
-
function destroyAll() {
|
|
1289
|
-
const sdk = getAdsSdk();
|
|
1290
|
-
if (!sdk?.banner) {
|
|
1291
|
-
return;
|
|
1292
|
-
}
|
|
1293
|
-
sdk.banner.destroyAll();
|
|
1294
|
-
}
|
|
1295
|
-
function wrapCallbacks(adGroupId, callbacks) {
|
|
1296
|
-
if (!callbacks) {
|
|
1297
|
-
return void 0;
|
|
1298
|
-
}
|
|
1299
|
-
const mapEvent = (payload) => {
|
|
1300
|
-
const next = { ...payload ?? {} };
|
|
1301
|
-
next.adGroupId = next.adGroupId ?? next.spaceId ?? adGroupId;
|
|
1302
|
-
delete next.spaceId;
|
|
1303
|
-
return next;
|
|
1304
|
-
};
|
|
1305
|
-
return {
|
|
1306
|
-
onAdRendered: (payload) => callbacks.onAdRendered?.(mapEvent(payload)),
|
|
1307
|
-
onAdViewable: (payload) => callbacks.onAdViewable?.(mapEvent(payload)),
|
|
1308
|
-
onAdClicked: (payload) => callbacks.onAdClicked?.(mapEvent(payload)),
|
|
1309
|
-
onAdImpression: (payload) => {
|
|
1310
|
-
tossAdEventLog({
|
|
1311
|
-
log_name: "display_ads_all::impression__1px_banner",
|
|
1312
|
-
log_type: "event",
|
|
1313
|
-
params: {
|
|
1314
|
-
event_type: "impression",
|
|
1315
|
-
schema_id: 1812034,
|
|
1316
|
-
request_id: payload?.adMetadata?.requestId ?? ""
|
|
1317
|
-
}
|
|
1318
|
-
});
|
|
1319
|
-
callbacks.onAdImpression?.(mapEvent(payload));
|
|
1320
|
-
},
|
|
1321
|
-
onAdFailedToRender: (payload) => callbacks.onAdFailedToRender?.({
|
|
1322
|
-
...mapEvent(payload),
|
|
1323
|
-
error: payload?.error ?? { code: 0, message: "UNKNOWN" }
|
|
1324
|
-
}),
|
|
1325
|
-
onNoFill: (payload) => callbacks.onNoFill?.(mapEvent(payload))
|
|
1326
|
-
};
|
|
1327
|
-
}
|
|
1328
|
-
var TossAds = {
|
|
1329
|
-
initialize: Object.assign(initialize, {
|
|
1330
|
-
isSupported: fetchTossAd.isSupported
|
|
1331
|
-
}),
|
|
1332
|
-
attach: Object.assign(attach, {
|
|
1333
|
-
isSupported: fetchTossAd.isSupported
|
|
1334
|
-
}),
|
|
1335
|
-
destroy: Object.assign(destroy, {
|
|
1336
|
-
isSupported: fetchTossAd.isSupported
|
|
1337
|
-
}),
|
|
1338
|
-
destroyAll: Object.assign(destroyAll, {
|
|
1339
|
-
isSupported: fetchTossAd.isSupported
|
|
1340
|
-
})
|
|
1341
|
-
};
|
|
1342
|
-
|
|
1343
1063
|
// src/index.ts
|
|
1344
1064
|
__reExport(index_exports, require("@apps-in-toss/types"), module.exports);
|
|
1345
1065
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1348,7 +1068,6 @@ __reExport(index_exports, require("@apps-in-toss/types"), module.exports);
|
|
|
1348
1068
|
IAP,
|
|
1349
1069
|
SafeAreaInsets,
|
|
1350
1070
|
Storage,
|
|
1351
|
-
TossAds,
|
|
1352
1071
|
appsInTossEvent,
|
|
1353
1072
|
env,
|
|
1354
1073
|
fetchAlbumPhotos,
|
|
@@ -1359,11 +1078,9 @@ __reExport(index_exports, require("@apps-in-toss/types"), module.exports);
|
|
|
1359
1078
|
getSafeAreaInsets,
|
|
1360
1079
|
graniteEvent,
|
|
1361
1080
|
isMinVersionSupported,
|
|
1362
|
-
loadFullScreenAd,
|
|
1363
1081
|
openCamera,
|
|
1364
1082
|
partner,
|
|
1365
1083
|
setClipboardText,
|
|
1366
|
-
showFullScreenAd,
|
|
1367
1084
|
startUpdateLocation,
|
|
1368
1085
|
tdsEvent,
|
|
1369
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
|
};
|
|
@@ -821,13 +821,7 @@ declare function isMinVersionSupported(minVersions: {
|
|
|
821
821
|
ios: `${number}.${number}.${number}` | 'always' | 'never';
|
|
822
822
|
}): boolean;
|
|
823
823
|
|
|
824
|
-
type AppsInTossEvent = {
|
|
825
|
-
entryMessageExited: {
|
|
826
|
-
onEvent: () => void;
|
|
827
|
-
onError?: (error: Error) => void;
|
|
828
|
-
options: undefined;
|
|
829
|
-
};
|
|
830
|
-
};
|
|
824
|
+
type AppsInTossEvent = {};
|
|
831
825
|
declare const appsInTossEvent: {
|
|
832
826
|
addEventListener: <K extends keyof AppsInTossEvent>(event: K, { onEvent, onError, options, }: {
|
|
833
827
|
onEvent: AppsInTossEvent[K]["onEvent"];
|
|
@@ -967,189 +961,4 @@ declare const startUpdateLocation: {
|
|
|
967
961
|
openPermissionDialog(): Promise<"denied" | "allowed">;
|
|
968
962
|
};
|
|
969
963
|
|
|
970
|
-
|
|
971
|
-
onEvent: (data: LoadFullScreenAdEvent) => void;
|
|
972
|
-
onError: (error: Error) => void;
|
|
973
|
-
options?: LoadFullScreenAdOptions | undefined;
|
|
974
|
-
}) => () => void) & {
|
|
975
|
-
isSupported: () => boolean;
|
|
976
|
-
};
|
|
977
|
-
declare const showFullScreenAd: ((args: {
|
|
978
|
-
onEvent: (data: ShowFullScreenAdEvent) => void;
|
|
979
|
-
onError: (error: Error) => void;
|
|
980
|
-
options?: ShowFullScreenAdOptions | undefined;
|
|
981
|
-
}) => () => void) & {
|
|
982
|
-
isSupported: () => boolean;
|
|
983
|
-
};
|
|
984
|
-
|
|
985
|
-
type Environment = 'alpha' | 'live';
|
|
986
|
-
type DeviceOS = 'IOS' | 'ANDROID';
|
|
987
|
-
type DeviceAttStatus = 'NOT_DETERMINED' | 'RESTRICTED' | 'DENIED' | 'AUTHORIZED';
|
|
988
|
-
type DeviceCarrier = 'SKT' | 'KT' | 'LGU' | 'SKT_MVNO' | 'KT_MVNO' | 'LG_MVNO';
|
|
989
|
-
type RequestHeaders = Record<string, string>;
|
|
990
|
-
interface DeviceInfo {
|
|
991
|
-
os?: DeviceOS;
|
|
992
|
-
osVersion?: string;
|
|
993
|
-
ua?: string;
|
|
994
|
-
ifa?: string;
|
|
995
|
-
ifv?: string | null;
|
|
996
|
-
attStatus?: DeviceAttStatus | null;
|
|
997
|
-
model?: string;
|
|
998
|
-
carrier?: DeviceCarrier;
|
|
999
|
-
}
|
|
1000
|
-
interface SafeAreaInsets {
|
|
1001
|
-
top: string;
|
|
1002
|
-
bottom: string;
|
|
1003
|
-
left: string;
|
|
1004
|
-
right: string;
|
|
1005
|
-
}
|
|
1006
|
-
interface RuntimeInfo {
|
|
1007
|
-
safeAreaInsets?: SafeAreaInsets;
|
|
1008
|
-
}
|
|
1009
|
-
type AdOpener = (url: string, target?: string, features?: string) => void;
|
|
1010
|
-
interface AdConfig {
|
|
1011
|
-
environment: Environment;
|
|
1012
|
-
apiEndpoint?: string;
|
|
1013
|
-
deviceInfo?: DeviceInfo;
|
|
1014
|
-
requestHeaders?: RequestHeaders;
|
|
1015
|
-
runtimeInfo?: RuntimeInfo;
|
|
1016
|
-
opener?: AdOpener;
|
|
1017
|
-
customAdFetcher?: CustomAdFetcher;
|
|
1018
|
-
}
|
|
1019
|
-
interface AdRequest {
|
|
1020
|
-
spaceUnitId: string;
|
|
1021
|
-
options?: {
|
|
1022
|
-
dummyAdFormat?: string;
|
|
1023
|
-
maxSize?: number;
|
|
1024
|
-
video?: {
|
|
1025
|
-
maxDurationMs?: number;
|
|
1026
|
-
};
|
|
1027
|
-
};
|
|
1028
|
-
}
|
|
1029
|
-
type AdResponseStatus = 'OK' | 'NO_AD' | 'BLOCKED' | 'ERROR' | 'TIMEOUT' | 'INVALID_SPACE' | 'INVALID_REQUEST' | 'LIMITED_AD' | 'CONSENT_REQUIRED' | 'TEST_MODE';
|
|
1030
|
-
interface AdResponse {
|
|
1031
|
-
requestId?: string;
|
|
1032
|
-
status?: AdResponseStatus;
|
|
1033
|
-
ads: Ad[];
|
|
1034
|
-
ext?: AdResponseExt;
|
|
1035
|
-
}
|
|
1036
|
-
interface Ad {
|
|
1037
|
-
styleId: string;
|
|
1038
|
-
creative: Record<string, any>;
|
|
1039
|
-
eventTrackingUrls?: string[];
|
|
1040
|
-
eventTypes?: string[];
|
|
1041
|
-
eventPayload?: string;
|
|
1042
|
-
requestId?: string;
|
|
1043
|
-
}
|
|
1044
|
-
interface AdResponseExt {
|
|
1045
|
-
skippableOffsetSeconds?: number;
|
|
1046
|
-
reward?: {
|
|
1047
|
-
type: string;
|
|
1048
|
-
amount: number;
|
|
1049
|
-
};
|
|
1050
|
-
isAdBadgeEnabled?: boolean;
|
|
1051
|
-
refetchSeconds?: number | null;
|
|
1052
|
-
}
|
|
1053
|
-
interface ApiResponse<T> {
|
|
1054
|
-
resultType: 'SUCCESS' | 'HTTP_TIMEOUT' | 'NETWORK_ERROR' | 'EXECUTION_FAIL' | 'INTERRUPTED' | 'INTERNAL_ERROR' | 'FAIL';
|
|
1055
|
-
success?: T;
|
|
1056
|
-
error?: {
|
|
1057
|
-
errorType?: number;
|
|
1058
|
-
errorCode?: string;
|
|
1059
|
-
reason?: string;
|
|
1060
|
-
data?: Record<string, any>;
|
|
1061
|
-
title?: string;
|
|
1062
|
-
};
|
|
1063
|
-
}
|
|
1064
|
-
type CustomAdFetcher = (endpoint: string, request: AdRequest, headers?: RequestHeaders) => Promise<ApiResponse<AdResponse>>;
|
|
1065
|
-
interface InitializeOptions {
|
|
1066
|
-
callbacks?: {
|
|
1067
|
-
onInitialized?: () => void;
|
|
1068
|
-
onInitializationFailed?: (error: Error) => void;
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
interface BannerSlotEventPayload {
|
|
1072
|
-
slotId: string;
|
|
1073
|
-
adGroupId: string;
|
|
1074
|
-
adMetadata: {
|
|
1075
|
-
creativeId: string;
|
|
1076
|
-
requestId: string;
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
interface BannerSlotErrorPayload {
|
|
1080
|
-
slotId: string;
|
|
1081
|
-
adGroupId: string;
|
|
1082
|
-
adMetadata: Record<string, never>;
|
|
1083
|
-
error: {
|
|
1084
|
-
code: number;
|
|
1085
|
-
message: string;
|
|
1086
|
-
domain?: string;
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
interface BannerSlotCallbacks {
|
|
1090
|
-
onAdRendered?: (payload: BannerSlotEventPayload) => void;
|
|
1091
|
-
onAdViewable?: (payload: BannerSlotEventPayload) => void;
|
|
1092
|
-
onAdClicked?: (payload: BannerSlotEventPayload) => void;
|
|
1093
|
-
onAdImpression?: (payload: BannerSlotEventPayload) => void;
|
|
1094
|
-
onAdFailedToRender?: (payload: BannerSlotErrorPayload) => void;
|
|
1095
|
-
onNoFill?: (payload: {
|
|
1096
|
-
slotId: string;
|
|
1097
|
-
adGroupId: string;
|
|
1098
|
-
adMetadata: Record<string, never>;
|
|
1099
|
-
}) => void;
|
|
1100
|
-
}
|
|
1101
|
-
interface BannerSlotOptions {
|
|
1102
|
-
spaceId: string;
|
|
1103
|
-
autoLoad?: boolean;
|
|
1104
|
-
dummyAdFormat?: string;
|
|
1105
|
-
maxVideoDurationMs?: number;
|
|
1106
|
-
refetchIntervalMs?: number;
|
|
1107
|
-
theme?: 'light' | 'dark';
|
|
1108
|
-
padding?: string;
|
|
1109
|
-
callbacks?: BannerSlotCallbacks;
|
|
1110
|
-
}
|
|
1111
|
-
interface BannerSlot {
|
|
1112
|
-
load(): void | Promise<void>;
|
|
1113
|
-
destroy(): void;
|
|
1114
|
-
}
|
|
1115
|
-
interface BannerNamespace {
|
|
1116
|
-
createSlot(target: string | HTMLElement, options: BannerSlotOptions): BannerSlot;
|
|
1117
|
-
destroy(slotId: string): void;
|
|
1118
|
-
destroyAll(): void;
|
|
1119
|
-
}
|
|
1120
|
-
interface AdsSdkGlobal {
|
|
1121
|
-
init(config: AdConfig): void;
|
|
1122
|
-
banner: BannerNamespace;
|
|
1123
|
-
isInitialized(): boolean;
|
|
1124
|
-
}
|
|
1125
|
-
declare global {
|
|
1126
|
-
interface Window {
|
|
1127
|
-
TossAdsSpaceKit?: AdsSdkGlobal;
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
interface AttachOptions {
|
|
1131
|
-
theme?: 'light' | 'dark';
|
|
1132
|
-
padding?: string;
|
|
1133
|
-
callbacks?: BannerSlotCallbacks;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
declare function initialize(options: InitializeOptions): void;
|
|
1137
|
-
declare function attach(adGroupId: string, target: string | HTMLElement, options?: AttachOptions): void;
|
|
1138
|
-
declare function destroy(slotId: string): void;
|
|
1139
|
-
declare function destroyAll(): void;
|
|
1140
|
-
declare const TossAds: {
|
|
1141
|
-
initialize: typeof initialize & {
|
|
1142
|
-
isSupported: () => boolean;
|
|
1143
|
-
};
|
|
1144
|
-
attach: typeof attach & {
|
|
1145
|
-
isSupported: () => boolean;
|
|
1146
|
-
};
|
|
1147
|
-
destroy: typeof destroy & {
|
|
1148
|
-
isSupported: () => boolean;
|
|
1149
|
-
};
|
|
1150
|
-
destroyAll: typeof destroyAll & {
|
|
1151
|
-
isSupported: () => boolean;
|
|
1152
|
-
};
|
|
1153
|
-
};
|
|
1154
|
-
|
|
1155
|
-
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
|
};
|
|
@@ -821,13 +821,7 @@ declare function isMinVersionSupported(minVersions: {
|
|
|
821
821
|
ios: `${number}.${number}.${number}` | 'always' | 'never';
|
|
822
822
|
}): boolean;
|
|
823
823
|
|
|
824
|
-
type AppsInTossEvent = {
|
|
825
|
-
entryMessageExited: {
|
|
826
|
-
onEvent: () => void;
|
|
827
|
-
onError?: (error: Error) => void;
|
|
828
|
-
options: undefined;
|
|
829
|
-
};
|
|
830
|
-
};
|
|
824
|
+
type AppsInTossEvent = {};
|
|
831
825
|
declare const appsInTossEvent: {
|
|
832
826
|
addEventListener: <K extends keyof AppsInTossEvent>(event: K, { onEvent, onError, options, }: {
|
|
833
827
|
onEvent: AppsInTossEvent[K]["onEvent"];
|
|
@@ -967,189 +961,4 @@ declare const startUpdateLocation: {
|
|
|
967
961
|
openPermissionDialog(): Promise<"denied" | "allowed">;
|
|
968
962
|
};
|
|
969
963
|
|
|
970
|
-
|
|
971
|
-
onEvent: (data: LoadFullScreenAdEvent) => void;
|
|
972
|
-
onError: (error: Error) => void;
|
|
973
|
-
options?: LoadFullScreenAdOptions | undefined;
|
|
974
|
-
}) => () => void) & {
|
|
975
|
-
isSupported: () => boolean;
|
|
976
|
-
};
|
|
977
|
-
declare const showFullScreenAd: ((args: {
|
|
978
|
-
onEvent: (data: ShowFullScreenAdEvent) => void;
|
|
979
|
-
onError: (error: Error) => void;
|
|
980
|
-
options?: ShowFullScreenAdOptions | undefined;
|
|
981
|
-
}) => () => void) & {
|
|
982
|
-
isSupported: () => boolean;
|
|
983
|
-
};
|
|
984
|
-
|
|
985
|
-
type Environment = 'alpha' | 'live';
|
|
986
|
-
type DeviceOS = 'IOS' | 'ANDROID';
|
|
987
|
-
type DeviceAttStatus = 'NOT_DETERMINED' | 'RESTRICTED' | 'DENIED' | 'AUTHORIZED';
|
|
988
|
-
type DeviceCarrier = 'SKT' | 'KT' | 'LGU' | 'SKT_MVNO' | 'KT_MVNO' | 'LG_MVNO';
|
|
989
|
-
type RequestHeaders = Record<string, string>;
|
|
990
|
-
interface DeviceInfo {
|
|
991
|
-
os?: DeviceOS;
|
|
992
|
-
osVersion?: string;
|
|
993
|
-
ua?: string;
|
|
994
|
-
ifa?: string;
|
|
995
|
-
ifv?: string | null;
|
|
996
|
-
attStatus?: DeviceAttStatus | null;
|
|
997
|
-
model?: string;
|
|
998
|
-
carrier?: DeviceCarrier;
|
|
999
|
-
}
|
|
1000
|
-
interface SafeAreaInsets {
|
|
1001
|
-
top: string;
|
|
1002
|
-
bottom: string;
|
|
1003
|
-
left: string;
|
|
1004
|
-
right: string;
|
|
1005
|
-
}
|
|
1006
|
-
interface RuntimeInfo {
|
|
1007
|
-
safeAreaInsets?: SafeAreaInsets;
|
|
1008
|
-
}
|
|
1009
|
-
type AdOpener = (url: string, target?: string, features?: string) => void;
|
|
1010
|
-
interface AdConfig {
|
|
1011
|
-
environment: Environment;
|
|
1012
|
-
apiEndpoint?: string;
|
|
1013
|
-
deviceInfo?: DeviceInfo;
|
|
1014
|
-
requestHeaders?: RequestHeaders;
|
|
1015
|
-
runtimeInfo?: RuntimeInfo;
|
|
1016
|
-
opener?: AdOpener;
|
|
1017
|
-
customAdFetcher?: CustomAdFetcher;
|
|
1018
|
-
}
|
|
1019
|
-
interface AdRequest {
|
|
1020
|
-
spaceUnitId: string;
|
|
1021
|
-
options?: {
|
|
1022
|
-
dummyAdFormat?: string;
|
|
1023
|
-
maxSize?: number;
|
|
1024
|
-
video?: {
|
|
1025
|
-
maxDurationMs?: number;
|
|
1026
|
-
};
|
|
1027
|
-
};
|
|
1028
|
-
}
|
|
1029
|
-
type AdResponseStatus = 'OK' | 'NO_AD' | 'BLOCKED' | 'ERROR' | 'TIMEOUT' | 'INVALID_SPACE' | 'INVALID_REQUEST' | 'LIMITED_AD' | 'CONSENT_REQUIRED' | 'TEST_MODE';
|
|
1030
|
-
interface AdResponse {
|
|
1031
|
-
requestId?: string;
|
|
1032
|
-
status?: AdResponseStatus;
|
|
1033
|
-
ads: Ad[];
|
|
1034
|
-
ext?: AdResponseExt;
|
|
1035
|
-
}
|
|
1036
|
-
interface Ad {
|
|
1037
|
-
styleId: string;
|
|
1038
|
-
creative: Record<string, any>;
|
|
1039
|
-
eventTrackingUrls?: string[];
|
|
1040
|
-
eventTypes?: string[];
|
|
1041
|
-
eventPayload?: string;
|
|
1042
|
-
requestId?: string;
|
|
1043
|
-
}
|
|
1044
|
-
interface AdResponseExt {
|
|
1045
|
-
skippableOffsetSeconds?: number;
|
|
1046
|
-
reward?: {
|
|
1047
|
-
type: string;
|
|
1048
|
-
amount: number;
|
|
1049
|
-
};
|
|
1050
|
-
isAdBadgeEnabled?: boolean;
|
|
1051
|
-
refetchSeconds?: number | null;
|
|
1052
|
-
}
|
|
1053
|
-
interface ApiResponse<T> {
|
|
1054
|
-
resultType: 'SUCCESS' | 'HTTP_TIMEOUT' | 'NETWORK_ERROR' | 'EXECUTION_FAIL' | 'INTERRUPTED' | 'INTERNAL_ERROR' | 'FAIL';
|
|
1055
|
-
success?: T;
|
|
1056
|
-
error?: {
|
|
1057
|
-
errorType?: number;
|
|
1058
|
-
errorCode?: string;
|
|
1059
|
-
reason?: string;
|
|
1060
|
-
data?: Record<string, any>;
|
|
1061
|
-
title?: string;
|
|
1062
|
-
};
|
|
1063
|
-
}
|
|
1064
|
-
type CustomAdFetcher = (endpoint: string, request: AdRequest, headers?: RequestHeaders) => Promise<ApiResponse<AdResponse>>;
|
|
1065
|
-
interface InitializeOptions {
|
|
1066
|
-
callbacks?: {
|
|
1067
|
-
onInitialized?: () => void;
|
|
1068
|
-
onInitializationFailed?: (error: Error) => void;
|
|
1069
|
-
};
|
|
1070
|
-
}
|
|
1071
|
-
interface BannerSlotEventPayload {
|
|
1072
|
-
slotId: string;
|
|
1073
|
-
adGroupId: string;
|
|
1074
|
-
adMetadata: {
|
|
1075
|
-
creativeId: string;
|
|
1076
|
-
requestId: string;
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
interface BannerSlotErrorPayload {
|
|
1080
|
-
slotId: string;
|
|
1081
|
-
adGroupId: string;
|
|
1082
|
-
adMetadata: Record<string, never>;
|
|
1083
|
-
error: {
|
|
1084
|
-
code: number;
|
|
1085
|
-
message: string;
|
|
1086
|
-
domain?: string;
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
interface BannerSlotCallbacks {
|
|
1090
|
-
onAdRendered?: (payload: BannerSlotEventPayload) => void;
|
|
1091
|
-
onAdViewable?: (payload: BannerSlotEventPayload) => void;
|
|
1092
|
-
onAdClicked?: (payload: BannerSlotEventPayload) => void;
|
|
1093
|
-
onAdImpression?: (payload: BannerSlotEventPayload) => void;
|
|
1094
|
-
onAdFailedToRender?: (payload: BannerSlotErrorPayload) => void;
|
|
1095
|
-
onNoFill?: (payload: {
|
|
1096
|
-
slotId: string;
|
|
1097
|
-
adGroupId: string;
|
|
1098
|
-
adMetadata: Record<string, never>;
|
|
1099
|
-
}) => void;
|
|
1100
|
-
}
|
|
1101
|
-
interface BannerSlotOptions {
|
|
1102
|
-
spaceId: string;
|
|
1103
|
-
autoLoad?: boolean;
|
|
1104
|
-
dummyAdFormat?: string;
|
|
1105
|
-
maxVideoDurationMs?: number;
|
|
1106
|
-
refetchIntervalMs?: number;
|
|
1107
|
-
theme?: 'light' | 'dark';
|
|
1108
|
-
padding?: string;
|
|
1109
|
-
callbacks?: BannerSlotCallbacks;
|
|
1110
|
-
}
|
|
1111
|
-
interface BannerSlot {
|
|
1112
|
-
load(): void | Promise<void>;
|
|
1113
|
-
destroy(): void;
|
|
1114
|
-
}
|
|
1115
|
-
interface BannerNamespace {
|
|
1116
|
-
createSlot(target: string | HTMLElement, options: BannerSlotOptions): BannerSlot;
|
|
1117
|
-
destroy(slotId: string): void;
|
|
1118
|
-
destroyAll(): void;
|
|
1119
|
-
}
|
|
1120
|
-
interface AdsSdkGlobal {
|
|
1121
|
-
init(config: AdConfig): void;
|
|
1122
|
-
banner: BannerNamespace;
|
|
1123
|
-
isInitialized(): boolean;
|
|
1124
|
-
}
|
|
1125
|
-
declare global {
|
|
1126
|
-
interface Window {
|
|
1127
|
-
TossAdsSpaceKit?: AdsSdkGlobal;
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
interface AttachOptions {
|
|
1131
|
-
theme?: 'light' | 'dark';
|
|
1132
|
-
padding?: string;
|
|
1133
|
-
callbacks?: BannerSlotCallbacks;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
declare function initialize(options: InitializeOptions): void;
|
|
1137
|
-
declare function attach(adGroupId: string, target: string | HTMLElement, options?: AttachOptions): void;
|
|
1138
|
-
declare function destroy(slotId: string): void;
|
|
1139
|
-
declare function destroyAll(): void;
|
|
1140
|
-
declare const TossAds: {
|
|
1141
|
-
initialize: typeof initialize & {
|
|
1142
|
-
isSupported: () => boolean;
|
|
1143
|
-
};
|
|
1144
|
-
attach: typeof attach & {
|
|
1145
|
-
isSupported: () => boolean;
|
|
1146
|
-
};
|
|
1147
|
-
destroy: typeof destroy & {
|
|
1148
|
-
isSupported: () => boolean;
|
|
1149
|
-
};
|
|
1150
|
-
destroyAll: typeof destroyAll & {
|
|
1151
|
-
isSupported: () => boolean;
|
|
1152
|
-
};
|
|
1153
|
-
};
|
|
1154
|
-
|
|
1155
|
-
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,283 +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.0.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({ adGroupId: request.spaceUnitId });
|
|
1168
|
-
return normalizeApiResponse(raw);
|
|
1169
|
-
} catch (error) {
|
|
1170
|
-
return {
|
|
1171
|
-
resultType: "FAIL",
|
|
1172
|
-
error: {
|
|
1173
|
-
reason: error instanceof Error ? error.message : "Unknown fetchTossAd error"
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
};
|
|
1178
|
-
}
|
|
1179
|
-
var pendingLoad2 = null;
|
|
1180
|
-
function initialize(options) {
|
|
1181
|
-
const { callbacks } = options;
|
|
1182
|
-
if (window.TossAdsSpaceKit != null && window.TossAdsSpaceKit.isInitialized()) {
|
|
1183
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] Already initialized."));
|
|
1184
|
-
return;
|
|
1185
|
-
}
|
|
1186
|
-
if (pendingLoad2 != null) {
|
|
1187
|
-
callbacks?.onInitializationFailed?.(new Error("[toss-ad] initialization already in progress."));
|
|
1188
|
-
}
|
|
1189
|
-
const resolveInitialized = () => callbacks?.onInitialized?.();
|
|
1190
|
-
const rejectInitialized = (error) => {
|
|
1191
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1192
|
-
callbacks?.onInitializationFailed?.(normalizedError);
|
|
1193
|
-
};
|
|
1194
|
-
pendingLoad2 = loadAdsSdk().then((sdk) => {
|
|
1195
|
-
const customAdFetcher = createCustomAdFetcher();
|
|
1196
|
-
const config = { environment: "live", customAdFetcher, opener: openUrlOpener };
|
|
1197
|
-
sdk.init(config);
|
|
1198
|
-
resolveInitialized();
|
|
1199
|
-
}).catch((error) => {
|
|
1200
|
-
pendingLoad2 = null;
|
|
1201
|
-
rejectInitialized(error);
|
|
1202
|
-
});
|
|
1203
|
-
}
|
|
1204
|
-
function attach(adGroupId, target, options = {}) {
|
|
1205
|
-
const { callbacks } = options;
|
|
1206
|
-
const rejectAttached = (error) => {
|
|
1207
|
-
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1208
|
-
callbacks?.onAdFailedToRender?.({
|
|
1209
|
-
slotId: "",
|
|
1210
|
-
adGroupId,
|
|
1211
|
-
adMetadata: {},
|
|
1212
|
-
error: { code: 0, message: normalizedError.message }
|
|
1213
|
-
});
|
|
1214
|
-
};
|
|
1215
|
-
try {
|
|
1216
|
-
const spaceId = adGroupId;
|
|
1217
|
-
const sdk = getAdsSdk();
|
|
1218
|
-
if (!sdk) {
|
|
1219
|
-
throw new Error("[toss-ad] Call initialize() before attaching an ad.");
|
|
1220
|
-
}
|
|
1221
|
-
if (!sdk.banner) {
|
|
1222
|
-
throw new Error("[toss-ad] Loaded TossAdsSpaceKit does not support banner ads.");
|
|
1223
|
-
}
|
|
1224
|
-
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
1225
|
-
if (!element) {
|
|
1226
|
-
throw new Error(`[toss-ad] Failed to find target element: ${target}`);
|
|
1227
|
-
}
|
|
1228
|
-
const slotOptions = {
|
|
1229
|
-
spaceId,
|
|
1230
|
-
autoLoad: true,
|
|
1231
|
-
theme: options.theme,
|
|
1232
|
-
padding: options.padding,
|
|
1233
|
-
callbacks: wrapCallbacks(adGroupId, options.callbacks)
|
|
1234
|
-
};
|
|
1235
|
-
sdk.banner.createSlot(element, slotOptions);
|
|
1236
|
-
} catch (error) {
|
|
1237
|
-
rejectAttached(error);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
function destroy(slotId) {
|
|
1241
|
-
const sdk = getAdsSdk();
|
|
1242
|
-
if (!sdk?.banner) {
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
sdk.banner.destroy(slotId);
|
|
1246
|
-
}
|
|
1247
|
-
function destroyAll() {
|
|
1248
|
-
const sdk = getAdsSdk();
|
|
1249
|
-
if (!sdk?.banner) {
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
sdk.banner.destroyAll();
|
|
1253
|
-
}
|
|
1254
|
-
function wrapCallbacks(adGroupId, callbacks) {
|
|
1255
|
-
if (!callbacks) {
|
|
1256
|
-
return void 0;
|
|
1257
|
-
}
|
|
1258
|
-
const mapEvent = (payload) => {
|
|
1259
|
-
const next = { ...payload ?? {} };
|
|
1260
|
-
next.adGroupId = next.adGroupId ?? next.spaceId ?? adGroupId;
|
|
1261
|
-
delete next.spaceId;
|
|
1262
|
-
return next;
|
|
1263
|
-
};
|
|
1264
|
-
return {
|
|
1265
|
-
onAdRendered: (payload) => callbacks.onAdRendered?.(mapEvent(payload)),
|
|
1266
|
-
onAdViewable: (payload) => callbacks.onAdViewable?.(mapEvent(payload)),
|
|
1267
|
-
onAdClicked: (payload) => callbacks.onAdClicked?.(mapEvent(payload)),
|
|
1268
|
-
onAdImpression: (payload) => {
|
|
1269
|
-
tossAdEventLog({
|
|
1270
|
-
log_name: "display_ads_all::impression__1px_banner",
|
|
1271
|
-
log_type: "event",
|
|
1272
|
-
params: {
|
|
1273
|
-
event_type: "impression",
|
|
1274
|
-
schema_id: 1812034,
|
|
1275
|
-
request_id: payload?.adMetadata?.requestId ?? ""
|
|
1276
|
-
}
|
|
1277
|
-
});
|
|
1278
|
-
callbacks.onAdImpression?.(mapEvent(payload));
|
|
1279
|
-
},
|
|
1280
|
-
onAdFailedToRender: (payload) => callbacks.onAdFailedToRender?.({
|
|
1281
|
-
...mapEvent(payload),
|
|
1282
|
-
error: payload?.error ?? { code: 0, message: "UNKNOWN" }
|
|
1283
|
-
}),
|
|
1284
|
-
onNoFill: (payload) => callbacks.onNoFill?.(mapEvent(payload))
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
var TossAds = {
|
|
1288
|
-
initialize: Object.assign(initialize, {
|
|
1289
|
-
isSupported: fetchTossAd.isSupported
|
|
1290
|
-
}),
|
|
1291
|
-
attach: Object.assign(attach, {
|
|
1292
|
-
isSupported: fetchTossAd.isSupported
|
|
1293
|
-
}),
|
|
1294
|
-
destroy: Object.assign(destroy, {
|
|
1295
|
-
isSupported: fetchTossAd.isSupported
|
|
1296
|
-
}),
|
|
1297
|
-
destroyAll: Object.assign(destroyAll, {
|
|
1298
|
-
isSupported: fetchTossAd.isSupported
|
|
1299
|
-
})
|
|
1300
|
-
};
|
|
1301
|
-
|
|
1302
1025
|
// src/index.ts
|
|
1303
1026
|
export * from "@apps-in-toss/types";
|
|
1304
1027
|
export {
|
|
@@ -1306,7 +1029,6 @@ export {
|
|
|
1306
1029
|
IAP,
|
|
1307
1030
|
SafeAreaInsets,
|
|
1308
1031
|
Storage,
|
|
1309
|
-
TossAds,
|
|
1310
1032
|
appsInTossEvent,
|
|
1311
1033
|
env,
|
|
1312
1034
|
fetchAlbumPhotos,
|
|
@@ -1317,11 +1039,9 @@ export {
|
|
|
1317
1039
|
getSafeAreaInsets,
|
|
1318
1040
|
graniteEvent,
|
|
1319
1041
|
isMinVersionSupported,
|
|
1320
|
-
loadFullScreenAd,
|
|
1321
1042
|
openCamera,
|
|
1322
1043
|
partner,
|
|
1323
1044
|
setClipboardText,
|
|
1324
|
-
showFullScreenAd,
|
|
1325
1045
|
startUpdateLocation,
|
|
1326
1046
|
tdsEvent
|
|
1327
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.1765732023607",
|
|
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.1765732023607"
|
|
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.1765732023607",
|
|
35
|
+
"@apps-in-toss/framework": "0.0.0-dev.1765732023607",
|
|
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": "e45c1308eb7d471b4873b1d92b7570e11bc85ae3"
|
|
50
50
|
}
|