@apps-in-toss/framework 0.0.0-dev.1756107381611 → 0.0.0-dev.1757056983098
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 +793 -1157
- package/dist/index.d.cts +11 -2272
- package/dist/index.d.ts +11 -2272
- package/dist/index.js +746 -1095
- 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,17 @@
|
|
|
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 as isMinVersionSupported2, setIosSwipeGestureEnabled, eventLog } from "@apps-in-toss/native-modules";
|
|
7
|
+
import { Granite as Granite6 } from "@granite-js/react-native";
|
|
12
8
|
import { TDSProvider } from "@toss-design-system/react-native";
|
|
13
|
-
import {
|
|
9
|
+
import { AppRegistry } from "react-native";
|
|
14
10
|
|
|
15
11
|
// src/core/components/AppEvent.tsx
|
|
12
|
+
import { INTERNAL__module as INTERNAL__module2 } from "@apps-in-toss/native-modules";
|
|
13
|
+
import { Granite as Granite2, getSchemeUri as getSchemeUri3, useVisibility as useVisibility2 } from "@granite-js/react-native";
|
|
16
14
|
import { useEffect as useEffect2 } from "react";
|
|
17
|
-
import { Bedrock as Bedrock2, getSchemeUri as getSchemeUri3, useVisibility as useVisibility2 } from "react-native-bedrock";
|
|
18
15
|
|
|
19
16
|
// src/env.ts
|
|
20
17
|
var env = {
|
|
@@ -22,12 +19,13 @@ var env = {
|
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
// src/hooks/useCaptureExitLog.ts
|
|
22
|
+
import { INTERNAL__module } from "@apps-in-toss/native-modules";
|
|
23
|
+
import { Granite, useVisibility } from "@granite-js/react-native";
|
|
25
24
|
import { useCallback, useEffect, useRef } from "react";
|
|
26
|
-
import { Bedrock, useVisibility } from "react-native-bedrock";
|
|
27
25
|
|
|
28
26
|
// src/core/hooks/useReferrer.ts
|
|
27
|
+
import { getSchemeUri } from "@granite-js/react-native";
|
|
29
28
|
import { useMemo } from "react";
|
|
30
|
-
import { getSchemeUri } from "react-native-bedrock";
|
|
31
29
|
function useReferrer() {
|
|
32
30
|
return useMemo(() => {
|
|
33
31
|
try {
|
|
@@ -38,129 +36,8 @@ function useReferrer() {
|
|
|
38
36
|
}, []);
|
|
39
37
|
}
|
|
40
38
|
|
|
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
39
|
// src/utils/isPrivateScheme.ts
|
|
163
|
-
import { getSchemeUri as getSchemeUri2 } from "react-native
|
|
40
|
+
import { getSchemeUri as getSchemeUri2 } from "@granite-js/react-native";
|
|
164
41
|
function isPrivateScheme() {
|
|
165
42
|
try {
|
|
166
43
|
return new URL(getSchemeUri2()).protocol === "intoss-private:";
|
|
@@ -187,7 +64,7 @@ function useCaptureExitLog() {
|
|
|
187
64
|
return;
|
|
188
65
|
}
|
|
189
66
|
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
190
|
-
tossCoreEventLog({
|
|
67
|
+
INTERNAL__module.tossCoreEventLog({
|
|
191
68
|
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
192
69
|
log_type: "event",
|
|
193
70
|
params: {
|
|
@@ -195,7 +72,7 @@ function useCaptureExitLog() {
|
|
|
195
72
|
event_type: "impression",
|
|
196
73
|
referrer,
|
|
197
74
|
deployment_id: env.getDeploymentId(),
|
|
198
|
-
app_name:
|
|
75
|
+
app_name: Granite.appName,
|
|
199
76
|
is_private: isPrivateScheme(),
|
|
200
77
|
stay_time: stayTime.toString(),
|
|
201
78
|
exit_time: exitTime.toString()
|
|
@@ -213,7 +90,7 @@ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
|
213
90
|
function EntryAppEvent() {
|
|
214
91
|
const referrer = useReferrer() ?? "";
|
|
215
92
|
useEffect2(() => {
|
|
216
|
-
tossCoreEventLog({
|
|
93
|
+
INTERNAL__module2.tossCoreEventLog({
|
|
217
94
|
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
218
95
|
log_type: "info",
|
|
219
96
|
params: {
|
|
@@ -221,7 +98,7 @@ function EntryAppEvent() {
|
|
|
221
98
|
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
222
99
|
referrer,
|
|
223
100
|
deployment_id: env.getDeploymentId(),
|
|
224
|
-
app_name:
|
|
101
|
+
app_name: Granite2.appName,
|
|
225
102
|
is_private: isPrivateScheme()
|
|
226
103
|
}
|
|
227
104
|
});
|
|
@@ -230,14 +107,14 @@ function EntryAppEvent() {
|
|
|
230
107
|
}
|
|
231
108
|
function SystemAppEvent({ ...initialProps }) {
|
|
232
109
|
useEffect2(() => {
|
|
233
|
-
tossCoreEventLog({
|
|
110
|
+
INTERNAL__module2.tossCoreEventLog({
|
|
234
111
|
log_name: "AppsInTossInitialProps",
|
|
235
112
|
log_type: "debug",
|
|
236
113
|
params: {
|
|
237
114
|
...initialProps,
|
|
238
115
|
schemeUri: getSchemeUri3(),
|
|
239
116
|
deployment_id: env.getDeploymentId(),
|
|
240
|
-
app_name:
|
|
117
|
+
app_name: Granite2.appName,
|
|
241
118
|
is_private: isPrivateScheme()
|
|
242
119
|
}
|
|
243
120
|
});
|
|
@@ -260,204 +137,288 @@ var AppEvent = {
|
|
|
260
137
|
StayTime: StayTimeAppEvent
|
|
261
138
|
};
|
|
262
139
|
|
|
263
|
-
// src/core/
|
|
264
|
-
import {
|
|
140
|
+
// src/core/components/AppUpdate.tsx
|
|
141
|
+
import { openURL } from "@granite-js/react-native";
|
|
265
142
|
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
|
-
}
|
|
143
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
144
|
+
var UPDATE_SCHEME = "servicetoss://update/forced/j?updateType=required";
|
|
145
|
+
function AppUpdate() {
|
|
146
|
+
useEffect3(() => {
|
|
147
|
+
openURL(`supertoss://closePage?url=${UPDATE_SCHEME}`);
|
|
148
|
+
}, []);
|
|
149
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
304
150
|
}
|
|
305
151
|
|
|
306
|
-
// src/
|
|
307
|
-
import {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
152
|
+
// src/core/components/BuiltinNavigationBar/index.tsx
|
|
153
|
+
import { appsInTossEvent } from "@apps-in-toss/native-modules";
|
|
154
|
+
import { closeView, useBackEventContext, useNavigation } from "@granite-js/react-native";
|
|
155
|
+
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
156
|
+
import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss-design-system/react-native/private";
|
|
157
|
+
import { josa } from "es-hangul";
|
|
158
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
159
|
+
import { BackHandler } from "react-native";
|
|
160
|
+
|
|
161
|
+
// src/core/components/BuiltinNavigationBar/useBuiltinNavigationBarLogging.tsx
|
|
162
|
+
import { INTERNAL__module as INTERNAL__module3 } from "@apps-in-toss/native-modules";
|
|
163
|
+
import { Granite as Granite3 } from "@granite-js/react-native";
|
|
164
|
+
var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
|
|
165
|
+
var NAVI_BAR_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__navigation_bar";
|
|
166
|
+
var CLOSE_POPUP_SHOW_SCHEMA_ID = 1644490;
|
|
167
|
+
var CLOSE_POPUP_SHOW_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app";
|
|
168
|
+
var CLOSE_BUTTON_CLICK_SCHEMA_ID = 1596831;
|
|
169
|
+
var CLOSE_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_close";
|
|
170
|
+
var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
|
|
171
|
+
var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
|
|
172
|
+
var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
|
|
173
|
+
var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
|
|
174
|
+
function useBuiltinNavigationBarLogging() {
|
|
175
|
+
const referrer = useReferrer();
|
|
176
|
+
const baseParams = {
|
|
177
|
+
referrer,
|
|
178
|
+
app_name: Granite3.appName
|
|
317
179
|
};
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
328
|
-
return;
|
|
180
|
+
const logNavBarImpression = (naviBarConfig) => {
|
|
181
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
182
|
+
log_name: NAVI_BAR_IMPRESSION_LOG_NAME,
|
|
183
|
+
log_type: "event",
|
|
184
|
+
params: {
|
|
185
|
+
...naviBarConfig,
|
|
186
|
+
...baseParams,
|
|
187
|
+
event_type: "impression",
|
|
188
|
+
schema_id: NAVI_BAR_IMPRESSION_SCHEMA_ID
|
|
329
189
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
const logHomeButtonClick = () => {
|
|
193
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
194
|
+
log_name: HOME_BUTTON_CLICK_LOG_NAME,
|
|
195
|
+
log_type: "event",
|
|
196
|
+
params: {
|
|
197
|
+
...baseParams,
|
|
198
|
+
event_type: "click",
|
|
199
|
+
schema_id: HOME_BUTTON_CLICK_SCHEMA_ID
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
const logCloseButtonClick = () => {
|
|
204
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
205
|
+
log_name: CLOSE_BUTTON_CLICK_LOG_NAME,
|
|
206
|
+
log_type: "event",
|
|
207
|
+
params: {
|
|
208
|
+
...baseParams,
|
|
209
|
+
event_type: "click",
|
|
210
|
+
schema_id: CLOSE_BUTTON_CLICK_SCHEMA_ID
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
const logClosePopupShow = () => {
|
|
215
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
216
|
+
log_name: CLOSE_POPUP_SHOW_LOG_NAME,
|
|
217
|
+
log_type: "popup",
|
|
218
|
+
params: {
|
|
219
|
+
...baseParams,
|
|
220
|
+
schema_id: CLOSE_POPUP_SHOW_SCHEMA_ID
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
const logClosePopupCtaClick = (confirm) => {
|
|
225
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
226
|
+
log_name: CLOSE_POPUP_CTA_CLICK_LOG_NAME,
|
|
227
|
+
log_type: "event",
|
|
228
|
+
params: {
|
|
229
|
+
...baseParams,
|
|
230
|
+
close_yn: confirm ? "Y" : "N",
|
|
231
|
+
schema_id: CLOSE_POPUP_CTA_CLICK_SCHEMA_ID,
|
|
232
|
+
event_type: "click"
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
return {
|
|
237
|
+
navBarImpression: logNavBarImpression,
|
|
238
|
+
closePopupShow: logClosePopupShow,
|
|
239
|
+
closePopupCtaClick: logClosePopupCtaClick,
|
|
240
|
+
closeButtonClick: logCloseButtonClick,
|
|
241
|
+
homeButtonClick: logHomeButtonClick
|
|
242
|
+
};
|
|
346
243
|
}
|
|
347
244
|
|
|
348
|
-
// src/
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
245
|
+
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
246
|
+
import { INTERNAL__appBridgeHandler, isMinVersionSupported } from "@apps-in-toss/native-modules";
|
|
247
|
+
import { openURL as openURL3 } from "@granite-js/react-native";
|
|
248
|
+
import { BottomSheet, List, ListHeader, ListRow } from "@toss-design-system/react-native";
|
|
249
|
+
import { useAdaptive, useOverlay } from "@toss-design-system/react-native/private";
|
|
250
|
+
import { useEffect as useEffect4, useState } from "react";
|
|
251
|
+
|
|
252
|
+
// src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
|
|
253
|
+
import { INTERNAL__module as INTERNAL__module4 } from "@apps-in-toss/native-modules";
|
|
254
|
+
import { Granite as Granite4 } from "@granite-js/react-native";
|
|
255
|
+
var BOTTOM_SHEET_SCHEMA_ID = 1596825;
|
|
256
|
+
var BOTTOM_SHEET_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more";
|
|
257
|
+
var BOTTOM_SHEET_OPEN_SCHEMA_ID = 1596829;
|
|
258
|
+
var BOTTOM_SHEET_OPEN_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_more";
|
|
259
|
+
var BOTTOM_SHEET_CLOSE_CLICK_SCHEMA_ID = 1596843;
|
|
260
|
+
var BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more::click__close";
|
|
261
|
+
var BOTTOM_SHEET_MENU_CLICK_SCHEMA_ID = 1596841;
|
|
262
|
+
var BOTTOM_SHEET_MENU_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more::click__menu";
|
|
263
|
+
function useMoreButtonBottomSheetLogging() {
|
|
264
|
+
const referrer = useReferrer();
|
|
265
|
+
const baseParams = {
|
|
266
|
+
referrer,
|
|
267
|
+
app_name: Granite4.appName
|
|
268
|
+
};
|
|
269
|
+
const logBottomSheetShow = () => {
|
|
270
|
+
INTERNAL__module4.tossCoreEventLog({
|
|
271
|
+
log_name: BOTTOM_SHEET_LOG_NAME,
|
|
272
|
+
log_type: "popup",
|
|
273
|
+
params: {
|
|
274
|
+
...baseParams,
|
|
275
|
+
schema_id: BOTTOM_SHEET_SCHEMA_ID
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
const logBottomSheetOpen = () => {
|
|
280
|
+
INTERNAL__module4.tossCoreEventLog({
|
|
281
|
+
log_name: BOTTOM_SHEET_OPEN_LOG_NAME,
|
|
282
|
+
log_type: "event",
|
|
283
|
+
params: {
|
|
284
|
+
...baseParams,
|
|
285
|
+
schema_id: BOTTOM_SHEET_OPEN_SCHEMA_ID,
|
|
286
|
+
event_type: "click"
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
const logBottomSheetCloseClick = () => {
|
|
291
|
+
INTERNAL__module4.tossCoreEventLog({
|
|
292
|
+
log_name: BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME,
|
|
293
|
+
log_type: "event",
|
|
294
|
+
params: {
|
|
295
|
+
...baseParams,
|
|
296
|
+
schema_id: BOTTOM_SHEET_CLOSE_CLICK_SCHEMA_ID,
|
|
297
|
+
event_type: "click"
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
const logBottomSheetMenuClick = ({ title }) => {
|
|
302
|
+
INTERNAL__module4.tossCoreEventLog({
|
|
303
|
+
log_name: BOTTOM_SHEET_MENU_CLICK_LOG_NAME,
|
|
304
|
+
log_type: "event",
|
|
305
|
+
params: {
|
|
306
|
+
...baseParams,
|
|
307
|
+
schema_id: BOTTOM_SHEET_MENU_CLICK_SCHEMA_ID,
|
|
308
|
+
event_type: "click",
|
|
309
|
+
item_title: title
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
return {
|
|
314
|
+
show: logBottomSheetShow,
|
|
315
|
+
open: logBottomSheetOpen,
|
|
316
|
+
close: logBottomSheetCloseClick,
|
|
317
|
+
menuClick: logBottomSheetMenuClick
|
|
373
318
|
};
|
|
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());
|
|
387
319
|
}
|
|
388
|
-
var INTERNAL__appBridgeHandler = {
|
|
389
|
-
invokeAppBridgeCallback,
|
|
390
|
-
invokeAppBridgeMethod,
|
|
391
|
-
registerCallback,
|
|
392
|
-
unregisterCallback,
|
|
393
|
-
getCallbackIds
|
|
394
|
-
};
|
|
395
320
|
|
|
396
|
-
// src/
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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
|
-
}
|
|
321
|
+
// src/hooks/useAppUpdateDialog.tsx
|
|
322
|
+
import { INTERNAL__module as INTERNAL__module5 } from "@apps-in-toss/native-modules";
|
|
323
|
+
import { Granite as Granite5, openURL as openURL2 } from "@granite-js/react-native";
|
|
324
|
+
import { useDialog } from "@toss-design-system/react-native";
|
|
325
|
+
import { useCallback as useCallback2 } from "react";
|
|
326
|
+
|
|
327
|
+
// src/utils/market.ts
|
|
328
|
+
import { Platform } from "react-native";
|
|
329
|
+
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
330
|
+
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
331
|
+
var getMarketLink = () => {
|
|
332
|
+
return Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
425
333
|
};
|
|
426
334
|
|
|
427
|
-
// src/
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
335
|
+
// src/hooks/useAppUpdateDialog.tsx
|
|
336
|
+
function useAppUpdateDialog() {
|
|
337
|
+
const { openConfirm } = useDialog();
|
|
338
|
+
const logging = useAppUpdateDialogLogging();
|
|
339
|
+
const openAppUpdateDialog = useCallback2(
|
|
340
|
+
async ({
|
|
341
|
+
title,
|
|
342
|
+
description,
|
|
343
|
+
leftButton = "\uB2EB\uAE30",
|
|
344
|
+
rightButton = "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
|
|
345
|
+
}) => {
|
|
346
|
+
logging.show();
|
|
347
|
+
const isConfirmed = await openConfirm({
|
|
348
|
+
title,
|
|
349
|
+
description,
|
|
350
|
+
leftButton,
|
|
351
|
+
rightButton,
|
|
352
|
+
closeOnDimmerClick: true
|
|
353
|
+
});
|
|
354
|
+
if (!isConfirmed) {
|
|
355
|
+
logging.close();
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
logging.update();
|
|
359
|
+
const STORE_SCHEME = getMarketLink();
|
|
360
|
+
openURL2(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
361
|
+
},
|
|
362
|
+
[logging, openConfirm]
|
|
363
|
+
);
|
|
364
|
+
return {
|
|
365
|
+
open: openAppUpdateDialog
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
var UPDATE_DIALOG_SCHEMA_ID = 1634992;
|
|
369
|
+
var UPDATE_DIALOG_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__app_update";
|
|
370
|
+
var UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID = 1634996;
|
|
371
|
+
var UPDATE_DIALOG_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__app_update::click__cta";
|
|
372
|
+
function useAppUpdateDialogLogging() {
|
|
373
|
+
const referrer = useReferrer();
|
|
374
|
+
const baseParams = {
|
|
375
|
+
referrer,
|
|
376
|
+
app_name: Granite5.appName
|
|
377
|
+
};
|
|
378
|
+
const logUpdateClick = () => {
|
|
379
|
+
INTERNAL__module5.tossCoreEventLog({
|
|
380
|
+
log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
|
|
381
|
+
log_type: "event",
|
|
382
|
+
params: {
|
|
383
|
+
...baseParams,
|
|
384
|
+
schema_id: UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID,
|
|
385
|
+
event_type: "click",
|
|
386
|
+
button_type: "update"
|
|
444
387
|
}
|
|
445
388
|
});
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
389
|
+
};
|
|
390
|
+
const logCloseClick = () => {
|
|
391
|
+
INTERNAL__module5.tossCoreEventLog({
|
|
392
|
+
log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
|
|
393
|
+
log_type: "event",
|
|
394
|
+
params: {
|
|
395
|
+
...baseParams,
|
|
396
|
+
schema_id: UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID,
|
|
397
|
+
event_type: "click",
|
|
398
|
+
button_type: "close"
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
const logDialogShow = () => {
|
|
403
|
+
INTERNAL__module5.tossCoreEventLog({
|
|
404
|
+
log_name: UPDATE_DIALOG_LOG_NAME,
|
|
405
|
+
log_type: "popup",
|
|
406
|
+
params: {
|
|
407
|
+
...baseParams,
|
|
408
|
+
schema_id: UPDATE_DIALOG_SCHEMA_ID
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
return { update: logUpdateClick, close: logCloseClick, show: logDialogShow };
|
|
413
|
+
}
|
|
452
414
|
|
|
453
|
-
// src/
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
]);
|
|
415
|
+
// src/core/utils/ensureValue.ts
|
|
416
|
+
function ensureValue(value, name) {
|
|
417
|
+
if (value === void 0) {
|
|
418
|
+
throw new Error(`${name} is required`);
|
|
419
|
+
}
|
|
420
|
+
return value;
|
|
421
|
+
}
|
|
461
422
|
|
|
462
423
|
// src/core/utils/getAppsInTossGlobals.ts
|
|
463
424
|
function getAppsInTossGlobals() {
|
|
@@ -467,270 +428,316 @@ function getAppsInTossGlobals() {
|
|
|
467
428
|
return global.__appsInToss;
|
|
468
429
|
}
|
|
469
430
|
|
|
470
|
-
// src/core/
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
431
|
+
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
432
|
+
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
433
|
+
var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
|
|
434
|
+
function useMoreButtonBottomSheet() {
|
|
435
|
+
const globals = getAppsInTossGlobals();
|
|
436
|
+
const adaptive = useAdaptive();
|
|
437
|
+
const [itemList, setItemList] = useState([]);
|
|
438
|
+
const appUpdateDialog = useAppUpdateDialog();
|
|
439
|
+
const logging = useMoreButtonBottomSheetLogging();
|
|
440
|
+
const overlay = useOverlay();
|
|
441
|
+
const title = ensureValue(globals.brandDisplayName, "displayName");
|
|
442
|
+
const isSupported = isMinVersionSupported({
|
|
443
|
+
android: "5.226.0",
|
|
444
|
+
ios: "5.226.0"
|
|
445
|
+
});
|
|
446
|
+
useEffect4(() => {
|
|
447
|
+
if (!isSupported) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
451
|
+
APP_BRIDGE_METHOD_NAME,
|
|
452
|
+
{},
|
|
453
|
+
{
|
|
454
|
+
onSuccess: ({ items }) => setItemList(items),
|
|
455
|
+
onError: (error) => console.error("\uBA54\uB274 \uBAA9\uB85D\uC744 \uAC00\uC838\uC624\uB294 \uB370 \uC2E4\uD328\uD588\uC5B4\uC694:", error)
|
|
490
456
|
}
|
|
457
|
+
);
|
|
458
|
+
}, [isSupported]);
|
|
459
|
+
const onClickHandler = async () => {
|
|
460
|
+
logging.open();
|
|
461
|
+
if (!isSupported) {
|
|
462
|
+
await appUpdateDialog.open({
|
|
463
|
+
title: `\uC774 \uAE30\uB2A5\uC744 \uC4F0\uB824\uBA74 \uC571 \uC5C5\uB370\uC774\uD2B8\uAC00 \uD544\uC694\uD574\uC694`,
|
|
464
|
+
description: `\uBB38\uC758, \uAD8C\uD55C \uC124\uC815, \uC2E0\uACE0 \uB4F1 \uAE30\uB2A5\uC744 \uC4F8 \uC218 \uC788\uC5B4\uC694`
|
|
465
|
+
});
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
overlay.open(({ isOpen, exit, close }) => {
|
|
469
|
+
const handleClose = () => {
|
|
470
|
+
logging.close();
|
|
471
|
+
close();
|
|
472
|
+
};
|
|
473
|
+
return /* @__PURE__ */ jsx2(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx2(
|
|
474
|
+
BottomSheet.Root,
|
|
475
|
+
{
|
|
476
|
+
header: /* @__PURE__ */ jsx2(
|
|
477
|
+
ListHeader,
|
|
478
|
+
{
|
|
479
|
+
title: /* @__PURE__ */ jsx2(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
open: isOpen,
|
|
483
|
+
cta: /* @__PURE__ */ jsx2(
|
|
484
|
+
BottomSheet.CTA,
|
|
485
|
+
{
|
|
486
|
+
size: "large",
|
|
487
|
+
type: "dark",
|
|
488
|
+
style: "weak",
|
|
489
|
+
onPress: () => {
|
|
490
|
+
handleClose();
|
|
491
|
+
},
|
|
492
|
+
children: "\uB2EB\uAE30"
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
onClose: handleClose,
|
|
496
|
+
onExited: exit,
|
|
497
|
+
children: /* @__PURE__ */ jsx2(List, { rowSeparator: "none", children: itemList.map((item) => {
|
|
498
|
+
return /* @__PURE__ */ jsx2(
|
|
499
|
+
ListRow,
|
|
500
|
+
{
|
|
501
|
+
left: /* @__PURE__ */ jsx2(
|
|
502
|
+
ListRow.Icon,
|
|
503
|
+
{
|
|
504
|
+
color: globals.brandPrimaryColor,
|
|
505
|
+
source: { uri: item.contactIconUrl },
|
|
506
|
+
type: "background"
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
contents: /* @__PURE__ */ jsx2(
|
|
510
|
+
ListRow.Texts,
|
|
511
|
+
{
|
|
512
|
+
type: "1RowTypeA",
|
|
513
|
+
top: item.contactItemName,
|
|
514
|
+
topProps: { color: adaptive.grey700 }
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
verticalPadding: "extraSmall",
|
|
518
|
+
onPress: () => {
|
|
519
|
+
logging.menuClick({ title: item.contactItemName });
|
|
520
|
+
openURL3(item.contactUri);
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
item.contactItemName
|
|
524
|
+
);
|
|
525
|
+
}) })
|
|
526
|
+
}
|
|
527
|
+
) });
|
|
491
528
|
});
|
|
492
|
-
}, []);
|
|
493
|
-
}
|
|
494
|
-
|
|
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
529
|
};
|
|
530
|
+
return { open: onClickHandler };
|
|
553
531
|
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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;
|
|
532
|
+
function BottomSheetImpressionArea({ children }) {
|
|
533
|
+
const logging = useMoreButtonBottomSheetLogging();
|
|
534
|
+
useEffect4(() => {
|
|
535
|
+
logging.show();
|
|
536
|
+
}, [logging]);
|
|
537
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children });
|
|
569
538
|
}
|
|
570
539
|
|
|
571
|
-
// src/
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
540
|
+
// src/core/utils/safeParseNavigationBar.ts
|
|
541
|
+
function safeParseNavigationBar(navigationBar) {
|
|
542
|
+
if (typeof navigationBar === "object") {
|
|
543
|
+
return navigationBar;
|
|
576
544
|
}
|
|
577
|
-
|
|
578
|
-
|
|
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.");
|
|
545
|
+
try {
|
|
546
|
+
return JSON.parse(navigationBar);
|
|
547
|
+
} catch {
|
|
548
|
+
return null;
|
|
586
549
|
}
|
|
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
550
|
}
|
|
595
551
|
|
|
596
|
-
// src/
|
|
597
|
-
|
|
598
|
-
return
|
|
552
|
+
// src/core/utils/toIcon.ts
|
|
553
|
+
function toIcon(source) {
|
|
554
|
+
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
599
555
|
}
|
|
600
556
|
|
|
601
|
-
// src/
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
);
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
557
|
+
// src/core/components/BuiltinNavigationBar/index.tsx
|
|
558
|
+
import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
|
|
559
|
+
function BuiltinNavigationBar() {
|
|
560
|
+
const globals = getAppsInTossGlobals();
|
|
561
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
562
|
+
const logging = useBuiltinNavigationBarLogging();
|
|
563
|
+
const { openConfirm } = useDialog2();
|
|
564
|
+
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
565
|
+
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
566
|
+
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
567
|
+
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
568
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
569
|
+
const isExternalWebView = globals.webViewType === "external";
|
|
570
|
+
const isGameWebView = globals.webViewType === "game";
|
|
571
|
+
const backEventContext = useBackEventContext();
|
|
572
|
+
const overrideCanGoBack = !backEventContext.hasBackEvent;
|
|
573
|
+
const handleBackOrClose = useBackOrCloseNavigation();
|
|
574
|
+
const navigation = useNavigation();
|
|
575
|
+
const handlePressTitle = useCallback3(() => {
|
|
576
|
+
logging.homeButtonClick();
|
|
577
|
+
if (globals.webViewType != null) {
|
|
578
|
+
appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
navigation.navigate("/");
|
|
582
|
+
}, [logging, globals.webViewType, navigation]);
|
|
583
|
+
const handleBack = useCallback3(() => {
|
|
584
|
+
if (!overrideCanGoBack) {
|
|
585
|
+
backEventContext.onBack();
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
handleBackOrClose();
|
|
589
|
+
}, [overrideCanGoBack, handleBackOrClose, backEventContext]);
|
|
590
|
+
const handleClose = useCallback3(async () => {
|
|
591
|
+
logging.closeButtonClick();
|
|
592
|
+
const isConfirmed = await openConfirm({
|
|
593
|
+
title: `${josa(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
594
|
+
leftButton: "\uCDE8\uC18C",
|
|
595
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
596
|
+
closeOnDimmerClick: true,
|
|
597
|
+
onEntered: logging.closePopupShow
|
|
613
598
|
});
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
});
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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;
|
|
599
|
+
logging.closePopupCtaClick(isConfirmed);
|
|
600
|
+
if (isConfirmed) {
|
|
601
|
+
captureExitLog(Date.now());
|
|
602
|
+
closeView();
|
|
603
|
+
}
|
|
604
|
+
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
605
|
+
useEffect5(() => {
|
|
606
|
+
const backHandler = () => {
|
|
607
|
+
handleClose();
|
|
608
|
+
return true;
|
|
609
|
+
};
|
|
610
|
+
BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
611
|
+
return () => {
|
|
612
|
+
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
613
|
+
};
|
|
614
|
+
}, [handleClose]);
|
|
615
|
+
if (isExternalWebView) {
|
|
616
|
+
return /* @__PURE__ */ jsx3(Fragment3, {});
|
|
660
617
|
}
|
|
661
|
-
|
|
618
|
+
return /* @__PURE__ */ jsx3(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx3(
|
|
619
|
+
TopNavigation,
|
|
620
|
+
{
|
|
621
|
+
title: globals.brandDisplayName,
|
|
622
|
+
icon: toIcon(globals.brandIcon),
|
|
623
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
624
|
+
contentVisible: isGameWebView ? false : true,
|
|
625
|
+
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
626
|
+
onPressClose: handleClose,
|
|
627
|
+
withHome: withHomeButton,
|
|
628
|
+
fixedRightButton: initialAccessoryButton ? {
|
|
629
|
+
title: initialAccessoryButton.title,
|
|
630
|
+
icon: initialAccessoryButton.icon,
|
|
631
|
+
id: initialAccessoryButton.id
|
|
632
|
+
} : void 0,
|
|
633
|
+
children: isGameWebView === false ? /* @__PURE__ */ jsx3(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx3(NavigationBackButton, { onPress: handleBack, canGoBack: false }) }) : null
|
|
634
|
+
}
|
|
635
|
+
) });
|
|
662
636
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
async function getGameCenterGameProfile() {
|
|
673
|
-
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
674
|
-
if (!isSupported) {
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
return AppsInTossModule.getGameCenterGameProfile({});
|
|
637
|
+
function useBackOrCloseNavigation() {
|
|
638
|
+
const navigation = useNavigation();
|
|
639
|
+
return useCallback3(() => {
|
|
640
|
+
if (navigation.canGoBack()) {
|
|
641
|
+
navigation.goBack();
|
|
642
|
+
} else {
|
|
643
|
+
closeView();
|
|
644
|
+
}
|
|
645
|
+
}, [navigation]);
|
|
678
646
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
647
|
+
function BuiltinNavigationBarImpressionArea({
|
|
648
|
+
children,
|
|
649
|
+
withHomeButton
|
|
650
|
+
}) {
|
|
651
|
+
const hasLogged = useRef2(false);
|
|
652
|
+
const logging = useBuiltinNavigationBarLogging();
|
|
653
|
+
useEffect5(() => {
|
|
654
|
+
if (hasLogged.current === false) {
|
|
655
|
+
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
656
|
+
hasLogged.current = true;
|
|
657
|
+
}
|
|
658
|
+
}, []);
|
|
659
|
+
return /* @__PURE__ */ jsx3(Fragment3, { children });
|
|
690
660
|
}
|
|
691
661
|
|
|
692
|
-
// src/
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
662
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
663
|
+
import { appsInTossEvent as appsInTossEvent2 } from "@apps-in-toss/native-modules";
|
|
664
|
+
import { useBridge } from "@toss-design-system/react-native";
|
|
665
|
+
import { useEffect as useEffect6 } from "react";
|
|
666
|
+
function useAppsInTossBridge() {
|
|
667
|
+
const controller = useBridge();
|
|
668
|
+
const appsInTossGlobals = getAppsInTossGlobals();
|
|
669
|
+
useEffect6(() => {
|
|
670
|
+
const commonProps = {
|
|
671
|
+
serviceName: appsInTossGlobals.brandDisplayName,
|
|
672
|
+
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
673
|
+
color: appsInTossGlobals.brandPrimaryColor,
|
|
674
|
+
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
675
|
+
};
|
|
676
|
+
controller.open({
|
|
677
|
+
...commonProps,
|
|
678
|
+
onExited: () => {
|
|
679
|
+
appsInTossEvent2.emit("entryMessageExited", void 0);
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
}, []);
|
|
699
683
|
}
|
|
700
684
|
|
|
701
685
|
// src/core/registerApp.tsx
|
|
702
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
686
|
+
import { Fragment as Fragment4, jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
703
687
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
688
|
+
if (!isMinVersionSupported2({
|
|
689
|
+
android: "5.220.0",
|
|
690
|
+
ios: "5.221.0"
|
|
691
|
+
})) {
|
|
692
|
+
return /* @__PURE__ */ jsxs(Fragment4, { children: [
|
|
693
|
+
/* @__PURE__ */ jsx4(AppEvent.Entry, {}),
|
|
694
|
+
/* @__PURE__ */ jsx4(AppEvent.System, { ...initialProps }),
|
|
695
|
+
/* @__PURE__ */ jsx4(AppUpdate, {})
|
|
696
|
+
] });
|
|
697
|
+
}
|
|
698
|
+
return /* @__PURE__ */ jsxs(Fragment4, { children: [
|
|
699
|
+
/* @__PURE__ */ jsx4(AppEvent.StayTime, {}),
|
|
700
|
+
/* @__PURE__ */ jsx4(AppEvent.Entry, {}),
|
|
701
|
+
/* @__PURE__ */ jsx4(AppEvent.System, { ...initialProps }),
|
|
702
|
+
/* @__PURE__ */ jsx4(Container, { ...initialProps, children: /* @__PURE__ */ jsx4(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx4(TDSContainer, { ...initialProps, children }) }) })
|
|
709
703
|
] });
|
|
710
704
|
}
|
|
711
705
|
function TDSContainer({ children }) {
|
|
712
706
|
useAppsInTossBridge();
|
|
713
|
-
return /* @__PURE__ */
|
|
707
|
+
return /* @__PURE__ */ jsx4(Fragment4, { children });
|
|
714
708
|
}
|
|
715
709
|
function registerApp(container, { context, analytics }) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
710
|
+
const appName = getAppName();
|
|
711
|
+
const isRegistered = AppRegistry.getAppKeys().includes(appName);
|
|
712
|
+
if (!isRegistered) {
|
|
713
|
+
Analytics.init({
|
|
714
|
+
logger: (params) => void eventLog(params),
|
|
715
|
+
debug: analytics?.debug ?? __DEV__
|
|
716
|
+
});
|
|
717
|
+
const App = Granite6.registerApp(AppsInTossContainer.bind(null, container), {
|
|
718
|
+
appName,
|
|
719
|
+
context,
|
|
720
|
+
setIosSwipeGestureEnabled,
|
|
721
|
+
router: {
|
|
722
|
+
screenContainer: AppsInTossScreenContainer,
|
|
723
|
+
defaultScreenOption: {
|
|
724
|
+
statusBarStyle: "dark"
|
|
725
|
+
}
|
|
727
726
|
}
|
|
728
|
-
}
|
|
729
|
-
|
|
727
|
+
});
|
|
728
|
+
global.Page = App;
|
|
729
|
+
}
|
|
730
|
+
return global.Page;
|
|
731
|
+
}
|
|
732
|
+
function AppsInTossScreenContainer({ children }) {
|
|
733
|
+
return /* @__PURE__ */ jsxs(Analytics.Screen, { children: [
|
|
734
|
+
/* @__PURE__ */ jsx4(BuiltinNavigationBar, {}),
|
|
735
|
+
children
|
|
736
|
+
] });
|
|
730
737
|
}
|
|
731
738
|
function getAppName() {
|
|
732
739
|
try {
|
|
733
|
-
return global.
|
|
740
|
+
return global.__granite.app.name;
|
|
734
741
|
} catch (error) {
|
|
735
742
|
console.error("unexpected error occurred while getting app name");
|
|
736
743
|
throw error;
|
|
@@ -742,255 +749,57 @@ var AppsInToss = {
|
|
|
742
749
|
registerApp
|
|
743
750
|
};
|
|
744
751
|
|
|
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
752
|
// src/components/WebView.tsx
|
|
950
|
-
import {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
import
|
|
957
|
-
import {
|
|
958
|
-
import {
|
|
959
|
-
import {
|
|
960
|
-
import
|
|
961
|
-
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
753
|
+
import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInTossEvent4 } from "@apps-in-toss/native-modules";
|
|
754
|
+
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
755
|
+
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
756
|
+
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
757
|
+
import { getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/react-native";
|
|
758
|
+
import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
|
|
759
|
+
import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
|
|
760
|
+
import { ExternalWebViewScreen, tdsEvent } from "@toss-design-system/react-native";
|
|
761
|
+
import { useSafeAreaBottom, useSafeAreaTop, useTopNavigation } from "@toss-design-system/react-native/private";
|
|
762
|
+
import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo3, useState as useState5 } from "react";
|
|
763
|
+
import { BackHandler as BackHandler2, Platform as Platform3 } from "react-native";
|
|
962
764
|
|
|
963
765
|
// src/components/GameWebView.tsx
|
|
766
|
+
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment } from "@apps-in-toss/native-modules";
|
|
964
767
|
import {
|
|
965
768
|
WebView as PlainWebView
|
|
966
|
-
} from "@
|
|
967
|
-
import {
|
|
968
|
-
import {
|
|
969
|
-
import { forwardRef, useCallback as useCallback3, useEffect as useEffect5, useState as useState2 } from "react";
|
|
970
|
-
import { BackHandler, Platform as Platform6 } from "react-native";
|
|
971
|
-
import { closeView as closeView2, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
769
|
+
} from "@granite-js/native/react-native-webview";
|
|
770
|
+
import { forwardRef, useEffect as useEffect8, useState as useState3 } from "react";
|
|
771
|
+
import { Platform as Platform2 } from "react-native";
|
|
972
772
|
|
|
973
773
|
// src/components/GameProfile.tsx
|
|
774
|
+
import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported as isMinVersionSupported3 } from "@apps-in-toss/native-modules";
|
|
974
775
|
import { Loader } from "@toss-design-system/react-native";
|
|
975
|
-
import { useEffect as
|
|
776
|
+
import { useEffect as useEffect7 } from "react";
|
|
976
777
|
import { Pressable, View } from "react-native";
|
|
977
778
|
|
|
779
|
+
// src/constant/game-center.ts
|
|
780
|
+
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
781
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
782
|
+
android: "5.221.0",
|
|
783
|
+
ios: "5.221.0"
|
|
784
|
+
};
|
|
785
|
+
|
|
978
786
|
// src/hooks/useGameCenterProfile.ts
|
|
979
|
-
import {
|
|
980
|
-
import {
|
|
981
|
-
import {
|
|
982
|
-
import {
|
|
787
|
+
import { getGameCenterGameProfile } from "@apps-in-toss/native-modules";
|
|
788
|
+
import { closeView as closeView2, openURL as openURL5 } from "@granite-js/react-native";
|
|
789
|
+
import { useDialog as useDialog3 } from "@toss-design-system/react-native";
|
|
790
|
+
import { josa as josa2 } from "es-hangul";
|
|
791
|
+
import { useCallback as useCallback4, useRef as useRef3, useState as useState2 } from "react";
|
|
983
792
|
|
|
984
793
|
// src/components/GameProfileToast.tsx
|
|
985
794
|
import { Asset, Toast } from "@toss-design-system/react-native";
|
|
986
|
-
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay } from "@toss-design-system/react-native/private";
|
|
987
|
-
import { jsx as
|
|
795
|
+
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay as useOverlay2 } from "@toss-design-system/react-native/private";
|
|
796
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
988
797
|
var useGameProfileToast = () => {
|
|
989
|
-
const overlay =
|
|
798
|
+
const overlay = useOverlay2();
|
|
990
799
|
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
991
800
|
return new Promise((resolve) => {
|
|
992
801
|
overlay.open(({ isOpen, close, exit }) => {
|
|
993
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ jsx5(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx5(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx5(
|
|
994
803
|
Toast,
|
|
995
804
|
{
|
|
996
805
|
open: isOpen,
|
|
@@ -1001,7 +810,7 @@ var useGameProfileToast = () => {
|
|
|
1001
810
|
onExited: exit,
|
|
1002
811
|
position: "top",
|
|
1003
812
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
1004
|
-
icon: /* @__PURE__ */
|
|
813
|
+
icon: /* @__PURE__ */ jsx5(
|
|
1005
814
|
Asset.Image,
|
|
1006
815
|
{
|
|
1007
816
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
@@ -1023,23 +832,11 @@ var DEFAULT_ERROR = {
|
|
|
1023
832
|
description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
|
|
1024
833
|
};
|
|
1025
834
|
|
|
1026
|
-
// src/utils/market.ts
|
|
1027
|
-
import { Platform as Platform2 } from "react-native";
|
|
1028
|
-
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
1029
|
-
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
1030
|
-
var getMarketLink = () => {
|
|
1031
|
-
return Platform2.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
835
|
// src/utils/openTransparentWebView.ts
|
|
1035
|
-
import { openURL as
|
|
1036
|
-
|
|
1037
|
-
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1038
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1039
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1040
|
-
}
|
|
836
|
+
import { openURL as openURL4 } from "@granite-js/react-native";
|
|
1041
837
|
|
|
1042
838
|
// src/private.ts
|
|
839
|
+
import { onVisibilityChangedByTransparentServiceWeb } from "@apps-in-toss/native-modules";
|
|
1043
840
|
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1044
841
|
|
|
1045
842
|
// src/utils/openTransparentWebView.ts
|
|
@@ -1070,29 +867,29 @@ var openTransparentWebView = ({
|
|
|
1070
867
|
}
|
|
1071
868
|
}
|
|
1072
869
|
});
|
|
1073
|
-
|
|
870
|
+
openURL4(url.toString());
|
|
1074
871
|
};
|
|
1075
872
|
|
|
1076
873
|
// src/hooks/useGameCenterProfile.ts
|
|
1077
874
|
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
1078
|
-
const [profileData, setProfileData] =
|
|
1079
|
-
const [isProfileDataLoading, setIsProfileDataLoading] =
|
|
1080
|
-
const [isProfileDataRefetching, setIsProfileDataRefetching] =
|
|
875
|
+
const [profileData, setProfileData] = useState2(void 0);
|
|
876
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = useState2(true);
|
|
877
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = useState2(false);
|
|
1081
878
|
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
1082
879
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1083
880
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1084
|
-
const [isWebviewLoading, setIsWebviewLoading] =
|
|
1085
|
-
const isCompletedProfileFlow =
|
|
1086
|
-
const { openAlert, openConfirm } =
|
|
881
|
+
const [isWebviewLoading, setIsWebviewLoading] = useState2(false);
|
|
882
|
+
const isCompletedProfileFlow = useRef3(false);
|
|
883
|
+
const { openAlert, openConfirm } = useDialog3();
|
|
1087
884
|
const { openGameProfileToast } = useGameProfileToast();
|
|
1088
|
-
const openErrorAlert =
|
|
885
|
+
const openErrorAlert = useCallback4(async () => {
|
|
1089
886
|
await openAlert({
|
|
1090
887
|
title: DEFAULT_ERROR.title,
|
|
1091
888
|
description: DEFAULT_ERROR.description
|
|
1092
889
|
});
|
|
1093
|
-
|
|
890
|
+
closeView2();
|
|
1094
891
|
}, [openAlert]);
|
|
1095
|
-
const openProfileWebview =
|
|
892
|
+
const openProfileWebview = useCallback4(() => {
|
|
1096
893
|
if (isWebviewLoading) {
|
|
1097
894
|
return;
|
|
1098
895
|
}
|
|
@@ -1121,9 +918,9 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1121
918
|
}
|
|
1122
919
|
});
|
|
1123
920
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1124
|
-
const updateAppToSupportedMinVersion =
|
|
921
|
+
const updateAppToSupportedMinVersion = useCallback4(async () => {
|
|
1125
922
|
const upddateConfirmDialogLabel = {
|
|
1126
|
-
title: `${
|
|
923
|
+
title: `${josa2(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1127
924
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
1128
925
|
leftButton: "\uB2EB\uAE30",
|
|
1129
926
|
rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
|
|
@@ -1135,11 +932,11 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1135
932
|
closeOnDimmerClick: true
|
|
1136
933
|
});
|
|
1137
934
|
if (!isConfirmed) {
|
|
1138
|
-
|
|
935
|
+
closeView2();
|
|
1139
936
|
return;
|
|
1140
937
|
}
|
|
1141
938
|
const STORE_SCHEME = getMarketLink();
|
|
1142
|
-
|
|
939
|
+
openURL5(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
1143
940
|
}, [openConfirm]);
|
|
1144
941
|
return {
|
|
1145
942
|
profileData,
|
|
@@ -1168,7 +965,7 @@ var Z_INDEX = {
|
|
|
1168
965
|
};
|
|
1169
966
|
|
|
1170
967
|
// src/components/GameProfile.tsx
|
|
1171
|
-
import { Fragment as
|
|
968
|
+
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1172
969
|
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1173
970
|
const {
|
|
1174
971
|
profileData,
|
|
@@ -1184,10 +981,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1184
981
|
openErrorAlert,
|
|
1185
982
|
openGameProfileToast
|
|
1186
983
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1187
|
-
|
|
984
|
+
useEffect7(() => {
|
|
1188
985
|
try {
|
|
1189
986
|
const getProfileData = async () => {
|
|
1190
|
-
const data = await
|
|
987
|
+
const data = await getGameCenterGameProfile2();
|
|
1191
988
|
setProfileData(data);
|
|
1192
989
|
setIsProfileDataLoading(false);
|
|
1193
990
|
};
|
|
@@ -1197,7 +994,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1197
994
|
setIsProfileDataLoading(false);
|
|
1198
995
|
}
|
|
1199
996
|
}, []);
|
|
1200
|
-
|
|
997
|
+
useEffect7(() => {
|
|
1201
998
|
const handleGameProfileFlow = async () => {
|
|
1202
999
|
if (!canShowBottomSheetOrToast) {
|
|
1203
1000
|
return;
|
|
@@ -1206,7 +1003,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1206
1003
|
return;
|
|
1207
1004
|
}
|
|
1208
1005
|
isCompletedProfileFlow.current = true;
|
|
1209
|
-
if (!
|
|
1006
|
+
if (!isMinVersionSupported3(GAME_CENTER_MIN_VERSION)) {
|
|
1210
1007
|
updateAppToSupportedMinVersion();
|
|
1211
1008
|
return;
|
|
1212
1009
|
}
|
|
@@ -1227,10 +1024,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1227
1024
|
profileData,
|
|
1228
1025
|
updateAppToSupportedMinVersion
|
|
1229
1026
|
]);
|
|
1230
|
-
if (!
|
|
1231
|
-
return /* @__PURE__ */ jsxs2(
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1027
|
+
if (!isMinVersionSupported3(GAME_CENTER_MIN_VERSION)) {
|
|
1028
|
+
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1029
|
+
/* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1030
|
+
/* @__PURE__ */ jsx6(
|
|
1234
1031
|
Pressable,
|
|
1235
1032
|
{
|
|
1236
1033
|
style: {
|
|
@@ -1244,9 +1041,9 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1244
1041
|
] });
|
|
1245
1042
|
}
|
|
1246
1043
|
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1247
|
-
return /* @__PURE__ */ jsxs2(
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1044
|
+
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1045
|
+
/* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1046
|
+
/* @__PURE__ */ jsx6(
|
|
1250
1047
|
View,
|
|
1251
1048
|
{
|
|
1252
1049
|
style: {
|
|
@@ -1255,15 +1052,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1255
1052
|
alignItems: "center",
|
|
1256
1053
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1257
1054
|
},
|
|
1258
|
-
children: /* @__PURE__ */
|
|
1055
|
+
children: /* @__PURE__ */ jsx6(Loader, { size: "large", type: "light" })
|
|
1259
1056
|
}
|
|
1260
1057
|
)
|
|
1261
1058
|
] });
|
|
1262
1059
|
}
|
|
1263
1060
|
if (shouldShowProfileNotFoundOverlay) {
|
|
1264
|
-
return /* @__PURE__ */ jsxs2(
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
shouldShowProfileNotFoundOverlay && /* @__PURE__ */
|
|
1061
|
+
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1062
|
+
/* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1063
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx6(
|
|
1267
1064
|
Pressable,
|
|
1268
1065
|
{
|
|
1269
1066
|
style: {
|
|
@@ -1276,7 +1073,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1276
1073
|
)
|
|
1277
1074
|
] });
|
|
1278
1075
|
}
|
|
1279
|
-
return /* @__PURE__ */
|
|
1076
|
+
return /* @__PURE__ */ jsx6(Fragment5, { children: /* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1280
1077
|
};
|
|
1281
1078
|
var overlayStyle = {
|
|
1282
1079
|
position: "absolute",
|
|
@@ -1287,155 +1084,60 @@ var overlayStyle = {
|
|
|
1287
1084
|
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1288
1085
|
};
|
|
1289
1086
|
|
|
1290
|
-
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1291
|
-
import { SvgXml } from "@react-native-bedrock/native/react-native-svg";
|
|
1292
|
-
import { PageNavbar } from "@toss-design-system/react-native";
|
|
1293
|
-
import { Platform as Platform5, TouchableOpacity, View as View3 } from "react-native";
|
|
1294
|
-
|
|
1295
|
-
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1296
|
-
import { StyleSheet, View as View2 } from "react-native";
|
|
1297
|
-
|
|
1298
|
-
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
1299
|
-
import { Platform as Platform3 } from "react-native";
|
|
1300
|
-
function byPlatform({
|
|
1301
|
-
...props
|
|
1302
|
-
}) {
|
|
1303
|
-
return (props[Platform3.OS] ?? props.fallback)();
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
// src/components/GameWebViewNavigationBar/constants.ts
|
|
1307
|
-
var RIGHT_MARGIN = 24;
|
|
1308
|
-
var IOS_DEFAULT_MARGIN = 20;
|
|
1309
|
-
|
|
1310
|
-
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1311
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1312
|
-
function IOSHeaderRight(props) {
|
|
1313
|
-
return /* @__PURE__ */ jsx4(View2, { style: styles.ios, ...props });
|
|
1314
|
-
}
|
|
1315
|
-
function AndroidHeaderRight(props) {
|
|
1316
|
-
return /* @__PURE__ */ jsx4(View2, { style: styles.android, ...props });
|
|
1317
|
-
}
|
|
1318
|
-
function HeaderRight(props) {
|
|
1319
|
-
return byPlatform({
|
|
1320
|
-
ios: () => /* @__PURE__ */ jsx4(IOSHeaderRight, { ...props }),
|
|
1321
|
-
android: () => /* @__PURE__ */ jsx4(AndroidHeaderRight, { ...props }),
|
|
1322
|
-
fallback: () => /* @__PURE__ */ jsx4(IOSHeaderRight, { ...props })
|
|
1323
|
-
});
|
|
1324
|
-
}
|
|
1325
|
-
var styles = StyleSheet.create({
|
|
1326
|
-
ios: {
|
|
1327
|
-
marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
|
|
1328
|
-
flexDirection: "row"
|
|
1329
|
-
},
|
|
1330
|
-
android: {
|
|
1331
|
-
flexDirection: "row"
|
|
1332
|
-
}
|
|
1333
|
-
});
|
|
1334
|
-
|
|
1335
|
-
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
1336
|
-
import { useSafeAreaInsets } from "@react-native-bedrock/native/react-native-safe-area-context";
|
|
1337
|
-
import { Platform as Platform4 } from "react-native";
|
|
1338
|
-
function useSafeAreaTop() {
|
|
1339
|
-
const safeAreaInsets = useSafeAreaInsets();
|
|
1340
|
-
const hasDynamicIsland = Platform4.OS === "ios" && safeAreaInsets.top > 50;
|
|
1341
|
-
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
1342
|
-
return safeAreaTop;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1346
|
-
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1347
|
-
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
|
-
function GameNavigationBar({ onClose }) {
|
|
1349
|
-
const safeAreaTop = useSafeAreaTop();
|
|
1350
|
-
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
1351
|
-
/* @__PURE__ */ jsx5(PageNavbar, { preference: { type: "none" } }),
|
|
1352
|
-
/* @__PURE__ */ jsx5(
|
|
1353
|
-
View3,
|
|
1354
|
-
{
|
|
1355
|
-
style: {
|
|
1356
|
-
width: "100%",
|
|
1357
|
-
height: Platform5.OS === "ios" ? 44 : 54,
|
|
1358
|
-
flexDirection: "row",
|
|
1359
|
-
alignItems: "center",
|
|
1360
|
-
justifyContent: "flex-end",
|
|
1361
|
-
position: "absolute",
|
|
1362
|
-
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1363
|
-
marginTop: safeAreaTop,
|
|
1364
|
-
paddingRight: Platform5.OS === "ios" ? 10 : 8
|
|
1365
|
-
},
|
|
1366
|
-
pointerEvents: "box-none",
|
|
1367
|
-
children: /* @__PURE__ */ jsx5(HeaderRight, { children: /* @__PURE__ */ jsx5(
|
|
1368
|
-
TouchableOpacity,
|
|
1369
|
-
{
|
|
1370
|
-
hitSlop: { left: 8, right: 8 },
|
|
1371
|
-
accessibilityRole: "button",
|
|
1372
|
-
accessible: true,
|
|
1373
|
-
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
1374
|
-
style: {
|
|
1375
|
-
padding: Platform5.OS === "ios" ? 7 : 9
|
|
1376
|
-
},
|
|
1377
|
-
onPress: onClose,
|
|
1378
|
-
children: /* @__PURE__ */ jsx5(SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
1379
|
-
}
|
|
1380
|
-
) })
|
|
1381
|
-
}
|
|
1382
|
-
)
|
|
1383
|
-
] });
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
1087
|
// src/components/GameWebView.tsx
|
|
1387
|
-
import { Fragment as
|
|
1088
|
+
import { Fragment as Fragment6, jsx as jsx7 } from "react/jsx-runtime";
|
|
1388
1089
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
const handleClose = useCallback3(async () => {
|
|
1394
|
-
const isConfirmed = await openConfirm({
|
|
1395
|
-
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1396
|
-
leftButton: "\uCDE8\uC18C",
|
|
1397
|
-
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1398
|
-
closeOnDimmerClick: true
|
|
1399
|
-
});
|
|
1400
|
-
if (isConfirmed) {
|
|
1401
|
-
captureExitLog(Date.now());
|
|
1402
|
-
closeView2();
|
|
1403
|
-
}
|
|
1404
|
-
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1405
|
-
useEffect5(() => {
|
|
1406
|
-
if (Platform6.OS === "ios") {
|
|
1407
|
-
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
1090
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = useState3(false);
|
|
1091
|
+
useEffect8(() => {
|
|
1092
|
+
if (Platform2.OS === "ios") {
|
|
1093
|
+
setIosSwipeGestureEnabled2({ isEnabled: false });
|
|
1408
1094
|
return () => {
|
|
1409
|
-
|
|
1095
|
+
setIosSwipeGestureEnabled2({ isEnabled: true });
|
|
1410
1096
|
};
|
|
1411
1097
|
}
|
|
1412
1098
|
return;
|
|
1413
1099
|
}, []);
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
handleClose();
|
|
1417
|
-
return true;
|
|
1418
|
-
};
|
|
1419
|
-
BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
1420
|
-
return () => {
|
|
1421
|
-
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1422
|
-
};
|
|
1423
|
-
}, [handleClose]);
|
|
1424
|
-
useEffect5(() => {
|
|
1425
|
-
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1100
|
+
useEffect8(() => {
|
|
1101
|
+
appsInTossEvent3.addEventListener("entryMessageExited", {
|
|
1426
1102
|
onEvent: () => {
|
|
1427
1103
|
setIsEntryMessageExited(true);
|
|
1428
1104
|
}
|
|
1429
1105
|
});
|
|
1430
1106
|
}, []);
|
|
1431
|
-
return /* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */ jsx6(GameNavigationBar, { onClose: handleClose }),
|
|
1433
|
-
getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx6(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx6(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx6(PlainWebView, { ref, ...props })
|
|
1434
|
-
] });
|
|
1107
|
+
return /* @__PURE__ */ jsx7(Fragment6, { children: getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx7(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx7(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx7(PlainWebView, { ref, ...props }) });
|
|
1435
1108
|
});
|
|
1436
1109
|
|
|
1110
|
+
// src/components/PartnerWebView.tsx
|
|
1111
|
+
import {
|
|
1112
|
+
WebView as PlainWebView2
|
|
1113
|
+
} from "@granite-js/native/react-native-webview";
|
|
1114
|
+
import { forwardRef as forwardRef2, useRef as useRef4 } from "react";
|
|
1115
|
+
|
|
1116
|
+
// src/core/utils/mergeRefs.ts
|
|
1117
|
+
function mergeRefs(...refs) {
|
|
1118
|
+
return (value) => {
|
|
1119
|
+
refs.forEach((ref) => {
|
|
1120
|
+
if (typeof ref === "function") {
|
|
1121
|
+
ref(value);
|
|
1122
|
+
} else if (ref != null) {
|
|
1123
|
+
ref.current = value;
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// src/components/PartnerWebView.tsx
|
|
1130
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1131
|
+
var PartnerWebView = forwardRef2(
|
|
1132
|
+
function PartnerWebViewScreen(webViewProps, ref) {
|
|
1133
|
+
const webViewRef = useRef4(null);
|
|
1134
|
+
const refs = mergeRefs(ref, webViewRef);
|
|
1135
|
+
return /* @__PURE__ */ jsx8(PlainWebView2, { ref: refs, ...webViewProps, style: { flex: 1 } });
|
|
1136
|
+
}
|
|
1137
|
+
);
|
|
1138
|
+
|
|
1437
1139
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1438
|
-
import { useCallback as
|
|
1140
|
+
import { useCallback as useCallback5, useMemo as useMemo2, useRef as useRef5 } from "react";
|
|
1439
1141
|
function serializeError(error) {
|
|
1440
1142
|
return JSON.stringify(error, (_, value) => {
|
|
1441
1143
|
if (value instanceof Error) {
|
|
@@ -1467,12 +1169,12 @@ function methodHandler({
|
|
|
1467
1169
|
};
|
|
1468
1170
|
wrappedFunc(...args).then((result) => {
|
|
1469
1171
|
injectJavaScript?.(`
|
|
1470
|
-
window.
|
|
1172
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
|
|
1471
1173
|
`);
|
|
1472
1174
|
}).catch((error) => {
|
|
1473
1175
|
const serializedError = serializeError(error);
|
|
1474
1176
|
injectJavaScript?.(`
|
|
1475
|
-
window.
|
|
1177
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
|
|
1476
1178
|
`);
|
|
1477
1179
|
});
|
|
1478
1180
|
}
|
|
@@ -1484,7 +1186,7 @@ function useBridgeHandler({
|
|
|
1484
1186
|
eventListenerMap,
|
|
1485
1187
|
injectedJavaScript: originalInjectedJavaScript
|
|
1486
1188
|
}) {
|
|
1487
|
-
const ref =
|
|
1189
|
+
const ref = useRef5(null);
|
|
1488
1190
|
const injectedJavaScript = useMemo2(
|
|
1489
1191
|
() => [
|
|
1490
1192
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
@@ -1503,15 +1205,15 @@ function useBridgeHandler({
|
|
|
1503
1205
|
);
|
|
1504
1206
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
1505
1207
|
ref.current?.injectJavaScript(`
|
|
1506
|
-
window.
|
|
1208
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
1507
1209
|
`);
|
|
1508
1210
|
};
|
|
1509
1211
|
const createHandleOnError = (functionName, eventId) => (error) => {
|
|
1510
1212
|
ref.current?.injectJavaScript(`
|
|
1511
|
-
window.
|
|
1213
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1512
1214
|
`);
|
|
1513
1215
|
};
|
|
1514
|
-
const $onMessage =
|
|
1216
|
+
const $onMessage = useCallback5(
|
|
1515
1217
|
async (e) => {
|
|
1516
1218
|
onMessage?.(e);
|
|
1517
1219
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1561,24 +1263,9 @@ function useBridgeHandler({
|
|
|
1561
1263
|
};
|
|
1562
1264
|
}
|
|
1563
1265
|
|
|
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
1266
|
// src/hooks/useCreateUserAgent.ts
|
|
1267
|
+
import { getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
|
|
1580
1268
|
import { useWindowDimensions } from "react-native";
|
|
1581
|
-
import { getPlatformOS } from "react-native-bedrock";
|
|
1582
1269
|
var FontA11yCategory = {
|
|
1583
1270
|
Large: "Large",
|
|
1584
1271
|
xLarge: "xLarge",
|
|
@@ -1733,12 +1420,13 @@ function useCreateUserAgent({
|
|
|
1733
1420
|
}
|
|
1734
1421
|
|
|
1735
1422
|
// src/hooks/useGeolocation.ts
|
|
1736
|
-
import {
|
|
1737
|
-
import { useVisibility as useVisibility3 } from "react-native
|
|
1423
|
+
import { startUpdateLocation } from "@apps-in-toss/native-modules";
|
|
1424
|
+
import { useVisibility as useVisibility3 } from "@granite-js/react-native";
|
|
1425
|
+
import { useState as useState4, useEffect as useEffect9 } from "react";
|
|
1738
1426
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1739
1427
|
const isVisible = useVisibility3();
|
|
1740
|
-
const [location, setLocation] =
|
|
1741
|
-
|
|
1428
|
+
const [location, setLocation] = useState4(null);
|
|
1429
|
+
useEffect9(() => {
|
|
1742
1430
|
if (!isVisible) {
|
|
1743
1431
|
return;
|
|
1744
1432
|
}
|
|
@@ -1756,7 +1444,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1756
1444
|
}
|
|
1757
1445
|
|
|
1758
1446
|
// src/utils/log.ts
|
|
1759
|
-
import {
|
|
1447
|
+
import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
|
|
1448
|
+
import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
|
|
1760
1449
|
|
|
1761
1450
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1762
1451
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1800,16 +1489,15 @@ var trackScreen = (url) => {
|
|
|
1800
1489
|
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1801
1490
|
}
|
|
1802
1491
|
};
|
|
1803
|
-
return
|
|
1492
|
+
return eventLogNative(log);
|
|
1804
1493
|
};
|
|
1805
1494
|
|
|
1806
1495
|
// src/components/WebView.tsx
|
|
1807
|
-
import { jsx as
|
|
1808
|
-
var
|
|
1809
|
-
var operationalEnvironment = getOperationalEnvironment();
|
|
1496
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1497
|
+
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1810
1498
|
var TYPES = ["partner", "external", "game"];
|
|
1811
1499
|
var WEBVIEW_TYPES = {
|
|
1812
|
-
partner:
|
|
1500
|
+
partner: PartnerWebView,
|
|
1813
1501
|
external: ExternalWebViewScreen,
|
|
1814
1502
|
game: GameWebView
|
|
1815
1503
|
};
|
|
@@ -1839,12 +1527,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1839
1527
|
if (!TYPES.includes(type)) {
|
|
1840
1528
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1841
1529
|
}
|
|
1842
|
-
const
|
|
1530
|
+
const graniteEvent = useGraniteEvent();
|
|
1843
1531
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1844
|
-
const top =
|
|
1532
|
+
const top = useSafeAreaTop();
|
|
1845
1533
|
const bottom = useSafeAreaBottom();
|
|
1846
1534
|
const global2 = getAppsInTossGlobals();
|
|
1847
|
-
const
|
|
1535
|
+
const topNavigation = useTopNavigation();
|
|
1848
1536
|
const disableTextSelectionCSS = `
|
|
1849
1537
|
(function() {
|
|
1850
1538
|
const style = document.createElement('style');
|
|
@@ -1852,7 +1540,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1852
1540
|
document.head.appendChild(style);
|
|
1853
1541
|
})();
|
|
1854
1542
|
`;
|
|
1855
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] =
|
|
1543
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState5(
|
|
1856
1544
|
props.allowsBackForwardNavigationGestures
|
|
1857
1545
|
);
|
|
1858
1546
|
const handler = useBridgeHandler({
|
|
@@ -1860,25 +1548,25 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1860
1548
|
injectedJavaScript: [disableTextSelectionCSS].join("\n"),
|
|
1861
1549
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1862
1550
|
eventListenerMap: {
|
|
1863
|
-
...
|
|
1864
|
-
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", {
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
}),
|
|
1868
|
-
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1869
|
-
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1870
|
-
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1551
|
+
...appsInTossEventBridges,
|
|
1552
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
|
|
1553
|
+
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1554
|
+
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent4.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1555
|
+
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1871
1556
|
/** @internal */
|
|
1872
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
1557
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1873
1558
|
/** AdMob */
|
|
1874
1559
|
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1875
1560
|
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
1876
1561
|
loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
|
|
1877
|
-
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
|
|
1562
|
+
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd,
|
|
1563
|
+
/** AdMobV2 */
|
|
1564
|
+
loadAppsInTossAdMob: GoogleAdMob.loadAppsInTossAdMob,
|
|
1565
|
+
showAppsInTossAdMob: GoogleAdMob.showAppsInTossAdMob
|
|
1878
1566
|
},
|
|
1879
1567
|
constantHandlerMap: {
|
|
1880
|
-
...
|
|
1881
|
-
...
|
|
1568
|
+
...graniteConstantBridges,
|
|
1569
|
+
...appsInTossConstantBridges,
|
|
1882
1570
|
getSafeAreaTop: () => top,
|
|
1883
1571
|
getSafeAreaBottom: () => bottom,
|
|
1884
1572
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
@@ -1887,18 +1575,21 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1887
1575
|
showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
1888
1576
|
loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
|
|
1889
1577
|
showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
|
|
1578
|
+
/** AdMobV2 */
|
|
1579
|
+
loadAppsInTossAdMob_isSupported: GoogleAdMob.loadAppsInTossAdMob.isSupported,
|
|
1580
|
+
showAppsInTossAdMob_isSupported: GoogleAdMob.showAppsInTossAdMob.isSupported,
|
|
1890
1581
|
/** env */
|
|
1891
1582
|
getDeploymentId: env.getDeploymentId
|
|
1892
1583
|
},
|
|
1893
1584
|
asyncHandlerMap: {
|
|
1894
|
-
...
|
|
1895
|
-
...
|
|
1585
|
+
...graniteAsyncBridges,
|
|
1586
|
+
...appsInTossAsyncBridges,
|
|
1896
1587
|
setIosSwipeGestureEnabled: (options) => {
|
|
1897
1588
|
setAllowsBackForwardNavigationGestures(options.isEnabled);
|
|
1898
|
-
return
|
|
1589
|
+
return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
|
|
1899
1590
|
},
|
|
1900
|
-
addAccessoryButton: async (params) =>
|
|
1901
|
-
removeAccessoryButton: async () =>
|
|
1591
|
+
addAccessoryButton: async (params) => topNavigation.addAccessoryButton(params),
|
|
1592
|
+
removeAccessoryButton: async () => topNavigation.removeAccessoryButton(),
|
|
1902
1593
|
/** internal */
|
|
1903
1594
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
1904
1595
|
/** Storage */
|
|
@@ -1911,37 +1602,25 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1911
1602
|
iapGetProductItemList: IAP.getProductItemList
|
|
1912
1603
|
}
|
|
1913
1604
|
});
|
|
1914
|
-
const
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
}
|
|
1926
|
-
case "external": {
|
|
1927
|
-
const headerOnlyProp = {
|
|
1928
|
-
header: {
|
|
1929
|
-
..."header" in props ? props.header : {},
|
|
1930
|
-
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
1931
|
-
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
1932
|
-
}
|
|
1933
|
-
};
|
|
1934
|
-
return headerOnlyProp;
|
|
1935
|
-
}
|
|
1936
|
-
default: {
|
|
1937
|
-
return {};
|
|
1938
|
-
}
|
|
1605
|
+
const headerPropForExternalWebView = useMemo3(() => {
|
|
1606
|
+
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
1607
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1608
|
+
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1609
|
+
if (type === "external" && initialAccessoryButton != null) {
|
|
1610
|
+
return {
|
|
1611
|
+
header: {
|
|
1612
|
+
withBackButton,
|
|
1613
|
+
title: initialAccessoryButton.title,
|
|
1614
|
+
icon: initialAccessoryButton.icon
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1939
1617
|
}
|
|
1940
|
-
|
|
1618
|
+
return {};
|
|
1619
|
+
}, [global2.navigationBar, type]);
|
|
1941
1620
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1942
1621
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1943
|
-
const [canHistoryGoBack, setCanHistoryGoBack] =
|
|
1944
|
-
const handleNavigationStateChange =
|
|
1622
|
+
const [canHistoryGoBack, setCanHistoryGoBack] = useState5(false);
|
|
1623
|
+
const handleNavigationStateChange = useCallback6(
|
|
1945
1624
|
(event) => {
|
|
1946
1625
|
if (event.url) {
|
|
1947
1626
|
trackScreen(event.url);
|
|
@@ -1953,7 +1632,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1953
1632
|
const userAgent = useCreateUserAgent({
|
|
1954
1633
|
colorPreference: "light"
|
|
1955
1634
|
});
|
|
1956
|
-
const handleBackEvent =
|
|
1635
|
+
const handleBackEvent = useCallback6(() => {
|
|
1957
1636
|
if (canHistoryGoBack) {
|
|
1958
1637
|
handler.ref.current?.goBack();
|
|
1959
1638
|
return true;
|
|
@@ -1961,16 +1640,28 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1961
1640
|
return false;
|
|
1962
1641
|
}
|
|
1963
1642
|
}, [canHistoryGoBack, handler]);
|
|
1964
|
-
|
|
1643
|
+
useEffect10(() => {
|
|
1965
1644
|
BackHandler2.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1966
1645
|
return () => BackHandler2.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
1967
1646
|
}, [handleBackEvent]);
|
|
1968
|
-
|
|
1647
|
+
useEffect10(() => {
|
|
1648
|
+
return appsInTossEvent4.addEventListener("homeIconButtonClickEvent", {
|
|
1649
|
+
onEvent: () => {
|
|
1650
|
+
handler.ref?.current?.injectJavaScript(`
|
|
1651
|
+
(function() {
|
|
1652
|
+
window.history.replaceState(null, '', '/');
|
|
1653
|
+
true;
|
|
1654
|
+
})();
|
|
1655
|
+
`);
|
|
1656
|
+
}
|
|
1657
|
+
});
|
|
1658
|
+
}, [handler.ref]);
|
|
1659
|
+
return /* @__PURE__ */ jsx9(
|
|
1969
1660
|
BaseWebView,
|
|
1970
1661
|
{
|
|
1971
1662
|
ref: handler.ref,
|
|
1972
1663
|
...props,
|
|
1973
|
-
...
|
|
1664
|
+
...headerPropForExternalWebView,
|
|
1974
1665
|
source: {
|
|
1975
1666
|
uri,
|
|
1976
1667
|
// NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
|
|
@@ -1978,7 +1669,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1978
1669
|
"User-Agent": userAgent
|
|
1979
1670
|
}
|
|
1980
1671
|
},
|
|
1981
|
-
userAgent:
|
|
1672
|
+
userAgent: Platform3.OS === "ios" ? userAgent : void 0,
|
|
1982
1673
|
sharedCookiesEnabled: true,
|
|
1983
1674
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1984
1675
|
thirdPartyCookiesEnabled: true,
|
|
@@ -1986,31 +1677,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1986
1677
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1987
1678
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1988
1679
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1989
|
-
decelerationRate:
|
|
1680
|
+
decelerationRate: Platform3.OS === "ios" ? 1 : void 0,
|
|
1990
1681
|
allowsBackForwardNavigationGestures
|
|
1991
1682
|
}
|
|
1992
1683
|
);
|
|
1993
1684
|
}
|
|
1994
|
-
function ensureValue(value, name) {
|
|
1995
|
-
if (value === void 0) {
|
|
1996
|
-
throw new Error(`${name} is required`);
|
|
1997
|
-
}
|
|
1998
|
-
return value;
|
|
1999
|
-
}
|
|
2000
|
-
|
|
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
1685
|
|
|
2012
1686
|
// src/index.ts
|
|
2013
1687
|
export * from "@apps-in-toss/analytics";
|
|
1688
|
+
import { useTopNavigation as useTopNavigation2 } from "@toss-design-system/react-native/private";
|
|
1689
|
+
export * from "@apps-in-toss/native-modules";
|
|
2014
1690
|
var Analytics2 = {
|
|
2015
1691
|
init: InternalAnalytics.init,
|
|
2016
1692
|
Impression: InternalAnalytics.Impression,
|
|
@@ -2018,37 +1694,12 @@ var Analytics2 = {
|
|
|
2018
1694
|
Area: InternalAnalytics.Area
|
|
2019
1695
|
};
|
|
2020
1696
|
export {
|
|
2021
|
-
Accuracy2 as Accuracy,
|
|
2022
1697
|
Analytics2 as Analytics,
|
|
2023
1698
|
AppsInToss,
|
|
2024
|
-
GoogleAdMob,
|
|
2025
|
-
IAP,
|
|
2026
1699
|
INTERNAL__onVisibilityChangedByTransparentServiceWeb,
|
|
2027
|
-
Storage,
|
|
2028
|
-
TossPay,
|
|
2029
1700
|
WebView,
|
|
2030
|
-
appLogin,
|
|
2031
|
-
appsInTossEvent,
|
|
2032
|
-
contactsViral,
|
|
2033
1701
|
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
1702
|
useCreateUserAgent,
|
|
2053
|
-
useGeolocation
|
|
1703
|
+
useGeolocation,
|
|
1704
|
+
useTopNavigation2 as useTopNavigation
|
|
2054
1705
|
};
|