@apps-in-toss/framework 0.0.0-dev.1757573431379 → 0.0.0-dev.1758103372343

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.js CHANGED
@@ -149,16 +149,56 @@ function AppUpdate() {
149
149
  return /* @__PURE__ */ jsx(Fragment, {});
150
150
  }
151
151
 
152
- // src/core/components/BuiltinNavigationBar/index.tsx
152
+ // src/core/hooks/useAppsInTossBridge.ts
153
153
  import { appsInTossEvent } from "@apps-in-toss/native-modules";
154
+ import { useBridge } from "@toss-design-system/react-native";
155
+ import { useEffect as useEffect4 } from "react";
156
+
157
+ // src/core/utils/getAppsInTossGlobals.ts
158
+ function getAppsInTossGlobals() {
159
+ if (global.__appsInToss == null) {
160
+ throw new Error("invalid apps-in-toss globals");
161
+ }
162
+ return global.__appsInToss;
163
+ }
164
+
165
+ // src/core/utils/toIcon.ts
166
+ function toIcon(source) {
167
+ return source.startsWith("http") ? { source: { uri: source } } : { name: source };
168
+ }
169
+
170
+ // src/core/hooks/useAppsInTossBridge.ts
171
+ function useAppsInTossBridge() {
172
+ const controller = useBridge();
173
+ const appsInTossGlobals = getAppsInTossGlobals();
174
+ useEffect4(() => {
175
+ const commonProps = {
176
+ serviceName: appsInTossGlobals.brandDisplayName,
177
+ icon: toIcon(appsInTossGlobals.brandIcon),
178
+ color: appsInTossGlobals.brandPrimaryColor,
179
+ colorMode: appsInTossGlobals.brandBridgeColorMode
180
+ };
181
+ controller.open({
182
+ ...commonProps,
183
+ onExited: () => {
184
+ appsInTossEvent.emit("entryMessageExited", void 0);
185
+ }
186
+ });
187
+ }, []);
188
+ }
189
+
190
+ // src/components/NavigationBar/RNNavigationBar.tsx
154
191
  import { closeView, useBackEventContext, useNavigation } from "@granite-js/react-native";
155
192
  import { useDialog as useDialog2 } from "@toss-design-system/react-native";
156
193
  import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss-design-system/react-native/private";
157
194
  import { josa } from "es-hangul";
158
- import { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef2 } from "react";
195
+ import { useCallback as useCallback3, useEffect as useEffect7 } from "react";
159
196
  import { BackHandler } from "react-native";
160
197
 
161
- // src/core/components/BuiltinNavigationBar/useBuiltinNavigationBarLogging.tsx
198
+ // src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
199
+ import { useEffect as useEffect5, useRef as useRef2 } from "react";
200
+
201
+ // src/components/NavigationBar/common/useNavigationBarLogging.tsx
162
202
  import { INTERNAL__module as INTERNAL__module3 } from "@apps-in-toss/native-modules";
163
203
  import { Granite as Granite3 } from "@granite-js/react-native";
164
204
  var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
@@ -171,7 +211,7 @@ var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
171
211
  var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
172
212
  var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
173
213
  var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
174
- function useBuiltinNavigationBarLogging() {
214
+ function useNavigationBarLogging() {
175
215
  const referrer = useReferrer();
176
216
  const baseParams = {
177
217
  referrer,
@@ -242,12 +282,29 @@ function useBuiltinNavigationBarLogging() {
242
282
  };
243
283
  }
244
284
 
285
+ // src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
286
+ import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
287
+ function NavigationBarImpressionArea({
288
+ children,
289
+ withHomeButton
290
+ }) {
291
+ const hasLogged = useRef2(false);
292
+ const logging = useNavigationBarLogging();
293
+ useEffect5(() => {
294
+ if (hasLogged.current === false) {
295
+ logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
296
+ hasLogged.current = true;
297
+ }
298
+ }, []);
299
+ return /* @__PURE__ */ jsx2(Fragment2, { children });
300
+ }
301
+
245
302
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
246
303
  import { INTERNAL__appBridgeHandler, isMinVersionSupported } from "@apps-in-toss/native-modules";
247
304
  import { openURL as openURL3 } from "@granite-js/react-native";
248
305
  import { BottomSheet, List, ListHeader, ListRow } from "@toss-design-system/react-native";
249
306
  import { useAdaptive, useOverlay } from "@toss-design-system/react-native/private";
250
- import { useEffect as useEffect4, useState } from "react";
307
+ import { useEffect as useEffect6, useState } from "react";
251
308
 
252
309
  // src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
253
310
  import { INTERNAL__module as INTERNAL__module4 } from "@apps-in-toss/native-modules";
@@ -420,16 +477,8 @@ function ensureValue(value, name) {
420
477
  return value;
421
478
  }
422
479
 
423
- // src/core/utils/getAppsInTossGlobals.ts
424
- function getAppsInTossGlobals() {
425
- if (global.__appsInToss == null) {
426
- throw new Error("invalid apps-in-toss globals");
427
- }
428
- return global.__appsInToss;
429
- }
430
-
431
480
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
432
- import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
481
+ import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
433
482
  var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
434
483
  function useMoreButtonBottomSheet() {
435
484
  const globals = getAppsInTossGlobals();
@@ -443,7 +492,7 @@ function useMoreButtonBottomSheet() {
443
492
  android: "5.226.0",
444
493
  ios: "5.226.0"
445
494
  });
446
- useEffect4(() => {
495
+ useEffect6(() => {
447
496
  if (!isSupported) {
448
497
  return;
449
498
  }
@@ -470,17 +519,17 @@ function useMoreButtonBottomSheet() {
470
519
  logging.close();
471
520
  close();
472
521
  };
473
- return /* @__PURE__ */ jsx2(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx2(
522
+ return /* @__PURE__ */ jsx3(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx3(
474
523
  BottomSheet.Root,
475
524
  {
476
- header: /* @__PURE__ */ jsx2(
525
+ header: /* @__PURE__ */ jsx3(
477
526
  ListHeader,
478
527
  {
479
- title: /* @__PURE__ */ jsx2(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
528
+ title: /* @__PURE__ */ jsx3(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
480
529
  }
481
530
  ),
482
531
  open: isOpen,
483
- cta: /* @__PURE__ */ jsx2(
532
+ cta: /* @__PURE__ */ jsx3(
484
533
  BottomSheet.CTA,
485
534
  {
486
535
  size: "large",
@@ -494,11 +543,11 @@ function useMoreButtonBottomSheet() {
494
543
  ),
495
544
  onClose: handleClose,
496
545
  onExited: exit,
497
- children: /* @__PURE__ */ jsx2(List, { rowSeparator: "none", children: itemList.map((item) => {
498
- return /* @__PURE__ */ jsx2(
546
+ children: /* @__PURE__ */ jsx3(List, { rowSeparator: "none", children: itemList.map((item) => {
547
+ return /* @__PURE__ */ jsx3(
499
548
  ListRow,
500
549
  {
501
- left: /* @__PURE__ */ jsx2(
550
+ left: /* @__PURE__ */ jsx3(
502
551
  ListRow.Icon,
503
552
  {
504
553
  color: globals.brandPrimaryColor,
@@ -506,7 +555,7 @@ function useMoreButtonBottomSheet() {
506
555
  type: "background"
507
556
  }
508
557
  ),
509
- contents: /* @__PURE__ */ jsx2(
558
+ contents: /* @__PURE__ */ jsx3(
510
559
  ListRow.Texts,
511
560
  {
512
561
  type: "1RowTypeA",
@@ -531,10 +580,10 @@ function useMoreButtonBottomSheet() {
531
580
  }
532
581
  function BottomSheetImpressionArea({ children }) {
533
582
  const logging = useMoreButtonBottomSheetLogging();
534
- useEffect4(() => {
583
+ useEffect6(() => {
535
584
  logging.show();
536
585
  }, [logging]);
537
- return /* @__PURE__ */ jsx2(Fragment2, { children });
586
+ return /* @__PURE__ */ jsx3(Fragment3, { children });
538
587
  }
539
588
 
540
589
  // src/core/utils/safeParseNavigationBar.ts
@@ -549,44 +598,25 @@ function safeParseNavigationBar(navigationBar) {
549
598
  }
550
599
  }
551
600
 
552
- // src/core/utils/toIcon.ts
553
- function toIcon(source) {
554
- return source.startsWith("http") ? { source: { uri: source } } : { name: source };
555
- }
556
-
557
- // src/core/components/BuiltinNavigationBar/index.tsx
558
- import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
559
- function BuiltinNavigationBar() {
601
+ // src/components/NavigationBar/RNNavigationBar.tsx
602
+ import { jsx as jsx4 } from "react/jsx-runtime";
603
+ function RNNavigationBar() {
560
604
  const globals = getAppsInTossGlobals();
561
605
  const { captureExitLog } = useCaptureExitLog();
562
- const logging = useBuiltinNavigationBarLogging();
606
+ const logging = useNavigationBarLogging();
563
607
  const { openConfirm } = useDialog2();
564
608
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
565
609
  const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
566
610
  const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
567
611
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
568
612
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
569
- const isExternalWebView = globals.webViewType === "external";
570
- const isGameWebView = globals.webViewType === "game";
571
613
  const backEventContext = useBackEventContext();
572
- const overrideCanGoBack = !backEventContext.hasBackEvent;
573
614
  const handleBackOrClose = useBackOrCloseNavigation();
574
615
  const navigation = useNavigation();
575
616
  const handlePressTitle = useCallback3(() => {
576
617
  logging.homeButtonClick();
577
- if (globals.webViewType != null) {
578
- appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
579
- return;
580
- }
581
618
  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]);
619
+ }, [logging, navigation]);
590
620
  const handleClose = useCallback3(async () => {
591
621
  logging.closeButtonClick();
592
622
  const isConfirmed = await openConfirm({
@@ -602,26 +632,30 @@ function BuiltinNavigationBar() {
602
632
  closeView();
603
633
  }
604
634
  }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
605
- useEffect5(() => {
606
- const backHandler = () => {
607
- handleClose();
608
- return true;
609
- };
610
- BackHandler.addEventListener("hardwareBackPress", backHandler);
635
+ const handleBack = useCallback3(() => {
636
+ if (backEventContext.hasBackEvent) {
637
+ backEventContext.onBack();
638
+ return;
639
+ }
640
+ handleBackOrClose();
641
+ }, [backEventContext, handleBackOrClose]);
642
+ const handleAndroidBackEvent = useCallback3(() => {
643
+ handleBack();
644
+ return true;
645
+ }, [handleBack]);
646
+ useEffect7(() => {
647
+ BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
611
648
  return () => {
612
- BackHandler.removeEventListener("hardwareBackPress", backHandler);
649
+ BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
613
650
  };
614
- }, [handleClose]);
615
- if (isExternalWebView) {
616
- return /* @__PURE__ */ jsx3(Fragment3, {});
617
- }
618
- return /* @__PURE__ */ jsx3(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx3(
651
+ }, [handleAndroidBackEvent]);
652
+ return /* @__PURE__ */ jsx4(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx4(
619
653
  TopNavigation,
620
654
  {
621
655
  title: globals.brandDisplayName,
622
656
  icon: toIcon(globals.brandIcon),
623
657
  onPressDots: openMoreButtonBottomSheet,
624
- contentVisible: isGameWebView ? false : true,
658
+ contentVisible: true,
625
659
  onPressTitle: withHomeButton ? handlePressTitle : void 0,
626
660
  onPressClose: handleClose,
627
661
  withHome: withHomeButton,
@@ -630,81 +664,46 @@ function BuiltinNavigationBar() {
630
664
  icon: initialAccessoryButton.icon,
631
665
  id: initialAccessoryButton.id
632
666
  } : void 0,
633
- children: isGameWebView === false ? /* @__PURE__ */ jsx3(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx3(NavigationBackButton, { onPress: handleBack, canGoBack: false }) }) : null
667
+ children: /* @__PURE__ */ jsx4(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx4(NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
634
668
  }
635
669
  ) });
636
670
  }
637
671
  function useBackOrCloseNavigation() {
638
672
  const navigation = useNavigation();
673
+ const { captureExitLog } = useCaptureExitLog();
639
674
  return useCallback3(() => {
640
675
  if (navigation.canGoBack()) {
641
676
  navigation.goBack();
642
677
  } else {
678
+ captureExitLog(Date.now());
643
679
  closeView();
644
680
  }
645
- }, [navigation]);
646
- }
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 });
660
- }
661
-
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
- }, []);
681
+ }, [captureExitLog, navigation]);
683
682
  }
684
683
 
685
684
  // src/core/registerApp.tsx
686
- import { Fragment as Fragment4, jsx as jsx4, jsxs } from "react/jsx-runtime";
685
+ import { Fragment as Fragment4, jsx as jsx5, jsxs } from "react/jsx-runtime";
687
686
  function AppsInTossContainer(Container, { children, ...initialProps }) {
688
687
  if (!isMinVersionSupported2({
689
688
  android: "5.220.0",
690
689
  ios: "5.221.0"
691
690
  })) {
692
691
  return /* @__PURE__ */ jsxs(Fragment4, { children: [
693
- /* @__PURE__ */ jsx4(AppEvent.Entry, {}),
694
- /* @__PURE__ */ jsx4(AppEvent.System, { ...initialProps }),
695
- /* @__PURE__ */ jsx4(AppUpdate, {})
692
+ /* @__PURE__ */ jsx5(AppEvent.Entry, {}),
693
+ /* @__PURE__ */ jsx5(AppEvent.System, { ...initialProps }),
694
+ /* @__PURE__ */ jsx5(AppUpdate, {})
696
695
  ] });
697
696
  }
698
697
  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 }) }) })
698
+ /* @__PURE__ */ jsx5(AppEvent.StayTime, {}),
699
+ /* @__PURE__ */ jsx5(AppEvent.Entry, {}),
700
+ /* @__PURE__ */ jsx5(AppEvent.System, { ...initialProps }),
701
+ /* @__PURE__ */ jsx5(Container, { ...initialProps, children: /* @__PURE__ */ jsx5(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx5(TDSContainer, { ...initialProps, children }) }) })
703
702
  ] });
704
703
  }
705
704
  function TDSContainer({ children }) {
706
705
  useAppsInTossBridge();
707
- return /* @__PURE__ */ jsx4(Fragment4, { children });
706
+ return /* @__PURE__ */ jsx5(Fragment4, { children });
708
707
  }
709
708
  function registerApp(container, { context, analytics }) {
710
709
  const appName = getAppName();
@@ -730,8 +729,9 @@ function registerApp(container, { context, analytics }) {
730
729
  return global.Page;
731
730
  }
732
731
  function AppsInTossScreenContainer({ children }) {
732
+ const isRN = getAppsInTossGlobals().webViewType == null;
733
733
  return /* @__PURE__ */ jsxs(Analytics.Screen, { children: [
734
- /* @__PURE__ */ jsx4(BuiltinNavigationBar, {}),
734
+ isRN && /* @__PURE__ */ jsx5(RNNavigationBar, {}),
735
735
  children
736
736
  ] });
737
737
  }
@@ -750,7 +750,7 @@ var AppsInToss = {
750
750
  };
751
751
 
752
752
  // src/components/WebView.tsx
753
- import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInTossEvent4 } from "@apps-in-toss/native-modules";
753
+ import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInTossEvent3 } from "@apps-in-toss/native-modules";
754
754
  import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
755
755
  import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
756
756
  import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
@@ -758,22 +758,22 @@ import { getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/reac
758
758
  import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
759
759
  import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
760
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";
761
+ import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2, useTopNavigation } from "@toss-design-system/react-native/private";
762
+ import { useMemo as useMemo3, useState as useState6 } from "react";
763
+ import { Platform as Platform4 } from "react-native";
764
764
 
765
765
  // src/components/GameWebView.tsx
766
- import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment } from "@apps-in-toss/native-modules";
766
+ import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent2, getOperationalEnvironment } from "@apps-in-toss/native-modules";
767
767
  import {
768
768
  WebView as PlainWebView
769
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";
770
+ import { forwardRef, useEffect as useEffect10, useState as useState3 } from "react";
771
+ import { Platform as Platform3 } from "react-native";
772
772
 
773
773
  // src/components/GameProfile.tsx
774
774
  import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported as isMinVersionSupported3 } from "@apps-in-toss/native-modules";
775
775
  import { Loader } from "@toss-design-system/react-native";
776
- import { useEffect as useEffect7 } from "react";
776
+ import { useEffect as useEffect8 } from "react";
777
777
  import { Pressable, View } from "react-native";
778
778
 
779
779
  // src/constant/game-center.ts
@@ -793,13 +793,13 @@ import { useCallback as useCallback4, useRef as useRef3, useState as useState2 }
793
793
  // src/components/GameProfileToast.tsx
794
794
  import { Asset, Toast } from "@toss-design-system/react-native";
795
795
  import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay as useOverlay2 } from "@toss-design-system/react-native/private";
796
- import { jsx as jsx5 } from "react/jsx-runtime";
796
+ import { jsx as jsx6 } from "react/jsx-runtime";
797
797
  var useGameProfileToast = () => {
798
798
  const overlay = useOverlay2();
799
799
  const openGameProfileToast = (nickname, profileImageUri) => {
800
800
  return new Promise((resolve) => {
801
801
  overlay.open(({ isOpen, close, exit }) => {
802
- return /* @__PURE__ */ jsx5(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx5(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx5(
802
+ return /* @__PURE__ */ jsx6(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx6(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx6(
803
803
  Toast,
804
804
  {
805
805
  open: isOpen,
@@ -810,7 +810,7 @@ var useGameProfileToast = () => {
810
810
  onExited: exit,
811
811
  position: "top",
812
812
  text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
813
- icon: /* @__PURE__ */ jsx5(
813
+ icon: /* @__PURE__ */ jsx6(
814
814
  Asset.Image,
815
815
  {
816
816
  style: { borderRadius: 64, overflow: "hidden" },
@@ -965,7 +965,7 @@ var Z_INDEX = {
965
965
  };
966
966
 
967
967
  // src/components/GameProfile.tsx
968
- import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
968
+ import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
969
969
  var GameProfile = ({ children, isReadyForProfileUI }) => {
970
970
  const {
971
971
  profileData,
@@ -981,7 +981,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
981
981
  openErrorAlert,
982
982
  openGameProfileToast
983
983
  } = useGameCenterProfile(isReadyForProfileUI);
984
- useEffect7(() => {
984
+ useEffect8(() => {
985
985
  try {
986
986
  const getProfileData = async () => {
987
987
  const data = await getGameCenterGameProfile2();
@@ -994,7 +994,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
994
994
  setIsProfileDataLoading(false);
995
995
  }
996
996
  }, []);
997
- useEffect7(() => {
997
+ useEffect8(() => {
998
998
  const handleGameProfileFlow = async () => {
999
999
  if (!canShowBottomSheetOrToast) {
1000
1000
  return;
@@ -1026,8 +1026,8 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1026
1026
  ]);
1027
1027
  if (!isMinVersionSupported3(GAME_CENTER_MIN_VERSION)) {
1028
1028
  return /* @__PURE__ */ jsxs2(Fragment5, { children: [
1029
- /* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }),
1030
- /* @__PURE__ */ jsx6(
1029
+ /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
1030
+ /* @__PURE__ */ jsx7(
1031
1031
  Pressable,
1032
1032
  {
1033
1033
  style: {
@@ -1042,8 +1042,8 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1042
1042
  }
1043
1043
  if (shouldShowLoadingOverlay || isProfileDataRefetching) {
1044
1044
  return /* @__PURE__ */ jsxs2(Fragment5, { children: [
1045
- /* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }),
1046
- /* @__PURE__ */ jsx6(
1045
+ /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
1046
+ /* @__PURE__ */ jsx7(
1047
1047
  View,
1048
1048
  {
1049
1049
  style: {
@@ -1052,15 +1052,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1052
1052
  alignItems: "center",
1053
1053
  backgroundColor: "rgba(0, 0, 0, 0.2)"
1054
1054
  },
1055
- children: /* @__PURE__ */ jsx6(Loader, { size: "large", type: "light" })
1055
+ children: /* @__PURE__ */ jsx7(Loader, { size: "large", type: "light" })
1056
1056
  }
1057
1057
  )
1058
1058
  ] });
1059
1059
  }
1060
1060
  if (shouldShowProfileNotFoundOverlay) {
1061
1061
  return /* @__PURE__ */ jsxs2(Fragment5, { children: [
1062
- /* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }),
1063
- shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx6(
1062
+ /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
1063
+ shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx7(
1064
1064
  Pressable,
1065
1065
  {
1066
1066
  style: {
@@ -1073,7 +1073,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1073
1073
  )
1074
1074
  ] });
1075
1075
  }
1076
- return /* @__PURE__ */ jsx6(Fragment5, { children: /* @__PURE__ */ jsx6(View, { style: { flex: 1, position: "relative" }, children }) });
1076
+ return /* @__PURE__ */ jsx7(Fragment5, { children: /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }) });
1077
1077
  };
1078
1078
  var overlayStyle = {
1079
1079
  position: "absolute",
@@ -1084,12 +1084,82 @@ var overlayStyle = {
1084
1084
  zIndex: Z_INDEX.PROFILE_OVERLAY
1085
1085
  };
1086
1086
 
1087
+ // src/components/NavigationBar/GameWebviewNavigationBar.tsx
1088
+ import { closeView as closeView3 } from "@granite-js/react-native";
1089
+ import { PageNavbar, useDialog as useDialog4 } from "@toss-design-system/react-native";
1090
+ import { NavigationRightContent, useSafeAreaTop } from "@toss-design-system/react-native/private";
1091
+ import { josa as josa3 } from "es-hangul";
1092
+ import { useCallback as useCallback5, useEffect as useEffect9 } from "react";
1093
+ import { BackHandler as BackHandler2, Platform as Platform2, View as View2 } from "react-native";
1094
+ import { Fragment as Fragment6, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1095
+ function GameWebviewNavigationBar() {
1096
+ const safeAreaTop = useSafeAreaTop();
1097
+ const { openConfirm } = useDialog4();
1098
+ const { captureExitLog } = useCaptureExitLog();
1099
+ const global2 = getAppsInTossGlobals();
1100
+ const logging = useNavigationBarLogging();
1101
+ const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1102
+ const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1103
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1104
+ const handleGameWebviewClose = useCallback5(async () => {
1105
+ const isConfirmed = await openConfirm({
1106
+ title: `${josa3(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1107
+ leftButton: "\uCDE8\uC18C",
1108
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
1109
+ closeOnDimmerClick: true,
1110
+ onEntered: logging.closePopupShow
1111
+ });
1112
+ logging.closePopupCtaClick(isConfirmed);
1113
+ if (isConfirmed) {
1114
+ captureExitLog(Date.now());
1115
+ closeView3();
1116
+ }
1117
+ }, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
1118
+ const handleAndroidBackEvent = useCallback5(() => {
1119
+ handleGameWebviewClose();
1120
+ return true;
1121
+ }, [handleGameWebviewClose]);
1122
+ useEffect9(() => {
1123
+ BackHandler2.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1124
+ return () => BackHandler2.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1125
+ }, [handleAndroidBackEvent]);
1126
+ return /* @__PURE__ */ jsxs3(Fragment6, { children: [
1127
+ /* @__PURE__ */ jsx8(PageNavbar, { preference: { type: "none" } }),
1128
+ /* @__PURE__ */ jsx8(
1129
+ View2,
1130
+ {
1131
+ style: {
1132
+ width: "100%",
1133
+ height: Platform2.OS === "ios" ? 44 : 54,
1134
+ flexDirection: "row",
1135
+ alignItems: "center",
1136
+ justifyContent: "flex-end",
1137
+ position: "absolute",
1138
+ zIndex: Z_INDEX.CLOSE_BUTTON,
1139
+ marginTop: safeAreaTop,
1140
+ paddingRight: 10
1141
+ },
1142
+ pointerEvents: "box-none",
1143
+ children: /* @__PURE__ */ jsx8(
1144
+ NavigationRightContent,
1145
+ {
1146
+ fixedRightButton: initialAccessoryButton,
1147
+ onPressDots: openMoreButtonBottomSheet,
1148
+ onPressClose: handleGameWebviewClose,
1149
+ theme: "dark"
1150
+ }
1151
+ )
1152
+ }
1153
+ )
1154
+ ] });
1155
+ }
1156
+
1087
1157
  // src/components/GameWebView.tsx
1088
- import { Fragment as Fragment6, jsx as jsx7 } from "react/jsx-runtime";
1158
+ import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1089
1159
  var GameWebView = forwardRef(function GameWebView2(props, ref) {
1090
1160
  const [isEntryMessageExited, setIsEntryMessageExited] = useState3(false);
1091
- useEffect8(() => {
1092
- if (Platform2.OS === "ios") {
1161
+ useEffect10(() => {
1162
+ if (Platform3.OS === "ios") {
1093
1163
  setIosSwipeGestureEnabled2({ isEnabled: false });
1094
1164
  return () => {
1095
1165
  setIosSwipeGestureEnabled2({ isEnabled: true });
@@ -1097,21 +1167,78 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1097
1167
  }
1098
1168
  return;
1099
1169
  }, []);
1100
- useEffect8(() => {
1101
- appsInTossEvent3.addEventListener("entryMessageExited", {
1170
+ useEffect10(() => {
1171
+ appsInTossEvent2.addEventListener("entryMessageExited", {
1102
1172
  onEvent: () => {
1103
1173
  setIsEntryMessageExited(true);
1104
1174
  }
1105
1175
  });
1106
1176
  }, []);
1107
- return /* @__PURE__ */ jsx7(Fragment6, { children: getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx7(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx7(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx7(PlainWebView, { ref, ...props }) });
1177
+ return /* @__PURE__ */ jsxs4(Fragment7, { children: [
1178
+ /* @__PURE__ */ jsx9(GameWebviewNavigationBar, {}),
1179
+ getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx9(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx9(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx9(PlainWebView, { ref, ...props })
1180
+ ] });
1108
1181
  });
1109
1182
 
1110
1183
  // src/components/PartnerWebView.tsx
1184
+ import { closeView as closeView5 } from "@apps-in-toss/native-modules";
1111
1185
  import {
1112
1186
  WebView as PlainWebView2
1113
1187
  } from "@granite-js/native/react-native-webview";
1114
- import { forwardRef as forwardRef2, useRef as useRef4 } from "react";
1188
+ import { forwardRef as forwardRef2, useCallback as useCallback8, useEffect as useEffect11, useRef as useRef4 } from "react";
1189
+ import { BackHandler as BackHandler3 } from "react-native";
1190
+
1191
+ // src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
1192
+ import { closeView as closeView4 } from "@granite-js/react-native";
1193
+ import { useDialog as useDialog5 } from "@toss-design-system/react-native";
1194
+ import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss-design-system/react-native/private";
1195
+ import { josa as josa4 } from "es-hangul";
1196
+ import { useCallback as useCallback6 } from "react";
1197
+ import { jsx as jsx10 } from "react/jsx-runtime";
1198
+ function PartnerWebviewNavigationBar({ handleBackEvent, handleHomeIconButtonClick }) {
1199
+ const globals = getAppsInTossGlobals();
1200
+ const { captureExitLog } = useCaptureExitLog();
1201
+ const logging = useNavigationBarLogging();
1202
+ const { openConfirm } = useDialog5();
1203
+ const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1204
+ const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
1205
+ const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
1206
+ const withBackButton = parsedNavigationBar?.withBackButton ?? true;
1207
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1208
+ const handlePressTitle = useCallback6(() => {
1209
+ logging.homeButtonClick();
1210
+ handleHomeIconButtonClick();
1211
+ }, [handleHomeIconButtonClick, logging]);
1212
+ const handleClose = useCallback6(async () => {
1213
+ logging.closeButtonClick();
1214
+ const isConfirmed = await openConfirm({
1215
+ title: `${josa4(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1216
+ leftButton: "\uCDE8\uC18C",
1217
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
1218
+ closeOnDimmerClick: true,
1219
+ onEntered: logging.closePopupShow
1220
+ });
1221
+ logging.closePopupCtaClick(isConfirmed);
1222
+ if (isConfirmed) {
1223
+ captureExitLog(Date.now());
1224
+ closeView4();
1225
+ }
1226
+ }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
1227
+ return /* @__PURE__ */ jsx10(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx10(
1228
+ TopNavigation2,
1229
+ {
1230
+ title: globals.brandDisplayName,
1231
+ icon: toIcon(globals.brandIcon),
1232
+ onPressDots: openMoreButtonBottomSheet,
1233
+ contentVisible: true,
1234
+ onPressTitle: withHomeButton ? handlePressTitle : void 0,
1235
+ onPressClose: handleClose,
1236
+ withHome: withHomeButton,
1237
+ fixedRightButton: initialAccessoryButton,
1238
+ children: /* @__PURE__ */ jsx10(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx10(NavigationBackButton2, { onPress: handleBackEvent, canGoBack: false }) })
1239
+ }
1240
+ ) });
1241
+ }
1115
1242
 
1116
1243
  // src/core/utils/mergeRefs.ts
1117
1244
  function mergeRefs(...refs) {
@@ -1126,18 +1253,182 @@ function mergeRefs(...refs) {
1126
1253
  };
1127
1254
  }
1128
1255
 
1256
+ // src/hooks/useWebviewHistoryStack.tsx
1257
+ import { useCallback as useCallback7, useState as useState4 } from "react";
1258
+ function useWebViewHistory() {
1259
+ const [stack, setStack] = useState4([]);
1260
+ const [index, setIndex] = useState4(-1);
1261
+ const canGoBack = index > 0;
1262
+ const canGoForward = index >= 0 && index < stack.length - 1;
1263
+ const push = useCallback7(
1264
+ (url) => {
1265
+ setStack((prev) => {
1266
+ const base = prev.slice(0, index + 1);
1267
+ return [...base, url];
1268
+ });
1269
+ setIndex((i) => i + 1);
1270
+ },
1271
+ [index]
1272
+ );
1273
+ const onNavigationStateChange = useCallback7(
1274
+ ({ url }) => {
1275
+ if (stack.length === 0) {
1276
+ setStack([url]);
1277
+ setIndex(0);
1278
+ return;
1279
+ }
1280
+ const cur = stack[index];
1281
+ if (url === cur) {
1282
+ return;
1283
+ }
1284
+ const prev = index > 0 ? stack[index - 1] : void 0;
1285
+ const next = index < stack.length - 1 ? stack[index + 1] : void 0;
1286
+ if (prev && url === prev) {
1287
+ setIndex((i) => i - 1);
1288
+ return;
1289
+ }
1290
+ if (next && url === next) {
1291
+ setIndex((i) => i + 1);
1292
+ return;
1293
+ }
1294
+ push(url);
1295
+ },
1296
+ [stack, index, push]
1297
+ );
1298
+ return {
1299
+ onNavigationStateChange,
1300
+ canGoBack,
1301
+ canGoForward
1302
+ };
1303
+ }
1304
+
1305
+ // src/utils/log.ts
1306
+ import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
1307
+ import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
1308
+
1309
+ // src/utils/extractDateFromUUIDv7.ts
1310
+ var extractDateFromUUIDv7 = (uuid) => {
1311
+ const timestampHex = uuid.split("-").join("").slice(0, 12);
1312
+ const timestamp = Number.parseInt(timestampHex, 16);
1313
+ return new Date(timestamp);
1314
+ };
1315
+
1316
+ // src/utils/log.ts
1317
+ var getGroupId = (url) => {
1318
+ try {
1319
+ const urlObject = new URL(url);
1320
+ return {
1321
+ groupId: urlObject.pathname,
1322
+ search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1323
+ };
1324
+ } catch {
1325
+ return {
1326
+ groupId: "unknown",
1327
+ search: "unknown"
1328
+ };
1329
+ }
1330
+ };
1331
+ var getReferrer = () => {
1332
+ try {
1333
+ const referrer = new URL(getSchemeUri4());
1334
+ return referrer.searchParams.get("referrer");
1335
+ } catch {
1336
+ return "";
1337
+ }
1338
+ };
1339
+ var trackScreen = (url) => {
1340
+ const { groupId, search } = getGroupId(url);
1341
+ const log = {
1342
+ log_type: "screen",
1343
+ log_name: `${groupId}::screen`,
1344
+ params: {
1345
+ search,
1346
+ referrer: getReferrer(),
1347
+ deployment_id: env.getDeploymentId(),
1348
+ deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1349
+ }
1350
+ };
1351
+ return eventLogNative(log);
1352
+ };
1353
+
1129
1354
  // src/components/PartnerWebView.tsx
1130
- import { jsx as jsx8 } from "react/jsx-runtime";
1355
+ import { Fragment as Fragment8, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1131
1356
  var PartnerWebView = forwardRef2(
1132
1357
  function PartnerWebViewScreen(webViewProps, ref) {
1133
1358
  const webViewRef = useRef4(null);
1134
1359
  const refs = mergeRefs(ref, webViewRef);
1135
- return /* @__PURE__ */ jsx8(PlainWebView2, { ref: refs, ...webViewProps, style: { flex: 1 } });
1360
+ const { captureExitLog } = useCaptureExitLog();
1361
+ const { canGoBack, onNavigationStateChange } = useWebViewHistory();
1362
+ const historyBackScript = `
1363
+ (function() {
1364
+ history.back();
1365
+ true;
1366
+ })();
1367
+ `;
1368
+ const historyHomeScript = `
1369
+ (function() {
1370
+ history.replaceState(null, '', '/');
1371
+ true;
1372
+ })();
1373
+ `;
1374
+ const handleBackEvent = useCallback8(() => {
1375
+ if (canGoBack) {
1376
+ webViewRef.current?.injectJavaScript(historyBackScript);
1377
+ } else {
1378
+ captureExitLog(Date.now());
1379
+ closeView5();
1380
+ }
1381
+ }, [canGoBack, captureExitLog, historyBackScript]);
1382
+ const handleAndroidBackEvent = useCallback8(() => {
1383
+ if (canGoBack) {
1384
+ webViewRef.current?.injectJavaScript(historyBackScript);
1385
+ return true;
1386
+ } else {
1387
+ return false;
1388
+ }
1389
+ }, [canGoBack, historyBackScript]);
1390
+ useEffect11(() => {
1391
+ BackHandler3.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1392
+ return () => BackHandler3.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1393
+ }, [handleAndroidBackEvent]);
1394
+ const handleHomeIconButtonClick = useCallback8(() => {
1395
+ webViewRef.current?.injectJavaScript(historyHomeScript);
1396
+ }, [historyHomeScript]);
1397
+ const handleNavigationStateChange = useCallback8(
1398
+ (event) => {
1399
+ if (event.url) {
1400
+ trackScreen(event.url);
1401
+ }
1402
+ onNavigationStateChange(event);
1403
+ },
1404
+ [onNavigationStateChange]
1405
+ );
1406
+ return /* @__PURE__ */ jsxs5(Fragment8, { children: [
1407
+ /* @__PURE__ */ jsx11(
1408
+ PartnerWebviewNavigationBar,
1409
+ {
1410
+ handleBackEvent,
1411
+ handleHomeIconButtonClick
1412
+ }
1413
+ ),
1414
+ /* @__PURE__ */ jsx11(
1415
+ PlainWebView2,
1416
+ {
1417
+ ref: refs,
1418
+ ...webViewProps,
1419
+ style: { flex: 1 },
1420
+ onNavigationStateChange: (event) => {
1421
+ webViewProps?.onNavigationStateChange?.(event);
1422
+ handleNavigationStateChange(event);
1423
+ }
1424
+ }
1425
+ )
1426
+ ] });
1136
1427
  }
1137
1428
  );
1138
1429
 
1139
1430
  // src/bridge-handler/useBridgeHandler.tsx
1140
- import { useCallback as useCallback5, useMemo as useMemo2, useRef as useRef5 } from "react";
1431
+ import { useCallback as useCallback9, useMemo as useMemo2, useRef as useRef5 } from "react";
1141
1432
  function serializeError(error) {
1142
1433
  return JSON.stringify(error, (_, value) => {
1143
1434
  if (value instanceof Error) {
@@ -1214,7 +1505,7 @@ function useBridgeHandler({
1214
1505
  window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
1215
1506
  `);
1216
1507
  };
1217
- const $onMessage = useCallback5(
1508
+ const $onMessage = useCallback9(
1218
1509
  async (e) => {
1219
1510
  onMessage?.(e);
1220
1511
  const data = JSON.parse(e.nativeEvent.data);
@@ -1423,11 +1714,11 @@ function useCreateUserAgent({
1423
1714
  // src/hooks/useGeolocation.ts
1424
1715
  import { startUpdateLocation } from "@apps-in-toss/native-modules";
1425
1716
  import { useVisibility as useVisibility3 } from "@granite-js/react-native";
1426
- import { useEffect as useEffect9, useState as useState4 } from "react";
1717
+ import { useEffect as useEffect12, useState as useState5 } from "react";
1427
1718
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1428
1719
  const isVisible = useVisibility3();
1429
- const [location, setLocation] = useState4(null);
1430
- useEffect9(() => {
1720
+ const [location, setLocation] = useState5(null);
1721
+ useEffect12(() => {
1431
1722
  if (!isVisible) {
1432
1723
  return;
1433
1724
  }
@@ -1444,57 +1735,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1444
1735
  return location;
1445
1736
  }
1446
1737
 
1447
- // src/utils/log.ts
1448
- import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
1449
- import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
1450
-
1451
- // src/utils/extractDateFromUUIDv7.ts
1452
- var extractDateFromUUIDv7 = (uuid) => {
1453
- const timestampHex = uuid.split("-").join("").slice(0, 12);
1454
- const timestamp = Number.parseInt(timestampHex, 16);
1455
- return new Date(timestamp);
1456
- };
1457
-
1458
- // src/utils/log.ts
1459
- var getGroupId = (url) => {
1460
- try {
1461
- const urlObject = new URL(url);
1462
- return {
1463
- groupId: urlObject.pathname,
1464
- search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1465
- };
1466
- } catch {
1467
- return {
1468
- groupId: "unknown",
1469
- search: "unknown"
1470
- };
1471
- }
1472
- };
1473
- var getReferrer = () => {
1474
- try {
1475
- const referrer = new URL(getSchemeUri4());
1476
- return referrer.searchParams.get("referrer");
1477
- } catch {
1478
- return "";
1479
- }
1480
- };
1481
- var trackScreen = (url) => {
1482
- const { groupId, search } = getGroupId(url);
1483
- const log = {
1484
- log_type: "screen",
1485
- log_name: `${groupId}::screen`,
1486
- params: {
1487
- search,
1488
- referrer: getReferrer(),
1489
- deployment_id: env.getDeploymentId(),
1490
- deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1491
- }
1492
- };
1493
- return eventLogNative(log);
1494
- };
1495
-
1496
1738
  // src/components/WebView.tsx
1497
- import { jsx as jsx9 } from "react/jsx-runtime";
1739
+ import { jsx as jsx12 } from "react/jsx-runtime";
1498
1740
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
1499
1741
  var TYPES = ["partner", "external", "game"];
1500
1742
  var WEBVIEW_TYPES = {
@@ -1530,7 +1772,7 @@ function WebView({ type, local, onMessage, ...props }) {
1530
1772
  }
1531
1773
  const graniteEvent = useGraniteEvent();
1532
1774
  const uri = useMemo3(() => getWebViewUri(local), [local]);
1533
- const top = useSafeAreaTop();
1775
+ const top = useSafeAreaTop2();
1534
1776
  const bottom = useSafeAreaBottom();
1535
1777
  const global2 = getAppsInTossGlobals();
1536
1778
  const topNavigation = useTopNavigation();
@@ -1541,7 +1783,7 @@ function WebView({ type, local, onMessage, ...props }) {
1541
1783
  document.head.appendChild(style);
1542
1784
  })();
1543
1785
  `;
1544
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState5(
1786
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState6(
1545
1787
  props.allowsBackForwardNavigationGestures
1546
1788
  );
1547
1789
  const handler = useBridgeHandler({
@@ -1552,10 +1794,10 @@ function WebView({ type, local, onMessage, ...props }) {
1552
1794
  ...appsInTossEventBridges,
1553
1795
  navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1554
1796
  backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1555
- entryMessageExited: ({ onEvent, onError }) => appsInTossEvent4.addEventListener("entryMessageExited", { onEvent, onError }),
1556
- updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1797
+ entryMessageExited: ({ onEvent, onError }) => appsInTossEvent3.addEventListener("entryMessageExited", { onEvent, onError }),
1798
+ updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent3.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1557
1799
  /** @internal */
1558
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1800
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent3.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1559
1801
  /** AdMob */
1560
1802
  loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
1561
1803
  showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
@@ -1628,44 +1870,10 @@ function WebView({ type, local, onMessage, ...props }) {
1628
1870
  }, [global2.navigationBar, type]);
1629
1871
  const BaseWebView = WEBVIEW_TYPES[type];
1630
1872
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1631
- const [canHistoryGoBack, setCanHistoryGoBack] = useState5(false);
1632
- const handleNavigationStateChange = useCallback6(
1633
- (event) => {
1634
- if (event.url) {
1635
- trackScreen(event.url);
1636
- }
1637
- setCanHistoryGoBack(event.canGoBack);
1638
- },
1639
- [setCanHistoryGoBack]
1640
- );
1641
1873
  const userAgent = useCreateUserAgent({
1642
1874
  colorPreference: "light"
1643
1875
  });
1644
- const handleBackEvent = useCallback6(() => {
1645
- if (canHistoryGoBack) {
1646
- handler.ref.current?.goBack();
1647
- return true;
1648
- } else {
1649
- return false;
1650
- }
1651
- }, [canHistoryGoBack, handler]);
1652
- useEffect10(() => {
1653
- BackHandler2.addEventListener("hardwareBackPress", handleBackEvent);
1654
- return () => BackHandler2.removeEventListener("hardwareBackPress", handleBackEvent);
1655
- }, [handleBackEvent]);
1656
- useEffect10(() => {
1657
- return appsInTossEvent4.addEventListener("homeIconButtonClickEvent", {
1658
- onEvent: () => {
1659
- handler.ref?.current?.injectJavaScript(`
1660
- (function() {
1661
- window.history.replaceState(null, '', '/');
1662
- true;
1663
- })();
1664
- `);
1665
- }
1666
- });
1667
- }, [handler.ref]);
1668
- return /* @__PURE__ */ jsx9(
1876
+ return /* @__PURE__ */ jsx12(
1669
1877
  BaseWebView,
1670
1878
  {
1671
1879
  ref: handler.ref,
@@ -1678,15 +1886,14 @@ function WebView({ type, local, onMessage, ...props }) {
1678
1886
  "User-Agent": userAgent
1679
1887
  }
1680
1888
  },
1681
- userAgent: Platform3.OS === "ios" ? userAgent : void 0,
1889
+ userAgent: Platform4.OS === "ios" ? userAgent : void 0,
1682
1890
  sharedCookiesEnabled: true,
1683
1891
  webviewDebuggingEnabled: webViewDebuggingEnabled,
1684
1892
  thirdPartyCookiesEnabled: true,
1685
1893
  onMessage: handler.onMessage,
1686
- onNavigationStateChange: handleNavigationStateChange,
1687
1894
  injectedJavaScript: handler.injectedJavaScript,
1688
1895
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
1689
- decelerationRate: Platform3.OS === "ios" ? 1 : void 0,
1896
+ decelerationRate: Platform4.OS === "ios" ? 1 : void 0,
1690
1897
  allowsBackForwardNavigationGestures
1691
1898
  }
1692
1899
  );