@apps-in-toss/framework 2.4.1 → 2.4.3
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/index.cjs +476 -521
- package/dist/index.js +242 -289
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -17,15 +17,14 @@ import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
|
17
17
|
|
|
18
18
|
// src/core/registerApp.tsx
|
|
19
19
|
import { Analytics } from "@apps-in-toss/analytics";
|
|
20
|
-
import { isMinVersionSupported as isMinVersionSupported3, setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, eventLog, getSchemeUri as getSchemeUri5 } from "@apps-in-toss/native-modules";
|
|
21
|
-
import { Granite as
|
|
20
|
+
import { isMinVersionSupported as isMinVersionSupported3, setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, eventLog as eventLog2, getSchemeUri as getSchemeUri5 } from "@apps-in-toss/native-modules";
|
|
21
|
+
import { Granite as Granite6 } from "@granite-js/react-native";
|
|
22
22
|
import { TDSProvider } from "@toss/tds-react-native";
|
|
23
23
|
import { AppRegistry } from "react-native";
|
|
24
24
|
|
|
25
25
|
// src/core/components/AppEvent.tsx
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { useEffect as useEffect2 } from "react";
|
|
26
|
+
import { Granite, getSchemeUri as getSchemeUri2 } from "@granite-js/react-native";
|
|
27
|
+
import { useEffect } from "react";
|
|
29
28
|
|
|
30
29
|
// src/env.ts
|
|
31
30
|
var env = {
|
|
@@ -34,132 +33,60 @@ var env = {
|
|
|
34
33
|
getAppName: () => global.__granite.app.name
|
|
35
34
|
};
|
|
36
35
|
|
|
37
|
-
// src/hooks/useCaptureExitLog.ts
|
|
38
|
-
import { INTERNAL__module } from "@apps-in-toss/native-modules";
|
|
39
|
-
import { Granite, useVisibility } from "@granite-js/react-native";
|
|
40
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
41
|
-
|
|
42
|
-
// src/core/hooks/useReferrer.ts
|
|
43
|
-
import { getSchemeUri } from "@granite-js/react-native";
|
|
44
|
-
import { useMemo } from "react";
|
|
45
|
-
function useReferrer() {
|
|
46
|
-
return useMemo(() => {
|
|
47
|
-
try {
|
|
48
|
-
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
49
|
-
} catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}, []);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
36
|
// src/utils/isPrivateScheme.ts
|
|
56
|
-
import { getSchemeUri
|
|
37
|
+
import { getSchemeUri } from "@granite-js/react-native";
|
|
57
38
|
function isPrivateScheme() {
|
|
58
39
|
try {
|
|
59
|
-
return new URL(
|
|
40
|
+
return new URL(getSchemeUri()).protocol === "intoss-private:";
|
|
60
41
|
} catch {
|
|
61
42
|
return false;
|
|
62
43
|
}
|
|
63
44
|
}
|
|
64
45
|
|
|
65
|
-
// src/
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
46
|
+
// src/utils/sendLog.ts
|
|
47
|
+
import { INTERNAL__module, eventLog } from "@apps-in-toss/native-modules";
|
|
48
|
+
var DEFAULT_PIPELINES = ["core", "partner"];
|
|
49
|
+
function sendLog(logData, options) {
|
|
50
|
+
const { pipelines = DEFAULT_PIPELINES } = options ?? {};
|
|
51
|
+
if (pipelines.includes("core")) {
|
|
52
|
+
INTERNAL__module.tossCoreEventLog(logData);
|
|
53
|
+
}
|
|
54
|
+
if (pipelines.includes("partner")) {
|
|
55
|
+
eventLog(logData);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/core/components/AppEvent.tsx
|
|
60
|
+
function SystemAppEvent({ ...initialProps }) {
|
|
72
61
|
useEffect(() => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const captureExitLog = useCallback(
|
|
78
|
-
(exitTime) => {
|
|
79
|
-
if (enterTime.current == null) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
83
|
-
INTERNAL__module.tossCoreEventLog({
|
|
84
|
-
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
85
|
-
log_type: "event",
|
|
62
|
+
sendLog(
|
|
63
|
+
{
|
|
64
|
+
log_name: "AppsInTossInitialProps",
|
|
65
|
+
log_type: "debug",
|
|
86
66
|
params: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
referrer,
|
|
67
|
+
...initialProps,
|
|
68
|
+
schemeUri: getSchemeUri2(),
|
|
90
69
|
deployment_id: env.getDeploymentId(),
|
|
91
70
|
app_name: Granite.appName,
|
|
92
|
-
is_private: isPrivateScheme()
|
|
93
|
-
stay_time: stayTime.toString(),
|
|
94
|
-
exit_time: exitTime.toString()
|
|
71
|
+
is_private: isPrivateScheme()
|
|
95
72
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[referrer]
|
|
100
|
-
);
|
|
101
|
-
return { captureExitLog };
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// src/core/components/AppEvent.tsx
|
|
105
|
-
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
106
|
-
function EntryAppEvent() {
|
|
107
|
-
const referrer = useReferrer() ?? "";
|
|
108
|
-
useEffect2(() => {
|
|
109
|
-
INTERNAL__module2.tossCoreEventLog({
|
|
110
|
-
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
111
|
-
log_type: "info",
|
|
112
|
-
params: {
|
|
113
|
-
is_transform: true,
|
|
114
|
-
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
115
|
-
referrer,
|
|
116
|
-
deployment_id: env.getDeploymentId(),
|
|
117
|
-
app_name: Granite2.appName,
|
|
118
|
-
is_private: isPrivateScheme()
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}, [referrer]);
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
function SystemAppEvent({ ...initialProps }) {
|
|
125
|
-
useEffect2(() => {
|
|
126
|
-
INTERNAL__module2.tossCoreEventLog({
|
|
127
|
-
log_name: "AppsInTossInitialProps",
|
|
128
|
-
log_type: "debug",
|
|
129
|
-
params: {
|
|
130
|
-
...initialProps,
|
|
131
|
-
schemeUri: getSchemeUri3(),
|
|
132
|
-
deployment_id: env.getDeploymentId(),
|
|
133
|
-
app_name: Granite2.appName,
|
|
134
|
-
is_private: isPrivateScheme()
|
|
135
|
-
}
|
|
136
|
-
});
|
|
73
|
+
},
|
|
74
|
+
{ pipelines: ["core"] }
|
|
75
|
+
);
|
|
137
76
|
}, [initialProps]);
|
|
138
77
|
return null;
|
|
139
78
|
}
|
|
140
|
-
function StayTimeAppEvent() {
|
|
141
|
-
const visible = useVisibility2();
|
|
142
|
-
const { captureExitLog } = useCaptureExitLog();
|
|
143
|
-
useEffect2(() => {
|
|
144
|
-
if (visible === false) {
|
|
145
|
-
captureExitLog(Date.now());
|
|
146
|
-
}
|
|
147
|
-
}, [visible, captureExitLog]);
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
79
|
var AppEvent = {
|
|
151
|
-
|
|
152
|
-
System: SystemAppEvent,
|
|
153
|
-
StayTime: StayTimeAppEvent
|
|
80
|
+
System: SystemAppEvent
|
|
154
81
|
};
|
|
155
82
|
|
|
156
83
|
// src/core/components/AppUpdate.tsx
|
|
157
84
|
import { openURL } from "@granite-js/react-native";
|
|
158
|
-
import { useEffect as
|
|
85
|
+
import { useEffect as useEffect2 } from "react";
|
|
159
86
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
160
87
|
var UPDATE_SCHEME = "servicetoss://update/forced/j?updateType=required";
|
|
161
88
|
function AppUpdate() {
|
|
162
|
-
|
|
89
|
+
useEffect2(() => {
|
|
163
90
|
openURL(`supertoss://closePage?url=${UPDATE_SCHEME}`);
|
|
164
91
|
}, []);
|
|
165
92
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
@@ -221,7 +148,7 @@ function useNavigationBarContext() {
|
|
|
221
148
|
|
|
222
149
|
// src/components/RNAppContainer.tsx
|
|
223
150
|
import { setIosSwipeGestureEnabled } from "@apps-in-toss/native-modules";
|
|
224
|
-
import { useEffect as
|
|
151
|
+
import { useEffect as useEffect7 } from "react";
|
|
225
152
|
import { Platform as Platform3 } from "react-native";
|
|
226
153
|
|
|
227
154
|
// src/components/GameInitializer.tsx
|
|
@@ -229,7 +156,7 @@ import { isMinVersionSupported } from "@apps-in-toss/native-modules";
|
|
|
229
156
|
import { closeView as closeView2 } from "@granite-js/react-native";
|
|
230
157
|
import { Loader } from "@toss/tds-react-native";
|
|
231
158
|
import { josa } from "es-hangul";
|
|
232
|
-
import { useEffect as
|
|
159
|
+
import { useEffect as useEffect3, useRef } from "react";
|
|
233
160
|
import { Pressable, View } from "react-native";
|
|
234
161
|
|
|
235
162
|
// src/constant/game-center.ts
|
|
@@ -240,10 +167,22 @@ var GAME_MIN_VERSION = {
|
|
|
240
167
|
};
|
|
241
168
|
|
|
242
169
|
// src/hooks/useAppUpdateDialog.tsx
|
|
243
|
-
import {
|
|
244
|
-
import { Granite as Granite3, openURL as openURL2 } from "@granite-js/react-native";
|
|
170
|
+
import { Granite as Granite2, openURL as openURL2 } from "@granite-js/react-native";
|
|
245
171
|
import { useDialog } from "@toss/tds-react-native";
|
|
246
|
-
import { useCallback
|
|
172
|
+
import { useCallback } from "react";
|
|
173
|
+
|
|
174
|
+
// src/core/hooks/useReferrer.ts
|
|
175
|
+
import { getSchemeUri as getSchemeUri3 } from "@granite-js/react-native";
|
|
176
|
+
import { useMemo } from "react";
|
|
177
|
+
function useReferrer() {
|
|
178
|
+
return useMemo(() => {
|
|
179
|
+
try {
|
|
180
|
+
return new URL(getSchemeUri3()).searchParams.get("referrer");
|
|
181
|
+
} catch {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}, []);
|
|
185
|
+
}
|
|
247
186
|
|
|
248
187
|
// src/utils/market.ts
|
|
249
188
|
import { Platform } from "react-native";
|
|
@@ -257,7 +196,7 @@ var getMarketLink = () => {
|
|
|
257
196
|
function useAppUpdateDialog() {
|
|
258
197
|
const { openConfirm } = useDialog();
|
|
259
198
|
const logging = useAppUpdateDialogLogging();
|
|
260
|
-
const openAppUpdateDialog =
|
|
199
|
+
const openAppUpdateDialog = useCallback(
|
|
261
200
|
async ({
|
|
262
201
|
title,
|
|
263
202
|
description,
|
|
@@ -296,10 +235,10 @@ function useAppUpdateDialogLogging() {
|
|
|
296
235
|
const referrer = useReferrer();
|
|
297
236
|
const baseParams = {
|
|
298
237
|
referrer,
|
|
299
|
-
app_name:
|
|
238
|
+
app_name: Granite2.appName
|
|
300
239
|
};
|
|
301
240
|
const logUpdateClick = () => {
|
|
302
|
-
|
|
241
|
+
sendLog({
|
|
303
242
|
log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
|
|
304
243
|
log_type: "event",
|
|
305
244
|
params: {
|
|
@@ -311,7 +250,7 @@ function useAppUpdateDialogLogging() {
|
|
|
311
250
|
});
|
|
312
251
|
};
|
|
313
252
|
const logCloseClick = () => {
|
|
314
|
-
|
|
253
|
+
sendLog({
|
|
315
254
|
log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
|
|
316
255
|
log_type: "event",
|
|
317
256
|
params: {
|
|
@@ -323,7 +262,7 @@ function useAppUpdateDialogLogging() {
|
|
|
323
262
|
});
|
|
324
263
|
};
|
|
325
264
|
const logDialogShow = () => {
|
|
326
|
-
|
|
265
|
+
sendLog({
|
|
327
266
|
log_name: UPDATE_DIALOG_LOG_NAME,
|
|
328
267
|
log_type: "popup",
|
|
329
268
|
params: {
|
|
@@ -337,12 +276,12 @@ function useAppUpdateDialogLogging() {
|
|
|
337
276
|
|
|
338
277
|
// src/hooks/useGameCenterProfile.ts
|
|
339
278
|
import { getGameCenterGameProfile } from "@apps-in-toss/native-modules";
|
|
340
|
-
import { useCallback as
|
|
279
|
+
import { useCallback as useCallback5, useState as useState3 } from "react";
|
|
341
280
|
|
|
342
281
|
// src/hooks/useErrorAlert.ts
|
|
343
282
|
import { closeView } from "@granite-js/react-native";
|
|
344
283
|
import { useDialog as useDialog2 } from "@toss/tds-react-native";
|
|
345
|
-
import { useCallback as
|
|
284
|
+
import { useCallback as useCallback2 } from "react";
|
|
346
285
|
|
|
347
286
|
// src/utils/error.ts
|
|
348
287
|
var DEFAULT_ERROR = {
|
|
@@ -353,7 +292,7 @@ var DEFAULT_ERROR = {
|
|
|
353
292
|
// src/hooks/useErrorAlert.ts
|
|
354
293
|
var useErrorAlert = () => {
|
|
355
294
|
const { openAlert } = useDialog2();
|
|
356
|
-
const openErrorAlert =
|
|
295
|
+
const openErrorAlert = useCallback2(async () => {
|
|
357
296
|
await openAlert({
|
|
358
297
|
title: DEFAULT_ERROR.title,
|
|
359
298
|
description: DEFAULT_ERROR.description
|
|
@@ -364,7 +303,7 @@ var useErrorAlert = () => {
|
|
|
364
303
|
};
|
|
365
304
|
|
|
366
305
|
// src/hooks/useTransparentWebview.tsx
|
|
367
|
-
import { useCallback as
|
|
306
|
+
import { useCallback as useCallback3, useState as useState2 } from "react";
|
|
368
307
|
|
|
369
308
|
// src/utils/openTransparentWebView.ts
|
|
370
309
|
import { openURL as openURL3 } from "@granite-js/react-native";
|
|
@@ -408,7 +347,7 @@ var openTransparentWebView = ({
|
|
|
408
347
|
var useTransparentWebview = () => {
|
|
409
348
|
const [isWebviewLoading, setIsWebviewLoading] = useState2(false);
|
|
410
349
|
const { open: openErrorAlert } = useErrorAlert();
|
|
411
|
-
const _openTransparentWebview =
|
|
350
|
+
const _openTransparentWebview = useCallback3(
|
|
412
351
|
({ webUrl, onClose, onError }) => {
|
|
413
352
|
if (isWebviewLoading) {
|
|
414
353
|
return;
|
|
@@ -442,11 +381,11 @@ var useTransparentWebview = () => {
|
|
|
442
381
|
// src/components/GameProfileToast.tsx
|
|
443
382
|
import { Asset, Toast } from "@toss/tds-react-native";
|
|
444
383
|
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay } from "@toss/tds-react-native/private";
|
|
445
|
-
import { useCallback as
|
|
384
|
+
import { useCallback as useCallback4 } from "react";
|
|
446
385
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
447
386
|
var useGameProfileToast = () => {
|
|
448
387
|
const overlay = useOverlay();
|
|
449
|
-
const openGameProfileToast =
|
|
388
|
+
const openGameProfileToast = useCallback4(
|
|
450
389
|
(nickname, profileImageUri) => {
|
|
451
390
|
return new Promise((resolve) => {
|
|
452
391
|
overlay.open(({ isOpen, close, exit }) => {
|
|
@@ -490,7 +429,7 @@ var useGameCenterProfile = () => {
|
|
|
490
429
|
const { openGameProfileToast } = useGameProfileToast();
|
|
491
430
|
const { open: openErrorAlert } = useErrorAlert();
|
|
492
431
|
const { open: openTransparentWebView2 } = useTransparentWebview();
|
|
493
|
-
const fetchProfileData =
|
|
432
|
+
const fetchProfileData = useCallback5(async () => {
|
|
494
433
|
try {
|
|
495
434
|
const data = await getGameCenterGameProfile();
|
|
496
435
|
setProfileData(data);
|
|
@@ -500,7 +439,7 @@ var useGameCenterProfile = () => {
|
|
|
500
439
|
setIsProfileDataLoading(false);
|
|
501
440
|
}
|
|
502
441
|
}, [openErrorAlert]);
|
|
503
|
-
const refetchProfileData =
|
|
442
|
+
const refetchProfileData = useCallback5(async () => {
|
|
504
443
|
try {
|
|
505
444
|
setIsProfileDataRefetching(true);
|
|
506
445
|
const data = await getGameCenterGameProfile();
|
|
@@ -514,7 +453,7 @@ var useGameCenterProfile = () => {
|
|
|
514
453
|
openErrorAlert();
|
|
515
454
|
}
|
|
516
455
|
}, [openErrorAlert, openGameProfileToast]);
|
|
517
|
-
const openProfileWebview =
|
|
456
|
+
const openProfileWebview = useCallback5(() => {
|
|
518
457
|
openTransparentWebView2({
|
|
519
458
|
webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
|
|
520
459
|
onClose: async () => {
|
|
@@ -558,12 +497,12 @@ var GameInitializer = ({ children }) => {
|
|
|
558
497
|
openGameProfileToast,
|
|
559
498
|
fetchProfileData
|
|
560
499
|
} = useGameCenterProfile();
|
|
561
|
-
const isCompletedFlow =
|
|
500
|
+
const isCompletedFlow = useRef(false);
|
|
562
501
|
const { open: openAppUpdateDialog } = useAppUpdateDialog();
|
|
563
|
-
|
|
502
|
+
useEffect3(() => {
|
|
564
503
|
fetchProfileData();
|
|
565
504
|
}, []);
|
|
566
|
-
|
|
505
|
+
useEffect3(() => {
|
|
567
506
|
const handleGameProfileFlow = async () => {
|
|
568
507
|
if (!canShowBottomSheetOrToast) {
|
|
569
508
|
return;
|
|
@@ -669,10 +608,10 @@ var overlayStyle = {
|
|
|
669
608
|
import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss/tds-react-native/private";
|
|
670
609
|
|
|
671
610
|
// src/components/NavigationBar/RNNavigationBar/hooks/useHardwareBackPress.ts
|
|
672
|
-
import { useEffect as
|
|
611
|
+
import { useEffect as useEffect4 } from "react";
|
|
673
612
|
import { BackHandler } from "react-native";
|
|
674
613
|
function useHardwareBackPress(handler) {
|
|
675
|
-
|
|
614
|
+
useEffect4(() => {
|
|
676
615
|
const handleBackPress = () => {
|
|
677
616
|
handler();
|
|
678
617
|
return true;
|
|
@@ -689,11 +628,11 @@ import { useMemo as useMemo2 } from "react";
|
|
|
689
628
|
// src/components/NavigationBar/RNNavigationBar/hooks/useCloseConfirm.ts
|
|
690
629
|
import { useDialog as useDialog3 } from "@toss/tds-react-native";
|
|
691
630
|
import { josa as josa2 } from "es-hangul";
|
|
692
|
-
import { useCallback as
|
|
631
|
+
import { useCallback as useCallback6 } from "react";
|
|
693
632
|
function useCloseConfirm() {
|
|
694
633
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
695
634
|
const { openConfirm } = useDialog3();
|
|
696
|
-
return
|
|
635
|
+
return useCallback6(
|
|
697
636
|
async ({ onEntered }) => {
|
|
698
637
|
return await openConfirm({
|
|
699
638
|
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -748,8 +687,7 @@ var homeEvent = createEvent("homeEvent");
|
|
|
748
687
|
var safeAreaInsetsChange = createEvent("safeAreaInsetsChange");
|
|
749
688
|
|
|
750
689
|
// src/components/NavigationBar/common/useNavigationBarLogging.tsx
|
|
751
|
-
import {
|
|
752
|
-
import { Granite as Granite4 } from "@granite-js/react-native";
|
|
690
|
+
import { Granite as Granite3 } from "@granite-js/react-native";
|
|
753
691
|
var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
|
|
754
692
|
var NAVI_BAR_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__navigation_bar";
|
|
755
693
|
var CLOSE_POPUP_SHOW_SCHEMA_ID = 1644490;
|
|
@@ -764,10 +702,10 @@ function useNavigationBarLogging() {
|
|
|
764
702
|
const referrer = useReferrer();
|
|
765
703
|
const baseParams = {
|
|
766
704
|
referrer,
|
|
767
|
-
app_name:
|
|
705
|
+
app_name: Granite3.appName
|
|
768
706
|
};
|
|
769
707
|
const logNavBarImpression = (naviBarConfig) => {
|
|
770
|
-
|
|
708
|
+
sendLog({
|
|
771
709
|
log_name: NAVI_BAR_IMPRESSION_LOG_NAME,
|
|
772
710
|
log_type: "event",
|
|
773
711
|
params: {
|
|
@@ -779,7 +717,7 @@ function useNavigationBarLogging() {
|
|
|
779
717
|
});
|
|
780
718
|
};
|
|
781
719
|
const logHomeButtonClick = () => {
|
|
782
|
-
|
|
720
|
+
sendLog({
|
|
783
721
|
log_name: HOME_BUTTON_CLICK_LOG_NAME,
|
|
784
722
|
log_type: "event",
|
|
785
723
|
params: {
|
|
@@ -790,7 +728,7 @@ function useNavigationBarLogging() {
|
|
|
790
728
|
});
|
|
791
729
|
};
|
|
792
730
|
const logCloseButtonClick = () => {
|
|
793
|
-
|
|
731
|
+
sendLog({
|
|
794
732
|
log_name: CLOSE_BUTTON_CLICK_LOG_NAME,
|
|
795
733
|
log_type: "event",
|
|
796
734
|
params: {
|
|
@@ -801,7 +739,7 @@ function useNavigationBarLogging() {
|
|
|
801
739
|
});
|
|
802
740
|
};
|
|
803
741
|
const logClosePopupShow = () => {
|
|
804
|
-
|
|
742
|
+
sendLog({
|
|
805
743
|
log_name: CLOSE_POPUP_SHOW_LOG_NAME,
|
|
806
744
|
log_type: "popup",
|
|
807
745
|
params: {
|
|
@@ -811,7 +749,7 @@ function useNavigationBarLogging() {
|
|
|
811
749
|
});
|
|
812
750
|
};
|
|
813
751
|
const logClosePopupCtaClick = (confirm) => {
|
|
814
|
-
|
|
752
|
+
sendLog({
|
|
815
753
|
log_name: CLOSE_POPUP_CTA_CLICK_LOG_NAME,
|
|
816
754
|
log_type: "event",
|
|
817
755
|
params: {
|
|
@@ -837,7 +775,6 @@ function useNavigationEvent() {
|
|
|
837
775
|
const logging = useNavigationBarLogging();
|
|
838
776
|
const navigation = useNavigation();
|
|
839
777
|
const closeConfirm = useCloseConfirm();
|
|
840
|
-
const { captureExitLog } = useCaptureExitLog();
|
|
841
778
|
return useMemo2(() => {
|
|
842
779
|
const close = async () => {
|
|
843
780
|
const hasConfirmed = await closeConfirm({
|
|
@@ -845,7 +782,6 @@ function useNavigationEvent() {
|
|
|
845
782
|
});
|
|
846
783
|
logging.closePopupCtaClick(hasConfirmed);
|
|
847
784
|
if (hasConfirmed) {
|
|
848
|
-
captureExitLog(Date.now());
|
|
849
785
|
closeView3();
|
|
850
786
|
}
|
|
851
787
|
};
|
|
@@ -872,7 +808,7 @@ function useNavigationEvent() {
|
|
|
872
808
|
close();
|
|
873
809
|
}
|
|
874
810
|
};
|
|
875
|
-
}, [backEventContext, navigation, closeConfirm, logging
|
|
811
|
+
}, [backEventContext, navigation, closeConfirm, logging]);
|
|
876
812
|
}
|
|
877
813
|
|
|
878
814
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
@@ -880,7 +816,7 @@ import { INTERNAL__appBridgeHandler as INTERNAL__appBridgeHandler2, isMinVersion
|
|
|
880
816
|
import { openURL as openURL5 } from "@granite-js/react-native";
|
|
881
817
|
import { BottomSheet, List, ListHeader } from "@toss/tds-react-native";
|
|
882
818
|
import { useAdaptive as useAdaptive2, useOverlay as useOverlay2 } from "@toss/tds-react-native/private";
|
|
883
|
-
import { useEffect as
|
|
819
|
+
import { useEffect as useEffect5, useState as useState4 } from "react";
|
|
884
820
|
|
|
885
821
|
// src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
|
|
886
822
|
import { getOperationalEnvironment, shareWithScheme } from "@apps-in-toss/native-modules";
|
|
@@ -893,8 +829,7 @@ import { useAdaptive } from "@toss/tds-react-native/private";
|
|
|
893
829
|
import { View as View2 } from "react-native";
|
|
894
830
|
|
|
895
831
|
// src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
|
|
896
|
-
import {
|
|
897
|
-
import { Granite as Granite5 } from "@granite-js/react-native";
|
|
832
|
+
import { Granite as Granite4 } from "@granite-js/react-native";
|
|
898
833
|
var BOTTOM_SHEET_SCHEMA_ID = 1596825;
|
|
899
834
|
var BOTTOM_SHEET_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more";
|
|
900
835
|
var BOTTOM_SHEET_OPEN_SCHEMA_ID = 1596829;
|
|
@@ -907,10 +842,10 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
907
842
|
const referrer = useReferrer();
|
|
908
843
|
const baseParams = {
|
|
909
844
|
referrer,
|
|
910
|
-
app_name:
|
|
845
|
+
app_name: Granite4.appName
|
|
911
846
|
};
|
|
912
847
|
const logBottomSheetShow = () => {
|
|
913
|
-
|
|
848
|
+
sendLog({
|
|
914
849
|
log_name: BOTTOM_SHEET_LOG_NAME,
|
|
915
850
|
log_type: "popup",
|
|
916
851
|
params: {
|
|
@@ -920,7 +855,7 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
920
855
|
});
|
|
921
856
|
};
|
|
922
857
|
const logBottomSheetOpen = () => {
|
|
923
|
-
|
|
858
|
+
sendLog({
|
|
924
859
|
log_name: BOTTOM_SHEET_OPEN_LOG_NAME,
|
|
925
860
|
log_type: "event",
|
|
926
861
|
params: {
|
|
@@ -931,7 +866,7 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
931
866
|
});
|
|
932
867
|
};
|
|
933
868
|
const logBottomSheetCloseClick = () => {
|
|
934
|
-
|
|
869
|
+
sendLog({
|
|
935
870
|
log_name: BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME,
|
|
936
871
|
log_type: "event",
|
|
937
872
|
params: {
|
|
@@ -942,7 +877,7 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
942
877
|
});
|
|
943
878
|
};
|
|
944
879
|
const logBottomSheetMenuClick = ({ title }) => {
|
|
945
|
-
|
|
880
|
+
sendLog({
|
|
946
881
|
log_name: BOTTOM_SHEET_MENU_CLICK_LOG_NAME,
|
|
947
882
|
log_type: "event",
|
|
948
883
|
params: {
|
|
@@ -1095,7 +1030,7 @@ function HomeShortcutMenu() {
|
|
|
1095
1030
|
|
|
1096
1031
|
// src/core/hooks/useMoreButtonBottomSheet/SettingsMenu.tsx
|
|
1097
1032
|
import { getOperationalEnvironment as getOperationalEnvironment3 } from "@apps-in-toss/native-modules";
|
|
1098
|
-
import { Granite as
|
|
1033
|
+
import { Granite as Granite5, openURL as openURL4 } from "@granite-js/react-native";
|
|
1099
1034
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1100
1035
|
function SettingsMenu() {
|
|
1101
1036
|
const globals = getAppsInTossGlobals();
|
|
@@ -1108,7 +1043,7 @@ function SettingsMenu() {
|
|
|
1108
1043
|
title: "\uC124\uC815",
|
|
1109
1044
|
iconURL: "https://static.toss.im/icons/png/4x/icon-setting-mono.png",
|
|
1110
1045
|
onPress: () => openURL4(
|
|
1111
|
-
`servicetoss://apps-in-toss-menu/settings?appName=${
|
|
1046
|
+
`servicetoss://apps-in-toss-menu/settings?appName=${Granite5.appName}&displayAppName=${globals.brandDisplayName}`
|
|
1112
1047
|
)
|
|
1113
1048
|
}
|
|
1114
1049
|
);
|
|
@@ -1155,7 +1090,7 @@ function useMoreButtonBottomSheet() {
|
|
|
1155
1090
|
const isBottomSheetSupported = isMinVersionSupported2(MIN_VERSION.BOTTOM_SHEET);
|
|
1156
1091
|
const isShareListMenuSupported = isMinVersionSupported2(MIN_VERSION.SHARE_LIST_MENU);
|
|
1157
1092
|
const isSettingsMenuSupported = isMinVersionSupported2(MIN_VERSION.SETTINGS_MENU);
|
|
1158
|
-
|
|
1093
|
+
useEffect5(() => {
|
|
1159
1094
|
if (!isBottomSheetSupported) {
|
|
1160
1095
|
return;
|
|
1161
1096
|
}
|
|
@@ -1228,7 +1163,7 @@ function useMoreButtonBottomSheet() {
|
|
|
1228
1163
|
}
|
|
1229
1164
|
function BottomSheetImpressionArea({ children }) {
|
|
1230
1165
|
const logging = useMoreButtonBottomSheetLogging();
|
|
1231
|
-
|
|
1166
|
+
useEffect5(() => {
|
|
1232
1167
|
logging.show();
|
|
1233
1168
|
}, [logging]);
|
|
1234
1169
|
return /* @__PURE__ */ jsx9(Fragment3, { children });
|
|
@@ -1240,15 +1175,15 @@ function toIcon(source) {
|
|
|
1240
1175
|
}
|
|
1241
1176
|
|
|
1242
1177
|
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
1243
|
-
import { useEffect as
|
|
1178
|
+
import { useEffect as useEffect6, useRef as useRef2 } from "react";
|
|
1244
1179
|
import { Fragment as Fragment4, jsx as jsx10 } from "react/jsx-runtime";
|
|
1245
1180
|
function NavigationBarImpressionArea({
|
|
1246
1181
|
children,
|
|
1247
1182
|
withHomeButton
|
|
1248
1183
|
}) {
|
|
1249
|
-
const hasLogged =
|
|
1184
|
+
const hasLogged = useRef2(false);
|
|
1250
1185
|
const logging = useNavigationBarLogging();
|
|
1251
|
-
|
|
1186
|
+
useEffect6(() => {
|
|
1252
1187
|
if (hasLogged.current === false) {
|
|
1253
1188
|
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
1254
1189
|
hasLogged.current = true;
|
|
@@ -1358,7 +1293,7 @@ function RNAppContainer({ children }) {
|
|
|
1358
1293
|
}
|
|
1359
1294
|
}
|
|
1360
1295
|
function GameAppContainer({ children }) {
|
|
1361
|
-
|
|
1296
|
+
useEffect7(() => {
|
|
1362
1297
|
if (Platform3.OS === "ios") {
|
|
1363
1298
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
1364
1299
|
return () => {
|
|
@@ -1387,14 +1322,11 @@ function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
|
1387
1322
|
ios: "5.221.0"
|
|
1388
1323
|
})) {
|
|
1389
1324
|
return /* @__PURE__ */ jsxs5(Fragment7, { children: [
|
|
1390
|
-
/* @__PURE__ */ jsx14(AppEvent.Entry, {}),
|
|
1391
1325
|
/* @__PURE__ */ jsx14(AppEvent.System, { ...initialProps }),
|
|
1392
1326
|
/* @__PURE__ */ jsx14(AppUpdate, {})
|
|
1393
1327
|
] });
|
|
1394
1328
|
}
|
|
1395
1329
|
return /* @__PURE__ */ jsxs5(Fragment7, { children: [
|
|
1396
|
-
/* @__PURE__ */ jsx14(AppEvent.StayTime, {}),
|
|
1397
|
-
/* @__PURE__ */ jsx14(AppEvent.Entry, {}),
|
|
1398
1330
|
/* @__PURE__ */ jsx14(AppEvent.System, { ...initialProps }),
|
|
1399
1331
|
/* @__PURE__ */ jsx14(Container, { ...initialProps, children: /* @__PURE__ */ jsx14(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children }) })
|
|
1400
1332
|
] });
|
|
@@ -1404,10 +1336,10 @@ function registerApp(container, { context, analytics }) {
|
|
|
1404
1336
|
const isRegistered = AppRegistry.getAppKeys().includes(appName);
|
|
1405
1337
|
if (!isRegistered) {
|
|
1406
1338
|
Analytics.init({
|
|
1407
|
-
logger: (params) => void
|
|
1339
|
+
logger: (params) => void eventLog2(params),
|
|
1408
1340
|
debug: analytics?.debug ?? __DEV__
|
|
1409
1341
|
});
|
|
1410
|
-
const App =
|
|
1342
|
+
const App = Granite6.registerApp(AppsInTossContainer.bind(null, container), {
|
|
1411
1343
|
appName,
|
|
1412
1344
|
context,
|
|
1413
1345
|
initialScheme: getSchemeUri5(),
|
|
@@ -1452,9 +1384,7 @@ import {
|
|
|
1452
1384
|
iapCreateOneTimePurchaseOrder,
|
|
1453
1385
|
processProductGrant,
|
|
1454
1386
|
requestOneTimePurchase,
|
|
1455
|
-
safeSyncPostMessage
|
|
1456
|
-
eventLog as eventLog2,
|
|
1457
|
-
INTERNAL__module as INTERNAL__module8
|
|
1387
|
+
safeSyncPostMessage
|
|
1458
1388
|
} from "@apps-in-toss/native-modules";
|
|
1459
1389
|
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
1460
1390
|
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
@@ -1464,7 +1394,7 @@ import { useSafeAreaInsets as useSafeAreaInsets4 } from "@granite-js/native/reac
|
|
|
1464
1394
|
import { getSchemeUri as getSchemeUri9 } from "@granite-js/react-native";
|
|
1465
1395
|
import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
|
|
1466
1396
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3 } from "@toss/tds-react-native/private";
|
|
1467
|
-
import { useEffect as
|
|
1397
|
+
import { useEffect as useEffect12, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
|
|
1468
1398
|
import { BackHandler as BackHandler2, Linking, Platform as Platform6 } from "react-native";
|
|
1469
1399
|
|
|
1470
1400
|
// src/components/GameWebView.tsx
|
|
@@ -1472,7 +1402,7 @@ import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, getOperational
|
|
|
1472
1402
|
import {
|
|
1473
1403
|
WebView as PlainWebView
|
|
1474
1404
|
} from "@granite-js/native/react-native-webview";
|
|
1475
|
-
import { forwardRef, useEffect as
|
|
1405
|
+
import { forwardRef, useEffect as useEffect8 } from "react";
|
|
1476
1406
|
import { Platform as Platform5 } from "react-native";
|
|
1477
1407
|
|
|
1478
1408
|
// src/components/NavigationBar/GameWebviewNavigationBar.tsx
|
|
@@ -1481,19 +1411,18 @@ import { closeView as closeView4 } from "@granite-js/react-native";
|
|
|
1481
1411
|
import { PageNavbar as PageNavbar2, useDialog as useDialog5 } from "@toss/tds-react-native";
|
|
1482
1412
|
import { NavigationRightContent as NavigationRightContent2, useSafeAreaTop as useSafeAreaTop2 } from "@toss/tds-react-native/private";
|
|
1483
1413
|
import { josa as josa3 } from "es-hangul";
|
|
1484
|
-
import { useCallback as
|
|
1414
|
+
import { useCallback as useCallback7 } from "react";
|
|
1485
1415
|
import { Platform as Platform4, View as View4 } from "react-native";
|
|
1486
1416
|
import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1487
1417
|
function GameWebviewNavigationBar() {
|
|
1488
1418
|
const safeAreaTop = useSafeAreaTop2();
|
|
1489
1419
|
const { openConfirm } = useDialog5();
|
|
1490
|
-
const { captureExitLog } = useCaptureExitLog();
|
|
1491
1420
|
const global2 = getAppsInTossGlobals();
|
|
1492
1421
|
const logging = useNavigationBarLogging();
|
|
1493
1422
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1494
1423
|
const { navigationRightButton } = useNavigationBarContext();
|
|
1495
1424
|
const { right: safeAreaRight } = useSafeAreaInsets2();
|
|
1496
|
-
const handleGameWebviewClose =
|
|
1425
|
+
const handleGameWebviewClose = useCallback7(async () => {
|
|
1497
1426
|
logging.closeButtonClick();
|
|
1498
1427
|
const isConfirmed = await openConfirm({
|
|
1499
1428
|
title: `${josa3(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1504,10 +1433,9 @@ function GameWebviewNavigationBar() {
|
|
|
1504
1433
|
});
|
|
1505
1434
|
logging.closePopupCtaClick(isConfirmed);
|
|
1506
1435
|
if (isConfirmed) {
|
|
1507
|
-
captureExitLog(Date.now());
|
|
1508
1436
|
closeView4();
|
|
1509
1437
|
}
|
|
1510
|
-
}, [
|
|
1438
|
+
}, [global2.brandDisplayName, logging, openConfirm]);
|
|
1511
1439
|
return /* @__PURE__ */ jsxs6(Fragment8, { children: [
|
|
1512
1440
|
/* @__PURE__ */ jsx15(PageNavbar2, { preference: { type: "none" } }),
|
|
1513
1441
|
/* @__PURE__ */ jsx15(
|
|
@@ -1545,7 +1473,7 @@ function GameWebviewNavigationBar() {
|
|
|
1545
1473
|
// src/components/GameWebView.tsx
|
|
1546
1474
|
import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1547
1475
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1548
|
-
|
|
1476
|
+
useEffect8(() => {
|
|
1549
1477
|
if (Platform5.OS === "ios") {
|
|
1550
1478
|
setIosSwipeGestureEnabled3({ isEnabled: false });
|
|
1551
1479
|
return () => {
|
|
@@ -1571,11 +1499,10 @@ import { closeView as closeView5 } from "@granite-js/react-native";
|
|
|
1571
1499
|
import { useDialog as useDialog6 } from "@toss/tds-react-native";
|
|
1572
1500
|
import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss/tds-react-native/private";
|
|
1573
1501
|
import { josa as josa4 } from "es-hangul";
|
|
1574
|
-
import { useCallback as
|
|
1502
|
+
import { useCallback as useCallback8 } from "react";
|
|
1575
1503
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1576
1504
|
function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
1577
1505
|
const globals = getAppsInTossGlobals();
|
|
1578
|
-
const { captureExitLog } = useCaptureExitLog();
|
|
1579
1506
|
const logging = useNavigationBarLogging();
|
|
1580
1507
|
const { openConfirm } = useDialog6();
|
|
1581
1508
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
@@ -1583,7 +1510,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1583
1510
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1584
1511
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1585
1512
|
const { navigationRightButton } = useNavigationBarContext();
|
|
1586
|
-
const handleClose =
|
|
1513
|
+
const handleClose = useCallback8(async () => {
|
|
1587
1514
|
logging.closeButtonClick();
|
|
1588
1515
|
const isConfirmed = await openConfirm({
|
|
1589
1516
|
title: `${josa4(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1594,10 +1521,9 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1594
1521
|
});
|
|
1595
1522
|
logging.closePopupCtaClick(isConfirmed);
|
|
1596
1523
|
if (isConfirmed) {
|
|
1597
|
-
captureExitLog(Date.now());
|
|
1598
1524
|
closeView5();
|
|
1599
1525
|
}
|
|
1600
|
-
}, [
|
|
1526
|
+
}, [globals.brandDisplayName, logging, openConfirm]);
|
|
1601
1527
|
return /* @__PURE__ */ jsx17(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx17(
|
|
1602
1528
|
TopNavigation2,
|
|
1603
1529
|
{
|
|
@@ -1648,6 +1574,15 @@ import {
|
|
|
1648
1574
|
function noop() {
|
|
1649
1575
|
}
|
|
1650
1576
|
|
|
1577
|
+
// src/ads/adGroupId.ts
|
|
1578
|
+
var INVALID_AD_GROUP_ID_ERROR_MESSAGE = "\uC798\uBABB\uB41C \uC694\uCCAD\uC774\uC5D0\uC694. \uD544\uC694\uD55C \uAC12\uC774 \uBE44\uC5B4 \uC788\uC5B4\uC694.";
|
|
1579
|
+
function normalizeAdGroupId(adGroupId) {
|
|
1580
|
+
return adGroupId.trim();
|
|
1581
|
+
}
|
|
1582
|
+
function createInvalidAdGroupIdError() {
|
|
1583
|
+
return new Error(INVALID_AD_GROUP_ID_ERROR_MESSAGE);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1651
1586
|
// src/ads/generateSessionId.ts
|
|
1652
1587
|
function generateSessionId() {
|
|
1653
1588
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
@@ -1671,7 +1606,11 @@ function fetchTossAd(params) {
|
|
|
1671
1606
|
return noop;
|
|
1672
1607
|
}
|
|
1673
1608
|
const { onEvent, onError, options } = params;
|
|
1674
|
-
const
|
|
1609
|
+
const adGroupId = normalizeAdGroupId(options.adGroupId);
|
|
1610
|
+
if (adGroupId.length === 0) {
|
|
1611
|
+
params.onError(createInvalidAdGroupIdError());
|
|
1612
|
+
return noop;
|
|
1613
|
+
}
|
|
1675
1614
|
const unregisterCallbacks = INTERNAL__appBridgeHandler3.invokeAppBridgeMethod(
|
|
1676
1615
|
"fetchTossAd",
|
|
1677
1616
|
{ spaceUnitId: adGroupId, sessionId, sdkId: options.sdkId, availableStyleIds: options.availableStyleIds },
|
|
@@ -1762,8 +1701,8 @@ function postEventTracking(params) {
|
|
|
1762
1701
|
|
|
1763
1702
|
// src/ads/integratedAd.ts
|
|
1764
1703
|
var INTEGRATED_AD_SDK_VERSION = "0.0.0";
|
|
1765
|
-
var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.
|
|
1766
|
-
var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.
|
|
1704
|
+
var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
|
|
1705
|
+
var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
|
|
1767
1706
|
var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
|
|
1768
1707
|
var INTG_AD_ADM_FALLBACK_RID_MAP = {};
|
|
1769
1708
|
function integratedAdIsSupported() {
|
|
@@ -1778,16 +1717,28 @@ function generateLoadFullScreenAd(sdkId) {
|
|
|
1778
1717
|
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
1779
1718
|
return noop;
|
|
1780
1719
|
}
|
|
1720
|
+
const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
|
|
1721
|
+
if (normalizedAdGroupId.length === 0) {
|
|
1722
|
+
params.onError(createInvalidAdGroupIdError());
|
|
1723
|
+
return noop;
|
|
1724
|
+
}
|
|
1725
|
+
const normalizedParams = {
|
|
1726
|
+
...params,
|
|
1727
|
+
options: {
|
|
1728
|
+
...params.options,
|
|
1729
|
+
adGroupId: normalizedAdGroupId
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1781
1732
|
if (!integratedAdIsSupported()) {
|
|
1782
1733
|
return GoogleAdMob.loadAppsInTossAdMob({
|
|
1783
|
-
...
|
|
1734
|
+
...normalizedParams,
|
|
1784
1735
|
onEvent: (event) => {
|
|
1785
1736
|
if (event.type === "loaded") {
|
|
1786
1737
|
const requestId = generateRequestId();
|
|
1787
|
-
INTG_AD_ADM_FALLBACK_RID_MAP[
|
|
1738
|
+
INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] = requestId;
|
|
1788
1739
|
postEventTracking({
|
|
1789
1740
|
eventName: "LOAD",
|
|
1790
|
-
spaceUnitId:
|
|
1741
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1791
1742
|
requestId,
|
|
1792
1743
|
responseId: event.data.responseInfo.responseId,
|
|
1793
1744
|
mediationType: "ADMOB",
|
|
@@ -1796,13 +1747,13 @@ function generateLoadFullScreenAd(sdkId) {
|
|
|
1796
1747
|
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1797
1748
|
});
|
|
1798
1749
|
}
|
|
1799
|
-
return
|
|
1750
|
+
return normalizedParams.onEvent(event);
|
|
1800
1751
|
},
|
|
1801
1752
|
onError: (error) => {
|
|
1802
|
-
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[
|
|
1753
|
+
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
|
|
1803
1754
|
postEventTracking({
|
|
1804
1755
|
eventName: "FAILED_TO_LOAD",
|
|
1805
|
-
spaceUnitId:
|
|
1756
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1806
1757
|
requestId,
|
|
1807
1758
|
responseId: "",
|
|
1808
1759
|
mediationType: "ADMOB",
|
|
@@ -1810,11 +1761,11 @@ function generateLoadFullScreenAd(sdkId) {
|
|
|
1810
1761
|
adSourceName: "",
|
|
1811
1762
|
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1812
1763
|
});
|
|
1813
|
-
return
|
|
1764
|
+
return normalizedParams.onError(error);
|
|
1814
1765
|
}
|
|
1815
1766
|
});
|
|
1816
1767
|
}
|
|
1817
|
-
const { onEvent, onError, options } =
|
|
1768
|
+
const { onEvent, onError, options } = normalizedParams;
|
|
1818
1769
|
const { adGroupId } = options;
|
|
1819
1770
|
const referrer = getReferrer();
|
|
1820
1771
|
const unregisterCallbacks = INTERNAL__appBridgeHandler4.invokeAppBridgeMethod(
|
|
@@ -1841,16 +1792,28 @@ function showFullScreenAd(params) {
|
|
|
1841
1792
|
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
1842
1793
|
return noop;
|
|
1843
1794
|
}
|
|
1795
|
+
const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
|
|
1796
|
+
if (normalizedAdGroupId.length === 0) {
|
|
1797
|
+
params.onError(createInvalidAdGroupIdError());
|
|
1798
|
+
return noop;
|
|
1799
|
+
}
|
|
1800
|
+
const normalizedParams = {
|
|
1801
|
+
...params,
|
|
1802
|
+
options: {
|
|
1803
|
+
...params.options,
|
|
1804
|
+
adGroupId: normalizedAdGroupId
|
|
1805
|
+
}
|
|
1806
|
+
};
|
|
1844
1807
|
if (!integratedAdIsSupported()) {
|
|
1845
1808
|
return GoogleAdMob.showAppsInTossAdMob({
|
|
1846
|
-
...
|
|
1809
|
+
...normalizedParams,
|
|
1847
1810
|
onEvent: (event) => {
|
|
1848
|
-
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[
|
|
1811
|
+
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
|
|
1849
1812
|
switch (event.type) {
|
|
1850
1813
|
case "show":
|
|
1851
1814
|
postEventTracking({
|
|
1852
1815
|
eventName: "SHOW",
|
|
1853
|
-
spaceUnitId:
|
|
1816
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1854
1817
|
requestId,
|
|
1855
1818
|
responseId: "",
|
|
1856
1819
|
mediationType: "ADMOB",
|
|
@@ -1862,7 +1825,7 @@ function showFullScreenAd(params) {
|
|
|
1862
1825
|
case "failedToShow":
|
|
1863
1826
|
postEventTracking({
|
|
1864
1827
|
eventName: "FAILED_TO_SHOW",
|
|
1865
|
-
spaceUnitId:
|
|
1828
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1866
1829
|
requestId,
|
|
1867
1830
|
responseId: "",
|
|
1868
1831
|
mediationType: "ADMOB",
|
|
@@ -1874,7 +1837,7 @@ function showFullScreenAd(params) {
|
|
|
1874
1837
|
case "impression":
|
|
1875
1838
|
postEventTracking({
|
|
1876
1839
|
eventName: "IMP",
|
|
1877
|
-
spaceUnitId:
|
|
1840
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1878
1841
|
requestId,
|
|
1879
1842
|
responseId: "",
|
|
1880
1843
|
mediationType: "ADMOB",
|
|
@@ -1886,7 +1849,7 @@ function showFullScreenAd(params) {
|
|
|
1886
1849
|
case "clicked":
|
|
1887
1850
|
postEventTracking({
|
|
1888
1851
|
eventName: "CLICK",
|
|
1889
|
-
spaceUnitId:
|
|
1852
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1890
1853
|
requestId,
|
|
1891
1854
|
responseId: "",
|
|
1892
1855
|
mediationType: "ADMOB",
|
|
@@ -1898,7 +1861,7 @@ function showFullScreenAd(params) {
|
|
|
1898
1861
|
case "dismissed":
|
|
1899
1862
|
postEventTracking({
|
|
1900
1863
|
eventName: "DISMISS",
|
|
1901
|
-
spaceUnitId:
|
|
1864
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1902
1865
|
requestId,
|
|
1903
1866
|
responseId: "",
|
|
1904
1867
|
mediationType: "ADMOB",
|
|
@@ -1910,7 +1873,7 @@ function showFullScreenAd(params) {
|
|
|
1910
1873
|
case "userEarnedReward":
|
|
1911
1874
|
postEventTracking({
|
|
1912
1875
|
eventName: "USER_EARNED_REWARD",
|
|
1913
|
-
spaceUnitId:
|
|
1876
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1914
1877
|
requestId,
|
|
1915
1878
|
responseId: "",
|
|
1916
1879
|
mediationType: "ADMOB",
|
|
@@ -1920,13 +1883,13 @@ function showFullScreenAd(params) {
|
|
|
1920
1883
|
});
|
|
1921
1884
|
break;
|
|
1922
1885
|
}
|
|
1923
|
-
return
|
|
1886
|
+
return normalizedParams.onEvent(event);
|
|
1924
1887
|
},
|
|
1925
1888
|
onError: (error) => {
|
|
1926
|
-
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[
|
|
1889
|
+
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
|
|
1927
1890
|
postEventTracking({
|
|
1928
1891
|
eventName: "FAILED_TO_SHOW",
|
|
1929
|
-
spaceUnitId:
|
|
1892
|
+
spaceUnitId: normalizedAdGroupId,
|
|
1930
1893
|
requestId,
|
|
1931
1894
|
responseId: "",
|
|
1932
1895
|
mediationType: "ADMOB",
|
|
@@ -1934,11 +1897,11 @@ function showFullScreenAd(params) {
|
|
|
1934
1897
|
adSourceName: "",
|
|
1935
1898
|
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1936
1899
|
});
|
|
1937
|
-
return
|
|
1900
|
+
return normalizedParams.onError(error);
|
|
1938
1901
|
}
|
|
1939
1902
|
});
|
|
1940
1903
|
}
|
|
1941
|
-
const { onEvent, onError, options } =
|
|
1904
|
+
const { onEvent, onError, options } = normalizedParams;
|
|
1942
1905
|
const { adGroupId } = options;
|
|
1943
1906
|
const referrer = getReferrer();
|
|
1944
1907
|
const unregisterCallbacks = INTERNAL__appBridgeHandler4.invokeAppBridgeMethod(
|
|
@@ -1976,11 +1939,10 @@ function showFullScreenAd(params) {
|
|
|
1976
1939
|
showFullScreenAd.isSupported = GoogleAdMob.showAppsInTossAdMob.isSupported;
|
|
1977
1940
|
|
|
1978
1941
|
// src/ads/tossAdEventLog.ts
|
|
1979
|
-
import {
|
|
1980
|
-
import { Granite as Granite8 } from "@granite-js/react-native";
|
|
1942
|
+
import { Granite as Granite7 } from "@granite-js/react-native";
|
|
1981
1943
|
async function tossAdEventLog(params) {
|
|
1982
1944
|
const referrer = getReferrer();
|
|
1983
|
-
const appName =
|
|
1945
|
+
const appName = Granite7.appName;
|
|
1984
1946
|
const eventLogParams = {
|
|
1985
1947
|
...params,
|
|
1986
1948
|
params: {
|
|
@@ -1989,11 +1951,11 @@ async function tossAdEventLog(params) {
|
|
|
1989
1951
|
app_name: appName
|
|
1990
1952
|
}
|
|
1991
1953
|
};
|
|
1992
|
-
return
|
|
1954
|
+
return sendLog(eventLogParams, { pipelines: ["core"] });
|
|
1993
1955
|
}
|
|
1994
1956
|
|
|
1995
1957
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1996
|
-
import { useCallback as
|
|
1958
|
+
import { useCallback as useCallback9, useEffect as useEffect9, useMemo as useMemo3, useRef as useRef3 } from "react";
|
|
1997
1959
|
function serializeError(error) {
|
|
1998
1960
|
return JSON.stringify(error, (_, value) => {
|
|
1999
1961
|
if (value instanceof Error) {
|
|
@@ -2045,7 +2007,7 @@ function useBridgeHandler({
|
|
|
2045
2007
|
asyncHandlerMap,
|
|
2046
2008
|
eventListenerMap
|
|
2047
2009
|
}) {
|
|
2048
|
-
const ref =
|
|
2010
|
+
const ref = useRef3(null);
|
|
2049
2011
|
const injectedJavaScript = useMemo3(
|
|
2050
2012
|
() => `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
2051
2013
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -2058,7 +2020,7 @@ function useBridgeHandler({
|
|
|
2058
2020
|
)};`,
|
|
2059
2021
|
[constantHandlerMap]
|
|
2060
2022
|
);
|
|
2061
|
-
|
|
2023
|
+
useEffect9(() => {
|
|
2062
2024
|
ref.current?.injectJavaScript(injectedJavaScript);
|
|
2063
2025
|
}, [injectedJavaScript]);
|
|
2064
2026
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
@@ -2072,7 +2034,7 @@ function useBridgeHandler({
|
|
|
2072
2034
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
2073
2035
|
`);
|
|
2074
2036
|
};
|
|
2075
|
-
const $onMessage =
|
|
2037
|
+
const $onMessage = useCallback9(
|
|
2076
2038
|
async (e) => {
|
|
2077
2039
|
onMessage?.(e);
|
|
2078
2040
|
const data = parseNativeEventData(e.nativeEvent.data);
|
|
@@ -2132,13 +2094,13 @@ function parseNativeEventData(data) {
|
|
|
2132
2094
|
|
|
2133
2095
|
// src/core/hooks/useSafeAreaInsetsEvent.tsx
|
|
2134
2096
|
import { useSafeAreaInsets as useSafeAreaInsets3 } from "@granite-js/native/react-native-safe-area-context";
|
|
2135
|
-
import { useEffect as
|
|
2097
|
+
import { useEffect as useEffect10 } from "react";
|
|
2136
2098
|
function useSafeAreaInsetsEvent() {
|
|
2137
2099
|
const insets = useSafeAreaInsets3();
|
|
2138
|
-
|
|
2100
|
+
useEffect10(() => {
|
|
2139
2101
|
safeAreaInsetsChange.emit(insets);
|
|
2140
2102
|
}, [insets]);
|
|
2141
|
-
|
|
2103
|
+
useEffect10(() => {
|
|
2142
2104
|
return () => safeAreaInsetsChange.clearSubscriptions();
|
|
2143
2105
|
}, []);
|
|
2144
2106
|
return safeAreaInsetsChange;
|
|
@@ -2148,10 +2110,10 @@ function useSafeAreaInsetsEvent() {
|
|
|
2148
2110
|
import { closeView as closeView6, useBackEventState } from "@granite-js/react-native";
|
|
2149
2111
|
import { useDialog as useDialog7 } from "@toss/tds-react-native";
|
|
2150
2112
|
import { josa as josa5 } from "es-hangul";
|
|
2151
|
-
import { useCallback as
|
|
2113
|
+
import { useCallback as useCallback11, useMemo as useMemo5 } from "react";
|
|
2152
2114
|
|
|
2153
2115
|
// src/hooks/useWebviewHistoryStack.tsx
|
|
2154
|
-
import { useCallback as
|
|
2116
|
+
import { useCallback as useCallback10, useMemo as useMemo4, useReducer } from "react";
|
|
2155
2117
|
var INITIAL_STATE = { stack: [], index: -1 };
|
|
2156
2118
|
function reducer(state, action) {
|
|
2157
2119
|
switch (action.type) {
|
|
@@ -2183,7 +2145,7 @@ function reducer(state, action) {
|
|
|
2183
2145
|
}
|
|
2184
2146
|
function useWebViewHistory() {
|
|
2185
2147
|
const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
|
|
2186
|
-
const onNavigationStateChange =
|
|
2148
|
+
const onNavigationStateChange = useCallback10(({ url, canGoForward: canGoForward2 }) => {
|
|
2187
2149
|
dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
|
|
2188
2150
|
}, []);
|
|
2189
2151
|
const { canGoBack, canGoForward } = useMemo4(() => {
|
|
@@ -2196,7 +2158,6 @@ function useWebViewHistory() {
|
|
|
2196
2158
|
|
|
2197
2159
|
// src/core/hooks/useWebBackHandler.tsx
|
|
2198
2160
|
function useWebBackHandler(webViewInitialURL, webViewRef) {
|
|
2199
|
-
const { captureExitLog } = useCaptureExitLog();
|
|
2200
2161
|
const { hasHistory, onNavigationStateChange } = useWebViewHistory();
|
|
2201
2162
|
const {
|
|
2202
2163
|
handlersRef: webBackHandlersRef,
|
|
@@ -2207,19 +2168,19 @@ function useWebBackHandler(webViewInitialURL, webViewRef) {
|
|
|
2207
2168
|
const logging = useNavigationBarLogging();
|
|
2208
2169
|
const { openConfirm } = useDialog7();
|
|
2209
2170
|
const global2 = getAppsInTossGlobals();
|
|
2210
|
-
const addEventListener =
|
|
2171
|
+
const addEventListener = useCallback11(
|
|
2211
2172
|
(handler) => {
|
|
2212
2173
|
addWebBackEventListener(handler);
|
|
2213
2174
|
},
|
|
2214
2175
|
[addWebBackEventListener]
|
|
2215
2176
|
);
|
|
2216
|
-
const removeEventListener =
|
|
2177
|
+
const removeEventListener = useCallback11(
|
|
2217
2178
|
(handler) => {
|
|
2218
2179
|
removeWebBackEventListener(handler);
|
|
2219
2180
|
},
|
|
2220
2181
|
[removeWebBackEventListener]
|
|
2221
2182
|
);
|
|
2222
|
-
const handleWebBack =
|
|
2183
|
+
const handleWebBack = useCallback11(async () => {
|
|
2223
2184
|
if (hasWebBackEvent) {
|
|
2224
2185
|
for (const handler of webBackHandlersRef) {
|
|
2225
2186
|
handler();
|
|
@@ -2238,21 +2199,11 @@ function useWebBackHandler(webViewInitialURL, webViewRef) {
|
|
|
2238
2199
|
});
|
|
2239
2200
|
logging.closePopupCtaClick(isConfirmed);
|
|
2240
2201
|
if (isConfirmed) {
|
|
2241
|
-
captureExitLog(Date.now());
|
|
2242
2202
|
closeView6();
|
|
2243
2203
|
}
|
|
2244
2204
|
}
|
|
2245
|
-
}, [
|
|
2246
|
-
|
|
2247
|
-
global2.brandDisplayName,
|
|
2248
|
-
hasHistory,
|
|
2249
|
-
hasWebBackEvent,
|
|
2250
|
-
webBackHandlersRef,
|
|
2251
|
-
logging,
|
|
2252
|
-
openConfirm,
|
|
2253
|
-
webViewRef
|
|
2254
|
-
]);
|
|
2255
|
-
const handleWebHome = useCallback12(() => {
|
|
2205
|
+
}, [global2.brandDisplayName, hasHistory, hasWebBackEvent, webBackHandlersRef, logging, openConfirm, webViewRef]);
|
|
2206
|
+
const handleWebHome = useCallback11(() => {
|
|
2256
2207
|
logging.homeButtonClick();
|
|
2257
2208
|
if (homeEvent.hasSubscriptions()) {
|
|
2258
2209
|
homeEvent.emit({});
|
|
@@ -2443,12 +2394,12 @@ function useCreateUserAgent({
|
|
|
2443
2394
|
|
|
2444
2395
|
// src/hooks/useGeolocation.ts
|
|
2445
2396
|
import { startUpdateLocation } from "@apps-in-toss/native-modules";
|
|
2446
|
-
import { useVisibility
|
|
2447
|
-
import { useEffect as
|
|
2397
|
+
import { useVisibility } from "@granite-js/react-native";
|
|
2398
|
+
import { useEffect as useEffect11, useState as useState5 } from "react";
|
|
2448
2399
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
2449
|
-
const isVisible =
|
|
2400
|
+
const isVisible = useVisibility();
|
|
2450
2401
|
const [location, setLocation] = useState5(null);
|
|
2451
|
-
|
|
2402
|
+
useEffect11(() => {
|
|
2452
2403
|
if (!isVisible) {
|
|
2453
2404
|
return;
|
|
2454
2405
|
}
|
|
@@ -2467,11 +2418,11 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
2467
2418
|
|
|
2468
2419
|
// src/hooks/useWaitForReturnNavigator.tsx
|
|
2469
2420
|
import { useNavigation as useNavigation2, useVisibilityChange } from "@granite-js/react-native";
|
|
2470
|
-
import { useCallback as
|
|
2421
|
+
import { useCallback as useCallback12, useRef as useRef4 } from "react";
|
|
2471
2422
|
function useWaitForReturnNavigator() {
|
|
2472
|
-
const callbacks =
|
|
2423
|
+
const callbacks = useRef4([]).current;
|
|
2473
2424
|
const navigation = useNavigation2();
|
|
2474
|
-
const startNavigating =
|
|
2425
|
+
const startNavigating = useCallback12(
|
|
2475
2426
|
(route, params) => {
|
|
2476
2427
|
return new Promise((resolve) => {
|
|
2477
2428
|
callbacks.push(resolve);
|
|
@@ -2480,7 +2431,7 @@ function useWaitForReturnNavigator() {
|
|
|
2480
2431
|
},
|
|
2481
2432
|
[callbacks, navigation]
|
|
2482
2433
|
);
|
|
2483
|
-
const handleVisibilityChange =
|
|
2434
|
+
const handleVisibilityChange = useCallback12(
|
|
2484
2435
|
(state) => {
|
|
2485
2436
|
if (state === "visible" && callbacks.length > 0) {
|
|
2486
2437
|
for (const callback of callbacks) {
|
|
@@ -2505,8 +2456,8 @@ function useTopNavigation() {
|
|
|
2505
2456
|
}
|
|
2506
2457
|
|
|
2507
2458
|
// src/hooks/useWebViewMemoryDebug.tsx
|
|
2508
|
-
import { getOperationalEnvironment as getOperationalEnvironment8
|
|
2509
|
-
import { Granite as
|
|
2459
|
+
import { getOperationalEnvironment as getOperationalEnvironment8 } from "@apps-in-toss/native-modules";
|
|
2460
|
+
import { Granite as Granite8 } from "@granite-js/react-native";
|
|
2510
2461
|
import { useToast } from "@toss/tds-react-native";
|
|
2511
2462
|
function useHandleWebViewProcessDidTerminate(webViewRef) {
|
|
2512
2463
|
const toast = useToast();
|
|
@@ -2529,12 +2480,12 @@ function webViewDebugLog(logName, params) {
|
|
|
2529
2480
|
log_type: "debug",
|
|
2530
2481
|
params: {
|
|
2531
2482
|
...params,
|
|
2532
|
-
app_name:
|
|
2483
|
+
app_name: Granite8.appName,
|
|
2533
2484
|
deployment_id: global2.deploymentId
|
|
2534
2485
|
}
|
|
2535
2486
|
};
|
|
2536
2487
|
if (getOperationalEnvironment8() === "toss") {
|
|
2537
|
-
|
|
2488
|
+
sendLog(event, { pipelines: ["core"] });
|
|
2538
2489
|
} else {
|
|
2539
2490
|
console.log("[webViewDebugLog]", event);
|
|
2540
2491
|
}
|
|
@@ -2628,7 +2579,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2628
2579
|
if (!TYPES.includes(type)) {
|
|
2629
2580
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
2630
2581
|
}
|
|
2631
|
-
const webViewRef =
|
|
2582
|
+
const webViewRef = useRef5(null);
|
|
2632
2583
|
const url = useMemo6(() => getWebViewURL(local), [local]);
|
|
2633
2584
|
const webBackHandler = useWebBackHandler(url, webViewRef);
|
|
2634
2585
|
const top = useSafeAreaTop3();
|
|
@@ -2733,8 +2684,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2733
2684
|
/** Private */
|
|
2734
2685
|
memoryDebugLog: webViewMemoryDebugLog,
|
|
2735
2686
|
debugLog: async (event) => {
|
|
2736
|
-
|
|
2737
|
-
INTERNAL__module8.tossCoreEventLog(event);
|
|
2687
|
+
sendLog(event);
|
|
2738
2688
|
}
|
|
2739
2689
|
}
|
|
2740
2690
|
});
|
|
@@ -2759,7 +2709,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2759
2709
|
colorPreference: "light"
|
|
2760
2710
|
});
|
|
2761
2711
|
const refs = mergeRefs(handler.ref, webViewRef);
|
|
2762
|
-
|
|
2712
|
+
useEffect12(() => {
|
|
2763
2713
|
const callback = () => {
|
|
2764
2714
|
webBackHandler.handleWebBack();
|
|
2765
2715
|
return true;
|
|
@@ -2838,7 +2788,7 @@ import { StartUpdateLocationPermissionError } from "@apps-in-toss/types";
|
|
|
2838
2788
|
|
|
2839
2789
|
// src/ads/inlineAd/InlineAd.tsx
|
|
2840
2790
|
import { ImpressionArea, useVisibilityChange as useVisibilityChange2 } from "@granite-js/react-native";
|
|
2841
|
-
import { useEffect as
|
|
2791
|
+
import { useEffect as useEffect13, useRef as useRef8, useState as useState7 } from "react";
|
|
2842
2792
|
import { StyleSheet as StyleSheet3, View as View7, useColorScheme } from "react-native";
|
|
2843
2793
|
|
|
2844
2794
|
// src/ads/inlineAd/constants.ts
|
|
@@ -3025,10 +2975,11 @@ function isStructurallyValidAd(ad) {
|
|
|
3025
2975
|
return Boolean(ad && ad.creative && typeof ad.creative === "object");
|
|
3026
2976
|
}
|
|
3027
2977
|
async function loadAd(adGroupId) {
|
|
3028
|
-
|
|
2978
|
+
const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
|
|
2979
|
+
if (normalizedAdGroupId.length === 0) {
|
|
3029
2980
|
return {
|
|
3030
2981
|
type: "error",
|
|
3031
|
-
error: createError(ERROR_CODES.INVALID_SPACE,
|
|
2982
|
+
error: createError(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE)
|
|
3032
2983
|
};
|
|
3033
2984
|
}
|
|
3034
2985
|
if (!fetchTossAd.isSupported()) {
|
|
@@ -3040,7 +2991,7 @@ async function loadAd(adGroupId) {
|
|
|
3040
2991
|
let response;
|
|
3041
2992
|
try {
|
|
3042
2993
|
const raw = await fetchTossAdPromise({
|
|
3043
|
-
adGroupId,
|
|
2994
|
+
adGroupId: normalizedAdGroupId,
|
|
3044
2995
|
sdkId: SDK_ID,
|
|
3045
2996
|
availableStyleIds: AVAILABLE_STYLE_IDS
|
|
3046
2997
|
});
|
|
@@ -3219,7 +3170,7 @@ var EventTracker = class {
|
|
|
3219
3170
|
|
|
3220
3171
|
// src/ads/inlineAd/ui/FeedBannerAdView.tsx
|
|
3221
3172
|
import { Path, Svg } from "@granite-js/native/react-native-svg";
|
|
3222
|
-
import { useRef as
|
|
3173
|
+
import { useRef as useRef6 } from "react";
|
|
3223
3174
|
import {
|
|
3224
3175
|
Animated,
|
|
3225
3176
|
Easing,
|
|
@@ -3246,7 +3197,7 @@ function FeedBannerAdView({
|
|
|
3246
3197
|
paddingStyle,
|
|
3247
3198
|
onPress
|
|
3248
3199
|
}) {
|
|
3249
|
-
const scale =
|
|
3200
|
+
const scale = useRef6(new Animated.Value(1)).current;
|
|
3250
3201
|
const animateScale = (toValue) => {
|
|
3251
3202
|
Animated.timing(scale, {
|
|
3252
3203
|
toValue,
|
|
@@ -3482,7 +3433,7 @@ var styles = StyleSheet.create({
|
|
|
3482
3433
|
|
|
3483
3434
|
// src/ads/inlineAd/ui/ListBannerAdView.tsx
|
|
3484
3435
|
import { ClipPath, Defs, Image as SvgImage, Path as Path2, Svg as Svg2 } from "@granite-js/native/react-native-svg";
|
|
3485
|
-
import { useRef as
|
|
3436
|
+
import { useRef as useRef7 } from "react";
|
|
3486
3437
|
import { Animated as Animated2, Easing as Easing2, Pressable as Pressable3, StyleSheet as StyleSheet2, Text as Text2, View as View6 } from "react-native";
|
|
3487
3438
|
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3488
3439
|
var SQUIRCLE_PATH = "M0 17.352C0 3.564 3.564 0 17.352 0H18.648C32.436 0 36 3.564 36 17.352V18.648C36 32.436 32.436 36 18.648 36H17.352C3.564 36 0 32.436 0 18.648V17.352Z";
|
|
@@ -3496,8 +3447,8 @@ function ListBannerAdView({
|
|
|
3496
3447
|
colors,
|
|
3497
3448
|
onPress
|
|
3498
3449
|
}) {
|
|
3499
|
-
const scale =
|
|
3500
|
-
const clipIdRef =
|
|
3450
|
+
const scale = useRef7(new Animated2.Value(1)).current;
|
|
3451
|
+
const clipIdRef = useRef7(`clip-${Math.random().toString(36).slice(2)}`);
|
|
3501
3452
|
const animateScale = (toValue) => {
|
|
3502
3453
|
Animated2.timing(scale, {
|
|
3503
3454
|
toValue,
|
|
@@ -3805,21 +3756,21 @@ function InlineAd(props) {
|
|
|
3805
3756
|
onAdFailedToRender,
|
|
3806
3757
|
onNoFill
|
|
3807
3758
|
} = props;
|
|
3808
|
-
const slotIdRef =
|
|
3759
|
+
const slotIdRef = useRef8(createSlotId());
|
|
3809
3760
|
const [ad, setAd] = useState7(null);
|
|
3810
3761
|
const [isAdBadgeEnabled, setIsAdBadgeEnabled] = useState7(true);
|
|
3811
|
-
const eventTrackerRef =
|
|
3812
|
-
const eventPayloadRef =
|
|
3813
|
-
const hasRenderedRef =
|
|
3814
|
-
const hasLoggedImp1pxRef =
|
|
3815
|
-
const hasLoggedImp100pRef =
|
|
3816
|
-
const hasNotifiedViewableRef =
|
|
3817
|
-
const viewableTimerRef =
|
|
3818
|
-
const refetchIntervalMsRef =
|
|
3819
|
-
const lastImp1pxAtRef =
|
|
3820
|
-
const loadingRef =
|
|
3821
|
-
const loadRef =
|
|
3822
|
-
const callbacksRef =
|
|
3762
|
+
const eventTrackerRef = useRef8(null);
|
|
3763
|
+
const eventPayloadRef = useRef8(null);
|
|
3764
|
+
const hasRenderedRef = useRef8(false);
|
|
3765
|
+
const hasLoggedImp1pxRef = useRef8(false);
|
|
3766
|
+
const hasLoggedImp100pRef = useRef8(false);
|
|
3767
|
+
const hasNotifiedViewableRef = useRef8(false);
|
|
3768
|
+
const viewableTimerRef = useRef8(null);
|
|
3769
|
+
const refetchIntervalMsRef = useRef8(null);
|
|
3770
|
+
const lastImp1pxAtRef = useRef8(null);
|
|
3771
|
+
const loadingRef = useRef8(false);
|
|
3772
|
+
const loadRef = useRef8(null);
|
|
3773
|
+
const callbacksRef = useRef8({
|
|
3823
3774
|
onAdRendered,
|
|
3824
3775
|
onAdViewable,
|
|
3825
3776
|
onAdClicked,
|
|
@@ -3827,7 +3778,7 @@ function InlineAd(props) {
|
|
|
3827
3778
|
onAdFailedToRender,
|
|
3828
3779
|
onNoFill
|
|
3829
3780
|
});
|
|
3830
|
-
const isMountedRef =
|
|
3781
|
+
const isMountedRef = useRef8(false);
|
|
3831
3782
|
const colorScheme = useColorScheme();
|
|
3832
3783
|
const selectedTheme = theme ?? DEFAULT_INLINE_AD_THEME;
|
|
3833
3784
|
const resolvedTheme = selectedTheme === "auto" ? colorScheme === "dark" ? "dark" : "light" : selectedTheme;
|
|
@@ -3844,7 +3795,7 @@ function InlineAd(props) {
|
|
|
3844
3795
|
onAdFailedToRender,
|
|
3845
3796
|
onNoFill
|
|
3846
3797
|
};
|
|
3847
|
-
|
|
3798
|
+
useEffect13(() => {
|
|
3848
3799
|
isMountedRef.current = true;
|
|
3849
3800
|
return () => {
|
|
3850
3801
|
isMountedRef.current = false;
|
|
@@ -3854,36 +3805,36 @@ function InlineAd(props) {
|
|
|
3854
3805
|
}
|
|
3855
3806
|
};
|
|
3856
3807
|
}, []);
|
|
3857
|
-
|
|
3808
|
+
useEffect13(() => {
|
|
3809
|
+
const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
|
|
3858
3810
|
const loadAdRequest = () => {
|
|
3859
3811
|
if (loadingRef.current) {
|
|
3860
3812
|
return;
|
|
3861
3813
|
}
|
|
3862
|
-
if (
|
|
3863
|
-
const error = createError2(
|
|
3864
|
-
|
|
3865
|
-
|
|
3814
|
+
if (normalizedAdGroupId.length === 0) {
|
|
3815
|
+
const error = createError2(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE);
|
|
3816
|
+
callbacksRef.current.onAdFailedToRender?.(
|
|
3817
|
+
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, error)
|
|
3866
3818
|
);
|
|
3867
|
-
callbacksRef.current.onAdFailedToRender?.(buildBannerErrorPayload(slotIdRef.current, adGroupId, error));
|
|
3868
3819
|
return;
|
|
3869
3820
|
}
|
|
3870
3821
|
loadingRef.current = true;
|
|
3871
|
-
loadAd(
|
|
3822
|
+
loadAd(normalizedAdGroupId).then((result) => {
|
|
3872
3823
|
if (!isMountedRef.current) return;
|
|
3873
3824
|
if (result.type === "noFill") {
|
|
3874
|
-
callbacksRef.current.onNoFill?.(buildNoFillPayload(slotIdRef.current,
|
|
3825
|
+
callbacksRef.current.onNoFill?.(buildNoFillPayload(slotIdRef.current, normalizedAdGroupId));
|
|
3875
3826
|
return;
|
|
3876
3827
|
}
|
|
3877
3828
|
if (result.type === "error") {
|
|
3878
3829
|
callbacksRef.current.onAdFailedToRender?.(
|
|
3879
|
-
buildBannerErrorPayload(slotIdRef.current,
|
|
3830
|
+
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, result.error)
|
|
3880
3831
|
);
|
|
3881
3832
|
return;
|
|
3882
3833
|
}
|
|
3883
3834
|
if (!isValidCreative(result.ad)) {
|
|
3884
3835
|
const invalidError = createError2(ERROR_CODES.INTERNAL_ERROR, "Invalid creative payload");
|
|
3885
3836
|
callbacksRef.current.onAdFailedToRender?.(
|
|
3886
|
-
buildBannerErrorPayload(slotIdRef.current,
|
|
3837
|
+
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, invalidError)
|
|
3887
3838
|
);
|
|
3888
3839
|
return;
|
|
3889
3840
|
}
|
|
@@ -3899,7 +3850,7 @@ function InlineAd(props) {
|
|
|
3899
3850
|
clearTimeout(viewableTimerRef.current);
|
|
3900
3851
|
viewableTimerRef.current = null;
|
|
3901
3852
|
}
|
|
3902
|
-
const payload = buildBannerEventPayload(slotIdRef.current,
|
|
3853
|
+
const payload = buildBannerEventPayload(slotIdRef.current, normalizedAdGroupId, result.ad);
|
|
3903
3854
|
eventPayloadRef.current = payload;
|
|
3904
3855
|
eventTrackerRef.current = new EventTracker(
|
|
3905
3856
|
result.ad.eventTrackingUrls ?? [],
|
|
@@ -3913,7 +3864,9 @@ function InlineAd(props) {
|
|
|
3913
3864
|
}).catch((error) => {
|
|
3914
3865
|
if (!isMountedRef.current) return;
|
|
3915
3866
|
const adError = error instanceof Error ? createError2(ERROR_CODES.INTERNAL_ERROR, error.message) : createError2(ERROR_CODES.INTERNAL_ERROR, "Unknown error");
|
|
3916
|
-
callbacksRef.current.onAdFailedToRender?.(
|
|
3867
|
+
callbacksRef.current.onAdFailedToRender?.(
|
|
3868
|
+
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, adError)
|
|
3869
|
+
);
|
|
3917
3870
|
}).finally(() => {
|
|
3918
3871
|
loadingRef.current = false;
|
|
3919
3872
|
});
|
|
@@ -3937,7 +3890,7 @@ function InlineAd(props) {
|
|
|
3937
3890
|
loadRef.current?.();
|
|
3938
3891
|
}
|
|
3939
3892
|
});
|
|
3940
|
-
|
|
3893
|
+
useEffect13(() => {
|
|
3941
3894
|
if (!ad || hasRenderedRef.current) {
|
|
3942
3895
|
return;
|
|
3943
3896
|
}
|