@apps-in-toss/framework 1.5.3 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -37,6 +37,8 @@ __export(src_exports, {
37
37
  OverlayProvider: () => import_private10.OverlayProvider,
38
38
  WebView: () => WebView,
39
39
  env: () => env,
40
+ loadFullScreenAd: () => loadFullScreenAd,
41
+ showFullScreenAd: () => showFullScreenAd,
40
42
  useCreateUserAgent: () => useCreateUserAgent,
41
43
  useGeolocation: () => useGeolocation,
42
44
  useOverlay: () => import_private10.useOverlay,
@@ -722,15 +724,18 @@ var import_react13 = require("react");
722
724
  function useCloseConfirm() {
723
725
  const { brandDisplayName } = getAppsInTossGlobals();
724
726
  const { openConfirm } = (0, import_tds_react_native5.useDialog)();
725
- return (0, import_react13.useCallback)(async ({ onEntered }) => {
726
- return await openConfirm({
727
- title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
728
- leftButton: "\uCDE8\uC18C",
729
- rightButton: "\uC885\uB8CC\uD558\uAE30",
730
- closeOnDimmerClick: true,
731
- onEntered
732
- });
733
- }, [brandDisplayName, openConfirm]);
727
+ return (0, import_react13.useCallback)(
728
+ async ({ onEntered }) => {
729
+ return await openConfirm({
730
+ title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
731
+ leftButton: "\uCDE8\uC18C",
732
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
733
+ closeOnDimmerClick: true,
734
+ onEntered
735
+ });
736
+ },
737
+ [brandDisplayName, openConfirm]
738
+ );
734
739
  }
735
740
 
736
741
  // src/components/NavigationBar/common/useNavigationBarLogging.tsx
@@ -969,30 +974,10 @@ function Menu({ title, iconURL, onPress }) {
969
974
  marginRight: 16,
970
975
  backgroundColor: iconBackgroundColor
971
976
  },
972
- children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
973
- import_tds_react_native6.Asset.Icon,
974
- {
975
- frameShape: { width: 20, height: 20 },
976
- color: globals.brandPrimaryColor,
977
- name: iconName
978
- }
979
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
980
- import_tds_react_native6.Asset.Image,
981
- {
982
- frameShape: { width: 20, height: 20 },
983
- source: { uri: iconURL }
984
- }
985
- )
986
- }
987
- ),
988
- contents: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
989
- import_tds_react_native6.ListRow.Texts,
990
- {
991
- type: "1RowTypeA",
992
- top: title,
993
- topProps: { color: adaptive.grey700 }
977
+ children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_tds_react_native6.Asset.Icon, { frameShape: { width: 20, height: 20 }, color: globals.brandPrimaryColor, name: iconName }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_tds_react_native6.Asset.Image, { frameShape: { width: 20, height: 20 }, source: { uri: iconURL } })
994
978
  }
995
979
  ),
980
+ contents: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_tds_react_native6.ListRow.Texts, { type: "1RowTypeA", top: title, topProps: { color: adaptive.grey700 } }),
996
981
  verticalPadding: "extraSmall",
997
982
  onPress: () => {
998
983
  logging.menuClick({ title });
@@ -1082,7 +1067,9 @@ function PermissionsMenu() {
1082
1067
  {
1083
1068
  title: "\uAD8C\uD55C \uC124\uC815",
1084
1069
  iconURL: "https://static.toss.im/icons/png/4x/icon-setting-mono.png",
1085
- onPress: () => (0, import_react_native19.openURL)(`servicetoss://apps-in-toss-menu/permissions?appName=${import_react_native19.Granite.appName}&displayAppName=${globals.brandDisplayName}`)
1070
+ onPress: () => (0, import_react_native19.openURL)(
1071
+ `servicetoss://apps-in-toss-menu/permissions?appName=${import_react_native19.Granite.appName}&displayAppName=${globals.brandDisplayName}`
1072
+ )
1086
1073
  }
1087
1074
  );
1088
1075
  }
@@ -1185,17 +1172,15 @@ function useMoreButtonBottomSheet() {
1185
1172
  onClose: handleClose,
1186
1173
  onExited: exit,
1187
1174
  children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_tds_react_native8.List, { rowSeparator: "none", children: [
1188
- itemList.map(
1189
- (item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1190
- Menu,
1191
- {
1192
- title: item.contactItemName,
1193
- iconURL: item.contactIconUrl,
1194
- onPress: () => (0, import_react_native20.openURL)(item.contactUri)
1195
- },
1196
- item.contactItemName
1197
- )
1198
- ),
1175
+ itemList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1176
+ Menu,
1177
+ {
1178
+ title: item.contactItemName,
1179
+ iconURL: item.contactIconUrl,
1180
+ onPress: () => (0, import_react_native20.openURL)(item.contactUri)
1181
+ },
1182
+ item.contactItemName
1183
+ )),
1199
1184
  isShareListMenuSupported && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AppShareListMenu, {}),
1200
1185
  isPermissionsMenuSupported && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PermissionsMenu, {})
1201
1186
  ] })
@@ -1417,16 +1402,16 @@ var AppsInToss = {
1417
1402
  };
1418
1403
 
1419
1404
  // src/components/WebView.tsx
1420
- var import_native_modules18 = require("@apps-in-toss/native-modules");
1405
+ var import_native_modules23 = require("@apps-in-toss/native-modules");
1421
1406
  var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
1422
1407
  var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
1423
1408
  var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
1424
1409
  var import_react_native_safe_area_context4 = require("@granite-js/native/react-native-safe-area-context");
1425
- var import_react_native34 = require("@granite-js/react-native");
1426
- var import_tds_react_native14 = require("@toss/tds-react-native");
1410
+ var import_react_native38 = require("@granite-js/react-native");
1411
+ var import_tds_react_native15 = require("@toss/tds-react-native");
1427
1412
  var import_private9 = require("@toss/tds-react-native/private");
1428
1413
  var import_react28 = require("react");
1429
- var import_react_native35 = require("react-native");
1414
+ var import_react_native39 = require("react-native");
1430
1415
 
1431
1416
  // src/components/GameWebView.tsx
1432
1417
  var import_native_modules14 = require("@apps-in-toss/native-modules");
@@ -1594,6 +1579,357 @@ function convertIntentURL(url) {
1594
1579
  return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
1595
1580
  }
1596
1581
 
1582
+ // src/ads/fetchTossAd.ts
1583
+ var import_native_modules15 = require("@apps-in-toss/native-modules");
1584
+
1585
+ // ../../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
1586
+ function noop() {
1587
+ }
1588
+
1589
+ // src/ads/generateSessionId.ts
1590
+ function generateSessionId() {
1591
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
1592
+ const r = Math.random() * 16 | 0;
1593
+ const v = c === "x" ? r : r & 3 | 8;
1594
+ return v.toString(16);
1595
+ });
1596
+ }
1597
+
1598
+ // src/ads/constants.ts
1599
+ var sessionId = generateSessionId();
1600
+
1601
+ // src/ads/fetchTossAd.ts
1602
+ var ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
1603
+ var IOS_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
1604
+ var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
1605
+ var ENVIRONMENT = (0, import_native_modules15.getOperationalEnvironment)();
1606
+ function fetchTossAd(params) {
1607
+ if (!fetchTossAd.isSupported()) {
1608
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
1609
+ return noop;
1610
+ }
1611
+ const { onEvent, onError, options } = params;
1612
+ const { adGroupId } = options;
1613
+ const unregisterCallbacks = import_native_modules15.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
1614
+ "fetchTossAd",
1615
+ { spaceUnitId: adGroupId, sessionId, sdkId: options.sdkId, availableStyleIds: options.availableStyleIds },
1616
+ {
1617
+ onSuccess: (response) => {
1618
+ onEvent(response);
1619
+ },
1620
+ onError: (error) => {
1621
+ onError(error);
1622
+ }
1623
+ }
1624
+ );
1625
+ return unregisterCallbacks;
1626
+ }
1627
+ fetchTossAd.isSupported = () => {
1628
+ if (ENVIRONMENT !== "toss") {
1629
+ return false;
1630
+ }
1631
+ return (0, import_native_modules15.isMinVersionSupported)({
1632
+ android: ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION,
1633
+ ios: IOS_FETCH_TOSS_AD_SUPPORTED_VERSION
1634
+ });
1635
+ };
1636
+
1637
+ // src/ads/integratedAd.ts
1638
+ var import_native_modules17 = require("@apps-in-toss/native-modules");
1639
+
1640
+ // src/ads/generateRequestId.ts
1641
+ function generateRequestId() {
1642
+ const timestamp = Date.now().toString(36).toUpperCase();
1643
+ const random = Math.random().toString(36).substring(2, 7).toUpperCase();
1644
+ return `ait-${timestamp}${random}`;
1645
+ }
1646
+
1647
+ // src/ads/getReferrer.ts
1648
+ var import_react_native29 = require("@granite-js/react-native");
1649
+ function getReferrer() {
1650
+ try {
1651
+ return new URL((0, import_react_native29.getSchemeUri)()).searchParams.get("referrer");
1652
+ } catch {
1653
+ return null;
1654
+ }
1655
+ }
1656
+
1657
+ // src/ads/remotes.ts
1658
+ var import_native_modules16 = require("@apps-in-toss/native-modules");
1659
+
1660
+ // src/ads/getIsDev.ts
1661
+ var import_react_native30 = require("@granite-js/react-native");
1662
+ function getIsDev() {
1663
+ try {
1664
+ return new URL((0, import_react_native30.getSchemeUri)()).searchParams.get("isDev") === "true";
1665
+ } catch {
1666
+ return false;
1667
+ }
1668
+ }
1669
+
1670
+ // src/ads/remotes.ts
1671
+ var OPERATIONAL_ENVIRONMENT = (0, import_native_modules16.getOperationalEnvironment)();
1672
+ var OS = (0, import_native_modules16.getPlatformOS)();
1673
+ var APP_VER = (0, import_native_modules16.getTossAppVersion)();
1674
+ var ALPHA_EVENT_TRACKER_HTTP_ENDPOINT = "https://alpha-trillion.toss.im/trk/sdk-mediation/event";
1675
+ var LIVE_EVENT_TRACKER_HTTP_ENDPOINT = "https://trillion.toss.im/trk/sdk-mediation/event";
1676
+ function getPostEventTrackingUrl() {
1677
+ const isDev = getIsDev();
1678
+ if (OPERATIONAL_ENVIRONMENT === "sandbox" || isDev) {
1679
+ return ALPHA_EVENT_TRACKER_HTTP_ENDPOINT;
1680
+ }
1681
+ return LIVE_EVENT_TRACKER_HTTP_ENDPOINT;
1682
+ }
1683
+ function postEventTracking(params) {
1684
+ const endpoint = getPostEventTrackingUrl();
1685
+ const bodyJSON = JSON.stringify({
1686
+ ...params,
1687
+ os: OS,
1688
+ appVer: APP_VER,
1689
+ deviceIdType: "NONE",
1690
+ platform: "RN"
1691
+ });
1692
+ return fetch(endpoint, {
1693
+ method: "POST",
1694
+ headers: {
1695
+ "Content-Type": "application/json"
1696
+ },
1697
+ body: bodyJSON
1698
+ }).catch(noop);
1699
+ }
1700
+
1701
+ // src/ads/integratedAd.ts
1702
+ var INTEGRATED_AD_SDK_VERSION = "0.0.0";
1703
+ var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1704
+ var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1705
+ var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
1706
+ var INTG_AD_ADM_FALLBACK_RID_MAP = {};
1707
+ function integratedAdIsSupported() {
1708
+ return (0, import_native_modules17.isMinVersionSupported)({
1709
+ android: ANDROID_INTEGRATED_AD_SUPPORTED_VERSION,
1710
+ ios: IOS_INTEGRATED_AD_SUPPORTED_VERSION
1711
+ });
1712
+ }
1713
+ function generateLoadFullScreenAd(sdkId) {
1714
+ const fn = (params) => {
1715
+ if (!import_native_modules17.GoogleAdMob.loadAppsInTossAdMob.isSupported()) {
1716
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1717
+ return noop;
1718
+ }
1719
+ if (!integratedAdIsSupported()) {
1720
+ return import_native_modules17.GoogleAdMob.loadAppsInTossAdMob({
1721
+ ...params,
1722
+ onEvent: (event) => {
1723
+ if (event.type === "loaded") {
1724
+ const requestId = generateRequestId();
1725
+ INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] = requestId;
1726
+ postEventTracking({
1727
+ eventName: "LOAD",
1728
+ spaceUnitId: params.options.adGroupId,
1729
+ requestId,
1730
+ responseId: event.data.responseInfo.responseId,
1731
+ mediationType: "ADMOB",
1732
+ format: "",
1733
+ adSourceName: event.data.responseInfo.loadedAdNetworkInfo?.adSourceName ?? "",
1734
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1735
+ });
1736
+ }
1737
+ return params.onEvent(event);
1738
+ },
1739
+ onError: (error) => {
1740
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1741
+ postEventTracking({
1742
+ eventName: "FAILED_TO_LOAD",
1743
+ spaceUnitId: params.options.adGroupId,
1744
+ requestId,
1745
+ responseId: "",
1746
+ mediationType: "ADMOB",
1747
+ format: "",
1748
+ adSourceName: "",
1749
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1750
+ });
1751
+ return params.onError(error);
1752
+ }
1753
+ });
1754
+ }
1755
+ const { onEvent, onError, options } = params;
1756
+ const { adGroupId } = options;
1757
+ const referrer = getReferrer();
1758
+ const unregisterCallbacks = import_native_modules17.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
1759
+ "loadTossAdOrAdmob",
1760
+ { spaceUnitId: adGroupId, referrer, sessionId, sdkId },
1761
+ {
1762
+ onSuccess: () => {
1763
+ onEvent({ type: "loaded" });
1764
+ },
1765
+ onError: (error) => {
1766
+ onError(error);
1767
+ }
1768
+ }
1769
+ );
1770
+ return unregisterCallbacks;
1771
+ };
1772
+ fn.isSupported = import_native_modules17.GoogleAdMob.loadAppsInTossAdMob.isSupported;
1773
+ return fn;
1774
+ }
1775
+ var loadFullScreenAd = generateLoadFullScreenAd("107");
1776
+ var loadFullScreenAdForWeb = generateLoadFullScreenAd("107");
1777
+ function showFullScreenAd(params) {
1778
+ if (!import_native_modules17.GoogleAdMob.showAppsInTossAdMob.isSupported()) {
1779
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1780
+ return noop;
1781
+ }
1782
+ if (!integratedAdIsSupported()) {
1783
+ return import_native_modules17.GoogleAdMob.showAppsInTossAdMob({
1784
+ ...params,
1785
+ onEvent: (event) => {
1786
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1787
+ switch (event.type) {
1788
+ case "show":
1789
+ postEventTracking({
1790
+ eventName: "SHOW",
1791
+ spaceUnitId: params.options.adGroupId,
1792
+ requestId,
1793
+ responseId: "",
1794
+ mediationType: "ADMOB",
1795
+ format: "",
1796
+ adSourceName: "",
1797
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1798
+ });
1799
+ break;
1800
+ case "failedToShow":
1801
+ postEventTracking({
1802
+ eventName: "FAILED_TO_SHOW",
1803
+ spaceUnitId: params.options.adGroupId,
1804
+ requestId,
1805
+ responseId: "",
1806
+ mediationType: "ADMOB",
1807
+ format: "",
1808
+ adSourceName: "",
1809
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1810
+ });
1811
+ break;
1812
+ case "impression":
1813
+ postEventTracking({
1814
+ eventName: "IMP",
1815
+ spaceUnitId: params.options.adGroupId,
1816
+ requestId,
1817
+ responseId: "",
1818
+ mediationType: "ADMOB",
1819
+ format: "",
1820
+ adSourceName: "",
1821
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1822
+ });
1823
+ break;
1824
+ case "clicked":
1825
+ postEventTracking({
1826
+ eventName: "CLICK",
1827
+ spaceUnitId: params.options.adGroupId,
1828
+ requestId,
1829
+ responseId: "",
1830
+ mediationType: "ADMOB",
1831
+ format: "",
1832
+ adSourceName: "",
1833
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1834
+ });
1835
+ break;
1836
+ case "dismissed":
1837
+ postEventTracking({
1838
+ eventName: "DISMISS",
1839
+ spaceUnitId: params.options.adGroupId,
1840
+ requestId,
1841
+ responseId: "",
1842
+ mediationType: "ADMOB",
1843
+ format: "",
1844
+ adSourceName: "",
1845
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1846
+ });
1847
+ break;
1848
+ case "userEarnedReward":
1849
+ postEventTracking({
1850
+ eventName: "USER_EARNED_REWARD",
1851
+ spaceUnitId: params.options.adGroupId,
1852
+ requestId,
1853
+ responseId: "",
1854
+ mediationType: "ADMOB",
1855
+ format: "",
1856
+ adSourceName: "",
1857
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1858
+ });
1859
+ break;
1860
+ }
1861
+ return params.onEvent(event);
1862
+ },
1863
+ onError: (error) => {
1864
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1865
+ postEventTracking({
1866
+ eventName: "FAILED_TO_SHOW",
1867
+ spaceUnitId: params.options.adGroupId,
1868
+ requestId,
1869
+ responseId: "",
1870
+ mediationType: "ADMOB",
1871
+ format: "",
1872
+ adSourceName: "",
1873
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1874
+ });
1875
+ return params.onError(error);
1876
+ }
1877
+ });
1878
+ }
1879
+ const { onEvent, onError, options } = params;
1880
+ const { adGroupId } = options;
1881
+ const referrer = getReferrer();
1882
+ const unregisterCallbacks = import_native_modules17.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
1883
+ "showTossAdOrAdmob",
1884
+ { spaceUnitId: adGroupId, referrer, sessionId },
1885
+ {
1886
+ onAdClicked: () => {
1887
+ onEvent({ type: "clicked" });
1888
+ },
1889
+ onAdDismissed: () => {
1890
+ onEvent({ type: "dismissed" });
1891
+ },
1892
+ onAdFailedToShow: () => {
1893
+ onEvent({ type: "failedToShow" });
1894
+ },
1895
+ onAdImpression: () => {
1896
+ onEvent({ type: "impression" });
1897
+ },
1898
+ onAdShow: () => {
1899
+ onEvent({ type: "show" });
1900
+ },
1901
+ onUserEarnedReward: (data) => {
1902
+ onEvent({ type: "userEarnedReward", data });
1903
+ },
1904
+ onSuccess: () => {
1905
+ onEvent({ type: "requested" });
1906
+ },
1907
+ onError: (error) => {
1908
+ onError(error);
1909
+ }
1910
+ }
1911
+ );
1912
+ return unregisterCallbacks;
1913
+ }
1914
+ showFullScreenAd.isSupported = import_native_modules17.GoogleAdMob.showAppsInTossAdMob.isSupported;
1915
+
1916
+ // src/ads/tossAdEventLog.ts
1917
+ var import_native_modules18 = require("@apps-in-toss/native-modules");
1918
+ var import_react_native31 = require("@granite-js/react-native");
1919
+ async function tossAdEventLog(params) {
1920
+ const referrer = getReferrer();
1921
+ const appName = import_react_native31.Granite.appName;
1922
+ const eventLogParams = {
1923
+ ...params,
1924
+ params: {
1925
+ ...params.params,
1926
+ referrer,
1927
+ app_name: appName
1928
+ }
1929
+ };
1930
+ return import_native_modules18.INTERNAL__module.tossCoreEventLog(eventLogParams);
1931
+ }
1932
+
1597
1933
  // src/bridge-handler/useBridgeHandler.tsx
1598
1934
  var import_react22 = require("react");
1599
1935
  function serializeError(error) {
@@ -1769,7 +2105,7 @@ function useSafeAreaInsetsEmitter() {
1769
2105
  }
1770
2106
 
1771
2107
  // src/core/hooks/useWebBackHandler.tsx
1772
- var import_react_native29 = require("@granite-js/react-native");
2108
+ var import_react_native32 = require("@granite-js/react-native");
1773
2109
  var import_tds_react_native13 = require("@toss/tds-react-native");
1774
2110
  var import_es_hangul5 = require("es-hangul");
1775
2111
  var import_react25 = require("react");
@@ -1839,7 +2175,7 @@ function useWebBackHandler(webViewRef) {
1839
2175
  hasBackEvent: hasWebBackEvent,
1840
2176
  addEventListener: addWebBackEventListener,
1841
2177
  removeEventListener: removeWebBackEventListener
1842
- } = (0, import_react_native29.useBackEventState)();
2178
+ } = (0, import_react_native32.useBackEventState)();
1843
2179
  const logging = useNavigationBarLogging();
1844
2180
  const { openConfirm } = (0, import_tds_react_native13.useDialog)();
1845
2181
  const global2 = getAppsInTossGlobals();
@@ -1875,7 +2211,7 @@ function useWebBackHandler(webViewRef) {
1875
2211
  logging.closePopupCtaClick(isConfirmed);
1876
2212
  if (isConfirmed) {
1877
2213
  captureExitLog(Date.now());
1878
- (0, import_react_native29.closeView)();
2214
+ (0, import_react_native32.closeView)();
1879
2215
  }
1880
2216
  }
1881
2217
  }, [
@@ -1918,8 +2254,8 @@ function mergeRefs(...refs) {
1918
2254
  }
1919
2255
 
1920
2256
  // src/hooks/useCreateUserAgent.ts
1921
- var import_native_modules15 = require("@apps-in-toss/native-modules");
1922
- var import_react_native30 = require("react-native");
2257
+ var import_native_modules19 = require("@apps-in-toss/native-modules");
2258
+ var import_react_native33 = require("react-native");
1923
2259
  var FontA11yCategory = {
1924
2260
  Large: "Large",
1925
2261
  xLarge: "xLarge",
@@ -2052,9 +2388,9 @@ function useCreateUserAgent({
2052
2388
  safeArea,
2053
2389
  safeAreaBottomTransparency
2054
2390
  }) {
2055
- const platform = (0, import_native_modules15.getPlatformOS)();
2056
- const appVersion = (0, import_native_modules15.getTossAppVersion)();
2057
- const { fontScale } = (0, import_react_native30.useWindowDimensions)();
2391
+ const platform = (0, import_native_modules19.getPlatformOS)();
2392
+ const appVersion = (0, import_native_modules19.getTossAppVersion)();
2393
+ const { fontScale } = (0, import_react_native33.useWindowDimensions)();
2058
2394
  const platformString = platform === "ios" ? "iPhone" : "Android phone";
2059
2395
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
2060
2396
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
@@ -2075,17 +2411,17 @@ function useCreateUserAgent({
2075
2411
  }
2076
2412
 
2077
2413
  // src/hooks/useGeolocation.ts
2078
- var import_native_modules16 = require("@apps-in-toss/native-modules");
2079
- var import_react_native31 = require("@granite-js/react-native");
2414
+ var import_native_modules20 = require("@apps-in-toss/native-modules");
2415
+ var import_react_native34 = require("@granite-js/react-native");
2080
2416
  var import_react26 = require("react");
2081
2417
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
2082
- const isVisible = (0, import_react_native31.useVisibility)();
2418
+ const isVisible = (0, import_react_native34.useVisibility)();
2083
2419
  const [location, setLocation] = (0, import_react26.useState)(null);
2084
2420
  (0, import_react26.useEffect)(() => {
2085
2421
  if (!isVisible) {
2086
2422
  return;
2087
2423
  }
2088
- return (0, import_native_modules16.startUpdateLocation)({
2424
+ return (0, import_native_modules20.startUpdateLocation)({
2089
2425
  options: {
2090
2426
  accuracy,
2091
2427
  distanceInterval,
@@ -2099,11 +2435,11 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
2099
2435
  }
2100
2436
 
2101
2437
  // src/hooks/useWaitForReturnNavigator.tsx
2102
- var import_react_native32 = require("@granite-js/react-native");
2438
+ var import_react_native35 = require("@granite-js/react-native");
2103
2439
  var import_react27 = require("react");
2104
2440
  function useWaitForReturnNavigator() {
2105
2441
  const callbacks = (0, import_react27.useRef)([]).current;
2106
- const navigation = (0, import_react_native32.useNavigation)();
2442
+ const navigation = (0, import_react_native35.useNavigation)();
2107
2443
  const startNavigating = (0, import_react27.useCallback)(
2108
2444
  (route, params) => {
2109
2445
  return new Promise((resolve) => {
@@ -2124,7 +2460,7 @@ function useWaitForReturnNavigator() {
2124
2460
  },
2125
2461
  [callbacks]
2126
2462
  );
2127
- (0, import_react_native32.useVisibilityChange)(handleVisibilityChange);
2463
+ (0, import_react_native35.useVisibilityChange)(handleVisibilityChange);
2128
2464
  return startNavigating;
2129
2465
  }
2130
2466
 
@@ -2137,9 +2473,45 @@ function useTopNavigation() {
2137
2473
  };
2138
2474
  }
2139
2475
 
2476
+ // src/hooks/useWebViewMemoryDebug.tsx
2477
+ var import_native_modules21 = require("@apps-in-toss/native-modules");
2478
+ var import_react_native36 = require("@granite-js/react-native");
2479
+ var import_tds_react_native14 = require("@toss/tds-react-native");
2480
+ function useHandleWebViewProcessDidTerminate(webViewRef) {
2481
+ const toast = (0, import_tds_react_native14.useToast)();
2482
+ return () => {
2483
+ webViewDebugLog("AppsInTossWebViewProcessDidTerminate", {});
2484
+ toast.open("\uBB38\uC81C\uAC00 \uC0DD\uACA8\uC11C \uBBF8\uB2C8\uC571\uC744 \uB2E4\uC2DC \uC2DC\uC791\uD588\uC5B4\uC694.", {
2485
+ type: "bottom",
2486
+ lottie: `https://static.toss.im/lotties-common/check-green-spot.json`
2487
+ });
2488
+ webViewRef.current?.reload();
2489
+ };
2490
+ }
2491
+ async function webViewMemoryDebugLog(params) {
2492
+ webViewDebugLog("AppsInTossWebViewMemoryDebug", params);
2493
+ }
2494
+ function webViewDebugLog(logName, params) {
2495
+ const global2 = getAppsInTossGlobals();
2496
+ const event = {
2497
+ log_name: logName,
2498
+ log_type: "debug",
2499
+ params: {
2500
+ ...params,
2501
+ app_name: import_react_native36.Granite.appName,
2502
+ deployment_id: global2.deploymentId
2503
+ }
2504
+ };
2505
+ if ((0, import_native_modules21.getOperationalEnvironment)() === "toss") {
2506
+ import_native_modules21.INTERNAL__module.tossCoreEventLog(event);
2507
+ } else {
2508
+ console.log("[webViewDebugLog]", event);
2509
+ }
2510
+ }
2511
+
2140
2512
  // src/utils/log.ts
2141
- var import_native_modules17 = require("@apps-in-toss/native-modules");
2142
- var import_react_native33 = require("@granite-js/react-native");
2513
+ var import_native_modules22 = require("@apps-in-toss/native-modules");
2514
+ var import_react_native37 = require("@granite-js/react-native");
2143
2515
 
2144
2516
  // src/utils/extractDateFromUUIDv7.ts
2145
2517
  var extractDateFromUUIDv7 = (uuid) => {
@@ -2163,9 +2535,9 @@ var getGroupId = (url) => {
2163
2535
  };
2164
2536
  }
2165
2537
  };
2166
- var getReferrer = () => {
2538
+ var getReferrer2 = () => {
2167
2539
  try {
2168
- const referrer = new URL((0, import_react_native33.getSchemeUri)());
2540
+ const referrer = new URL((0, import_react_native37.getSchemeUri)());
2169
2541
  return referrer.searchParams.get("referrer");
2170
2542
  } catch {
2171
2543
  return "";
@@ -2178,12 +2550,12 @@ var trackScreen = (url) => {
2178
2550
  log_name: `${groupId}::screen`,
2179
2551
  params: {
2180
2552
  search,
2181
- referrer: getReferrer(),
2553
+ referrer: getReferrer2(),
2182
2554
  deployment_id: env.getDeploymentId(),
2183
2555
  deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
2184
2556
  }
2185
2557
  };
2186
- return (0, import_native_modules17.eventLog)(log);
2558
+ return (0, import_native_modules22.eventLog)(log);
2187
2559
  };
2188
2560
 
2189
2561
  // src/components/WebView.tsx
@@ -2192,12 +2564,12 @@ var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment
2192
2564
  var TYPES = ["partner", "external", "game"];
2193
2565
  var WEBVIEW_TYPES = {
2194
2566
  partner: PartnerWebView,
2195
- external: import_tds_react_native14.ExternalWebViewScreen,
2567
+ external: import_tds_react_native15.ExternalWebViewScreen,
2196
2568
  game: GameWebView
2197
2569
  };
2198
2570
  function mergeSchemeQueryParamsInto(url) {
2199
2571
  const baseUrl = new URL(url);
2200
- const schemeUrl = new URL((0, import_react_native34.getSchemeUri)());
2572
+ const schemeUrl = new URL((0, import_react_native38.getSchemeUri)());
2201
2573
  baseUrl.pathname = schemeUrl.pathname;
2202
2574
  for (const [key, value] of schemeUrl.searchParams.entries()) {
2203
2575
  baseUrl.searchParams.set(key, value);
@@ -2209,7 +2581,7 @@ function getWebViewUri(local) {
2209
2581
  const devUrl = `http://${local.host}:${local.port}`;
2210
2582
  return mergeSchemeQueryParamsInto(devUrl).toString();
2211
2583
  }
2212
- const { url: rawUrl } = import_native_modules18.AppsInTossModule.getWebBundleURL({});
2584
+ const { url: rawUrl } = import_native_modules23.AppsInTossModule.getWebBundleURL({});
2213
2585
  const url = mergeSchemeQueryParamsInto(rawUrl);
2214
2586
  const deploymentId = env.getDeploymentId();
2215
2587
  if (deploymentId) {
@@ -2237,14 +2609,14 @@ function WebView({ type, local, onMessage, ...props }) {
2237
2609
  onMessage,
2238
2610
  eventListenerMap: {
2239
2611
  ...appsInTossEventBridges,
2240
- navigationAccessoryEvent: ({ onEvent, onError }) => import_tds_react_native14.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
2612
+ navigationAccessoryEvent: ({ onEvent, onError }) => import_tds_react_native15.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
2241
2613
  backEvent: ({ onEvent }) => {
2242
2614
  webBackHandler.addEventListener(onEvent);
2243
2615
  return () => {
2244
2616
  webBackHandler.removeEventListener(onEvent);
2245
2617
  };
2246
2618
  },
2247
- updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2619
+ updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules23.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2248
2620
  safeAreaInsetsChange: ({ onEvent }) => {
2249
2621
  safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
2250
2622
  return () => {
@@ -2252,18 +2624,23 @@ function WebView({ type, local, onMessage, ...props }) {
2252
2624
  };
2253
2625
  },
2254
2626
  /** @internal */
2255
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2627
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules23.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2256
2628
  /** AdMob */
2257
- loadAdMobInterstitialAd: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd,
2258
- showAdMobInterstitialAd: import_native_modules18.GoogleAdMob.showAdMobInterstitialAd,
2259
- loadAdMobRewardedAd: import_native_modules18.GoogleAdMob.loadAdMobRewardedAd,
2260
- showAdMobRewardedAd: import_native_modules18.GoogleAdMob.showAdMobRewardedAd,
2629
+ loadAdMobInterstitialAd: import_native_modules23.GoogleAdMob.loadAdMobInterstitialAd,
2630
+ showAdMobInterstitialAd: import_native_modules23.GoogleAdMob.showAdMobInterstitialAd,
2631
+ loadAdMobRewardedAd: import_native_modules23.GoogleAdMob.loadAdMobRewardedAd,
2632
+ showAdMobRewardedAd: import_native_modules23.GoogleAdMob.showAdMobRewardedAd,
2261
2633
  /** AdMobV2 */
2262
- loadAppsInTossAdMob: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob,
2263
- showAppsInTossAdMob: import_native_modules18.GoogleAdMob.showAppsInTossAdMob,
2634
+ loadAppsInTossAdMob: import_native_modules23.GoogleAdMob.loadAppsInTossAdMob,
2635
+ showAppsInTossAdMob: import_native_modules23.GoogleAdMob.showAppsInTossAdMob,
2636
+ /** IntegratedAd */
2637
+ loadFullScreenAd: loadFullScreenAdForWeb,
2638
+ showFullScreenAd,
2639
+ /** TossAd */
2640
+ fetchTossAd,
2264
2641
  /** IAP */
2265
- iapCreateOneTimePurchaseOrder: import_native_modules18.IAP.createOneTimePurchaseOrder,
2266
- requestOneTimePurchase: import_native_modules18.requestOneTimePurchase
2642
+ iapCreateOneTimePurchaseOrder: import_native_modules23.IAP.createOneTimePurchaseOrder,
2643
+ requestOneTimePurchase: import_native_modules23.requestOneTimePurchase
2267
2644
  },
2268
2645
  constantHandlerMap: {
2269
2646
  ...appsInTossConstantBridges,
@@ -2273,13 +2650,18 @@ function WebView({ type, local, onMessage, ...props }) {
2273
2650
  getSafeAreaRight: () => insets.right,
2274
2651
  ...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
2275
2652
  /** AdMob */
2276
- loadAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
2277
- showAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.showAdMobInterstitialAd.isSupported,
2278
- loadAdMobRewardedAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobRewardedAd.isSupported,
2279
- showAdMobRewardedAd_isSupported: import_native_modules18.GoogleAdMob.showAdMobRewardedAd.isSupported,
2653
+ loadAdMobInterstitialAd_isSupported: import_native_modules23.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
2654
+ showAdMobInterstitialAd_isSupported: import_native_modules23.GoogleAdMob.showAdMobInterstitialAd.isSupported,
2655
+ loadAdMobRewardedAd_isSupported: import_native_modules23.GoogleAdMob.loadAdMobRewardedAd.isSupported,
2656
+ showAdMobRewardedAd_isSupported: import_native_modules23.GoogleAdMob.showAdMobRewardedAd.isSupported,
2280
2657
  /** AdMobV2 */
2281
- loadAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob.isSupported,
2282
- showAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.showAppsInTossAdMob.isSupported,
2658
+ loadAppsInTossAdMob_isSupported: import_native_modules23.GoogleAdMob.loadAppsInTossAdMob.isSupported,
2659
+ showAppsInTossAdMob_isSupported: import_native_modules23.GoogleAdMob.showAppsInTossAdMob.isSupported,
2660
+ /** IntegratedAd */
2661
+ loadFullScreenAd_isSupported: loadFullScreenAdForWeb.isSupported,
2662
+ showFullScreenAd_isSupported: showFullScreenAd.isSupported,
2663
+ /** TossAd */
2664
+ fetchTossAd_isSupported: fetchTossAd.isSupported,
2283
2665
  /** env */
2284
2666
  getDeploymentId: env.getDeploymentId
2285
2667
  },
@@ -2302,17 +2684,21 @@ function WebView({ type, local, onMessage, ...props }) {
2302
2684
  getCurrentLocation: appsInTossAsyncBridges.getCurrentLocation,
2303
2685
  openCamera: appsInTossAsyncBridges.openCamera,
2304
2686
  /** Storage */
2305
- getStorageItem: import_native_modules18.Storage.getItem,
2306
- setStorageItem: import_native_modules18.Storage.setItem,
2307
- removeStorageItem: import_native_modules18.Storage.removeItem,
2308
- clearItems: import_native_modules18.Storage.clearItems,
2687
+ getStorageItem: import_native_modules23.Storage.getItem,
2688
+ setStorageItem: import_native_modules23.Storage.setItem,
2689
+ removeStorageItem: import_native_modules23.Storage.removeItem,
2690
+ clearItems: import_native_modules23.Storage.clearItems,
2309
2691
  /** IAP */
2310
- iapGetProductItemList: import_native_modules18.IAP.getProductItemList,
2311
- iapCreateOneTimePurchaseOrder: import_native_modules18.iapCreateOneTimePurchaseOrder,
2312
- processProductGrant: import_native_modules18.processProductGrant,
2313
- getPendingOrders: import_native_modules18.IAP.getPendingOrders,
2314
- getCompletedOrRefundedOrders: import_native_modules18.IAP.getCompletedOrRefundedOrders,
2315
- completeProductGrant: import_native_modules18.IAP.completeProductGrant
2692
+ iapGetProductItemList: import_native_modules23.IAP.getProductItemList,
2693
+ iapCreateOneTimePurchaseOrder: import_native_modules23.iapCreateOneTimePurchaseOrder,
2694
+ processProductGrant: import_native_modules23.processProductGrant,
2695
+ getPendingOrders: import_native_modules23.IAP.getPendingOrders,
2696
+ getCompletedOrRefundedOrders: import_native_modules23.IAP.getCompletedOrRefundedOrders,
2697
+ completeProductGrant: import_native_modules23.IAP.completeProductGrant,
2698
+ /** Toss Ads */
2699
+ tossAdEventLog,
2700
+ /** Private */
2701
+ memoryDebugLog: webViewMemoryDebugLog
2316
2702
  }
2317
2703
  });
2318
2704
  const headerPropForExternalWebView = (0, import_react28.useMemo)(() => {
@@ -2341,10 +2727,11 @@ function WebView({ type, local, onMessage, ...props }) {
2341
2727
  webBackHandler.handleWebBack();
2342
2728
  return true;
2343
2729
  };
2344
- import_react_native35.BackHandler.addEventListener("hardwareBackPress", callback);
2345
- return () => import_react_native35.BackHandler.removeEventListener("hardwareBackPress", callback);
2730
+ import_react_native39.BackHandler.addEventListener("hardwareBackPress", callback);
2731
+ return () => import_react_native39.BackHandler.removeEventListener("hardwareBackPress", callback);
2346
2732
  }, [webBackHandler]);
2347
2733
  const globalScripts = useGlobalScripts();
2734
+ const handleWebViewProcessDidTerminate = useHandleWebViewProcessDidTerminate(webViewRef);
2348
2735
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2349
2736
  BaseWebView,
2350
2737
  {
@@ -2367,14 +2754,14 @@ function WebView({ type, local, onMessage, ...props }) {
2367
2754
  props.onNavigationStateChange?.(event);
2368
2755
  webBackHandler.onNavigationStateChange(event);
2369
2756
  },
2370
- userAgent: import_react_native35.Platform.OS === "ios" ? userAgent : void 0,
2757
+ userAgent: import_react_native39.Platform.OS === "ios" ? userAgent : void 0,
2371
2758
  sharedCookiesEnabled: true,
2372
2759
  webviewDebuggingEnabled: webViewDebuggingEnabled,
2373
2760
  thirdPartyCookiesEnabled: true,
2374
2761
  onMessage: handler.onMessage,
2375
2762
  injectedJavaScript: globalScripts.afterLoad,
2376
2763
  injectedJavaScriptBeforeContentLoaded: mergeScripts(handler.injectedJavaScript, globalScripts.beforeLoad),
2377
- decelerationRate: import_react_native35.Platform.OS === "ios" ? 1 : void 0,
2764
+ decelerationRate: import_react_native39.Platform.OS === "ios" ? 1 : void 0,
2378
2765
  allowsBackForwardNavigationGestures,
2379
2766
  onShouldStartLoadWithRequest: (event) => {
2380
2767
  try {
@@ -2382,7 +2769,7 @@ function WebView({ type, local, onMessage, ...props }) {
2382
2769
  if (["https:", "http:"].includes(url.protocol)) {
2383
2770
  return true;
2384
2771
  } else {
2385
- import_react_native35.Linking.openURL(convertIntentURL(url) ?? url.href);
2772
+ import_react_native39.Linking.openURL(convertIntentURL(url) ?? url.href);
2386
2773
  return false;
2387
2774
  }
2388
2775
  } catch (error) {
@@ -2390,7 +2777,17 @@ function WebView({ type, local, onMessage, ...props }) {
2390
2777
  return false;
2391
2778
  }
2392
2779
  },
2393
- originWhitelist: ["https://*", "http://*", "intoss://*", "intoss-private://*", "servicetoss://*", "supertoss://*", "intent://*"]
2780
+ originWhitelist: [
2781
+ "https://*",
2782
+ "http://*",
2783
+ "intoss://*",
2784
+ "intoss-private://*",
2785
+ "servicetoss://*",
2786
+ "supertoss://*",
2787
+ "intent://*"
2788
+ ],
2789
+ onContentProcessDidTerminate: handleWebViewProcessDidTerminate,
2790
+ onRenderProcessGone: handleWebViewProcessDidTerminate
2394
2791
  }
2395
2792
  );
2396
2793
  }
@@ -2475,6 +2872,8 @@ var Analytics2 = {
2475
2872
  OverlayProvider,
2476
2873
  WebView,
2477
2874
  env,
2875
+ loadFullScreenAd,
2876
+ showFullScreenAd,
2478
2877
  useCreateUserAgent,
2479
2878
  useGeolocation,
2480
2879
  useOverlay,