@apps-in-toss/web-framework 2.6.1 → 3.0.0-beta.0c56009
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +306 -0
- package/dist/config.cjs +52 -0
- package/dist/config.d.cts +54 -0
- package/dist/config.d.ts +54 -0
- package/dist/config.js +27 -0
- package/dist/core.cjs +1511 -0
- package/dist/core.d.cts +906 -0
- package/dist/core.d.ts +906 -0
- package/dist/core.js +1452 -0
- package/package.json +42 -91
- package/LICENSE +0 -674
- package/README.md +0 -43
- package/ait.js +0 -4
- package/bin.js +0 -4
- package/config.d.ts +0 -1
- package/dist/cli/chunk-BAH3W7VD.js +0 -61
- package/dist/cli/index.js +0 -15558
- package/dist/cli/lib-O2ZDIQPQ.js +0 -1007
- package/dist/config/index.d.ts +0 -85
- package/dist/config/index.js +0 -599
- package/dist/prebuilt/dev.android.rn84.js +0 -214517
- package/dist/prebuilt/dev.ios.rn84.js +0 -213945
- package/dist/prebuilt/prod.android.rn72.js +0 -49390
- package/dist/prebuilt/prod.android.rn84.js +0 -48405
- package/dist/prebuilt/prod.ios.rn72.js +0 -49399
- package/dist/prebuilt/prod.ios.rn84.js +0 -48414
- package/dist-web/index.d.ts +0 -2
- package/dist-web/index.js +0 -2
package/dist/core.js
ADDED
|
@@ -0,0 +1,1452 @@
|
|
|
1
|
+
// src/core/bridges/ad/googleAdMob.ts
|
|
2
|
+
import {
|
|
3
|
+
callAsyncMethod,
|
|
4
|
+
callEventMethod,
|
|
5
|
+
getConstant
|
|
6
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
7
|
+
var GoogleAdMob = {
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
* @category 광고
|
|
11
|
+
* @name loadAppsInTossAdMob
|
|
12
|
+
* @description 광고를 미리 불러와서, 광고가 필요한 시점에 바로 보여줄 수 있도록 준비하는 함수예요.
|
|
13
|
+
* @param {object} params 광고를 불러올 때 사용할 설정 값이에요.
|
|
14
|
+
* @param {LoadAdMobOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요.
|
|
15
|
+
* @param {string} params.options.adGroupId 광고 그룹 단위 ID예요.
|
|
16
|
+
* @param {(event: LoadAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요.
|
|
17
|
+
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요.
|
|
18
|
+
* @property {() => boolean} [isSupported] 현재 환경에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요.
|
|
19
|
+
*/
|
|
20
|
+
loadAppsInTossAdMob: Object.assign(
|
|
21
|
+
(params) => {
|
|
22
|
+
callAsyncMethod("loadAppsInTossAdmob", params.options).then((data) => params.onEvent({ type: "loaded", data })).catch(params.onError);
|
|
23
|
+
return () => {
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
isSupported: () => getConstant("isLoadAppsInTossAdmobSupported")
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
* @category 광고
|
|
33
|
+
* @name showAppsInTossAdMob
|
|
34
|
+
* @description 광고를 사용자에게 노출해요.
|
|
35
|
+
* @param {object} params 광고를 보여주기 위해 사용할 설정 값이에요.
|
|
36
|
+
* @param {ShowAdMobOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요.
|
|
37
|
+
* @param {string} params.options.adGroupId 광고 그룹 단위 ID예요.
|
|
38
|
+
* @param {(event: ShowAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요.
|
|
39
|
+
* @param {(reason: unknown) => void} [params.onError] 광고를 노출하지 못했을 때 호출돼요.
|
|
40
|
+
* @property {() => boolean} [isSupported] 현재 환경에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요.
|
|
41
|
+
*/
|
|
42
|
+
showAppsInTossAdMob: Object.assign(
|
|
43
|
+
(params) => {
|
|
44
|
+
return callEventMethod("showAppsInTossAdmob", {
|
|
45
|
+
params: params.options,
|
|
46
|
+
onEvent: params.onEvent,
|
|
47
|
+
onError: params.onError
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
isSupported: () => getConstant("isShowAppsInTossAdmobSupported")
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
* @category 광고
|
|
57
|
+
* @name isAppsInTossAdMobLoaded
|
|
58
|
+
* @description 광고가 잘 불러와졌는지 확인해요.
|
|
59
|
+
* @param {IsAdMobLoadedOptions} options 광고 그룹 단위 ID가 포함된 옵션 객체예요.
|
|
60
|
+
* @property {() => boolean} [isSupported] 현재 환경에서 지원하는지 확인하는 함수예요.
|
|
61
|
+
*/
|
|
62
|
+
isAppsInTossAdMobLoaded: Object.assign(
|
|
63
|
+
(options) => callAsyncMethod("getCachedStatusAppsInTossAdmob", options),
|
|
64
|
+
{
|
|
65
|
+
isSupported: () => getConstant("isGetCachedStatusAppsInTossAdmobSupported")
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/core/bridges/ad/integratedAd.ts
|
|
71
|
+
import {
|
|
72
|
+
callEventMethod as callEventMethod2,
|
|
73
|
+
getConstant as getConstant2
|
|
74
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
75
|
+
var loadFullScreenAd = Object.assign(
|
|
76
|
+
(params) => {
|
|
77
|
+
return callEventMethod2("loadFullScreenAd", {
|
|
78
|
+
params: params.options,
|
|
79
|
+
onEvent: params.onEvent,
|
|
80
|
+
onError: params.onError
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
isSupported: () => getConstant2("isLoadFullScreenAdSupported")
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
var showFullScreenAd = Object.assign(
|
|
88
|
+
(params) => {
|
|
89
|
+
return callEventMethod2("showFullScreenAd", {
|
|
90
|
+
params: params.options,
|
|
91
|
+
onEvent: params.onEvent,
|
|
92
|
+
onError: params.onError
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
isSupported: () => getConstant2("isShowFullScreenAdSupported")
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// src/core/bridges/ad/toss-ad/index.ts
|
|
101
|
+
import {
|
|
102
|
+
callAsyncMethod as callAsyncMethod3,
|
|
103
|
+
callEventMethod as callEventMethod3,
|
|
104
|
+
getConstant as getConstant3
|
|
105
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
106
|
+
|
|
107
|
+
// src/core/bridges/ad/toss-ad/attachBannerRegistry.ts
|
|
108
|
+
var attachedBannerRegistry = /* @__PURE__ */ new WeakMap();
|
|
109
|
+
function getOrCreateAttachedBanner(element, createAttachedBanner) {
|
|
110
|
+
const attachedBanner = attachedBannerRegistry.get(element);
|
|
111
|
+
if (attachedBanner) {
|
|
112
|
+
return attachedBanner;
|
|
113
|
+
}
|
|
114
|
+
const createdAttachedBanner = createAttachedBanner();
|
|
115
|
+
let isDestroyed = false;
|
|
116
|
+
const registeredAttachedBanner = {
|
|
117
|
+
destroy() {
|
|
118
|
+
if (isDestroyed) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
isDestroyed = true;
|
|
122
|
+
if (attachedBannerRegistry.get(element) === registeredAttachedBanner) {
|
|
123
|
+
attachedBannerRegistry.delete(element);
|
|
124
|
+
}
|
|
125
|
+
createdAttachedBanner.destroy();
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
attachedBannerRegistry.set(element, registeredAttachedBanner);
|
|
129
|
+
return registeredAttachedBanner;
|
|
130
|
+
}
|
|
131
|
+
function resetAttachedBannerRegistry() {
|
|
132
|
+
attachedBannerRegistry = /* @__PURE__ */ new WeakMap();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/core/bridges/ad/toss-ad/opener.ts
|
|
136
|
+
import { callAsyncMethod as callAsyncMethod2 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
137
|
+
function openUrlOpener(url) {
|
|
138
|
+
const transformed = getWebSchemeOrUri(url);
|
|
139
|
+
return callAsyncMethod2("openURL", { url: transformed });
|
|
140
|
+
}
|
|
141
|
+
function getWebSchemeOrUri(uri) {
|
|
142
|
+
const isHttp = ["http://", "https://"].some(
|
|
143
|
+
(protocol) => uri.startsWith(protocol)
|
|
144
|
+
);
|
|
145
|
+
return isHttp ? supertossWeb(uri) : uri;
|
|
146
|
+
}
|
|
147
|
+
function supertossWeb(uri) {
|
|
148
|
+
return `supertoss://web?url=${encodeURIComponent(uri)}&external=true`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/core/bridges/ad/toss-ad/scriptLoader.ts
|
|
152
|
+
var DEFAULT_SDK_URL = "https://static.toss.im/ads/sdk/toss-ads-space-kit-1.3.0.js";
|
|
153
|
+
var DEFAULT_TIMEOUT_MS = 15e3;
|
|
154
|
+
var pendingLoad = null;
|
|
155
|
+
function getAdsSdk() {
|
|
156
|
+
if (typeof window === "undefined") {
|
|
157
|
+
return void 0;
|
|
158
|
+
}
|
|
159
|
+
return window.TossAdsSpaceKit;
|
|
160
|
+
}
|
|
161
|
+
function loadAdsSdk() {
|
|
162
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
163
|
+
return Promise.reject(new Error("Ads SDK can only be loaded in a browser environment."));
|
|
164
|
+
}
|
|
165
|
+
const existing = getAdsSdk();
|
|
166
|
+
if (existing) {
|
|
167
|
+
return Promise.resolve(existing);
|
|
168
|
+
}
|
|
169
|
+
if (pendingLoad) {
|
|
170
|
+
return pendingLoad;
|
|
171
|
+
}
|
|
172
|
+
const promise = new Promise((resolve, reject) => {
|
|
173
|
+
const script = document.createElement("script");
|
|
174
|
+
const cleanup = () => {
|
|
175
|
+
script.removeEventListener("load", handleLoad);
|
|
176
|
+
script.removeEventListener("error", handleError);
|
|
177
|
+
window.clearTimeout(timeoutId);
|
|
178
|
+
pendingLoad = null;
|
|
179
|
+
};
|
|
180
|
+
const handleLoad = () => {
|
|
181
|
+
const sdk = getAdsSdk();
|
|
182
|
+
if (sdk) {
|
|
183
|
+
cleanup();
|
|
184
|
+
resolve(sdk);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
cleanup();
|
|
188
|
+
reject(new Error("Ads SDK script loaded but window.TossAdsSpaceKit was not exposed."));
|
|
189
|
+
};
|
|
190
|
+
const handleError = () => {
|
|
191
|
+
cleanup();
|
|
192
|
+
reject(new Error(`Failed to load Ads SDK script from ${DEFAULT_SDK_URL}.`));
|
|
193
|
+
};
|
|
194
|
+
const timeoutId = window.setTimeout(() => {
|
|
195
|
+
cleanup();
|
|
196
|
+
reject(new Error(`Loading Ads SDK timed out after ${DEFAULT_TIMEOUT_MS}ms.`));
|
|
197
|
+
}, DEFAULT_TIMEOUT_MS);
|
|
198
|
+
script.addEventListener("load", handleLoad);
|
|
199
|
+
script.addEventListener("error", handleError);
|
|
200
|
+
script.async = true;
|
|
201
|
+
script.src = DEFAULT_SDK_URL;
|
|
202
|
+
document.head.appendChild(script);
|
|
203
|
+
});
|
|
204
|
+
pendingLoad = promise;
|
|
205
|
+
return promise;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/core/bridges/ad/toss-ad/index.ts
|
|
209
|
+
var fetchTossAd = Object.assign(
|
|
210
|
+
(params) => {
|
|
211
|
+
return callEventMethod3("fetchTossAd", {
|
|
212
|
+
params: params.options,
|
|
213
|
+
onEvent: params.onEvent,
|
|
214
|
+
onError: params.onError
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
isSupported: () => getConstant3("isFetchTossAdSupported")
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
var tossAdEventLog = (params) => callAsyncMethod3("tossAdEventLog", params);
|
|
222
|
+
var SUPPORTED_STYLE_IDS = /* @__PURE__ */ new Set(["1", "2"]);
|
|
223
|
+
var INVALID_AD_GROUP_ID_ERROR_MESSAGE = "\uC798\uBABB\uB41C \uC694\uCCAD\uC774\uC5D0\uC694. \uD544\uC694\uD55C \uAC12\uC774 \uBE44\uC5B4 \uC788\uC5B4\uC694.";
|
|
224
|
+
function normalizeAdGroupId(adGroupId) {
|
|
225
|
+
return adGroupId.trim();
|
|
226
|
+
}
|
|
227
|
+
function createInvalidAdGroupIdError() {
|
|
228
|
+
return new Error(INVALID_AD_GROUP_ID_ERROR_MESSAGE);
|
|
229
|
+
}
|
|
230
|
+
function createInvalidAdGroupIdResponse() {
|
|
231
|
+
return {
|
|
232
|
+
resultType: "FAIL",
|
|
233
|
+
error: {
|
|
234
|
+
reason: INVALID_AD_GROUP_ID_ERROR_MESSAGE
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function fetchTossAdPromise(options) {
|
|
239
|
+
return new Promise((resolve, reject) => {
|
|
240
|
+
if (!fetchTossAd.isSupported()) {
|
|
241
|
+
reject(new Error("fetchTossAd is not supported in this environment."));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const adGroupId = normalizeAdGroupId(options.adGroupId);
|
|
245
|
+
if (adGroupId.length === 0) {
|
|
246
|
+
reject(createInvalidAdGroupIdError());
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
return fetchTossAd({
|
|
250
|
+
options: {
|
|
251
|
+
...options,
|
|
252
|
+
adGroupId
|
|
253
|
+
},
|
|
254
|
+
onEvent: resolve,
|
|
255
|
+
onError: reject
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function normalizeAdResponse(adResponse) {
|
|
260
|
+
const ads = Array.isArray(adResponse.ads) ? adResponse.ads.filter((ad) => SUPPORTED_STYLE_IDS.has(String(ad.styleId))) : [];
|
|
261
|
+
return {
|
|
262
|
+
requestId: adResponse.requestId ?? "",
|
|
263
|
+
status: adResponse.status ?? "OK",
|
|
264
|
+
ads,
|
|
265
|
+
ext: adResponse.ext
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function normalizeApiResponse(raw) {
|
|
269
|
+
if (isApiResponse(raw)) {
|
|
270
|
+
if (raw.resultType !== "SUCCESS") {
|
|
271
|
+
return raw;
|
|
272
|
+
}
|
|
273
|
+
if (!raw.success) {
|
|
274
|
+
return {
|
|
275
|
+
resultType: "FAIL",
|
|
276
|
+
error: { reason: "fetchTossAd returned SUCCESS without payload" }
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return { ...raw, success: normalizeAdResponse(raw.success) };
|
|
280
|
+
}
|
|
281
|
+
if (isAdResponse(raw)) {
|
|
282
|
+
return {
|
|
283
|
+
resultType: "SUCCESS",
|
|
284
|
+
success: normalizeAdResponse(raw)
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
resultType: "FAIL",
|
|
289
|
+
error: { reason: "Invalid response from fetchTossAd" }
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function isApiResponse(payload) {
|
|
293
|
+
return Boolean(
|
|
294
|
+
payload && typeof payload === "object" && "resultType" in payload
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
function isAdResponse(payload) {
|
|
298
|
+
return Boolean(
|
|
299
|
+
payload && typeof payload === "object" && "ads" in payload
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
function createCustomAdFetcher() {
|
|
303
|
+
return async (_endpoint, request) => {
|
|
304
|
+
const spaceUnitId = normalizeAdGroupId(request.spaceUnitId);
|
|
305
|
+
if (spaceUnitId.length === 0) {
|
|
306
|
+
return createInvalidAdGroupIdResponse();
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
const raw = await fetchTossAdPromise({
|
|
310
|
+
adGroupId: spaceUnitId,
|
|
311
|
+
sdkId: "108",
|
|
312
|
+
availableStyleIds: ["1", "2"]
|
|
313
|
+
});
|
|
314
|
+
return normalizeApiResponse(raw);
|
|
315
|
+
} catch (error) {
|
|
316
|
+
return {
|
|
317
|
+
resultType: "FAIL",
|
|
318
|
+
error: {
|
|
319
|
+
reason: error instanceof Error ? error.message : "Unknown fetchTossAd error"
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
var pendingLoad2 = null;
|
|
326
|
+
function initialize(options) {
|
|
327
|
+
const { callbacks } = options;
|
|
328
|
+
const resolveInitialized = () => callbacks?.onInitialized?.();
|
|
329
|
+
const rejectInitialized = (error) => {
|
|
330
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
331
|
+
callbacks?.onInitializationFailed?.(normalizedError);
|
|
332
|
+
};
|
|
333
|
+
const existingSdk = getAdsSdk();
|
|
334
|
+
if (existingSdk?.isInitialized()) {
|
|
335
|
+
resolveInitialized();
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (pendingLoad2 != null) {
|
|
339
|
+
pendingLoad2.then(resolveInitialized).catch(rejectInitialized);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const initPromise = loadAdsSdk().then((sdk) => {
|
|
343
|
+
if (sdk.isInitialized()) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const customAdFetcher = createCustomAdFetcher();
|
|
347
|
+
const config = {
|
|
348
|
+
environment: "live",
|
|
349
|
+
customAdFetcher,
|
|
350
|
+
opener: openUrlOpener
|
|
351
|
+
};
|
|
352
|
+
sdk.init(config);
|
|
353
|
+
});
|
|
354
|
+
pendingLoad2 = initPromise;
|
|
355
|
+
initPromise.then(resolveInitialized).catch(rejectInitialized).finally(() => {
|
|
356
|
+
if (pendingLoad2 === initPromise) {
|
|
357
|
+
pendingLoad2 = null;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
function attach(adGroupId, target, options = {}) {
|
|
362
|
+
const { callbacks } = options;
|
|
363
|
+
const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
|
|
364
|
+
const rejectAttached = (error) => {
|
|
365
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
366
|
+
callbacks?.onAdFailedToRender?.({
|
|
367
|
+
slotId: "",
|
|
368
|
+
adGroupId: normalizedAdGroupId,
|
|
369
|
+
adMetadata: {},
|
|
370
|
+
error: { code: 0, message: normalizedError.message }
|
|
371
|
+
});
|
|
372
|
+
};
|
|
373
|
+
try {
|
|
374
|
+
const spaceId = normalizedAdGroupId;
|
|
375
|
+
if (spaceId.length === 0) {
|
|
376
|
+
throw createInvalidAdGroupIdError();
|
|
377
|
+
}
|
|
378
|
+
const sdk = getAdsSdk();
|
|
379
|
+
if (!sdk) {
|
|
380
|
+
throw new Error("[toss-ad] Call initialize() before attaching an ad.");
|
|
381
|
+
}
|
|
382
|
+
if (!sdk.banner) {
|
|
383
|
+
throw new Error(
|
|
384
|
+
"[toss-ad] Loaded TossAdsSpaceKit does not support banner ads."
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
388
|
+
if (!element) {
|
|
389
|
+
throw new Error(`[toss-ad] Failed to find target element: ${target}`);
|
|
390
|
+
}
|
|
391
|
+
const slotOptions = {
|
|
392
|
+
spaceId,
|
|
393
|
+
autoLoad: true,
|
|
394
|
+
theme: options.theme,
|
|
395
|
+
padding: options.padding,
|
|
396
|
+
callbacks: wrapCallbacks(normalizedAdGroupId, options.callbacks)
|
|
397
|
+
};
|
|
398
|
+
sdk.banner.createSlot(element, slotOptions);
|
|
399
|
+
} catch (error) {
|
|
400
|
+
rejectAttached(error);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
var DEFAULT_ATTACH_PADDING_BANNER = "16px 20px";
|
|
404
|
+
var DEFAULT_ATTACH_PADDING_NATIVE_IMAGE = "20px";
|
|
405
|
+
var DEFAULT_ATTACH_THEME = "auto";
|
|
406
|
+
var DEFAULT_ATTACH_TONE = "blackAndWhite";
|
|
407
|
+
var DEFAULT_ATTACH_VARIANT = "expanded";
|
|
408
|
+
var ATTACH_CLASS_NAME = "toss-ads-attach";
|
|
409
|
+
var ATTACH_STYLE_ID = "toss-ads-attach-style";
|
|
410
|
+
var ATTACH_WRAPPER_ATTRIBUTE = "data-toss-ads-attach-banner-wrapper";
|
|
411
|
+
function ensureAttachStyles(container) {
|
|
412
|
+
const documentRef = container.ownerDocument;
|
|
413
|
+
if (!documentRef) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (documentRef.getElementById(ATTACH_STYLE_ID)) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const style = documentRef.createElement("style");
|
|
420
|
+
style.id = ATTACH_STYLE_ID;
|
|
421
|
+
style.textContent = `
|
|
422
|
+
.${ATTACH_CLASS_NAME} { background: #ffffff; }
|
|
423
|
+
.${ATTACH_CLASS_NAME}.toss-ads-tone-grey { background: #f2f4f7; }
|
|
424
|
+
@media (prefers-color-scheme: dark) {
|
|
425
|
+
.${ATTACH_CLASS_NAME} { background: #17171c; }
|
|
426
|
+
.${ATTACH_CLASS_NAME}.toss-ads-tone-grey { background: #101013; }
|
|
427
|
+
}
|
|
428
|
+
.${ATTACH_CLASS_NAME}.toss-ads-theme-light { background: #ffffff; }
|
|
429
|
+
.${ATTACH_CLASS_NAME}.toss-ads-theme-light.toss-ads-tone-grey { background: #f2f4f7; }
|
|
430
|
+
.${ATTACH_CLASS_NAME}.toss-ads-theme-dark { background: #17171c; }
|
|
431
|
+
.${ATTACH_CLASS_NAME}.toss-ads-theme-dark.toss-ads-tone-grey { background: #101013; }
|
|
432
|
+
`;
|
|
433
|
+
const styleContainer = documentRef.head ?? documentRef.body ?? documentRef.documentElement;
|
|
434
|
+
if (!styleContainer) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
styleContainer.appendChild(style);
|
|
438
|
+
}
|
|
439
|
+
function removeStaleAttachedBannerWrappers(container) {
|
|
440
|
+
Array.from(container.children).forEach((child) => {
|
|
441
|
+
if (child instanceof HTMLElement && child.getAttribute(ATTACH_WRAPPER_ATTRIBUTE) === "true") {
|
|
442
|
+
container.removeChild(child);
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
function attachBanner(adGroupId, target, options = {}) {
|
|
447
|
+
const {
|
|
448
|
+
callbacks,
|
|
449
|
+
theme = DEFAULT_ATTACH_THEME,
|
|
450
|
+
tone = DEFAULT_ATTACH_TONE,
|
|
451
|
+
variant = DEFAULT_ATTACH_VARIANT
|
|
452
|
+
} = options;
|
|
453
|
+
const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
|
|
454
|
+
const rejectAttached = (error) => {
|
|
455
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
456
|
+
callbacks?.onAdFailedToRender?.({
|
|
457
|
+
slotId: "",
|
|
458
|
+
adGroupId: normalizedAdGroupId,
|
|
459
|
+
adMetadata: {},
|
|
460
|
+
error: { code: 0, message: normalizedError.message }
|
|
461
|
+
});
|
|
462
|
+
};
|
|
463
|
+
const wrappedCallbacks = wrapCallbacks(normalizedAdGroupId, callbacks);
|
|
464
|
+
try {
|
|
465
|
+
const spaceId = normalizedAdGroupId;
|
|
466
|
+
if (spaceId.length === 0) {
|
|
467
|
+
throw createInvalidAdGroupIdError();
|
|
468
|
+
}
|
|
469
|
+
const sdk = getAdsSdk();
|
|
470
|
+
if (!sdk) {
|
|
471
|
+
throw new Error("[toss-ad] Call initialize() before attaching an ad.");
|
|
472
|
+
}
|
|
473
|
+
if (!sdk.banner) {
|
|
474
|
+
throw new Error(
|
|
475
|
+
"[toss-ad] Loaded TossAdsSpaceKit does not support banner ads."
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
const container = typeof target === "string" ? document.querySelector(target) : target;
|
|
479
|
+
if (!container) {
|
|
480
|
+
throw new Error(`[toss-ad] Failed to find target element: ${target}`);
|
|
481
|
+
}
|
|
482
|
+
return getOrCreateAttachedBanner(container, () => {
|
|
483
|
+
const wrapper = document.createElement("div");
|
|
484
|
+
wrapper.style.width = "100%";
|
|
485
|
+
wrapper.style.height = "100%";
|
|
486
|
+
wrapper.style.boxSizing = "border-box";
|
|
487
|
+
wrapper.style.display = "flex";
|
|
488
|
+
wrapper.style.flexDirection = "column";
|
|
489
|
+
wrapper.style.justifyContent = "center";
|
|
490
|
+
wrapper.style.overflow = "hidden";
|
|
491
|
+
wrapper.setAttribute(ATTACH_WRAPPER_ATTRIBUTE, "true");
|
|
492
|
+
if (variant === "card") {
|
|
493
|
+
wrapper.style.padding = "0 10px";
|
|
494
|
+
}
|
|
495
|
+
const element = document.createElement("div");
|
|
496
|
+
element.classList.add(ATTACH_CLASS_NAME);
|
|
497
|
+
if (tone === "grey") {
|
|
498
|
+
element.classList.add("toss-ads-tone-grey");
|
|
499
|
+
}
|
|
500
|
+
if (theme === "light") {
|
|
501
|
+
element.classList.add("toss-ads-theme-light");
|
|
502
|
+
} else if (theme === "dark") {
|
|
503
|
+
element.classList.add("toss-ads-theme-dark");
|
|
504
|
+
}
|
|
505
|
+
if (variant === "card") {
|
|
506
|
+
element.style.borderRadius = "16px";
|
|
507
|
+
element.style.overflow = "hidden";
|
|
508
|
+
}
|
|
509
|
+
wrapper.appendChild(element);
|
|
510
|
+
let isAttached = false;
|
|
511
|
+
let slot = null;
|
|
512
|
+
try {
|
|
513
|
+
ensureAttachStyles(container);
|
|
514
|
+
removeStaleAttachedBannerWrappers(container);
|
|
515
|
+
container.appendChild(wrapper);
|
|
516
|
+
isAttached = true;
|
|
517
|
+
const slotOptions = {
|
|
518
|
+
spaceId,
|
|
519
|
+
autoLoad: true,
|
|
520
|
+
theme: theme === "auto" ? void 0 : theme,
|
|
521
|
+
renderPadding: (styleId) => {
|
|
522
|
+
if (styleId === "1") {
|
|
523
|
+
return DEFAULT_ATTACH_PADDING_BANNER;
|
|
524
|
+
}
|
|
525
|
+
return DEFAULT_ATTACH_PADDING_NATIVE_IMAGE;
|
|
526
|
+
},
|
|
527
|
+
callbacks: wrappedCallbacks
|
|
528
|
+
};
|
|
529
|
+
slot = sdk.banner.createSlot(element, slotOptions);
|
|
530
|
+
} catch (error) {
|
|
531
|
+
if (isAttached && wrapper.parentNode) {
|
|
532
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
533
|
+
}
|
|
534
|
+
throw error;
|
|
535
|
+
}
|
|
536
|
+
return {
|
|
537
|
+
destroy() {
|
|
538
|
+
slot?.destroy();
|
|
539
|
+
if (isAttached && wrapper.parentNode) {
|
|
540
|
+
wrapper.parentNode.removeChild(wrapper);
|
|
541
|
+
}
|
|
542
|
+
isAttached = false;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
});
|
|
546
|
+
} catch (error) {
|
|
547
|
+
rejectAttached(error);
|
|
548
|
+
return {
|
|
549
|
+
destroy() {
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
function destroy(slotId) {
|
|
555
|
+
const sdk = getAdsSdk();
|
|
556
|
+
if (!sdk?.banner) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
sdk.banner.destroy(slotId);
|
|
560
|
+
}
|
|
561
|
+
function destroyAll() {
|
|
562
|
+
const sdk = getAdsSdk();
|
|
563
|
+
if (!sdk?.banner) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
sdk.banner.destroyAll();
|
|
567
|
+
resetAttachedBannerRegistry();
|
|
568
|
+
}
|
|
569
|
+
function wrapCallbacks(adGroupId, callbacks) {
|
|
570
|
+
if (!callbacks) {
|
|
571
|
+
return void 0;
|
|
572
|
+
}
|
|
573
|
+
const mapEvent = (payload) => {
|
|
574
|
+
const next = { ...payload ?? {} };
|
|
575
|
+
next.adGroupId = next.adGroupId ?? next.spaceId ?? adGroupId;
|
|
576
|
+
delete next.spaceId;
|
|
577
|
+
return next;
|
|
578
|
+
};
|
|
579
|
+
return {
|
|
580
|
+
onAdRendered: (payload) => callbacks.onAdRendered?.(mapEvent(payload)),
|
|
581
|
+
onAdViewable: (payload) => callbacks.onAdViewable?.(mapEvent(payload)),
|
|
582
|
+
onAdClicked: (payload) => callbacks.onAdClicked?.(mapEvent(payload)),
|
|
583
|
+
onAdImpression: (payload) => {
|
|
584
|
+
tossAdEventLog({
|
|
585
|
+
log_name: "display_ads_all::impression__1px_banner",
|
|
586
|
+
log_type: "event",
|
|
587
|
+
params: {
|
|
588
|
+
event_type: "impression",
|
|
589
|
+
schema_id: 1812034,
|
|
590
|
+
request_id: payload?.adMetadata?.requestId ?? ""
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
callbacks.onAdImpression?.(mapEvent(payload));
|
|
594
|
+
},
|
|
595
|
+
onAdFailedToRender: (payload) => callbacks.onAdFailedToRender?.({
|
|
596
|
+
...mapEvent(payload),
|
|
597
|
+
error: payload?.error ?? { code: 0, message: "UNKNOWN" }
|
|
598
|
+
}),
|
|
599
|
+
onNoFill: (payload) => callbacks.onNoFill?.(mapEvent(payload))
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
var TossAds = {
|
|
603
|
+
initialize: Object.assign(initialize, {
|
|
604
|
+
isSupported: fetchTossAd.isSupported
|
|
605
|
+
}),
|
|
606
|
+
/**
|
|
607
|
+
* @deprecated attach는 더 이상 권장되지 않습니다. attachBanner를 사용해주세요.
|
|
608
|
+
*/
|
|
609
|
+
attach: Object.assign(attach, {
|
|
610
|
+
isSupported: fetchTossAd.isSupported
|
|
611
|
+
}),
|
|
612
|
+
attachBanner: Object.assign(attachBanner, {
|
|
613
|
+
isSupported: fetchTossAd.isSupported
|
|
614
|
+
}),
|
|
615
|
+
destroy: Object.assign(destroy, {
|
|
616
|
+
isSupported: fetchTossAd.isSupported
|
|
617
|
+
}),
|
|
618
|
+
destroyAll: Object.assign(destroyAll, {
|
|
619
|
+
isSupported: fetchTossAd.isSupported
|
|
620
|
+
})
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
// src/core/bridges/getAnonymousKey.ts
|
|
624
|
+
import { callAsyncMethod as callAsyncMethod4 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
625
|
+
function getAnonymousKey() {
|
|
626
|
+
return callAsyncMethod4("getAnonymousKey");
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// src/core/bridges/appLogin.ts
|
|
630
|
+
import { callAsyncMethod as callAsyncMethod5 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
631
|
+
function appLogin() {
|
|
632
|
+
return callAsyncMethod5("appLogin");
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// src/core/bridges/appsInTossSignTossCert.ts
|
|
636
|
+
import { callAsyncMethod as callAsyncMethod6 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
637
|
+
function appsInTossSignTossCert(params) {
|
|
638
|
+
return callAsyncMethod6("appsInTossSignTossCert", params);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// src/core/bridges/checkoutPayment.ts
|
|
642
|
+
import { callAsyncMethod as callAsyncMethod7 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
643
|
+
function checkoutPayment(options) {
|
|
644
|
+
return callAsyncMethod7("checkoutPayment", options.params);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
// src/core/bridges/clipboard/getClipboardText.ts
|
|
648
|
+
import { callAsyncMethod as callAsyncMethod9 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
649
|
+
|
|
650
|
+
// src/core/bridges/permission/PermissionError.ts
|
|
651
|
+
var PermissionError = class extends Error {
|
|
652
|
+
constructor({ methodName, message }) {
|
|
653
|
+
super();
|
|
654
|
+
this.name = `${methodName} permission error`;
|
|
655
|
+
this.message = message;
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
// src/core/bridges/permission/GetClipboardTextPermissionError.ts
|
|
660
|
+
var GetClipboardTextPermissionError = class extends PermissionError {
|
|
661
|
+
constructor() {
|
|
662
|
+
super({
|
|
663
|
+
methodName: "getClipboardText",
|
|
664
|
+
message: "\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
// src/core/bridges/permission/withPermission.ts
|
|
670
|
+
import { callAsyncMethod as callAsyncMethod8 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
671
|
+
function withPermission(fn, name, access, errorClass) {
|
|
672
|
+
const wrapped = async (...args) => {
|
|
673
|
+
const status = await callAsyncMethod8("requestPermission", { name, access });
|
|
674
|
+
if (status === "denied") {
|
|
675
|
+
throw new errorClass();
|
|
676
|
+
}
|
|
677
|
+
return fn(...args);
|
|
678
|
+
};
|
|
679
|
+
return Object.assign(wrapped, {
|
|
680
|
+
getPermission: () => callAsyncMethod8("getPermission", { name, access }),
|
|
681
|
+
openPermissionDialog: () => callAsyncMethod8("openPermissionDialog", { name, access })
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// src/core/bridges/clipboard/getClipboardText.ts
|
|
686
|
+
var getClipboardText = withPermission(
|
|
687
|
+
() => callAsyncMethod9("getClipboardText"),
|
|
688
|
+
"clipboard",
|
|
689
|
+
"read",
|
|
690
|
+
GetClipboardTextPermissionError
|
|
691
|
+
);
|
|
692
|
+
|
|
693
|
+
// src/core/bridges/clipboard/setClipboardText.ts
|
|
694
|
+
import { callAsyncMethod as callAsyncMethod10 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
695
|
+
|
|
696
|
+
// src/core/bridges/permission/SetClipboardTextPermissionError.ts
|
|
697
|
+
var SetClipboardTextPermissionError = class extends PermissionError {
|
|
698
|
+
constructor() {
|
|
699
|
+
super({
|
|
700
|
+
methodName: "setClipboardText",
|
|
701
|
+
message: "\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
// src/core/bridges/clipboard/setClipboardText.ts
|
|
707
|
+
var setClipboardText = withPermission(
|
|
708
|
+
(text) => callAsyncMethod10("setClipboardText", { text }),
|
|
709
|
+
"clipboard",
|
|
710
|
+
"write",
|
|
711
|
+
SetClipboardTextPermissionError
|
|
712
|
+
);
|
|
713
|
+
|
|
714
|
+
// src/core/bridges/constants/getDeviceId.ts
|
|
715
|
+
import { getConstant as getConstant4 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
716
|
+
function getDeviceId() {
|
|
717
|
+
return getConstant4("deviceId");
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// src/core/bridges/constants/getGroupId.ts
|
|
721
|
+
import { getConstant as getConstant5 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
722
|
+
function getGroupId() {
|
|
723
|
+
return getConstant5("groupId");
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/core/bridges/constants/getLocale.ts
|
|
727
|
+
import { getConstant as getConstant6 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
728
|
+
function getLocale() {
|
|
729
|
+
return getConstant6("locale");
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// src/core/bridges/constants/getOperationalEnvironment.ts
|
|
733
|
+
import { getConstant as getConstant7 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
734
|
+
function getOperationalEnvironment() {
|
|
735
|
+
return getConstant7("operationalEnvironment");
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// src/core/bridges/constants/getPlatformOS.ts
|
|
739
|
+
import { getConstant as getConstant8 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
740
|
+
function getPlatformOS() {
|
|
741
|
+
return getConstant8("platformOS");
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// src/core/bridges/constants/getSchemeUri.ts
|
|
745
|
+
import { getConstant as getConstant9 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
746
|
+
function getSchemeUri() {
|
|
747
|
+
return getConstant9("schemeUri");
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// src/core/bridges/constants/getTossAppVersion.ts
|
|
751
|
+
import { getConstant as getConstant10 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
752
|
+
function getTossAppVersion() {
|
|
753
|
+
return getConstant10("tossAppVersion");
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// src/core/bridges/contacts/contactsViral.ts
|
|
757
|
+
import { callEventMethod as callEventMethod4 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
758
|
+
function contactsViral(params) {
|
|
759
|
+
return callEventMethod4("contactsViral", {
|
|
760
|
+
params: params.options,
|
|
761
|
+
onEvent: params.onEvent,
|
|
762
|
+
onError: (error) => params.onError(error)
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// src/core/bridges/contacts/fetchContacts.ts
|
|
767
|
+
import { callAsyncMethod as callAsyncMethod11 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
768
|
+
|
|
769
|
+
// src/core/bridges/permission/FetchContactsPermissionError.ts
|
|
770
|
+
var FetchContactsPermissionError = class extends PermissionError {
|
|
771
|
+
constructor() {
|
|
772
|
+
super({
|
|
773
|
+
methodName: "fetchContacts",
|
|
774
|
+
message: "\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
// src/core/bridges/contacts/fetchContacts.ts
|
|
780
|
+
var fetchContacts = withPermission(
|
|
781
|
+
(options) => callAsyncMethod11("fetchContacts", options),
|
|
782
|
+
"contacts",
|
|
783
|
+
"read",
|
|
784
|
+
FetchContactsPermissionError
|
|
785
|
+
);
|
|
786
|
+
|
|
787
|
+
// src/core/bridges/env/env.ts
|
|
788
|
+
import { getConstant as getConstant11 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
789
|
+
var env = {
|
|
790
|
+
getDeploymentId: () => getConstant11("deploymentId")
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
// src/core/bridges/env/getAppsInTossGlobals.ts
|
|
794
|
+
import { getConstant as getConstant12 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
795
|
+
function getAppsInTossGlobals() {
|
|
796
|
+
return getConstant12("appsInTossGlobals");
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// src/core/bridges/env/isMinVersionSupported.ts
|
|
800
|
+
import { getConstant as getConstant13 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
801
|
+
function isMinVersionSupported(minVersions) {
|
|
802
|
+
const os = getConstant13("platformOS");
|
|
803
|
+
const minVersion = minVersions[os];
|
|
804
|
+
if (minVersion === "always") return true;
|
|
805
|
+
if (minVersion === "never") return false;
|
|
806
|
+
const currentVersion = getConstant13("tossAppVersion");
|
|
807
|
+
return compareVersions(currentVersion, minVersion) >= 0;
|
|
808
|
+
}
|
|
809
|
+
function compareVersions(current, min) {
|
|
810
|
+
const a = current.split(".").map(Number);
|
|
811
|
+
const b = min.split(".").map(Number);
|
|
812
|
+
for (let i = 0; i < 3; i++) {
|
|
813
|
+
if ((a[i] ?? 0) !== (b[i] ?? 0)) {
|
|
814
|
+
return (a[i] ?? 0) - (b[i] ?? 0);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return 0;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// src/core/bridges/eventLog.ts
|
|
821
|
+
import { callAsyncMethod as callAsyncMethod12 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
822
|
+
function eventLog(params) {
|
|
823
|
+
return callAsyncMethod12("eventLog", params);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// src/core/bridges/events/createEventEmitter.ts
|
|
827
|
+
import { callEventMethod as callEventMethod5 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
828
|
+
function createEventEmitter() {
|
|
829
|
+
return {
|
|
830
|
+
addEventListener: (event, args) => {
|
|
831
|
+
return callEventMethod5(event, {
|
|
832
|
+
params: args.options,
|
|
833
|
+
onEvent: args.onEvent,
|
|
834
|
+
onError: args.onError ?? (() => {
|
|
835
|
+
})
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// src/core/bridges/events/appsInTossEvent.ts
|
|
842
|
+
var appsInTossEvent = createEventEmitter();
|
|
843
|
+
|
|
844
|
+
// src/core/bridges/events/graniteEvent.ts
|
|
845
|
+
var graniteEvent = createEventEmitter();
|
|
846
|
+
|
|
847
|
+
// src/core/bridges/events/tdsEvent.ts
|
|
848
|
+
var tdsEvent = createEventEmitter();
|
|
849
|
+
|
|
850
|
+
// src/core/bridges/game/getGameCenterGameProfile.ts
|
|
851
|
+
import { callAsyncMethod as callAsyncMethod13 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
852
|
+
function getGameCenterGameProfile() {
|
|
853
|
+
return callAsyncMethod13("getGameCenterGameProfile");
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// src/core/bridges/game/getUserKeyForGame.ts
|
|
857
|
+
var getUserKeyForGame = getAnonymousKey;
|
|
858
|
+
|
|
859
|
+
// src/core/bridges/grantPromotionReward.ts
|
|
860
|
+
import { callAsyncMethod as callAsyncMethod14 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
861
|
+
function grantPromotionReward(params) {
|
|
862
|
+
return callAsyncMethod14("grantPromotionReward", params);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// src/core/bridges/game/grantPromotionRewardForGame.ts
|
|
866
|
+
var grantPromotionRewardForGame = grantPromotionReward;
|
|
867
|
+
|
|
868
|
+
// src/core/bridges/game/openGameCenterLeaderboard.ts
|
|
869
|
+
import { callAsyncMethod as callAsyncMethod15 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
870
|
+
function openGameCenterLeaderboard() {
|
|
871
|
+
return callAsyncMethod15("openGameCenterLeaderboard");
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
// src/core/bridges/game/submitGameCenterLeaderBoardScore.ts
|
|
875
|
+
import { callAsyncMethod as callAsyncMethod16 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
876
|
+
function submitGameCenterLeaderBoardScore(params) {
|
|
877
|
+
return callAsyncMethod16("submitGameCenterLeaderBoardScore", params);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/core/bridges/generateHapticFeedback.ts
|
|
881
|
+
import { callAsyncMethod as callAsyncMethod17 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
882
|
+
function generateHapticFeedback(options) {
|
|
883
|
+
return callAsyncMethod17("generateHapticFeedback", options);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// src/core/bridges/getIsTossLoginIntegratedService.ts
|
|
887
|
+
import { callAsyncMethod as callAsyncMethod18 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
888
|
+
function getIsTossLoginIntegratedService() {
|
|
889
|
+
return callAsyncMethod18("getIsTossLoginIntegratedService");
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// src/core/bridges/getNetworkStatus.ts
|
|
893
|
+
import { callAsyncMethod as callAsyncMethod19 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
894
|
+
function getNetworkStatus() {
|
|
895
|
+
return callAsyncMethod19("getNetworkStatus");
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// src/core/bridges/getServerTime.ts
|
|
899
|
+
import {
|
|
900
|
+
callAsyncMethod as callAsyncMethod20,
|
|
901
|
+
getConstant as getConstant14
|
|
902
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
903
|
+
var getServerTime = Object.assign(
|
|
904
|
+
async () => {
|
|
905
|
+
const result = await callAsyncMethod20("getServerTime");
|
|
906
|
+
return result.serverTime;
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
isSupported: () => getConstant14("isGetServerTimeSupported")
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
|
|
913
|
+
// src/core/bridges/iap/IAP.ts
|
|
914
|
+
import {
|
|
915
|
+
callAsyncMethod as callAsyncMethod21,
|
|
916
|
+
callEventMethod as callEventMethod6,
|
|
917
|
+
getConstant as getConstant15
|
|
918
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
919
|
+
var IAP = {
|
|
920
|
+
createOneTimePurchaseOrder: (params) => {
|
|
921
|
+
const sku = params.options.sku;
|
|
922
|
+
if (!getConstant15("isRequestOneTimePurchaseSupported")) {
|
|
923
|
+
callAsyncMethod21("iapCreateOneTimePurchaseOrder", { productId: sku }).then(async (response) => {
|
|
924
|
+
try {
|
|
925
|
+
await params.options.processProductGrant({
|
|
926
|
+
orderId: response.orderId
|
|
927
|
+
});
|
|
928
|
+
params.onEvent({ type: "success", data: response });
|
|
929
|
+
} catch (error) {
|
|
930
|
+
params.onError(error);
|
|
931
|
+
}
|
|
932
|
+
}).catch((error) => params.onError(error));
|
|
933
|
+
return () => {
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
return callEventMethod6("requestOneTimePurchase", {
|
|
937
|
+
params: { sku },
|
|
938
|
+
onEvent: async (event) => {
|
|
939
|
+
if (event.type === "purchased") {
|
|
940
|
+
const granted = await params.options.processProductGrant({
|
|
941
|
+
orderId: event.data.orderId
|
|
942
|
+
});
|
|
943
|
+
await callAsyncMethod21("processProductGrant", {
|
|
944
|
+
orderId: event.data.orderId,
|
|
945
|
+
isProductGranted: granted
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
if (event.type === "success") {
|
|
949
|
+
params.onEvent({
|
|
950
|
+
type: "success",
|
|
951
|
+
data: event.data
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
onError: (error) => params.onError(error)
|
|
956
|
+
});
|
|
957
|
+
},
|
|
958
|
+
createSubscriptionPurchaseOrder: (params) => {
|
|
959
|
+
return callEventMethod6("requestSubscriptionPurchase", {
|
|
960
|
+
params: {
|
|
961
|
+
sku: params.options.sku,
|
|
962
|
+
offerId: params.options.offerId ?? null
|
|
963
|
+
},
|
|
964
|
+
onEvent: async (event) => {
|
|
965
|
+
if (event.type === "purchased") {
|
|
966
|
+
const granted = await params.options.processProductGrant({
|
|
967
|
+
orderId: event.data.orderId,
|
|
968
|
+
subscriptionId: event.data.subscriptionId
|
|
969
|
+
});
|
|
970
|
+
await callAsyncMethod21("processProductGrant", {
|
|
971
|
+
orderId: event.data.orderId,
|
|
972
|
+
isProductGranted: granted
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
if (event.type === "success") {
|
|
976
|
+
params.onEvent({ type: "success", data: event.data });
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
onError: (error) => params.onError(error)
|
|
980
|
+
});
|
|
981
|
+
},
|
|
982
|
+
getProductItemList: () => callAsyncMethod21("iapGetProductItemList"),
|
|
983
|
+
getPendingOrders: () => callAsyncMethod21("getPendingOrders"),
|
|
984
|
+
getCompletedOrRefundedOrders: () => callAsyncMethod21("getCompletedOrRefundedOrders", {}),
|
|
985
|
+
completeProductGrant: (args) => callAsyncMethod21("completeProductGrant", args.params),
|
|
986
|
+
getSubscriptionInfo: (args) => callAsyncMethod21("getSubscriptionInfo", args)
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
// src/core/bridges/location/getCurrentLocation.ts
|
|
990
|
+
import { callAsyncMethod as callAsyncMethod22 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
991
|
+
|
|
992
|
+
// src/core/bridges/permission/GetCurrentLocationPermissionError.ts
|
|
993
|
+
var GetCurrentLocationPermissionError = class extends PermissionError {
|
|
994
|
+
constructor() {
|
|
995
|
+
super({
|
|
996
|
+
methodName: "getCurrentLocation",
|
|
997
|
+
message: "\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
// src/core/bridges/location/getCurrentLocation.ts
|
|
1003
|
+
var getCurrentLocation = withPermission(
|
|
1004
|
+
(options) => callAsyncMethod22("getCurrentLocation", options),
|
|
1005
|
+
"geolocation",
|
|
1006
|
+
"access",
|
|
1007
|
+
GetCurrentLocationPermissionError
|
|
1008
|
+
);
|
|
1009
|
+
|
|
1010
|
+
// src/core/bridges/location/startUpdateLocation.ts
|
|
1011
|
+
import {
|
|
1012
|
+
callAsyncMethod as callAsyncMethod23,
|
|
1013
|
+
callEventMethod as callEventMethod7
|
|
1014
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
1015
|
+
|
|
1016
|
+
// src/core/bridges/permission/StartUpdateLocationPermissionError.ts
|
|
1017
|
+
var StartUpdateLocationPermissionError = GetCurrentLocationPermissionError;
|
|
1018
|
+
|
|
1019
|
+
// src/core/bridges/location/startUpdateLocation.ts
|
|
1020
|
+
var startUpdateLocation = (eventParams) => {
|
|
1021
|
+
return callEventMethod7("startUpdateLocation", {
|
|
1022
|
+
params: eventParams.options,
|
|
1023
|
+
onEvent: eventParams.onEvent,
|
|
1024
|
+
onError: (error) => {
|
|
1025
|
+
const locationError = new StartUpdateLocationPermissionError();
|
|
1026
|
+
if (error instanceof Error && error.name === locationError.name) {
|
|
1027
|
+
return eventParams.onError(locationError);
|
|
1028
|
+
}
|
|
1029
|
+
return eventParams.onError(error);
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
};
|
|
1033
|
+
startUpdateLocation.getPermission = () => callAsyncMethod23("getPermission", { name: "geolocation", access: "access" });
|
|
1034
|
+
startUpdateLocation.openPermissionDialog = () => callAsyncMethod23("openPermissionDialog", {
|
|
1035
|
+
name: "geolocation",
|
|
1036
|
+
access: "access"
|
|
1037
|
+
});
|
|
1038
|
+
|
|
1039
|
+
// src/core/bridges/location/types.ts
|
|
1040
|
+
var Accuracy = /* @__PURE__ */ ((Accuracy2) => {
|
|
1041
|
+
Accuracy2[Accuracy2["Lowest"] = 1] = "Lowest";
|
|
1042
|
+
Accuracy2[Accuracy2["Low"] = 2] = "Low";
|
|
1043
|
+
Accuracy2[Accuracy2["Balanced"] = 3] = "Balanced";
|
|
1044
|
+
Accuracy2[Accuracy2["High"] = 4] = "High";
|
|
1045
|
+
Accuracy2[Accuracy2["Highest"] = 5] = "Highest";
|
|
1046
|
+
Accuracy2[Accuracy2["BestForNavigation"] = 6] = "BestForNavigation";
|
|
1047
|
+
return Accuracy2;
|
|
1048
|
+
})(Accuracy || {});
|
|
1049
|
+
|
|
1050
|
+
// src/core/bridges/media/fetchAlbumPhotos.ts
|
|
1051
|
+
import { callAsyncMethod as callAsyncMethod24 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1052
|
+
|
|
1053
|
+
// src/core/bridges/permission/FetchAlbumPhotosPermissionError.ts
|
|
1054
|
+
var FetchAlbumPhotosPermissionError = class extends PermissionError {
|
|
1055
|
+
constructor() {
|
|
1056
|
+
super({
|
|
1057
|
+
methodName: "fetchAlbumPhotos",
|
|
1058
|
+
message: "\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
// src/core/bridges/media/fetchAlbumPhotos.ts
|
|
1064
|
+
var fetchAlbumPhotos = withPermission(
|
|
1065
|
+
(options) => callAsyncMethod24("fetchAlbumPhotos", options ?? {}),
|
|
1066
|
+
"photos",
|
|
1067
|
+
"read",
|
|
1068
|
+
FetchAlbumPhotosPermissionError
|
|
1069
|
+
);
|
|
1070
|
+
|
|
1071
|
+
// src/core/bridges/media/openCamera.ts
|
|
1072
|
+
import { callAsyncMethod as callAsyncMethod25 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1073
|
+
|
|
1074
|
+
// src/core/bridges/permission/OpenCameraPermissionError.ts
|
|
1075
|
+
var OpenCameraPermissionError = class extends PermissionError {
|
|
1076
|
+
constructor() {
|
|
1077
|
+
super({
|
|
1078
|
+
methodName: "openCamera",
|
|
1079
|
+
message: "\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
// src/core/bridges/media/openCamera.ts
|
|
1085
|
+
var openCamera = withPermission(
|
|
1086
|
+
(options) => callAsyncMethod25("openCamera", options ?? {}),
|
|
1087
|
+
"camera",
|
|
1088
|
+
"access",
|
|
1089
|
+
OpenCameraPermissionError
|
|
1090
|
+
);
|
|
1091
|
+
|
|
1092
|
+
// src/core/bridges/openURL.ts
|
|
1093
|
+
import { callAsyncMethod as callAsyncMethod26 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1094
|
+
function openURL(url) {
|
|
1095
|
+
return callAsyncMethod26("openURL", { url });
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// src/core/bridges/partner/partner.ts
|
|
1099
|
+
import { callAsyncMethod as callAsyncMethod27 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1100
|
+
var partner = {
|
|
1101
|
+
addAccessoryButton: (params) => callAsyncMethod27("addAccessoryButton", params),
|
|
1102
|
+
removeAccessoryButton: () => callAsyncMethod27("removeAccessoryButton")
|
|
1103
|
+
};
|
|
1104
|
+
|
|
1105
|
+
// src/core/bridges/permission/getPermission.ts
|
|
1106
|
+
import { callAsyncMethod as callAsyncMethod28 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1107
|
+
function getPermission(permission) {
|
|
1108
|
+
return callAsyncMethod28("getPermission", permission);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// src/core/bridges/permission/openPermissionDialog.ts
|
|
1112
|
+
import { callAsyncMethod as callAsyncMethod29 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1113
|
+
function openPermissionDialog(permission) {
|
|
1114
|
+
return callAsyncMethod29("openPermissionDialog", permission);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
// src/core/bridges/permission/requestPermission.ts
|
|
1118
|
+
import { callAsyncMethod as callAsyncMethod30 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1119
|
+
function requestPermission(permission) {
|
|
1120
|
+
return callAsyncMethod30("requestPermission", permission);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// src/core/bridges/requestReview.ts
|
|
1124
|
+
import {
|
|
1125
|
+
callAsyncMethod as callAsyncMethod31,
|
|
1126
|
+
getConstant as getConstant16
|
|
1127
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
1128
|
+
var requestReview = Object.assign(() => callAsyncMethod31("requestMiniAppReview"), {
|
|
1129
|
+
isSupported: () => getConstant16("isRequestReviewSupported")
|
|
1130
|
+
});
|
|
1131
|
+
|
|
1132
|
+
// src/core/bridges/safe-area/SafeAreaInsets.ts
|
|
1133
|
+
import {
|
|
1134
|
+
callEventMethod as callEventMethod8,
|
|
1135
|
+
getConstant as getConstant17
|
|
1136
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
1137
|
+
var SafeAreaInsets = {
|
|
1138
|
+
get: () => getConstant17("safeAreaInsets"),
|
|
1139
|
+
subscribe: (args) => {
|
|
1140
|
+
return callEventMethod8("safeAreaInsetsChange", {
|
|
1141
|
+
onEvent: args.onEvent,
|
|
1142
|
+
onError: () => {
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
// src/core/bridges/safe-area/getSafeAreaInsets.ts
|
|
1149
|
+
function getSafeAreaInsets() {
|
|
1150
|
+
return SafeAreaInsets.get().top;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
// src/core/bridges/saveBase64Data.ts
|
|
1154
|
+
import { callAsyncMethod as callAsyncMethod32 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1155
|
+
function saveBase64Data(params) {
|
|
1156
|
+
return callAsyncMethod32("saveBase64Data", params);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// src/core/bridges/share/getTossShareLink.ts
|
|
1160
|
+
import { callAsyncMethod as callAsyncMethod33 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1161
|
+
async function getTossShareLink(url, ogImageUrl) {
|
|
1162
|
+
const result = await callAsyncMethod33("getTossShareLink", { url, ogImageUrl });
|
|
1163
|
+
return result.shareLink;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
// src/core/bridges/share/share.ts
|
|
1167
|
+
import { callAsyncMethod as callAsyncMethod34 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1168
|
+
function share(message) {
|
|
1169
|
+
return callAsyncMethod34("share", message);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// src/core/bridges/storage/Storage.ts
|
|
1173
|
+
import { callAsyncMethod as callAsyncMethod35 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1174
|
+
var Storage = {
|
|
1175
|
+
getItem: (key) => callAsyncMethod35("getStorageItem", { key }),
|
|
1176
|
+
setItem: (key, value) => callAsyncMethod35("setStorageItem", { key, value }),
|
|
1177
|
+
removeItem: (key) => callAsyncMethod35("removeStorageItem", { key }),
|
|
1178
|
+
clearItems: () => callAsyncMethod35("clearStorage")
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
// src/core/bridges/view/closeView.ts
|
|
1182
|
+
import { callAsyncMethod as callAsyncMethod36 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1183
|
+
function closeView() {
|
|
1184
|
+
return callAsyncMethod36("closeView");
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// src/core/bridges/view/setDeviceOrientation.ts
|
|
1188
|
+
import { callAsyncMethod as callAsyncMethod37 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1189
|
+
function setDeviceOrientation(options) {
|
|
1190
|
+
return callAsyncMethod37("setDeviceOrientation", options);
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// src/core/bridges/view/setIosSwipeGestureEnabled.ts
|
|
1194
|
+
import { callAsyncMethod as callAsyncMethod38 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1195
|
+
function setIosSwipeGestureEnabled(options) {
|
|
1196
|
+
return callAsyncMethod38("setIosSwipeGestureEnabled", options);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// src/core/bridges/view/setScreenAwakeMode.ts
|
|
1200
|
+
import { callAsyncMethod as callAsyncMethod39 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1201
|
+
function setScreenAwakeMode(options) {
|
|
1202
|
+
return callAsyncMethod39("setScreenAwakeMode", options);
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
// src/core/bridges/view/setSecureScreen.ts
|
|
1206
|
+
import { callAsyncMethod as callAsyncMethod40 } from "@apps-in-toss/webview-bridge/utils/web";
|
|
1207
|
+
function setSecureScreen(options) {
|
|
1208
|
+
return callAsyncMethod40("setSecureScreen", options);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
// src/core/bridges/openPDFViewer.ts
|
|
1212
|
+
import {
|
|
1213
|
+
callAsyncMethod as callAsyncMethod41,
|
|
1214
|
+
getConstant as getConstant18
|
|
1215
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
1216
|
+
var openPDFViewer = Object.assign(
|
|
1217
|
+
(params) => callAsyncMethod41("openPDFViewer", params),
|
|
1218
|
+
{
|
|
1219
|
+
isSupported: () => getConstant18("isOpenPDFViewerSupported")
|
|
1220
|
+
}
|
|
1221
|
+
);
|
|
1222
|
+
|
|
1223
|
+
// src/core/bridges/fetchAlbumItems.ts
|
|
1224
|
+
import {
|
|
1225
|
+
callAsyncMethod as callAsyncMethod42,
|
|
1226
|
+
getConstant as getConstant19
|
|
1227
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
1228
|
+
var fetchAlbumItems = Object.assign(
|
|
1229
|
+
(options) => callAsyncMethod42("fetchAlbumItems", options ?? {}),
|
|
1230
|
+
{
|
|
1231
|
+
isSupported: () => getConstant19("isFetchAlbumItemsSupported")
|
|
1232
|
+
}
|
|
1233
|
+
);
|
|
1234
|
+
|
|
1235
|
+
// src/core/bridges/requestTossPayPaysBilling.ts
|
|
1236
|
+
import {
|
|
1237
|
+
callAsyncMethod as callAsyncMethod43,
|
|
1238
|
+
getConstant as getConstant20
|
|
1239
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
1240
|
+
var requestTossPayPaysBilling = Object.assign(
|
|
1241
|
+
async (options) => {
|
|
1242
|
+
if (!requestTossPayPaysBilling.isSupported()) {
|
|
1243
|
+
console.warn(
|
|
1244
|
+
"requestTossPayPaysBilling is not supported in this app version"
|
|
1245
|
+
);
|
|
1246
|
+
return void 0;
|
|
1247
|
+
}
|
|
1248
|
+
return callAsyncMethod43("requestTossPayPaysBilling", options.params);
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
isSupported: () => getConstant20("isRequestTossPayPaysBillingSupported")
|
|
1252
|
+
}
|
|
1253
|
+
);
|
|
1254
|
+
|
|
1255
|
+
// src/core/bridges/requestNotificationAgreement.ts
|
|
1256
|
+
import {
|
|
1257
|
+
callEventMethod as callEventMethod9,
|
|
1258
|
+
getConstant as getConstant21
|
|
1259
|
+
} from "@apps-in-toss/webview-bridge/utils/web";
|
|
1260
|
+
var noop = () => {
|
|
1261
|
+
};
|
|
1262
|
+
var requestNotificationAgreement = Object.assign(
|
|
1263
|
+
(params) => {
|
|
1264
|
+
if (!requestNotificationAgreement.isSupported()) {
|
|
1265
|
+
return noop;
|
|
1266
|
+
}
|
|
1267
|
+
return callEventMethod9("requestNotificationAgreement", {
|
|
1268
|
+
params: params.options,
|
|
1269
|
+
onEvent: (event) => params.onEvent(event),
|
|
1270
|
+
onError: (error) => {
|
|
1271
|
+
params.onError(error);
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
isSupported: () => getConstant21("isRequestNotificationAgreementSupported")
|
|
1277
|
+
}
|
|
1278
|
+
);
|
|
1279
|
+
|
|
1280
|
+
// src/core/analytics/utils/extractDateFromUUIDv7.ts
|
|
1281
|
+
var extractDateFromUUIDv7 = (uuid) => {
|
|
1282
|
+
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
1283
|
+
const timestamp = Number.parseInt(timestampHex, 16);
|
|
1284
|
+
return new Date(timestamp);
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
// src/core/analytics/index.ts
|
|
1288
|
+
var getReferrer = () => {
|
|
1289
|
+
try {
|
|
1290
|
+
const referrer = new URL(getSchemeUri());
|
|
1291
|
+
return referrer.searchParams.get("referrer");
|
|
1292
|
+
} catch {
|
|
1293
|
+
return "";
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
var getGroupId2 = () => {
|
|
1297
|
+
try {
|
|
1298
|
+
const url = new URL(location.href);
|
|
1299
|
+
if (url.protocol !== "https:") {
|
|
1300
|
+
throw new Error("Invalid URL");
|
|
1301
|
+
}
|
|
1302
|
+
return {
|
|
1303
|
+
groupId: url.pathname,
|
|
1304
|
+
search: url.search.startsWith("?") ? url.search.substring(1) : url.search
|
|
1305
|
+
};
|
|
1306
|
+
} catch {
|
|
1307
|
+
return {
|
|
1308
|
+
groupId: "unknown",
|
|
1309
|
+
search: "unknown"
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
var Analytics = {
|
|
1314
|
+
screen: (params = {}) => {
|
|
1315
|
+
const { groupId, search } = getGroupId2();
|
|
1316
|
+
if (groupId === "unknown") {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
const { log_name, ...otherParams } = params;
|
|
1320
|
+
return eventLog({
|
|
1321
|
+
...params,
|
|
1322
|
+
log_type: "screen",
|
|
1323
|
+
log_name: log_name ?? `${groupId}::screen`,
|
|
1324
|
+
params: {
|
|
1325
|
+
search,
|
|
1326
|
+
referrer: getReferrer(),
|
|
1327
|
+
document_title: document.title,
|
|
1328
|
+
deployment_id: env.getDeploymentId(),
|
|
1329
|
+
deployment_timestamp: extractDateFromUUIDv7(
|
|
1330
|
+
env.getDeploymentId()
|
|
1331
|
+
).getTime(),
|
|
1332
|
+
...otherParams
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
},
|
|
1336
|
+
impression: (params = {}) => {
|
|
1337
|
+
const { groupId, search } = getGroupId2();
|
|
1338
|
+
if (groupId === "unknown") {
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
const { log_name, ...otherParams } = params;
|
|
1342
|
+
return eventLog({
|
|
1343
|
+
log_type: "event",
|
|
1344
|
+
log_name: log_name ?? `${groupId}::impression`,
|
|
1345
|
+
params: {
|
|
1346
|
+
...otherParams,
|
|
1347
|
+
search,
|
|
1348
|
+
referrer: getReferrer(),
|
|
1349
|
+
deployment_id: env.getDeploymentId(),
|
|
1350
|
+
deployment_timestamp: extractDateFromUUIDv7(
|
|
1351
|
+
env.getDeploymentId()
|
|
1352
|
+
).getTime(),
|
|
1353
|
+
event_type: "impression"
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
},
|
|
1357
|
+
click: (params = {}) => {
|
|
1358
|
+
const { groupId, search } = getGroupId2();
|
|
1359
|
+
if (groupId === "unknown") {
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
const { log_name, ...otherParams } = params;
|
|
1363
|
+
return eventLog({
|
|
1364
|
+
log_type: "event",
|
|
1365
|
+
log_name: log_name ?? `${groupId}::click`,
|
|
1366
|
+
params: {
|
|
1367
|
+
...otherParams,
|
|
1368
|
+
search,
|
|
1369
|
+
referrer: getReferrer(),
|
|
1370
|
+
deployment_id: env.getDeploymentId(),
|
|
1371
|
+
deployment_timestamp: extractDateFromUUIDv7(
|
|
1372
|
+
env.getDeploymentId()
|
|
1373
|
+
).getTime(),
|
|
1374
|
+
event_type: "click"
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
export {
|
|
1380
|
+
Accuracy,
|
|
1381
|
+
Analytics,
|
|
1382
|
+
FetchAlbumPhotosPermissionError,
|
|
1383
|
+
FetchContactsPermissionError,
|
|
1384
|
+
GetClipboardTextPermissionError,
|
|
1385
|
+
GetCurrentLocationPermissionError,
|
|
1386
|
+
GoogleAdMob,
|
|
1387
|
+
IAP,
|
|
1388
|
+
OpenCameraPermissionError,
|
|
1389
|
+
PermissionError,
|
|
1390
|
+
SafeAreaInsets,
|
|
1391
|
+
SetClipboardTextPermissionError,
|
|
1392
|
+
StartUpdateLocationPermissionError,
|
|
1393
|
+
Storage,
|
|
1394
|
+
TossAds,
|
|
1395
|
+
appLogin,
|
|
1396
|
+
appsInTossEvent,
|
|
1397
|
+
appsInTossSignTossCert,
|
|
1398
|
+
checkoutPayment,
|
|
1399
|
+
closeView,
|
|
1400
|
+
contactsViral,
|
|
1401
|
+
env,
|
|
1402
|
+
eventLog,
|
|
1403
|
+
fetchAlbumItems,
|
|
1404
|
+
fetchAlbumPhotos,
|
|
1405
|
+
fetchContacts,
|
|
1406
|
+
generateHapticFeedback,
|
|
1407
|
+
getAnonymousKey,
|
|
1408
|
+
getAppsInTossGlobals,
|
|
1409
|
+
getClipboardText,
|
|
1410
|
+
getCurrentLocation,
|
|
1411
|
+
getDeviceId,
|
|
1412
|
+
getGameCenterGameProfile,
|
|
1413
|
+
getGroupId,
|
|
1414
|
+
getIsTossLoginIntegratedService,
|
|
1415
|
+
getLocale,
|
|
1416
|
+
getNetworkStatus,
|
|
1417
|
+
getOperationalEnvironment,
|
|
1418
|
+
getPermission,
|
|
1419
|
+
getPlatformOS,
|
|
1420
|
+
getSafeAreaInsets,
|
|
1421
|
+
getSchemeUri,
|
|
1422
|
+
getServerTime,
|
|
1423
|
+
getTossAppVersion,
|
|
1424
|
+
getTossShareLink,
|
|
1425
|
+
getUserKeyForGame,
|
|
1426
|
+
graniteEvent,
|
|
1427
|
+
grantPromotionReward,
|
|
1428
|
+
grantPromotionRewardForGame,
|
|
1429
|
+
isMinVersionSupported,
|
|
1430
|
+
loadFullScreenAd,
|
|
1431
|
+
openCamera,
|
|
1432
|
+
openGameCenterLeaderboard,
|
|
1433
|
+
openPDFViewer,
|
|
1434
|
+
openPermissionDialog,
|
|
1435
|
+
openURL,
|
|
1436
|
+
partner,
|
|
1437
|
+
requestNotificationAgreement,
|
|
1438
|
+
requestPermission,
|
|
1439
|
+
requestReview,
|
|
1440
|
+
requestTossPayPaysBilling,
|
|
1441
|
+
saveBase64Data,
|
|
1442
|
+
setClipboardText,
|
|
1443
|
+
setDeviceOrientation,
|
|
1444
|
+
setIosSwipeGestureEnabled,
|
|
1445
|
+
setScreenAwakeMode,
|
|
1446
|
+
setSecureScreen,
|
|
1447
|
+
share,
|
|
1448
|
+
showFullScreenAd,
|
|
1449
|
+
startUpdateLocation,
|
|
1450
|
+
submitGameCenterLeaderBoardScore,
|
|
1451
|
+
tdsEvent
|
|
1452
|
+
};
|