@apps-in-toss/framework 1.4.3 → 1.4.5

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
@@ -163,10 +163,8 @@ function AppUpdate() {
163
163
  return /* @__PURE__ */ jsx(Fragment, {});
164
164
  }
165
165
 
166
- // src/core/hooks/useAppsInTossBridge.ts
167
- import { appsInTossEvent } from "@apps-in-toss/native-modules";
168
- import { useBridge } from "@toss/tds-react-native";
169
- import { useEffect as useEffect4 } from "react";
166
+ // src/core/context/NavigationBarContext.tsx
167
+ import { createContext, useContext, useState } from "react";
170
168
 
171
169
  // src/core/utils/getAppsInTossGlobals.ts
172
170
  function getAppsInTossGlobals() {
@@ -176,6 +174,54 @@ function getAppsInTossGlobals() {
176
174
  return global.__appsInToss;
177
175
  }
178
176
 
177
+ // src/core/utils/safeParseNavigationBar.ts
178
+ function safeParseNavigationBar(navigationBar) {
179
+ if (typeof navigationBar === "object") {
180
+ return navigationBar;
181
+ }
182
+ try {
183
+ return JSON.parse(navigationBar);
184
+ } catch {
185
+ return null;
186
+ }
187
+ }
188
+
189
+ // src/core/context/NavigationBarContext.tsx
190
+ import { jsx as jsx2 } from "react/jsx-runtime";
191
+ var NavigationBarContext = createContext(null);
192
+ function NavigationBarContextProvider({ children }) {
193
+ const globals = getAppsInTossGlobals();
194
+ const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
195
+ const [navigationRightButton, setNavigationRightButton] = useState(
196
+ parsedNavigationBar?.initialAccessoryButton
197
+ );
198
+ const addNavigationRightButton = (button) => {
199
+ setNavigationRightButton(button);
200
+ };
201
+ const removeNavigationRightButton = () => {
202
+ setNavigationRightButton(void 0);
203
+ };
204
+ return /* @__PURE__ */ jsx2(
205
+ NavigationBarContext.Provider,
206
+ {
207
+ value: { navigationRightButton, addNavigationRightButton, removeNavigationRightButton },
208
+ children
209
+ }
210
+ );
211
+ }
212
+ function useNavigationBarContext() {
213
+ const context = useContext(NavigationBarContext);
214
+ if (context == null) {
215
+ throw Error("useNavigationBarContext must be used within NavigationBarContextProvider");
216
+ }
217
+ return context;
218
+ }
219
+
220
+ // src/core/hooks/useAppsInTossBridge.ts
221
+ import { appsInTossEvent } from "@apps-in-toss/native-modules";
222
+ import { useBridge } from "@toss/tds-react-native";
223
+ import { useEffect as useEffect4 } from "react";
224
+
179
225
  // src/core/utils/toIcon.ts
180
226
  function toIcon(source) {
181
227
  return source.startsWith("http") ? { source: { uri: source } } : { name: source };
@@ -201,7 +247,7 @@ function useAppsInTossBridge() {
201
247
 
202
248
  // src/components/RNAppContainer.tsx
203
249
  import { appsInTossEvent as appsInTossEvent2, setIosSwipeGestureEnabled } from "@apps-in-toss/native-modules";
204
- import { useEffect as useEffect9, useState as useState4 } from "react";
250
+ import { useEffect as useEffect9, useState as useState5 } from "react";
205
251
  import { Platform as Platform3 } from "react-native";
206
252
 
207
253
  // src/components/GameInitializer.tsx
@@ -317,7 +363,7 @@ function useAppUpdateDialogLogging() {
317
363
 
318
364
  // src/hooks/useGameCenterProfile.ts
319
365
  import { getGameCenterGameProfile } from "@apps-in-toss/native-modules";
320
- import { useCallback as useCallback6, useState as useState2 } from "react";
366
+ import { useCallback as useCallback6, useState as useState3 } from "react";
321
367
 
322
368
  // src/hooks/useErrorAlert.ts
323
369
  import { closeView } from "@granite-js/react-native";
@@ -344,7 +390,7 @@ var useErrorAlert = () => {
344
390
  };
345
391
 
346
392
  // src/hooks/useTransparentWebview.tsx
347
- import { useCallback as useCallback4, useState } from "react";
393
+ import { useCallback as useCallback4, useState as useState2 } from "react";
348
394
 
349
395
  // src/utils/openTransparentWebView.ts
350
396
  import { openURL as openURL3 } from "@granite-js/react-native";
@@ -386,7 +432,7 @@ var openTransparentWebView = ({
386
432
 
387
433
  // src/hooks/useTransparentWebview.tsx
388
434
  var useTransparentWebview = () => {
389
- const [isWebviewLoading, setIsWebviewLoading] = useState(false);
435
+ const [isWebviewLoading, setIsWebviewLoading] = useState2(false);
390
436
  const { open: openErrorAlert } = useErrorAlert();
391
437
  const _openTransparentWebview = useCallback4(
392
438
  ({ webUrl, onClose, onError }) => {
@@ -423,14 +469,14 @@ var useTransparentWebview = () => {
423
469
  import { Asset, Toast } from "@toss/tds-react-native";
424
470
  import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay } from "@toss/tds-react-native/private";
425
471
  import { useCallback as useCallback5 } from "react";
426
- import { jsx as jsx2 } from "react/jsx-runtime";
472
+ import { jsx as jsx3 } from "react/jsx-runtime";
427
473
  var useGameProfileToast = () => {
428
474
  const overlay = useOverlay();
429
475
  const openGameProfileToast = useCallback5(
430
476
  (nickname, profileImageUri) => {
431
477
  return new Promise((resolve) => {
432
478
  overlay.open(({ isOpen, close, exit }) => {
433
- return /* @__PURE__ */ jsx2(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx2(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx2(
479
+ return /* @__PURE__ */ jsx3(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx3(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx3(
434
480
  Toast,
435
481
  {
436
482
  open: isOpen,
@@ -441,7 +487,7 @@ var useGameProfileToast = () => {
441
487
  onExited: exit,
442
488
  position: "top",
443
489
  text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
444
- icon: /* @__PURE__ */ jsx2(
490
+ icon: /* @__PURE__ */ jsx3(
445
491
  Asset.Image,
446
492
  {
447
493
  style: { borderRadius: 64, overflow: "hidden" },
@@ -461,9 +507,9 @@ var useGameProfileToast = () => {
461
507
 
462
508
  // src/hooks/useGameCenterProfile.ts
463
509
  var useGameCenterProfile = (isReadyForProfileUI) => {
464
- const [profileData, setProfileData] = useState2(void 0);
465
- const [isProfileDataLoading, setIsProfileDataLoading] = useState2(true);
466
- const [isProfileDataRefetching, setIsProfileDataRefetching] = useState2(false);
510
+ const [profileData, setProfileData] = useState3(void 0);
511
+ const [isProfileDataLoading, setIsProfileDataLoading] = useState3(true);
512
+ const [isProfileDataRefetching, setIsProfileDataRefetching] = useState3(false);
467
513
  const shouldShowProfileLoadingOverlay = isProfileDataLoading && isReadyForProfileUI || isProfileDataRefetching;
468
514
  const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
469
515
  const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
@@ -527,7 +573,7 @@ var Z_INDEX = {
527
573
  };
528
574
 
529
575
  // src/components/GameInitializer.tsx
530
- import { Fragment as Fragment2, jsx as jsx3, jsxs } from "react/jsx-runtime";
576
+ import { Fragment as Fragment2, jsx as jsx4, jsxs } from "react/jsx-runtime";
531
577
  var GameInitializer = ({ children, isReadyForProfileUI }) => {
532
578
  const {
533
579
  profileData,
@@ -581,8 +627,8 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
581
627
  ]);
582
628
  if (!isMinVersionSupported(GAME_MIN_VERSION)) {
583
629
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
584
- /* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
585
- /* @__PURE__ */ jsx3(
630
+ /* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }),
631
+ /* @__PURE__ */ jsx4(
586
632
  Pressable,
587
633
  {
588
634
  style: {
@@ -603,8 +649,8 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
603
649
  }
604
650
  if (shouldShowProfileLoadingOverlay) {
605
651
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
606
- /* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
607
- /* @__PURE__ */ jsx3(
652
+ /* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }),
653
+ /* @__PURE__ */ jsx4(
608
654
  View,
609
655
  {
610
656
  style: {
@@ -613,15 +659,15 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
613
659
  alignItems: "center",
614
660
  backgroundColor: "rgba(0, 0, 0, 0.2)"
615
661
  },
616
- children: /* @__PURE__ */ jsx3(Loader, { size: "large", type: "light" })
662
+ children: /* @__PURE__ */ jsx4(Loader, { size: "large", type: "light" })
617
663
  }
618
664
  )
619
665
  ] });
620
666
  }
621
667
  if (shouldShowProfileNotFoundOverlay) {
622
668
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
623
- /* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
624
- shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx3(
669
+ /* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }),
670
+ shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx4(
625
671
  Pressable,
626
672
  {
627
673
  style: {
@@ -634,7 +680,7 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
634
680
  )
635
681
  ] });
636
682
  }
637
- return /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }) });
683
+ return /* @__PURE__ */ jsx4(Fragment2, { children: /* @__PURE__ */ jsx4(View, { style: { flex: 1, position: "relative" }, children }) });
638
684
  };
639
685
  var overlayStyle = {
640
686
  position: "absolute",
@@ -813,7 +859,7 @@ import { INTERNAL__appBridgeHandler, isMinVersionSupported as isMinVersionSuppor
813
859
  import { openURL as openURL4 } from "@granite-js/react-native";
814
860
  import { BottomSheet, List, ListHeader, ListRow as ListRow2 } from "@toss/tds-react-native";
815
861
  import { useAdaptive as useAdaptive2, useOverlay as useOverlay2 } from "@toss/tds-react-native/private";
816
- import { useEffect as useEffect7, useState as useState3 } from "react";
862
+ import { useEffect as useEffect7, useState as useState4 } from "react";
817
863
 
818
864
  // src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
819
865
  import { getOperationalEnvironment } from "@apps-in-toss/native-modules";
@@ -901,7 +947,7 @@ function addParamsToUrl(url, params) {
901
947
  }
902
948
 
903
949
  // src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
904
- import { jsx as jsx4 } from "react/jsx-runtime";
950
+ import { jsx as jsx5 } from "react/jsx-runtime";
905
951
  var SHARE_SCHEME_REFERRER = "appsintoss.common_module_share";
906
952
  var APP_SHARE_MENU_INFO = {
907
953
  contactItemName: "\uACF5\uC720\uD558\uAE30",
@@ -917,10 +963,10 @@ function AppShareListMenu() {
917
963
  const schemeForShare = addParamsToUrl(initialScheme, {
918
964
  referrer: SHARE_SCHEME_REFERRER
919
965
  });
920
- return /* @__PURE__ */ jsx4(
966
+ return /* @__PURE__ */ jsx5(
921
967
  ListRow,
922
968
  {
923
- left: /* @__PURE__ */ jsx4(
969
+ left: /* @__PURE__ */ jsx5(
924
970
  ListRow.Icon,
925
971
  {
926
972
  color: globals.brandPrimaryColor,
@@ -928,7 +974,7 @@ function AppShareListMenu() {
928
974
  type: "background"
929
975
  }
930
976
  ),
931
- contents: /* @__PURE__ */ jsx4(
977
+ contents: /* @__PURE__ */ jsx5(
932
978
  ListRow.Texts,
933
979
  {
934
980
  type: "1RowTypeA",
@@ -967,7 +1013,7 @@ function ensureValue(value, name) {
967
1013
  }
968
1014
 
969
1015
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
970
- import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1016
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
971
1017
  var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
972
1018
  var MIN_VERSION = {
973
1019
  BOTTOM_SHEET: {
@@ -982,7 +1028,7 @@ var MIN_VERSION = {
982
1028
  function useMoreButtonBottomSheet() {
983
1029
  const globals = getAppsInTossGlobals();
984
1030
  const adaptive = useAdaptive2();
985
- const [itemList, setItemList] = useState3([]);
1031
+ const [itemList, setItemList] = useState4([]);
986
1032
  const appUpdateDialog = useAppUpdateDialog();
987
1033
  const logging = useMoreButtonBottomSheetLogging();
988
1034
  const overlay = useOverlay2();
@@ -1016,17 +1062,17 @@ function useMoreButtonBottomSheet() {
1016
1062
  logging.close();
1017
1063
  close();
1018
1064
  };
1019
- return /* @__PURE__ */ jsx5(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx5(
1065
+ return /* @__PURE__ */ jsx6(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx6(
1020
1066
  BottomSheet.Root,
1021
1067
  {
1022
- header: /* @__PURE__ */ jsx5(
1068
+ header: /* @__PURE__ */ jsx6(
1023
1069
  ListHeader,
1024
1070
  {
1025
- title: /* @__PURE__ */ jsx5(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
1071
+ title: /* @__PURE__ */ jsx6(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
1026
1072
  }
1027
1073
  ),
1028
1074
  open: isOpen,
1029
- cta: /* @__PURE__ */ jsx5(
1075
+ cta: /* @__PURE__ */ jsx6(
1030
1076
  BottomSheet.CTA,
1031
1077
  {
1032
1078
  size: "large",
@@ -1042,10 +1088,10 @@ function useMoreButtonBottomSheet() {
1042
1088
  onExited: exit,
1043
1089
  children: /* @__PURE__ */ jsxs2(List, { rowSeparator: "none", children: [
1044
1090
  itemList.map((item) => {
1045
- return /* @__PURE__ */ jsx5(
1091
+ return /* @__PURE__ */ jsx6(
1046
1092
  ListRow2,
1047
1093
  {
1048
- left: /* @__PURE__ */ jsx5(
1094
+ left: /* @__PURE__ */ jsx6(
1049
1095
  ListRow2.Icon,
1050
1096
  {
1051
1097
  color: globals.brandPrimaryColor,
@@ -1053,7 +1099,7 @@ function useMoreButtonBottomSheet() {
1053
1099
  type: "background"
1054
1100
  }
1055
1101
  ),
1056
- contents: /* @__PURE__ */ jsx5(
1102
+ contents: /* @__PURE__ */ jsx6(
1057
1103
  ListRow2.Texts,
1058
1104
  {
1059
1105
  type: "1RowTypeA",
@@ -1070,7 +1116,7 @@ function useMoreButtonBottomSheet() {
1070
1116
  item.contactItemName
1071
1117
  );
1072
1118
  }),
1073
- isShareListMenuSupported && /* @__PURE__ */ jsx5(AppShareListMenu, {})
1119
+ isShareListMenuSupported && /* @__PURE__ */ jsx6(AppShareListMenu, {})
1074
1120
  ] })
1075
1121
  }
1076
1122
  ) });
@@ -1083,24 +1129,12 @@ function BottomSheetImpressionArea({ children }) {
1083
1129
  useEffect7(() => {
1084
1130
  logging.show();
1085
1131
  }, [logging]);
1086
- return /* @__PURE__ */ jsx5(Fragment3, { children });
1087
- }
1088
-
1089
- // src/core/utils/safeParseNavigationBar.ts
1090
- function safeParseNavigationBar(navigationBar) {
1091
- if (typeof navigationBar === "object") {
1092
- return navigationBar;
1093
- }
1094
- try {
1095
- return JSON.parse(navigationBar);
1096
- } catch {
1097
- return null;
1098
- }
1132
+ return /* @__PURE__ */ jsx6(Fragment3, { children });
1099
1133
  }
1100
1134
 
1101
1135
  // src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
1102
1136
  import { useEffect as useEffect8, useRef as useRef3 } from "react";
1103
- import { Fragment as Fragment4, jsx as jsx6 } from "react/jsx-runtime";
1137
+ import { Fragment as Fragment4, jsx as jsx7 } from "react/jsx-runtime";
1104
1138
  function NavigationBarImpressionArea({
1105
1139
  children,
1106
1140
  withHomeButton
@@ -1113,21 +1147,21 @@ function NavigationBarImpressionArea({
1113
1147
  hasLogged.current = true;
1114
1148
  }
1115
1149
  }, [logging, withHomeButton]);
1116
- return /* @__PURE__ */ jsx6(Fragment4, { children });
1150
+ return /* @__PURE__ */ jsx7(Fragment4, { children });
1117
1151
  }
1118
1152
 
1119
1153
  // src/components/NavigationBar/RNNavigationBar/Default.tsx
1120
- import { jsx as jsx7 } from "react/jsx-runtime";
1154
+ import { jsx as jsx8 } from "react/jsx-runtime";
1121
1155
  function DefaultNavigationBar() {
1122
1156
  const globals = getAppsInTossGlobals();
1123
1157
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1124
1158
  const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
1125
1159
  const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
1126
1160
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
1127
- const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1161
+ const { navigationRightButton } = useNavigationBarContext();
1128
1162
  const navigationEvent = useNavigationEvent();
1129
1163
  useHardwareBackPress(navigationEvent.handleBack);
1130
- return /* @__PURE__ */ jsx7(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx7(
1164
+ return /* @__PURE__ */ jsx8(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx8(
1131
1165
  TopNavigation,
1132
1166
  {
1133
1167
  title: globals.brandDisplayName,
@@ -1137,8 +1171,8 @@ function DefaultNavigationBar() {
1137
1171
  onPressTitle: withHomeButton ? navigationEvent.handleHomeButtonClick : void 0,
1138
1172
  onPressClose: navigationEvent.handleCloseButtonClick,
1139
1173
  withHome: withHomeButton,
1140
- fixedRightButton: initialAccessoryButton,
1141
- children: /* @__PURE__ */ jsx7(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx7(NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
1174
+ fixedRightButton: navigationRightButton,
1175
+ children: /* @__PURE__ */ jsx8(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx8(NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
1142
1176
  }
1143
1177
  ) });
1144
1178
  }
@@ -1148,19 +1182,17 @@ import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-con
1148
1182
  import { PageNavbar } from "@toss/tds-react-native";
1149
1183
  import { NavigationRightContent, useSafeAreaTop } from "@toss/tds-react-native/private";
1150
1184
  import { Platform as Platform2, View as View2 } from "react-native";
1151
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1185
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
1152
1186
  function GameNavigationBar() {
1153
1187
  const safeAreaTop = useSafeAreaTop();
1154
- const global2 = getAppsInTossGlobals();
1155
1188
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1156
1189
  const navigationEvent = useNavigationEvent();
1190
+ const { navigationRightButton } = useNavigationBarContext();
1157
1191
  const { right: safeAreaRight } = useSafeAreaInsets();
1158
1192
  useHardwareBackPress(navigationEvent.handleBack);
1159
- const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1160
- const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1161
1193
  return /* @__PURE__ */ jsxs3(Fragment5, { children: [
1162
- /* @__PURE__ */ jsx8(PageNavbar, { preference: { type: "none" } }),
1163
- /* @__PURE__ */ jsx8(
1194
+ /* @__PURE__ */ jsx9(PageNavbar, { preference: { type: "none" } }),
1195
+ /* @__PURE__ */ jsx9(
1164
1196
  View2,
1165
1197
  {
1166
1198
  style: {
@@ -1176,10 +1208,10 @@ function GameNavigationBar() {
1176
1208
  paddingRight: safeAreaRight + 10
1177
1209
  },
1178
1210
  pointerEvents: "box-none",
1179
- children: /* @__PURE__ */ jsx8(
1211
+ children: /* @__PURE__ */ jsx9(
1180
1212
  NavigationRightContent,
1181
1213
  {
1182
- fixedRightButton: initialAccessoryButton,
1214
+ fixedRightButton: navigationRightButton,
1183
1215
  onPressDots: openMoreButtonBottomSheet,
1184
1216
  onPressClose: navigationEvent.handleCloseButtonClick,
1185
1217
  theme: "dark"
@@ -1206,19 +1238,19 @@ import * as constant_bridges_star from "@apps-in-toss/native-modules/constant-br
1206
1238
  import * as event_bridges_star from "@apps-in-toss/native-modules/event-bridges";
1207
1239
 
1208
1240
  // src/components/RNAppContainer.tsx
1209
- import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1241
+ import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
1210
1242
  function RNAppContainer({ children }) {
1211
1243
  const global2 = getAppsInTossGlobals();
1212
1244
  switch (global2.appType) {
1213
1245
  case "game":
1214
- return /* @__PURE__ */ jsx9(GameAppContainer, { children });
1246
+ return /* @__PURE__ */ jsx10(GameAppContainer, { children });
1215
1247
  case "general":
1216
1248
  default:
1217
- return /* @__PURE__ */ jsx9(GeneralAppContainer, { children });
1249
+ return /* @__PURE__ */ jsx10(GeneralAppContainer, { children });
1218
1250
  }
1219
1251
  }
1220
1252
  function GameAppContainer({ children }) {
1221
- const [isEntryMessageExited, setIsEntryMessageExited] = useState4(false);
1253
+ const [isEntryMessageExited, setIsEntryMessageExited] = useState5(false);
1222
1254
  useEffect9(() => {
1223
1255
  if (Platform3.OS === "ios") {
1224
1256
  setIosSwipeGestureEnabled({ isEnabled: false });
@@ -1236,40 +1268,40 @@ function GameAppContainer({ children }) {
1236
1268
  });
1237
1269
  }, []);
1238
1270
  return /* @__PURE__ */ jsxs4(Fragment6, { children: [
1239
- /* @__PURE__ */ jsx9(RNNavigationBar.Game, {}),
1240
- (0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx9(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children }) : children
1271
+ /* @__PURE__ */ jsx10(RNNavigationBar.Game, {}),
1272
+ (0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx10(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children }) : children
1241
1273
  ] });
1242
1274
  }
1243
1275
  function GeneralAppContainer({ children }) {
1244
1276
  return /* @__PURE__ */ jsxs4(Fragment6, { children: [
1245
- /* @__PURE__ */ jsx9(RNNavigationBar.Default, {}),
1277
+ /* @__PURE__ */ jsx10(RNNavigationBar.Default, {}),
1246
1278
  children
1247
1279
  ] });
1248
1280
  }
1249
1281
 
1250
1282
  // src/core/registerApp.tsx
1251
- import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1283
+ import { Fragment as Fragment7, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1252
1284
  function AppsInTossContainer(Container, { children, ...initialProps }) {
1253
1285
  if (!isMinVersionSupported3({
1254
1286
  android: "5.220.0",
1255
1287
  ios: "5.221.0"
1256
1288
  })) {
1257
1289
  return /* @__PURE__ */ jsxs5(Fragment7, { children: [
1258
- /* @__PURE__ */ jsx10(AppEvent.Entry, {}),
1259
- /* @__PURE__ */ jsx10(AppEvent.System, { ...initialProps }),
1260
- /* @__PURE__ */ jsx10(AppUpdate, {})
1290
+ /* @__PURE__ */ jsx11(AppEvent.Entry, {}),
1291
+ /* @__PURE__ */ jsx11(AppEvent.System, { ...initialProps }),
1292
+ /* @__PURE__ */ jsx11(AppUpdate, {})
1261
1293
  ] });
1262
1294
  }
1263
1295
  return /* @__PURE__ */ jsxs5(Fragment7, { children: [
1264
- /* @__PURE__ */ jsx10(AppEvent.StayTime, {}),
1265
- /* @__PURE__ */ jsx10(AppEvent.Entry, {}),
1266
- /* @__PURE__ */ jsx10(AppEvent.System, { ...initialProps }),
1267
- /* @__PURE__ */ jsx10(Container, { ...initialProps, children: /* @__PURE__ */ jsx10(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx10(TDSContainer, { ...initialProps, children }) }) })
1296
+ /* @__PURE__ */ jsx11(AppEvent.StayTime, {}),
1297
+ /* @__PURE__ */ jsx11(AppEvent.Entry, {}),
1298
+ /* @__PURE__ */ jsx11(AppEvent.System, { ...initialProps }),
1299
+ /* @__PURE__ */ jsx11(Container, { ...initialProps, children: /* @__PURE__ */ jsx11(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx11(TDSContainer, { ...initialProps, children }) }) })
1268
1300
  ] });
1269
1301
  }
1270
1302
  function TDSContainer({ children }) {
1271
1303
  useAppsInTossBridge();
1272
- return /* @__PURE__ */ jsx10(Fragment7, { children });
1304
+ return /* @__PURE__ */ jsx11(Fragment7, { children });
1273
1305
  }
1274
1306
  function registerApp(container, { context, analytics }) {
1275
1307
  const appName = getAppName();
@@ -1296,7 +1328,7 @@ function registerApp(container, { context, analytics }) {
1296
1328
  }
1297
1329
  function AppsInTossScreenContainer({ children }) {
1298
1330
  const isRNApp = getAppsInTossGlobals().webViewType == null;
1299
- return /* @__PURE__ */ jsx10(Analytics.Screen, { children: isRNApp ? /* @__PURE__ */ jsx10(RNAppContainer, { children }) : children });
1331
+ return /* @__PURE__ */ jsx11(NavigationBarContextProvider, { children: /* @__PURE__ */ jsx11(Analytics.Screen, { children: isRNApp ? /* @__PURE__ */ jsx11(RNAppContainer, { children }) : children }) });
1300
1332
  }
1301
1333
  function getAppName() {
1302
1334
  try {
@@ -1314,10 +1346,10 @@ var AppsInToss = {
1314
1346
 
1315
1347
  // src/components/WebView.tsx
1316
1348
  import {
1349
+ AppsInTossModule,
1317
1350
  GoogleAdMob,
1318
1351
  IAP,
1319
1352
  Storage,
1320
- AppsInTossModule,
1321
1353
  appsInTossEvent as appsInTossEvent4,
1322
1354
  iapCreateOneTimePurchaseOrder,
1323
1355
  processProductGrant,
@@ -1328,8 +1360,8 @@ import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constan
1328
1360
  import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
1329
1361
  import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
1330
1362
  import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
1331
- import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3, useTopNavigation } from "@toss/tds-react-native/private";
1332
- import { useEffect as useEffect12, useMemo as useMemo6, useRef as useRef6, useState as useState7 } from "react";
1363
+ import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3 } from "@toss/tds-react-native/private";
1364
+ import { useEffect as useEffect12, useMemo as useMemo6, useRef as useRef6, useState as useState8 } from "react";
1333
1365
  import { BackHandler as BackHandler2, Platform as Platform6 } from "react-native";
1334
1366
 
1335
1367
  // src/components/GameWebView.tsx
@@ -1337,7 +1369,7 @@ import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, appsInTossEven
1337
1369
  import {
1338
1370
  WebView as PlainWebView
1339
1371
  } from "@granite-js/native/react-native-webview";
1340
- import { forwardRef, useEffect as useEffect10, useState as useState5 } from "react";
1372
+ import { forwardRef, useEffect as useEffect10, useState as useState6 } from "react";
1341
1373
  import { Platform as Platform5 } from "react-native";
1342
1374
 
1343
1375
  // src/components/NavigationBar/GameWebviewNavigationBar.tsx
@@ -1348,7 +1380,7 @@ import { NavigationRightContent as NavigationRightContent2, useSafeAreaTop as us
1348
1380
  import { josa as josa3 } from "es-hangul";
1349
1381
  import { useCallback as useCallback8 } from "react";
1350
1382
  import { Platform as Platform4, View as View3 } from "react-native";
1351
- import { Fragment as Fragment8, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1383
+ import { Fragment as Fragment8, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1352
1384
  function GameWebviewNavigationBar() {
1353
1385
  const safeAreaTop = useSafeAreaTop2();
1354
1386
  const { openConfirm } = useDialog5();
@@ -1356,9 +1388,8 @@ function GameWebviewNavigationBar() {
1356
1388
  const global2 = getAppsInTossGlobals();
1357
1389
  const logging = useNavigationBarLogging();
1358
1390
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1391
+ const { navigationRightButton } = useNavigationBarContext();
1359
1392
  const { right: safeAreaRight } = useSafeAreaInsets2();
1360
- const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1361
- const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1362
1393
  const handleGameWebviewClose = useCallback8(async () => {
1363
1394
  logging.closeButtonClick();
1364
1395
  const isConfirmed = await openConfirm({
@@ -1375,8 +1406,8 @@ function GameWebviewNavigationBar() {
1375
1406
  }
1376
1407
  }, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
1377
1408
  return /* @__PURE__ */ jsxs6(Fragment8, { children: [
1378
- /* @__PURE__ */ jsx11(PageNavbar2, { preference: { type: "none" } }),
1379
- /* @__PURE__ */ jsx11(
1409
+ /* @__PURE__ */ jsx12(PageNavbar2, { preference: { type: "none" } }),
1410
+ /* @__PURE__ */ jsx12(
1380
1411
  View3,
1381
1412
  {
1382
1413
  style: {
@@ -1392,10 +1423,10 @@ function GameWebviewNavigationBar() {
1392
1423
  paddingRight: safeAreaRight + 10
1393
1424
  },
1394
1425
  pointerEvents: "box-none",
1395
- children: /* @__PURE__ */ jsx11(
1426
+ children: /* @__PURE__ */ jsx12(
1396
1427
  NavigationRightContent2,
1397
1428
  {
1398
- fixedRightButton: initialAccessoryButton,
1429
+ fixedRightButton: navigationRightButton,
1399
1430
  onPressDots: openMoreButtonBottomSheet,
1400
1431
  onPressClose: () => {
1401
1432
  handleGameWebviewClose();
@@ -1409,9 +1440,9 @@ function GameWebviewNavigationBar() {
1409
1440
  }
1410
1441
 
1411
1442
  // src/components/GameWebView.tsx
1412
- import { Fragment as Fragment9, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1443
+ import { Fragment as Fragment9, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1413
1444
  var GameWebView = forwardRef(function GameWebView2(props, ref) {
1414
- const [isEntryMessageExited, setIsEntryMessageExited] = useState5(false);
1445
+ const [isEntryMessageExited, setIsEntryMessageExited] = useState6(false);
1415
1446
  useEffect10(() => {
1416
1447
  if (Platform5.OS === "ios") {
1417
1448
  setIosSwipeGestureEnabled3({ isEnabled: false });
@@ -1429,8 +1460,8 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1429
1460
  });
1430
1461
  }, []);
1431
1462
  return /* @__PURE__ */ jsxs7(Fragment9, { children: [
1432
- /* @__PURE__ */ jsx12(GameWebviewNavigationBar, {}),
1433
- getOperationalEnvironment3() === "toss" ? /* @__PURE__ */ jsx12(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx12(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx12(PlainWebView, { ref, ...props })
1463
+ /* @__PURE__ */ jsx13(GameWebviewNavigationBar, {}),
1464
+ getOperationalEnvironment3() === "toss" ? /* @__PURE__ */ jsx13(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx13(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx13(PlainWebView, { ref, ...props })
1434
1465
  ] });
1435
1466
  });
1436
1467
 
@@ -1446,7 +1477,7 @@ import { useDialog as useDialog6 } from "@toss/tds-react-native";
1446
1477
  import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss/tds-react-native/private";
1447
1478
  import { josa as josa4 } from "es-hangul";
1448
1479
  import { useCallback as useCallback9 } from "react";
1449
- import { jsx as jsx13 } from "react/jsx-runtime";
1480
+ import { jsx as jsx14 } from "react/jsx-runtime";
1450
1481
  function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1451
1482
  const globals = getAppsInTossGlobals();
1452
1483
  const { captureExitLog } = useCaptureExitLog();
@@ -1456,7 +1487,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1456
1487
  const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
1457
1488
  const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
1458
1489
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
1459
- const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1490
+ const { navigationRightButton } = useNavigationBarContext();
1460
1491
  const handleClose = useCallback9(async () => {
1461
1492
  logging.closeButtonClick();
1462
1493
  const isConfirmed = await openConfirm({
@@ -1472,7 +1503,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1472
1503
  closeView5();
1473
1504
  }
1474
1505
  }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
1475
- return /* @__PURE__ */ jsx13(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx13(
1506
+ return /* @__PURE__ */ jsx14(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx14(
1476
1507
  TopNavigation2,
1477
1508
  {
1478
1509
  title: globals.brandDisplayName,
@@ -1482,18 +1513,18 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1482
1513
  onPressTitle: withHomeButton ? onHomeButtonClick : void 0,
1483
1514
  onPressClose: handleClose,
1484
1515
  withHome: withHomeButton,
1485
- fixedRightButton: initialAccessoryButton,
1486
- children: /* @__PURE__ */ jsx13(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx13(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
1516
+ fixedRightButton: navigationRightButton,
1517
+ children: /* @__PURE__ */ jsx14(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx14(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
1487
1518
  }
1488
1519
  ) });
1489
1520
  }
1490
1521
 
1491
1522
  // src/components/PartnerWebView.tsx
1492
- import { Fragment as Fragment10, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
1523
+ import { Fragment as Fragment10, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
1493
1524
  var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ onBackButtonClick, onHomeButtonClick, ...webViewProps }, ref) {
1494
1525
  return /* @__PURE__ */ jsxs8(Fragment10, { children: [
1495
- /* @__PURE__ */ jsx14(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
1496
- /* @__PURE__ */ jsx14(PlainWebView2, { ref, ...webViewProps, style: { flex: 1 } })
1526
+ /* @__PURE__ */ jsx15(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
1527
+ /* @__PURE__ */ jsx15(PlainWebView2, { ref, ...webViewProps, style: { flex: 1 } })
1497
1528
  ] });
1498
1529
  });
1499
1530
 
@@ -1916,7 +1947,7 @@ function useCreateUserAgent({
1916
1947
  const platform = getPlatformOS();
1917
1948
  const appVersion = getTossAppVersion();
1918
1949
  const { fontScale } = useWindowDimensions();
1919
- const platformString = platform === "ios" ? "iPhone" : "Android";
1950
+ const platformString = platform === "ios" ? "iPhone" : "Android phone";
1920
1951
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
1921
1952
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
1922
1953
  return [
@@ -1937,10 +1968,10 @@ function useCreateUserAgent({
1937
1968
  // src/hooks/useGeolocation.ts
1938
1969
  import { startUpdateLocation } from "@apps-in-toss/native-modules";
1939
1970
  import { useVisibility as useVisibility3 } from "@granite-js/react-native";
1940
- import { useEffect as useEffect11, useState as useState6 } from "react";
1971
+ import { useEffect as useEffect11, useState as useState7 } from "react";
1941
1972
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1942
1973
  const isVisible = useVisibility3();
1943
- const [location, setLocation] = useState6(null);
1974
+ const [location, setLocation] = useState7(null);
1944
1975
  useEffect11(() => {
1945
1976
  if (!isVisible) {
1946
1977
  return;
@@ -1988,6 +2019,15 @@ function useWaitForReturnNavigator() {
1988
2019
  return startNavigating;
1989
2020
  }
1990
2021
 
2022
+ // src/hooks/useTopNavigation.tsx
2023
+ function useTopNavigation() {
2024
+ const { addNavigationRightButton, removeNavigationRightButton } = useNavigationBarContext();
2025
+ return {
2026
+ addAccessoryButton: addNavigationRightButton,
2027
+ removeAccessoryButton: removeNavigationRightButton
2028
+ };
2029
+ }
2030
+
1991
2031
  // src/utils/log.ts
1992
2032
  import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
1993
2033
  import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
@@ -2038,7 +2078,7 @@ var trackScreen = (url) => {
2038
2078
  };
2039
2079
 
2040
2080
  // src/components/WebView.tsx
2041
- import { jsx as jsx15 } from "react/jsx-runtime";
2081
+ import { jsx as jsx16 } from "react/jsx-runtime";
2042
2082
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
2043
2083
  var TYPES = ["partner", "external", "game"];
2044
2084
  var WEBVIEW_TYPES = {
@@ -2078,7 +2118,7 @@ function WebView({ type, local, onMessage, ...props }) {
2078
2118
  const top = useSafeAreaTop3();
2079
2119
  const bottom = useSafeAreaBottom();
2080
2120
  const global2 = getAppsInTossGlobals();
2081
- const topNavigation = useTopNavigation();
2121
+ const navigationBarContext = useNavigationBarContext();
2082
2122
  const disableTextSelectionCSS = `
2083
2123
  (function() {
2084
2124
  const style = document.createElement('style');
@@ -2086,7 +2126,7 @@ function WebView({ type, local, onMessage, ...props }) {
2086
2126
  document.head.appendChild(style);
2087
2127
  })();
2088
2128
  `;
2089
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState7(
2129
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState8(
2090
2130
  props.allowsBackForwardNavigationGestures
2091
2131
  );
2092
2132
  const handler = useBridgeHandler({
@@ -2140,8 +2180,8 @@ function WebView({ type, local, onMessage, ...props }) {
2140
2180
  setAllowsBackForwardNavigationGestures(options.isEnabled);
2141
2181
  return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
2142
2182
  },
2143
- addAccessoryButton: async (params) => topNavigation.addAccessoryButton(params),
2144
- removeAccessoryButton: async () => topNavigation.removeAccessoryButton(),
2183
+ addAccessoryButton: async (params) => navigationBarContext.addNavigationRightButton(params),
2184
+ removeAccessoryButton: async () => navigationBarContext.removeNavigationRightButton(),
2145
2185
  /** permissions */
2146
2186
  requestPermission: appsInTossAsyncBridges.requestPermission,
2147
2187
  openPermissionDialog: appsInTossAsyncBridges.openPermissionDialog,
@@ -2195,7 +2235,7 @@ function WebView({ type, local, onMessage, ...props }) {
2195
2235
  BackHandler2.addEventListener("hardwareBackPress", callback);
2196
2236
  return () => BackHandler2.removeEventListener("hardwareBackPress", callback);
2197
2237
  }, [webBackHandler]);
2198
- return /* @__PURE__ */ jsx15(
2238
+ return /* @__PURE__ */ jsx16(
2199
2239
  BaseWebView,
2200
2240
  {
2201
2241
  ref: refs,
@@ -2232,7 +2272,7 @@ function WebView({ type, local, onMessage, ...props }) {
2232
2272
 
2233
2273
  // src/index.ts
2234
2274
  export * from "@apps-in-toss/analytics";
2235
- import { useTopNavigation as useTopNavigation2, useOverlay as useOverlay3, OverlayProvider } from "@toss/tds-react-native/private";
2275
+ import { useOverlay as useOverlay3, OverlayProvider } from "@toss/tds-react-native/private";
2236
2276
  export * from "@apps-in-toss/native-modules";
2237
2277
  export * from "@apps-in-toss/types";
2238
2278
  var Analytics2 = {
@@ -2251,6 +2291,6 @@ export {
2251
2291
  useCreateUserAgent,
2252
2292
  useGeolocation,
2253
2293
  useOverlay3 as useOverlay,
2254
- useTopNavigation2 as useTopNavigation,
2294
+ useTopNavigation,
2255
2295
  useWaitForReturnNavigator
2256
2296
  };