@apps-in-toss/framework 1.5.2 → 1.6.0

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,10 +1391,10 @@ var AppsInToss = {
1426
1391
  // src/components/WebView.tsx
1427
1392
  import {
1428
1393
  AppsInTossModule,
1429
- GoogleAdMob,
1394
+ GoogleAdMob as GoogleAdMob2,
1430
1395
  IAP,
1431
1396
  Storage,
1432
- appsInTossEvent as appsInTossEvent4,
1397
+ appsInTossEvent,
1433
1398
  iapCreateOneTimePurchaseOrder,
1434
1399
  processProductGrant,
1435
1400
  requestOneTimePurchase
@@ -1438,18 +1403,18 @@ import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-brid
1438
1403
  import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
1439
1404
  import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
1440
1405
  import { useSafeAreaInsets as useSafeAreaInsets4 } from "@granite-js/native/react-native-safe-area-context";
1441
- import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
1406
+ import { getSchemeUri as getSchemeUri8 } from "@granite-js/react-native";
1442
1407
  import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
1443
1408
  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";
1409
+ import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef6, useState as useState6 } from "react";
1445
1410
  import { BackHandler as BackHandler2, Linking, Platform as Platform6 } from "react-native";
1446
1411
 
1447
1412
  // src/components/GameWebView.tsx
1448
- import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment as getOperationalEnvironment4 } from "@apps-in-toss/native-modules";
1413
+ import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, getOperationalEnvironment as getOperationalEnvironment4 } from "@apps-in-toss/native-modules";
1449
1414
  import {
1450
1415
  WebView as PlainWebView
1451
1416
  } from "@granite-js/native/react-native-webview";
1452
- import { forwardRef, useEffect as useEffect10, useState as useState6 } from "react";
1417
+ import { forwardRef, useEffect as useEffect9 } from "react";
1453
1418
  import { Platform as Platform5 } from "react-native";
1454
1419
 
1455
1420
  // src/components/NavigationBar/GameWebviewNavigationBar.tsx
@@ -1522,8 +1487,7 @@ function GameWebviewNavigationBar() {
1522
1487
  // src/components/GameWebView.tsx
1523
1488
  import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1524
1489
  var GameWebView = forwardRef(function GameWebView2(props, ref) {
1525
- const [isEntryMessageExited, setIsEntryMessageExited] = useState6(false);
1526
- useEffect10(() => {
1490
+ useEffect9(() => {
1527
1491
  if (Platform5.OS === "ios") {
1528
1492
  setIosSwipeGestureEnabled3({ isEnabled: false });
1529
1493
  return () => {
@@ -1532,16 +1496,9 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1532
1496
  }
1533
1497
  return;
1534
1498
  }, []);
1535
- useEffect10(() => {
1536
- appsInTossEvent3.addEventListener("entryMessageExited", {
1537
- onEvent: () => {
1538
- setIsEntryMessageExited(true);
1539
- }
1540
- });
1541
- }, []);
1542
1499
  return /* @__PURE__ */ jsxs7(Fragment9, { children: [
1543
1500
  /* @__PURE__ */ jsx15(GameWebviewNavigationBar, {}),
1544
- getOperationalEnvironment4() === "toss" ? /* @__PURE__ */ jsx15(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props })
1501
+ getOperationalEnvironment4() === "toss" ? /* @__PURE__ */ jsx15(GameInitializer, { children: /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props })
1545
1502
  ] });
1546
1503
  });
1547
1504
 
@@ -1622,8 +1579,366 @@ function convertIntentURL(url) {
1622
1579
  return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
1623
1580
  }
1624
1581
 
1582
+ // src/ads/fetchTossAd.ts
1583
+ import {
1584
+ getOperationalEnvironment as getOperationalEnvironment5,
1585
+ INTERNAL__appBridgeHandler as INTERNAL__appBridgeHandler2,
1586
+ isMinVersionSupported as isMinVersionSupported4
1587
+ } from "@apps-in-toss/native-modules";
1588
+
1589
+ // ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
1590
+ function noop() {
1591
+ }
1592
+
1593
+ // src/ads/generateSessionId.ts
1594
+ function generateSessionId() {
1595
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
1596
+ const r = Math.random() * 16 | 0;
1597
+ const v = c === "x" ? r : r & 3 | 8;
1598
+ return v.toString(16);
1599
+ });
1600
+ }
1601
+
1602
+ // src/ads/constants.ts
1603
+ var sessionId = generateSessionId();
1604
+
1605
+ // src/ads/fetchTossAd.ts
1606
+ var ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
1607
+ var IOS_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
1608
+ var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
1609
+ var ENVIRONMENT = getOperationalEnvironment5();
1610
+ function fetchTossAd(params) {
1611
+ if (!fetchTossAd.isSupported()) {
1612
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
1613
+ return noop;
1614
+ }
1615
+ const { onEvent, onError, options } = params;
1616
+ const { adGroupId } = options;
1617
+ const unregisterCallbacks = INTERNAL__appBridgeHandler2.invokeAppBridgeMethod(
1618
+ "fetchTossAd",
1619
+ { spaceUnitId: adGroupId, sessionId, sdkId: options.sdkId, availableStyleIds: options.availableStyleIds },
1620
+ {
1621
+ onSuccess: (response) => {
1622
+ onEvent(response);
1623
+ },
1624
+ onError: (error) => {
1625
+ onError(error);
1626
+ }
1627
+ }
1628
+ );
1629
+ return unregisterCallbacks;
1630
+ }
1631
+ fetchTossAd.isSupported = () => {
1632
+ if (ENVIRONMENT !== "toss") {
1633
+ return false;
1634
+ }
1635
+ return isMinVersionSupported4({
1636
+ android: ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION,
1637
+ ios: IOS_FETCH_TOSS_AD_SUPPORTED_VERSION
1638
+ });
1639
+ };
1640
+
1641
+ // src/ads/integratedAd.ts
1642
+ import { GoogleAdMob, INTERNAL__appBridgeHandler as INTERNAL__appBridgeHandler3, isMinVersionSupported as isMinVersionSupported5 } from "@apps-in-toss/native-modules";
1643
+
1644
+ // src/ads/generateRequestId.ts
1645
+ function generateRequestId() {
1646
+ const timestamp = Date.now().toString(36).toUpperCase();
1647
+ const random = Math.random().toString(36).substring(2, 7).toUpperCase();
1648
+ return `ait-${timestamp}${random}`;
1649
+ }
1650
+
1651
+ // src/ads/getReferrer.ts
1652
+ import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
1653
+ function getReferrer() {
1654
+ try {
1655
+ return new URL(getSchemeUri5()).searchParams.get("referrer");
1656
+ } catch {
1657
+ return null;
1658
+ }
1659
+ }
1660
+
1661
+ // src/ads/remotes.ts
1662
+ import { getOperationalEnvironment as getOperationalEnvironment6, getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
1663
+
1664
+ // src/ads/getIsDev.ts
1665
+ import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
1666
+ function getIsDev() {
1667
+ try {
1668
+ return new URL(getSchemeUri6()).searchParams.get("isDev") === "true";
1669
+ } catch {
1670
+ return false;
1671
+ }
1672
+ }
1673
+
1674
+ // src/ads/remotes.ts
1675
+ var OPERATIONAL_ENVIRONMENT = getOperationalEnvironment6();
1676
+ var OS = getPlatformOS();
1677
+ var APP_VER = getTossAppVersion();
1678
+ var ALPHA_EVENT_TRACKER_HTTP_ENDPOINT = "https://alpha-trillion.toss.im/trk/sdk-mediation/event";
1679
+ var LIVE_EVENT_TRACKER_HTTP_ENDPOINT = "https://trillion.toss.im/trk/sdk-mediation/event";
1680
+ function getPostEventTrackingUrl() {
1681
+ const isDev = getIsDev();
1682
+ if (OPERATIONAL_ENVIRONMENT === "sandbox" || isDev) {
1683
+ return ALPHA_EVENT_TRACKER_HTTP_ENDPOINT;
1684
+ }
1685
+ return LIVE_EVENT_TRACKER_HTTP_ENDPOINT;
1686
+ }
1687
+ function postEventTracking(params) {
1688
+ const endpoint = getPostEventTrackingUrl();
1689
+ const bodyJSON = JSON.stringify({
1690
+ ...params,
1691
+ os: OS,
1692
+ appVer: APP_VER,
1693
+ deviceIdType: "NONE",
1694
+ platform: "RN"
1695
+ });
1696
+ return fetch(
1697
+ endpoint,
1698
+ {
1699
+ method: "POST",
1700
+ headers: {
1701
+ "Content-Type": "application/json"
1702
+ },
1703
+ body: bodyJSON
1704
+ }
1705
+ ).catch(noop);
1706
+ }
1707
+
1708
+ // src/ads/integratedAd.ts
1709
+ var INTEGRATED_AD_SDK_VERSION = "0.0.0";
1710
+ var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1711
+ var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1712
+ var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
1713
+ var INTG_AD_ADM_FALLBACK_RID_MAP = {};
1714
+ function integratedAdIsSupported() {
1715
+ return isMinVersionSupported5({
1716
+ android: ANDROID_INTEGRATED_AD_SUPPORTED_VERSION,
1717
+ ios: IOS_INTEGRATED_AD_SUPPORTED_VERSION
1718
+ });
1719
+ }
1720
+ function generateLoadFullScreenAd(sdkId) {
1721
+ const fn = (params) => {
1722
+ if (!GoogleAdMob.loadAppsInTossAdMob.isSupported()) {
1723
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1724
+ return noop;
1725
+ }
1726
+ if (!integratedAdIsSupported()) {
1727
+ return GoogleAdMob.loadAppsInTossAdMob({
1728
+ ...params,
1729
+ onEvent: (event) => {
1730
+ if (event.type === "loaded") {
1731
+ const requestId = generateRequestId();
1732
+ INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] = requestId;
1733
+ postEventTracking({
1734
+ eventName: "LOAD",
1735
+ spaceUnitId: params.options.adGroupId,
1736
+ requestId,
1737
+ responseId: event.data.responseInfo.responseId,
1738
+ mediationType: "ADMOB",
1739
+ format: "",
1740
+ adSourceName: event.data.responseInfo.loadedAdNetworkInfo?.adSourceName ?? "",
1741
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1742
+ });
1743
+ }
1744
+ return params.onEvent(event);
1745
+ },
1746
+ onError: (error) => {
1747
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1748
+ postEventTracking({
1749
+ eventName: "FAILED_TO_LOAD",
1750
+ spaceUnitId: params.options.adGroupId,
1751
+ requestId,
1752
+ responseId: "",
1753
+ mediationType: "ADMOB",
1754
+ format: "",
1755
+ adSourceName: "",
1756
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1757
+ });
1758
+ return params.onError(error);
1759
+ }
1760
+ });
1761
+ }
1762
+ const { onEvent, onError, options } = params;
1763
+ const { adGroupId } = options;
1764
+ const referrer = getReferrer();
1765
+ const unregisterCallbacks = INTERNAL__appBridgeHandler3.invokeAppBridgeMethod(
1766
+ "loadTossAdOrAdmob",
1767
+ { spaceUnitId: adGroupId, referrer, sessionId, sdkId },
1768
+ {
1769
+ onSuccess: () => {
1770
+ onEvent({ type: "loaded" });
1771
+ },
1772
+ onError: (error) => {
1773
+ onError(error);
1774
+ }
1775
+ }
1776
+ );
1777
+ return unregisterCallbacks;
1778
+ };
1779
+ fn.isSupported = GoogleAdMob.loadAppsInTossAdMob.isSupported;
1780
+ return fn;
1781
+ }
1782
+ var loadFullScreenAd = generateLoadFullScreenAd("107");
1783
+ var loadFullScreenAdForWeb = generateLoadFullScreenAd("107");
1784
+ function showFullScreenAd(params) {
1785
+ if (!GoogleAdMob.showAppsInTossAdMob.isSupported()) {
1786
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1787
+ return noop;
1788
+ }
1789
+ if (!integratedAdIsSupported()) {
1790
+ return GoogleAdMob.showAppsInTossAdMob({
1791
+ ...params,
1792
+ onEvent: (event) => {
1793
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1794
+ switch (event.type) {
1795
+ case "show":
1796
+ postEventTracking({
1797
+ eventName: "SHOW",
1798
+ spaceUnitId: params.options.adGroupId,
1799
+ requestId,
1800
+ responseId: "",
1801
+ mediationType: "ADMOB",
1802
+ format: "",
1803
+ adSourceName: "",
1804
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1805
+ });
1806
+ break;
1807
+ case "failedToShow":
1808
+ postEventTracking({
1809
+ eventName: "FAILED_TO_SHOW",
1810
+ spaceUnitId: params.options.adGroupId,
1811
+ requestId,
1812
+ responseId: "",
1813
+ mediationType: "ADMOB",
1814
+ format: "",
1815
+ adSourceName: "",
1816
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1817
+ });
1818
+ break;
1819
+ case "impression":
1820
+ postEventTracking({
1821
+ eventName: "IMP",
1822
+ spaceUnitId: params.options.adGroupId,
1823
+ requestId,
1824
+ responseId: "",
1825
+ mediationType: "ADMOB",
1826
+ format: "",
1827
+ adSourceName: "",
1828
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1829
+ });
1830
+ break;
1831
+ case "clicked":
1832
+ postEventTracking({
1833
+ eventName: "CLICK",
1834
+ spaceUnitId: params.options.adGroupId,
1835
+ requestId,
1836
+ responseId: "",
1837
+ mediationType: "ADMOB",
1838
+ format: "",
1839
+ adSourceName: "",
1840
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1841
+ });
1842
+ break;
1843
+ case "dismissed":
1844
+ postEventTracking({
1845
+ eventName: "DISMISS",
1846
+ spaceUnitId: params.options.adGroupId,
1847
+ requestId,
1848
+ responseId: "",
1849
+ mediationType: "ADMOB",
1850
+ format: "",
1851
+ adSourceName: "",
1852
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1853
+ });
1854
+ break;
1855
+ case "userEarnedReward":
1856
+ postEventTracking({
1857
+ eventName: "USER_EARNED_REWARD",
1858
+ spaceUnitId: params.options.adGroupId,
1859
+ requestId,
1860
+ responseId: "",
1861
+ mediationType: "ADMOB",
1862
+ format: "",
1863
+ adSourceName: "",
1864
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1865
+ });
1866
+ break;
1867
+ }
1868
+ return params.onEvent(event);
1869
+ },
1870
+ onError: (error) => {
1871
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1872
+ postEventTracking({
1873
+ eventName: "FAILED_TO_SHOW",
1874
+ spaceUnitId: params.options.adGroupId,
1875
+ requestId,
1876
+ responseId: "",
1877
+ mediationType: "ADMOB",
1878
+ format: "",
1879
+ adSourceName: "",
1880
+ sdkVer: INTEGRATED_AD_SDK_VERSION
1881
+ });
1882
+ return params.onError(error);
1883
+ }
1884
+ });
1885
+ }
1886
+ const { onEvent, onError, options } = params;
1887
+ const { adGroupId } = options;
1888
+ const referrer = getReferrer();
1889
+ const unregisterCallbacks = INTERNAL__appBridgeHandler3.invokeAppBridgeMethod(
1890
+ "showTossAdOrAdmob",
1891
+ { spaceUnitId: adGroupId, referrer, sessionId },
1892
+ {
1893
+ onAdClicked: () => {
1894
+ onEvent({ type: "clicked" });
1895
+ },
1896
+ onAdDismissed: () => {
1897
+ onEvent({ type: "dismissed" });
1898
+ },
1899
+ onAdFailedToShow: () => {
1900
+ onEvent({ type: "failedToShow" });
1901
+ },
1902
+ onAdImpression: () => {
1903
+ onEvent({ type: "impression" });
1904
+ },
1905
+ onAdShow: () => {
1906
+ onEvent({ type: "show" });
1907
+ },
1908
+ onUserEarnedReward: (data) => {
1909
+ onEvent({ type: "userEarnedReward", data });
1910
+ },
1911
+ onSuccess: () => {
1912
+ onEvent({ type: "requested" });
1913
+ },
1914
+ onError: (error) => {
1915
+ onError(error);
1916
+ }
1917
+ }
1918
+ );
1919
+ return unregisterCallbacks;
1920
+ }
1921
+ showFullScreenAd.isSupported = GoogleAdMob.showAppsInTossAdMob.isSupported;
1922
+
1923
+ // src/ads/tossAdEventLog.ts
1924
+ import { INTERNAL__module as INTERNAL__module6 } from "@apps-in-toss/native-modules";
1925
+ import { Granite as Granite8 } from "@granite-js/react-native";
1926
+ async function tossAdEventLog(params) {
1927
+ const referrer = getReferrer();
1928
+ const appName = Granite8.appName;
1929
+ const eventLogParams = {
1930
+ ...params,
1931
+ params: {
1932
+ ...params.params,
1933
+ referrer,
1934
+ app_name: appName
1935
+ }
1936
+ };
1937
+ return INTERNAL__module6.tossCoreEventLog(eventLogParams);
1938
+ }
1939
+
1625
1940
  // src/bridge-handler/useBridgeHandler.tsx
1626
- import { useCallback as useCallback10, useEffect as useEffect11, useMemo as useMemo3, useRef as useRef4 } from "react";
1941
+ import { useCallback as useCallback10, useEffect as useEffect10, useMemo as useMemo3, useRef as useRef4 } from "react";
1627
1942
  function serializeError(error) {
1628
1943
  return JSON.stringify(error, (_, value) => {
1629
1944
  if (value instanceof Error) {
@@ -1688,7 +2003,7 @@ function useBridgeHandler({
1688
2003
  )};`,
1689
2004
  [constantHandlerMap]
1690
2005
  );
1691
- useEffect11(() => {
2006
+ useEffect10(() => {
1692
2007
  ref.current?.injectJavaScript(injectedJavaScript);
1693
2008
  }, [injectedJavaScript]);
1694
2009
  const createHandleOnEvent = (functionName, eventId) => (response) => {
@@ -1762,7 +2077,7 @@ function parseNativeEventData(data) {
1762
2077
 
1763
2078
  // src/core/hooks/useSafeAreaInsetsEmitter.tsx
1764
2079
  import { useSafeAreaInsets as useSafeAreaInsets3 } from "@granite-js/native/react-native-safe-area-context";
1765
- import { useEffect as useEffect12, useMemo as useMemo4 } from "react";
2080
+ import { useEffect as useEffect11, useMemo as useMemo4 } from "react";
1766
2081
  var EventEmitter = class {
1767
2082
  listeners = {};
1768
2083
  on(event, listener) {
@@ -1787,7 +2102,7 @@ var EventEmitter = class {
1787
2102
  function useSafeAreaInsetsEmitter() {
1788
2103
  const insets = useSafeAreaInsets3();
1789
2104
  const emitter = useMemo4(() => new EventEmitter(), []);
1790
- useEffect12(() => {
2105
+ useEffect11(() => {
1791
2106
  emitter.emit("safeAreaInsetsChange", insets);
1792
2107
  return () => {
1793
2108
  emitter.off("safeAreaInsetsChange", (listener) => listener(insets));
@@ -1946,7 +2261,7 @@ function mergeRefs(...refs) {
1946
2261
  }
1947
2262
 
1948
2263
  // src/hooks/useCreateUserAgent.ts
1949
- import { getPlatformOS, getTossAppVersion } from "@apps-in-toss/native-modules";
2264
+ import { getPlatformOS as getPlatformOS2, getTossAppVersion as getTossAppVersion2 } from "@apps-in-toss/native-modules";
1950
2265
  import { useWindowDimensions } from "react-native";
1951
2266
  var FontA11yCategory = {
1952
2267
  Large: "Large",
@@ -2080,8 +2395,8 @@ function useCreateUserAgent({
2080
2395
  safeArea,
2081
2396
  safeAreaBottomTransparency
2082
2397
  }) {
2083
- const platform = getPlatformOS();
2084
- const appVersion = getTossAppVersion();
2398
+ const platform = getPlatformOS2();
2399
+ const appVersion = getTossAppVersion2();
2085
2400
  const { fontScale } = useWindowDimensions();
2086
2401
  const platformString = platform === "ios" ? "iPhone" : "Android phone";
2087
2402
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
@@ -2105,11 +2420,11 @@ function useCreateUserAgent({
2105
2420
  // src/hooks/useGeolocation.ts
2106
2421
  import { startUpdateLocation } from "@apps-in-toss/native-modules";
2107
2422
  import { useVisibility as useVisibility3 } from "@granite-js/react-native";
2108
- import { useEffect as useEffect13, useState as useState7 } from "react";
2423
+ import { useEffect as useEffect12, useState as useState5 } from "react";
2109
2424
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
2110
2425
  const isVisible = useVisibility3();
2111
- const [location, setLocation] = useState7(null);
2112
- useEffect13(() => {
2426
+ const [location, setLocation] = useState5(null);
2427
+ useEffect12(() => {
2113
2428
  if (!isVisible) {
2114
2429
  return;
2115
2430
  }
@@ -2167,7 +2482,7 @@ function useTopNavigation() {
2167
2482
 
2168
2483
  // src/utils/log.ts
2169
2484
  import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
2170
- import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
2485
+ import { getSchemeUri as getSchemeUri7 } from "@granite-js/react-native";
2171
2486
 
2172
2487
  // src/utils/extractDateFromUUIDv7.ts
2173
2488
  var extractDateFromUUIDv7 = (uuid) => {
@@ -2191,9 +2506,9 @@ var getGroupId = (url) => {
2191
2506
  };
2192
2507
  }
2193
2508
  };
2194
- var getReferrer = () => {
2509
+ var getReferrer2 = () => {
2195
2510
  try {
2196
- const referrer = new URL(getSchemeUri5());
2511
+ const referrer = new URL(getSchemeUri7());
2197
2512
  return referrer.searchParams.get("referrer");
2198
2513
  } catch {
2199
2514
  return "";
@@ -2206,7 +2521,7 @@ var trackScreen = (url) => {
2206
2521
  log_name: `${groupId}::screen`,
2207
2522
  params: {
2208
2523
  search,
2209
- referrer: getReferrer(),
2524
+ referrer: getReferrer2(),
2210
2525
  deployment_id: env.getDeploymentId(),
2211
2526
  deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
2212
2527
  }
@@ -2225,7 +2540,7 @@ var WEBVIEW_TYPES = {
2225
2540
  };
2226
2541
  function mergeSchemeQueryParamsInto(url) {
2227
2542
  const baseUrl = new URL(url);
2228
- const schemeUrl = new URL(getSchemeUri6());
2543
+ const schemeUrl = new URL(getSchemeUri8());
2229
2544
  baseUrl.pathname = schemeUrl.pathname;
2230
2545
  for (const [key, value] of schemeUrl.searchParams.entries()) {
2231
2546
  baseUrl.searchParams.set(key, value);
@@ -2258,7 +2573,7 @@ function WebView({ type, local, onMessage, ...props }) {
2258
2573
  const global2 = getAppsInTossGlobals();
2259
2574
  const navigationBarContext = useNavigationBarContext();
2260
2575
  const safeAreaInsetsEmitter = useSafeAreaInsetsEmitter();
2261
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState8(
2576
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState6(
2262
2577
  props.allowsBackForwardNavigationGestures
2263
2578
  );
2264
2579
  const handler = useBridgeHandler({
@@ -2272,8 +2587,7 @@ function WebView({ type, local, onMessage, ...props }) {
2272
2587
  webBackHandler.removeEventListener(onEvent);
2273
2588
  };
2274
2589
  },
2275
- entryMessageExited: ({ onEvent, onError }) => appsInTossEvent4.addEventListener("entryMessageExited", { onEvent, onError }),
2276
- updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2590
+ updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2277
2591
  safeAreaInsetsChange: ({ onEvent }) => {
2278
2592
  safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
2279
2593
  return () => {
@@ -2281,15 +2595,20 @@ function WebView({ type, local, onMessage, ...props }) {
2281
2595
  };
2282
2596
  },
2283
2597
  /** @internal */
2284
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2598
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2285
2599
  /** AdMob */
2286
- loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
2287
- showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
2288
- loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
2289
- showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd,
2600
+ loadAdMobInterstitialAd: GoogleAdMob2.loadAdMobInterstitialAd,
2601
+ showAdMobInterstitialAd: GoogleAdMob2.showAdMobInterstitialAd,
2602
+ loadAdMobRewardedAd: GoogleAdMob2.loadAdMobRewardedAd,
2603
+ showAdMobRewardedAd: GoogleAdMob2.showAdMobRewardedAd,
2290
2604
  /** AdMobV2 */
2291
- loadAppsInTossAdMob: GoogleAdMob.loadAppsInTossAdMob,
2292
- showAppsInTossAdMob: GoogleAdMob.showAppsInTossAdMob,
2605
+ loadAppsInTossAdMob: GoogleAdMob2.loadAppsInTossAdMob,
2606
+ showAppsInTossAdMob: GoogleAdMob2.showAppsInTossAdMob,
2607
+ /** IntegratedAd */
2608
+ loadFullScreenAd: loadFullScreenAdForWeb,
2609
+ showFullScreenAd,
2610
+ /** TossAd */
2611
+ fetchTossAd,
2293
2612
  /** IAP */
2294
2613
  iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
2295
2614
  requestOneTimePurchase
@@ -2302,13 +2621,18 @@ function WebView({ type, local, onMessage, ...props }) {
2302
2621
  getSafeAreaRight: () => insets.right,
2303
2622
  ...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
2304
2623
  /** AdMob */
2305
- loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
2306
- showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
2307
- loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
2308
- showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
2624
+ loadAdMobInterstitialAd_isSupported: GoogleAdMob2.loadAdMobInterstitialAd.isSupported,
2625
+ showAdMobInterstitialAd_isSupported: GoogleAdMob2.showAdMobInterstitialAd.isSupported,
2626
+ loadAdMobRewardedAd_isSupported: GoogleAdMob2.loadAdMobRewardedAd.isSupported,
2627
+ showAdMobRewardedAd_isSupported: GoogleAdMob2.showAdMobRewardedAd.isSupported,
2309
2628
  /** AdMobV2 */
2310
- loadAppsInTossAdMob_isSupported: GoogleAdMob.loadAppsInTossAdMob.isSupported,
2311
- showAppsInTossAdMob_isSupported: GoogleAdMob.showAppsInTossAdMob.isSupported,
2629
+ loadAppsInTossAdMob_isSupported: GoogleAdMob2.loadAppsInTossAdMob.isSupported,
2630
+ showAppsInTossAdMob_isSupported: GoogleAdMob2.showAppsInTossAdMob.isSupported,
2631
+ /** IntegratedAd */
2632
+ loadFullScreenAd_isSupported: loadFullScreenAdForWeb.isSupported,
2633
+ showFullScreenAd_isSupported: showFullScreenAd.isSupported,
2634
+ /** TossAd */
2635
+ fetchTossAd_isSupported: fetchTossAd.isSupported,
2312
2636
  /** env */
2313
2637
  getDeploymentId: env.getDeploymentId
2314
2638
  },
@@ -2341,7 +2665,9 @@ function WebView({ type, local, onMessage, ...props }) {
2341
2665
  processProductGrant,
2342
2666
  getPendingOrders: IAP.getPendingOrders,
2343
2667
  getCompletedOrRefundedOrders: IAP.getCompletedOrRefundedOrders,
2344
- completeProductGrant: IAP.completeProductGrant
2668
+ completeProductGrant: IAP.completeProductGrant,
2669
+ /** Toss Ads */
2670
+ tossAdEventLog
2345
2671
  }
2346
2672
  });
2347
2673
  const headerPropForExternalWebView = useMemo7(() => {
@@ -2365,7 +2691,7 @@ function WebView({ type, local, onMessage, ...props }) {
2365
2691
  colorPreference: "light"
2366
2692
  });
2367
2693
  const refs = mergeRefs(handler.ref, webViewRef);
2368
- useEffect14(() => {
2694
+ useEffect13(() => {
2369
2695
  const callback = () => {
2370
2696
  webBackHandler.handleWebBack();
2371
2697
  return true;
@@ -2419,7 +2745,15 @@ function WebView({ type, local, onMessage, ...props }) {
2419
2745
  return false;
2420
2746
  }
2421
2747
  },
2422
- originWhitelist: ["https://*", "http://*", "intoss://*", "intoss-private://*", "servicetoss://*", "supertoss://*", "intent://*"]
2748
+ originWhitelist: [
2749
+ "https://*",
2750
+ "http://*",
2751
+ "intoss://*",
2752
+ "intoss-private://*",
2753
+ "servicetoss://*",
2754
+ "supertoss://*",
2755
+ "intent://*"
2756
+ ]
2423
2757
  }
2424
2758
  );
2425
2759
  }
@@ -2503,6 +2837,8 @@ export {
2503
2837
  OverlayProvider,
2504
2838
  WebView,
2505
2839
  env,
2840
+ loadFullScreenAd,
2841
+ showFullScreenAd,
2506
2842
  useCreateUserAgent,
2507
2843
  useGeolocation,
2508
2844
  useOverlay3 as useOverlay,