@apps-in-toss/framework 0.0.40 → 1.0.1
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 +5 -0
- package/dist/index.cjs +254 -1015
- package/dist/index.d.cts +7 -2269
- package/dist/index.d.ts +7 -2269
- package/dist/index.js +162 -904
- package/dist/internal.cjs +24 -0
- package/dist/internal.d.cts +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- 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 +27 -26
- package/src/bridge-entry.ts +4 -0
- package/src/async-bridges.ts +0 -15
- package/src/constant-bridges.ts +0 -3
- package/src/event-bridges.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
1
|
// src/index.ts
|
|
8
2
|
import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
9
3
|
|
|
10
4
|
// src/core/registerApp.tsx
|
|
11
5
|
import { Analytics } from "@apps-in-toss/analytics";
|
|
6
|
+
import { isMinVersionSupported, setIosSwipeGestureEnabled, eventLog } from "@apps-in-toss/native-modules";
|
|
7
|
+
import { Granite as Granite3 } from "@granite-js/react-native";
|
|
12
8
|
import { TDSProvider } from "@toss-design-system/react-native";
|
|
13
|
-
import { Bedrock as Bedrock3 } from "react-native-bedrock";
|
|
14
9
|
|
|
15
10
|
// src/core/components/AppEvent.tsx
|
|
11
|
+
import { INTERNAL__module as INTERNAL__module2 } from "@apps-in-toss/native-modules";
|
|
12
|
+
import { Granite as Granite2, getSchemeUri as getSchemeUri3, useVisibility as useVisibility2 } from "@granite-js/react-native";
|
|
16
13
|
import { useEffect as useEffect2 } from "react";
|
|
17
|
-
import { Bedrock as Bedrock2, getSchemeUri as getSchemeUri3, useVisibility as useVisibility2 } from "react-native-bedrock";
|
|
18
14
|
|
|
19
15
|
// src/env.ts
|
|
20
16
|
var env = {
|
|
@@ -22,12 +18,13 @@ var env = {
|
|
|
22
18
|
};
|
|
23
19
|
|
|
24
20
|
// src/hooks/useCaptureExitLog.ts
|
|
21
|
+
import { INTERNAL__module } from "@apps-in-toss/native-modules";
|
|
22
|
+
import { Granite, useVisibility } from "@granite-js/react-native";
|
|
25
23
|
import { useCallback, useEffect, useRef } from "react";
|
|
26
|
-
import { Bedrock, useVisibility } from "react-native-bedrock";
|
|
27
24
|
|
|
28
25
|
// src/core/hooks/useReferrer.ts
|
|
26
|
+
import { getSchemeUri } from "@granite-js/react-native";
|
|
29
27
|
import { useMemo } from "react";
|
|
30
|
-
import { getSchemeUri } from "react-native-bedrock";
|
|
31
28
|
function useReferrer() {
|
|
32
29
|
return useMemo(() => {
|
|
33
30
|
try {
|
|
@@ -38,129 +35,8 @@ function useReferrer() {
|
|
|
38
35
|
}, []);
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
// src/native-modules/tossCore.ts
|
|
42
|
-
import { NativeModules as NativeModules2 } from "react-native";
|
|
43
|
-
|
|
44
|
-
// src/native-modules/AppsInTossModule.ts
|
|
45
|
-
import { NativeModules } from "react-native";
|
|
46
|
-
var AppsInTossModuleInstance = NativeModules.AppsInTossModule;
|
|
47
|
-
var AppsInTossModule = AppsInTossModuleInstance;
|
|
48
|
-
|
|
49
|
-
// src/native-modules/getOperationalEnvironment.ts
|
|
50
|
-
function getOperationalEnvironment() {
|
|
51
|
-
return AppsInTossModule.operationalEnvironment;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/native-modules/isMinVersionSupported.ts
|
|
55
|
-
import { Platform } from "react-native";
|
|
56
|
-
|
|
57
|
-
// src/utils/compareVersion.ts
|
|
58
|
-
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
59
|
-
var isWildcard = (val) => ["*", "x", "X"].includes(val);
|
|
60
|
-
var tryParse = (val) => {
|
|
61
|
-
const num = parseInt(val, 10);
|
|
62
|
-
return isNaN(num) ? val : num;
|
|
63
|
-
};
|
|
64
|
-
var coerceTypes = (a, b) => {
|
|
65
|
-
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
66
|
-
};
|
|
67
|
-
var compareValues = (a, b) => {
|
|
68
|
-
if (isWildcard(a) || isWildcard(b)) {
|
|
69
|
-
return 0;
|
|
70
|
-
}
|
|
71
|
-
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
72
|
-
if (aVal > bVal) {
|
|
73
|
-
return 1;
|
|
74
|
-
}
|
|
75
|
-
if (aVal < bVal) {
|
|
76
|
-
return -1;
|
|
77
|
-
}
|
|
78
|
-
return 0;
|
|
79
|
-
};
|
|
80
|
-
var parseVersion = (version) => {
|
|
81
|
-
if (typeof version !== "string") {
|
|
82
|
-
throw new TypeError("Invalid argument: expected a string");
|
|
83
|
-
}
|
|
84
|
-
const match = version.match(SEMVER_REGEX);
|
|
85
|
-
if (!match) {
|
|
86
|
-
throw new Error(`Invalid semver: '${version}'`);
|
|
87
|
-
}
|
|
88
|
-
const [, major, minor, patch, build, preRelease] = match;
|
|
89
|
-
return [major, minor, patch, build, preRelease];
|
|
90
|
-
};
|
|
91
|
-
var compareSegments = (a, b) => {
|
|
92
|
-
const maxLength = Math.max(a.length, b.length);
|
|
93
|
-
for (let i = 0; i < maxLength; i++) {
|
|
94
|
-
const segA = a[i] ?? "0";
|
|
95
|
-
const segB = b[i] ?? "0";
|
|
96
|
-
const result = compareValues(segA, segB);
|
|
97
|
-
if (result !== 0) {
|
|
98
|
-
return result;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return 0;
|
|
102
|
-
};
|
|
103
|
-
var compareVersions = (v1, v2) => {
|
|
104
|
-
const seg1 = parseVersion(v1);
|
|
105
|
-
const seg2 = parseVersion(v2);
|
|
106
|
-
const preRelease1 = seg1.pop();
|
|
107
|
-
const preRelease2 = seg2.pop();
|
|
108
|
-
const mainCompare = compareSegments(seg1, seg2);
|
|
109
|
-
if (mainCompare !== 0) {
|
|
110
|
-
return mainCompare;
|
|
111
|
-
}
|
|
112
|
-
if (preRelease1 && preRelease2) {
|
|
113
|
-
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
114
|
-
}
|
|
115
|
-
if (preRelease1) {
|
|
116
|
-
return -1;
|
|
117
|
-
}
|
|
118
|
-
if (preRelease2) {
|
|
119
|
-
return 1;
|
|
120
|
-
}
|
|
121
|
-
return 0;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// src/native-modules/isMinVersionSupported.ts
|
|
125
|
-
function isMinVersionSupported(minVersions) {
|
|
126
|
-
const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
|
|
127
|
-
if (operationalEnvironment2 === "sandbox") {
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
131
|
-
const isIOS = Platform.OS === "ios";
|
|
132
|
-
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
133
|
-
if (minVersion === void 0) {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
if (minVersion === "always") {
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
if (minVersion === "never") {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
return compareVersions(currentVersion, minVersion) >= 0;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// src/native-modules/tossCore.ts
|
|
146
|
-
var TossCoreModule = NativeModules2.TossCoreModule;
|
|
147
|
-
function tossCoreEventLog(params) {
|
|
148
|
-
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
149
|
-
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
150
|
-
if (!supported || isSandbox) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
TossCoreModule.eventLog({
|
|
154
|
-
params: {
|
|
155
|
-
log_name: params.log_name,
|
|
156
|
-
log_type: params.log_type,
|
|
157
|
-
params: params.params
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
38
|
// src/utils/isPrivateScheme.ts
|
|
163
|
-
import { getSchemeUri as getSchemeUri2 } from "react-native
|
|
39
|
+
import { getSchemeUri as getSchemeUri2 } from "@granite-js/react-native";
|
|
164
40
|
function isPrivateScheme() {
|
|
165
41
|
try {
|
|
166
42
|
return new URL(getSchemeUri2()).protocol === "intoss-private:";
|
|
@@ -187,7 +63,7 @@ function useCaptureExitLog() {
|
|
|
187
63
|
return;
|
|
188
64
|
}
|
|
189
65
|
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
190
|
-
tossCoreEventLog({
|
|
66
|
+
INTERNAL__module.tossCoreEventLog({
|
|
191
67
|
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
192
68
|
log_type: "event",
|
|
193
69
|
params: {
|
|
@@ -195,7 +71,7 @@ function useCaptureExitLog() {
|
|
|
195
71
|
event_type: "impression",
|
|
196
72
|
referrer,
|
|
197
73
|
deployment_id: env.getDeploymentId(),
|
|
198
|
-
app_name:
|
|
74
|
+
app_name: Granite.appName,
|
|
199
75
|
is_private: isPrivateScheme(),
|
|
200
76
|
stay_time: stayTime.toString(),
|
|
201
77
|
exit_time: exitTime.toString()
|
|
@@ -213,7 +89,7 @@ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
|
213
89
|
function EntryAppEvent() {
|
|
214
90
|
const referrer = useReferrer() ?? "";
|
|
215
91
|
useEffect2(() => {
|
|
216
|
-
tossCoreEventLog({
|
|
92
|
+
INTERNAL__module2.tossCoreEventLog({
|
|
217
93
|
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
218
94
|
log_type: "info",
|
|
219
95
|
params: {
|
|
@@ -221,7 +97,7 @@ function EntryAppEvent() {
|
|
|
221
97
|
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
222
98
|
referrer,
|
|
223
99
|
deployment_id: env.getDeploymentId(),
|
|
224
|
-
app_name:
|
|
100
|
+
app_name: Granite2.appName,
|
|
225
101
|
is_private: isPrivateScheme()
|
|
226
102
|
}
|
|
227
103
|
});
|
|
@@ -230,14 +106,14 @@ function EntryAppEvent() {
|
|
|
230
106
|
}
|
|
231
107
|
function SystemAppEvent({ ...initialProps }) {
|
|
232
108
|
useEffect2(() => {
|
|
233
|
-
tossCoreEventLog({
|
|
109
|
+
INTERNAL__module2.tossCoreEventLog({
|
|
234
110
|
log_name: "AppsInTossInitialProps",
|
|
235
111
|
log_type: "debug",
|
|
236
112
|
params: {
|
|
237
113
|
...initialProps,
|
|
238
114
|
schemeUri: getSchemeUri3(),
|
|
239
115
|
deployment_id: env.getDeploymentId(),
|
|
240
|
-
app_name:
|
|
116
|
+
app_name: Granite2.appName,
|
|
241
117
|
is_private: isPrivateScheme()
|
|
242
118
|
}
|
|
243
119
|
});
|
|
@@ -260,204 +136,22 @@ var AppEvent = {
|
|
|
260
136
|
StayTime: StayTimeAppEvent
|
|
261
137
|
};
|
|
262
138
|
|
|
263
|
-
// src/core/
|
|
264
|
-
import {
|
|
139
|
+
// src/core/components/AppUpdate.tsx
|
|
140
|
+
import { openURL } from "@granite-js/react-native";
|
|
265
141
|
import { useEffect as useEffect3 } from "react";
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
name = "entryMessageExited";
|
|
274
|
-
remove() {
|
|
275
|
-
}
|
|
276
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
277
|
-
listener(_) {
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
282
|
-
import { BedrockEventDefinition as BedrockEventDefinition2 } from "react-native-bedrock";
|
|
283
|
-
|
|
284
|
-
// src/native-modules/getPermission.ts
|
|
285
|
-
function getPermission(permission) {
|
|
286
|
-
return AppsInTossModule.getPermission(permission);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// src/native-modules/openPermissionDialog.ts
|
|
290
|
-
function openPermissionDialog(permission) {
|
|
291
|
-
return AppsInTossModule.openPermissionDialog(permission);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// src/native-modules/requestPermission.ts
|
|
295
|
-
async function requestPermission(permission) {
|
|
296
|
-
const permissionStatus = await getPermission(permission);
|
|
297
|
-
switch (permissionStatus) {
|
|
298
|
-
case "allowed":
|
|
299
|
-
case "denied":
|
|
300
|
-
return permissionStatus;
|
|
301
|
-
default:
|
|
302
|
-
return openPermissionDialog(permission);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// src/native-event-emitter/nativeEventEmitter.ts
|
|
307
|
-
import { NativeEventEmitter } from "react-native";
|
|
308
|
-
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
309
|
-
|
|
310
|
-
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
311
|
-
var UpdateLocationEvent = class extends BedrockEventDefinition2 {
|
|
312
|
-
name = "updateLocationEvent";
|
|
313
|
-
subscriptionCount = 0;
|
|
314
|
-
ref = {
|
|
315
|
-
remove: () => {
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
remove() {
|
|
319
|
-
if (--this.subscriptionCount === 0) {
|
|
320
|
-
AppsInTossModuleInstance.stopUpdateLocation({});
|
|
321
|
-
}
|
|
322
|
-
this.ref.remove();
|
|
323
|
-
}
|
|
324
|
-
listener(options, onEvent, onError) {
|
|
325
|
-
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
326
|
-
if (permissionStatus === "denied") {
|
|
327
|
-
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
331
|
-
const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
|
|
332
|
-
this.ref = {
|
|
333
|
-
remove: () => subscription?.remove()
|
|
334
|
-
};
|
|
335
|
-
this.subscriptionCount++;
|
|
336
|
-
}).catch(onError);
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
341
|
-
import { BedrockEventDefinition as BedrockEventDefinition3 } from "react-native-bedrock";
|
|
342
|
-
|
|
343
|
-
// src/utils/generateUUID.ts
|
|
344
|
-
function generateUUID(placeholder) {
|
|
345
|
-
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// src/native-event-emitter/internal/appBridge.ts
|
|
349
|
-
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
350
|
-
function invokeAppBridgeCallback(id, ...args) {
|
|
351
|
-
const callback = INTERNAL__callbacks.get(id);
|
|
352
|
-
callback?.call(null, ...args);
|
|
353
|
-
return Boolean(callback);
|
|
354
|
-
}
|
|
355
|
-
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
356
|
-
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
357
|
-
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
358
|
-
const promise = AppsInTossModuleInstance[methodName]({
|
|
359
|
-
params,
|
|
360
|
-
callbacks: callbackMap
|
|
361
|
-
});
|
|
362
|
-
void promise.then(onSuccess).catch(onError);
|
|
363
|
-
return unregisterAll;
|
|
364
|
-
}
|
|
365
|
-
function registerCallbacks(callbacks) {
|
|
366
|
-
const callbackMap = {};
|
|
367
|
-
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
368
|
-
const id = registerCallback(callback, callbackName);
|
|
369
|
-
callbackMap[callbackName] = id;
|
|
370
|
-
}
|
|
371
|
-
const unregisterAll = () => {
|
|
372
|
-
Object.values(callbackMap).forEach(unregisterCallback);
|
|
373
|
-
};
|
|
374
|
-
return { callbackMap, unregisterAll };
|
|
375
|
-
}
|
|
376
|
-
function registerCallback(callback, name = "unnamed") {
|
|
377
|
-
const uniqueId = generateUUID();
|
|
378
|
-
const callbackId = `${uniqueId}__${name}`;
|
|
379
|
-
INTERNAL__callbacks.set(callbackId, callback);
|
|
380
|
-
return callbackId;
|
|
381
|
-
}
|
|
382
|
-
function unregisterCallback(id) {
|
|
383
|
-
INTERNAL__callbacks.delete(id);
|
|
384
|
-
}
|
|
385
|
-
function getCallbackIds() {
|
|
386
|
-
return Array.from(INTERNAL__callbacks.keys());
|
|
142
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
143
|
+
var UPDATE_SCHEME = "servicetoss://update/forced/j?updateType=required";
|
|
144
|
+
function AppUpdate() {
|
|
145
|
+
useEffect3(() => {
|
|
146
|
+
openURL(`supertoss://closePage?url=${UPDATE_SCHEME}`);
|
|
147
|
+
}, []);
|
|
148
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
387
149
|
}
|
|
388
|
-
var INTERNAL__appBridgeHandler = {
|
|
389
|
-
invokeAppBridgeCallback,
|
|
390
|
-
invokeAppBridgeMethod,
|
|
391
|
-
registerCallback,
|
|
392
|
-
unregisterCallback,
|
|
393
|
-
getCallbackIds
|
|
394
|
-
};
|
|
395
150
|
|
|
396
|
-
// src/
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
name = "appBridgeCallbackEvent";
|
|
401
|
-
constructor() {
|
|
402
|
-
super();
|
|
403
|
-
this.registerAppBridgeCallbackEventListener();
|
|
404
|
-
}
|
|
405
|
-
remove() {
|
|
406
|
-
}
|
|
407
|
-
listener() {
|
|
408
|
-
}
|
|
409
|
-
registerAppBridgeCallbackEventListener() {
|
|
410
|
-
if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
|
|
414
|
-
"appBridgeCallback",
|
|
415
|
-
this.ensureInvokeAppBridgeCallback
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
ensureInvokeAppBridgeCallback(result) {
|
|
419
|
-
if (typeof result === "object" && typeof result.name === "string") {
|
|
420
|
-
INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
|
|
421
|
-
} else {
|
|
422
|
-
console.warn("Invalid app bridge callback result:", result);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
// src/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
428
|
-
import { BedrockEventDefinition as BedrockEventDefinition4 } from "react-native-bedrock";
|
|
429
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends BedrockEventDefinition4 {
|
|
430
|
-
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
431
|
-
subscription = null;
|
|
432
|
-
remove() {
|
|
433
|
-
this.subscription?.remove();
|
|
434
|
-
this.subscription = null;
|
|
435
|
-
}
|
|
436
|
-
listener(options, onEvent, onError) {
|
|
437
|
-
const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
|
|
438
|
-
if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
|
|
439
|
-
if (params.callbackId === options.callbackId) {
|
|
440
|
-
onEvent(params.isVisible);
|
|
441
|
-
}
|
|
442
|
-
} else {
|
|
443
|
-
onError(new Error("Invalid visibility changed by transparent service web result"));
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
this.subscription = subscription;
|
|
447
|
-
}
|
|
448
|
-
isVisibilityChangedByTransparentServiceWebResult(params) {
|
|
449
|
-
return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
// src/native-event-emitter/appsInTossEvent.ts
|
|
454
|
-
var appsInTossEvent = new BedrockEvent([
|
|
455
|
-
new UpdateLocationEvent(),
|
|
456
|
-
new EntryMessageExitedEvent(),
|
|
457
|
-
// Internal events
|
|
458
|
-
new AppBridgeCallbackEvent(),
|
|
459
|
-
new VisibilityChangedByTransparentServiceWebEvent()
|
|
460
|
-
]);
|
|
151
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
152
|
+
import { appsInTossEvent } from "@apps-in-toss/native-modules";
|
|
153
|
+
import { useBridge } from "@toss-design-system/react-native";
|
|
154
|
+
import { useEffect as useEffect4 } from "react";
|
|
461
155
|
|
|
462
156
|
// src/core/utils/getAppsInTossGlobals.ts
|
|
463
157
|
function getAppsInTossGlobals() {
|
|
@@ -476,7 +170,7 @@ function toIcon(source) {
|
|
|
476
170
|
function useAppsInTossBridge() {
|
|
477
171
|
const controller = useBridge();
|
|
478
172
|
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
479
|
-
|
|
173
|
+
useEffect4(() => {
|
|
480
174
|
const commonProps = {
|
|
481
175
|
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
482
176
|
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
@@ -492,234 +186,39 @@ function useAppsInTossBridge() {
|
|
|
492
186
|
}, []);
|
|
493
187
|
}
|
|
494
188
|
|
|
495
|
-
// src/async-bridges.ts
|
|
496
|
-
var async_bridges_exports = {};
|
|
497
|
-
__export(async_bridges_exports, {
|
|
498
|
-
appLogin: () => appLogin,
|
|
499
|
-
checkoutPayment: () => checkoutPayment,
|
|
500
|
-
eventLog: () => eventLog,
|
|
501
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
502
|
-
fetchContacts: () => fetchContacts,
|
|
503
|
-
getClipboardText: () => getClipboardText,
|
|
504
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
505
|
-
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
506
|
-
getTossShareLink: () => getTossShareLink,
|
|
507
|
-
openCamera: () => openCamera,
|
|
508
|
-
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
509
|
-
saveBase64Data: () => saveBase64Data,
|
|
510
|
-
setClipboardText: () => setClipboardText,
|
|
511
|
-
setDeviceOrientation: () => setDeviceOrientation,
|
|
512
|
-
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
// src/native-modules/setClipboardText.ts
|
|
516
|
-
async function setClipboardText(text) {
|
|
517
|
-
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
518
|
-
if (permissionStatus === "denied") {
|
|
519
|
-
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
520
|
-
}
|
|
521
|
-
return AppsInTossModule.setClipboardText({ text });
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
// src/native-modules/getClipboardText.ts
|
|
525
|
-
async function getClipboardText() {
|
|
526
|
-
const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
|
|
527
|
-
if (permissionStatus === "denied") {
|
|
528
|
-
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
529
|
-
}
|
|
530
|
-
return AppsInTossModule.getClipboardText({});
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
// src/native-modules/fetchContacts.ts
|
|
534
|
-
async function fetchContacts({
|
|
535
|
-
size,
|
|
536
|
-
offset,
|
|
537
|
-
query
|
|
538
|
-
}) {
|
|
539
|
-
const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
|
|
540
|
-
if (permissionStatus === "denied") {
|
|
541
|
-
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
542
|
-
}
|
|
543
|
-
const contacts = await AppsInTossModule.fetchContacts({
|
|
544
|
-
size,
|
|
545
|
-
offset,
|
|
546
|
-
query
|
|
547
|
-
});
|
|
548
|
-
return {
|
|
549
|
-
result: contacts.result,
|
|
550
|
-
nextOffset: contacts.nextOffset ?? null,
|
|
551
|
-
done: contacts.done
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
// src/native-modules/fetchAlbumPhotos.ts
|
|
556
|
-
var DEFAULT_MAX_COUNT = 10;
|
|
557
|
-
var DEFAULT_MAX_WIDTH = 1024;
|
|
558
|
-
async function fetchAlbumPhotos(options) {
|
|
559
|
-
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
560
|
-
if (permissionStatus === "denied") {
|
|
561
|
-
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
562
|
-
}
|
|
563
|
-
const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
|
|
564
|
-
...options,
|
|
565
|
-
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
566
|
-
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
567
|
-
});
|
|
568
|
-
return albumPhotos;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// src/native-modules/getCurrentLocation.ts
|
|
572
|
-
async function getCurrentLocation(options) {
|
|
573
|
-
const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
|
|
574
|
-
if (permissionStatus === "denied") {
|
|
575
|
-
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
576
|
-
}
|
|
577
|
-
const position = await AppsInTossModule.getCurrentLocation(options);
|
|
578
|
-
return position;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
// src/native-modules/openCamera.ts
|
|
582
|
-
async function openCamera(options) {
|
|
583
|
-
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
584
|
-
if (permissionStatus === "denied") {
|
|
585
|
-
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
586
|
-
}
|
|
587
|
-
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
588
|
-
return photo;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// src/native-modules/appLogin.ts
|
|
592
|
-
async function appLogin() {
|
|
593
|
-
return AppsInTossModule.appLogin({});
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// src/native-modules/checkoutPayment.ts
|
|
597
|
-
async function checkoutPayment(options) {
|
|
598
|
-
return AppsInTossModule.checkoutPayment({ params: options });
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
// src/native-modules/eventLog.ts
|
|
602
|
-
function normalizeParams(params) {
|
|
603
|
-
return Object.fromEntries(
|
|
604
|
-
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
async function eventLog(params) {
|
|
608
|
-
if (AppsInTossModule.operationalEnvironment === "sandbox") {
|
|
609
|
-
console.log("[eventLogDebug]", {
|
|
610
|
-
log_name: params.log_name,
|
|
611
|
-
log_type: params.log_type,
|
|
612
|
-
params: normalizeParams(params.params)
|
|
613
|
-
});
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
const isSupported = isMinVersionSupported({
|
|
617
|
-
android: "5.208.0",
|
|
618
|
-
ios: "5.208.0"
|
|
619
|
-
});
|
|
620
|
-
if (!isSupported) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
return AppsInTossModule.eventLog({
|
|
624
|
-
log_name: params.log_name,
|
|
625
|
-
log_type: params.log_type,
|
|
626
|
-
params: normalizeParams(params.params)
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
// src/native-modules/getTossShareLink.ts
|
|
631
|
-
async function getTossShareLink(path) {
|
|
632
|
-
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
633
|
-
const shareUrl = new URL(shareLink);
|
|
634
|
-
shareUrl.searchParams.set("deep_link_value", path);
|
|
635
|
-
shareUrl.searchParams.set("af_dp", path);
|
|
636
|
-
return shareUrl.toString();
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
// src/native-modules/setDeviceOrientation.ts
|
|
640
|
-
async function setDeviceOrientation(options) {
|
|
641
|
-
const isSupported = isMinVersionSupported({
|
|
642
|
-
android: "5.215.0",
|
|
643
|
-
ios: "5.215.0"
|
|
644
|
-
});
|
|
645
|
-
if (!isSupported) {
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
return AppsInTossModule.setDeviceOrientation(options);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
// src/native-modules/saveBase64Data.ts
|
|
652
|
-
async function saveBase64Data(params) {
|
|
653
|
-
const isSupported = isMinVersionSupported({
|
|
654
|
-
android: "5.218.0",
|
|
655
|
-
ios: "5.216.0"
|
|
656
|
-
});
|
|
657
|
-
if (!isSupported) {
|
|
658
|
-
console.warn("saveBase64Data is not supported in this app version");
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
await AppsInTossModule.saveBase64Data(params);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
// src/constant/game-center.ts
|
|
665
|
-
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
666
|
-
var GAME_CENTER_MIN_VERSION = {
|
|
667
|
-
android: "5.221.0",
|
|
668
|
-
ios: "5.221.0"
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
// src/native-modules/getGameCenterGameProfile.ts
|
|
672
|
-
async function getGameCenterGameProfile() {
|
|
673
|
-
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
674
|
-
if (!isSupported) {
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
return AppsInTossModule.getGameCenterGameProfile({});
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
// src/native-modules/openGameCenterLeaderboard.ts
|
|
681
|
-
import { openURL } from "react-native-bedrock";
|
|
682
|
-
async function openGameCenterLeaderboard() {
|
|
683
|
-
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
687
|
-
url.searchParams.set("appName", getAppName());
|
|
688
|
-
url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
|
|
689
|
-
return openURL(url.toString());
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
// src/native-modules/submitGameCenterLeaderBoardScore.ts
|
|
693
|
-
async function submitGameCenterLeaderBoardScore(params) {
|
|
694
|
-
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
695
|
-
if (!isSupported) {
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
189
|
// src/core/registerApp.tsx
|
|
702
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
190
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
703
191
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
192
|
+
if (!isMinVersionSupported({
|
|
193
|
+
android: "5.220.0",
|
|
194
|
+
ios: "5.221.0"
|
|
195
|
+
})) {
|
|
196
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
197
|
+
/* @__PURE__ */ jsx2(AppEvent.Entry, {}),
|
|
198
|
+
/* @__PURE__ */ jsx2(AppEvent.System, { ...initialProps }),
|
|
199
|
+
/* @__PURE__ */ jsx2(AppUpdate, {})
|
|
200
|
+
] });
|
|
201
|
+
}
|
|
202
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
203
|
+
/* @__PURE__ */ jsx2(AppEvent.StayTime, {}),
|
|
204
|
+
/* @__PURE__ */ jsx2(AppEvent.Entry, {}),
|
|
205
|
+
/* @__PURE__ */ jsx2(AppEvent.System, { ...initialProps }),
|
|
206
|
+
/* @__PURE__ */ jsx2(Container, { ...initialProps, children: /* @__PURE__ */ jsx2(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx2(TDSContainer, { ...initialProps, children }) }) })
|
|
709
207
|
] });
|
|
710
208
|
}
|
|
711
209
|
function TDSContainer({ children }) {
|
|
712
210
|
useAppsInTossBridge();
|
|
713
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children });
|
|
714
212
|
}
|
|
715
213
|
function registerApp(container, { context, analytics }) {
|
|
716
214
|
Analytics.init({
|
|
717
215
|
logger: (params) => void eventLog(params),
|
|
718
216
|
debug: analytics?.debug ?? __DEV__
|
|
719
217
|
});
|
|
720
|
-
|
|
218
|
+
const App = Granite3.registerApp(AppsInTossContainer.bind(null, container), {
|
|
721
219
|
appName: getAppName(),
|
|
722
220
|
context,
|
|
221
|
+
setIosSwipeGestureEnabled,
|
|
723
222
|
router: {
|
|
724
223
|
screenContainer: Analytics.Screen,
|
|
725
224
|
defaultScreenOption: {
|
|
@@ -727,10 +226,12 @@ function registerApp(container, { context, analytics }) {
|
|
|
727
226
|
}
|
|
728
227
|
}
|
|
729
228
|
});
|
|
229
|
+
global.Page = App;
|
|
230
|
+
return App;
|
|
730
231
|
}
|
|
731
232
|
function getAppName() {
|
|
732
233
|
try {
|
|
733
|
-
return global.
|
|
234
|
+
return global.__granite.app.name;
|
|
734
235
|
} catch (error) {
|
|
735
236
|
console.error("unexpected error occurred while getting app name");
|
|
736
237
|
throw error;
|
|
@@ -742,211 +243,14 @@ var AppsInToss = {
|
|
|
742
243
|
registerApp
|
|
743
244
|
};
|
|
744
245
|
|
|
745
|
-
// src/native-event-emitter/startUpdateLocation.ts
|
|
746
|
-
function startUpdateLocation(eventParams) {
|
|
747
|
-
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
// ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
751
|
-
function noop() {
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
// src/native-modules/ads/googleAdMob.ts
|
|
755
|
-
function loadAdMobInterstitialAd(params) {
|
|
756
|
-
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
757
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
758
|
-
return noop;
|
|
759
|
-
}
|
|
760
|
-
const { onEvent, onError, options } = params;
|
|
761
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
762
|
-
onAdClicked: () => {
|
|
763
|
-
onEvent({ type: "clicked" });
|
|
764
|
-
},
|
|
765
|
-
onAdDismissed: () => {
|
|
766
|
-
onEvent({ type: "dismissed" });
|
|
767
|
-
},
|
|
768
|
-
onAdFailedToShow: () => {
|
|
769
|
-
onEvent({ type: "failedToShow" });
|
|
770
|
-
},
|
|
771
|
-
onAdImpression: () => {
|
|
772
|
-
onEvent({ type: "impression" });
|
|
773
|
-
},
|
|
774
|
-
onAdShow: () => {
|
|
775
|
-
onEvent({ type: "show" });
|
|
776
|
-
},
|
|
777
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
778
|
-
onError
|
|
779
|
-
});
|
|
780
|
-
return unregisterCallbacks;
|
|
781
|
-
}
|
|
782
|
-
function showAdMobInterstitialAd(params) {
|
|
783
|
-
if (!showAdMobInterstitialAd.isSupported()) {
|
|
784
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
785
|
-
return noop;
|
|
786
|
-
}
|
|
787
|
-
const { onEvent, onError, options } = params;
|
|
788
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
789
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
790
|
-
onError
|
|
791
|
-
});
|
|
792
|
-
return unregisterCallbacks;
|
|
793
|
-
}
|
|
794
|
-
function loadAdMobRewardedAd(params) {
|
|
795
|
-
if (!loadAdMobRewardedAd.isSupported()) {
|
|
796
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
797
|
-
return noop;
|
|
798
|
-
}
|
|
799
|
-
const { onEvent, onError, options } = params;
|
|
800
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
801
|
-
onAdClicked: () => {
|
|
802
|
-
onEvent({ type: "clicked" });
|
|
803
|
-
},
|
|
804
|
-
onAdDismissed: () => {
|
|
805
|
-
onEvent({ type: "dismissed" });
|
|
806
|
-
},
|
|
807
|
-
onAdFailedToShow: () => {
|
|
808
|
-
onEvent({ type: "failedToShow" });
|
|
809
|
-
},
|
|
810
|
-
onAdImpression: () => {
|
|
811
|
-
onEvent({ type: "impression" });
|
|
812
|
-
},
|
|
813
|
-
onAdShow: () => {
|
|
814
|
-
onEvent({ type: "show" });
|
|
815
|
-
},
|
|
816
|
-
onUserEarnedReward: () => {
|
|
817
|
-
onEvent({ type: "userEarnedReward" });
|
|
818
|
-
},
|
|
819
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
820
|
-
onError
|
|
821
|
-
});
|
|
822
|
-
return unregisterCallbacks;
|
|
823
|
-
}
|
|
824
|
-
function showAdMobRewardedAd(params) {
|
|
825
|
-
if (!showAdMobRewardedAd.isSupported()) {
|
|
826
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
827
|
-
return noop;
|
|
828
|
-
}
|
|
829
|
-
const { onEvent, onError, options } = params;
|
|
830
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
831
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
832
|
-
onError
|
|
833
|
-
});
|
|
834
|
-
return unregisterCallbacks;
|
|
835
|
-
}
|
|
836
|
-
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
837
|
-
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
838
|
-
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
839
|
-
var ENVIRONMENT = getOperationalEnvironment();
|
|
840
|
-
function createIsSupported() {
|
|
841
|
-
return () => {
|
|
842
|
-
if (ENVIRONMENT !== "toss") {
|
|
843
|
-
return false;
|
|
844
|
-
}
|
|
845
|
-
return isMinVersionSupported({
|
|
846
|
-
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
847
|
-
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
848
|
-
});
|
|
849
|
-
};
|
|
850
|
-
}
|
|
851
|
-
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
852
|
-
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
853
|
-
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
854
|
-
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
855
|
-
|
|
856
|
-
// src/native-modules/getDeviceId.ts
|
|
857
|
-
function getDeviceId() {
|
|
858
|
-
return AppsInTossModule.deviceId;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
// src/native-modules/getTossAppVersion.ts
|
|
862
|
-
function getTossAppVersion() {
|
|
863
|
-
return AppsInTossModule.tossAppVersion;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
// src/native-modules/iap.ts
|
|
867
|
-
async function createOneTimePurchaseOrder(params) {
|
|
868
|
-
const isSupported = isMinVersionSupported({
|
|
869
|
-
android: "5.219.0",
|
|
870
|
-
ios: "5.219.0"
|
|
871
|
-
});
|
|
872
|
-
if (!isSupported) {
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
|
|
876
|
-
}
|
|
877
|
-
async function getProductItemList() {
|
|
878
|
-
const isSupported = isMinVersionSupported({
|
|
879
|
-
android: "5.219.0",
|
|
880
|
-
ios: "5.219.0"
|
|
881
|
-
});
|
|
882
|
-
if (!isSupported) {
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
return AppsInTossModule.iapGetProductItemList({});
|
|
886
|
-
}
|
|
887
|
-
var IAP = {
|
|
888
|
-
createOneTimePurchaseOrder,
|
|
889
|
-
getProductItemList
|
|
890
|
-
};
|
|
891
|
-
|
|
892
|
-
// src/native-modules/storage.ts
|
|
893
|
-
function getItem(key) {
|
|
894
|
-
return AppsInTossModule.getStorageItem({ key });
|
|
895
|
-
}
|
|
896
|
-
function setItem(key, value) {
|
|
897
|
-
return AppsInTossModule.setStorageItem({
|
|
898
|
-
key,
|
|
899
|
-
value
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
function removeItem(key) {
|
|
903
|
-
return AppsInTossModule.removeStorageItem({ key });
|
|
904
|
-
}
|
|
905
|
-
function clearItems() {
|
|
906
|
-
return AppsInTossModule.clearStorage({});
|
|
907
|
-
}
|
|
908
|
-
var Storage = {
|
|
909
|
-
getItem,
|
|
910
|
-
setItem,
|
|
911
|
-
removeItem,
|
|
912
|
-
clearItems
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
// src/native-modules/contactsViral.ts
|
|
916
|
-
function contactsViral(params) {
|
|
917
|
-
const isSupported = isMinVersionSupported({
|
|
918
|
-
android: "5.223.0",
|
|
919
|
-
ios: "5.223.0"
|
|
920
|
-
});
|
|
921
|
-
if (!isSupported) {
|
|
922
|
-
return () => {
|
|
923
|
-
};
|
|
924
|
-
}
|
|
925
|
-
const { onEvent, onError, options } = params;
|
|
926
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
|
|
927
|
-
onRewardFromContactsViral: (result) => {
|
|
928
|
-
onEvent({ type: "sendViral", data: result });
|
|
929
|
-
},
|
|
930
|
-
onSuccess: (result) => {
|
|
931
|
-
onEvent({ type: "close", data: result });
|
|
932
|
-
},
|
|
933
|
-
onError
|
|
934
|
-
});
|
|
935
|
-
return unregisterCallbacks;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
// src/native-modules/index.ts
|
|
939
|
-
var TossPay = {
|
|
940
|
-
checkoutPayment
|
|
941
|
-
};
|
|
942
|
-
var GoogleAdMob = {
|
|
943
|
-
loadAdMobInterstitialAd,
|
|
944
|
-
showAdMobInterstitialAd,
|
|
945
|
-
loadAdMobRewardedAd,
|
|
946
|
-
showAdMobRewardedAd
|
|
947
|
-
};
|
|
948
|
-
|
|
949
246
|
// src/components/WebView.tsx
|
|
247
|
+
import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInTossEvent3 } from "@apps-in-toss/native-modules";
|
|
248
|
+
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
249
|
+
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
250
|
+
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
251
|
+
import { getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/react-native";
|
|
252
|
+
import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
|
|
253
|
+
import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
|
|
950
254
|
import {
|
|
951
255
|
ExternalWebViewScreen,
|
|
952
256
|
PartnerWebViewScreen,
|
|
@@ -954,43 +258,50 @@ import {
|
|
|
954
258
|
usePartnerNavigation
|
|
955
259
|
} from "@toss-design-system/react-native";
|
|
956
260
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
957
|
-
import { useCallback as useCallback5, useEffect as
|
|
958
|
-
import { BackHandler as BackHandler2, Platform as
|
|
959
|
-
import { getSchemeUri as getSchemeUri5, useBedrockEvent } from "react-native-bedrock";
|
|
960
|
-
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
961
|
-
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
261
|
+
import { useCallback as useCallback5, useEffect as useEffect8, useMemo as useMemo3, useState as useState4 } from "react";
|
|
262
|
+
import { BackHandler as BackHandler2, Platform as Platform6 } from "react-native";
|
|
962
263
|
|
|
963
264
|
// src/components/GameWebView.tsx
|
|
265
|
+
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent2, getOperationalEnvironment } from "@apps-in-toss/native-modules";
|
|
964
266
|
import {
|
|
965
267
|
WebView as PlainWebView
|
|
966
|
-
} from "@
|
|
268
|
+
} from "@granite-js/native/react-native-webview";
|
|
269
|
+
import { closeView as closeView2 } from "@granite-js/react-native";
|
|
967
270
|
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
968
271
|
import { josa as josa2 } from "es-hangul";
|
|
969
|
-
import { forwardRef, useCallback as useCallback3, useEffect as
|
|
970
|
-
import { BackHandler, Platform as
|
|
971
|
-
import { closeView as closeView2, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
272
|
+
import { forwardRef, useCallback as useCallback3, useEffect as useEffect6, useState as useState2 } from "react";
|
|
273
|
+
import { BackHandler, Platform as Platform5 } from "react-native";
|
|
972
274
|
|
|
973
275
|
// src/components/GameProfile.tsx
|
|
276
|
+
import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported as isMinVersionSupported2 } from "@apps-in-toss/native-modules";
|
|
974
277
|
import { Loader } from "@toss-design-system/react-native";
|
|
975
|
-
import { useEffect as
|
|
278
|
+
import { useEffect as useEffect5 } from "react";
|
|
976
279
|
import { Pressable, View } from "react-native";
|
|
977
280
|
|
|
281
|
+
// src/constant/game-center.ts
|
|
282
|
+
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
283
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
284
|
+
android: "5.221.0",
|
|
285
|
+
ios: "5.221.0"
|
|
286
|
+
};
|
|
287
|
+
|
|
978
288
|
// src/hooks/useGameCenterProfile.ts
|
|
289
|
+
import { getGameCenterGameProfile } from "@apps-in-toss/native-modules";
|
|
290
|
+
import { closeView, openURL as openURL3 } from "@granite-js/react-native";
|
|
979
291
|
import { useDialog } from "@toss-design-system/react-native";
|
|
980
292
|
import { josa } from "es-hangul";
|
|
981
293
|
import { useCallback as useCallback2, useRef as useRef2, useState } from "react";
|
|
982
|
-
import { closeView, openURL as openURL3 } from "react-native-bedrock";
|
|
983
294
|
|
|
984
295
|
// src/components/GameProfileToast.tsx
|
|
985
296
|
import { Asset, Toast } from "@toss-design-system/react-native";
|
|
986
297
|
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay } from "@toss-design-system/react-native/private";
|
|
987
|
-
import { jsx as
|
|
298
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
988
299
|
var useGameProfileToast = () => {
|
|
989
300
|
const overlay = useOverlay();
|
|
990
301
|
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
991
302
|
return new Promise((resolve) => {
|
|
992
303
|
overlay.open(({ isOpen, close, exit }) => {
|
|
993
|
-
return /* @__PURE__ */
|
|
304
|
+
return /* @__PURE__ */ jsx3(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx3(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx3(
|
|
994
305
|
Toast,
|
|
995
306
|
{
|
|
996
307
|
open: isOpen,
|
|
@@ -1001,7 +312,7 @@ var useGameProfileToast = () => {
|
|
|
1001
312
|
onExited: exit,
|
|
1002
313
|
position: "top",
|
|
1003
314
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
1004
|
-
icon: /* @__PURE__ */
|
|
315
|
+
icon: /* @__PURE__ */ jsx3(
|
|
1005
316
|
Asset.Image,
|
|
1006
317
|
{
|
|
1007
318
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
@@ -1024,22 +335,18 @@ var DEFAULT_ERROR = {
|
|
|
1024
335
|
};
|
|
1025
336
|
|
|
1026
337
|
// src/utils/market.ts
|
|
1027
|
-
import { Platform
|
|
338
|
+
import { Platform } from "react-native";
|
|
1028
339
|
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
1029
340
|
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
1030
341
|
var getMarketLink = () => {
|
|
1031
|
-
return
|
|
342
|
+
return Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
1032
343
|
};
|
|
1033
344
|
|
|
1034
345
|
// src/utils/openTransparentWebView.ts
|
|
1035
|
-
import { openURL as openURL2 } from "react-native
|
|
1036
|
-
|
|
1037
|
-
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1038
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1039
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1040
|
-
}
|
|
346
|
+
import { openURL as openURL2 } from "@granite-js/react-native";
|
|
1041
347
|
|
|
1042
348
|
// src/private.ts
|
|
349
|
+
import { onVisibilityChangedByTransparentServiceWeb } from "@apps-in-toss/native-modules";
|
|
1043
350
|
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1044
351
|
|
|
1045
352
|
// src/utils/openTransparentWebView.ts
|
|
@@ -1168,7 +475,7 @@ var Z_INDEX = {
|
|
|
1168
475
|
};
|
|
1169
476
|
|
|
1170
477
|
// src/components/GameProfile.tsx
|
|
1171
|
-
import { Fragment as
|
|
478
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1172
479
|
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1173
480
|
const {
|
|
1174
481
|
profileData,
|
|
@@ -1184,10 +491,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1184
491
|
openErrorAlert,
|
|
1185
492
|
openGameProfileToast
|
|
1186
493
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1187
|
-
|
|
494
|
+
useEffect5(() => {
|
|
1188
495
|
try {
|
|
1189
496
|
const getProfileData = async () => {
|
|
1190
|
-
const data = await
|
|
497
|
+
const data = await getGameCenterGameProfile2();
|
|
1191
498
|
setProfileData(data);
|
|
1192
499
|
setIsProfileDataLoading(false);
|
|
1193
500
|
};
|
|
@@ -1197,7 +504,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1197
504
|
setIsProfileDataLoading(false);
|
|
1198
505
|
}
|
|
1199
506
|
}, []);
|
|
1200
|
-
|
|
507
|
+
useEffect5(() => {
|
|
1201
508
|
const handleGameProfileFlow = async () => {
|
|
1202
509
|
if (!canShowBottomSheetOrToast) {
|
|
1203
510
|
return;
|
|
@@ -1206,7 +513,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1206
513
|
return;
|
|
1207
514
|
}
|
|
1208
515
|
isCompletedProfileFlow.current = true;
|
|
1209
|
-
if (!
|
|
516
|
+
if (!isMinVersionSupported2(GAME_CENTER_MIN_VERSION)) {
|
|
1210
517
|
updateAppToSupportedMinVersion();
|
|
1211
518
|
return;
|
|
1212
519
|
}
|
|
@@ -1227,10 +534,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1227
534
|
profileData,
|
|
1228
535
|
updateAppToSupportedMinVersion
|
|
1229
536
|
]);
|
|
1230
|
-
if (!
|
|
1231
|
-
return /* @__PURE__ */ jsxs2(
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
537
|
+
if (!isMinVersionSupported2(GAME_CENTER_MIN_VERSION)) {
|
|
538
|
+
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
539
|
+
/* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }),
|
|
540
|
+
/* @__PURE__ */ jsx4(
|
|
1234
541
|
Pressable,
|
|
1235
542
|
{
|
|
1236
543
|
style: {
|
|
@@ -1244,9 +551,9 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1244
551
|
] });
|
|
1245
552
|
}
|
|
1246
553
|
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1247
|
-
return /* @__PURE__ */ jsxs2(
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
554
|
+
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
555
|
+
/* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }),
|
|
556
|
+
/* @__PURE__ */ jsx4(
|
|
1250
557
|
View,
|
|
1251
558
|
{
|
|
1252
559
|
style: {
|
|
@@ -1255,15 +562,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1255
562
|
alignItems: "center",
|
|
1256
563
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1257
564
|
},
|
|
1258
|
-
children: /* @__PURE__ */
|
|
565
|
+
children: /* @__PURE__ */ jsx4(Loader, { size: "large", type: "light" })
|
|
1259
566
|
}
|
|
1260
567
|
)
|
|
1261
568
|
] });
|
|
1262
569
|
}
|
|
1263
570
|
if (shouldShowProfileNotFoundOverlay) {
|
|
1264
|
-
return /* @__PURE__ */ jsxs2(
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
shouldShowProfileNotFoundOverlay && /* @__PURE__ */
|
|
571
|
+
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
572
|
+
/* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }),
|
|
573
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx4(
|
|
1267
574
|
Pressable,
|
|
1268
575
|
{
|
|
1269
576
|
style: {
|
|
@@ -1276,7 +583,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1276
583
|
)
|
|
1277
584
|
] });
|
|
1278
585
|
}
|
|
1279
|
-
return /* @__PURE__ */
|
|
586
|
+
return /* @__PURE__ */ jsx4(Fragment3, { children: /* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1280
587
|
};
|
|
1281
588
|
var overlayStyle = {
|
|
1282
589
|
position: "absolute",
|
|
@@ -1288,19 +595,19 @@ var overlayStyle = {
|
|
|
1288
595
|
};
|
|
1289
596
|
|
|
1290
597
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1291
|
-
import { SvgXml } from "@
|
|
598
|
+
import { SvgXml } from "@granite-js/native/react-native-svg";
|
|
1292
599
|
import { PageNavbar } from "@toss-design-system/react-native";
|
|
1293
|
-
import { Platform as
|
|
600
|
+
import { Platform as Platform4, TouchableOpacity, View as View3 } from "react-native";
|
|
1294
601
|
|
|
1295
602
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1296
603
|
import { StyleSheet, View as View2 } from "react-native";
|
|
1297
604
|
|
|
1298
605
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
1299
|
-
import { Platform as
|
|
606
|
+
import { Platform as Platform2 } from "react-native";
|
|
1300
607
|
function byPlatform({
|
|
1301
608
|
...props
|
|
1302
609
|
}) {
|
|
1303
|
-
return (props[
|
|
610
|
+
return (props[Platform2.OS] ?? props.fallback)();
|
|
1304
611
|
}
|
|
1305
612
|
|
|
1306
613
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -1308,18 +615,18 @@ var RIGHT_MARGIN = 24;
|
|
|
1308
615
|
var IOS_DEFAULT_MARGIN = 20;
|
|
1309
616
|
|
|
1310
617
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1311
|
-
import { jsx as
|
|
618
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1312
619
|
function IOSHeaderRight(props) {
|
|
1313
|
-
return /* @__PURE__ */
|
|
620
|
+
return /* @__PURE__ */ jsx5(View2, { style: styles.ios, ...props });
|
|
1314
621
|
}
|
|
1315
622
|
function AndroidHeaderRight(props) {
|
|
1316
|
-
return /* @__PURE__ */
|
|
623
|
+
return /* @__PURE__ */ jsx5(View2, { style: styles.android, ...props });
|
|
1317
624
|
}
|
|
1318
625
|
function HeaderRight(props) {
|
|
1319
626
|
return byPlatform({
|
|
1320
|
-
ios: () => /* @__PURE__ */
|
|
1321
|
-
android: () => /* @__PURE__ */
|
|
1322
|
-
fallback: () => /* @__PURE__ */
|
|
627
|
+
ios: () => /* @__PURE__ */ jsx5(IOSHeaderRight, { ...props }),
|
|
628
|
+
android: () => /* @__PURE__ */ jsx5(AndroidHeaderRight, { ...props }),
|
|
629
|
+
fallback: () => /* @__PURE__ */ jsx5(IOSHeaderRight, { ...props })
|
|
1323
630
|
});
|
|
1324
631
|
}
|
|
1325
632
|
var styles = StyleSheet.create({
|
|
@@ -1333,38 +640,38 @@ var styles = StyleSheet.create({
|
|
|
1333
640
|
});
|
|
1334
641
|
|
|
1335
642
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
1336
|
-
import { useSafeAreaInsets } from "@
|
|
1337
|
-
import { Platform as
|
|
643
|
+
import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-context";
|
|
644
|
+
import { Platform as Platform3 } from "react-native";
|
|
1338
645
|
function useSafeAreaTop() {
|
|
1339
646
|
const safeAreaInsets = useSafeAreaInsets();
|
|
1340
|
-
const hasDynamicIsland =
|
|
647
|
+
const hasDynamicIsland = Platform3.OS === "ios" && safeAreaInsets.top > 50;
|
|
1341
648
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
1342
649
|
return safeAreaTop;
|
|
1343
650
|
}
|
|
1344
651
|
|
|
1345
652
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1346
|
-
import { Fragment as
|
|
653
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1347
654
|
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>';
|
|
1348
655
|
function GameNavigationBar({ onClose }) {
|
|
1349
656
|
const safeAreaTop = useSafeAreaTop();
|
|
1350
|
-
return /* @__PURE__ */ jsxs3(
|
|
1351
|
-
/* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
658
|
+
/* @__PURE__ */ jsx6(PageNavbar, { preference: { type: "none" } }),
|
|
659
|
+
/* @__PURE__ */ jsx6(
|
|
1353
660
|
View3,
|
|
1354
661
|
{
|
|
1355
662
|
style: {
|
|
1356
663
|
width: "100%",
|
|
1357
|
-
height:
|
|
664
|
+
height: Platform4.OS === "ios" ? 44 : 54,
|
|
1358
665
|
flexDirection: "row",
|
|
1359
666
|
alignItems: "center",
|
|
1360
667
|
justifyContent: "flex-end",
|
|
1361
668
|
position: "absolute",
|
|
1362
669
|
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1363
670
|
marginTop: safeAreaTop,
|
|
1364
|
-
paddingRight:
|
|
671
|
+
paddingRight: Platform4.OS === "ios" ? 10 : 8
|
|
1365
672
|
},
|
|
1366
673
|
pointerEvents: "box-none",
|
|
1367
|
-
children: /* @__PURE__ */
|
|
674
|
+
children: /* @__PURE__ */ jsx6(HeaderRight, { children: /* @__PURE__ */ jsx6(
|
|
1368
675
|
TouchableOpacity,
|
|
1369
676
|
{
|
|
1370
677
|
hitSlop: { left: 8, right: 8 },
|
|
@@ -1372,10 +679,10 @@ function GameNavigationBar({ onClose }) {
|
|
|
1372
679
|
accessible: true,
|
|
1373
680
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
1374
681
|
style: {
|
|
1375
|
-
padding:
|
|
682
|
+
padding: Platform4.OS === "ios" ? 7 : 9
|
|
1376
683
|
},
|
|
1377
684
|
onPress: onClose,
|
|
1378
|
-
children: /* @__PURE__ */
|
|
685
|
+
children: /* @__PURE__ */ jsx6(SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
1379
686
|
}
|
|
1380
687
|
) })
|
|
1381
688
|
}
|
|
@@ -1384,7 +691,7 @@ function GameNavigationBar({ onClose }) {
|
|
|
1384
691
|
}
|
|
1385
692
|
|
|
1386
693
|
// src/components/GameWebView.tsx
|
|
1387
|
-
import { Fragment as
|
|
694
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1388
695
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1389
696
|
const { openConfirm } = useDialog2();
|
|
1390
697
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
@@ -1402,16 +709,16 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1402
709
|
closeView2();
|
|
1403
710
|
}
|
|
1404
711
|
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1405
|
-
|
|
1406
|
-
if (
|
|
1407
|
-
|
|
712
|
+
useEffect6(() => {
|
|
713
|
+
if (Platform5.OS === "ios") {
|
|
714
|
+
setIosSwipeGestureEnabled2({ isEnabled: false });
|
|
1408
715
|
return () => {
|
|
1409
|
-
|
|
716
|
+
setIosSwipeGestureEnabled2({ isEnabled: true });
|
|
1410
717
|
};
|
|
1411
718
|
}
|
|
1412
719
|
return;
|
|
1413
720
|
}, []);
|
|
1414
|
-
|
|
721
|
+
useEffect6(() => {
|
|
1415
722
|
const backHandler = () => {
|
|
1416
723
|
handleClose();
|
|
1417
724
|
return true;
|
|
@@ -1421,16 +728,16 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1421
728
|
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1422
729
|
};
|
|
1423
730
|
}, [handleClose]);
|
|
1424
|
-
|
|
1425
|
-
|
|
731
|
+
useEffect6(() => {
|
|
732
|
+
appsInTossEvent2.addEventListener("entryMessageExited", {
|
|
1426
733
|
onEvent: () => {
|
|
1427
734
|
setIsEntryMessageExited(true);
|
|
1428
735
|
}
|
|
1429
736
|
});
|
|
1430
737
|
}, []);
|
|
1431
|
-
return /* @__PURE__ */ jsxs4(
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
getOperationalEnvironment() === "toss" ? /* @__PURE__ */
|
|
738
|
+
return /* @__PURE__ */ jsxs4(Fragment5, { children: [
|
|
739
|
+
/* @__PURE__ */ jsx7(GameNavigationBar, { onClose: handleClose }),
|
|
740
|
+
getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx7(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx7(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx7(PlainWebView, { ref, ...props })
|
|
1434
741
|
] });
|
|
1435
742
|
});
|
|
1436
743
|
|
|
@@ -1467,12 +774,12 @@ function methodHandler({
|
|
|
1467
774
|
};
|
|
1468
775
|
wrappedFunc(...args).then((result) => {
|
|
1469
776
|
injectJavaScript?.(`
|
|
1470
|
-
window.
|
|
777
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
|
|
1471
778
|
`);
|
|
1472
779
|
}).catch((error) => {
|
|
1473
780
|
const serializedError = serializeError(error);
|
|
1474
781
|
injectJavaScript?.(`
|
|
1475
|
-
window.
|
|
782
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
|
|
1476
783
|
`);
|
|
1477
784
|
});
|
|
1478
785
|
}
|
|
@@ -1503,12 +810,12 @@ function useBridgeHandler({
|
|
|
1503
810
|
);
|
|
1504
811
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
1505
812
|
ref.current?.injectJavaScript(`
|
|
1506
|
-
window.
|
|
813
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
1507
814
|
`);
|
|
1508
815
|
};
|
|
1509
816
|
const createHandleOnError = (functionName, eventId) => (error) => {
|
|
1510
817
|
ref.current?.injectJavaScript(`
|
|
1511
|
-
window.
|
|
818
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1512
819
|
`);
|
|
1513
820
|
};
|
|
1514
821
|
const $onMessage = useCallback4(
|
|
@@ -1561,24 +868,9 @@ function useBridgeHandler({
|
|
|
1561
868
|
};
|
|
1562
869
|
}
|
|
1563
870
|
|
|
1564
|
-
// src/constant-bridges.ts
|
|
1565
|
-
var constant_bridges_exports = {};
|
|
1566
|
-
__export(constant_bridges_exports, {
|
|
1567
|
-
getDeviceId: () => getDeviceId,
|
|
1568
|
-
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
1569
|
-
getTossAppVersion: () => getTossAppVersion
|
|
1570
|
-
});
|
|
1571
|
-
|
|
1572
|
-
// src/event-bridges.ts
|
|
1573
|
-
var event_bridges_exports = {};
|
|
1574
|
-
__export(event_bridges_exports, {
|
|
1575
|
-
contactsViral: () => contactsViral,
|
|
1576
|
-
startUpdateLocation: () => startUpdateLocation
|
|
1577
|
-
});
|
|
1578
|
-
|
|
1579
871
|
// src/hooks/useCreateUserAgent.ts
|
|
872
|
+
import { getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
|
|
1580
873
|
import { useWindowDimensions } from "react-native";
|
|
1581
|
-
import { getPlatformOS } from "react-native-bedrock";
|
|
1582
874
|
var FontA11yCategory = {
|
|
1583
875
|
Large: "Large",
|
|
1584
876
|
xLarge: "xLarge",
|
|
@@ -1733,12 +1025,13 @@ function useCreateUserAgent({
|
|
|
1733
1025
|
}
|
|
1734
1026
|
|
|
1735
1027
|
// src/hooks/useGeolocation.ts
|
|
1736
|
-
import {
|
|
1737
|
-
import { useVisibility as useVisibility3 } from "react-native
|
|
1028
|
+
import { startUpdateLocation } from "@apps-in-toss/native-modules";
|
|
1029
|
+
import { useVisibility as useVisibility3 } from "@granite-js/react-native";
|
|
1030
|
+
import { useState as useState3, useEffect as useEffect7 } from "react";
|
|
1738
1031
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1739
1032
|
const isVisible = useVisibility3();
|
|
1740
1033
|
const [location, setLocation] = useState3(null);
|
|
1741
|
-
|
|
1034
|
+
useEffect7(() => {
|
|
1742
1035
|
if (!isVisible) {
|
|
1743
1036
|
return;
|
|
1744
1037
|
}
|
|
@@ -1756,7 +1049,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1756
1049
|
}
|
|
1757
1050
|
|
|
1758
1051
|
// src/utils/log.ts
|
|
1759
|
-
import {
|
|
1052
|
+
import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
|
|
1053
|
+
import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
|
|
1760
1054
|
|
|
1761
1055
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1762
1056
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1800,13 +1094,13 @@ var trackScreen = (url) => {
|
|
|
1800
1094
|
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1801
1095
|
}
|
|
1802
1096
|
};
|
|
1803
|
-
return
|
|
1097
|
+
return eventLogNative(log);
|
|
1804
1098
|
};
|
|
1805
1099
|
|
|
1806
1100
|
// src/components/WebView.tsx
|
|
1807
|
-
import { jsx as
|
|
1101
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1808
1102
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1809
|
-
var operationalEnvironment = getOperationalEnvironment();
|
|
1103
|
+
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1810
1104
|
var TYPES = ["partner", "external", "game"];
|
|
1811
1105
|
var WEBVIEW_TYPES = {
|
|
1812
1106
|
partner: PartnerWebViewScreen,
|
|
@@ -1839,7 +1133,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1839
1133
|
if (!TYPES.includes(type)) {
|
|
1840
1134
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1841
1135
|
}
|
|
1842
|
-
const
|
|
1136
|
+
const graniteEvent = useGraniteEvent();
|
|
1843
1137
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1844
1138
|
const top = useSafeAreaTop2();
|
|
1845
1139
|
const bottom = useSafeAreaBottom();
|
|
@@ -1860,16 +1154,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1860
1154
|
injectedJavaScript: [disableTextSelectionCSS].join("\n"),
|
|
1861
1155
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1862
1156
|
eventListenerMap: {
|
|
1863
|
-
...
|
|
1157
|
+
...appsInTossEventBridges,
|
|
1864
1158
|
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", {
|
|
1865
1159
|
onEvent,
|
|
1866
1160
|
onError
|
|
1867
1161
|
}),
|
|
1868
|
-
backEvent: ({ onEvent, onError, options }) =>
|
|
1869
|
-
entryMessageExited: ({ onEvent, onError }) =>
|
|
1870
|
-
updateLocationEvent: ({ onEvent, onError, options }) =>
|
|
1162
|
+
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1163
|
+
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent3.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1164
|
+
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent3.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1871
1165
|
/** @internal */
|
|
1872
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
1166
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent3.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1873
1167
|
/** AdMob */
|
|
1874
1168
|
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1875
1169
|
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
@@ -1877,8 +1171,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1877
1171
|
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
|
|
1878
1172
|
},
|
|
1879
1173
|
constantHandlerMap: {
|
|
1880
|
-
...
|
|
1881
|
-
...
|
|
1174
|
+
...graniteConstantBridges,
|
|
1175
|
+
...appsInTossConstantBridges,
|
|
1882
1176
|
getSafeAreaTop: () => top,
|
|
1883
1177
|
getSafeAreaBottom: () => bottom,
|
|
1884
1178
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
@@ -1891,11 +1185,11 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1891
1185
|
getDeploymentId: env.getDeploymentId
|
|
1892
1186
|
},
|
|
1893
1187
|
asyncHandlerMap: {
|
|
1894
|
-
...
|
|
1895
|
-
...
|
|
1188
|
+
...graniteAsyncBridges,
|
|
1189
|
+
...appsInTossAsyncBridges,
|
|
1896
1190
|
setIosSwipeGestureEnabled: (options) => {
|
|
1897
1191
|
setAllowsBackForwardNavigationGestures(options.isEnabled);
|
|
1898
|
-
return
|
|
1192
|
+
return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
|
|
1899
1193
|
},
|
|
1900
1194
|
addAccessoryButton: async (params) => partner.addAccessoryButton(params),
|
|
1901
1195
|
removeAccessoryButton: async () => partner.removeAccessoryButton(),
|
|
@@ -1961,11 +1255,11 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1961
1255
|
return false;
|
|
1962
1256
|
}
|
|
1963
1257
|
}, [canHistoryGoBack, handler]);
|
|
1964
|
-
|
|
1258
|
+
useEffect8(() => {
|
|
1965
1259
|
BackHandler2.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1966
1260
|
return () => BackHandler2.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
1967
1261
|
}, [handleBackEvent]);
|
|
1968
|
-
return /* @__PURE__ */
|
|
1262
|
+
return /* @__PURE__ */ jsx8(
|
|
1969
1263
|
BaseWebView,
|
|
1970
1264
|
{
|
|
1971
1265
|
ref: handler.ref,
|
|
@@ -1978,7 +1272,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1978
1272
|
"User-Agent": userAgent
|
|
1979
1273
|
}
|
|
1980
1274
|
},
|
|
1981
|
-
userAgent:
|
|
1275
|
+
userAgent: Platform6.OS === "ios" ? userAgent : void 0,
|
|
1982
1276
|
sharedCookiesEnabled: true,
|
|
1983
1277
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1984
1278
|
thirdPartyCookiesEnabled: true,
|
|
@@ -1986,7 +1280,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1986
1280
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1987
1281
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1988
1282
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1989
|
-
decelerationRate:
|
|
1283
|
+
decelerationRate: Platform6.OS === "ios" ? 1 : void 0,
|
|
1990
1284
|
allowsBackForwardNavigationGestures
|
|
1991
1285
|
}
|
|
1992
1286
|
);
|
|
@@ -1998,19 +1292,9 @@ function ensureValue(value, name) {
|
|
|
1998
1292
|
return value;
|
|
1999
1293
|
}
|
|
2000
1294
|
|
|
2001
|
-
// src/types.ts
|
|
2002
|
-
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
2003
|
-
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
2004
|
-
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
2005
|
-
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
2006
|
-
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
2007
|
-
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
2008
|
-
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
2009
|
-
return Accuracy3;
|
|
2010
|
-
})(Accuracy2 || {});
|
|
2011
|
-
|
|
2012
1295
|
// src/index.ts
|
|
2013
1296
|
export * from "@apps-in-toss/analytics";
|
|
1297
|
+
export * from "@apps-in-toss/native-modules";
|
|
2014
1298
|
var Analytics2 = {
|
|
2015
1299
|
init: InternalAnalytics.init,
|
|
2016
1300
|
Impression: InternalAnalytics.Impression,
|
|
@@ -2018,37 +1302,11 @@ var Analytics2 = {
|
|
|
2018
1302
|
Area: InternalAnalytics.Area
|
|
2019
1303
|
};
|
|
2020
1304
|
export {
|
|
2021
|
-
Accuracy2 as Accuracy,
|
|
2022
1305
|
Analytics2 as Analytics,
|
|
2023
1306
|
AppsInToss,
|
|
2024
|
-
GoogleAdMob,
|
|
2025
|
-
IAP,
|
|
2026
1307
|
INTERNAL__onVisibilityChangedByTransparentServiceWeb,
|
|
2027
|
-
Storage,
|
|
2028
|
-
TossPay,
|
|
2029
1308
|
WebView,
|
|
2030
|
-
appLogin,
|
|
2031
|
-
appsInTossEvent,
|
|
2032
|
-
contactsViral,
|
|
2033
1309
|
env,
|
|
2034
|
-
eventLog,
|
|
2035
|
-
fetchAlbumPhotos,
|
|
2036
|
-
fetchContacts,
|
|
2037
|
-
getClipboardText,
|
|
2038
|
-
getCurrentLocation,
|
|
2039
|
-
getDeviceId,
|
|
2040
|
-
getGameCenterGameProfile,
|
|
2041
|
-
getOperationalEnvironment,
|
|
2042
|
-
getTossAppVersion,
|
|
2043
|
-
getTossShareLink,
|
|
2044
|
-
isMinVersionSupported,
|
|
2045
|
-
openCamera,
|
|
2046
|
-
openGameCenterLeaderboard,
|
|
2047
|
-
saveBase64Data,
|
|
2048
|
-
setClipboardText,
|
|
2049
|
-
setDeviceOrientation,
|
|
2050
|
-
startUpdateLocation,
|
|
2051
|
-
submitGameCenterLeaderBoardScore,
|
|
2052
1310
|
useCreateUserAgent,
|
|
2053
1311
|
useGeolocation
|
|
2054
1312
|
};
|