@apps-in-toss/framework 1.1.3 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
5
5
  import { Analytics } from "@apps-in-toss/analytics";
6
6
  import { isMinVersionSupported as isMinVersionSupported2, setIosSwipeGestureEnabled, eventLog } from "@apps-in-toss/native-modules";
7
7
  import { Granite as Granite6 } from "@granite-js/react-native";
8
- import { TDSProvider } from "@toss-design-system/react-native";
8
+ import { TDSProvider } from "@toss/tds-react-native";
9
9
  import { AppRegistry } from "react-native";
10
10
 
11
11
  // src/core/components/AppEvent.tsx
@@ -151,7 +151,7 @@ function AppUpdate() {
151
151
 
152
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";
154
+ import { useBridge } from "@toss/tds-react-native";
155
155
  import { useEffect as useEffect4 } from "react";
156
156
 
157
157
  // src/core/utils/getAppsInTossGlobals.ts
@@ -189,8 +189,8 @@ function useAppsInTossBridge() {
189
189
 
190
190
  // src/components/NavigationBar/RNNavigationBar.tsx
191
191
  import { closeView, useBackEventContext, useNavigation } from "@granite-js/react-native";
192
- import { useDialog as useDialog2 } from "@toss-design-system/react-native";
193
- import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss-design-system/react-native/private";
192
+ import { useDialog as useDialog3 } from "@toss/tds-react-native";
193
+ import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss/tds-react-native/private";
194
194
  import { josa } from "es-hangul";
195
195
  import { useCallback as useCallback3, useEffect as useEffect7 } from "react";
196
196
  import { BackHandler } from "react-native";
@@ -302,10 +302,17 @@ function NavigationBarImpressionArea({
302
302
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
303
303
  import { INTERNAL__appBridgeHandler, isMinVersionSupported } from "@apps-in-toss/native-modules";
304
304
  import { openURL as openURL3 } from "@granite-js/react-native";
305
- import { BottomSheet, List, ListHeader, ListRow } from "@toss-design-system/react-native";
306
- import { useAdaptive, useOverlay } from "@toss-design-system/react-native/private";
305
+ import { BottomSheet, List, ListHeader, ListRow as ListRow2 } from "@toss/tds-react-native";
306
+ import { useAdaptive as useAdaptive2, useOverlay } from "@toss/tds-react-native/private";
307
307
  import { useEffect as useEffect6, useState } from "react";
308
308
 
309
+ // src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
310
+ import { getOperationalEnvironment } from "@apps-in-toss/native-modules";
311
+ import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
312
+ import { ListRow, useDialog } from "@toss/tds-react-native";
313
+ import { useAdaptive } from "@toss/tds-react-native/private";
314
+ import { NativeModules } from "react-native";
315
+
309
316
  // src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
310
317
  import { INTERNAL__module as INTERNAL__module4 } from "@apps-in-toss/native-modules";
311
318
  import { Granite as Granite4 } from "@granite-js/react-native";
@@ -375,10 +382,77 @@ function useMoreButtonBottomSheetLogging() {
375
382
  };
376
383
  }
377
384
 
385
+ // src/core/utils/url.ts
386
+ function addParamsToUrl(url, params) {
387
+ const urlObj = new URL(url);
388
+ for (const [key, value] of Object.entries(params)) {
389
+ urlObj.searchParams.set(key, value);
390
+ }
391
+ return urlObj.toString();
392
+ }
393
+
394
+ // src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
395
+ import { jsx as jsx3 } from "react/jsx-runtime";
396
+ var SHARE_SCHEME_REFERRER = "appsintoss.common_module_share";
397
+ var APP_SHARE_MENU_INFO = {
398
+ contactItemName: "\uACF5\uC720\uD558\uAE30",
399
+ contactIconUrl: "https://static.toss.im/icons/png/4x/icon-share-dots-mono.png"
400
+ };
401
+ function AppShareListMenu() {
402
+ const globals = getAppsInTossGlobals();
403
+ const adaptive = useAdaptive();
404
+ const logging = useMoreButtonBottomSheetLogging();
405
+ const initialScheme = getSchemeUri4();
406
+ const isSandbox = getOperationalEnvironment() === "sandbox";
407
+ const { openConfirm } = useDialog();
408
+ const schemeForShare = addParamsToUrl(initialScheme, {
409
+ referrer: SHARE_SCHEME_REFERRER
410
+ });
411
+ return /* @__PURE__ */ jsx3(
412
+ ListRow,
413
+ {
414
+ left: /* @__PURE__ */ jsx3(
415
+ ListRow.Icon,
416
+ {
417
+ color: globals.brandPrimaryColor,
418
+ source: { uri: APP_SHARE_MENU_INFO.contactIconUrl },
419
+ type: "background"
420
+ }
421
+ ),
422
+ contents: /* @__PURE__ */ jsx3(
423
+ ListRow.Texts,
424
+ {
425
+ type: "1RowTypeA",
426
+ top: APP_SHARE_MENU_INFO.contactItemName,
427
+ topProps: { color: adaptive.grey700 }
428
+ }
429
+ ),
430
+ verticalPadding: "extraSmall",
431
+ onPress: () => {
432
+ if (isSandbox) {
433
+ openConfirm({
434
+ title: "\uACF5\uC720\uD558\uAE30 \uAE30\uB2A5 \uBBF8\uC9C0\uC6D0",
435
+ description: "\uC0CC\uB4DC\uBC15\uC2A4 \uD658\uACBD\uC5D0\uC11C\uB294 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC5B4\uC694. \uCF58\uC194\uC744 \uD1B5\uD574 \uD1A0\uC2A4\uC571\uC5D0\uC11C \uD14C\uC2A4\uD2B8\uD574 \uC8FC\uC138\uC694.",
436
+ rightButton: "\uD655\uC778",
437
+ closeOnDimmerClick: true
438
+ });
439
+ return;
440
+ }
441
+ logging.menuClick({ title: APP_SHARE_MENU_INFO.contactItemName });
442
+ NativeModules.AppsInTossModule.shareWithScheme({
443
+ params: {
444
+ schemeURL: schemeForShare
445
+ }
446
+ });
447
+ }
448
+ }
449
+ );
450
+ }
451
+
378
452
  // src/hooks/useAppUpdateDialog.tsx
379
453
  import { INTERNAL__module as INTERNAL__module5 } from "@apps-in-toss/native-modules";
380
454
  import { Granite as Granite5, openURL as openURL2 } from "@granite-js/react-native";
381
- import { useDialog } from "@toss-design-system/react-native";
455
+ import { useDialog as useDialog2 } from "@toss/tds-react-native";
382
456
  import { useCallback as useCallback2 } from "react";
383
457
 
384
458
  // src/utils/market.ts
@@ -391,7 +465,7 @@ var getMarketLink = () => {
391
465
 
392
466
  // src/hooks/useAppUpdateDialog.tsx
393
467
  function useAppUpdateDialog() {
394
- const { openConfirm } = useDialog();
468
+ const { openConfirm } = useDialog2();
395
469
  const logging = useAppUpdateDialogLogging();
396
470
  const openAppUpdateDialog = useCallback2(
397
471
  async ({
@@ -478,22 +552,30 @@ function ensureValue(value, name) {
478
552
  }
479
553
 
480
554
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
481
- import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
555
+ import { Fragment as Fragment3, jsx as jsx4, jsxs } from "react/jsx-runtime";
482
556
  var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
557
+ var MIN_VERSION = {
558
+ BOTTOM_SHEET: {
559
+ android: "5.226.0",
560
+ ios: "5.226.0"
561
+ },
562
+ SHARE_LIST_MENU: {
563
+ android: "5.230.0",
564
+ ios: "5.230.0"
565
+ }
566
+ };
483
567
  function useMoreButtonBottomSheet() {
484
568
  const globals = getAppsInTossGlobals();
485
- const adaptive = useAdaptive();
569
+ const adaptive = useAdaptive2();
486
570
  const [itemList, setItemList] = useState([]);
487
571
  const appUpdateDialog = useAppUpdateDialog();
488
572
  const logging = useMoreButtonBottomSheetLogging();
489
573
  const overlay = useOverlay();
490
574
  const title = ensureValue(globals.brandDisplayName, "displayName");
491
- const isSupported = isMinVersionSupported({
492
- android: "5.226.0",
493
- ios: "5.226.0"
494
- });
575
+ const isBottomSheetSupported = isMinVersionSupported(MIN_VERSION.BOTTOM_SHEET);
576
+ const isShareListMenuSupported = isMinVersionSupported(MIN_VERSION.SHARE_LIST_MENU);
495
577
  useEffect6(() => {
496
- if (!isSupported) {
578
+ if (!isBottomSheetSupported) {
497
579
  return;
498
580
  }
499
581
  INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
@@ -504,10 +586,10 @@ function useMoreButtonBottomSheet() {
504
586
  onError: (error) => console.error("\uBA54\uB274 \uBAA9\uB85D\uC744 \uAC00\uC838\uC624\uB294 \uB370 \uC2E4\uD328\uD588\uC5B4\uC694:", error)
505
587
  }
506
588
  );
507
- }, [isSupported]);
589
+ }, [isBottomSheetSupported]);
508
590
  const onClickHandler = async () => {
509
591
  logging.open();
510
- if (!isSupported) {
592
+ if (!isBottomSheetSupported) {
511
593
  await appUpdateDialog.open({
512
594
  title: `\uC774 \uAE30\uB2A5\uC744 \uC4F0\uB824\uBA74 \uC571 \uC5C5\uB370\uC774\uD2B8\uAC00 \uD544\uC694\uD574\uC694`,
513
595
  description: `\uBB38\uC758, \uAD8C\uD55C \uC124\uC815, \uC2E0\uACE0 \uB4F1 \uAE30\uB2A5\uC744 \uC4F8 \uC218 \uC788\uC5B4\uC694`
@@ -519,17 +601,17 @@ function useMoreButtonBottomSheet() {
519
601
  logging.close();
520
602
  close();
521
603
  };
522
- return /* @__PURE__ */ jsx3(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx3(
604
+ return /* @__PURE__ */ jsx4(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx4(
523
605
  BottomSheet.Root,
524
606
  {
525
- header: /* @__PURE__ */ jsx3(
607
+ header: /* @__PURE__ */ jsx4(
526
608
  ListHeader,
527
609
  {
528
- title: /* @__PURE__ */ jsx3(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
610
+ title: /* @__PURE__ */ jsx4(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
529
611
  }
530
612
  ),
531
613
  open: isOpen,
532
- cta: /* @__PURE__ */ jsx3(
614
+ cta: /* @__PURE__ */ jsx4(
533
615
  BottomSheet.CTA,
534
616
  {
535
617
  size: "large",
@@ -543,35 +625,38 @@ function useMoreButtonBottomSheet() {
543
625
  ),
544
626
  onClose: handleClose,
545
627
  onExited: exit,
546
- children: /* @__PURE__ */ jsx3(List, { rowSeparator: "none", children: itemList.map((item) => {
547
- return /* @__PURE__ */ jsx3(
548
- ListRow,
549
- {
550
- left: /* @__PURE__ */ jsx3(
551
- ListRow.Icon,
552
- {
553
- color: globals.brandPrimaryColor,
554
- source: { uri: item.contactIconUrl },
555
- type: "background"
556
- }
557
- ),
558
- contents: /* @__PURE__ */ jsx3(
559
- ListRow.Texts,
560
- {
561
- type: "1RowTypeA",
562
- top: item.contactItemName,
563
- topProps: { color: adaptive.grey700 }
628
+ children: /* @__PURE__ */ jsxs(List, { rowSeparator: "none", children: [
629
+ itemList.map((item) => {
630
+ return /* @__PURE__ */ jsx4(
631
+ ListRow2,
632
+ {
633
+ left: /* @__PURE__ */ jsx4(
634
+ ListRow2.Icon,
635
+ {
636
+ color: globals.brandPrimaryColor,
637
+ source: { uri: item.contactIconUrl },
638
+ type: "background"
639
+ }
640
+ ),
641
+ contents: /* @__PURE__ */ jsx4(
642
+ ListRow2.Texts,
643
+ {
644
+ type: "1RowTypeA",
645
+ top: item.contactItemName,
646
+ topProps: { color: adaptive.grey700 }
647
+ }
648
+ ),
649
+ verticalPadding: "extraSmall",
650
+ onPress: () => {
651
+ logging.menuClick({ title: item.contactItemName });
652
+ openURL3(item.contactUri);
564
653
  }
565
- ),
566
- verticalPadding: "extraSmall",
567
- onPress: () => {
568
- logging.menuClick({ title: item.contactItemName });
569
- openURL3(item.contactUri);
570
- }
571
- },
572
- item.contactItemName
573
- );
574
- }) })
654
+ },
655
+ item.contactItemName
656
+ );
657
+ }),
658
+ isShareListMenuSupported && /* @__PURE__ */ jsx4(AppShareListMenu, {})
659
+ ] })
575
660
  }
576
661
  ) });
577
662
  });
@@ -583,7 +668,7 @@ function BottomSheetImpressionArea({ children }) {
583
668
  useEffect6(() => {
584
669
  logging.show();
585
670
  }, [logging]);
586
- return /* @__PURE__ */ jsx3(Fragment3, { children });
671
+ return /* @__PURE__ */ jsx4(Fragment3, { children });
587
672
  }
588
673
 
589
674
  // src/core/utils/safeParseNavigationBar.ts
@@ -599,12 +684,12 @@ function safeParseNavigationBar(navigationBar) {
599
684
  }
600
685
 
601
686
  // src/components/NavigationBar/RNNavigationBar.tsx
602
- import { jsx as jsx4 } from "react/jsx-runtime";
687
+ import { jsx as jsx5 } from "react/jsx-runtime";
603
688
  function RNNavigationBar() {
604
689
  const globals = getAppsInTossGlobals();
605
690
  const { captureExitLog } = useCaptureExitLog();
606
691
  const logging = useNavigationBarLogging();
607
- const { openConfirm } = useDialog2();
692
+ const { openConfirm } = useDialog3();
608
693
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
609
694
  const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
610
695
  const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
@@ -649,7 +734,7 @@ function RNNavigationBar() {
649
734
  BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
650
735
  };
651
736
  }, [handleBack]);
652
- return /* @__PURE__ */ jsx4(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx4(
737
+ return /* @__PURE__ */ jsx5(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx5(
653
738
  TopNavigation,
654
739
  {
655
740
  title: globals.brandDisplayName,
@@ -664,7 +749,7 @@ function RNNavigationBar() {
664
749
  icon: initialAccessoryButton.icon,
665
750
  id: initialAccessoryButton.id
666
751
  } : void 0,
667
- children: /* @__PURE__ */ jsx4(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx4(NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
752
+ children: /* @__PURE__ */ jsx5(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx5(NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
668
753
  }
669
754
  ) });
670
755
  }
@@ -682,28 +767,28 @@ function useBackOrCloseNavigation() {
682
767
  }
683
768
 
684
769
  // src/core/registerApp.tsx
685
- import { Fragment as Fragment4, jsx as jsx5, jsxs } from "react/jsx-runtime";
770
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
686
771
  function AppsInTossContainer(Container, { children, ...initialProps }) {
687
772
  if (!isMinVersionSupported2({
688
773
  android: "5.220.0",
689
774
  ios: "5.221.0"
690
775
  })) {
691
- return /* @__PURE__ */ jsxs(Fragment4, { children: [
692
- /* @__PURE__ */ jsx5(AppEvent.Entry, {}),
693
- /* @__PURE__ */ jsx5(AppEvent.System, { ...initialProps }),
694
- /* @__PURE__ */ jsx5(AppUpdate, {})
776
+ return /* @__PURE__ */ jsxs2(Fragment4, { children: [
777
+ /* @__PURE__ */ jsx6(AppEvent.Entry, {}),
778
+ /* @__PURE__ */ jsx6(AppEvent.System, { ...initialProps }),
779
+ /* @__PURE__ */ jsx6(AppUpdate, {})
695
780
  ] });
696
781
  }
697
- return /* @__PURE__ */ jsxs(Fragment4, { 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 }) }) })
782
+ return /* @__PURE__ */ jsxs2(Fragment4, { children: [
783
+ /* @__PURE__ */ jsx6(AppEvent.StayTime, {}),
784
+ /* @__PURE__ */ jsx6(AppEvent.Entry, {}),
785
+ /* @__PURE__ */ jsx6(AppEvent.System, { ...initialProps }),
786
+ /* @__PURE__ */ jsx6(Container, { ...initialProps, children: /* @__PURE__ */ jsx6(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx6(TDSContainer, { ...initialProps, children }) }) })
702
787
  ] });
703
788
  }
704
789
  function TDSContainer({ children }) {
705
790
  useAppsInTossBridge();
706
- return /* @__PURE__ */ jsx5(Fragment4, { children });
791
+ return /* @__PURE__ */ jsx6(Fragment4, { children });
707
792
  }
708
793
  function registerApp(container, { context, analytics }) {
709
794
  const appName = getAppName();
@@ -730,8 +815,8 @@ function registerApp(container, { context, analytics }) {
730
815
  }
731
816
  function AppsInTossScreenContainer({ children }) {
732
817
  const isReactNativeService = getAppsInTossGlobals().webViewType == null;
733
- return /* @__PURE__ */ jsxs(Analytics.Screen, { children: [
734
- isReactNativeService && /* @__PURE__ */ jsx5(RNNavigationBar, {}),
818
+ return /* @__PURE__ */ jsxs2(Analytics.Screen, { children: [
819
+ isReactNativeService && /* @__PURE__ */ jsx6(RNNavigationBar, {}),
735
820
  children
736
821
  ] });
737
822
  }
@@ -763,25 +848,23 @@ import {
763
848
  import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
764
849
  import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
765
850
  import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
766
- import { getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/react-native";
767
- import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
768
- import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
769
- import { ExternalWebViewScreen, tdsEvent } from "@toss-design-system/react-native";
770
- import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2, useTopNavigation } from "@toss-design-system/react-native/private";
771
- import { useMemo as useMemo4, useState as useState5 } from "react";
772
- import { Platform as Platform4 } from "react-native";
851
+ import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
852
+ import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
853
+ import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2, useTopNavigation } from "@toss/tds-react-native/private";
854
+ import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef6, useState as useState5 } from "react";
855
+ import { BackHandler as BackHandler2, Platform as Platform4 } from "react-native";
773
856
 
774
857
  // src/components/GameWebView.tsx
775
- import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent2, getOperationalEnvironment } from "@apps-in-toss/native-modules";
858
+ import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent2, getOperationalEnvironment as getOperationalEnvironment2 } from "@apps-in-toss/native-modules";
776
859
  import {
777
860
  WebView as PlainWebView
778
861
  } from "@granite-js/native/react-native-webview";
779
- import { forwardRef, useEffect as useEffect10, useState as useState3 } from "react";
862
+ import { forwardRef, useEffect as useEffect9, useState as useState3 } from "react";
780
863
  import { Platform as Platform3 } from "react-native";
781
864
 
782
865
  // src/components/GameProfile.tsx
783
866
  import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported as isMinVersionSupported3 } from "@apps-in-toss/native-modules";
784
- import { Loader } from "@toss-design-system/react-native";
867
+ import { Loader } from "@toss/tds-react-native";
785
868
  import { useEffect as useEffect8 } from "react";
786
869
  import { Pressable, View } from "react-native";
787
870
 
@@ -795,20 +878,20 @@ var GAME_CENTER_MIN_VERSION = {
795
878
  // src/hooks/useGameCenterProfile.ts
796
879
  import { getGameCenterGameProfile } from "@apps-in-toss/native-modules";
797
880
  import { closeView as closeView2, openURL as openURL5 } from "@granite-js/react-native";
798
- import { useDialog as useDialog3 } from "@toss-design-system/react-native";
881
+ import { useDialog as useDialog4 } from "@toss/tds-react-native";
799
882
  import { josa as josa2 } from "es-hangul";
800
883
  import { useCallback as useCallback4, useRef as useRef3, useState as useState2 } from "react";
801
884
 
802
885
  // src/components/GameProfileToast.tsx
803
- import { Asset, Toast } from "@toss-design-system/react-native";
804
- import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay as useOverlay2 } from "@toss-design-system/react-native/private";
805
- import { jsx as jsx6 } from "react/jsx-runtime";
886
+ import { Asset, Toast } from "@toss/tds-react-native";
887
+ import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay as useOverlay2 } from "@toss/tds-react-native/private";
888
+ import { jsx as jsx7 } from "react/jsx-runtime";
806
889
  var useGameProfileToast = () => {
807
890
  const overlay = useOverlay2();
808
891
  const openGameProfileToast = (nickname, profileImageUri) => {
809
892
  return new Promise((resolve) => {
810
893
  overlay.open(({ isOpen, close, exit }) => {
811
- return /* @__PURE__ */ jsx6(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx6(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx6(
894
+ return /* @__PURE__ */ jsx7(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx7(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx7(
812
895
  Toast,
813
896
  {
814
897
  open: isOpen,
@@ -819,7 +902,7 @@ var useGameProfileToast = () => {
819
902
  onExited: exit,
820
903
  position: "top",
821
904
  text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
822
- icon: /* @__PURE__ */ jsx6(
905
+ icon: /* @__PURE__ */ jsx7(
823
906
  Asset.Image,
824
907
  {
825
908
  style: { borderRadius: 64, overflow: "hidden" },
@@ -889,7 +972,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
889
972
  const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
890
973
  const [isWebviewLoading, setIsWebviewLoading] = useState2(false);
891
974
  const isCompletedProfileFlow = useRef3(false);
892
- const { openAlert, openConfirm } = useDialog3();
975
+ const { openAlert, openConfirm } = useDialog4();
893
976
  const { openGameProfileToast } = useGameProfileToast();
894
977
  const openErrorAlert = useCallback4(async () => {
895
978
  await openAlert({
@@ -974,7 +1057,7 @@ var Z_INDEX = {
974
1057
  };
975
1058
 
976
1059
  // src/components/GameProfile.tsx
977
- import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
1060
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
978
1061
  var GameProfile = ({ children, isReadyForProfileUI }) => {
979
1062
  const {
980
1063
  profileData,
@@ -1034,9 +1117,9 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1034
1117
  updateAppToSupportedMinVersion
1035
1118
  ]);
1036
1119
  if (!isMinVersionSupported3(GAME_CENTER_MIN_VERSION)) {
1037
- return /* @__PURE__ */ jsxs2(Fragment5, { children: [
1038
- /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
1039
- /* @__PURE__ */ jsx7(
1120
+ return /* @__PURE__ */ jsxs3(Fragment5, { children: [
1121
+ /* @__PURE__ */ jsx8(View, { style: { flex: 1, position: "relative" }, children }),
1122
+ /* @__PURE__ */ jsx8(
1040
1123
  Pressable,
1041
1124
  {
1042
1125
  style: {
@@ -1050,9 +1133,9 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1050
1133
  ] });
1051
1134
  }
1052
1135
  if (shouldShowLoadingOverlay || isProfileDataRefetching) {
1053
- return /* @__PURE__ */ jsxs2(Fragment5, { children: [
1054
- /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
1055
- /* @__PURE__ */ jsx7(
1136
+ return /* @__PURE__ */ jsxs3(Fragment5, { children: [
1137
+ /* @__PURE__ */ jsx8(View, { style: { flex: 1, position: "relative" }, children }),
1138
+ /* @__PURE__ */ jsx8(
1056
1139
  View,
1057
1140
  {
1058
1141
  style: {
@@ -1061,15 +1144,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1061
1144
  alignItems: "center",
1062
1145
  backgroundColor: "rgba(0, 0, 0, 0.2)"
1063
1146
  },
1064
- children: /* @__PURE__ */ jsx7(Loader, { size: "large", type: "light" })
1147
+ children: /* @__PURE__ */ jsx8(Loader, { size: "large", type: "light" })
1065
1148
  }
1066
1149
  )
1067
1150
  ] });
1068
1151
  }
1069
1152
  if (shouldShowProfileNotFoundOverlay) {
1070
- return /* @__PURE__ */ jsxs2(Fragment5, { children: [
1071
- /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
1072
- shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx7(
1153
+ return /* @__PURE__ */ jsxs3(Fragment5, { children: [
1154
+ /* @__PURE__ */ jsx8(View, { style: { flex: 1, position: "relative" }, children }),
1155
+ shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx8(
1073
1156
  Pressable,
1074
1157
  {
1075
1158
  style: {
@@ -1082,7 +1165,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1082
1165
  )
1083
1166
  ] });
1084
1167
  }
1085
- return /* @__PURE__ */ jsx7(Fragment5, { children: /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }) });
1168
+ return /* @__PURE__ */ jsx8(Fragment5, { children: /* @__PURE__ */ jsx8(View, { style: { flex: 1, position: "relative" }, children }) });
1086
1169
  };
1087
1170
  var overlayStyle = {
1088
1171
  position: "absolute",
@@ -1095,15 +1178,15 @@ var overlayStyle = {
1095
1178
 
1096
1179
  // src/components/NavigationBar/GameWebviewNavigationBar.tsx
1097
1180
  import { closeView as closeView3 } from "@granite-js/react-native";
1098
- import { PageNavbar, useDialog as useDialog4 } from "@toss-design-system/react-native";
1099
- import { NavigationRightContent, useSafeAreaTop } from "@toss-design-system/react-native/private";
1181
+ import { PageNavbar, useDialog as useDialog5 } from "@toss/tds-react-native";
1182
+ import { NavigationRightContent, useSafeAreaTop } from "@toss/tds-react-native/private";
1100
1183
  import { josa as josa3 } from "es-hangul";
1101
- import { useCallback as useCallback5, useEffect as useEffect9 } from "react";
1102
- import { BackHandler as BackHandler2, Platform as Platform2, View as View2 } from "react-native";
1103
- import { Fragment as Fragment6, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1184
+ import { useCallback as useCallback5 } from "react";
1185
+ import { Platform as Platform2, View as View2 } from "react-native";
1186
+ import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1104
1187
  function GameWebviewNavigationBar() {
1105
1188
  const safeAreaTop = useSafeAreaTop();
1106
- const { openConfirm } = useDialog4();
1189
+ const { openConfirm } = useDialog5();
1107
1190
  const { captureExitLog } = useCaptureExitLog();
1108
1191
  const global2 = getAppsInTossGlobals();
1109
1192
  const logging = useNavigationBarLogging();
@@ -1111,6 +1194,7 @@ function GameWebviewNavigationBar() {
1111
1194
  const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1112
1195
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1113
1196
  const handleGameWebviewClose = useCallback5(async () => {
1197
+ logging.closeButtonClick();
1114
1198
  const isConfirmed = await openConfirm({
1115
1199
  title: `${josa3(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1116
1200
  leftButton: "\uCDE8\uC18C",
@@ -1124,17 +1208,9 @@ function GameWebviewNavigationBar() {
1124
1208
  closeView3();
1125
1209
  }
1126
1210
  }, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
1127
- useEffect9(() => {
1128
- const handleAndroidBackEvent = () => {
1129
- handleGameWebviewClose();
1130
- return true;
1131
- };
1132
- BackHandler2.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1133
- return () => BackHandler2.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1134
- }, [handleGameWebviewClose]);
1135
- return /* @__PURE__ */ jsxs3(Fragment6, { children: [
1136
- /* @__PURE__ */ jsx8(PageNavbar, { preference: { type: "none" } }),
1137
- /* @__PURE__ */ jsx8(
1211
+ return /* @__PURE__ */ jsxs4(Fragment6, { children: [
1212
+ /* @__PURE__ */ jsx9(PageNavbar, { preference: { type: "none" } }),
1213
+ /* @__PURE__ */ jsx9(
1138
1214
  View2,
1139
1215
  {
1140
1216
  style: {
@@ -1150,13 +1226,12 @@ function GameWebviewNavigationBar() {
1150
1226
  paddingRight: 10
1151
1227
  },
1152
1228
  pointerEvents: "box-none",
1153
- children: /* @__PURE__ */ jsx8(
1229
+ children: /* @__PURE__ */ jsx9(
1154
1230
  NavigationRightContent,
1155
1231
  {
1156
1232
  fixedRightButton: initialAccessoryButton,
1157
1233
  onPressDots: openMoreButtonBottomSheet,
1158
1234
  onPressClose: () => {
1159
- logging.closeButtonClick();
1160
1235
  handleGameWebviewClose();
1161
1236
  },
1162
1237
  theme: "dark"
@@ -1168,10 +1243,10 @@ function GameWebviewNavigationBar() {
1168
1243
  }
1169
1244
 
1170
1245
  // src/components/GameWebView.tsx
1171
- import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1246
+ import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1172
1247
  var GameWebView = forwardRef(function GameWebView2(props, ref) {
1173
1248
  const [isEntryMessageExited, setIsEntryMessageExited] = useState3(false);
1174
- useEffect10(() => {
1249
+ useEffect9(() => {
1175
1250
  if (Platform3.OS === "ios") {
1176
1251
  setIosSwipeGestureEnabled2({ isEnabled: false });
1177
1252
  return () => {
@@ -1180,48 +1255,42 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1180
1255
  }
1181
1256
  return;
1182
1257
  }, []);
1183
- useEffect10(() => {
1258
+ useEffect9(() => {
1184
1259
  appsInTossEvent2.addEventListener("entryMessageExited", {
1185
1260
  onEvent: () => {
1186
1261
  setIsEntryMessageExited(true);
1187
1262
  }
1188
1263
  });
1189
1264
  }, []);
1190
- return /* @__PURE__ */ jsxs4(Fragment7, { children: [
1191
- /* @__PURE__ */ jsx9(GameWebviewNavigationBar, {}),
1192
- getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx9(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx9(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx9(PlainWebView, { ref, ...props })
1265
+ return /* @__PURE__ */ jsxs5(Fragment7, { children: [
1266
+ /* @__PURE__ */ jsx10(GameWebviewNavigationBar, {}),
1267
+ getOperationalEnvironment2() === "toss" ? /* @__PURE__ */ jsx10(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx10(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx10(PlainWebView, { ref, ...props })
1193
1268
  ] });
1194
1269
  });
1195
1270
 
1196
1271
  // src/components/PartnerWebView.tsx
1197
- import { closeView as closeView5 } from "@apps-in-toss/native-modules";
1198
1272
  import {
1199
1273
  WebView as PlainWebView2
1200
1274
  } from "@granite-js/native/react-native-webview";
1201
- import { forwardRef as forwardRef2, useCallback as useCallback8, useEffect as useEffect11, useRef as useRef4 } from "react";
1202
- import { BackHandler as BackHandler3 } from "react-native";
1275
+ import { forwardRef as forwardRef2 } from "react";
1203
1276
 
1204
1277
  // src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
1205
1278
  import { closeView as closeView4 } from "@granite-js/react-native";
1206
- import { useDialog as useDialog5 } from "@toss-design-system/react-native";
1207
- import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss-design-system/react-native/private";
1279
+ import { useDialog as useDialog6 } from "@toss/tds-react-native";
1280
+ import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss/tds-react-native/private";
1208
1281
  import { josa as josa4 } from "es-hangul";
1209
1282
  import { useCallback as useCallback6 } from "react";
1210
- import { jsx as jsx10 } from "react/jsx-runtime";
1211
- function PartnerWebviewNavigationBar({ handleBackEvent, handleHomeIconButtonClick }) {
1283
+ import { jsx as jsx11 } from "react/jsx-runtime";
1284
+ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1212
1285
  const globals = getAppsInTossGlobals();
1213
1286
  const { captureExitLog } = useCaptureExitLog();
1214
1287
  const logging = useNavigationBarLogging();
1215
- const { openConfirm } = useDialog5();
1288
+ const { openConfirm } = useDialog6();
1216
1289
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1217
1290
  const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
1218
1291
  const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
1219
1292
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
1220
1293
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1221
- const handlePressTitle = useCallback6(() => {
1222
- logging.homeButtonClick();
1223
- handleHomeIconButtonClick();
1224
- }, [handleHomeIconButtonClick, logging]);
1225
1294
  const handleClose = useCallback6(async () => {
1226
1295
  logging.closeButtonClick();
1227
1296
  const isConfirmed = await openConfirm({
@@ -1237,207 +1306,33 @@ function PartnerWebviewNavigationBar({ handleBackEvent, handleHomeIconButtonClic
1237
1306
  closeView4();
1238
1307
  }
1239
1308
  }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
1240
- return /* @__PURE__ */ jsx10(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx10(
1309
+ return /* @__PURE__ */ jsx11(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx11(
1241
1310
  TopNavigation2,
1242
1311
  {
1243
1312
  title: globals.brandDisplayName,
1244
1313
  icon: toIcon(globals.brandIcon),
1245
1314
  onPressDots: openMoreButtonBottomSheet,
1246
1315
  contentVisible: true,
1247
- onPressTitle: withHomeButton ? handlePressTitle : void 0,
1316
+ onPressTitle: withHomeButton ? onHomeButtonClick : void 0,
1248
1317
  onPressClose: handleClose,
1249
1318
  withHome: withHomeButton,
1250
1319
  fixedRightButton: initialAccessoryButton,
1251
- children: /* @__PURE__ */ jsx10(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx10(NavigationBackButton2, { onPress: handleBackEvent, canGoBack: false }) })
1320
+ children: /* @__PURE__ */ jsx11(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx11(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
1252
1321
  }
1253
1322
  ) });
1254
1323
  }
1255
1324
 
1256
- // src/core/utils/mergeRefs.ts
1257
- function mergeRefs(...refs) {
1258
- return (value) => {
1259
- refs.forEach((ref) => {
1260
- if (typeof ref === "function") {
1261
- ref(value);
1262
- } else if (ref != null) {
1263
- ref.current = value;
1264
- }
1265
- });
1266
- };
1267
- }
1268
-
1269
- // src/hooks/useWebviewHistoryStack.tsx
1270
- import { useCallback as useCallback7, useMemo as useMemo2, useReducer } from "react";
1271
- var INITIAL_STATE = { stack: [], index: -1 };
1272
- function reducer(state, action) {
1273
- switch (action.type) {
1274
- case "NAVIGATION_CHANGE": {
1275
- const { url, canGoForward } = action;
1276
- if (state.stack.length === 0) {
1277
- return { stack: [url], index: 0 };
1278
- }
1279
- const { stack, index } = state;
1280
- const cur = stack[index];
1281
- if (url === cur) {
1282
- return state;
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 && canGoForward) {
1287
- return { ...state, index: index - 1 };
1288
- }
1289
- if (next && url === next) {
1290
- return { ...state, index: index + 1 };
1291
- }
1292
- const base = stack.slice(0, index + 1);
1293
- const nextStack = [...base, url];
1294
- return { stack: nextStack, index: nextStack.length - 1 };
1295
- }
1296
- default:
1297
- return state;
1298
- }
1299
- }
1300
- function useWebViewHistory() {
1301
- const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
1302
- const onNavigationStateChange = useCallback7(({ url, canGoForward: canGoForward2 }) => {
1303
- dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
1304
- }, []);
1305
- const { canGoBack, canGoForward } = useMemo2(() => {
1306
- const canBack = state.index > 0;
1307
- const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
1308
- return { canGoBack: canBack, canGoForward: canFwd };
1309
- }, [state.index, state.stack.length]);
1310
- return { onNavigationStateChange, canGoBack, canGoForward };
1311
- }
1312
-
1313
- // src/utils/log.ts
1314
- import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
1315
- import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
1316
-
1317
- // src/utils/extractDateFromUUIDv7.ts
1318
- var extractDateFromUUIDv7 = (uuid) => {
1319
- const timestampHex = uuid.split("-").join("").slice(0, 12);
1320
- const timestamp = Number.parseInt(timestampHex, 16);
1321
- return new Date(timestamp);
1322
- };
1323
-
1324
- // src/utils/log.ts
1325
- var getGroupId = (url) => {
1326
- try {
1327
- const urlObject = new URL(url);
1328
- return {
1329
- groupId: urlObject.pathname,
1330
- search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1331
- };
1332
- } catch {
1333
- return {
1334
- groupId: "unknown",
1335
- search: "unknown"
1336
- };
1337
- }
1338
- };
1339
- var getReferrer = () => {
1340
- try {
1341
- const referrer = new URL(getSchemeUri4());
1342
- return referrer.searchParams.get("referrer");
1343
- } catch {
1344
- return "";
1345
- }
1346
- };
1347
- var trackScreen = (url) => {
1348
- const { groupId, search } = getGroupId(url);
1349
- const log = {
1350
- log_type: "screen",
1351
- log_name: `${groupId}::screen`,
1352
- params: {
1353
- search,
1354
- referrer: getReferrer(),
1355
- deployment_id: env.getDeploymentId(),
1356
- deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1357
- }
1358
- };
1359
- return eventLogNative(log);
1360
- };
1361
-
1362
1325
  // src/components/PartnerWebView.tsx
1363
- import { Fragment as Fragment8, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1364
- var PartnerWebView = forwardRef2(
1365
- function PartnerWebViewScreen(webViewProps, ref) {
1366
- const webViewRef = useRef4(null);
1367
- const refs = mergeRefs(ref, webViewRef);
1368
- const { captureExitLog } = useCaptureExitLog();
1369
- const { canGoBack, onNavigationStateChange } = useWebViewHistory();
1370
- const historyBackScript = `
1371
- (function() {
1372
- window.history.back();
1373
- true;
1374
- })();
1375
- `;
1376
- const historyHomeScript = `
1377
- (function() {
1378
- window.location.href = '/';
1379
- true;
1380
- })();
1381
- `;
1382
- const handleBackEvent = useCallback8(() => {
1383
- if (canGoBack) {
1384
- webViewRef.current?.injectJavaScript(historyBackScript);
1385
- } else {
1386
- captureExitLog(Date.now());
1387
- closeView5();
1388
- }
1389
- }, [canGoBack, captureExitLog, historyBackScript]);
1390
- useEffect11(() => {
1391
- const handleAndroidBackEvent = () => {
1392
- if (canGoBack) {
1393
- webViewRef.current?.injectJavaScript(historyBackScript);
1394
- return true;
1395
- } else {
1396
- captureExitLog(Date.now());
1397
- return false;
1398
- }
1399
- };
1400
- BackHandler3.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1401
- return () => BackHandler3.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1402
- }, [canGoBack, captureExitLog, historyBackScript]);
1403
- const handleHomeIconButtonClick = useCallback8(() => {
1404
- webViewRef.current?.injectJavaScript(historyHomeScript);
1405
- }, [historyHomeScript]);
1406
- const handleNavigationStateChange = useCallback8(
1407
- (event) => {
1408
- if (event.url) {
1409
- trackScreen(event.url);
1410
- }
1411
- onNavigationStateChange(event);
1412
- },
1413
- [onNavigationStateChange]
1414
- );
1415
- return /* @__PURE__ */ jsxs5(Fragment8, { children: [
1416
- /* @__PURE__ */ jsx11(
1417
- PartnerWebviewNavigationBar,
1418
- {
1419
- handleBackEvent,
1420
- handleHomeIconButtonClick
1421
- }
1422
- ),
1423
- /* @__PURE__ */ jsx11(
1424
- PlainWebView2,
1425
- {
1426
- ref: refs,
1427
- ...webViewProps,
1428
- style: { flex: 1 },
1429
- onNavigationStateChange: (event) => {
1430
- webViewProps?.onNavigationStateChange?.(event);
1431
- handleNavigationStateChange(event);
1432
- }
1433
- }
1434
- )
1435
- ] });
1436
- }
1437
- );
1326
+ import { Fragment as Fragment8, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1327
+ var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ onBackButtonClick, onHomeButtonClick, ...webViewProps }, ref) {
1328
+ return /* @__PURE__ */ jsxs6(Fragment8, { children: [
1329
+ /* @__PURE__ */ jsx12(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
1330
+ /* @__PURE__ */ jsx12(PlainWebView2, { ref, ...webViewProps, style: { flex: 1 } })
1331
+ ] });
1332
+ });
1438
1333
 
1439
1334
  // src/bridge-handler/useBridgeHandler.tsx
1440
- import { useCallback as useCallback9, useMemo as useMemo3, useRef as useRef5 } from "react";
1335
+ import { useCallback as useCallback7, useMemo as useMemo2, useRef as useRef4 } from "react";
1441
1336
  function serializeError(error) {
1442
1337
  return JSON.stringify(error, (_, value) => {
1443
1338
  if (value instanceof Error) {
@@ -1490,8 +1385,8 @@ function useBridgeHandler({
1490
1385
  eventListenerMap,
1491
1386
  injectedJavaScript: originalInjectedJavaScript
1492
1387
  }) {
1493
- const ref = useRef5(null);
1494
- const injectedJavaScript = useMemo3(
1388
+ const ref = useRef4(null);
1389
+ const injectedJavaScript = useMemo2(
1495
1390
  () => [
1496
1391
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
1497
1392
  Object.entries(constantHandlerMap).reduce(
@@ -1518,7 +1413,7 @@ function useBridgeHandler({
1518
1413
  window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
1519
1414
  `);
1520
1415
  };
1521
- const $onMessage = useCallback9(
1416
+ const $onMessage = useCallback7(
1522
1417
  async (e) => {
1523
1418
  onMessage?.(e);
1524
1419
  const data = JSON.parse(e.nativeEvent.data);
@@ -1568,6 +1463,155 @@ function useBridgeHandler({
1568
1463
  };
1569
1464
  }
1570
1465
 
1466
+ // src/core/hooks/useWebBackHandler.tsx
1467
+ import { closeView as closeView5, useBackEventState } from "@granite-js/react-native";
1468
+ import { useDialog as useDialog7 } from "@toss/tds-react-native";
1469
+ import { josa as josa5 } from "es-hangul";
1470
+ import { useCallback as useCallback9, useMemo as useMemo4 } from "react";
1471
+
1472
+ // src/hooks/useWebviewHistoryStack.tsx
1473
+ import { useCallback as useCallback8, useMemo as useMemo3, useReducer } from "react";
1474
+ var INITIAL_STATE = { stack: [], index: -1 };
1475
+ function reducer(state, action) {
1476
+ switch (action.type) {
1477
+ case "NAVIGATION_CHANGE": {
1478
+ const { url, canGoForward } = action;
1479
+ if (state.stack.length === 0) {
1480
+ return { stack: [url], index: 0 };
1481
+ }
1482
+ const { stack, index } = state;
1483
+ const cur = stack[index];
1484
+ if (url === cur) {
1485
+ return state;
1486
+ }
1487
+ const prev = index > 0 ? stack[index - 1] : void 0;
1488
+ const next = index < stack.length - 1 ? stack[index + 1] : void 0;
1489
+ if (prev && url === prev && canGoForward) {
1490
+ return { ...state, index: index - 1 };
1491
+ }
1492
+ if (next && url === next) {
1493
+ return { ...state, index: index + 1 };
1494
+ }
1495
+ const base = stack.slice(0, index + 1);
1496
+ const nextStack = [...base, url];
1497
+ return { stack: nextStack, index: nextStack.length - 1 };
1498
+ }
1499
+ default:
1500
+ return state;
1501
+ }
1502
+ }
1503
+ function useWebViewHistory() {
1504
+ const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
1505
+ const onNavigationStateChange = useCallback8(({ url, canGoForward: canGoForward2 }) => {
1506
+ dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
1507
+ }, []);
1508
+ const { canGoBack, canGoForward } = useMemo3(() => {
1509
+ const canBack = state.index > 0;
1510
+ const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
1511
+ return { canGoBack: canBack, canGoForward: canFwd };
1512
+ }, [state.index, state.stack.length]);
1513
+ return { onNavigationStateChange, hasHistory: canGoBack, canGoForward };
1514
+ }
1515
+
1516
+ // src/core/hooks/useWebBackHandler.tsx
1517
+ var HISTORY_BACK_SCRIPT = `
1518
+ (function() {
1519
+ window.history.back();
1520
+ true;
1521
+ })();
1522
+ `;
1523
+ var HISTORY_HOME_SCRIPT = `
1524
+ (function() {
1525
+ window.location.href = '/';
1526
+ true;
1527
+ })();
1528
+ `;
1529
+ function useWebBackHandler(webViewRef) {
1530
+ const { captureExitLog } = useCaptureExitLog();
1531
+ const { hasHistory, onNavigationStateChange } = useWebViewHistory();
1532
+ const {
1533
+ handlersRef: webBackHandlersRef,
1534
+ hasBackEvent: hasWebBackEvent,
1535
+ addEventListener: addWebBackEventListener,
1536
+ removeEventListener: removeWebBackEventListener
1537
+ } = useBackEventState();
1538
+ const logging = useNavigationBarLogging();
1539
+ const { openConfirm } = useDialog7();
1540
+ const global2 = getAppsInTossGlobals();
1541
+ const addEventListener = useCallback9(
1542
+ (handler) => {
1543
+ addWebBackEventListener(handler);
1544
+ },
1545
+ [addWebBackEventListener]
1546
+ );
1547
+ const removeEventListener = useCallback9(
1548
+ (handler) => {
1549
+ removeWebBackEventListener(handler);
1550
+ },
1551
+ [removeWebBackEventListener]
1552
+ );
1553
+ const handleWebBack = useCallback9(async () => {
1554
+ if (hasWebBackEvent) {
1555
+ for (const handler of webBackHandlersRef) {
1556
+ handler();
1557
+ }
1558
+ return;
1559
+ }
1560
+ if (hasHistory) {
1561
+ webViewRef.current?.injectJavaScript(HISTORY_BACK_SCRIPT);
1562
+ } else {
1563
+ const isConfirmed = await openConfirm({
1564
+ title: `${josa5(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1565
+ leftButton: "\uCDE8\uC18C",
1566
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
1567
+ closeOnDimmerClick: true,
1568
+ onEntered: logging.closePopupShow
1569
+ });
1570
+ logging.closePopupCtaClick(isConfirmed);
1571
+ if (isConfirmed) {
1572
+ captureExitLog(Date.now());
1573
+ closeView5();
1574
+ }
1575
+ }
1576
+ }, [
1577
+ captureExitLog,
1578
+ global2.brandDisplayName,
1579
+ hasHistory,
1580
+ hasWebBackEvent,
1581
+ webBackHandlersRef,
1582
+ logging,
1583
+ openConfirm,
1584
+ webViewRef
1585
+ ]);
1586
+ const handleWebHome = useCallback9(() => {
1587
+ logging.homeButtonClick();
1588
+ if (hasWebBackEvent) {
1589
+ for (const handler of webBackHandlersRef) {
1590
+ handler();
1591
+ }
1592
+ return;
1593
+ }
1594
+ webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
1595
+ }, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
1596
+ return useMemo4(
1597
+ () => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
1598
+ [addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
1599
+ );
1600
+ }
1601
+
1602
+ // src/core/utils/mergeRefs.ts
1603
+ function mergeRefs(...refs) {
1604
+ return (value) => {
1605
+ refs.forEach((ref) => {
1606
+ if (typeof ref === "function") {
1607
+ ref(value);
1608
+ } else if (ref != null) {
1609
+ ref.current = value;
1610
+ }
1611
+ });
1612
+ };
1613
+ }
1614
+
1571
1615
  // src/hooks/useCreateUserAgent.ts
1572
1616
  import { getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
1573
1617
  import { useWindowDimensions } from "react-native";
@@ -1727,11 +1771,11 @@ function useCreateUserAgent({
1727
1771
  // src/hooks/useGeolocation.ts
1728
1772
  import { startUpdateLocation } from "@apps-in-toss/native-modules";
1729
1773
  import { useVisibility as useVisibility3 } from "@granite-js/react-native";
1730
- import { useEffect as useEffect12, useState as useState4 } from "react";
1774
+ import { useEffect as useEffect10, useState as useState4 } from "react";
1731
1775
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1732
1776
  const isVisible = useVisibility3();
1733
1777
  const [location, setLocation] = useState4(null);
1734
- useEffect12(() => {
1778
+ useEffect10(() => {
1735
1779
  if (!isVisible) {
1736
1780
  return;
1737
1781
  }
@@ -1748,8 +1792,87 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1748
1792
  return location;
1749
1793
  }
1750
1794
 
1795
+ // src/hooks/useWaitForReturnNavigator.tsx
1796
+ import { useNavigation as useNavigation2, useVisibilityChange } from "@granite-js/react-native";
1797
+ import { useCallback as useCallback10, useRef as useRef5 } from "react";
1798
+ function useWaitForReturnNavigator() {
1799
+ const callbacks = useRef5([]).current;
1800
+ const navigation = useNavigation2();
1801
+ const startNavigating = useCallback10(
1802
+ (route, params) => {
1803
+ return new Promise((resolve) => {
1804
+ callbacks.push(resolve);
1805
+ navigation.navigate(route, params);
1806
+ });
1807
+ },
1808
+ [callbacks, navigation]
1809
+ );
1810
+ const handleVisibilityChange = useCallback10(
1811
+ (state) => {
1812
+ if (state === "visible" && callbacks.length > 0) {
1813
+ for (const callback of callbacks) {
1814
+ callback();
1815
+ }
1816
+ callbacks.splice(0, callbacks.length);
1817
+ }
1818
+ },
1819
+ [callbacks]
1820
+ );
1821
+ useVisibilityChange(handleVisibilityChange);
1822
+ return startNavigating;
1823
+ }
1824
+
1825
+ // src/utils/log.ts
1826
+ import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
1827
+ import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
1828
+
1829
+ // src/utils/extractDateFromUUIDv7.ts
1830
+ var extractDateFromUUIDv7 = (uuid) => {
1831
+ const timestampHex = uuid.split("-").join("").slice(0, 12);
1832
+ const timestamp = Number.parseInt(timestampHex, 16);
1833
+ return new Date(timestamp);
1834
+ };
1835
+
1836
+ // src/utils/log.ts
1837
+ var getGroupId = (url) => {
1838
+ try {
1839
+ const urlObject = new URL(url);
1840
+ return {
1841
+ groupId: urlObject.pathname,
1842
+ search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1843
+ };
1844
+ } catch {
1845
+ return {
1846
+ groupId: "unknown",
1847
+ search: "unknown"
1848
+ };
1849
+ }
1850
+ };
1851
+ var getReferrer = () => {
1852
+ try {
1853
+ const referrer = new URL(getSchemeUri5());
1854
+ return referrer.searchParams.get("referrer");
1855
+ } catch {
1856
+ return "";
1857
+ }
1858
+ };
1859
+ var trackScreen = (url) => {
1860
+ const { groupId, search } = getGroupId(url);
1861
+ const log = {
1862
+ log_type: "screen",
1863
+ log_name: `${groupId}::screen`,
1864
+ params: {
1865
+ search,
1866
+ referrer: getReferrer(),
1867
+ deployment_id: env.getDeploymentId(),
1868
+ deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1869
+ }
1870
+ };
1871
+ return eventLogNative(log);
1872
+ };
1873
+
1751
1874
  // src/components/WebView.tsx
1752
- import { jsx as jsx12 } from "react/jsx-runtime";
1875
+ import { jsx as jsx13 } from "react/jsx-runtime";
1753
1876
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
1754
1877
  var TYPES = ["partner", "external", "game"];
1755
1878
  var WEBVIEW_TYPES = {
@@ -1759,7 +1882,7 @@ var WEBVIEW_TYPES = {
1759
1882
  };
1760
1883
  function mergeSchemeQueryParamsInto(url) {
1761
1884
  const baseUrl = new URL(url);
1762
- const schemeUrl = new URL(getSchemeUri5());
1885
+ const schemeUrl = new URL(getSchemeUri6());
1763
1886
  baseUrl.pathname = schemeUrl.pathname;
1764
1887
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1765
1888
  baseUrl.searchParams.set(key, value);
@@ -1783,8 +1906,9 @@ function WebView({ type, local, onMessage, ...props }) {
1783
1906
  if (!TYPES.includes(type)) {
1784
1907
  throw new Error(`Invalid WebView type: '${type}'`);
1785
1908
  }
1786
- const graniteEvent = useGraniteEvent();
1787
- const uri = useMemo4(() => getWebViewUri(local), [local]);
1909
+ const webViewRef = useRef6(null);
1910
+ const webBackHandler = useWebBackHandler(webViewRef);
1911
+ const uri = useMemo5(() => getWebViewUri(local), [local]);
1788
1912
  const top = useSafeAreaTop2();
1789
1913
  const bottom = useSafeAreaBottom();
1790
1914
  const global2 = getAppsInTossGlobals();
@@ -1806,7 +1930,12 @@ function WebView({ type, local, onMessage, ...props }) {
1806
1930
  eventListenerMap: {
1807
1931
  ...appsInTossEventBridges,
1808
1932
  navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1809
- backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1933
+ backEvent: ({ onEvent }) => {
1934
+ webBackHandler.addEventListener(onEvent);
1935
+ return () => {
1936
+ webBackHandler.removeEventListener(onEvent);
1937
+ };
1938
+ },
1810
1939
  entryMessageExited: ({ onEvent, onError }) => appsInTossEvent3.addEventListener("entryMessageExited", { onEvent, onError }),
1811
1940
  updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent3.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1812
1941
  /** @internal */
@@ -1824,7 +1953,6 @@ function WebView({ type, local, onMessage, ...props }) {
1824
1953
  requestOneTimePurchase
1825
1954
  },
1826
1955
  constantHandlerMap: {
1827
- ...graniteConstantBridges,
1828
1956
  ...appsInTossConstantBridges,
1829
1957
  getSafeAreaTop: () => top,
1830
1958
  getSafeAreaBottom: () => bottom,
@@ -1841,7 +1969,6 @@ function WebView({ type, local, onMessage, ...props }) {
1841
1969
  getDeploymentId: env.getDeploymentId
1842
1970
  },
1843
1971
  asyncHandlerMap: {
1844
- ...graniteAsyncBridges,
1845
1972
  ...appsInTossAsyncBridges,
1846
1973
  setIosSwipeGestureEnabled: (options) => {
1847
1974
  setAllowsBackForwardNavigationGestures(options.isEnabled);
@@ -1867,10 +1994,12 @@ function WebView({ type, local, onMessage, ...props }) {
1867
1994
  /** IAP */
1868
1995
  iapGetProductItemList: IAP.getProductItemList,
1869
1996
  iapCreateOneTimePurchaseOrder,
1870
- processProductGrant
1997
+ processProductGrant,
1998
+ getPendingOrders: IAP.getPendingOrders,
1999
+ getCompletedOrRefundedOrders: IAP.getCompletedOrRefundedOrders
1871
2000
  }
1872
2001
  });
1873
- const headerPropForExternalWebView = useMemo4(() => {
2002
+ const headerPropForExternalWebView = useMemo5(() => {
1874
2003
  const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1875
2004
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1876
2005
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
@@ -1890,10 +2019,19 @@ function WebView({ type, local, onMessage, ...props }) {
1890
2019
  const userAgent = useCreateUserAgent({
1891
2020
  colorPreference: "light"
1892
2021
  });
1893
- return /* @__PURE__ */ jsx12(
2022
+ const refs = mergeRefs(handler.ref, webViewRef);
2023
+ useEffect11(() => {
2024
+ const callback = () => {
2025
+ webBackHandler.handleWebBack();
2026
+ return true;
2027
+ };
2028
+ BackHandler2.addEventListener("hardwareBackPress", callback);
2029
+ return () => BackHandler2.removeEventListener("hardwareBackPress", callback);
2030
+ }, [webBackHandler]);
2031
+ return /* @__PURE__ */ jsx13(
1894
2032
  BaseWebView,
1895
2033
  {
1896
- ref: handler.ref,
2034
+ ref: refs,
1897
2035
  ...props,
1898
2036
  ...headerPropForExternalWebView,
1899
2037
  source: {
@@ -1903,6 +2041,15 @@ function WebView({ type, local, onMessage, ...props }) {
1903
2041
  "User-Agent": userAgent
1904
2042
  }
1905
2043
  },
2044
+ onHomeButtonClick: webBackHandler.handleWebHome,
2045
+ onBackButtonClick: webBackHandler.handleWebBack,
2046
+ onNavigationStateChange: (event) => {
2047
+ if (event.url) {
2048
+ trackScreen(event.url);
2049
+ }
2050
+ props.onNavigationStateChange?.(event);
2051
+ webBackHandler.onNavigationStateChange(event);
2052
+ },
1906
2053
  userAgent: Platform4.OS === "ios" ? userAgent : void 0,
1907
2054
  sharedCookiesEnabled: true,
1908
2055
  webviewDebuggingEnabled: webViewDebuggingEnabled,
@@ -1918,7 +2065,7 @@ function WebView({ type, local, onMessage, ...props }) {
1918
2065
 
1919
2066
  // src/index.ts
1920
2067
  export * from "@apps-in-toss/analytics";
1921
- import { useTopNavigation as useTopNavigation2 } from "@toss-design-system/react-native/private";
2068
+ import { useTopNavigation as useTopNavigation2, useOverlay as useOverlay3, OverlayProvider } from "@toss/tds-react-native/private";
1922
2069
  export * from "@apps-in-toss/native-modules";
1923
2070
  export * from "@apps-in-toss/types";
1924
2071
  var Analytics2 = {
@@ -1931,9 +2078,12 @@ export {
1931
2078
  Analytics2 as Analytics,
1932
2079
  AppsInToss,
1933
2080
  INTERNAL__onVisibilityChangedByTransparentServiceWeb,
2081
+ OverlayProvider,
1934
2082
  WebView,
1935
2083
  env,
1936
2084
  useCreateUserAgent,
1937
2085
  useGeolocation,
1938
- useTopNavigation2 as useTopNavigation
2086
+ useOverlay3 as useOverlay,
2087
+ useTopNavigation2 as useTopNavigation,
2088
+ useWaitForReturnNavigator
1939
2089
  };