@apps-in-toss/framework 0.0.0-dev.1764816865438 → 0.0.0-dev.1765732023607

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
@@ -217,37 +217,9 @@ function useNavigationBarContext() {
217
217
  return context;
218
218
  }
219
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
-
225
- // src/core/utils/toIcon.ts
226
- function toIcon(source) {
227
- return source.startsWith("http") ? { source: { uri: source } } : { name: source };
228
- }
229
-
230
- // src/core/hooks/useAppsInTossBridge.ts
231
- function useAppsInTossBridge() {
232
- const controller = useBridge();
233
- const appsInTossGlobals = getAppsInTossGlobals();
234
- useEffect4(() => {
235
- const isGameApp = appsInTossGlobals.webViewType === "game" || appsInTossGlobals.appType === "game";
236
- controller.open({
237
- serviceName: appsInTossGlobals.brandDisplayName,
238
- icon: toIcon(appsInTossGlobals.brandIcon),
239
- color: appsInTossGlobals.brandPrimaryColor,
240
- colorMode: isGameApp ? "inverted" : appsInTossGlobals.brandBridgeColorMode,
241
- onExited: () => {
242
- appsInTossEvent.emit("entryMessageExited", void 0);
243
- }
244
- });
245
- }, []);
246
- }
247
-
248
220
  // src/components/RNAppContainer.tsx
249
- import { appsInTossEvent as appsInTossEvent2, setIosSwipeGestureEnabled } from "@apps-in-toss/native-modules";
250
- import { useEffect as useEffect9, useState as useState5 } from "react";
221
+ import { setIosSwipeGestureEnabled } from "@apps-in-toss/native-modules";
222
+ import { useEffect as useEffect8 } from "react";
251
223
  import { Platform as Platform3 } from "react-native";
252
224
 
253
225
  // src/components/GameInitializer.tsx
@@ -255,7 +227,7 @@ import { isMinVersionSupported } from "@apps-in-toss/native-modules";
255
227
  import { closeView as closeView2 } from "@granite-js/react-native";
256
228
  import { Loader } from "@toss/tds-react-native";
257
229
  import { josa } from "es-hangul";
258
- import { useEffect as useEffect5, useRef as useRef2 } from "react";
230
+ import { useEffect as useEffect4, useRef as useRef2 } from "react";
259
231
  import { Pressable, View } from "react-native";
260
232
 
261
233
  // src/constant/game-center.ts
@@ -506,13 +478,13 @@ var useGameProfileToast = () => {
506
478
  };
507
479
 
508
480
  // src/hooks/useGameCenterProfile.ts
509
- var useGameCenterProfile = (isReadyForProfileUI) => {
481
+ var useGameCenterProfile = () => {
510
482
  const [profileData, setProfileData] = useState3(void 0);
511
483
  const [isProfileDataLoading, setIsProfileDataLoading] = useState3(true);
512
484
  const [isProfileDataRefetching, setIsProfileDataRefetching] = useState3(false);
513
- const shouldShowProfileLoadingOverlay = isProfileDataLoading && isReadyForProfileUI || isProfileDataRefetching;
514
- const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
515
- const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
485
+ const shouldShowProfileLoadingOverlay = isProfileDataLoading || isProfileDataRefetching;
486
+ const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && !isProfileDataRefetching;
487
+ const canShowBottomSheetOrToast = !isProfileDataLoading;
516
488
  const { openGameProfileToast } = useGameProfileToast();
517
489
  const { open: openErrorAlert } = useErrorAlert();
518
490
  const { open: openTransparentWebView2 } = useTransparentWebview();
@@ -574,7 +546,7 @@ var Z_INDEX = {
574
546
 
575
547
  // src/components/GameInitializer.tsx
576
548
  import { Fragment as Fragment2, jsx as jsx4, jsxs } from "react/jsx-runtime";
577
- var GameInitializer = ({ children, isReadyForProfileUI }) => {
549
+ var GameInitializer = ({ children }) => {
578
550
  const {
579
551
  profileData,
580
552
  shouldShowProfileLoadingOverlay,
@@ -583,13 +555,13 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
583
555
  openProfileWebview,
584
556
  openGameProfileToast,
585
557
  fetchProfileData
586
- } = useGameCenterProfile(isReadyForProfileUI);
558
+ } = useGameCenterProfile();
587
559
  const isCompletedFlow = useRef2(false);
588
560
  const { open: openAppUpdateDialog } = useAppUpdateDialog();
589
- useEffect5(() => {
561
+ useEffect4(() => {
590
562
  fetchProfileData();
591
563
  }, []);
592
- useEffect5(() => {
564
+ useEffect4(() => {
593
565
  const handleGameProfileFlow = async () => {
594
566
  if (!canShowBottomSheetOrToast) {
595
567
  return;
@@ -695,10 +667,10 @@ var overlayStyle = {
695
667
  import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss/tds-react-native/private";
696
668
 
697
669
  // src/components/NavigationBar/RNNavigationBar/hooks/useHardwareBackPress.ts
698
- import { useEffect as useEffect6 } from "react";
670
+ import { useEffect as useEffect5 } from "react";
699
671
  import { BackHandler } from "react-native";
700
672
  function useHardwareBackPress(handler) {
701
- useEffect6(() => {
673
+ useEffect5(() => {
702
674
  const handleBackPress = () => {
703
675
  handler();
704
676
  return true;
@@ -859,7 +831,7 @@ import { INTERNAL__appBridgeHandler, isMinVersionSupported as isMinVersionSuppor
859
831
  import { openURL as openURL5 } from "@granite-js/react-native";
860
832
  import { BottomSheet, List, ListHeader } from "@toss/tds-react-native";
861
833
  import { useAdaptive as useAdaptive2, useOverlay as useOverlay2 } from "@toss/tds-react-native/private";
862
- import { useEffect as useEffect7, useState as useState4 } from "react";
834
+ import { useEffect as useEffect6, useState as useState4 } from "react";
863
835
 
864
836
  // src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
865
837
  import { getOperationalEnvironment } from "@apps-in-toss/native-modules";
@@ -1120,7 +1092,7 @@ function useMoreButtonBottomSheet() {
1120
1092
  const isBottomSheetSupported = isMinVersionSupported2(MIN_VERSION.BOTTOM_SHEET);
1121
1093
  const isShareListMenuSupported = isMinVersionSupported2(MIN_VERSION.SHARE_LIST_MENU);
1122
1094
  const [isPermissionsMenuSupported, setIsPermissionsMenuSupported] = useState4(false);
1123
- useEffect7(() => {
1095
+ useEffect6(() => {
1124
1096
  if (!isBottomSheetSupported) {
1125
1097
  return;
1126
1098
  }
@@ -1204,14 +1176,19 @@ function useMoreButtonBottomSheet() {
1204
1176
  }
1205
1177
  function BottomSheetImpressionArea({ children }) {
1206
1178
  const logging = useMoreButtonBottomSheetLogging();
1207
- useEffect7(() => {
1179
+ useEffect6(() => {
1208
1180
  logging.show();
1209
1181
  }, [logging]);
1210
1182
  return /* @__PURE__ */ jsx8(Fragment3, { children });
1211
1183
  }
1212
1184
 
1185
+ // src/core/utils/toIcon.ts
1186
+ function toIcon(source) {
1187
+ return source.startsWith("http") ? { source: { uri: source } } : { name: source };
1188
+ }
1189
+
1213
1190
  // src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
1214
- import { useEffect as useEffect8, useRef as useRef3 } from "react";
1191
+ import { useEffect as useEffect7, useRef as useRef3 } from "react";
1215
1192
  import { Fragment as Fragment4, jsx as jsx9 } from "react/jsx-runtime";
1216
1193
  function NavigationBarImpressionArea({
1217
1194
  children,
@@ -1219,7 +1196,7 @@ function NavigationBarImpressionArea({
1219
1196
  }) {
1220
1197
  const hasLogged = useRef3(false);
1221
1198
  const logging = useNavigationBarLogging();
1222
- useEffect8(() => {
1199
+ useEffect7(() => {
1223
1200
  if (hasLogged.current === false) {
1224
1201
  logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
1225
1202
  hasLogged.current = true;
@@ -1329,8 +1306,7 @@ function RNAppContainer({ children }) {
1329
1306
  }
1330
1307
  }
1331
1308
  function GameAppContainer({ children }) {
1332
- const [isEntryMessageExited, setIsEntryMessageExited] = useState5(false);
1333
- useEffect9(() => {
1309
+ useEffect8(() => {
1334
1310
  if (Platform3.OS === "ios") {
1335
1311
  setIosSwipeGestureEnabled({ isEnabled: false });
1336
1312
  return () => {
@@ -1339,16 +1315,9 @@ function GameAppContainer({ children }) {
1339
1315
  }
1340
1316
  return;
1341
1317
  }, []);
1342
- useEffect9(() => {
1343
- appsInTossEvent2.addEventListener("entryMessageExited", {
1344
- onEvent: () => {
1345
- setIsEntryMessageExited(true);
1346
- }
1347
- });
1348
- }, []);
1349
1318
  return /* @__PURE__ */ jsxs4(Fragment6, { children: [
1350
1319
  /* @__PURE__ */ jsx12(RNNavigationBar.Game, {}),
1351
- (0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx12(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children }) : children
1320
+ (0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx12(GameInitializer, { children }) : children
1352
1321
  ] });
1353
1322
  }
1354
1323
  function GeneralAppContainer({ children }) {
@@ -1375,13 +1344,9 @@ function AppsInTossContainer(Container, { children, ...initialProps }) {
1375
1344
  /* @__PURE__ */ jsx13(AppEvent.StayTime, {}),
1376
1345
  /* @__PURE__ */ jsx13(AppEvent.Entry, {}),
1377
1346
  /* @__PURE__ */ jsx13(AppEvent.System, { ...initialProps }),
1378
- /* @__PURE__ */ jsx13(Container, { ...initialProps, children: /* @__PURE__ */ jsx13(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx13(TDSContainer, { ...initialProps, children }) }) })
1347
+ /* @__PURE__ */ jsx13(Container, { ...initialProps, children: /* @__PURE__ */ jsx13(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children }) })
1379
1348
  ] });
1380
1349
  }
1381
- function TDSContainer({ children }) {
1382
- useAppsInTossBridge();
1383
- return /* @__PURE__ */ jsx13(Fragment7, { children });
1384
- }
1385
1350
  function registerApp(container, { context, analytics }) {
1386
1351
  const appName = getAppName();
1387
1352
  const isRegistered = AppRegistry.getAppKeys().includes(appName);
@@ -1426,30 +1391,32 @@ var AppsInToss = {
1426
1391
  // src/components/WebView.tsx
1427
1392
  import {
1428
1393
  AppsInTossModule,
1429
- GoogleAdMob as GoogleAdMob2,
1394
+ GoogleAdMob,
1430
1395
  IAP,
1431
1396
  Storage,
1432
- appsInTossEvent as appsInTossEvent4,
1397
+ appsInTossEvent,
1433
1398
  iapCreateOneTimePurchaseOrder,
1434
1399
  processProductGrant,
1435
- requestOneTimePurchase
1400
+ requestOneTimePurchase,
1401
+ INTERNAL__module as INTERNAL__module6,
1402
+ getOperationalEnvironment as getOperationalEnvironment5
1436
1403
  } from "@apps-in-toss/native-modules";
1437
1404
  import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
1438
1405
  import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
1439
1406
  import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
1440
1407
  import { useSafeAreaInsets as useSafeAreaInsets4 } from "@granite-js/native/react-native-safe-area-context";
1441
- import { getSchemeUri as getSchemeUri8 } from "@granite-js/react-native";
1408
+ import { getSchemeUri as getSchemeUri6, Granite as Granite8 } from "@granite-js/react-native";
1442
1409
  import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
1443
1410
  import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3 } from "@toss/tds-react-native/private";
1444
- import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef6, useState as useState8 } from "react";
1411
+ import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef6, useState as useState6 } from "react";
1445
1412
  import { BackHandler as BackHandler2, Linking, Platform as Platform6 } from "react-native";
1446
1413
 
1447
1414
  // src/components/GameWebView.tsx
1448
- import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment as getOperationalEnvironment4 } from "@apps-in-toss/native-modules";
1415
+ import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, getOperationalEnvironment as getOperationalEnvironment4 } from "@apps-in-toss/native-modules";
1449
1416
  import {
1450
1417
  WebView as PlainWebView
1451
1418
  } from "@granite-js/native/react-native-webview";
1452
- import { forwardRef, useEffect as useEffect10, useState as useState6 } from "react";
1419
+ import { forwardRef, useEffect as useEffect9 } from "react";
1453
1420
  import { Platform as Platform5 } from "react-native";
1454
1421
 
1455
1422
  // src/components/NavigationBar/GameWebviewNavigationBar.tsx
@@ -1522,8 +1489,7 @@ function GameWebviewNavigationBar() {
1522
1489
  // src/components/GameWebView.tsx
1523
1490
  import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1524
1491
  var GameWebView = forwardRef(function GameWebView2(props, ref) {
1525
- const [isEntryMessageExited, setIsEntryMessageExited] = useState6(false);
1526
- useEffect10(() => {
1492
+ useEffect9(() => {
1527
1493
  if (Platform5.OS === "ios") {
1528
1494
  setIosSwipeGestureEnabled3({ isEnabled: false });
1529
1495
  return () => {
@@ -1532,16 +1498,9 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1532
1498
  }
1533
1499
  return;
1534
1500
  }, []);
1535
- useEffect10(() => {
1536
- appsInTossEvent3.addEventListener("entryMessageExited", {
1537
- onEvent: () => {
1538
- setIsEntryMessageExited(true);
1539
- }
1540
- });
1541
- }, []);
1542
1501
  return /* @__PURE__ */ jsxs7(Fragment9, { children: [
1543
1502
  /* @__PURE__ */ jsx15(GameWebviewNavigationBar, {}),
1544
- getOperationalEnvironment4() === "toss" ? /* @__PURE__ */ jsx15(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props })
1503
+ getOperationalEnvironment4() === "toss" ? /* @__PURE__ */ jsx15(GameInitializer, { children: /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props })
1545
1504
  ] });
1546
1505
  });
1547
1506
 
@@ -1622,357 +1581,8 @@ function convertIntentURL(url) {
1622
1581
  return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
1623
1582
  }
1624
1583
 
1625
- // src/ads/fetchTossAd.ts
1626
- import { getOperationalEnvironment as getOperationalEnvironment5, INTERNAL__appBridgeHandler as INTERNAL__appBridgeHandler2, isMinVersionSupported as isMinVersionSupported4 } from "@apps-in-toss/native-modules";
1627
-
1628
- // ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
1629
- function noop() {
1630
- }
1631
-
1632
- // src/ads/generateSessionId.ts
1633
- function generateSessionId() {
1634
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
1635
- const r = Math.random() * 16 | 0;
1636
- const v = c === "x" ? r : r & 3 | 8;
1637
- return v.toString(16);
1638
- });
1639
- }
1640
-
1641
- // src/ads/constants.ts
1642
- var sessionId = generateSessionId();
1643
-
1644
- // src/ads/fetchTossAd.ts
1645
- var ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.239.0";
1646
- var IOS_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.239.0";
1647
- var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
1648
- var ENVIRONMENT = getOperationalEnvironment5();
1649
- function fetchTossAd(params) {
1650
- if (!fetchTossAd.isSupported()) {
1651
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
1652
- return noop;
1653
- }
1654
- const { onEvent, onError, options } = params;
1655
- const { adGroupId } = options;
1656
- const unregisterCallbacks = INTERNAL__appBridgeHandler2.invokeAppBridgeMethod(
1657
- "fetchTossAd",
1658
- { spaceUnitId: adGroupId, sessionId },
1659
- {
1660
- onSuccess: (response) => {
1661
- onEvent(response);
1662
- },
1663
- onError: (error) => {
1664
- onError(error);
1665
- }
1666
- }
1667
- );
1668
- return unregisterCallbacks;
1669
- }
1670
- fetchTossAd.isSupported = () => {
1671
- if (ENVIRONMENT !== "toss") {
1672
- return false;
1673
- }
1674
- return isMinVersionSupported4({
1675
- android: ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION,
1676
- ios: IOS_FETCH_TOSS_AD_SUPPORTED_VERSION
1677
- });
1678
- };
1679
-
1680
- // src/ads/integratedAd.ts
1681
- import { GoogleAdMob, INTERNAL__appBridgeHandler as INTERNAL__appBridgeHandler3, isMinVersionSupported as isMinVersionSupported5 } from "@apps-in-toss/native-modules";
1682
-
1683
- // src/ads/generateRequestId.ts
1684
- function generateRequestId() {
1685
- const timestamp = Date.now().toString(36).toUpperCase();
1686
- const random = Math.random().toString(36).substring(2, 7).toUpperCase();
1687
- return `ait-${timestamp}${random}`;
1688
- }
1689
-
1690
- // src/ads/getReferrer.ts
1691
- import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
1692
- function getReferrer() {
1693
- try {
1694
- return new URL(getSchemeUri5()).searchParams.get("referrer");
1695
- } catch {
1696
- return null;
1697
- }
1698
- }
1699
-
1700
- // src/ads/remotes.ts
1701
- import { getOperationalEnvironment as getOperationalEnvironment6, getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
1702
-
1703
- // src/ads/getIsDev.ts
1704
- import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
1705
- function getIsDev() {
1706
- try {
1707
- return new URL(getSchemeUri6()).searchParams.get("isDev") === "true";
1708
- } catch {
1709
- return false;
1710
- }
1711
- }
1712
-
1713
- // src/ads/remotes.ts
1714
- var OPERATIONAL_ENVIRONMENT = getOperationalEnvironment6();
1715
- var OS = getPlatformOS();
1716
- var APP_VER = getTossAppVersion();
1717
- var ALPHA_EVENT_TRACKER_HTTP_ENDPOINT = "https://alpha-trillion.toss.im/trk/sdk-mediation/event";
1718
- var LIVE_EVENT_TRACKER_HTTP_ENDPOINT = "https://trillion.toss.im/trk/sdk-mediation/event";
1719
- function getPostEventTrackingUrl() {
1720
- const isDev = getIsDev();
1721
- if (OPERATIONAL_ENVIRONMENT === "sandbox" || isDev) {
1722
- return ALPHA_EVENT_TRACKER_HTTP_ENDPOINT;
1723
- }
1724
- return LIVE_EVENT_TRACKER_HTTP_ENDPOINT;
1725
- }
1726
- function postEventTracking(params) {
1727
- const endpoint = getPostEventTrackingUrl();
1728
- const bodyJSON = JSON.stringify({
1729
- ...params,
1730
- os: OS,
1731
- appVer: APP_VER,
1732
- deviceIdType: "NONE",
1733
- platform: "RN"
1734
- });
1735
- return fetch(
1736
- endpoint,
1737
- {
1738
- method: "POST",
1739
- headers: {
1740
- "Content-Type": "application/json"
1741
- },
1742
- body: bodyJSON
1743
- }
1744
- ).catch(noop);
1745
- }
1746
-
1747
- // src/ads/integratedAd.ts
1748
- var INTEGRATED_AD_SDK_VERSION = "0.0.0";
1749
- var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.239.0";
1750
- var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.239.0";
1751
- var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
1752
- var INTG_AD_ADM_FALLBACK_RID_MAP = {};
1753
- function integratedAdIsSupported() {
1754
- return isMinVersionSupported5({
1755
- android: ANDROID_INTEGRATED_AD_SUPPORTED_VERSION,
1756
- ios: IOS_INTEGRATED_AD_SUPPORTED_VERSION
1757
- });
1758
- }
1759
- function loadFullScreenAd(params) {
1760
- if (!GoogleAdMob.loadAppsInTossAdMob.isSupported()) {
1761
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1762
- return noop;
1763
- }
1764
- if (!integratedAdIsSupported()) {
1765
- return GoogleAdMob.loadAppsInTossAdMob({
1766
- ...params,
1767
- onEvent: (event) => {
1768
- if (event.type === "loaded") {
1769
- const requestId = generateRequestId();
1770
- INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] = requestId;
1771
- postEventTracking({
1772
- eventName: "LOAD",
1773
- spaceUnitId: params.options.adGroupId,
1774
- requestId,
1775
- responseId: event.data.responseInfo.responseId,
1776
- mediationType: "ADMOB",
1777
- format: "",
1778
- adSourceName: event.data.responseInfo.loadedAdNetworkInfo?.adSourceName ?? "",
1779
- sdkVer: INTEGRATED_AD_SDK_VERSION
1780
- });
1781
- }
1782
- return params.onEvent(event);
1783
- },
1784
- onError: (error) => {
1785
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1786
- postEventTracking({
1787
- eventName: "FAILED_TO_LOAD",
1788
- spaceUnitId: params.options.adGroupId,
1789
- requestId,
1790
- responseId: "",
1791
- mediationType: "ADMOB",
1792
- format: "",
1793
- adSourceName: "",
1794
- sdkVer: INTEGRATED_AD_SDK_VERSION
1795
- });
1796
- return params.onError(error);
1797
- }
1798
- });
1799
- }
1800
- const { onEvent, onError, options } = params;
1801
- const { adGroupId } = options;
1802
- const referrer = getReferrer();
1803
- const unregisterCallbacks = INTERNAL__appBridgeHandler3.invokeAppBridgeMethod(
1804
- "loadTossAdOrAdmob",
1805
- { spaceUnitId: adGroupId, referrer, sessionId },
1806
- {
1807
- onSuccess: () => {
1808
- onEvent({ type: "loaded" });
1809
- },
1810
- onError: (error) => {
1811
- onError(error);
1812
- }
1813
- }
1814
- );
1815
- return unregisterCallbacks;
1816
- }
1817
- loadFullScreenAd.isSupported = GoogleAdMob.loadAppsInTossAdMob.isSupported;
1818
- function showFullScreenAd(params) {
1819
- if (!GoogleAdMob.showAppsInTossAdMob.isSupported()) {
1820
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1821
- return noop;
1822
- }
1823
- if (!integratedAdIsSupported()) {
1824
- return GoogleAdMob.showAppsInTossAdMob({
1825
- ...params,
1826
- onEvent: (event) => {
1827
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1828
- switch (event.type) {
1829
- case "show":
1830
- postEventTracking({
1831
- eventName: "SHOW",
1832
- spaceUnitId: params.options.adGroupId,
1833
- requestId,
1834
- responseId: "",
1835
- mediationType: "ADMOB",
1836
- format: "",
1837
- adSourceName: "",
1838
- sdkVer: INTEGRATED_AD_SDK_VERSION
1839
- });
1840
- break;
1841
- case "failedToShow":
1842
- postEventTracking({
1843
- eventName: "FAILED_TO_SHOW",
1844
- spaceUnitId: params.options.adGroupId,
1845
- requestId,
1846
- responseId: "",
1847
- mediationType: "ADMOB",
1848
- format: "",
1849
- adSourceName: "",
1850
- sdkVer: INTEGRATED_AD_SDK_VERSION
1851
- });
1852
- break;
1853
- case "impression":
1854
- postEventTracking({
1855
- eventName: "IMP",
1856
- spaceUnitId: params.options.adGroupId,
1857
- requestId,
1858
- responseId: "",
1859
- mediationType: "ADMOB",
1860
- format: "",
1861
- adSourceName: "",
1862
- sdkVer: INTEGRATED_AD_SDK_VERSION
1863
- });
1864
- break;
1865
- case "clicked":
1866
- postEventTracking({
1867
- eventName: "CLICK",
1868
- spaceUnitId: params.options.adGroupId,
1869
- requestId,
1870
- responseId: "",
1871
- mediationType: "ADMOB",
1872
- format: "",
1873
- adSourceName: "",
1874
- sdkVer: INTEGRATED_AD_SDK_VERSION
1875
- });
1876
- break;
1877
- case "dismissed":
1878
- postEventTracking({
1879
- eventName: "DISMISS",
1880
- spaceUnitId: params.options.adGroupId,
1881
- requestId,
1882
- responseId: "",
1883
- mediationType: "ADMOB",
1884
- format: "",
1885
- adSourceName: "",
1886
- sdkVer: INTEGRATED_AD_SDK_VERSION
1887
- });
1888
- break;
1889
- case "userEarnedReward":
1890
- postEventTracking({
1891
- eventName: "USER_EARNED_REWARD",
1892
- spaceUnitId: params.options.adGroupId,
1893
- requestId,
1894
- responseId: "",
1895
- mediationType: "ADMOB",
1896
- format: "",
1897
- adSourceName: "",
1898
- sdkVer: INTEGRATED_AD_SDK_VERSION
1899
- });
1900
- break;
1901
- }
1902
- return params.onEvent(event);
1903
- },
1904
- onError: (error) => {
1905
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1906
- postEventTracking({
1907
- eventName: "FAILED_TO_SHOW",
1908
- spaceUnitId: params.options.adGroupId,
1909
- requestId,
1910
- responseId: "",
1911
- mediationType: "ADMOB",
1912
- format: "",
1913
- adSourceName: "",
1914
- sdkVer: INTEGRATED_AD_SDK_VERSION
1915
- });
1916
- return params.onError(error);
1917
- }
1918
- });
1919
- }
1920
- const { onEvent, onError, options } = params;
1921
- const { adGroupId } = options;
1922
- const referrer = getReferrer();
1923
- const unregisterCallbacks = INTERNAL__appBridgeHandler3.invokeAppBridgeMethod(
1924
- "showTossAdOrAdmob",
1925
- { spaceUnitId: adGroupId, referrer, sessionId },
1926
- {
1927
- onAdClicked: () => {
1928
- onEvent({ type: "clicked" });
1929
- },
1930
- onAdDismissed: () => {
1931
- onEvent({ type: "dismissed" });
1932
- },
1933
- onAdFailedToShow: () => {
1934
- onEvent({ type: "failedToShow" });
1935
- },
1936
- onAdImpression: () => {
1937
- onEvent({ type: "impression" });
1938
- },
1939
- onAdShow: () => {
1940
- onEvent({ type: "show" });
1941
- },
1942
- onUserEarnedReward: (data) => {
1943
- onEvent({ type: "userEarnedReward", data });
1944
- },
1945
- onSuccess: () => {
1946
- onEvent({ type: "requested" });
1947
- },
1948
- onError: (error) => {
1949
- onError(error);
1950
- }
1951
- }
1952
- );
1953
- return unregisterCallbacks;
1954
- }
1955
- showFullScreenAd.isSupported = GoogleAdMob.showAppsInTossAdMob.isSupported;
1956
-
1957
- // src/ads/tossAdEventLog.ts
1958
- import { INTERNAL__module as INTERNAL__module6 } from "@apps-in-toss/native-modules";
1959
- import { Granite as Granite8 } from "@granite-js/react-native";
1960
- async function tossAdEventLog(params) {
1961
- const referrer = getReferrer();
1962
- const appName = Granite8.appName;
1963
- const eventLogParams = {
1964
- ...params,
1965
- params: {
1966
- ...params.params,
1967
- referrer,
1968
- app_name: appName
1969
- }
1970
- };
1971
- return INTERNAL__module6.tossCoreEventLog(eventLogParams);
1972
- }
1973
-
1974
1584
  // src/bridge-handler/useBridgeHandler.tsx
1975
- import { useCallback as useCallback10, useEffect as useEffect11, useMemo as useMemo3, useRef as useRef4 } from "react";
1585
+ import { useCallback as useCallback10, useEffect as useEffect10, useMemo as useMemo3, useRef as useRef4 } from "react";
1976
1586
  function serializeError(error) {
1977
1587
  return JSON.stringify(error, (_, value) => {
1978
1588
  if (value instanceof Error) {
@@ -2037,7 +1647,7 @@ function useBridgeHandler({
2037
1647
  )};`,
2038
1648
  [constantHandlerMap]
2039
1649
  );
2040
- useEffect11(() => {
1650
+ useEffect10(() => {
2041
1651
  ref.current?.injectJavaScript(injectedJavaScript);
2042
1652
  }, [injectedJavaScript]);
2043
1653
  const createHandleOnEvent = (functionName, eventId) => (response) => {
@@ -2111,7 +1721,7 @@ function parseNativeEventData(data) {
2111
1721
 
2112
1722
  // src/core/hooks/useSafeAreaInsetsEmitter.tsx
2113
1723
  import { useSafeAreaInsets as useSafeAreaInsets3 } from "@granite-js/native/react-native-safe-area-context";
2114
- import { useEffect as useEffect12, useMemo as useMemo4 } from "react";
1724
+ import { useEffect as useEffect11, useMemo as useMemo4 } from "react";
2115
1725
  var EventEmitter = class {
2116
1726
  listeners = {};
2117
1727
  on(event, listener) {
@@ -2136,7 +1746,7 @@ var EventEmitter = class {
2136
1746
  function useSafeAreaInsetsEmitter() {
2137
1747
  const insets = useSafeAreaInsets3();
2138
1748
  const emitter = useMemo4(() => new EventEmitter(), []);
2139
- useEffect12(() => {
1749
+ useEffect11(() => {
2140
1750
  emitter.emit("safeAreaInsetsChange", insets);
2141
1751
  return () => {
2142
1752
  emitter.off("safeAreaInsetsChange", (listener) => listener(insets));
@@ -2295,7 +1905,7 @@ function mergeRefs(...refs) {
2295
1905
  }
2296
1906
 
2297
1907
  // src/hooks/useCreateUserAgent.ts
2298
- import { getPlatformOS as getPlatformOS2, getTossAppVersion as getTossAppVersion2 } from "@apps-in-toss/native-modules";
1908
+ import { getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
2299
1909
  import { useWindowDimensions } from "react-native";
2300
1910
  var FontA11yCategory = {
2301
1911
  Large: "Large",
@@ -2429,8 +2039,8 @@ function useCreateUserAgent({
2429
2039
  safeArea,
2430
2040
  safeAreaBottomTransparency
2431
2041
  }) {
2432
- const platform = getPlatformOS2();
2433
- const appVersion = getTossAppVersion2();
2042
+ const platform = getPlatformOS();
2043
+ const appVersion = getTossAppVersion();
2434
2044
  const { fontScale } = useWindowDimensions();
2435
2045
  const platformString = platform === "ios" ? "iPhone" : "Android phone";
2436
2046
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
@@ -2454,11 +2064,11 @@ function useCreateUserAgent({
2454
2064
  // src/hooks/useGeolocation.ts
2455
2065
  import { startUpdateLocation } from "@apps-in-toss/native-modules";
2456
2066
  import { useVisibility as useVisibility3 } from "@granite-js/react-native";
2457
- import { useEffect as useEffect13, useState as useState7 } from "react";
2067
+ import { useEffect as useEffect12, useState as useState5 } from "react";
2458
2068
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
2459
2069
  const isVisible = useVisibility3();
2460
- const [location, setLocation] = useState7(null);
2461
- useEffect13(() => {
2070
+ const [location, setLocation] = useState5(null);
2071
+ useEffect12(() => {
2462
2072
  if (!isVisible) {
2463
2073
  return;
2464
2074
  }
@@ -2516,7 +2126,7 @@ function useTopNavigation() {
2516
2126
 
2517
2127
  // src/utils/log.ts
2518
2128
  import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
2519
- import { getSchemeUri as getSchemeUri7 } from "@granite-js/react-native";
2129
+ import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
2520
2130
 
2521
2131
  // src/utils/extractDateFromUUIDv7.ts
2522
2132
  var extractDateFromUUIDv7 = (uuid) => {
@@ -2540,9 +2150,9 @@ var getGroupId = (url) => {
2540
2150
  };
2541
2151
  }
2542
2152
  };
2543
- var getReferrer2 = () => {
2153
+ var getReferrer = () => {
2544
2154
  try {
2545
- const referrer = new URL(getSchemeUri7());
2155
+ const referrer = new URL(getSchemeUri5());
2546
2156
  return referrer.searchParams.get("referrer");
2547
2157
  } catch {
2548
2158
  return "";
@@ -2555,7 +2165,7 @@ var trackScreen = (url) => {
2555
2165
  log_name: `${groupId}::screen`,
2556
2166
  params: {
2557
2167
  search,
2558
- referrer: getReferrer2(),
2168
+ referrer: getReferrer(),
2559
2169
  deployment_id: env.getDeploymentId(),
2560
2170
  deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
2561
2171
  }
@@ -2574,7 +2184,7 @@ var WEBVIEW_TYPES = {
2574
2184
  };
2575
2185
  function mergeSchemeQueryParamsInto(url) {
2576
2186
  const baseUrl = new URL(url);
2577
- const schemeUrl = new URL(getSchemeUri8());
2187
+ const schemeUrl = new URL(getSchemeUri6());
2578
2188
  baseUrl.pathname = schemeUrl.pathname;
2579
2189
  for (const [key, value] of schemeUrl.searchParams.entries()) {
2580
2190
  baseUrl.searchParams.set(key, value);
@@ -2607,7 +2217,7 @@ function WebView({ type, local, onMessage, ...props }) {
2607
2217
  const global2 = getAppsInTossGlobals();
2608
2218
  const navigationBarContext = useNavigationBarContext();
2609
2219
  const safeAreaInsetsEmitter = useSafeAreaInsetsEmitter();
2610
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState8(
2220
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState6(
2611
2221
  props.allowsBackForwardNavigationGestures
2612
2222
  );
2613
2223
  const handler = useBridgeHandler({
@@ -2621,8 +2231,7 @@ function WebView({ type, local, onMessage, ...props }) {
2621
2231
  webBackHandler.removeEventListener(onEvent);
2622
2232
  };
2623
2233
  },
2624
- entryMessageExited: ({ onEvent, onError }) => appsInTossEvent4.addEventListener("entryMessageExited", { onEvent, onError }),
2625
- updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2234
+ updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2626
2235
  safeAreaInsetsChange: ({ onEvent }) => {
2627
2236
  safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
2628
2237
  return () => {
@@ -2630,20 +2239,15 @@ function WebView({ type, local, onMessage, ...props }) {
2630
2239
  };
2631
2240
  },
2632
2241
  /** @internal */
2633
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2242
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2634
2243
  /** AdMob */
2635
- loadAdMobInterstitialAd: GoogleAdMob2.loadAdMobInterstitialAd,
2636
- showAdMobInterstitialAd: GoogleAdMob2.showAdMobInterstitialAd,
2637
- loadAdMobRewardedAd: GoogleAdMob2.loadAdMobRewardedAd,
2638
- showAdMobRewardedAd: GoogleAdMob2.showAdMobRewardedAd,
2244
+ loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
2245
+ showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
2246
+ loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
2247
+ showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd,
2639
2248
  /** AdMobV2 */
2640
- loadAppsInTossAdMob: GoogleAdMob2.loadAppsInTossAdMob,
2641
- showAppsInTossAdMob: GoogleAdMob2.showAppsInTossAdMob,
2642
- /** IntegratedAd */
2643
- loadFullScreenAd,
2644
- showFullScreenAd,
2645
- /** TossAd */
2646
- fetchTossAd,
2249
+ loadAppsInTossAdMob: GoogleAdMob.loadAppsInTossAdMob,
2250
+ showAppsInTossAdMob: GoogleAdMob.showAppsInTossAdMob,
2647
2251
  /** IAP */
2648
2252
  iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
2649
2253
  requestOneTimePurchase
@@ -2656,18 +2260,13 @@ function WebView({ type, local, onMessage, ...props }) {
2656
2260
  getSafeAreaRight: () => insets.right,
2657
2261
  ...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
2658
2262
  /** AdMob */
2659
- loadAdMobInterstitialAd_isSupported: GoogleAdMob2.loadAdMobInterstitialAd.isSupported,
2660
- showAdMobInterstitialAd_isSupported: GoogleAdMob2.showAdMobInterstitialAd.isSupported,
2661
- loadAdMobRewardedAd_isSupported: GoogleAdMob2.loadAdMobRewardedAd.isSupported,
2662
- showAdMobRewardedAd_isSupported: GoogleAdMob2.showAdMobRewardedAd.isSupported,
2263
+ loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
2264
+ showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
2265
+ loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
2266
+ showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
2663
2267
  /** AdMobV2 */
2664
- loadAppsInTossAdMob_isSupported: GoogleAdMob2.loadAppsInTossAdMob.isSupported,
2665
- showAppsInTossAdMob_isSupported: GoogleAdMob2.showAppsInTossAdMob.isSupported,
2666
- /** IntegratedAd */
2667
- loadFullScreenAd_isSupported: loadFullScreenAd.isSupported,
2668
- showFullScreenAd_isSupported: showFullScreenAd.isSupported,
2669
- /** TossAd */
2670
- fetchTossAd_isSupported: fetchTossAd.isSupported,
2268
+ loadAppsInTossAdMob_isSupported: GoogleAdMob.loadAppsInTossAdMob.isSupported,
2269
+ showAppsInTossAdMob_isSupported: GoogleAdMob.showAppsInTossAdMob.isSupported,
2671
2270
  /** env */
2672
2271
  getDeploymentId: env.getDeploymentId
2673
2272
  },
@@ -2701,8 +2300,8 @@ function WebView({ type, local, onMessage, ...props }) {
2701
2300
  getPendingOrders: IAP.getPendingOrders,
2702
2301
  getCompletedOrRefundedOrders: IAP.getCompletedOrRefundedOrders,
2703
2302
  completeProductGrant: IAP.completeProductGrant,
2704
- /** Toss Ads */
2705
- tossAdEventLog
2303
+ /* Private */
2304
+ memoryDebugEventLog: webViewMemoryDebugLog
2706
2305
  }
2707
2306
  });
2708
2307
  const headerPropForExternalWebView = useMemo7(() => {
@@ -2726,7 +2325,7 @@ function WebView({ type, local, onMessage, ...props }) {
2726
2325
  colorPreference: "light"
2727
2326
  });
2728
2327
  const refs = mergeRefs(handler.ref, webViewRef);
2729
- useEffect14(() => {
2328
+ useEffect13(() => {
2730
2329
  const callback = () => {
2731
2330
  webBackHandler.handleWebBack();
2732
2331
  return true;
@@ -2780,10 +2379,49 @@ function WebView({ type, local, onMessage, ...props }) {
2780
2379
  return false;
2781
2380
  }
2782
2381
  },
2783
- originWhitelist: ["https://*", "http://*", "intoss://*", "intoss-private://*", "servicetoss://*", "supertoss://*", "intent://*"]
2382
+ originWhitelist: [
2383
+ "https://*",
2384
+ "http://*",
2385
+ "intoss://*",
2386
+ "intoss-private://*",
2387
+ "servicetoss://*",
2388
+ "supertoss://*",
2389
+ "intent://*"
2390
+ ],
2391
+ onContentProcessDidTerminate: (event) => {
2392
+ webViewProcessDidTerminateEventLog(event.nativeEvent.url);
2393
+ webViewRef.current?.reload();
2394
+ },
2395
+ onRenderProcessGone: () => {
2396
+ webViewProcessDidTerminateEventLog();
2397
+ webViewRef.current?.reload();
2398
+ }
2784
2399
  }
2785
2400
  );
2786
2401
  }
2402
+ async function webViewMemoryDebugLog(params) {
2403
+ webViewDebugLog("AppsInTossWebViewMemoryDebug", params);
2404
+ }
2405
+ function webViewProcessDidTerminateEventLog(url) {
2406
+ webViewDebugLog("AppsInTossWebViewProcessDidTerminate", { url });
2407
+ }
2408
+ function webViewDebugLog(logName, params) {
2409
+ const global2 = getAppsInTossGlobals();
2410
+ const event = {
2411
+ log_name: logName,
2412
+ log_type: "debug",
2413
+ params: {
2414
+ ...params,
2415
+ app_name: Granite8.appName,
2416
+ deployment_id: global2.deploymentId
2417
+ }
2418
+ };
2419
+ if (getOperationalEnvironment5() === "toss") {
2420
+ INTERNAL__module6.tossCoreEventLog(event);
2421
+ } else {
2422
+ console.log("[webViewDebugLog]", event);
2423
+ }
2424
+ }
2787
2425
  function useGlobalScripts() {
2788
2426
  const global2 = getAppsInTossGlobals();
2789
2427
  const disableTextSelectionCSS = `
@@ -2864,8 +2502,6 @@ export {
2864
2502
  OverlayProvider,
2865
2503
  WebView,
2866
2504
  env,
2867
- loadFullScreenAd,
2868
- showFullScreenAd,
2869
2505
  useCreateUserAgent,
2870
2506
  useGeolocation,
2871
2507
  useOverlay3 as useOverlay,