@apps-in-toss/framework 1.5.1 → 1.5.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.
Files changed (3) hide show
  1. package/dist/index.cjs +206 -250
  2. package/dist/index.js +43 -87
  3. package/package.json +8 -8
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);
@@ -1429,7 +1394,7 @@ import {
1429
1394
  GoogleAdMob,
1430
1395
  IAP,
1431
1396
  Storage,
1432
- appsInTossEvent as appsInTossEvent4,
1397
+ appsInTossEvent,
1433
1398
  iapCreateOneTimePurchaseOrder,
1434
1399
  processProductGrant,
1435
1400
  requestOneTimePurchase
@@ -1441,15 +1406,15 @@ import { useSafeAreaInsets as useSafeAreaInsets4 } from "@granite-js/native/reac
1441
1406
  import { getSchemeUri as getSchemeUri6 } 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
 
@@ -1623,7 +1580,7 @@ function convertIntentURL(url) {
1623
1580
  }
1624
1581
 
1625
1582
  // src/bridge-handler/useBridgeHandler.tsx
1626
- import { useCallback as useCallback10, useEffect as useEffect11, useMemo as useMemo3, useRef as useRef4 } from "react";
1583
+ import { useCallback as useCallback10, useEffect as useEffect10, useMemo as useMemo3, useRef as useRef4 } from "react";
1627
1584
  function serializeError(error) {
1628
1585
  return JSON.stringify(error, (_, value) => {
1629
1586
  if (value instanceof Error) {
@@ -1688,7 +1645,7 @@ function useBridgeHandler({
1688
1645
  )};`,
1689
1646
  [constantHandlerMap]
1690
1647
  );
1691
- useEffect11(() => {
1648
+ useEffect10(() => {
1692
1649
  ref.current?.injectJavaScript(injectedJavaScript);
1693
1650
  }, [injectedJavaScript]);
1694
1651
  const createHandleOnEvent = (functionName, eventId) => (response) => {
@@ -1762,7 +1719,7 @@ function parseNativeEventData(data) {
1762
1719
 
1763
1720
  // src/core/hooks/useSafeAreaInsetsEmitter.tsx
1764
1721
  import { useSafeAreaInsets as useSafeAreaInsets3 } from "@granite-js/native/react-native-safe-area-context";
1765
- import { useEffect as useEffect12, useMemo as useMemo4 } from "react";
1722
+ import { useEffect as useEffect11, useMemo as useMemo4 } from "react";
1766
1723
  var EventEmitter = class {
1767
1724
  listeners = {};
1768
1725
  on(event, listener) {
@@ -1787,7 +1744,7 @@ var EventEmitter = class {
1787
1744
  function useSafeAreaInsetsEmitter() {
1788
1745
  const insets = useSafeAreaInsets3();
1789
1746
  const emitter = useMemo4(() => new EventEmitter(), []);
1790
- useEffect12(() => {
1747
+ useEffect11(() => {
1791
1748
  emitter.emit("safeAreaInsetsChange", insets);
1792
1749
  return () => {
1793
1750
  emitter.off("safeAreaInsetsChange", (listener) => listener(insets));
@@ -2105,11 +2062,11 @@ function useCreateUserAgent({
2105
2062
  // src/hooks/useGeolocation.ts
2106
2063
  import { startUpdateLocation } from "@apps-in-toss/native-modules";
2107
2064
  import { useVisibility as useVisibility3 } from "@granite-js/react-native";
2108
- import { useEffect as useEffect13, useState as useState7 } from "react";
2065
+ import { useEffect as useEffect12, useState as useState5 } from "react";
2109
2066
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
2110
2067
  const isVisible = useVisibility3();
2111
- const [location, setLocation] = useState7(null);
2112
- useEffect13(() => {
2068
+ const [location, setLocation] = useState5(null);
2069
+ useEffect12(() => {
2113
2070
  if (!isVisible) {
2114
2071
  return;
2115
2072
  }
@@ -2258,7 +2215,7 @@ function WebView({ type, local, onMessage, ...props }) {
2258
2215
  const global2 = getAppsInTossGlobals();
2259
2216
  const navigationBarContext = useNavigationBarContext();
2260
2217
  const safeAreaInsetsEmitter = useSafeAreaInsetsEmitter();
2261
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState8(
2218
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState6(
2262
2219
  props.allowsBackForwardNavigationGestures
2263
2220
  );
2264
2221
  const handler = useBridgeHandler({
@@ -2272,8 +2229,7 @@ function WebView({ type, local, onMessage, ...props }) {
2272
2229
  webBackHandler.removeEventListener(onEvent);
2273
2230
  };
2274
2231
  },
2275
- entryMessageExited: ({ onEvent, onError }) => appsInTossEvent4.addEventListener("entryMessageExited", { onEvent, onError }),
2276
- updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2232
+ updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
2277
2233
  safeAreaInsetsChange: ({ onEvent }) => {
2278
2234
  safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
2279
2235
  return () => {
@@ -2281,7 +2237,7 @@ function WebView({ type, local, onMessage, ...props }) {
2281
2237
  };
2282
2238
  },
2283
2239
  /** @internal */
2284
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2240
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
2285
2241
  /** AdMob */
2286
2242
  loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
2287
2243
  showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
@@ -2365,7 +2321,7 @@ function WebView({ type, local, onMessage, ...props }) {
2365
2321
  colorPreference: "light"
2366
2322
  });
2367
2323
  const refs = mergeRefs(handler.ref, webViewRef);
2368
- useEffect14(() => {
2324
+ useEffect13(() => {
2369
2325
  const callback = () => {
2370
2326
  webBackHandler.handleWebBack();
2371
2327
  return true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "1.5.1",
4
+ "version": "1.5.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.5.1",
60
- "@apps-in-toss/cli": "1.5.1",
61
- "@apps-in-toss/native-modules": "1.5.1",
62
- "@apps-in-toss/plugins": "1.5.1",
63
- "@apps-in-toss/types": "1.5.1",
59
+ "@apps-in-toss/analytics": "1.5.3",
60
+ "@apps-in-toss/cli": "1.5.3",
61
+ "@apps-in-toss/native-modules": "1.5.3",
62
+ "@apps-in-toss/plugins": "1.5.3",
63
+ "@apps-in-toss/types": "1.5.3",
64
64
  "es-hangul": "^2.3.2"
65
65
  },
66
66
  "devDependencies": {
@@ -71,7 +71,7 @@
71
71
  "@granite-js/react-native": "0.1.31",
72
72
  "@granite-js/utils": "0.1.31",
73
73
  "@toss/tds-react-native": "1.3.6",
74
- "@types/kill-port": "^2.0.3",
74
+ "@types/kill-port": "2.0.1",
75
75
  "@types/react": "18.3.3",
76
76
  "es-toolkit": "^1.34.1",
77
77
  "eslint": "^9.7.0",
@@ -96,5 +96,5 @@
96
96
  "publishConfig": {
97
97
  "access": "public"
98
98
  },
99
- "gitHead": "d8574481dc9d5e72a5ed7bdd5cb77a16d776ab33"
99
+ "gitHead": "b6152cb5bd176d6fd1863ff00638b38f17269e09"
100
100
  }