@apps-in-toss/framework 1.9.2 → 1.9.4

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.d.cts CHANGED
@@ -166,6 +166,8 @@ declare function useTopNavigation(): {
166
166
 
167
167
  declare const env: {
168
168
  getDeploymentId: () => string;
169
+ getWebViewType: () => "partner" | "external" | "game" | undefined;
170
+ getAppName: () => string;
169
171
  };
170
172
 
171
173
  declare const INTERNAL__onVisibilityChangedByTransparentServiceWeb: typeof onVisibilityChangedByTransparentServiceWeb;
package/dist/index.d.ts CHANGED
@@ -166,6 +166,8 @@ declare function useTopNavigation(): {
166
166
 
167
167
  declare const env: {
168
168
  getDeploymentId: () => string;
169
+ getWebViewType: () => "partner" | "external" | "game" | undefined;
170
+ getAppName: () => string;
169
171
  };
170
172
 
171
173
  declare const INTERNAL__onVisibilityChangedByTransparentServiceWeb: typeof onVisibilityChangedByTransparentServiceWeb;
package/dist/index.js CHANGED
@@ -29,7 +29,9 @@ import { useEffect as useEffect2 } from "react";
29
29
 
30
30
  // src/env.ts
31
31
  var env = {
32
- getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
32
+ getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId,
33
+ getWebViewType: () => global.__appsInToss.webViewType,
34
+ getAppName: () => global.__granite.app.name
33
35
  };
34
36
 
35
37
  // src/hooks/useCaptureExitLog.ts
@@ -1020,16 +1022,43 @@ function AppShareListMenu() {
1020
1022
  );
1021
1023
  }
1022
1024
 
1023
- // src/core/hooks/useMoreButtonBottomSheet/PermissionsMenu.tsx
1025
+ // src/core/hooks/useMoreButtonBottomSheet/HomeShortcutMenu.tsx
1024
1026
  import { getOperationalEnvironment as getOperationalEnvironment2 } from "@apps-in-toss/native-modules";
1025
- import { Granite as Granite6, openURL as openURL4 } from "@granite-js/react-native";
1027
+ import { NativeModules as NativeModules2 } from "react-native";
1026
1028
  import { jsx as jsx7 } from "react/jsx-runtime";
1027
- function PermissionsMenu() {
1029
+ function HomeShortcutMenu() {
1030
+ const isSandbox = getOperationalEnvironment2() === "sandbox";
1028
1031
  const globals = getAppsInTossGlobals();
1029
- if (getOperationalEnvironment2() === "sandbox") {
1032
+ if (isSandbox) {
1030
1033
  return null;
1031
1034
  }
1032
1035
  return /* @__PURE__ */ jsx7(
1036
+ Menu,
1037
+ {
1038
+ title: "\uD648 \uD654\uBA74\uC5D0 \uCD94\uAC00",
1039
+ iconURL: "https://static.toss.im/icons/png/4x/icon-plus-circle-mono.png",
1040
+ onPress: () => {
1041
+ NativeModules2.AppsInTossModule.addMiniAppShortcut({
1042
+ title: globals.brandDisplayName,
1043
+ appName: global.__granite.app.name,
1044
+ iconUrl: globals.brandIcon,
1045
+ guideUrl: "https://service.toss.im/app-mini-home/shortcut"
1046
+ });
1047
+ }
1048
+ }
1049
+ );
1050
+ }
1051
+
1052
+ // src/core/hooks/useMoreButtonBottomSheet/PermissionsMenu.tsx
1053
+ import { getOperationalEnvironment as getOperationalEnvironment3 } from "@apps-in-toss/native-modules";
1054
+ import { Granite as Granite6, openURL as openURL4 } from "@granite-js/react-native";
1055
+ import { jsx as jsx8 } from "react/jsx-runtime";
1056
+ function PermissionsMenu() {
1057
+ const globals = getAppsInTossGlobals();
1058
+ if (getOperationalEnvironment3() === "sandbox") {
1059
+ return null;
1060
+ }
1061
+ return /* @__PURE__ */ jsx8(
1033
1062
  Menu,
1034
1063
  {
1035
1064
  title: "\uAD8C\uD55C \uC124\uC815",
@@ -1050,7 +1079,7 @@ function ensureValue(value, name) {
1050
1079
  }
1051
1080
 
1052
1081
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
1053
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
1082
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
1054
1083
  var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
1055
1084
  var MIN_VERSION = {
1056
1085
  BOTTOM_SHEET: {
@@ -1061,6 +1090,10 @@ var MIN_VERSION = {
1061
1090
  android: "5.230.0",
1062
1091
  ios: "5.230.0"
1063
1092
  },
1093
+ HOME_SHORTCUT_MENU: {
1094
+ android: "5.246.0",
1095
+ ios: "5.246.0"
1096
+ },
1064
1097
  PERMISSIONS_MENU: {
1065
1098
  android: "5.238.0",
1066
1099
  ios: "5.237.0"
@@ -1074,6 +1107,7 @@ function useMoreButtonBottomSheet() {
1074
1107
  const logging = useMoreButtonBottomSheetLogging();
1075
1108
  const overlay = useOverlay2();
1076
1109
  const title = ensureValue(globals.brandDisplayName, "displayName");
1110
+ const isHomeShortcutSupported = isMinVersionSupported2(MIN_VERSION.HOME_SHORTCUT_MENU);
1077
1111
  const isBottomSheetSupported = isMinVersionSupported2(MIN_VERSION.BOTTOM_SHEET);
1078
1112
  const isShareListMenuSupported = isMinVersionSupported2(MIN_VERSION.SHARE_LIST_MENU);
1079
1113
  const [isPermissionsMenuSupported, setIsPermissionsMenuSupported] = useState4(false);
@@ -1114,17 +1148,17 @@ function useMoreButtonBottomSheet() {
1114
1148
  logging.close();
1115
1149
  close();
1116
1150
  };
1117
- return /* @__PURE__ */ jsx8(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx8(
1151
+ return /* @__PURE__ */ jsx9(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx9(
1118
1152
  BottomSheet.Root,
1119
1153
  {
1120
- header: /* @__PURE__ */ jsx8(
1154
+ header: /* @__PURE__ */ jsx9(
1121
1155
  ListHeader,
1122
1156
  {
1123
- title: /* @__PURE__ */ jsx8(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
1157
+ title: /* @__PURE__ */ jsx9(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
1124
1158
  }
1125
1159
  ),
1126
1160
  open: isOpen,
1127
- cta: /* @__PURE__ */ jsx8(
1161
+ cta: /* @__PURE__ */ jsx9(
1128
1162
  BottomSheet.CTA,
1129
1163
  {
1130
1164
  size: "large",
@@ -1139,7 +1173,7 @@ function useMoreButtonBottomSheet() {
1139
1173
  onClose: handleClose,
1140
1174
  onExited: exit,
1141
1175
  children: /* @__PURE__ */ jsxs2(List, { rowSeparator: "none", children: [
1142
- itemList.map((item) => /* @__PURE__ */ jsx8(
1176
+ itemList.map((item) => /* @__PURE__ */ jsx9(
1143
1177
  Menu,
1144
1178
  {
1145
1179
  title: item.contactItemName,
@@ -1148,8 +1182,9 @@ function useMoreButtonBottomSheet() {
1148
1182
  },
1149
1183
  item.contactItemName
1150
1184
  )),
1151
- isShareListMenuSupported && /* @__PURE__ */ jsx8(AppShareListMenu, {}),
1152
- isPermissionsMenuSupported && /* @__PURE__ */ jsx8(PermissionsMenu, {})
1185
+ isHomeShortcutSupported && /* @__PURE__ */ jsx9(HomeShortcutMenu, {}),
1186
+ isShareListMenuSupported && /* @__PURE__ */ jsx9(AppShareListMenu, {}),
1187
+ isPermissionsMenuSupported && /* @__PURE__ */ jsx9(PermissionsMenu, {})
1153
1188
  ] })
1154
1189
  }
1155
1190
  ) });
@@ -1162,7 +1197,7 @@ function BottomSheetImpressionArea({ children }) {
1162
1197
  useEffect6(() => {
1163
1198
  logging.show();
1164
1199
  }, [logging]);
1165
- return /* @__PURE__ */ jsx8(Fragment3, { children });
1200
+ return /* @__PURE__ */ jsx9(Fragment3, { children });
1166
1201
  }
1167
1202
 
1168
1203
  // src/core/utils/toIcon.ts
@@ -1172,7 +1207,7 @@ function toIcon(source) {
1172
1207
 
1173
1208
  // src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
1174
1209
  import { useEffect as useEffect7, useRef as useRef3 } from "react";
1175
- import { Fragment as Fragment4, jsx as jsx9 } from "react/jsx-runtime";
1210
+ import { Fragment as Fragment4, jsx as jsx10 } from "react/jsx-runtime";
1176
1211
  function NavigationBarImpressionArea({
1177
1212
  children,
1178
1213
  withHomeButton
@@ -1185,11 +1220,11 @@ function NavigationBarImpressionArea({
1185
1220
  hasLogged.current = true;
1186
1221
  }
1187
1222
  }, [logging, withHomeButton]);
1188
- return /* @__PURE__ */ jsx9(Fragment4, { children });
1223
+ return /* @__PURE__ */ jsx10(Fragment4, { children });
1189
1224
  }
1190
1225
 
1191
1226
  // src/components/NavigationBar/RNNavigationBar/Default.tsx
1192
- import { jsx as jsx10 } from "react/jsx-runtime";
1227
+ import { jsx as jsx11 } from "react/jsx-runtime";
1193
1228
  function DefaultNavigationBar() {
1194
1229
  const globals = getAppsInTossGlobals();
1195
1230
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
@@ -1199,7 +1234,7 @@ function DefaultNavigationBar() {
1199
1234
  const { navigationRightButton } = useNavigationBarContext();
1200
1235
  const navigationEvent = useNavigationEvent();
1201
1236
  useHardwareBackPress(navigationEvent.handleBack);
1202
- return /* @__PURE__ */ jsx10(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx10(
1237
+ return /* @__PURE__ */ jsx11(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx11(
1203
1238
  TopNavigation,
1204
1239
  {
1205
1240
  title: globals.brandDisplayName,
@@ -1211,7 +1246,7 @@ function DefaultNavigationBar() {
1211
1246
  withHome: withHomeButton,
1212
1247
  fixedRightButton: navigationRightButton,
1213
1248
  leftVisible: withBackButton,
1214
- children: /* @__PURE__ */ jsx10(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx10(NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
1249
+ children: /* @__PURE__ */ jsx11(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx11(NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
1215
1250
  }
1216
1251
  ) });
1217
1252
  }
@@ -1221,7 +1256,7 @@ import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-con
1221
1256
  import { PageNavbar } from "@toss/tds-react-native";
1222
1257
  import { NavigationRightContent, useSafeAreaTop } from "@toss/tds-react-native/private";
1223
1258
  import { Platform as Platform2, View as View3 } from "react-native";
1224
- import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
1259
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
1225
1260
  function GameNavigationBar() {
1226
1261
  const safeAreaTop = useSafeAreaTop();
1227
1262
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
@@ -1230,8 +1265,8 @@ function GameNavigationBar() {
1230
1265
  const { right: safeAreaRight } = useSafeAreaInsets();
1231
1266
  useHardwareBackPress(navigationEvent.handleBack);
1232
1267
  return /* @__PURE__ */ jsxs3(Fragment5, { children: [
1233
- /* @__PURE__ */ jsx11(PageNavbar, { preference: { type: "none" } }),
1234
- /* @__PURE__ */ jsx11(
1268
+ /* @__PURE__ */ jsx12(PageNavbar, { preference: { type: "none" } }),
1269
+ /* @__PURE__ */ jsx12(
1235
1270
  View3,
1236
1271
  {
1237
1272
  style: {
@@ -1247,7 +1282,7 @@ function GameNavigationBar() {
1247
1282
  paddingRight: safeAreaRight + 10
1248
1283
  },
1249
1284
  pointerEvents: "box-none",
1250
- children: /* @__PURE__ */ jsx11(
1285
+ children: /* @__PURE__ */ jsx12(
1251
1286
  NavigationRightContent,
1252
1287
  {
1253
1288
  fixedRightButton: navigationRightButton,
@@ -1277,15 +1312,15 @@ import * as constant_bridges_star from "@apps-in-toss/native-modules/constant-br
1277
1312
  import * as event_bridges_star from "@apps-in-toss/native-modules/event-bridges";
1278
1313
 
1279
1314
  // src/components/RNAppContainer.tsx
1280
- import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
1315
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
1281
1316
  function RNAppContainer({ children }) {
1282
1317
  const global2 = getAppsInTossGlobals();
1283
1318
  switch (global2.appType) {
1284
1319
  case "game":
1285
- return /* @__PURE__ */ jsx12(GameAppContainer, { children });
1320
+ return /* @__PURE__ */ jsx13(GameAppContainer, { children });
1286
1321
  case "general":
1287
1322
  default:
1288
- return /* @__PURE__ */ jsx12(GeneralAppContainer, { children });
1323
+ return /* @__PURE__ */ jsx13(GeneralAppContainer, { children });
1289
1324
  }
1290
1325
  }
1291
1326
  function GameAppContainer({ children }) {
@@ -1299,35 +1334,35 @@ function GameAppContainer({ children }) {
1299
1334
  return;
1300
1335
  }, []);
1301
1336
  return /* @__PURE__ */ jsxs4(Fragment6, { children: [
1302
- /* @__PURE__ */ jsx12(RNNavigationBar.Game, {}),
1303
- (0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx12(GameInitializer, { children }) : children
1337
+ /* @__PURE__ */ jsx13(RNNavigationBar.Game, {}),
1338
+ (0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx13(GameInitializer, { children }) : children
1304
1339
  ] });
1305
1340
  }
1306
1341
  function GeneralAppContainer({ children }) {
1307
1342
  return /* @__PURE__ */ jsxs4(Fragment6, { children: [
1308
- /* @__PURE__ */ jsx12(RNNavigationBar.Default, {}),
1343
+ /* @__PURE__ */ jsx13(RNNavigationBar.Default, {}),
1309
1344
  children
1310
1345
  ] });
1311
1346
  }
1312
1347
 
1313
1348
  // src/core/registerApp.tsx
1314
- import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
1349
+ import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
1315
1350
  function AppsInTossContainer(Container, { children, ...initialProps }) {
1316
1351
  if (!isMinVersionSupported3({
1317
1352
  android: "5.220.0",
1318
1353
  ios: "5.221.0"
1319
1354
  })) {
1320
1355
  return /* @__PURE__ */ jsxs5(Fragment7, { children: [
1321
- /* @__PURE__ */ jsx13(AppEvent.Entry, {}),
1322
- /* @__PURE__ */ jsx13(AppEvent.System, { ...initialProps }),
1323
- /* @__PURE__ */ jsx13(AppUpdate, {})
1356
+ /* @__PURE__ */ jsx14(AppEvent.Entry, {}),
1357
+ /* @__PURE__ */ jsx14(AppEvent.System, { ...initialProps }),
1358
+ /* @__PURE__ */ jsx14(AppUpdate, {})
1324
1359
  ] });
1325
1360
  }
1326
1361
  return /* @__PURE__ */ jsxs5(Fragment7, { children: [
1327
- /* @__PURE__ */ jsx13(AppEvent.StayTime, {}),
1328
- /* @__PURE__ */ jsx13(AppEvent.Entry, {}),
1329
- /* @__PURE__ */ jsx13(AppEvent.System, { ...initialProps }),
1330
- /* @__PURE__ */ jsx13(Container, { ...initialProps, children: /* @__PURE__ */ jsx13(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children }) })
1362
+ /* @__PURE__ */ jsx14(AppEvent.StayTime, {}),
1363
+ /* @__PURE__ */ jsx14(AppEvent.Entry, {}),
1364
+ /* @__PURE__ */ jsx14(AppEvent.System, { ...initialProps }),
1365
+ /* @__PURE__ */ jsx14(Container, { ...initialProps, children: /* @__PURE__ */ jsx14(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children }) })
1331
1366
  ] });
1332
1367
  }
1333
1368
  function registerApp(container, { context, analytics }) {
@@ -1355,7 +1390,7 @@ function registerApp(container, { context, analytics }) {
1355
1390
  }
1356
1391
  function AppsInTossScreenContainer({ children }) {
1357
1392
  const isRNApp = getAppsInTossGlobals().webViewType == null;
1358
- return /* @__PURE__ */ jsx13(NavigationBarContextProvider, { children: /* @__PURE__ */ jsx13(Analytics.Screen, { children: isRNApp ? /* @__PURE__ */ jsx13(RNAppContainer, { children }) : children }) });
1393
+ return /* @__PURE__ */ jsx14(NavigationBarContextProvider, { children: /* @__PURE__ */ jsx14(Analytics.Screen, { children: isRNApp ? /* @__PURE__ */ jsx14(RNAppContainer, { children }) : children }) });
1359
1394
  }
1360
1395
  function getAppName() {
1361
1396
  try {
@@ -1386,15 +1421,16 @@ import {
1386
1421
  import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
1387
1422
  import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
1388
1423
  import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
1424
+ import { afterDocumentLoad, beforeDocumentLoad } from "@apps-in-toss/user-scripts";
1389
1425
  import { useSafeAreaInsets as useSafeAreaInsets4 } from "@granite-js/native/react-native-safe-area-context";
1390
1426
  import { getSchemeUri as getSchemeUri8 } from "@granite-js/react-native";
1391
1427
  import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
1392
1428
  import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3 } from "@toss/tds-react-native/private";
1393
1429
  import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef6, useState as useState6 } from "react";
1394
- import { BackHandler as BackHandler2, Linking, Platform as Platform6 } from "react-native";
1430
+ import { BackHandler as BackHandler2, Linking, NativeModules as NativeModules3, Platform as Platform6 } from "react-native";
1395
1431
 
1396
1432
  // src/components/GameWebView.tsx
1397
- import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, getOperationalEnvironment as getOperationalEnvironment4 } from "@apps-in-toss/native-modules";
1433
+ import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, getOperationalEnvironment as getOperationalEnvironment5 } from "@apps-in-toss/native-modules";
1398
1434
  import {
1399
1435
  WebView as PlainWebView
1400
1436
  } from "@granite-js/native/react-native-webview";
@@ -1409,7 +1445,7 @@ import { NavigationRightContent as NavigationRightContent2, useSafeAreaTop as us
1409
1445
  import { josa as josa3 } from "es-hangul";
1410
1446
  import { useCallback as useCallback8 } from "react";
1411
1447
  import { Platform as Platform4, View as View4 } from "react-native";
1412
- import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1448
+ import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
1413
1449
  function GameWebviewNavigationBar() {
1414
1450
  const safeAreaTop = useSafeAreaTop2();
1415
1451
  const { openConfirm } = useDialog5();
@@ -1435,8 +1471,8 @@ function GameWebviewNavigationBar() {
1435
1471
  }
1436
1472
  }, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
1437
1473
  return /* @__PURE__ */ jsxs6(Fragment8, { children: [
1438
- /* @__PURE__ */ jsx14(PageNavbar2, { preference: { type: "none" } }),
1439
- /* @__PURE__ */ jsx14(
1474
+ /* @__PURE__ */ jsx15(PageNavbar2, { preference: { type: "none" } }),
1475
+ /* @__PURE__ */ jsx15(
1440
1476
  View4,
1441
1477
  {
1442
1478
  style: {
@@ -1452,7 +1488,7 @@ function GameWebviewNavigationBar() {
1452
1488
  paddingRight: safeAreaRight + 10
1453
1489
  },
1454
1490
  pointerEvents: "box-none",
1455
- children: /* @__PURE__ */ jsx14(
1491
+ children: /* @__PURE__ */ jsx15(
1456
1492
  NavigationRightContent2,
1457
1493
  {
1458
1494
  fixedRightButton: navigationRightButton,
@@ -1469,7 +1505,7 @@ function GameWebviewNavigationBar() {
1469
1505
  }
1470
1506
 
1471
1507
  // src/components/GameWebView.tsx
1472
- import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1508
+ import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
1473
1509
  var GameWebView = forwardRef(function GameWebView2(props, ref) {
1474
1510
  useEffect9(() => {
1475
1511
  if (Platform5.OS === "ios") {
@@ -1481,8 +1517,8 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1481
1517
  return;
1482
1518
  }, []);
1483
1519
  return /* @__PURE__ */ jsxs7(Fragment9, { children: [
1484
- /* @__PURE__ */ jsx15(GameWebviewNavigationBar, {}),
1485
- getOperationalEnvironment4() === "toss" ? /* @__PURE__ */ jsx15(GameInitializer, { children: /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props })
1520
+ /* @__PURE__ */ jsx16(GameWebviewNavigationBar, {}),
1521
+ getOperationalEnvironment5() === "toss" ? /* @__PURE__ */ jsx16(GameInitializer, { children: /* @__PURE__ */ jsx16(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx16(PlainWebView, { ref, ...props })
1486
1522
  ] });
1487
1523
  });
1488
1524
 
@@ -1498,7 +1534,7 @@ import { useDialog as useDialog6 } from "@toss/tds-react-native";
1498
1534
  import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss/tds-react-native/private";
1499
1535
  import { josa as josa4 } from "es-hangul";
1500
1536
  import { useCallback as useCallback9 } from "react";
1501
- import { jsx as jsx16 } from "react/jsx-runtime";
1537
+ import { jsx as jsx17 } from "react/jsx-runtime";
1502
1538
  function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1503
1539
  const globals = getAppsInTossGlobals();
1504
1540
  const { captureExitLog } = useCaptureExitLog();
@@ -1524,7 +1560,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1524
1560
  closeView5();
1525
1561
  }
1526
1562
  }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
1527
- return /* @__PURE__ */ jsx16(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx16(
1563
+ return /* @__PURE__ */ jsx17(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx17(
1528
1564
  TopNavigation2,
1529
1565
  {
1530
1566
  title: globals.brandDisplayName,
@@ -1536,17 +1572,17 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1536
1572
  withHome: withHomeButton,
1537
1573
  fixedRightButton: navigationRightButton,
1538
1574
  leftVisible: withBackButton,
1539
- children: /* @__PURE__ */ jsx16(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx16(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
1575
+ children: /* @__PURE__ */ jsx17(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx17(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
1540
1576
  }
1541
1577
  ) });
1542
1578
  }
1543
1579
 
1544
1580
  // src/components/PartnerWebView.tsx
1545
- import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
1581
+ import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
1546
1582
  var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ onBackButtonClick, onHomeButtonClick, ...webViewProps }, ref) {
1547
1583
  return /* @__PURE__ */ jsxs8(Fragment10, { children: [
1548
- /* @__PURE__ */ jsx17(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
1549
- /* @__PURE__ */ jsx17(PlainWebView2, { ref, ...webViewProps, style: { flex: 1 } })
1584
+ /* @__PURE__ */ jsx18(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
1585
+ /* @__PURE__ */ jsx18(PlainWebView2, { ref, ...webViewProps, style: { flex: 1 } })
1550
1586
  ] });
1551
1587
  });
1552
1588
 
@@ -1565,7 +1601,7 @@ function convertIntentURL(url) {
1565
1601
 
1566
1602
  // src/ads/fetchTossAd.ts
1567
1603
  import {
1568
- getOperationalEnvironment as getOperationalEnvironment5,
1604
+ getOperationalEnvironment as getOperationalEnvironment6,
1569
1605
  INTERNAL__appBridgeHandler as INTERNAL__appBridgeHandler2,
1570
1606
  isMinVersionSupported as isMinVersionSupported4
1571
1607
  } from "@apps-in-toss/native-modules";
@@ -1590,7 +1626,7 @@ var sessionId = generateSessionId();
1590
1626
  var ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
1591
1627
  var IOS_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
1592
1628
  var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
1593
- var ENVIRONMENT = getOperationalEnvironment5();
1629
+ var ENVIRONMENT = getOperationalEnvironment6();
1594
1630
  function fetchTossAd(params) {
1595
1631
  if (!fetchTossAd.isSupported()) {
1596
1632
  params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
@@ -1643,7 +1679,7 @@ function getReferrer() {
1643
1679
  }
1644
1680
 
1645
1681
  // src/ads/remotes.ts
1646
- import { getOperationalEnvironment as getOperationalEnvironment6, getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
1682
+ import { getOperationalEnvironment as getOperationalEnvironment7, getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
1647
1683
 
1648
1684
  // src/ads/getIsDev.ts
1649
1685
  import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
@@ -1656,7 +1692,7 @@ function getIsDev() {
1656
1692
  }
1657
1693
 
1658
1694
  // src/ads/remotes.ts
1659
- var OPERATIONAL_ENVIRONMENT = getOperationalEnvironment6();
1695
+ var OPERATIONAL_ENVIRONMENT = getOperationalEnvironment7();
1660
1696
  var OS = getPlatformOS();
1661
1697
  var APP_VER = getTossAppVersion();
1662
1698
  var ALPHA_EVENT_TRACKER_HTTP_ENDPOINT = "https://alpha-trillion.toss.im/trk/sdk-mediation/event";
@@ -2455,7 +2491,7 @@ function useTopNavigation() {
2455
2491
  }
2456
2492
 
2457
2493
  // src/hooks/useWebViewMemoryDebug.tsx
2458
- import { getOperationalEnvironment as getOperationalEnvironment7, INTERNAL__module as INTERNAL__module7 } from "@apps-in-toss/native-modules";
2494
+ import { getOperationalEnvironment as getOperationalEnvironment8, INTERNAL__module as INTERNAL__module7 } from "@apps-in-toss/native-modules";
2459
2495
  import { Granite as Granite9 } from "@granite-js/react-native";
2460
2496
  import { useToast } from "@toss/tds-react-native";
2461
2497
  function useHandleWebViewProcessDidTerminate(webViewRef) {
@@ -2483,7 +2519,7 @@ function webViewDebugLog(logName, params) {
2483
2519
  deployment_id: global2.deploymentId
2484
2520
  }
2485
2521
  };
2486
- if (getOperationalEnvironment7() === "toss") {
2522
+ if (getOperationalEnvironment8() === "toss") {
2487
2523
  INTERNAL__module7.tossCoreEventLog(event);
2488
2524
  } else {
2489
2525
  console.log("[webViewDebugLog]", event);
@@ -2540,7 +2576,7 @@ var trackScreen = (url) => {
2540
2576
  };
2541
2577
 
2542
2578
  // src/components/WebView.tsx
2543
- import { jsx as jsx18 } from "react/jsx-runtime";
2579
+ import { jsx as jsx19 } from "react/jsx-runtime";
2544
2580
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
2545
2581
  var TYPES = ["partner", "external", "game"];
2546
2582
  var WEBVIEW_TYPES = {
@@ -2638,7 +2674,9 @@ function WebView({ type, local, onMessage, ...props }) {
2638
2674
  /** TossAd */
2639
2675
  fetchTossAd_isSupported: fetchTossAd.isSupported,
2640
2676
  /** env */
2641
- getDeploymentId: env.getDeploymentId
2677
+ getDeploymentId: env.getDeploymentId,
2678
+ getWebViewType: env.getWebViewType,
2679
+ getAppName: env.getAppName
2642
2680
  },
2643
2681
  asyncHandlerMap: {
2644
2682
  ...appsInTossAsyncBridges,
@@ -2676,7 +2714,11 @@ function WebView({ type, local, onMessage, ...props }) {
2676
2714
  /** Toss Ads */
2677
2715
  tossAdEventLog,
2678
2716
  /** Private */
2679
- memoryDebugLog: webViewMemoryDebugLog
2717
+ memoryDebugLog: webViewMemoryDebugLog,
2718
+ debugLog: async (event) => {
2719
+ NativeModules3.AppsInTossModule?.eventLog(event);
2720
+ NativeModules3.TossCoreModule?.eventLog(event);
2721
+ }
2680
2722
  }
2681
2723
  });
2682
2724
  const headerPropForExternalWebView = useMemo7(() => {
@@ -2708,9 +2750,8 @@ function WebView({ type, local, onMessage, ...props }) {
2708
2750
  BackHandler2.addEventListener("hardwareBackPress", callback);
2709
2751
  return () => BackHandler2.removeEventListener("hardwareBackPress", callback);
2710
2752
  }, [webBackHandler]);
2711
- const globalScripts = useGlobalScripts();
2712
2753
  const handleWebViewProcessDidTerminate = useHandleWebViewProcessDidTerminate(webViewRef);
2713
- return /* @__PURE__ */ jsx18(
2754
+ return /* @__PURE__ */ jsx19(
2714
2755
  BaseWebView,
2715
2756
  {
2716
2757
  ref: refs,
@@ -2737,8 +2778,8 @@ function WebView({ type, local, onMessage, ...props }) {
2737
2778
  webviewDebuggingEnabled: webViewDebuggingEnabled,
2738
2779
  thirdPartyCookiesEnabled: true,
2739
2780
  onMessage: handler.onMessage,
2740
- injectedJavaScript: globalScripts.afterLoad,
2741
- injectedJavaScriptBeforeContentLoaded: mergeScripts(handler.injectedJavaScript, globalScripts.beforeLoad),
2781
+ injectedJavaScript: afterDocumentLoad,
2782
+ injectedJavaScriptBeforeContentLoaded: [handler.injectedJavaScript, beforeDocumentLoad].join("\n"),
2742
2783
  decelerationRate: Platform6.OS === "ios" ? 1 : void 0,
2743
2784
  allowsBackForwardNavigationGestures,
2744
2785
  onShouldStartLoadWithRequest: (event) => {
@@ -2769,67 +2810,6 @@ function WebView({ type, local, onMessage, ...props }) {
2769
2810
  }
2770
2811
  );
2771
2812
  }
2772
- function useGlobalScripts() {
2773
- const global2 = getAppsInTossGlobals();
2774
- const disableTextSelectionCSS = `
2775
- const style = document.createElement('style');
2776
- style.textContent = '*:not(input):not(textarea) { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; }';
2777
- document.head.appendChild(style);
2778
- `;
2779
- const applyGameResourcesCache = `
2780
- (function () {
2781
- if (typeof caches === 'undefined') {
2782
- return;
2783
- }
2784
- const cacheKeyPrefix = '@apps-in-toss/caches/';
2785
- const cacheKey = \`\${cacheKeyPrefix}${global2.deploymentId}\`;
2786
- window.addEventListener('load', async () => {
2787
- const keys = await caches.keys();
2788
- for (const key of keys) {
2789
- if (key.startsWith(cacheKeyPrefix) && key !== cacheKey) {
2790
- await caches.delete(key);
2791
- }
2792
- }
2793
- });
2794
- window.fetch = new Proxy(window.fetch, {
2795
- async apply(originalFetch, thisArg, args) {
2796
- const request = new Request(args[0], args[1]);
2797
- if (!/\\.(data|wasm|framework\\.js)(?:\\.gz|\\.br|\\.unityweb)?$/.test(request.url)) {
2798
- return await originalFetch.call(thisArg, request);
2799
- }
2800
- const cache = await caches.open(cacheKey);
2801
- const cached = await cache.match(request);
2802
- if (cached) {
2803
- const eTag = cached.headers.get('ETag');
2804
- const lastModified = cached.headers.get('Last-Modified');
2805
- if (eTag) {
2806
- request.headers.set('If-None-Match', eTag);
2807
- }
2808
- if (lastModified) {
2809
- request.headers.set('If-Modified-Since', lastModified);
2810
- }
2811
- const revalidated = await originalFetch.call(thisArg, request);
2812
- if (revalidated.status === 304) {
2813
- return cached;
2814
- }
2815
- cache.put(request, revalidated.clone());
2816
- return revalidated;
2817
- }
2818
- const response = await originalFetch.call(thisArg, request);
2819
- cache.put(request, response.clone());
2820
- return response;
2821
- },
2822
- });
2823
- })();
2824
- `;
2825
- return {
2826
- beforeLoad: mergeScripts(global2.webViewType === "game" && applyGameResourcesCache),
2827
- afterLoad: mergeScripts(disableTextSelectionCSS)
2828
- };
2829
- }
2830
- function mergeScripts(...scripts) {
2831
- return scripts.filter((script) => typeof script === "string").join("\n");
2832
- }
2833
2813
 
2834
2814
  // src/index.ts
2835
2815
  export * from "@apps-in-toss/analytics";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "1.9.2",
4
+ "version": "1.9.4",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit",
@@ -55,11 +55,12 @@
55
55
  "ait": "./bin/ait.js"
56
56
  },
57
57
  "dependencies": {
58
- "@apps-in-toss/analytics": "1.9.2",
59
- "@apps-in-toss/cli": "1.9.2",
60
- "@apps-in-toss/native-modules": "1.9.2",
61
- "@apps-in-toss/plugins": "1.9.2",
62
- "@apps-in-toss/types": "1.9.2",
58
+ "@apps-in-toss/analytics": "1.9.4",
59
+ "@apps-in-toss/cli": "1.9.4",
60
+ "@apps-in-toss/native-modules": "1.9.4",
61
+ "@apps-in-toss/plugins": "1.9.4",
62
+ "@apps-in-toss/types": "1.9.4",
63
+ "@apps-in-toss/user-scripts": "^1.9.4",
63
64
  "es-hangul": "^2.3.2"
64
65
  },
65
66
  "devDependencies": {