@apps-in-toss/framework 1.5.0 → 1.5.2

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
@@ -1281,6 +1281,7 @@ function DefaultNavigationBar() {
1281
1281
  onPressClose: navigationEvent.handleCloseButtonClick,
1282
1282
  withHome: withHomeButton,
1283
1283
  fixedRightButton: navigationRightButton,
1284
+ leftVisible: withBackButton,
1284
1285
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_private5.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_private5.NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
1285
1286
  }
1286
1287
  ) });
@@ -1608,6 +1609,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1608
1609
  onPressClose: handleClose,
1609
1610
  withHome: withHomeButton,
1610
1611
  fixedRightButton: navigationRightButton,
1612
+ leftVisible: withBackButton,
1611
1613
  children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_private8.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_private8.NavigationBackButton, { onPress: onBackButtonClick, canGoBack: false }) })
1612
1614
  }
1613
1615
  ) });
@@ -1622,6 +1624,19 @@ var PartnerWebView = (0, import_react22.forwardRef)(function PartnerWebViewScree
1622
1624
  ] });
1623
1625
  });
1624
1626
 
1627
+ // src/components/utils/url.ts
1628
+ function convertIntentURL(url) {
1629
+ if (url.protocol !== "intent:") {
1630
+ return null;
1631
+ }
1632
+ const components = url.hash.replace("#Intent;", "").split(";").map((component) => component.split("="));
1633
+ const scheme = components.find(([key]) => key === "scheme")?.[1];
1634
+ if (!scheme) {
1635
+ return null;
1636
+ }
1637
+ return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
1638
+ }
1639
+
1625
1640
  // src/bridge-handler/useBridgeHandler.tsx
1626
1641
  var import_react23 = require("react");
1627
1642
  function serializeError(error) {
@@ -2087,6 +2102,7 @@ function useCreateUserAgent({
2087
2102
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
2088
2103
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
2089
2104
  return [
2105
+ "AppsInToss",
2090
2106
  `TossApp/${appVersion}`,
2091
2107
  batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
2092
2108
  colorPreference && `TossColorPreference/${colorPreference}`,
@@ -2262,7 +2278,6 @@ function WebView({ type, local, onMessage, ...props }) {
2262
2278
  );
2263
2279
  const handler = useBridgeHandler({
2264
2280
  onMessage,
2265
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2266
2281
  eventListenerMap: {
2267
2282
  ...appsInTossEventBridges,
2268
2283
  navigationAccessoryEvent: ({ onEvent, onError }) => import_tds_react_native15.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
@@ -2404,7 +2419,22 @@ function WebView({ type, local, onMessage, ...props }) {
2404
2419
  injectedJavaScript: globalScripts.afterLoad,
2405
2420
  injectedJavaScriptBeforeContentLoaded: mergeScripts(handler.injectedJavaScript, globalScripts.beforeLoad),
2406
2421
  decelerationRate: import_react_native35.Platform.OS === "ios" ? 1 : void 0,
2407
- allowsBackForwardNavigationGestures
2422
+ allowsBackForwardNavigationGestures,
2423
+ onShouldStartLoadWithRequest: (event) => {
2424
+ try {
2425
+ const url = new URL(event.url);
2426
+ if (["https:", "http:"].includes(url.protocol)) {
2427
+ return true;
2428
+ } else {
2429
+ import_react_native35.Linking.openURL(convertIntentURL(url) ?? url.href);
2430
+ return false;
2431
+ }
2432
+ } catch (error) {
2433
+ console.error(error);
2434
+ return false;
2435
+ }
2436
+ },
2437
+ originWhitelist: ["https://*", "http://*", "intoss://*", "intoss-private://*", "servicetoss://*", "supertoss://*", "intent://*"]
2408
2438
  }
2409
2439
  );
2410
2440
  }
package/dist/index.js CHANGED
@@ -1250,6 +1250,7 @@ function DefaultNavigationBar() {
1250
1250
  onPressClose: navigationEvent.handleCloseButtonClick,
1251
1251
  withHome: withHomeButton,
1252
1252
  fixedRightButton: navigationRightButton,
1253
+ leftVisible: withBackButton,
1253
1254
  children: /* @__PURE__ */ jsx10(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx10(NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
1254
1255
  }
1255
1256
  ) });
@@ -1441,7 +1442,7 @@ import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
1441
1442
  import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
1442
1443
  import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3 } from "@toss/tds-react-native/private";
1443
1444
  import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef6, useState as useState8 } from "react";
1444
- import { BackHandler as BackHandler2, Platform as Platform6 } from "react-native";
1445
+ import { BackHandler as BackHandler2, Linking, Platform as Platform6 } from "react-native";
1445
1446
 
1446
1447
  // src/components/GameWebView.tsx
1447
1448
  import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment as getOperationalEnvironment4 } from "@apps-in-toss/native-modules";
@@ -1593,6 +1594,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
1593
1594
  onPressClose: handleClose,
1594
1595
  withHome: withHomeButton,
1595
1596
  fixedRightButton: navigationRightButton,
1597
+ leftVisible: withBackButton,
1596
1598
  children: /* @__PURE__ */ jsx16(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx16(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
1597
1599
  }
1598
1600
  ) });
@@ -1607,6 +1609,19 @@ var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ onBackButtonCli
1607
1609
  ] });
1608
1610
  });
1609
1611
 
1612
+ // src/components/utils/url.ts
1613
+ function convertIntentURL(url) {
1614
+ if (url.protocol !== "intent:") {
1615
+ return null;
1616
+ }
1617
+ const components = url.hash.replace("#Intent;", "").split(";").map((component) => component.split("="));
1618
+ const scheme = components.find(([key]) => key === "scheme")?.[1];
1619
+ if (!scheme) {
1620
+ return null;
1621
+ }
1622
+ return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
1623
+ }
1624
+
1610
1625
  // src/bridge-handler/useBridgeHandler.tsx
1611
1626
  import { useCallback as useCallback10, useEffect as useEffect11, useMemo as useMemo3, useRef as useRef4 } from "react";
1612
1627
  function serializeError(error) {
@@ -2072,6 +2087,7 @@ function useCreateUserAgent({
2072
2087
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
2073
2088
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
2074
2089
  return [
2090
+ "AppsInToss",
2075
2091
  `TossApp/${appVersion}`,
2076
2092
  batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
2077
2093
  colorPreference && `TossColorPreference/${colorPreference}`,
@@ -2247,7 +2263,6 @@ function WebView({ type, local, onMessage, ...props }) {
2247
2263
  );
2248
2264
  const handler = useBridgeHandler({
2249
2265
  onMessage,
2250
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2251
2266
  eventListenerMap: {
2252
2267
  ...appsInTossEventBridges,
2253
2268
  navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
@@ -2389,7 +2404,22 @@ function WebView({ type, local, onMessage, ...props }) {
2389
2404
  injectedJavaScript: globalScripts.afterLoad,
2390
2405
  injectedJavaScriptBeforeContentLoaded: mergeScripts(handler.injectedJavaScript, globalScripts.beforeLoad),
2391
2406
  decelerationRate: Platform6.OS === "ios" ? 1 : void 0,
2392
- allowsBackForwardNavigationGestures
2407
+ allowsBackForwardNavigationGestures,
2408
+ onShouldStartLoadWithRequest: (event) => {
2409
+ try {
2410
+ const url = new URL(event.url);
2411
+ if (["https:", "http:"].includes(url.protocol)) {
2412
+ return true;
2413
+ } else {
2414
+ Linking.openURL(convertIntentURL(url) ?? url.href);
2415
+ return false;
2416
+ }
2417
+ } catch (error) {
2418
+ console.error(error);
2419
+ return false;
2420
+ }
2421
+ },
2422
+ originWhitelist: ["https://*", "http://*", "intoss://*", "intoss-private://*", "servicetoss://*", "supertoss://*", "intent://*"]
2393
2423
  }
2394
2424
  );
2395
2425
  }
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.0",
4
+ "version": "1.5.2",
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.0",
60
- "@apps-in-toss/cli": "1.5.0",
61
- "@apps-in-toss/native-modules": "1.5.0",
62
- "@apps-in-toss/plugins": "1.5.0",
63
- "@apps-in-toss/types": "1.5.0",
59
+ "@apps-in-toss/analytics": "1.5.2",
60
+ "@apps-in-toss/cli": "1.5.2",
61
+ "@apps-in-toss/native-modules": "1.5.2",
62
+ "@apps-in-toss/plugins": "1.5.2",
63
+ "@apps-in-toss/types": "1.5.2",
64
64
  "es-hangul": "^2.3.2"
65
65
  },
66
66
  "devDependencies": {
@@ -70,8 +70,8 @@
70
70
  "@granite-js/plugin-core": "0.1.31",
71
71
  "@granite-js/react-native": "0.1.31",
72
72
  "@granite-js/utils": "0.1.31",
73
- "@toss/tds-react-native": "^1.3.4",
74
- "@types/kill-port": "^2.0.3",
73
+ "@toss/tds-react-native": "1.3.6",
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",
@@ -88,7 +88,7 @@
88
88
  "peerDependencies": {
89
89
  "@granite-js/native": "*",
90
90
  "@granite-js/react-native": "*",
91
- "@toss/tds-react-native": ">=1.3.4",
91
+ "@toss/tds-react-native": ">=1.3.6",
92
92
  "@types/react": "*",
93
93
  "react": "*",
94
94
  "react-native": "*"
@@ -96,5 +96,5 @@
96
96
  "publishConfig": {
97
97
  "access": "public"
98
98
  },
99
- "gitHead": "80e646a4924c5d91fce00b30ec1a43075853cadc"
99
+ "gitHead": "8224b90876f7d9e0feac0cd38ef80be42a5d784f"
100
100
  }