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