@apps-in-toss/framework 0.0.0-dev.1744801739343 → 0.0.0-dev.1752049503789
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/bridge-meta.d.ts +1 -0
- package/dist/bridge-meta.js +158 -0
- package/dist/index.cjs +1388 -311
- package/dist/index.d.cts +26 -1179
- package/dist/index.d.ts +26 -1179
- package/dist/index.js +1341 -288
- package/dist/jest/index.cjs +2 -2
- package/dist/jest/index.d.cts +1 -1
- package/dist/jest/index.d.ts +1 -1
- package/dist/jest/index.js +1 -1
- package/package.json +25 -28
- package/src/bridge-entry.ts +4 -0
- package/src/async-bridges.ts +0 -9
- package/src/constant-bridges.ts +0 -3
- package/src/event-bridges.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -4,110 +4,1108 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// src/index.ts
|
|
8
|
+
import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
9
|
+
|
|
7
10
|
// src/core/registerApp.tsx
|
|
11
|
+
import { Analytics } from "@apps-in-toss/analytics";
|
|
12
|
+
import { Granite as Granite2 } from "@granite-js/react-native";
|
|
8
13
|
import { TDSProvider } from "@toss-design-system/react-native";
|
|
9
|
-
|
|
14
|
+
|
|
15
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
|
|
16
|
+
import { GraniteEvent } from "@granite-js/react-native";
|
|
17
|
+
import { GraniteEventDefinition } from "@granite-js/react-native";
|
|
18
|
+
import { GraniteEventDefinition as GraniteEventDefinition2 } from "@granite-js/react-native";
|
|
19
|
+
import { TurboModuleRegistry } from "react-native";
|
|
20
|
+
import { NativeEventEmitter } from "react-native";
|
|
21
|
+
import { GraniteEventDefinition as GraniteEventDefinition3 } from "@granite-js/react-native";
|
|
22
|
+
|
|
23
|
+
// ../../.yarn/cache/es-toolkit-npm-1.39.3-b94f623c91-1c85e518b1.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
24
|
+
function noop() {
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
|
|
28
|
+
import { Platform } from "react-native";
|
|
29
|
+
import { NativeModules } from "react-native";
|
|
30
|
+
import { Platform as Platform2 } from "react-native";
|
|
31
|
+
import { Linking } from "react-native";
|
|
32
|
+
import { Platform as Platform3 } from "react-native";
|
|
33
|
+
import { NativeModules as NativeModules2 } from "react-native";
|
|
34
|
+
import { NativeModules as NativeModules3 } from "react-native";
|
|
35
|
+
var EntryMessageExitedEvent = class extends GraniteEventDefinition {
|
|
36
|
+
name = "entryMessageExited";
|
|
37
|
+
remove() {
|
|
38
|
+
}
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
|
+
listener(_) {
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var Module = TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
44
|
+
var AppsInTossModuleInstance = Module;
|
|
45
|
+
var AppsInTossModule = Module;
|
|
46
|
+
function getPermission(permission) {
|
|
47
|
+
return AppsInTossModule.getPermission(permission);
|
|
48
|
+
}
|
|
49
|
+
function openPermissionDialog(permission) {
|
|
50
|
+
return AppsInTossModule.openPermissionDialog(permission);
|
|
51
|
+
}
|
|
52
|
+
async function requestPermission(permission) {
|
|
53
|
+
const permissionStatus = await getPermission(permission);
|
|
54
|
+
switch (permissionStatus) {
|
|
55
|
+
case "allowed":
|
|
56
|
+
case "denied":
|
|
57
|
+
return permissionStatus;
|
|
58
|
+
default:
|
|
59
|
+
return openPermissionDialog(permission);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
63
|
+
var UpdateLocationEvent = class extends GraniteEventDefinition2 {
|
|
64
|
+
name = "updateLocationEvent";
|
|
65
|
+
subscriptionCount = 0;
|
|
66
|
+
ref = {
|
|
67
|
+
remove: () => {
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
remove() {
|
|
71
|
+
if (--this.subscriptionCount === 0) {
|
|
72
|
+
AppsInTossModuleInstance.stopUpdateLocation({});
|
|
73
|
+
}
|
|
74
|
+
this.ref.remove();
|
|
75
|
+
}
|
|
76
|
+
listener(options, onEvent, onError) {
|
|
77
|
+
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
78
|
+
if (permissionStatus === "denied") {
|
|
79
|
+
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
83
|
+
const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
|
|
84
|
+
this.ref = {
|
|
85
|
+
remove: () => subscription?.remove()
|
|
86
|
+
};
|
|
87
|
+
this.subscriptionCount++;
|
|
88
|
+
}).catch(onError);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function generateUUID(placeholder) {
|
|
92
|
+
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
93
|
+
}
|
|
94
|
+
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
95
|
+
function invokeAppBridgeCallback(id, ...args) {
|
|
96
|
+
const callback = INTERNAL__callbacks.get(id);
|
|
97
|
+
callback?.call(null, ...args);
|
|
98
|
+
return Boolean(callback);
|
|
99
|
+
}
|
|
100
|
+
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
101
|
+
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
102
|
+
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
103
|
+
const promise = AppsInTossModuleInstance[methodName]({
|
|
104
|
+
params,
|
|
105
|
+
callbacks: callbackMap
|
|
106
|
+
});
|
|
107
|
+
void promise.then(onSuccess).catch(onError);
|
|
108
|
+
return unregisterAll;
|
|
109
|
+
}
|
|
110
|
+
function registerCallbacks(callbacks) {
|
|
111
|
+
const callbackMap = {};
|
|
112
|
+
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
113
|
+
const id = registerCallback(callback, callbackName);
|
|
114
|
+
callbackMap[callbackName] = id;
|
|
115
|
+
}
|
|
116
|
+
const unregisterAll = () => {
|
|
117
|
+
Object.values(callbackMap).forEach(unregisterCallback);
|
|
118
|
+
};
|
|
119
|
+
return { callbackMap, unregisterAll };
|
|
120
|
+
}
|
|
121
|
+
function registerCallback(callback, name = "unnamed") {
|
|
122
|
+
const uniqueId = generateUUID();
|
|
123
|
+
const callbackId = `${uniqueId}__${name}`;
|
|
124
|
+
INTERNAL__callbacks.set(callbackId, callback);
|
|
125
|
+
return callbackId;
|
|
126
|
+
}
|
|
127
|
+
function unregisterCallback(id) {
|
|
128
|
+
INTERNAL__callbacks.delete(id);
|
|
129
|
+
}
|
|
130
|
+
function getCallbackIds() {
|
|
131
|
+
return Array.from(INTERNAL__callbacks.keys());
|
|
132
|
+
}
|
|
133
|
+
var INTERNAL__appBridgeHandler = {
|
|
134
|
+
invokeAppBridgeCallback,
|
|
135
|
+
invokeAppBridgeMethod,
|
|
136
|
+
registerCallback,
|
|
137
|
+
unregisterCallback,
|
|
138
|
+
getCallbackIds
|
|
139
|
+
};
|
|
140
|
+
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
141
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition3 {
|
|
142
|
+
static INTERNAL__appBridgeSubscription;
|
|
143
|
+
name = "appBridgeCallbackEvent";
|
|
144
|
+
constructor() {
|
|
145
|
+
super();
|
|
146
|
+
this.registerAppBridgeCallbackEventListener();
|
|
147
|
+
}
|
|
148
|
+
remove() {
|
|
149
|
+
}
|
|
150
|
+
listener() {
|
|
151
|
+
}
|
|
152
|
+
registerAppBridgeCallbackEventListener() {
|
|
153
|
+
if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
|
|
157
|
+
"appBridgeCallback",
|
|
158
|
+
this.ensureInvokeAppBridgeCallback
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
ensureInvokeAppBridgeCallback(result) {
|
|
162
|
+
if (typeof result === "object" && typeof result.name === "string") {
|
|
163
|
+
INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
|
|
164
|
+
} else {
|
|
165
|
+
console.warn("Invalid app bridge callback result:", result);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
var appsInTossEvent = new GraniteEvent([
|
|
170
|
+
new AppBridgeCallbackEvent(),
|
|
171
|
+
new UpdateLocationEvent(),
|
|
172
|
+
new EntryMessageExitedEvent()
|
|
173
|
+
]);
|
|
174
|
+
function startUpdateLocation(eventParams) {
|
|
175
|
+
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
176
|
+
}
|
|
177
|
+
function getOperationalEnvironment() {
|
|
178
|
+
return AppsInTossModule.operationalEnvironment;
|
|
179
|
+
}
|
|
180
|
+
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
181
|
+
var isWildcard = (val) => ["*", "x", "X"].includes(val);
|
|
182
|
+
var tryParse = (val) => {
|
|
183
|
+
const num = parseInt(val, 10);
|
|
184
|
+
return isNaN(num) ? val : num;
|
|
185
|
+
};
|
|
186
|
+
var coerceTypes = (a, b) => {
|
|
187
|
+
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
188
|
+
};
|
|
189
|
+
var compareValues = (a, b) => {
|
|
190
|
+
if (isWildcard(a) || isWildcard(b)) {
|
|
191
|
+
return 0;
|
|
192
|
+
}
|
|
193
|
+
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
194
|
+
if (aVal > bVal) {
|
|
195
|
+
return 1;
|
|
196
|
+
}
|
|
197
|
+
if (aVal < bVal) {
|
|
198
|
+
return -1;
|
|
199
|
+
}
|
|
200
|
+
return 0;
|
|
201
|
+
};
|
|
202
|
+
var parseVersion = (version) => {
|
|
203
|
+
if (typeof version !== "string") {
|
|
204
|
+
throw new TypeError("Invalid argument: expected a string");
|
|
205
|
+
}
|
|
206
|
+
const match = version.match(SEMVER_REGEX);
|
|
207
|
+
if (!match) {
|
|
208
|
+
throw new Error(`Invalid semver: '${version}'`);
|
|
209
|
+
}
|
|
210
|
+
const [, major, minor, patch, build, preRelease] = match;
|
|
211
|
+
return [major, minor, patch, build, preRelease];
|
|
212
|
+
};
|
|
213
|
+
var compareSegments = (a, b) => {
|
|
214
|
+
const maxLength = Math.max(a.length, b.length);
|
|
215
|
+
for (let i = 0; i < maxLength; i++) {
|
|
216
|
+
const segA = a[i] ?? "0";
|
|
217
|
+
const segB = b[i] ?? "0";
|
|
218
|
+
const result = compareValues(segA, segB);
|
|
219
|
+
if (result !== 0) {
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return 0;
|
|
224
|
+
};
|
|
225
|
+
var compareVersions = (v1, v2) => {
|
|
226
|
+
const seg1 = parseVersion(v1);
|
|
227
|
+
const seg2 = parseVersion(v2);
|
|
228
|
+
const preRelease1 = seg1.pop();
|
|
229
|
+
const preRelease2 = seg2.pop();
|
|
230
|
+
const mainCompare = compareSegments(seg1, seg2);
|
|
231
|
+
if (mainCompare !== 0) {
|
|
232
|
+
return mainCompare;
|
|
233
|
+
}
|
|
234
|
+
if (preRelease1 && preRelease2) {
|
|
235
|
+
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
236
|
+
}
|
|
237
|
+
if (preRelease1) {
|
|
238
|
+
return -1;
|
|
239
|
+
}
|
|
240
|
+
if (preRelease2) {
|
|
241
|
+
return 1;
|
|
242
|
+
}
|
|
243
|
+
return 0;
|
|
244
|
+
};
|
|
245
|
+
function isMinVersionSupported(minVersions) {
|
|
246
|
+
const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
|
|
247
|
+
if (operationalEnvironment2 === "sandbox") {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
251
|
+
const isIOS = Platform.OS === "ios";
|
|
252
|
+
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
253
|
+
if (minVersion === void 0) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
if (minVersion === "always") {
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
if (minVersion === "never") {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return compareVersions(currentVersion, minVersion) >= 0;
|
|
263
|
+
}
|
|
264
|
+
function loadAdMobInterstitialAd(params) {
|
|
265
|
+
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
266
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
267
|
+
return noop;
|
|
268
|
+
}
|
|
269
|
+
const { onEvent, onError, options } = params;
|
|
270
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
271
|
+
onAdClicked: () => {
|
|
272
|
+
onEvent({ type: "clicked" });
|
|
273
|
+
},
|
|
274
|
+
onAdDismissed: () => {
|
|
275
|
+
onEvent({ type: "dismissed" });
|
|
276
|
+
},
|
|
277
|
+
onAdFailedToShow: () => {
|
|
278
|
+
onEvent({ type: "failedToShow" });
|
|
279
|
+
},
|
|
280
|
+
onAdImpression: () => {
|
|
281
|
+
onEvent({ type: "impression" });
|
|
282
|
+
},
|
|
283
|
+
onAdShow: () => {
|
|
284
|
+
onEvent({ type: "show" });
|
|
285
|
+
},
|
|
286
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
287
|
+
onError
|
|
288
|
+
});
|
|
289
|
+
return unregisterCallbacks;
|
|
290
|
+
}
|
|
291
|
+
function showAdMobInterstitialAd(params) {
|
|
292
|
+
if (!showAdMobInterstitialAd.isSupported()) {
|
|
293
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
294
|
+
return noop;
|
|
295
|
+
}
|
|
296
|
+
const { onEvent, onError, options } = params;
|
|
297
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
298
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
299
|
+
onError
|
|
300
|
+
});
|
|
301
|
+
return unregisterCallbacks;
|
|
302
|
+
}
|
|
303
|
+
function loadAdMobRewardedAd(params) {
|
|
304
|
+
if (!loadAdMobRewardedAd.isSupported()) {
|
|
305
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
306
|
+
return noop;
|
|
307
|
+
}
|
|
308
|
+
const { onEvent, onError, options } = params;
|
|
309
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
310
|
+
onAdClicked: () => {
|
|
311
|
+
onEvent({ type: "clicked" });
|
|
312
|
+
},
|
|
313
|
+
onAdDismissed: () => {
|
|
314
|
+
onEvent({ type: "dismissed" });
|
|
315
|
+
},
|
|
316
|
+
onAdFailedToShow: () => {
|
|
317
|
+
onEvent({ type: "failedToShow" });
|
|
318
|
+
},
|
|
319
|
+
onAdImpression: () => {
|
|
320
|
+
onEvent({ type: "impression" });
|
|
321
|
+
},
|
|
322
|
+
onAdShow: () => {
|
|
323
|
+
onEvent({ type: "show" });
|
|
324
|
+
},
|
|
325
|
+
onUserEarnedReward: () => {
|
|
326
|
+
onEvent({ type: "userEarnedReward" });
|
|
327
|
+
},
|
|
328
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
329
|
+
onError
|
|
330
|
+
});
|
|
331
|
+
return unregisterCallbacks;
|
|
332
|
+
}
|
|
333
|
+
function showAdMobRewardedAd(params) {
|
|
334
|
+
if (!showAdMobRewardedAd.isSupported()) {
|
|
335
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
336
|
+
return noop;
|
|
337
|
+
}
|
|
338
|
+
const { onEvent, onError, options } = params;
|
|
339
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
340
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
341
|
+
onError
|
|
342
|
+
});
|
|
343
|
+
return unregisterCallbacks;
|
|
344
|
+
}
|
|
345
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
346
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
347
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
348
|
+
var ENVIRONMENT = getOperationalEnvironment();
|
|
349
|
+
function createIsSupported() {
|
|
350
|
+
return () => {
|
|
351
|
+
if (ENVIRONMENT !== "toss") {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
return isMinVersionSupported({
|
|
355
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
356
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
361
|
+
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
362
|
+
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
363
|
+
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
364
|
+
async function checkoutPayment(options) {
|
|
365
|
+
return AppsInTossModule.checkoutPayment({ params: options });
|
|
366
|
+
}
|
|
367
|
+
async function setClipboardText(text) {
|
|
368
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
369
|
+
if (permissionStatus === "denied") {
|
|
370
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
371
|
+
}
|
|
372
|
+
return AppsInTossModule.setClipboardText({ text });
|
|
373
|
+
}
|
|
374
|
+
async function getClipboardText() {
|
|
375
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
|
|
376
|
+
if (permissionStatus === "denied") {
|
|
377
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
378
|
+
}
|
|
379
|
+
return AppsInTossModule.getClipboardText({});
|
|
380
|
+
}
|
|
381
|
+
async function fetchContacts(options) {
|
|
382
|
+
const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
|
|
383
|
+
if (permissionStatus === "denied") {
|
|
384
|
+
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
385
|
+
}
|
|
386
|
+
const contacts = await AppsInTossModule.fetchContacts(options);
|
|
387
|
+
return {
|
|
388
|
+
result: contacts.result,
|
|
389
|
+
nextOffset: contacts.nextOffset ?? null,
|
|
390
|
+
done: contacts.done
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
var DEFAULT_MAX_COUNT = 10;
|
|
394
|
+
var DEFAULT_MAX_WIDTH = 1024;
|
|
395
|
+
async function fetchAlbumPhotos(options) {
|
|
396
|
+
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
397
|
+
if (permissionStatus === "denied") {
|
|
398
|
+
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
399
|
+
}
|
|
400
|
+
const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
|
|
401
|
+
...options,
|
|
402
|
+
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
403
|
+
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
404
|
+
});
|
|
405
|
+
return albumPhotos;
|
|
406
|
+
}
|
|
407
|
+
async function getCurrentLocation(options) {
|
|
408
|
+
const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
|
|
409
|
+
if (permissionStatus === "denied") {
|
|
410
|
+
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
411
|
+
}
|
|
412
|
+
const position = await AppsInTossModule.getCurrentLocation(options);
|
|
413
|
+
return position;
|
|
414
|
+
}
|
|
415
|
+
async function openCamera(options) {
|
|
416
|
+
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
417
|
+
if (permissionStatus === "denied") {
|
|
418
|
+
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
419
|
+
}
|
|
420
|
+
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
421
|
+
return photo;
|
|
422
|
+
}
|
|
423
|
+
async function appLogin() {
|
|
424
|
+
return AppsInTossModule.appLogin({});
|
|
425
|
+
}
|
|
426
|
+
function getTossAppVersion() {
|
|
427
|
+
return AppsInTossModule.tossAppVersion;
|
|
428
|
+
}
|
|
429
|
+
function getDeviceId() {
|
|
430
|
+
return AppsInTossModule.deviceId;
|
|
431
|
+
}
|
|
432
|
+
function getItem(key) {
|
|
433
|
+
return AppsInTossModule.getStorageItem({ key });
|
|
434
|
+
}
|
|
435
|
+
function setItem(key, value) {
|
|
436
|
+
return AppsInTossModule.setStorageItem({
|
|
437
|
+
key,
|
|
438
|
+
value
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function removeItem(key) {
|
|
442
|
+
return AppsInTossModule.removeStorageItem({ key });
|
|
443
|
+
}
|
|
444
|
+
function clearItems() {
|
|
445
|
+
return AppsInTossModule.clearStorage({});
|
|
446
|
+
}
|
|
447
|
+
var Storage = {
|
|
448
|
+
getItem,
|
|
449
|
+
setItem,
|
|
450
|
+
removeItem,
|
|
451
|
+
clearItems
|
|
452
|
+
};
|
|
453
|
+
function normalizeParams(params) {
|
|
454
|
+
return Object.fromEntries(
|
|
455
|
+
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
async function eventLog(params) {
|
|
459
|
+
if (AppsInTossModule.operationalEnvironment === "sandbox") {
|
|
460
|
+
console.log("[eventLogDebug]", {
|
|
461
|
+
log_name: params.log_name,
|
|
462
|
+
log_type: params.log_type,
|
|
463
|
+
params: normalizeParams(params.params)
|
|
464
|
+
});
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
const isSupported = isMinVersionSupported({
|
|
468
|
+
android: "5.208.0",
|
|
469
|
+
ios: "5.208.0"
|
|
470
|
+
});
|
|
471
|
+
if (!isSupported) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
return AppsInTossModule.eventLog({
|
|
475
|
+
log_name: params.log_name,
|
|
476
|
+
log_type: params.log_type,
|
|
477
|
+
params: normalizeParams(params.params)
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
async function getTossShareLink(path) {
|
|
481
|
+
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
482
|
+
const shareUrl = new URL(shareLink);
|
|
483
|
+
shareUrl.searchParams.set("deep_link_value", path);
|
|
484
|
+
shareUrl.searchParams.set("af_dp", path);
|
|
485
|
+
return shareUrl.toString();
|
|
486
|
+
}
|
|
487
|
+
async function setDeviceOrientation(options) {
|
|
488
|
+
const isSupported = isMinVersionSupported({
|
|
489
|
+
android: "5.215.0",
|
|
490
|
+
ios: "5.215.0"
|
|
491
|
+
});
|
|
492
|
+
if (!isSupported) {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
return AppsInTossModule.setDeviceOrientation(options);
|
|
496
|
+
}
|
|
497
|
+
async function saveBase64Data(params) {
|
|
498
|
+
const isSupported = isMinVersionSupported({
|
|
499
|
+
android: "5.218.0",
|
|
500
|
+
ios: "5.216.0"
|
|
501
|
+
});
|
|
502
|
+
if (!isSupported) {
|
|
503
|
+
console.warn("saveBase64Data is not supported in this app version");
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
await AppsInTossModule.saveBase64Data(params);
|
|
507
|
+
}
|
|
508
|
+
var TossPay = {
|
|
509
|
+
checkoutPayment
|
|
510
|
+
};
|
|
511
|
+
var GoogleAdMob = {
|
|
512
|
+
loadAdMobInterstitialAd,
|
|
513
|
+
showAdMobInterstitialAd,
|
|
514
|
+
loadAdMobRewardedAd,
|
|
515
|
+
showAdMobRewardedAd
|
|
516
|
+
};
|
|
517
|
+
var BedrockModule = NativeModules.BedrockModule;
|
|
518
|
+
async function closeView() {
|
|
519
|
+
return BedrockModule.closeView();
|
|
520
|
+
}
|
|
521
|
+
function getLocale() {
|
|
522
|
+
const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
|
|
523
|
+
if (Platform2.OS === "android") {
|
|
524
|
+
return replaceUnderbarToHypen(locale);
|
|
525
|
+
}
|
|
526
|
+
return locale;
|
|
527
|
+
}
|
|
528
|
+
function replaceUnderbarToHypen(locale) {
|
|
529
|
+
return locale.replace(/_/g, "-");
|
|
530
|
+
}
|
|
531
|
+
function getSchemeUri() {
|
|
532
|
+
return BedrockModule.schemeUri;
|
|
533
|
+
}
|
|
534
|
+
function generateHapticFeedback(options) {
|
|
535
|
+
return BedrockModule.generateHapticFeedback(options);
|
|
536
|
+
}
|
|
537
|
+
async function share(message) {
|
|
538
|
+
BedrockModule.share(message);
|
|
539
|
+
}
|
|
540
|
+
function setSecureScreen(options) {
|
|
541
|
+
return BedrockModule.setSecureScreen(options);
|
|
542
|
+
}
|
|
543
|
+
async function setScreenAwakeMode(options) {
|
|
544
|
+
return BedrockModule.setScreenAwakeMode(options);
|
|
545
|
+
}
|
|
546
|
+
function getNetworkStatus() {
|
|
547
|
+
return BedrockModule.getNetworkStatus();
|
|
548
|
+
}
|
|
549
|
+
async function setIosSwipeGestureEnabled(options) {
|
|
550
|
+
if (BedrockModule.setIosSwipeGestureEnabled == null) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
return BedrockModule.setIosSwipeGestureEnabled(options);
|
|
554
|
+
}
|
|
555
|
+
function openURL(url) {
|
|
556
|
+
return Linking.openURL(url);
|
|
557
|
+
}
|
|
558
|
+
function getPlatformOS() {
|
|
559
|
+
return Platform3.OS;
|
|
560
|
+
}
|
|
561
|
+
var BedrockCoreModule = NativeModules2.BedrockCoreModule;
|
|
562
|
+
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
563
|
+
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
564
|
+
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
565
|
+
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
566
|
+
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
567
|
+
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
568
|
+
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
569
|
+
return Accuracy3;
|
|
570
|
+
})(Accuracy2 || {});
|
|
571
|
+
var TossCoreModule = NativeModules3.TossCoreModule;
|
|
572
|
+
function tossCoreEventLog(params) {
|
|
573
|
+
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
574
|
+
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
575
|
+
if (!supported || isSandbox) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
TossCoreModule.eventLog({
|
|
579
|
+
params: {
|
|
580
|
+
log_name: params.log_name,
|
|
581
|
+
log_type: params.log_type,
|
|
582
|
+
params: params.params
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
var INTERNAL__module = {
|
|
587
|
+
tossCoreEventLog
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// src/core/components/AppEvent.tsx
|
|
591
|
+
import { Granite, getSchemeUri as getSchemeUri3 } from "@granite-js/react-native";
|
|
592
|
+
import { useEffect } from "react";
|
|
593
|
+
|
|
594
|
+
// src/env.ts
|
|
595
|
+
var env = {
|
|
596
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
// src/core/hooks/useReferrer.ts
|
|
600
|
+
import { getSchemeUri as getSchemeUri2 } from "@granite-js/react-native";
|
|
601
|
+
import { useMemo } from "react";
|
|
602
|
+
function useReferrer() {
|
|
603
|
+
return useMemo(() => {
|
|
604
|
+
try {
|
|
605
|
+
return new URL(getSchemeUri2()).searchParams.get("referrer");
|
|
606
|
+
} catch {
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
}, []);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// src/core/components/AppEvent.tsx
|
|
613
|
+
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
614
|
+
function isPrivateScheme() {
|
|
615
|
+
try {
|
|
616
|
+
return new URL(getSchemeUri3()).protocol === "intoss-private:";
|
|
617
|
+
} catch {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
function EntryAppEvent() {
|
|
622
|
+
const referrer = useReferrer() ?? "";
|
|
623
|
+
useEffect(() => {
|
|
624
|
+
INTERNAL__module.tossCoreEventLog({
|
|
625
|
+
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
626
|
+
log_type: "info",
|
|
627
|
+
params: {
|
|
628
|
+
is_transform: true,
|
|
629
|
+
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
630
|
+
referrer,
|
|
631
|
+
deployment_id: env.getDeploymentId(),
|
|
632
|
+
app_name: Granite.appName,
|
|
633
|
+
is_private: isPrivateScheme()
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
}, [referrer]);
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
function SystemAppEvent({ ...initialProps }) {
|
|
640
|
+
useEffect(() => {
|
|
641
|
+
INTERNAL__module.tossCoreEventLog({
|
|
642
|
+
log_name: "AppsInTossInitialProps",
|
|
643
|
+
log_type: "debug",
|
|
644
|
+
params: {
|
|
645
|
+
...initialProps,
|
|
646
|
+
schemeUri: getSchemeUri3(),
|
|
647
|
+
deployment_id: env.getDeploymentId(),
|
|
648
|
+
app_name: Granite.appName,
|
|
649
|
+
is_private: isPrivateScheme()
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
}, [initialProps]);
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
var AppEvent = {
|
|
656
|
+
Entry: EntryAppEvent,
|
|
657
|
+
System: SystemAppEvent
|
|
658
|
+
};
|
|
10
659
|
|
|
11
660
|
// src/core/hooks/useAppsInTossBridge.ts
|
|
12
661
|
import { useBridge } from "@toss-design-system/react-native";
|
|
13
|
-
import { useEffect } from "react";
|
|
662
|
+
import { useEffect as useEffect2 } from "react";
|
|
14
663
|
|
|
15
664
|
// src/core/utils/getAppsInTossGlobals.ts
|
|
16
665
|
function getAppsInTossGlobals() {
|
|
17
666
|
if (global.__appsInToss == null) {
|
|
18
667
|
throw new Error("invalid apps-in-toss globals");
|
|
19
668
|
}
|
|
20
|
-
return global.__appsInToss;
|
|
669
|
+
return global.__appsInToss;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// src/core/utils/toIcon.ts
|
|
673
|
+
function toIcon(source) {
|
|
674
|
+
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
678
|
+
function useAppsInTossBridge() {
|
|
679
|
+
const controller = useBridge();
|
|
680
|
+
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
681
|
+
useEffect2(() => {
|
|
682
|
+
const commonProps = {
|
|
683
|
+
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
684
|
+
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
685
|
+
color: appsInTossGlobals2.brandPrimaryColor,
|
|
686
|
+
colorMode: appsInTossGlobals2.brandBridgeColorMode
|
|
687
|
+
};
|
|
688
|
+
controller.open({
|
|
689
|
+
...commonProps,
|
|
690
|
+
onExited: () => {
|
|
691
|
+
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}, []);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/async-bridges.ts
|
|
698
|
+
var async_bridges_exports = {};
|
|
699
|
+
__export(async_bridges_exports, {
|
|
700
|
+
appLogin: () => appLogin2,
|
|
701
|
+
checkoutPayment: () => checkoutPayment2,
|
|
702
|
+
closeView: () => closeView2,
|
|
703
|
+
eventLog: () => eventLog2,
|
|
704
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos2,
|
|
705
|
+
fetchContacts: () => fetchContacts2,
|
|
706
|
+
generateHapticFeedback: () => generateHapticFeedback2,
|
|
707
|
+
getClipboardText: () => getClipboardText2,
|
|
708
|
+
getCurrentLocation: () => getCurrentLocation2,
|
|
709
|
+
getNetworkStatus: () => getNetworkStatus2,
|
|
710
|
+
getTossShareLink: () => getTossShareLink2,
|
|
711
|
+
openCamera: () => openCamera2,
|
|
712
|
+
openURL: () => openURL2,
|
|
713
|
+
saveBase64Data: () => saveBase64Data2,
|
|
714
|
+
setClipboardText: () => setClipboardText2,
|
|
715
|
+
setDeviceOrientation: () => setDeviceOrientation2,
|
|
716
|
+
setIosSwipeGestureEnabled: () => setIosSwipeGestureEnabled2,
|
|
717
|
+
setScreenAwakeMode: () => setScreenAwakeMode2,
|
|
718
|
+
setSecureScreen: () => setSecureScreen2,
|
|
719
|
+
share: () => share2
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
723
|
+
import { NativeModules as NativeModules4 } from "react-native";
|
|
724
|
+
var BedrockModule2 = NativeModules4.BedrockModule;
|
|
725
|
+
|
|
726
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/closeView.ts
|
|
727
|
+
async function closeView2() {
|
|
728
|
+
return BedrockModule2.closeView();
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts
|
|
732
|
+
function generateHapticFeedback2(options) {
|
|
733
|
+
return BedrockModule2.generateHapticFeedback(options);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/share.ts
|
|
737
|
+
async function share2(message) {
|
|
738
|
+
BedrockModule2.share(message);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setSecureScreen.ts
|
|
742
|
+
function setSecureScreen2(options) {
|
|
743
|
+
return BedrockModule2.setSecureScreen(options);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts
|
|
747
|
+
async function setScreenAwakeMode2(options) {
|
|
748
|
+
return BedrockModule2.setScreenAwakeMode(options);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts
|
|
752
|
+
function getNetworkStatus2() {
|
|
753
|
+
return BedrockModule2.getNetworkStatus();
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts
|
|
757
|
+
async function setIosSwipeGestureEnabled2(options) {
|
|
758
|
+
if (BedrockModule2.setIosSwipeGestureEnabled == null) {
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
return BedrockModule2.setIosSwipeGestureEnabled(options);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/openURL.ts
|
|
765
|
+
import { Linking as Linking2 } from "react-native";
|
|
766
|
+
function openURL2(url) {
|
|
767
|
+
return Linking2.openURL(url);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
771
|
+
import { TurboModuleRegistry as TurboModuleRegistry2 } from "react-native";
|
|
772
|
+
var Module2 = TurboModuleRegistry2.getEnforcing("AppsInTossModule");
|
|
773
|
+
var AppsInTossModuleInstance2 = Module2;
|
|
774
|
+
var AppsInTossModule2 = Module2;
|
|
775
|
+
|
|
776
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getPermission.ts
|
|
777
|
+
function getPermission2(permission) {
|
|
778
|
+
return AppsInTossModule2.getPermission(permission);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openPermissionDialog.ts
|
|
782
|
+
function openPermissionDialog2(permission) {
|
|
783
|
+
return AppsInTossModule2.openPermissionDialog(permission);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/requestPermission.ts
|
|
787
|
+
async function requestPermission2(permission) {
|
|
788
|
+
const permissionStatus = await getPermission2(permission);
|
|
789
|
+
switch (permissionStatus) {
|
|
790
|
+
case "allowed":
|
|
791
|
+
case "denied":
|
|
792
|
+
return permissionStatus;
|
|
793
|
+
default:
|
|
794
|
+
return openPermissionDialog2(permission);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setClipboardText.ts
|
|
799
|
+
async function setClipboardText2(text) {
|
|
800
|
+
const permissionStatus = await requestPermission2({ name: "clipboard", access: "write" });
|
|
801
|
+
if (permissionStatus === "denied") {
|
|
802
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
803
|
+
}
|
|
804
|
+
return AppsInTossModule2.setClipboardText({ text });
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getClipboardText.ts
|
|
808
|
+
async function getClipboardText2() {
|
|
809
|
+
const permissionStatus = await requestPermission2({ name: "clipboard", access: "read" });
|
|
810
|
+
if (permissionStatus === "denied") {
|
|
811
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
812
|
+
}
|
|
813
|
+
return AppsInTossModule2.getClipboardText({});
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchContacts.ts
|
|
817
|
+
async function fetchContacts2(options) {
|
|
818
|
+
const permissionStatus = await requestPermission2({ name: "contacts", access: "read" });
|
|
819
|
+
if (permissionStatus === "denied") {
|
|
820
|
+
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
821
|
+
}
|
|
822
|
+
const contacts = await AppsInTossModule2.fetchContacts(options);
|
|
823
|
+
return {
|
|
824
|
+
result: contacts.result,
|
|
825
|
+
nextOffset: contacts.nextOffset ?? null,
|
|
826
|
+
done: contacts.done
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
|
|
831
|
+
var DEFAULT_MAX_COUNT2 = 10;
|
|
832
|
+
var DEFAULT_MAX_WIDTH2 = 1024;
|
|
833
|
+
async function fetchAlbumPhotos2(options) {
|
|
834
|
+
const permissionStatus = await requestPermission2({ name: "photos", access: "read" });
|
|
835
|
+
if (permissionStatus === "denied") {
|
|
836
|
+
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
837
|
+
}
|
|
838
|
+
const albumPhotos = await AppsInTossModule2.fetchAlbumPhotos({
|
|
839
|
+
...options,
|
|
840
|
+
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT2,
|
|
841
|
+
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH2
|
|
842
|
+
});
|
|
843
|
+
return albumPhotos;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getCurrentLocation.ts
|
|
847
|
+
async function getCurrentLocation2(options) {
|
|
848
|
+
const permissionStatus = await requestPermission2({ name: "geolocation", access: "access" });
|
|
849
|
+
if (permissionStatus === "denied") {
|
|
850
|
+
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
851
|
+
}
|
|
852
|
+
const position = await AppsInTossModule2.getCurrentLocation(options);
|
|
853
|
+
return position;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openCamera.ts
|
|
857
|
+
async function openCamera2(options) {
|
|
858
|
+
const permissionStatus = await requestPermission2({ name: "camera", access: "access" });
|
|
859
|
+
if (permissionStatus === "denied") {
|
|
860
|
+
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
861
|
+
}
|
|
862
|
+
const photo = await AppsInTossModule2.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
863
|
+
return photo;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/appLogin.ts
|
|
867
|
+
async function appLogin2() {
|
|
868
|
+
return AppsInTossModule2.appLogin({});
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
872
|
+
import { Platform as Platform4 } from "react-native";
|
|
873
|
+
|
|
874
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/compareVersion.ts
|
|
875
|
+
var SEMVER_REGEX2 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
876
|
+
var isWildcard2 = (val) => ["*", "x", "X"].includes(val);
|
|
877
|
+
var tryParse2 = (val) => {
|
|
878
|
+
const num = parseInt(val, 10);
|
|
879
|
+
return isNaN(num) ? val : num;
|
|
880
|
+
};
|
|
881
|
+
var coerceTypes2 = (a, b) => {
|
|
882
|
+
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
883
|
+
};
|
|
884
|
+
var compareValues2 = (a, b) => {
|
|
885
|
+
if (isWildcard2(a) || isWildcard2(b)) {
|
|
886
|
+
return 0;
|
|
887
|
+
}
|
|
888
|
+
const [aVal, bVal] = coerceTypes2(tryParse2(a), tryParse2(b));
|
|
889
|
+
if (aVal > bVal) {
|
|
890
|
+
return 1;
|
|
891
|
+
}
|
|
892
|
+
if (aVal < bVal) {
|
|
893
|
+
return -1;
|
|
894
|
+
}
|
|
895
|
+
return 0;
|
|
896
|
+
};
|
|
897
|
+
var parseVersion2 = (version) => {
|
|
898
|
+
if (typeof version !== "string") {
|
|
899
|
+
throw new TypeError("Invalid argument: expected a string");
|
|
900
|
+
}
|
|
901
|
+
const match = version.match(SEMVER_REGEX2);
|
|
902
|
+
if (!match) {
|
|
903
|
+
throw new Error(`Invalid semver: '${version}'`);
|
|
904
|
+
}
|
|
905
|
+
const [, major, minor, patch, build, preRelease] = match;
|
|
906
|
+
return [major, minor, patch, build, preRelease];
|
|
907
|
+
};
|
|
908
|
+
var compareSegments2 = (a, b) => {
|
|
909
|
+
const maxLength = Math.max(a.length, b.length);
|
|
910
|
+
for (let i = 0; i < maxLength; i++) {
|
|
911
|
+
const segA = a[i] ?? "0";
|
|
912
|
+
const segB = b[i] ?? "0";
|
|
913
|
+
const result = compareValues2(segA, segB);
|
|
914
|
+
if (result !== 0) {
|
|
915
|
+
return result;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return 0;
|
|
919
|
+
};
|
|
920
|
+
var compareVersions2 = (v1, v2) => {
|
|
921
|
+
const seg1 = parseVersion2(v1);
|
|
922
|
+
const seg2 = parseVersion2(v2);
|
|
923
|
+
const preRelease1 = seg1.pop();
|
|
924
|
+
const preRelease2 = seg2.pop();
|
|
925
|
+
const mainCompare = compareSegments2(seg1, seg2);
|
|
926
|
+
if (mainCompare !== 0) {
|
|
927
|
+
return mainCompare;
|
|
928
|
+
}
|
|
929
|
+
if (preRelease1 && preRelease2) {
|
|
930
|
+
return compareSegments2(preRelease1.split("."), preRelease2.split("."));
|
|
931
|
+
}
|
|
932
|
+
if (preRelease1) {
|
|
933
|
+
return -1;
|
|
934
|
+
}
|
|
935
|
+
if (preRelease2) {
|
|
936
|
+
return 1;
|
|
937
|
+
}
|
|
938
|
+
return 0;
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
942
|
+
function isMinVersionSupported2(minVersions) {
|
|
943
|
+
const operationalEnvironment2 = AppsInTossModule2.operationalEnvironment;
|
|
944
|
+
if (operationalEnvironment2 === "sandbox") {
|
|
945
|
+
return true;
|
|
946
|
+
}
|
|
947
|
+
const currentVersion = AppsInTossModule2.tossAppVersion;
|
|
948
|
+
const isIOS = Platform4.OS === "ios";
|
|
949
|
+
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
950
|
+
if (minVersion === void 0) {
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
if (minVersion === "always") {
|
|
954
|
+
return true;
|
|
955
|
+
}
|
|
956
|
+
if (minVersion === "never") {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
return compareVersions2(currentVersion, minVersion) >= 0;
|
|
21
960
|
}
|
|
22
961
|
|
|
23
|
-
// src/
|
|
24
|
-
function
|
|
25
|
-
return
|
|
962
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/eventLog.ts
|
|
963
|
+
function normalizeParams2(params) {
|
|
964
|
+
return Object.fromEntries(
|
|
965
|
+
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
async function eventLog2(params) {
|
|
969
|
+
if (AppsInTossModule2.operationalEnvironment === "sandbox") {
|
|
970
|
+
console.log("[eventLogDebug]", {
|
|
971
|
+
log_name: params.log_name,
|
|
972
|
+
log_type: params.log_type,
|
|
973
|
+
params: normalizeParams2(params.params)
|
|
974
|
+
});
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
const isSupported = isMinVersionSupported2({
|
|
978
|
+
android: "5.208.0",
|
|
979
|
+
ios: "5.208.0"
|
|
980
|
+
});
|
|
981
|
+
if (!isSupported) {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
return AppsInTossModule2.eventLog({
|
|
985
|
+
log_name: params.log_name,
|
|
986
|
+
log_type: params.log_type,
|
|
987
|
+
params: normalizeParams2(params.params)
|
|
988
|
+
});
|
|
26
989
|
}
|
|
27
990
|
|
|
28
|
-
// src/
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
36
|
-
color: appsInTossGlobals2.brandPrimaryColor,
|
|
37
|
-
colorMode: appsInTossGlobals2.brandBridgeColorMode
|
|
38
|
-
};
|
|
39
|
-
controller.open({ ...commonProps });
|
|
40
|
-
}, []);
|
|
991
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossShareLink.ts
|
|
992
|
+
async function getTossShareLink2(path) {
|
|
993
|
+
const { shareLink } = await AppsInTossModule2.getTossShareLink({});
|
|
994
|
+
const shareUrl = new URL(shareLink);
|
|
995
|
+
shareUrl.searchParams.set("deep_link_value", path);
|
|
996
|
+
shareUrl.searchParams.set("af_dp", path);
|
|
997
|
+
return shareUrl.toString();
|
|
41
998
|
}
|
|
42
999
|
|
|
43
|
-
// src/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1000
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setDeviceOrientation.ts
|
|
1001
|
+
async function setDeviceOrientation2(options) {
|
|
1002
|
+
const isSupported = isMinVersionSupported2({
|
|
1003
|
+
android: "5.215.0",
|
|
1004
|
+
ios: "5.215.0"
|
|
1005
|
+
});
|
|
1006
|
+
if (!isSupported) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
return AppsInTossModule2.setDeviceOrientation(options);
|
|
47
1010
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1011
|
+
|
|
1012
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/checkoutPayment.ts
|
|
1013
|
+
async function checkoutPayment2(options) {
|
|
1014
|
+
return AppsInTossModule2.checkoutPayment({ params: options });
|
|
51
1015
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1016
|
+
|
|
1017
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/saveBase64Data.ts
|
|
1018
|
+
async function saveBase64Data2(params) {
|
|
1019
|
+
const isSupported = isMinVersionSupported2({
|
|
1020
|
+
android: "5.218.0",
|
|
1021
|
+
ios: "5.216.0"
|
|
56
1022
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return global.__bedrock.app.name;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
console.error("unexpected error occurred while getting app name");
|
|
63
|
-
throw error;
|
|
1023
|
+
if (!isSupported) {
|
|
1024
|
+
console.warn("saveBase64Data is not supported in this app version");
|
|
1025
|
+
return;
|
|
64
1026
|
}
|
|
1027
|
+
await AppsInTossModule2.saveBase64Data(params);
|
|
65
1028
|
}
|
|
66
1029
|
|
|
67
|
-
// src/
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
1030
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/constant-bridges.ts
|
|
1031
|
+
var constant_bridges_exports = {};
|
|
1032
|
+
__export(constant_bridges_exports, {
|
|
1033
|
+
getDeviceId: () => getDeviceId2,
|
|
1034
|
+
getLocale: () => getLocale2,
|
|
1035
|
+
getOperationalEnvironment: () => getOperationalEnvironment2,
|
|
1036
|
+
getPlatformOS: () => getPlatformOS2,
|
|
1037
|
+
getSchemeUri: () => getSchemeUri4,
|
|
1038
|
+
getTossAppVersion: () => getTossAppVersion2
|
|
1039
|
+
});
|
|
71
1040
|
|
|
72
|
-
//
|
|
73
|
-
import {
|
|
1041
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getLocale.ts
|
|
1042
|
+
import { Platform as Platform5 } from "react-native";
|
|
1043
|
+
function getLocale2() {
|
|
1044
|
+
const locale = BedrockModule2?.DeviceInfo?.locale ?? "ko-KR";
|
|
1045
|
+
if (Platform5.OS === "android") {
|
|
1046
|
+
return replaceUnderbarToHypen2(locale);
|
|
1047
|
+
}
|
|
1048
|
+
return locale;
|
|
1049
|
+
}
|
|
1050
|
+
function replaceUnderbarToHypen2(locale) {
|
|
1051
|
+
return locale.replace(/_/g, "-");
|
|
1052
|
+
}
|
|
74
1053
|
|
|
75
|
-
//
|
|
76
|
-
|
|
1054
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getSchemeUri.ts
|
|
1055
|
+
function getSchemeUri4() {
|
|
1056
|
+
return BedrockModule2.schemeUri;
|
|
1057
|
+
}
|
|
77
1058
|
|
|
78
|
-
// src/native-modules/
|
|
79
|
-
import {
|
|
80
|
-
|
|
81
|
-
|
|
1059
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getPlatformOS.ts
|
|
1060
|
+
import { Platform as Platform6 } from "react-native";
|
|
1061
|
+
function getPlatformOS2() {
|
|
1062
|
+
return Platform6.OS;
|
|
1063
|
+
}
|
|
82
1064
|
|
|
83
|
-
// src/native-modules/
|
|
84
|
-
function
|
|
85
|
-
return
|
|
1065
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
|
|
1066
|
+
function getOperationalEnvironment2() {
|
|
1067
|
+
return AppsInTossModule2.operationalEnvironment;
|
|
86
1068
|
}
|
|
87
1069
|
|
|
88
|
-
// src/native-modules/
|
|
89
|
-
function
|
|
90
|
-
return
|
|
1070
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossAppVersion.ts
|
|
1071
|
+
function getTossAppVersion2() {
|
|
1072
|
+
return AppsInTossModule2.tossAppVersion;
|
|
91
1073
|
}
|
|
92
1074
|
|
|
93
|
-
// src/native-modules/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
switch (permissionStatus) {
|
|
97
|
-
case "allowed":
|
|
98
|
-
case "denied":
|
|
99
|
-
return permissionStatus;
|
|
100
|
-
default:
|
|
101
|
-
return openPermissionDialog(permission);
|
|
102
|
-
}
|
|
1075
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getDeviceId.ts
|
|
1076
|
+
function getDeviceId2() {
|
|
1077
|
+
return AppsInTossModule2.deviceId;
|
|
103
1078
|
}
|
|
104
1079
|
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
1080
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/event-bridges.ts
|
|
1081
|
+
var event_bridges_exports = {};
|
|
1082
|
+
__export(event_bridges_exports, {
|
|
1083
|
+
startUpdateLocation: () => startUpdateLocation2
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
1087
|
+
import { GraniteEvent as GraniteEvent2 } from "@granite-js/react-native";
|
|
1088
|
+
|
|
1089
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
1090
|
+
import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
|
|
1091
|
+
var EntryMessageExitedEvent2 = class extends GraniteEventDefinition4 {
|
|
1092
|
+
name = "entryMessageExited";
|
|
1093
|
+
remove() {
|
|
1094
|
+
}
|
|
1095
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1096
|
+
listener(_) {
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
1101
|
+
import { GraniteEventDefinition as GraniteEventDefinition5 } from "@granite-js/react-native";
|
|
1102
|
+
|
|
1103
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
|
|
1104
|
+
import { NativeEventEmitter as NativeEventEmitter2 } from "react-native";
|
|
1105
|
+
var nativeEventEmitter2 = new NativeEventEmitter2(AppsInTossModuleInstance2);
|
|
108
1106
|
|
|
109
|
-
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
110
|
-
var
|
|
1107
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
1108
|
+
var UpdateLocationEvent2 = class extends GraniteEventDefinition5 {
|
|
111
1109
|
name = "updateLocationEvent";
|
|
112
1110
|
subscriptionCount = 0;
|
|
113
1111
|
ref = {
|
|
@@ -115,17 +1113,19 @@ var UpdateLocationEvent = class extends BedrockEventDefinition {
|
|
|
115
1113
|
}
|
|
116
1114
|
};
|
|
117
1115
|
remove() {
|
|
118
|
-
--this.subscriptionCount === 0
|
|
1116
|
+
if (--this.subscriptionCount === 0) {
|
|
1117
|
+
AppsInTossModuleInstance2.stopUpdateLocation({});
|
|
1118
|
+
}
|
|
119
1119
|
this.ref.remove();
|
|
120
1120
|
}
|
|
121
1121
|
listener(options, onEvent, onError) {
|
|
122
|
-
|
|
1122
|
+
requestPermission2({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
123
1123
|
if (permissionStatus === "denied") {
|
|
124
1124
|
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
125
1125
|
return;
|
|
126
1126
|
}
|
|
127
|
-
void
|
|
128
|
-
const subscription =
|
|
1127
|
+
void AppsInTossModuleInstance2.startUpdateLocation(options).catch(onError);
|
|
1128
|
+
const subscription = nativeEventEmitter2.addListener("updateLocation", onEvent);
|
|
129
1129
|
this.ref = {
|
|
130
1130
|
remove: () => subscription?.remove()
|
|
131
1131
|
};
|
|
@@ -134,184 +1134,183 @@ var UpdateLocationEvent = class extends BedrockEventDefinition {
|
|
|
134
1134
|
}
|
|
135
1135
|
};
|
|
136
1136
|
|
|
137
|
-
// src/native-event-emitter/
|
|
138
|
-
|
|
1137
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
1138
|
+
import { GraniteEventDefinition as GraniteEventDefinition6 } from "@granite-js/react-native";
|
|
139
1139
|
|
|
140
|
-
//
|
|
141
|
-
function
|
|
142
|
-
return
|
|
1140
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/generateUUID.ts
|
|
1141
|
+
function generateUUID2(placeholder) {
|
|
1142
|
+
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID2);
|
|
143
1143
|
}
|
|
144
1144
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
1145
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts
|
|
1146
|
+
var INTERNAL__callbacks2 = /* @__PURE__ */ new Map();
|
|
1147
|
+
function invokeAppBridgeCallback2(id, ...args) {
|
|
1148
|
+
const callback = INTERNAL__callbacks2.get(id);
|
|
1149
|
+
callback?.call(null, ...args);
|
|
1150
|
+
return Boolean(callback);
|
|
148
1151
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
1152
|
+
function invokeAppBridgeMethod2(methodName, params, callbacks) {
|
|
1153
|
+
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
1154
|
+
const { callbackMap, unregisterAll } = registerCallbacks2(appBridgeCallbacks);
|
|
1155
|
+
const promise = AppsInTossModuleInstance2[methodName]({
|
|
1156
|
+
params,
|
|
1157
|
+
callbacks: callbackMap
|
|
1158
|
+
});
|
|
1159
|
+
void promise.then(onSuccess).catch(onError);
|
|
1160
|
+
return unregisterAll;
|
|
153
1161
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
1162
|
+
function registerCallbacks2(callbacks) {
|
|
1163
|
+
const callbackMap = {};
|
|
1164
|
+
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
1165
|
+
const id = registerCallback2(callback, callbackName);
|
|
1166
|
+
callbackMap[callbackName] = id;
|
|
160
1167
|
}
|
|
161
|
-
|
|
1168
|
+
const unregisterAll = () => {
|
|
1169
|
+
Object.values(callbackMap).forEach(unregisterCallback2);
|
|
1170
|
+
};
|
|
1171
|
+
return { callbackMap, unregisterAll };
|
|
162
1172
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
169
|
-
}
|
|
170
|
-
return AppsInTossModule.getClipboardText({});
|
|
1173
|
+
function registerCallback2(callback, name = "unnamed") {
|
|
1174
|
+
const uniqueId = generateUUID2();
|
|
1175
|
+
const callbackId = `${uniqueId}__${name}`;
|
|
1176
|
+
INTERNAL__callbacks2.set(callbackId, callback);
|
|
1177
|
+
return callbackId;
|
|
171
1178
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
async function fetchContacts({
|
|
175
|
-
size,
|
|
176
|
-
offset,
|
|
177
|
-
query
|
|
178
|
-
}) {
|
|
179
|
-
const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
|
|
180
|
-
if (permissionStatus === "denied") {
|
|
181
|
-
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
182
|
-
}
|
|
183
|
-
const contacts = await AppsInTossModule.fetchContacts({
|
|
184
|
-
size,
|
|
185
|
-
offset,
|
|
186
|
-
query
|
|
187
|
-
});
|
|
188
|
-
return {
|
|
189
|
-
result: contacts.result,
|
|
190
|
-
nextOffset: contacts.nextOffset ?? null,
|
|
191
|
-
done: contacts.done
|
|
192
|
-
};
|
|
1179
|
+
function unregisterCallback2(id) {
|
|
1180
|
+
INTERNAL__callbacks2.delete(id);
|
|
193
1181
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
var DEFAULT_MAX_COUNT = 10;
|
|
197
|
-
var DEFAULT_MAX_WIDTH = 1024;
|
|
198
|
-
async function fetchAlbumPhotos(options) {
|
|
199
|
-
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
200
|
-
if (permissionStatus === "denied") {
|
|
201
|
-
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
202
|
-
}
|
|
203
|
-
const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
|
|
204
|
-
...options,
|
|
205
|
-
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
206
|
-
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
207
|
-
});
|
|
208
|
-
return albumPhotos;
|
|
1182
|
+
function getCallbackIds2() {
|
|
1183
|
+
return Array.from(INTERNAL__callbacks2.keys());
|
|
209
1184
|
}
|
|
1185
|
+
var INTERNAL__appBridgeHandler2 = {
|
|
1186
|
+
invokeAppBridgeCallback: invokeAppBridgeCallback2,
|
|
1187
|
+
invokeAppBridgeMethod: invokeAppBridgeMethod2,
|
|
1188
|
+
registerCallback: registerCallback2,
|
|
1189
|
+
unregisterCallback: unregisterCallback2,
|
|
1190
|
+
getCallbackIds: getCallbackIds2
|
|
1191
|
+
};
|
|
210
1192
|
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
1193
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
1194
|
+
var UNSAFE__nativeEventEmitter2 = nativeEventEmitter2;
|
|
1195
|
+
var AppBridgeCallbackEvent2 = class _AppBridgeCallbackEvent2 extends GraniteEventDefinition6 {
|
|
1196
|
+
static INTERNAL__appBridgeSubscription;
|
|
1197
|
+
name = "appBridgeCallbackEvent";
|
|
1198
|
+
constructor() {
|
|
1199
|
+
super();
|
|
1200
|
+
this.registerAppBridgeCallbackEventListener();
|
|
216
1201
|
}
|
|
217
|
-
|
|
218
|
-
return position;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// src/native-modules/openCamera.ts
|
|
222
|
-
async function openCamera(options) {
|
|
223
|
-
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
224
|
-
if (permissionStatus === "denied") {
|
|
225
|
-
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
1202
|
+
remove() {
|
|
226
1203
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
1204
|
+
listener() {
|
|
1205
|
+
}
|
|
1206
|
+
registerAppBridgeCallbackEventListener() {
|
|
1207
|
+
if (_AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription != null) {
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
_AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter2.addListener(
|
|
1211
|
+
"appBridgeCallback",
|
|
1212
|
+
this.ensureInvokeAppBridgeCallback
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
ensureInvokeAppBridgeCallback(result) {
|
|
1216
|
+
if (typeof result === "object" && typeof result.name === "string") {
|
|
1217
|
+
INTERNAL__appBridgeHandler2.invokeAppBridgeCallback(result.name, result.params);
|
|
1218
|
+
} else {
|
|
1219
|
+
console.warn("Invalid app bridge callback result:", result);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
235
1223
|
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
1224
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
1225
|
+
var appsInTossEvent2 = new GraniteEvent2([
|
|
1226
|
+
new AppBridgeCallbackEvent2(),
|
|
1227
|
+
new UpdateLocationEvent2(),
|
|
1228
|
+
new EntryMessageExitedEvent2()
|
|
1229
|
+
]);
|
|
240
1230
|
|
|
241
|
-
//
|
|
242
|
-
function
|
|
243
|
-
return
|
|
1231
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
|
|
1232
|
+
function startUpdateLocation2(eventParams) {
|
|
1233
|
+
return appsInTossEvent2.addEventListener("updateLocationEvent", eventParams);
|
|
244
1234
|
}
|
|
245
1235
|
|
|
246
|
-
// src/
|
|
247
|
-
|
|
248
|
-
|
|
1236
|
+
// src/core/registerApp.tsx
|
|
1237
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
1238
|
+
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
1239
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1240
|
+
/* @__PURE__ */ jsx(AppEvent.Entry, {}),
|
|
1241
|
+
/* @__PURE__ */ jsx(AppEvent.System, { ...initialProps }),
|
|
1242
|
+
/* @__PURE__ */ jsx(Container, { ...initialProps, children: /* @__PURE__ */ jsx(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx(TDSContainer, { ...initialProps, children }) }) })
|
|
1243
|
+
] });
|
|
249
1244
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return AppsInTossModule.getStorageItem({ key });
|
|
1245
|
+
function TDSContainer({ children }) {
|
|
1246
|
+
useAppsInTossBridge();
|
|
1247
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
254
1248
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
1249
|
+
function registerApp(container, { context, analytics }) {
|
|
1250
|
+
Analytics.init({
|
|
1251
|
+
logger: (params) => void eventLog2(params),
|
|
1252
|
+
debug: analytics?.debug ?? __DEV__
|
|
1253
|
+
});
|
|
1254
|
+
return Granite2.registerApp(AppsInTossContainer.bind(null, container), {
|
|
1255
|
+
appName: getAppName(),
|
|
1256
|
+
context,
|
|
1257
|
+
router: {
|
|
1258
|
+
screenContainer: Analytics.Screen,
|
|
1259
|
+
defaultScreenOption: {
|
|
1260
|
+
statusBarStyle: "dark"
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
259
1263
|
});
|
|
260
1264
|
}
|
|
261
|
-
function
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
1265
|
+
function getAppName() {
|
|
1266
|
+
try {
|
|
1267
|
+
return global.__granite.app.name;
|
|
1268
|
+
} catch (error) {
|
|
1269
|
+
console.error("unexpected error occurred while getting app name");
|
|
1270
|
+
throw error;
|
|
1271
|
+
}
|
|
266
1272
|
}
|
|
267
|
-
var Storage = {
|
|
268
|
-
getItem,
|
|
269
|
-
setItem,
|
|
270
|
-
removeItem,
|
|
271
|
-
clearItems
|
|
272
|
-
};
|
|
273
1273
|
|
|
274
|
-
// src/
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
executePayment
|
|
1274
|
+
// src/core/index.ts
|
|
1275
|
+
var AppsInToss = {
|
|
1276
|
+
registerApp
|
|
278
1277
|
};
|
|
279
1278
|
|
|
280
1279
|
// src/components/WebView.tsx
|
|
1280
|
+
import { getSchemeUri as getSchemeUri6, useGraniteEvent } from "@granite-js/react-native";
|
|
1281
|
+
import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
|
|
1282
|
+
import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
|
|
281
1283
|
import {
|
|
282
1284
|
PartnerWebViewScreen,
|
|
283
1285
|
ExternalWebViewScreen
|
|
284
1286
|
} from "@toss-design-system/react-native";
|
|
285
1287
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
286
|
-
import { useMemo as
|
|
287
|
-
import { getSchemeUri, useBedrockEvent } from "react-native-bedrock";
|
|
288
|
-
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
289
|
-
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
1288
|
+
import { useCallback as useCallback3, useMemo as useMemo3 } from "react";
|
|
290
1289
|
|
|
291
1290
|
// src/components/GameWebView.tsx
|
|
292
1291
|
import {
|
|
293
1292
|
WebView as PlainWebView
|
|
294
|
-
} from "@
|
|
1293
|
+
} from "@granite-js/native/react-native-webview";
|
|
1294
|
+
import { closeView as closeView3 } from "@granite-js/react-native";
|
|
295
1295
|
import { useDialog } from "@toss-design-system/react-native";
|
|
296
1296
|
import { josa } from "es-hangul";
|
|
297
|
-
import { forwardRef, useCallback, useEffect as
|
|
298
|
-
import { BackHandler, Platform as
|
|
299
|
-
import { closeView, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
1297
|
+
import { forwardRef, useCallback, useEffect as useEffect3 } from "react";
|
|
1298
|
+
import { BackHandler, Platform as Platform10, View as View3 } from "react-native";
|
|
300
1299
|
|
|
301
1300
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
302
|
-
import { SvgXml } from "@
|
|
1301
|
+
import { SvgXml } from "@granite-js/native/react-native-svg";
|
|
303
1302
|
import { PageNavbar } from "@toss-design-system/react-native";
|
|
304
|
-
import { Platform as
|
|
1303
|
+
import { Platform as Platform9, TouchableOpacity, View as View2 } from "react-native";
|
|
305
1304
|
|
|
306
1305
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
307
1306
|
import { StyleSheet, View } from "react-native";
|
|
308
1307
|
|
|
309
1308
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
310
|
-
import { Platform } from "react-native";
|
|
1309
|
+
import { Platform as Platform7 } from "react-native";
|
|
311
1310
|
function byPlatform({
|
|
312
1311
|
...props
|
|
313
1312
|
}) {
|
|
314
|
-
return (props[
|
|
1313
|
+
return (props[Platform7.OS] ?? props.fallback)();
|
|
315
1314
|
}
|
|
316
1315
|
|
|
317
1316
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -344,35 +1343,35 @@ var styles = StyleSheet.create({
|
|
|
344
1343
|
});
|
|
345
1344
|
|
|
346
1345
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
347
|
-
import { useSafeAreaInsets } from "@
|
|
348
|
-
import { Platform as
|
|
1346
|
+
import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-context";
|
|
1347
|
+
import { Platform as Platform8 } from "react-native";
|
|
349
1348
|
function useSafeAreaTop() {
|
|
350
1349
|
const safeAreaInsets = useSafeAreaInsets();
|
|
351
|
-
const hasDynamicIsland =
|
|
1350
|
+
const hasDynamicIsland = Platform8.OS === "ios" && safeAreaInsets.top > 50;
|
|
352
1351
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
353
1352
|
return safeAreaTop;
|
|
354
1353
|
}
|
|
355
1354
|
|
|
356
1355
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
357
|
-
import { Fragment as Fragment2, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
1356
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
358
1357
|
var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xmlns="https://www.w3.org/2000/svg"><rect fill="#031832" fill-opacity=".46" height="30" rx="15" width="30"/><rect height="29.5" rx="14.75" stroke="#d9d9ff" stroke-opacity=".11" stroke-width=".5" width="29.5" x=".25" y=".25"/><path clip-rule="evenodd" d="m16.5119 15.0014 4.7092-4.7092c.0929-.0928.1666-.2031.2169-.32441.0503-.12134.0762-.25141.0762-.38276.0001-.13136-.0258-.26144-.076-.38281s-.1239-.23166-.2167-.32457c-.0929-.09291-.2031-.16662-.3245-.21692-.1213-.05031-.2514-.07622-.3827-.07626-.1314-.00004-.2615.0258-.3828.07603-.1214.05023-.2317.12388-.3246.21673l-4.7092 4.70997-4.71-4.70997c-.1897-.17718-.4408-.27373-.70034-.26927s-.5072.10959-.69069.2932c-.1835.1836-.28848.43132-.29279.69087-.00432.25954.09238.51057.26968.70017l4.71004 4.7092-4.71004 4.7092c-.1392.1401-.23385.3183-.27204.5121-.0382.1939-.01823.3946.05739.5771s.20351.3386.36759.4486.35702.169.55456.1697c.25583 0 .51164-.0975.70664-.2925l4.71-4.71 4.7092 4.71c.0927.093.2029.1668.3243.2172.1213.0504.2514.0763.3828.0763s.2614-.0259.3828-.0763c.1213-.0504.2315-.1242.3243-.2172.0929-.0929.1667-.2032.217-.3246s.0762-.2515.0762-.3829-.0259-.2616-.0762-.383-.1241-.2317-.217-.3245z" fill="#fdfdfe" fill-opacity=".89" fill-rule="evenodd"/></svg>';
|
|
359
1358
|
function GameNavigationBar({ onClose }) {
|
|
360
1359
|
const safeAreaTop = useSafeAreaTop();
|
|
361
|
-
return /* @__PURE__ */
|
|
1360
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
362
1361
|
/* @__PURE__ */ jsx3(PageNavbar, { preference: { type: "none" } }),
|
|
363
1362
|
/* @__PURE__ */ jsx3(
|
|
364
1363
|
View2,
|
|
365
1364
|
{
|
|
366
1365
|
style: {
|
|
367
1366
|
width: "100%",
|
|
368
|
-
height:
|
|
1367
|
+
height: Platform9.OS === "ios" ? 44 : 54,
|
|
369
1368
|
flexDirection: "row",
|
|
370
1369
|
alignItems: "center",
|
|
371
1370
|
justifyContent: "flex-end",
|
|
372
1371
|
position: "absolute",
|
|
373
1372
|
zIndex: 9999,
|
|
374
1373
|
marginTop: safeAreaTop,
|
|
375
|
-
paddingRight:
|
|
1374
|
+
paddingRight: Platform9.OS === "ios" ? 10 : 8
|
|
376
1375
|
},
|
|
377
1376
|
pointerEvents: "box-none",
|
|
378
1377
|
children: /* @__PURE__ */ jsx3(HeaderRight, { children: /* @__PURE__ */ jsx3(
|
|
@@ -383,7 +1382,7 @@ function GameNavigationBar({ onClose }) {
|
|
|
383
1382
|
accessible: true,
|
|
384
1383
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
385
1384
|
style: {
|
|
386
|
-
padding:
|
|
1385
|
+
padding: Platform9.OS === "ios" ? 7 : 9
|
|
387
1386
|
},
|
|
388
1387
|
onPress: onClose,
|
|
389
1388
|
children: /* @__PURE__ */ jsx3(SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
@@ -395,7 +1394,7 @@ function GameNavigationBar({ onClose }) {
|
|
|
395
1394
|
}
|
|
396
1395
|
|
|
397
1396
|
// src/components/GameWebView.tsx
|
|
398
|
-
import { Fragment as Fragment3, jsx as jsx4, jsxs as
|
|
1397
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
399
1398
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
400
1399
|
const { openConfirm } = useDialog();
|
|
401
1400
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
@@ -407,11 +1406,11 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
407
1406
|
closeOnDimmerClick: true
|
|
408
1407
|
});
|
|
409
1408
|
if (isConfirmed) {
|
|
410
|
-
|
|
1409
|
+
closeView3();
|
|
411
1410
|
}
|
|
412
1411
|
}, [brandDisplayName, openConfirm]);
|
|
413
|
-
|
|
414
|
-
if (
|
|
1412
|
+
useEffect3(() => {
|
|
1413
|
+
if (Platform10.OS === "ios") {
|
|
415
1414
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
416
1415
|
return () => {
|
|
417
1416
|
setIosSwipeGestureEnabled({ isEnabled: true });
|
|
@@ -419,7 +1418,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
419
1418
|
}
|
|
420
1419
|
return;
|
|
421
1420
|
}, []);
|
|
422
|
-
|
|
1421
|
+
useEffect3(() => {
|
|
423
1422
|
const backHandler = () => {
|
|
424
1423
|
handleClose();
|
|
425
1424
|
return true;
|
|
@@ -429,28 +1428,14 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
429
1428
|
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
430
1429
|
};
|
|
431
1430
|
}, [handleClose]);
|
|
432
|
-
return /* @__PURE__ */
|
|
1431
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
433
1432
|
/* @__PURE__ */ jsx4(GameNavigationBar, { onClose: handleClose }),
|
|
434
1433
|
/* @__PURE__ */ jsx4(View3, { style: { flex: 1 }, children: /* @__PURE__ */ jsx4(PlainWebView, { ref, ...props }) })
|
|
435
1434
|
] });
|
|
436
1435
|
});
|
|
437
1436
|
|
|
438
|
-
// src/async-bridges.ts
|
|
439
|
-
var async_bridges_exports = {};
|
|
440
|
-
__export(async_bridges_exports, {
|
|
441
|
-
appLogin: () => appLogin,
|
|
442
|
-
checkoutPayment: () => checkoutPayment,
|
|
443
|
-
executePayment: () => executePayment,
|
|
444
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
445
|
-
fetchContacts: () => fetchContacts,
|
|
446
|
-
getClipboardText: () => getClipboardText,
|
|
447
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
448
|
-
openCamera: () => openCamera,
|
|
449
|
-
setClipboardText: () => setClipboardText
|
|
450
|
-
});
|
|
451
|
-
|
|
452
1437
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
453
|
-
import { useCallback as useCallback2, useMemo, useRef } from "react";
|
|
1438
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useRef } from "react";
|
|
454
1439
|
function serializeError(error) {
|
|
455
1440
|
return JSON.stringify(error, (_, value) => {
|
|
456
1441
|
if (value instanceof Error) {
|
|
@@ -471,22 +1456,23 @@ function methodHandler({
|
|
|
471
1456
|
handlerMap,
|
|
472
1457
|
injectJavaScript
|
|
473
1458
|
}) {
|
|
474
|
-
const func =
|
|
475
|
-
const result = await handlerMap[functionName](...args2);
|
|
476
|
-
return result;
|
|
477
|
-
};
|
|
1459
|
+
const func = handlerMap[functionName];
|
|
478
1460
|
if (!func) {
|
|
479
1461
|
console.error(`${functionName} is not a function`);
|
|
480
1462
|
return;
|
|
481
1463
|
}
|
|
482
|
-
|
|
1464
|
+
const wrappedFunc = async (...args2) => {
|
|
1465
|
+
const result = await func(...args2);
|
|
1466
|
+
return result;
|
|
1467
|
+
};
|
|
1468
|
+
wrappedFunc(...args).then((result) => {
|
|
483
1469
|
injectJavaScript?.(`
|
|
484
|
-
window.
|
|
1470
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
|
|
485
1471
|
`);
|
|
486
1472
|
}).catch((error) => {
|
|
487
1473
|
const serializedError = serializeError(error);
|
|
488
1474
|
injectJavaScript?.(`
|
|
489
|
-
window.
|
|
1475
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
|
|
490
1476
|
`);
|
|
491
1477
|
});
|
|
492
1478
|
}
|
|
@@ -499,7 +1485,7 @@ function useBridgeHandler({
|
|
|
499
1485
|
injectedJavaScript: originalInjectedJavaScript
|
|
500
1486
|
}) {
|
|
501
1487
|
const ref = useRef(null);
|
|
502
|
-
const injectedJavaScript =
|
|
1488
|
+
const injectedJavaScript = useMemo2(
|
|
503
1489
|
() => [
|
|
504
1490
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
505
1491
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -517,12 +1503,12 @@ function useBridgeHandler({
|
|
|
517
1503
|
);
|
|
518
1504
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
519
1505
|
ref.current?.injectJavaScript(`
|
|
520
|
-
window.
|
|
1506
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
521
1507
|
`);
|
|
522
1508
|
};
|
|
523
1509
|
const createHandleOnError = (functionName, eventId) => (error) => {
|
|
524
1510
|
ref.current?.injectJavaScript(`
|
|
525
|
-
window.
|
|
1511
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
526
1512
|
`);
|
|
527
1513
|
};
|
|
528
1514
|
const $onMessage = useCallback2(
|
|
@@ -575,28 +1561,58 @@ function useBridgeHandler({
|
|
|
575
1561
|
};
|
|
576
1562
|
}
|
|
577
1563
|
|
|
578
|
-
// src/
|
|
579
|
-
|
|
580
|
-
__export(constant_bridges_exports, {
|
|
581
|
-
getDeviceId: () => getDeviceId,
|
|
582
|
-
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
583
|
-
getTossAppVersion: () => getTossAppVersion
|
|
584
|
-
});
|
|
1564
|
+
// src/utils/log.ts
|
|
1565
|
+
import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
|
|
585
1566
|
|
|
586
|
-
// src/
|
|
587
|
-
var
|
|
588
|
-
|
|
1567
|
+
// src/utils/extractDateFromUUIDv7.ts
|
|
1568
|
+
var extractDateFromUUIDv7 = (uuid) => {
|
|
1569
|
+
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
1570
|
+
const timestamp = Number.parseInt(timestampHex, 16);
|
|
1571
|
+
return new Date(timestamp);
|
|
589
1572
|
};
|
|
590
1573
|
|
|
591
|
-
// src/
|
|
592
|
-
var
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
1574
|
+
// src/utils/log.ts
|
|
1575
|
+
var getGroupId = (url) => {
|
|
1576
|
+
try {
|
|
1577
|
+
const urlObject = new URL(url);
|
|
1578
|
+
return {
|
|
1579
|
+
groupId: urlObject.pathname,
|
|
1580
|
+
search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
|
|
1581
|
+
};
|
|
1582
|
+
} catch {
|
|
1583
|
+
return {
|
|
1584
|
+
groupId: "unknown",
|
|
1585
|
+
search: "unknown"
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
var getReferrer = () => {
|
|
1590
|
+
try {
|
|
1591
|
+
const referrer = new URL(getSchemeUri5());
|
|
1592
|
+
return referrer.searchParams.get("referrer");
|
|
1593
|
+
} catch {
|
|
1594
|
+
return "";
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
var trackScreen = (url) => {
|
|
1598
|
+
const { groupId, search } = getGroupId(url);
|
|
1599
|
+
const log = {
|
|
1600
|
+
log_type: "screen",
|
|
1601
|
+
log_name: `${groupId}::screen`,
|
|
1602
|
+
params: {
|
|
1603
|
+
search,
|
|
1604
|
+
referrer: getReferrer(),
|
|
1605
|
+
deployment_id: env.getDeploymentId(),
|
|
1606
|
+
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
return eventLog(log);
|
|
1610
|
+
};
|
|
596
1611
|
|
|
597
1612
|
// src/components/WebView.tsx
|
|
598
1613
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
599
1614
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1615
|
+
var operationalEnvironment = getOperationalEnvironment2();
|
|
600
1616
|
var TYPES = ["partner", "external", "game"];
|
|
601
1617
|
var WEBVIEW_TYPES = {
|
|
602
1618
|
partner: PartnerWebViewScreen,
|
|
@@ -605,7 +1621,7 @@ var WEBVIEW_TYPES = {
|
|
|
605
1621
|
};
|
|
606
1622
|
function mergeSchemeQueryParamsInto(url) {
|
|
607
1623
|
const baseUrl = new URL(url);
|
|
608
|
-
const schemeUrl = new URL(
|
|
1624
|
+
const schemeUrl = new URL(getSchemeUri6());
|
|
609
1625
|
baseUrl.pathname = schemeUrl.pathname;
|
|
610
1626
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
611
1627
|
baseUrl.searchParams.set(key, value);
|
|
@@ -629,8 +1645,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
629
1645
|
if (!TYPES.includes(type)) {
|
|
630
1646
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
631
1647
|
}
|
|
632
|
-
const
|
|
633
|
-
const uri =
|
|
1648
|
+
const graniteEvent = useGraniteEvent();
|
|
1649
|
+
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
634
1650
|
const top = useSafeAreaTop2();
|
|
635
1651
|
const bottom = useSafeAreaBottom();
|
|
636
1652
|
const handler = useBridgeHandler({
|
|
@@ -638,20 +1654,32 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
638
1654
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
639
1655
|
eventListenerMap: {
|
|
640
1656
|
...event_bridges_exports,
|
|
641
|
-
backEvent: ({ onEvent, onError, options }) =>
|
|
1657
|
+
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1658
|
+
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1659
|
+
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1660
|
+
/** @internal */
|
|
1661
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1662
|
+
/** AdMob */
|
|
1663
|
+
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1664
|
+
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
1665
|
+
loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
|
|
1666
|
+
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
|
|
642
1667
|
},
|
|
643
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
644
|
-
// @ts-expect-error
|
|
645
1668
|
constantHandlerMap: {
|
|
646
|
-
...
|
|
1669
|
+
...graniteConstantBridges,
|
|
647
1670
|
...constant_bridges_exports,
|
|
648
1671
|
getSafeAreaTop: () => top,
|
|
649
|
-
getSafeAreaBottom: () => bottom
|
|
1672
|
+
getSafeAreaBottom: () => bottom,
|
|
1673
|
+
/** AdMob */
|
|
1674
|
+
loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1675
|
+
showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
1676
|
+
loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
|
|
1677
|
+
showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
|
|
1678
|
+
/** env */
|
|
1679
|
+
getDeploymentId: env.getDeploymentId
|
|
650
1680
|
},
|
|
651
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
652
|
-
// @ts-expect-error
|
|
653
1681
|
asyncHandlerMap: {
|
|
654
|
-
...
|
|
1682
|
+
...graniteAsyncBridges,
|
|
655
1683
|
...async_bridges_exports,
|
|
656
1684
|
/** internal */
|
|
657
1685
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
@@ -662,7 +1690,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
662
1690
|
clearItems: Storage.clearItems
|
|
663
1691
|
}
|
|
664
1692
|
});
|
|
665
|
-
const baseProps =
|
|
1693
|
+
const baseProps = useMemo3(() => {
|
|
666
1694
|
switch (type) {
|
|
667
1695
|
case "partner": {
|
|
668
1696
|
const headerOnlyProp = {
|
|
@@ -692,10 +1720,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
692
1720
|
}
|
|
693
1721
|
}, [type, props]);
|
|
694
1722
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
695
|
-
const
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
1723
|
+
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1724
|
+
const handleNavigationStateChange = useCallback3((event) => {
|
|
1725
|
+
if (event.url) {
|
|
1726
|
+
trackScreen(event.url);
|
|
1727
|
+
}
|
|
1728
|
+
}, []);
|
|
699
1729
|
return /* @__PURE__ */ jsx5(
|
|
700
1730
|
BaseWebView,
|
|
701
1731
|
{
|
|
@@ -704,9 +1734,10 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
704
1734
|
...baseProps,
|
|
705
1735
|
source: { uri },
|
|
706
1736
|
sharedCookiesEnabled: true,
|
|
707
|
-
webviewDebuggingEnabled,
|
|
1737
|
+
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
708
1738
|
thirdPartyCookiesEnabled: true,
|
|
709
1739
|
onMessage: handler.onMessage,
|
|
1740
|
+
onNavigationStateChange: handleNavigationStateChange,
|
|
710
1741
|
injectedJavaScript: handler.injectedJavaScript,
|
|
711
1742
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
712
1743
|
}
|
|
@@ -720,12 +1751,12 @@ function ensureValue(value, name) {
|
|
|
720
1751
|
}
|
|
721
1752
|
|
|
722
1753
|
// src/hooks/useGeolocation.ts
|
|
723
|
-
import {
|
|
724
|
-
import {
|
|
1754
|
+
import { useVisibility } from "@granite-js/react-native";
|
|
1755
|
+
import { useState, useEffect as useEffect4 } from "react";
|
|
725
1756
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
726
1757
|
const isVisible = useVisibility();
|
|
727
1758
|
const [location, setLocation] = useState(null);
|
|
728
|
-
|
|
1759
|
+
useEffect4(() => {
|
|
729
1760
|
if (!isVisible) {
|
|
730
1761
|
return;
|
|
731
1762
|
}
|
|
@@ -742,33 +1773,55 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
742
1773
|
return location;
|
|
743
1774
|
}
|
|
744
1775
|
|
|
745
|
-
// src/
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return Accuracy3;
|
|
754
|
-
})(Accuracy2 || {});
|
|
1776
|
+
// src/index.ts
|
|
1777
|
+
export * from "@apps-in-toss/analytics";
|
|
1778
|
+
var Analytics2 = {
|
|
1779
|
+
init: InternalAnalytics.init,
|
|
1780
|
+
Impression: InternalAnalytics.Impression,
|
|
1781
|
+
Press: InternalAnalytics.Press,
|
|
1782
|
+
Area: InternalAnalytics.Area
|
|
1783
|
+
};
|
|
755
1784
|
export {
|
|
756
1785
|
Accuracy2 as Accuracy,
|
|
1786
|
+
Analytics2 as Analytics,
|
|
757
1787
|
AppsInToss,
|
|
1788
|
+
AppsInTossModule,
|
|
1789
|
+
BedrockCoreModule,
|
|
1790
|
+
BedrockModule,
|
|
1791
|
+
GoogleAdMob,
|
|
1792
|
+
AppsInTossModuleInstance as INTERNAL__AppsInTossModule,
|
|
1793
|
+
INTERNAL__module,
|
|
758
1794
|
Storage,
|
|
759
1795
|
TossPay,
|
|
760
1796
|
WebView,
|
|
761
1797
|
appLogin,
|
|
1798
|
+
appsInTossEvent,
|
|
1799
|
+
closeView,
|
|
762
1800
|
env,
|
|
1801
|
+
eventLog,
|
|
763
1802
|
fetchAlbumPhotos,
|
|
764
1803
|
fetchContacts,
|
|
1804
|
+
generateHapticFeedback,
|
|
765
1805
|
getClipboardText,
|
|
766
1806
|
getCurrentLocation,
|
|
767
1807
|
getDeviceId,
|
|
1808
|
+
getLocale,
|
|
1809
|
+
getNetworkStatus,
|
|
768
1810
|
getOperationalEnvironment,
|
|
1811
|
+
getPlatformOS,
|
|
1812
|
+
getSchemeUri,
|
|
769
1813
|
getTossAppVersion,
|
|
1814
|
+
getTossShareLink,
|
|
1815
|
+
isMinVersionSupported,
|
|
770
1816
|
openCamera,
|
|
1817
|
+
openURL,
|
|
1818
|
+
saveBase64Data,
|
|
771
1819
|
setClipboardText,
|
|
1820
|
+
setDeviceOrientation,
|
|
1821
|
+
setIosSwipeGestureEnabled,
|
|
1822
|
+
setScreenAwakeMode,
|
|
1823
|
+
setSecureScreen,
|
|
1824
|
+
share,
|
|
772
1825
|
startUpdateLocation,
|
|
773
1826
|
useGeolocation
|
|
774
1827
|
};
|