@apps-in-toss/framework 1.1.2 → 1.1.3

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
@@ -792,7 +792,7 @@ var AppsInToss = {
792
792
  };
793
793
 
794
794
  // src/components/WebView.tsx
795
- var import_native_modules18 = require("@apps-in-toss/native-modules");
795
+ var import_native_modules17 = require("@apps-in-toss/native-modules");
796
796
  var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
797
797
  var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
798
798
  var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
@@ -801,7 +801,7 @@ var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridge
801
801
  var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
802
802
  var import_react_native37 = require("@toss-design-system/react-native");
803
803
  var import_private7 = require("@toss-design-system/react-native/private");
804
- var import_react18 = require("react");
804
+ var import_react19 = require("react");
805
805
  var import_react_native38 = require("react-native");
806
806
 
807
807
  // src/components/GameWebView.tsx
@@ -1227,18 +1227,17 @@ var GameWebView = (0, import_react13.forwardRef)(function GameWebView2(props, re
1227
1227
  // src/components/PartnerWebView.tsx
1228
1228
  var import_native_modules14 = require("@apps-in-toss/native-modules");
1229
1229
  var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
1230
- var import_react15 = require("react");
1231
- var import_react_native32 = require("react-native");
1230
+ var import_react16 = require("react");
1231
+ var import_react_native33 = require("react-native");
1232
1232
 
1233
1233
  // src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
1234
- var import_native_modules13 = require("@apps-in-toss/native-modules");
1235
1234
  var import_react_native30 = require("@granite-js/react-native");
1236
1235
  var import_react_native31 = require("@toss-design-system/react-native");
1237
1236
  var import_private6 = require("@toss-design-system/react-native/private");
1238
1237
  var import_es_hangul4 = require("es-hangul");
1239
1238
  var import_react14 = require("react");
1240
1239
  var import_jsx_runtime10 = require("react/jsx-runtime");
1241
- function PartnerWebviewNavigationBar({ handleBackEvent }) {
1240
+ function PartnerWebviewNavigationBar({ handleBackEvent, handleHomeIconButtonClick }) {
1242
1241
  const globals = getAppsInTossGlobals();
1243
1242
  const { captureExitLog } = useCaptureExitLog();
1244
1243
  const logging = useNavigationBarLogging();
@@ -1250,8 +1249,8 @@ function PartnerWebviewNavigationBar({ handleBackEvent }) {
1250
1249
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1251
1250
  const handlePressTitle = (0, import_react14.useCallback)(() => {
1252
1251
  logging.homeButtonClick();
1253
- import_native_modules13.appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
1254
- }, [logging]);
1252
+ handleHomeIconButtonClick();
1253
+ }, [handleHomeIconButtonClick, logging]);
1255
1254
  const handleClose = (0, import_react14.useCallback)(async () => {
1256
1255
  logging.closeButtonClick();
1257
1256
  const isConfirmed = await openConfirm({
@@ -1296,57 +1295,186 @@ function mergeRefs(...refs) {
1296
1295
  };
1297
1296
  }
1298
1297
 
1298
+ // src/hooks/useWebviewHistoryStack.tsx
1299
+ var import_react15 = require("react");
1300
+ var INITIAL_STATE = { stack: [], index: -1 };
1301
+ function reducer(state, action) {
1302
+ switch (action.type) {
1303
+ case "NAVIGATION_CHANGE": {
1304
+ const { url, canGoForward } = action;
1305
+ if (state.stack.length === 0) {
1306
+ return { stack: [url], index: 0 };
1307
+ }
1308
+ const { stack, index } = state;
1309
+ const cur = stack[index];
1310
+ if (url === cur) {
1311
+ return state;
1312
+ }
1313
+ const prev = index > 0 ? stack[index - 1] : void 0;
1314
+ const next = index < stack.length - 1 ? stack[index + 1] : void 0;
1315
+ if (prev && url === prev && canGoForward) {
1316
+ return { ...state, index: index - 1 };
1317
+ }
1318
+ if (next && url === next) {
1319
+ return { ...state, index: index + 1 };
1320
+ }
1321
+ const base = stack.slice(0, index + 1);
1322
+ const nextStack = [...base, url];
1323
+ return { stack: nextStack, index: nextStack.length - 1 };
1324
+ }
1325
+ default:
1326
+ return state;
1327
+ }
1328
+ }
1329
+ function useWebViewHistory() {
1330
+ const [state, dispatch] = (0, import_react15.useReducer)(reducer, INITIAL_STATE);
1331
+ const onNavigationStateChange = (0, import_react15.useCallback)(({ url, canGoForward: canGoForward2 }) => {
1332
+ dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
1333
+ }, []);
1334
+ const { canGoBack, canGoForward } = (0, import_react15.useMemo)(() => {
1335
+ const canBack = state.index > 0;
1336
+ const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
1337
+ return { canGoBack: canBack, canGoForward: canFwd };
1338
+ }, [state.index, state.stack.length]);
1339
+ return { onNavigationStateChange, canGoBack, canGoForward };
1340
+ }
1341
+
1342
+ // src/utils/log.ts
1343
+ var import_native_modules13 = require("@apps-in-toss/native-modules");
1344
+ var import_react_native32 = require("@granite-js/react-native");
1345
+
1346
+ // src/utils/extractDateFromUUIDv7.ts
1347
+ var extractDateFromUUIDv7 = (uuid) => {
1348
+ const timestampHex = uuid.split("-").join("").slice(0, 12);
1349
+ const timestamp = Number.parseInt(timestampHex, 16);
1350
+ return new Date(timestamp);
1351
+ };
1352
+
1353
+ // src/utils/log.ts
1354
+ var getGroupId = (url) => {
1355
+ try {
1356
+ const urlObject = new URL(url);
1357
+ return {
1358
+ groupId: urlObject.pathname,
1359
+ search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1360
+ };
1361
+ } catch {
1362
+ return {
1363
+ groupId: "unknown",
1364
+ search: "unknown"
1365
+ };
1366
+ }
1367
+ };
1368
+ var getReferrer = () => {
1369
+ try {
1370
+ const referrer = new URL((0, import_react_native32.getSchemeUri)());
1371
+ return referrer.searchParams.get("referrer");
1372
+ } catch {
1373
+ return "";
1374
+ }
1375
+ };
1376
+ var trackScreen = (url) => {
1377
+ const { groupId, search } = getGroupId(url);
1378
+ const log = {
1379
+ log_type: "screen",
1380
+ log_name: `${groupId}::screen`,
1381
+ params: {
1382
+ search,
1383
+ referrer: getReferrer(),
1384
+ deployment_id: env.getDeploymentId(),
1385
+ deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1386
+ }
1387
+ };
1388
+ return (0, import_native_modules13.eventLog)(log);
1389
+ };
1390
+
1299
1391
  // src/components/PartnerWebView.tsx
1300
1392
  var import_jsx_runtime11 = require("react/jsx-runtime");
1301
- var PartnerWebView = (0, import_react15.forwardRef)(function PartnerWebViewScreen({ canHistoryGoBack, ...webViewProps }, ref) {
1302
- const webViewRef = (0, import_react15.useRef)(null);
1303
- const refs = mergeRefs(ref, webViewRef);
1304
- const { captureExitLog } = useCaptureExitLog();
1305
- const handleBackEvent = (0, import_react15.useCallback)(() => {
1306
- if (canHistoryGoBack) {
1307
- webViewRef.current?.goBack();
1308
- } else {
1309
- captureExitLog(Date.now());
1310
- (0, import_native_modules14.closeView)();
1311
- }
1312
- }, [canHistoryGoBack, captureExitLog]);
1313
- (0, import_react15.useEffect)(() => {
1314
- const handleAndroidBackEvent = () => {
1315
- if (canHistoryGoBack) {
1316
- webViewRef.current?.goBack();
1317
- return true;
1393
+ var PartnerWebView = (0, import_react16.forwardRef)(
1394
+ function PartnerWebViewScreen(webViewProps, ref) {
1395
+ const webViewRef = (0, import_react16.useRef)(null);
1396
+ const refs = mergeRefs(ref, webViewRef);
1397
+ const { captureExitLog } = useCaptureExitLog();
1398
+ const { canGoBack, onNavigationStateChange } = useWebViewHistory();
1399
+ const historyBackScript = `
1400
+ (function() {
1401
+ window.history.back();
1402
+ true;
1403
+ })();
1404
+ `;
1405
+ const historyHomeScript = `
1406
+ (function() {
1407
+ window.location.href = '/';
1408
+ true;
1409
+ })();
1410
+ `;
1411
+ const handleBackEvent = (0, import_react16.useCallback)(() => {
1412
+ if (canGoBack) {
1413
+ webViewRef.current?.injectJavaScript(historyBackScript);
1318
1414
  } else {
1319
1415
  captureExitLog(Date.now());
1320
- return false;
1416
+ (0, import_native_modules14.closeView)();
1321
1417
  }
1322
- };
1323
- import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1324
- return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1325
- }, [canHistoryGoBack, captureExitLog]);
1326
- (0, import_react15.useEffect)(() => {
1327
- return import_native_modules14.appsInTossEvent.addEventListener("homeIconButtonClickEvent", {
1328
- onEvent: () => {
1329
- webViewRef.current?.injectJavaScript(`
1330
- (function() {
1331
- window.history.replaceState(null, '', '/');
1332
- true;
1333
- })();
1334
- `);
1335
- }
1336
- });
1337
- }, [webViewRef]);
1338
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1339
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PartnerWebviewNavigationBar, { handleBackEvent }),
1340
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_webview2.WebView, { ref: refs, ...webViewProps, style: { flex: 1 } })
1341
- ] });
1342
- });
1418
+ }, [canGoBack, captureExitLog, historyBackScript]);
1419
+ (0, import_react16.useEffect)(() => {
1420
+ const handleAndroidBackEvent = () => {
1421
+ if (canGoBack) {
1422
+ webViewRef.current?.injectJavaScript(historyBackScript);
1423
+ return true;
1424
+ } else {
1425
+ captureExitLog(Date.now());
1426
+ return false;
1427
+ }
1428
+ };
1429
+ import_react_native33.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1430
+ return () => import_react_native33.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1431
+ }, [canGoBack, captureExitLog, historyBackScript]);
1432
+ const handleHomeIconButtonClick = (0, import_react16.useCallback)(() => {
1433
+ webViewRef.current?.injectJavaScript(historyHomeScript);
1434
+ }, [historyHomeScript]);
1435
+ const handleNavigationStateChange = (0, import_react16.useCallback)(
1436
+ (event) => {
1437
+ if (event.url) {
1438
+ trackScreen(event.url);
1439
+ }
1440
+ onNavigationStateChange(event);
1441
+ },
1442
+ [onNavigationStateChange]
1443
+ );
1444
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1445
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1446
+ PartnerWebviewNavigationBar,
1447
+ {
1448
+ handleBackEvent,
1449
+ handleHomeIconButtonClick
1450
+ }
1451
+ ),
1452
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1453
+ import_react_native_webview2.WebView,
1454
+ {
1455
+ ref: refs,
1456
+ ...webViewProps,
1457
+ style: { flex: 1 },
1458
+ onNavigationStateChange: (event) => {
1459
+ webViewProps?.onNavigationStateChange?.(event);
1460
+ handleNavigationStateChange(event);
1461
+ }
1462
+ }
1463
+ )
1464
+ ] });
1465
+ }
1466
+ );
1343
1467
 
1344
1468
  // src/bridge-handler/useBridgeHandler.tsx
1345
- var import_react16 = require("react");
1469
+ var import_react17 = require("react");
1346
1470
  function serializeError(error) {
1347
1471
  return JSON.stringify(error, (_, value) => {
1348
1472
  if (value instanceof Error) {
1349
1473
  return {
1474
+ ...Object.entries(value).reduce((acc, [key, value2]) => {
1475
+ acc[key] = value2;
1476
+ return acc;
1477
+ }, {}),
1350
1478
  name: value.name,
1351
1479
  message: value.message,
1352
1480
  stack: value.stack,
@@ -1391,8 +1519,8 @@ function useBridgeHandler({
1391
1519
  eventListenerMap,
1392
1520
  injectedJavaScript: originalInjectedJavaScript
1393
1521
  }) {
1394
- const ref = (0, import_react16.useRef)(null);
1395
- const injectedJavaScript = (0, import_react16.useMemo)(
1522
+ const ref = (0, import_react17.useRef)(null);
1523
+ const injectedJavaScript = (0, import_react17.useMemo)(
1396
1524
  () => [
1397
1525
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
1398
1526
  Object.entries(constantHandlerMap).reduce(
@@ -1419,7 +1547,7 @@ function useBridgeHandler({
1419
1547
  window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
1420
1548
  `);
1421
1549
  };
1422
- const $onMessage = (0, import_react16.useCallback)(
1550
+ const $onMessage = (0, import_react17.useCallback)(
1423
1551
  async (e) => {
1424
1552
  onMessage?.(e);
1425
1553
  const data = JSON.parse(e.nativeEvent.data);
@@ -1471,7 +1599,7 @@ function useBridgeHandler({
1471
1599
 
1472
1600
  // src/hooks/useCreateUserAgent.ts
1473
1601
  var import_native_modules15 = require("@apps-in-toss/native-modules");
1474
- var import_react_native33 = require("react-native");
1602
+ var import_react_native34 = require("react-native");
1475
1603
  var FontA11yCategory = {
1476
1604
  Large: "Large",
1477
1605
  xLarge: "xLarge",
@@ -1606,7 +1734,7 @@ function useCreateUserAgent({
1606
1734
  }) {
1607
1735
  const platform = (0, import_native_modules15.getPlatformOS)();
1608
1736
  const appVersion = (0, import_native_modules15.getTossAppVersion)();
1609
- const { fontScale } = (0, import_react_native33.useWindowDimensions)();
1737
+ const { fontScale } = (0, import_react_native34.useWindowDimensions)();
1610
1738
  const platformString = platform === "ios" ? "iPhone" : "Android";
1611
1739
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
1612
1740
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
@@ -1627,12 +1755,12 @@ function useCreateUserAgent({
1627
1755
 
1628
1756
  // src/hooks/useGeolocation.ts
1629
1757
  var import_native_modules16 = require("@apps-in-toss/native-modules");
1630
- var import_react_native34 = require("@granite-js/react-native");
1631
- var import_react17 = require("react");
1758
+ var import_react_native35 = require("@granite-js/react-native");
1759
+ var import_react18 = require("react");
1632
1760
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1633
- const isVisible = (0, import_react_native34.useVisibility)();
1634
- const [location, setLocation] = (0, import_react17.useState)(null);
1635
- (0, import_react17.useEffect)(() => {
1761
+ const isVisible = (0, import_react_native35.useVisibility)();
1762
+ const [location, setLocation] = (0, import_react18.useState)(null);
1763
+ (0, import_react18.useEffect)(() => {
1636
1764
  if (!isVisible) {
1637
1765
  return;
1638
1766
  }
@@ -1649,55 +1777,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1649
1777
  return location;
1650
1778
  }
1651
1779
 
1652
- // src/utils/log.ts
1653
- var import_native_modules17 = require("@apps-in-toss/native-modules");
1654
- var import_react_native35 = require("@granite-js/react-native");
1655
-
1656
- // src/utils/extractDateFromUUIDv7.ts
1657
- var extractDateFromUUIDv7 = (uuid) => {
1658
- const timestampHex = uuid.split("-").join("").slice(0, 12);
1659
- const timestamp = Number.parseInt(timestampHex, 16);
1660
- return new Date(timestamp);
1661
- };
1662
-
1663
- // src/utils/log.ts
1664
- var getGroupId = (url) => {
1665
- try {
1666
- const urlObject = new URL(url);
1667
- return {
1668
- groupId: urlObject.pathname,
1669
- search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1670
- };
1671
- } catch {
1672
- return {
1673
- groupId: "unknown",
1674
- search: "unknown"
1675
- };
1676
- }
1677
- };
1678
- var getReferrer = () => {
1679
- try {
1680
- const referrer = new URL((0, import_react_native35.getSchemeUri)());
1681
- return referrer.searchParams.get("referrer");
1682
- } catch {
1683
- return "";
1684
- }
1685
- };
1686
- var trackScreen = (url) => {
1687
- const { groupId, search } = getGroupId(url);
1688
- const log = {
1689
- log_type: "screen",
1690
- log_name: `${groupId}::screen`,
1691
- params: {
1692
- search,
1693
- referrer: getReferrer(),
1694
- deployment_id: env.getDeploymentId(),
1695
- deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1696
- }
1697
- };
1698
- return (0, import_native_modules17.eventLog)(log);
1699
- };
1700
-
1701
1780
  // src/components/WebView.tsx
1702
1781
  var import_jsx_runtime12 = require("react/jsx-runtime");
1703
1782
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
@@ -1721,7 +1800,7 @@ function getWebViewUri(local) {
1721
1800
  const devUrl = `http://${local.host}:${local.port}`;
1722
1801
  return mergeSchemeQueryParamsInto(devUrl).toString();
1723
1802
  }
1724
- const { url: rawUrl } = import_native_modules18.AppsInTossModule.getWebBundleURL({});
1803
+ const { url: rawUrl } = import_native_modules17.AppsInTossModule.getWebBundleURL({});
1725
1804
  const url = mergeSchemeQueryParamsInto(rawUrl);
1726
1805
  const deploymentId = env.getDeploymentId();
1727
1806
  if (deploymentId) {
@@ -1734,7 +1813,7 @@ function WebView({ type, local, onMessage, ...props }) {
1734
1813
  throw new Error(`Invalid WebView type: '${type}'`);
1735
1814
  }
1736
1815
  const graniteEvent = (0, import_react_native36.useGraniteEvent)();
1737
- const uri = (0, import_react18.useMemo)(() => getWebViewUri(local), [local]);
1816
+ const uri = (0, import_react19.useMemo)(() => getWebViewUri(local), [local]);
1738
1817
  const top = (0, import_private7.useSafeAreaTop)();
1739
1818
  const bottom = (0, import_private7.useSafeAreaBottom)();
1740
1819
  const global2 = getAppsInTossGlobals();
@@ -1746,7 +1825,7 @@ function WebView({ type, local, onMessage, ...props }) {
1746
1825
  document.head.appendChild(style);
1747
1826
  })();
1748
1827
  `;
1749
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react18.useState)(
1828
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react19.useState)(
1750
1829
  props.allowsBackForwardNavigationGestures
1751
1830
  );
1752
1831
  const handler = useBridgeHandler({
@@ -1757,18 +1836,21 @@ function WebView({ type, local, onMessage, ...props }) {
1757
1836
  ...appsInTossEventBridges,
1758
1837
  navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native37.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1759
1838
  backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1760
- entryMessageExited: ({ onEvent, onError }) => import_native_modules18.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1761
- updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1839
+ entryMessageExited: ({ onEvent, onError }) => import_native_modules17.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1840
+ updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1762
1841
  /** @internal */
1763
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1842
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1764
1843
  /** AdMob */
1765
- loadAdMobInterstitialAd: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd,
1766
- showAdMobInterstitialAd: import_native_modules18.GoogleAdMob.showAdMobInterstitialAd,
1767
- loadAdMobRewardedAd: import_native_modules18.GoogleAdMob.loadAdMobRewardedAd,
1768
- showAdMobRewardedAd: import_native_modules18.GoogleAdMob.showAdMobRewardedAd,
1844
+ loadAdMobInterstitialAd: import_native_modules17.GoogleAdMob.loadAdMobInterstitialAd,
1845
+ showAdMobInterstitialAd: import_native_modules17.GoogleAdMob.showAdMobInterstitialAd,
1846
+ loadAdMobRewardedAd: import_native_modules17.GoogleAdMob.loadAdMobRewardedAd,
1847
+ showAdMobRewardedAd: import_native_modules17.GoogleAdMob.showAdMobRewardedAd,
1769
1848
  /** AdMobV2 */
1770
- loadAppsInTossAdMob: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob,
1771
- showAppsInTossAdMob: import_native_modules18.GoogleAdMob.showAppsInTossAdMob
1849
+ loadAppsInTossAdMob: import_native_modules17.GoogleAdMob.loadAppsInTossAdMob,
1850
+ showAppsInTossAdMob: import_native_modules17.GoogleAdMob.showAppsInTossAdMob,
1851
+ /** IAP */
1852
+ iapCreateOneTimePurchaseOrder: import_native_modules17.IAP.createOneTimePurchaseOrder,
1853
+ requestOneTimePurchase: import_native_modules17.requestOneTimePurchase
1772
1854
  },
1773
1855
  constantHandlerMap: {
1774
1856
  ...graniteConstantBridges,
@@ -1777,13 +1859,13 @@ function WebView({ type, local, onMessage, ...props }) {
1777
1859
  getSafeAreaBottom: () => bottom,
1778
1860
  ...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
1779
1861
  /** AdMob */
1780
- loadAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1781
- showAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.showAdMobInterstitialAd.isSupported,
1782
- loadAdMobRewardedAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobRewardedAd.isSupported,
1783
- showAdMobRewardedAd_isSupported: import_native_modules18.GoogleAdMob.showAdMobRewardedAd.isSupported,
1862
+ loadAdMobInterstitialAd_isSupported: import_native_modules17.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1863
+ showAdMobInterstitialAd_isSupported: import_native_modules17.GoogleAdMob.showAdMobInterstitialAd.isSupported,
1864
+ loadAdMobRewardedAd_isSupported: import_native_modules17.GoogleAdMob.loadAdMobRewardedAd.isSupported,
1865
+ showAdMobRewardedAd_isSupported: import_native_modules17.GoogleAdMob.showAdMobRewardedAd.isSupported,
1784
1866
  /** AdMobV2 */
1785
- loadAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob.isSupported,
1786
- showAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.showAppsInTossAdMob.isSupported,
1867
+ loadAppsInTossAdMob_isSupported: import_native_modules17.GoogleAdMob.loadAppsInTossAdMob.isSupported,
1868
+ showAppsInTossAdMob_isSupported: import_native_modules17.GoogleAdMob.showAppsInTossAdMob.isSupported,
1787
1869
  /** env */
1788
1870
  getDeploymentId: env.getDeploymentId
1789
1871
  },
@@ -1807,16 +1889,17 @@ function WebView({ type, local, onMessage, ...props }) {
1807
1889
  getCurrentLocation: appsInTossAsyncBridges.getCurrentLocation,
1808
1890
  openCamera: appsInTossAsyncBridges.openCamera,
1809
1891
  /** Storage */
1810
- getStorageItem: import_native_modules18.Storage.getItem,
1811
- setStorageItem: import_native_modules18.Storage.setItem,
1812
- removeStorageItem: import_native_modules18.Storage.removeItem,
1813
- clearItems: import_native_modules18.Storage.clearItems,
1892
+ getStorageItem: import_native_modules17.Storage.getItem,
1893
+ setStorageItem: import_native_modules17.Storage.setItem,
1894
+ removeStorageItem: import_native_modules17.Storage.removeItem,
1895
+ clearItems: import_native_modules17.Storage.clearItems,
1814
1896
  /** IAP */
1815
- iapCreateOneTimePurchaseOrder: import_native_modules18.IAP.createOneTimePurchaseOrder,
1816
- iapGetProductItemList: import_native_modules18.IAP.getProductItemList
1897
+ iapGetProductItemList: import_native_modules17.IAP.getProductItemList,
1898
+ iapCreateOneTimePurchaseOrder: import_native_modules17.iapCreateOneTimePurchaseOrder,
1899
+ processProductGrant: import_native_modules17.processProductGrant
1817
1900
  }
1818
1901
  });
1819
- const headerPropForExternalWebView = (0, import_react18.useMemo)(() => {
1902
+ const headerPropForExternalWebView = (0, import_react19.useMemo)(() => {
1820
1903
  const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1821
1904
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1822
1905
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
@@ -1833,16 +1916,6 @@ function WebView({ type, local, onMessage, ...props }) {
1833
1916
  }, [global2.navigationBar, type]);
1834
1917
  const BaseWebView = WEBVIEW_TYPES[type];
1835
1918
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1836
- const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react18.useState)(false);
1837
- const handleNavigationStateChange = (0, import_react18.useCallback)(
1838
- (event) => {
1839
- if (event.url) {
1840
- trackScreen(event.url);
1841
- }
1842
- setCanHistoryGoBack(event.canGoBack);
1843
- },
1844
- [setCanHistoryGoBack]
1845
- );
1846
1919
  const userAgent = useCreateUserAgent({
1847
1920
  colorPreference: "light"
1848
1921
  });
@@ -1864,8 +1937,6 @@ function WebView({ type, local, onMessage, ...props }) {
1864
1937
  webviewDebuggingEnabled: webViewDebuggingEnabled,
1865
1938
  thirdPartyCookiesEnabled: true,
1866
1939
  onMessage: handler.onMessage,
1867
- canHistoryGoBack,
1868
- onNavigationStateChange: handleNavigationStateChange,
1869
1940
  injectedJavaScript: handler.injectedJavaScript,
1870
1941
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
1871
1942
  decelerationRate: import_react_native38.Platform.OS === "ios" ? 1 : void 0,
package/dist/index.d.cts CHANGED
@@ -27,9 +27,7 @@ declare const AppsInToss: {
27
27
  registerApp: typeof registerApp;
28
28
  };
29
29
 
30
- type GameWebViewProps$1 = WebViewProps$1 & {
31
- canHistoryGoBack: boolean;
32
- };
30
+ type GameWebViewProps$1 = WebViewProps$1;
33
31
 
34
32
  type WebViewProps = PartnerWebViewProps | ExternalWebViewProps | GameWebViewProps;
35
33
  interface PartnerWebViewProps extends Omit<WebViewProps$1, InternalProps> {
package/dist/index.d.ts CHANGED
@@ -27,9 +27,7 @@ declare const AppsInToss: {
27
27
  registerApp: typeof registerApp;
28
28
  };
29
29
 
30
- type GameWebViewProps$1 = WebViewProps$1 & {
31
- canHistoryGoBack: boolean;
32
- };
30
+ type GameWebViewProps$1 = WebViewProps$1;
33
31
 
34
32
  type WebViewProps = PartnerWebViewProps | ExternalWebViewProps | GameWebViewProps;
35
33
  interface PartnerWebViewProps extends Omit<WebViewProps$1, InternalProps> {
package/dist/index.js CHANGED
@@ -750,7 +750,16 @@ var AppsInToss = {
750
750
  };
751
751
 
752
752
  // src/components/WebView.tsx
753
- import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInTossEvent5 } from "@apps-in-toss/native-modules";
753
+ import {
754
+ GoogleAdMob,
755
+ IAP,
756
+ Storage,
757
+ AppsInTossModule,
758
+ appsInTossEvent as appsInTossEvent3,
759
+ iapCreateOneTimePurchaseOrder,
760
+ processProductGrant,
761
+ requestOneTimePurchase
762
+ } from "@apps-in-toss/native-modules";
754
763
  import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
755
764
  import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
756
765
  import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
@@ -759,7 +768,7 @@ import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
759
768
  import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
760
769
  import { ExternalWebViewScreen, tdsEvent } from "@toss-design-system/react-native";
761
770
  import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2, useTopNavigation } from "@toss-design-system/react-native/private";
762
- import { useCallback as useCallback9, useMemo as useMemo3, useState as useState5 } from "react";
771
+ import { useMemo as useMemo4, useState as useState5 } from "react";
763
772
  import { Platform as Platform4 } from "react-native";
764
773
 
765
774
  // src/components/GameWebView.tsx
@@ -1185,22 +1194,21 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1185
1194
  });
1186
1195
 
1187
1196
  // src/components/PartnerWebView.tsx
1188
- import { appsInTossEvent as appsInTossEvent4, closeView as closeView5 } from "@apps-in-toss/native-modules";
1197
+ import { closeView as closeView5 } from "@apps-in-toss/native-modules";
1189
1198
  import {
1190
1199
  WebView as PlainWebView2
1191
1200
  } from "@granite-js/native/react-native-webview";
1192
- import { forwardRef as forwardRef2, useCallback as useCallback7, useEffect as useEffect11, useRef as useRef4 } from "react";
1201
+ import { forwardRef as forwardRef2, useCallback as useCallback8, useEffect as useEffect11, useRef as useRef4 } from "react";
1193
1202
  import { BackHandler as BackHandler3 } from "react-native";
1194
1203
 
1195
1204
  // src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
1196
- import { appsInTossEvent as appsInTossEvent3 } from "@apps-in-toss/native-modules";
1197
1205
  import { closeView as closeView4 } from "@granite-js/react-native";
1198
1206
  import { useDialog as useDialog5 } from "@toss-design-system/react-native";
1199
1207
  import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss-design-system/react-native/private";
1200
1208
  import { josa as josa4 } from "es-hangul";
1201
1209
  import { useCallback as useCallback6 } from "react";
1202
1210
  import { jsx as jsx10 } from "react/jsx-runtime";
1203
- function PartnerWebviewNavigationBar({ handleBackEvent }) {
1211
+ function PartnerWebviewNavigationBar({ handleBackEvent, handleHomeIconButtonClick }) {
1204
1212
  const globals = getAppsInTossGlobals();
1205
1213
  const { captureExitLog } = useCaptureExitLog();
1206
1214
  const logging = useNavigationBarLogging();
@@ -1212,8 +1220,8 @@ function PartnerWebviewNavigationBar({ handleBackEvent }) {
1212
1220
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1213
1221
  const handlePressTitle = useCallback6(() => {
1214
1222
  logging.homeButtonClick();
1215
- appsInTossEvent3.emit("homeIconButtonClickEvent", void 0);
1216
- }, [logging]);
1223
+ handleHomeIconButtonClick();
1224
+ }, [handleHomeIconButtonClick, logging]);
1217
1225
  const handleClose = useCallback6(async () => {
1218
1226
  logging.closeButtonClick();
1219
1227
  const isConfirmed = await openConfirm({
@@ -1258,57 +1266,186 @@ function mergeRefs(...refs) {
1258
1266
  };
1259
1267
  }
1260
1268
 
1269
+ // src/hooks/useWebviewHistoryStack.tsx
1270
+ import { useCallback as useCallback7, useMemo as useMemo2, useReducer } from "react";
1271
+ var INITIAL_STATE = { stack: [], index: -1 };
1272
+ function reducer(state, action) {
1273
+ switch (action.type) {
1274
+ case "NAVIGATION_CHANGE": {
1275
+ const { url, canGoForward } = action;
1276
+ if (state.stack.length === 0) {
1277
+ return { stack: [url], index: 0 };
1278
+ }
1279
+ const { stack, index } = state;
1280
+ const cur = stack[index];
1281
+ if (url === cur) {
1282
+ return state;
1283
+ }
1284
+ const prev = index > 0 ? stack[index - 1] : void 0;
1285
+ const next = index < stack.length - 1 ? stack[index + 1] : void 0;
1286
+ if (prev && url === prev && canGoForward) {
1287
+ return { ...state, index: index - 1 };
1288
+ }
1289
+ if (next && url === next) {
1290
+ return { ...state, index: index + 1 };
1291
+ }
1292
+ const base = stack.slice(0, index + 1);
1293
+ const nextStack = [...base, url];
1294
+ return { stack: nextStack, index: nextStack.length - 1 };
1295
+ }
1296
+ default:
1297
+ return state;
1298
+ }
1299
+ }
1300
+ function useWebViewHistory() {
1301
+ const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
1302
+ const onNavigationStateChange = useCallback7(({ url, canGoForward: canGoForward2 }) => {
1303
+ dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
1304
+ }, []);
1305
+ const { canGoBack, canGoForward } = useMemo2(() => {
1306
+ const canBack = state.index > 0;
1307
+ const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
1308
+ return { canGoBack: canBack, canGoForward: canFwd };
1309
+ }, [state.index, state.stack.length]);
1310
+ return { onNavigationStateChange, canGoBack, canGoForward };
1311
+ }
1312
+
1313
+ // src/utils/log.ts
1314
+ import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
1315
+ import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
1316
+
1317
+ // src/utils/extractDateFromUUIDv7.ts
1318
+ var extractDateFromUUIDv7 = (uuid) => {
1319
+ const timestampHex = uuid.split("-").join("").slice(0, 12);
1320
+ const timestamp = Number.parseInt(timestampHex, 16);
1321
+ return new Date(timestamp);
1322
+ };
1323
+
1324
+ // src/utils/log.ts
1325
+ var getGroupId = (url) => {
1326
+ try {
1327
+ const urlObject = new URL(url);
1328
+ return {
1329
+ groupId: urlObject.pathname,
1330
+ search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1331
+ };
1332
+ } catch {
1333
+ return {
1334
+ groupId: "unknown",
1335
+ search: "unknown"
1336
+ };
1337
+ }
1338
+ };
1339
+ var getReferrer = () => {
1340
+ try {
1341
+ const referrer = new URL(getSchemeUri4());
1342
+ return referrer.searchParams.get("referrer");
1343
+ } catch {
1344
+ return "";
1345
+ }
1346
+ };
1347
+ var trackScreen = (url) => {
1348
+ const { groupId, search } = getGroupId(url);
1349
+ const log = {
1350
+ log_type: "screen",
1351
+ log_name: `${groupId}::screen`,
1352
+ params: {
1353
+ search,
1354
+ referrer: getReferrer(),
1355
+ deployment_id: env.getDeploymentId(),
1356
+ deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1357
+ }
1358
+ };
1359
+ return eventLogNative(log);
1360
+ };
1361
+
1261
1362
  // src/components/PartnerWebView.tsx
1262
1363
  import { Fragment as Fragment8, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1263
- var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ canHistoryGoBack, ...webViewProps }, ref) {
1264
- const webViewRef = useRef4(null);
1265
- const refs = mergeRefs(ref, webViewRef);
1266
- const { captureExitLog } = useCaptureExitLog();
1267
- const handleBackEvent = useCallback7(() => {
1268
- if (canHistoryGoBack) {
1269
- webViewRef.current?.goBack();
1270
- } else {
1271
- captureExitLog(Date.now());
1272
- closeView5();
1273
- }
1274
- }, [canHistoryGoBack, captureExitLog]);
1275
- useEffect11(() => {
1276
- const handleAndroidBackEvent = () => {
1277
- if (canHistoryGoBack) {
1278
- webViewRef.current?.goBack();
1279
- return true;
1364
+ var PartnerWebView = forwardRef2(
1365
+ function PartnerWebViewScreen(webViewProps, ref) {
1366
+ const webViewRef = useRef4(null);
1367
+ const refs = mergeRefs(ref, webViewRef);
1368
+ const { captureExitLog } = useCaptureExitLog();
1369
+ const { canGoBack, onNavigationStateChange } = useWebViewHistory();
1370
+ const historyBackScript = `
1371
+ (function() {
1372
+ window.history.back();
1373
+ true;
1374
+ })();
1375
+ `;
1376
+ const historyHomeScript = `
1377
+ (function() {
1378
+ window.location.href = '/';
1379
+ true;
1380
+ })();
1381
+ `;
1382
+ const handleBackEvent = useCallback8(() => {
1383
+ if (canGoBack) {
1384
+ webViewRef.current?.injectJavaScript(historyBackScript);
1280
1385
  } else {
1281
1386
  captureExitLog(Date.now());
1282
- return false;
1387
+ closeView5();
1283
1388
  }
1284
- };
1285
- BackHandler3.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1286
- return () => BackHandler3.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1287
- }, [canHistoryGoBack, captureExitLog]);
1288
- useEffect11(() => {
1289
- return appsInTossEvent4.addEventListener("homeIconButtonClickEvent", {
1290
- onEvent: () => {
1291
- webViewRef.current?.injectJavaScript(`
1292
- (function() {
1293
- window.history.replaceState(null, '', '/');
1294
- true;
1295
- })();
1296
- `);
1297
- }
1298
- });
1299
- }, [webViewRef]);
1300
- return /* @__PURE__ */ jsxs5(Fragment8, { children: [
1301
- /* @__PURE__ */ jsx11(PartnerWebviewNavigationBar, { handleBackEvent }),
1302
- /* @__PURE__ */ jsx11(PlainWebView2, { ref: refs, ...webViewProps, style: { flex: 1 } })
1303
- ] });
1304
- });
1389
+ }, [canGoBack, captureExitLog, historyBackScript]);
1390
+ useEffect11(() => {
1391
+ const handleAndroidBackEvent = () => {
1392
+ if (canGoBack) {
1393
+ webViewRef.current?.injectJavaScript(historyBackScript);
1394
+ return true;
1395
+ } else {
1396
+ captureExitLog(Date.now());
1397
+ return false;
1398
+ }
1399
+ };
1400
+ BackHandler3.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1401
+ return () => BackHandler3.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1402
+ }, [canGoBack, captureExitLog, historyBackScript]);
1403
+ const handleHomeIconButtonClick = useCallback8(() => {
1404
+ webViewRef.current?.injectJavaScript(historyHomeScript);
1405
+ }, [historyHomeScript]);
1406
+ const handleNavigationStateChange = useCallback8(
1407
+ (event) => {
1408
+ if (event.url) {
1409
+ trackScreen(event.url);
1410
+ }
1411
+ onNavigationStateChange(event);
1412
+ },
1413
+ [onNavigationStateChange]
1414
+ );
1415
+ return /* @__PURE__ */ jsxs5(Fragment8, { children: [
1416
+ /* @__PURE__ */ jsx11(
1417
+ PartnerWebviewNavigationBar,
1418
+ {
1419
+ handleBackEvent,
1420
+ handleHomeIconButtonClick
1421
+ }
1422
+ ),
1423
+ /* @__PURE__ */ jsx11(
1424
+ PlainWebView2,
1425
+ {
1426
+ ref: refs,
1427
+ ...webViewProps,
1428
+ style: { flex: 1 },
1429
+ onNavigationStateChange: (event) => {
1430
+ webViewProps?.onNavigationStateChange?.(event);
1431
+ handleNavigationStateChange(event);
1432
+ }
1433
+ }
1434
+ )
1435
+ ] });
1436
+ }
1437
+ );
1305
1438
 
1306
1439
  // src/bridge-handler/useBridgeHandler.tsx
1307
- import { useCallback as useCallback8, useMemo as useMemo2, useRef as useRef5 } from "react";
1440
+ import { useCallback as useCallback9, useMemo as useMemo3, useRef as useRef5 } from "react";
1308
1441
  function serializeError(error) {
1309
1442
  return JSON.stringify(error, (_, value) => {
1310
1443
  if (value instanceof Error) {
1311
1444
  return {
1445
+ ...Object.entries(value).reduce((acc, [key, value2]) => {
1446
+ acc[key] = value2;
1447
+ return acc;
1448
+ }, {}),
1312
1449
  name: value.name,
1313
1450
  message: value.message,
1314
1451
  stack: value.stack,
@@ -1354,7 +1491,7 @@ function useBridgeHandler({
1354
1491
  injectedJavaScript: originalInjectedJavaScript
1355
1492
  }) {
1356
1493
  const ref = useRef5(null);
1357
- const injectedJavaScript = useMemo2(
1494
+ const injectedJavaScript = useMemo3(
1358
1495
  () => [
1359
1496
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
1360
1497
  Object.entries(constantHandlerMap).reduce(
@@ -1381,7 +1518,7 @@ function useBridgeHandler({
1381
1518
  window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
1382
1519
  `);
1383
1520
  };
1384
- const $onMessage = useCallback8(
1521
+ const $onMessage = useCallback9(
1385
1522
  async (e) => {
1386
1523
  onMessage?.(e);
1387
1524
  const data = JSON.parse(e.nativeEvent.data);
@@ -1611,55 +1748,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1611
1748
  return location;
1612
1749
  }
1613
1750
 
1614
- // src/utils/log.ts
1615
- import { eventLog as eventLogNative } from "@apps-in-toss/native-modules";
1616
- import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
1617
-
1618
- // src/utils/extractDateFromUUIDv7.ts
1619
- var extractDateFromUUIDv7 = (uuid) => {
1620
- const timestampHex = uuid.split("-").join("").slice(0, 12);
1621
- const timestamp = Number.parseInt(timestampHex, 16);
1622
- return new Date(timestamp);
1623
- };
1624
-
1625
- // src/utils/log.ts
1626
- var getGroupId = (url) => {
1627
- try {
1628
- const urlObject = new URL(url);
1629
- return {
1630
- groupId: urlObject.pathname,
1631
- search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1632
- };
1633
- } catch {
1634
- return {
1635
- groupId: "unknown",
1636
- search: "unknown"
1637
- };
1638
- }
1639
- };
1640
- var getReferrer = () => {
1641
- try {
1642
- const referrer = new URL(getSchemeUri4());
1643
- return referrer.searchParams.get("referrer");
1644
- } catch {
1645
- return "";
1646
- }
1647
- };
1648
- var trackScreen = (url) => {
1649
- const { groupId, search } = getGroupId(url);
1650
- const log = {
1651
- log_type: "screen",
1652
- log_name: `${groupId}::screen`,
1653
- params: {
1654
- search,
1655
- referrer: getReferrer(),
1656
- deployment_id: env.getDeploymentId(),
1657
- deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1658
- }
1659
- };
1660
- return eventLogNative(log);
1661
- };
1662
-
1663
1751
  // src/components/WebView.tsx
1664
1752
  import { jsx as jsx12 } from "react/jsx-runtime";
1665
1753
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
@@ -1696,7 +1784,7 @@ function WebView({ type, local, onMessage, ...props }) {
1696
1784
  throw new Error(`Invalid WebView type: '${type}'`);
1697
1785
  }
1698
1786
  const graniteEvent = useGraniteEvent();
1699
- const uri = useMemo3(() => getWebViewUri(local), [local]);
1787
+ const uri = useMemo4(() => getWebViewUri(local), [local]);
1700
1788
  const top = useSafeAreaTop2();
1701
1789
  const bottom = useSafeAreaBottom();
1702
1790
  const global2 = getAppsInTossGlobals();
@@ -1719,10 +1807,10 @@ function WebView({ type, local, onMessage, ...props }) {
1719
1807
  ...appsInTossEventBridges,
1720
1808
  navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1721
1809
  backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1722
- entryMessageExited: ({ onEvent, onError }) => appsInTossEvent5.addEventListener("entryMessageExited", { onEvent, onError }),
1723
- updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent5.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1810
+ entryMessageExited: ({ onEvent, onError }) => appsInTossEvent3.addEventListener("entryMessageExited", { onEvent, onError }),
1811
+ updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent3.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1724
1812
  /** @internal */
1725
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent5.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1813
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent3.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1726
1814
  /** AdMob */
1727
1815
  loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
1728
1816
  showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
@@ -1730,7 +1818,10 @@ function WebView({ type, local, onMessage, ...props }) {
1730
1818
  showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd,
1731
1819
  /** AdMobV2 */
1732
1820
  loadAppsInTossAdMob: GoogleAdMob.loadAppsInTossAdMob,
1733
- showAppsInTossAdMob: GoogleAdMob.showAppsInTossAdMob
1821
+ showAppsInTossAdMob: GoogleAdMob.showAppsInTossAdMob,
1822
+ /** IAP */
1823
+ iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
1824
+ requestOneTimePurchase
1734
1825
  },
1735
1826
  constantHandlerMap: {
1736
1827
  ...graniteConstantBridges,
@@ -1774,11 +1865,12 @@ function WebView({ type, local, onMessage, ...props }) {
1774
1865
  removeStorageItem: Storage.removeItem,
1775
1866
  clearItems: Storage.clearItems,
1776
1867
  /** IAP */
1777
- iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
1778
- iapGetProductItemList: IAP.getProductItemList
1868
+ iapGetProductItemList: IAP.getProductItemList,
1869
+ iapCreateOneTimePurchaseOrder,
1870
+ processProductGrant
1779
1871
  }
1780
1872
  });
1781
- const headerPropForExternalWebView = useMemo3(() => {
1873
+ const headerPropForExternalWebView = useMemo4(() => {
1782
1874
  const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1783
1875
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1784
1876
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
@@ -1795,16 +1887,6 @@ function WebView({ type, local, onMessage, ...props }) {
1795
1887
  }, [global2.navigationBar, type]);
1796
1888
  const BaseWebView = WEBVIEW_TYPES[type];
1797
1889
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1798
- const [canHistoryGoBack, setCanHistoryGoBack] = useState5(false);
1799
- const handleNavigationStateChange = useCallback9(
1800
- (event) => {
1801
- if (event.url) {
1802
- trackScreen(event.url);
1803
- }
1804
- setCanHistoryGoBack(event.canGoBack);
1805
- },
1806
- [setCanHistoryGoBack]
1807
- );
1808
1890
  const userAgent = useCreateUserAgent({
1809
1891
  colorPreference: "light"
1810
1892
  });
@@ -1826,8 +1908,6 @@ function WebView({ type, local, onMessage, ...props }) {
1826
1908
  webviewDebuggingEnabled: webViewDebuggingEnabled,
1827
1909
  thirdPartyCookiesEnabled: true,
1828
1910
  onMessage: handler.onMessage,
1829
- canHistoryGoBack,
1830
- onNavigationStateChange: handleNavigationStateChange,
1831
1911
  injectedJavaScript: handler.injectedJavaScript,
1832
1912
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
1833
1913
  decelerationRate: Platform4.OS === "ios" ? 1 : void 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -56,11 +56,11 @@
56
56
  "ait": "./bin/ait.js"
57
57
  },
58
58
  "dependencies": {
59
- "@apps-in-toss/analytics": "1.1.2",
60
- "@apps-in-toss/cli": "1.1.2",
61
- "@apps-in-toss/native-modules": "1.1.2",
62
- "@apps-in-toss/plugins": "1.1.2",
63
- "@apps-in-toss/types": "1.1.2",
59
+ "@apps-in-toss/analytics": "1.1.3",
60
+ "@apps-in-toss/cli": "1.1.3",
61
+ "@apps-in-toss/native-modules": "1.1.3",
62
+ "@apps-in-toss/plugins": "1.1.3",
63
+ "@apps-in-toss/types": "1.1.3",
64
64
  "es-hangul": "^2.3.2"
65
65
  },
66
66
  "devDependencies": {
@@ -96,5 +96,5 @@
96
96
  "publishConfig": {
97
97
  "access": "public"
98
98
  },
99
- "gitHead": "7b3c5e53a3ed0ffef8af2690a5ab92e8dfb0213b"
99
+ "gitHead": "0c80b4a0b49ec85f9f042909c7e9762c25425573"
100
100
  }