@apps-in-toss/framework 1.7.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @apps-in-toss/framework
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ [[AIT-3844]: 외부 사이트에서 네비바 홈 버튼을 누르면 해당 사이트의 루트가 아닌 미니앱의 루트로 이동하도록 수정](https://github.toss.bz/toss/apps-in-toss-sdk/pull/22)
8
+
9
+ 외부 사이트에서 네비바 홈 버튼을 누르면 미니앱 루트 페이지로 이동하도록 수정합니다.
10
+
11
+ ## 1.8.0
12
+
13
+ ### Minor Changes
14
+
15
+ [[AIT-3762]: GoogleAdMob 로딩 여부 확인하는 브릿지 추가](https://github.toss.bz/toss/apps-in-toss-sdk/pull/18)
16
+
17
+ 구글 광고가 로딩되었는지 확인하는 isAdMobLoaded를 추가합니다.
18
+
19
+ ### Patch Changes
20
+
21
+ [[AP-2118] 토스애즈 integrated ad 최소 앱버전 5.244.1로 변경 - changeset 생성](https://github.toss.bz/toss/apps-in-toss-sdk/pull/21)
22
+
23
+ 토스애즈 integrated ad 최소 앱버전을 5.244.1로 변경
24
+
3
25
  ## 1.7.1
4
26
 
5
27
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1700,8 +1700,8 @@ function postEventTracking(params) {
1700
1700
 
1701
1701
  // src/ads/integratedAd.ts
1702
1702
  var INTEGRATED_AD_SDK_VERSION = "0.0.0";
1703
- var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1704
- var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1703
+ var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1704
+ var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1705
1705
  var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
1706
1706
  var INTG_AD_ADM_FALLBACK_RID_MAP = {};
1707
1707
  function integratedAdIsSupported() {
@@ -2155,19 +2155,7 @@ function useWebViewHistory() {
2155
2155
  }
2156
2156
 
2157
2157
  // src/core/hooks/useWebBackHandler.tsx
2158
- var HISTORY_BACK_SCRIPT = `
2159
- (function() {
2160
- window.history.back();
2161
- true;
2162
- })();
2163
- `;
2164
- var HISTORY_HOME_SCRIPT = `
2165
- (function() {
2166
- window.location.href = '/';
2167
- true;
2168
- })();
2169
- `;
2170
- function useWebBackHandler(webViewRef) {
2158
+ function useWebBackHandler(webViewInitialURL, webViewRef) {
2171
2159
  const { captureExitLog } = useCaptureExitLog();
2172
2160
  const { hasHistory, onNavigationStateChange } = useWebViewHistory();
2173
2161
  const {
@@ -2199,7 +2187,7 @@ function useWebBackHandler(webViewRef) {
2199
2187
  return;
2200
2188
  }
2201
2189
  if (hasHistory) {
2202
- webViewRef.current?.injectJavaScript(HISTORY_BACK_SCRIPT);
2190
+ webViewRef.current?.injectJavaScript("window.history.back();");
2203
2191
  } else {
2204
2192
  const isConfirmed = await openConfirm({
2205
2193
  title: `${(0, import_es_hangul5.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
@@ -2232,8 +2220,13 @@ function useWebBackHandler(webViewRef) {
2232
2220
  }
2233
2221
  return;
2234
2222
  }
2235
- webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
2236
- }, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
2223
+ webViewRef.current?.injectJavaScript(`
2224
+ (function() {
2225
+ const webBundleOrigin = '${webViewInitialURL.origin}';
2226
+ window.location.href = window.location.origin === webBundleOrigin ? '/' : webBundleOrigin;
2227
+ })();
2228
+ `);
2229
+ }, [hasWebBackEvent, webBackHandlersRef, logging, webViewInitialURL, webViewRef]);
2237
2230
  return (0, import_react25.useMemo)(
2238
2231
  () => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
2239
2232
  [addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
@@ -2576,10 +2569,10 @@ function mergeSchemeQueryParamsInto(url) {
2576
2569
  }
2577
2570
  return baseUrl;
2578
2571
  }
2579
- function getWebViewUri(local) {
2572
+ function getWebViewURL(local) {
2580
2573
  if (__DEV__) {
2581
2574
  const devUrl = `http://${local.host}:${local.port}`;
2582
- return mergeSchemeQueryParamsInto(devUrl).toString();
2575
+ return mergeSchemeQueryParamsInto(devUrl);
2583
2576
  }
2584
2577
  const { url: rawUrl } = import_native_modules23.AppsInTossModule.getWebBundleURL({});
2585
2578
  const url = mergeSchemeQueryParamsInto(rawUrl);
@@ -2587,15 +2580,15 @@ function getWebViewUri(local) {
2587
2580
  if (deploymentId) {
2588
2581
  url.searchParams.set("_deploymentId", deploymentId);
2589
2582
  }
2590
- return url.toString();
2583
+ return url;
2591
2584
  }
2592
2585
  function WebView({ type, local, onMessage, ...props }) {
2593
2586
  if (!TYPES.includes(type)) {
2594
2587
  throw new Error(`Invalid WebView type: '${type}'`);
2595
2588
  }
2596
2589
  const webViewRef = (0, import_react28.useRef)(null);
2597
- const webBackHandler = useWebBackHandler(webViewRef);
2598
- const uri = (0, import_react28.useMemo)(() => getWebViewUri(local), [local]);
2590
+ const url = (0, import_react28.useMemo)(() => getWebViewURL(local), [local]);
2591
+ const webBackHandler = useWebBackHandler(url, webViewRef);
2599
2592
  const top = (0, import_private9.useSafeAreaTop)();
2600
2593
  const bottom = (0, import_private9.useSafeAreaBottom)();
2601
2594
  const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
@@ -2649,6 +2642,7 @@ function WebView({ type, local, onMessage, ...props }) {
2649
2642
  /** AdMobV2 */
2650
2643
  loadAppsInTossAdMob_isSupported: import_native_modules23.GoogleAdMob.loadAppsInTossAdMob.isSupported,
2651
2644
  showAppsInTossAdMob_isSupported: import_native_modules23.GoogleAdMob.showAppsInTossAdMob.isSupported,
2645
+ isAppsInTossAdMobLoaded_isSupported: import_native_modules23.GoogleAdMob.isAppsInTossAdMobLoaded.isSupported,
2652
2646
  /** IntegratedAd */
2653
2647
  loadFullScreenAd_isSupported: loadFullScreenAdForWeb.isSupported,
2654
2648
  showFullScreenAd_isSupported: showFullScreenAd.isSupported,
@@ -2687,6 +2681,8 @@ function WebView({ type, local, onMessage, ...props }) {
2687
2681
  getPendingOrders: import_native_modules23.IAP.getPendingOrders,
2688
2682
  getCompletedOrRefundedOrders: import_native_modules23.IAP.getCompletedOrRefundedOrders,
2689
2683
  completeProductGrant: import_native_modules23.IAP.completeProductGrant,
2684
+ /** AdMobV2 */
2685
+ isAppsInTossAdMobLoaded: import_native_modules23.GoogleAdMob.isAppsInTossAdMobLoaded,
2690
2686
  /** Toss Ads */
2691
2687
  tossAdEventLog,
2692
2688
  /** Private */
@@ -2731,7 +2727,7 @@ function WebView({ type, local, onMessage, ...props }) {
2731
2727
  ...props,
2732
2728
  ...headerPropForExternalWebView,
2733
2729
  source: {
2734
- uri,
2730
+ uri: url.href,
2735
2731
  // NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
2736
2732
  headers: {
2737
2733
  "User-Agent": userAgent
@@ -2757,11 +2753,11 @@ function WebView({ type, local, onMessage, ...props }) {
2757
2753
  allowsBackForwardNavigationGestures,
2758
2754
  onShouldStartLoadWithRequest: (event) => {
2759
2755
  try {
2760
- const url = new URL(event.url);
2761
- if (["https:", "http:"].includes(url.protocol) || url.href === "about:blank") {
2756
+ const url2 = new URL(event.url);
2757
+ if (["https:", "http:"].includes(url2.protocol) || url2.href === "about:blank") {
2762
2758
  return true;
2763
2759
  } else {
2764
- import_react_native39.Linking.openURL(convertIntentURL(url) ?? url.href);
2760
+ import_react_native39.Linking.openURL(convertIntentURL(url2) ?? url2.href);
2765
2761
  return false;
2766
2762
  }
2767
2763
  } catch (error) {
package/dist/index.js CHANGED
@@ -1687,8 +1687,8 @@ function postEventTracking(params) {
1687
1687
 
1688
1688
  // src/ads/integratedAd.ts
1689
1689
  var INTEGRATED_AD_SDK_VERSION = "0.0.0";
1690
- var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1691
- var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
1690
+ var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1691
+ var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1692
1692
  var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
1693
1693
  var INTG_AD_ADM_FALLBACK_RID_MAP = {};
1694
1694
  function integratedAdIsSupported() {
@@ -2142,19 +2142,7 @@ function useWebViewHistory() {
2142
2142
  }
2143
2143
 
2144
2144
  // src/core/hooks/useWebBackHandler.tsx
2145
- var HISTORY_BACK_SCRIPT = `
2146
- (function() {
2147
- window.history.back();
2148
- true;
2149
- })();
2150
- `;
2151
- var HISTORY_HOME_SCRIPT = `
2152
- (function() {
2153
- window.location.href = '/';
2154
- true;
2155
- })();
2156
- `;
2157
- function useWebBackHandler(webViewRef) {
2145
+ function useWebBackHandler(webViewInitialURL, webViewRef) {
2158
2146
  const { captureExitLog } = useCaptureExitLog();
2159
2147
  const { hasHistory, onNavigationStateChange } = useWebViewHistory();
2160
2148
  const {
@@ -2186,7 +2174,7 @@ function useWebBackHandler(webViewRef) {
2186
2174
  return;
2187
2175
  }
2188
2176
  if (hasHistory) {
2189
- webViewRef.current?.injectJavaScript(HISTORY_BACK_SCRIPT);
2177
+ webViewRef.current?.injectJavaScript("window.history.back();");
2190
2178
  } else {
2191
2179
  const isConfirmed = await openConfirm({
2192
2180
  title: `${josa5(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
@@ -2219,8 +2207,13 @@ function useWebBackHandler(webViewRef) {
2219
2207
  }
2220
2208
  return;
2221
2209
  }
2222
- webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
2223
- }, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
2210
+ webViewRef.current?.injectJavaScript(`
2211
+ (function() {
2212
+ const webBundleOrigin = '${webViewInitialURL.origin}';
2213
+ window.location.href = window.location.origin === webBundleOrigin ? '/' : webBundleOrigin;
2214
+ })();
2215
+ `);
2216
+ }, [hasWebBackEvent, webBackHandlersRef, logging, webViewInitialURL, webViewRef]);
2224
2217
  return useMemo6(
2225
2218
  () => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
2226
2219
  [addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
@@ -2563,10 +2556,10 @@ function mergeSchemeQueryParamsInto(url) {
2563
2556
  }
2564
2557
  return baseUrl;
2565
2558
  }
2566
- function getWebViewUri(local) {
2559
+ function getWebViewURL(local) {
2567
2560
  if (__DEV__) {
2568
2561
  const devUrl = `http://${local.host}:${local.port}`;
2569
- return mergeSchemeQueryParamsInto(devUrl).toString();
2562
+ return mergeSchemeQueryParamsInto(devUrl);
2570
2563
  }
2571
2564
  const { url: rawUrl } = AppsInTossModule.getWebBundleURL({});
2572
2565
  const url = mergeSchemeQueryParamsInto(rawUrl);
@@ -2574,15 +2567,15 @@ function getWebViewUri(local) {
2574
2567
  if (deploymentId) {
2575
2568
  url.searchParams.set("_deploymentId", deploymentId);
2576
2569
  }
2577
- return url.toString();
2570
+ return url;
2578
2571
  }
2579
2572
  function WebView({ type, local, onMessage, ...props }) {
2580
2573
  if (!TYPES.includes(type)) {
2581
2574
  throw new Error(`Invalid WebView type: '${type}'`);
2582
2575
  }
2583
2576
  const webViewRef = useRef6(null);
2584
- const webBackHandler = useWebBackHandler(webViewRef);
2585
- const uri = useMemo7(() => getWebViewUri(local), [local]);
2577
+ const url = useMemo7(() => getWebViewURL(local), [local]);
2578
+ const webBackHandler = useWebBackHandler(url, webViewRef);
2586
2579
  const top = useSafeAreaTop3();
2587
2580
  const bottom = useSafeAreaBottom();
2588
2581
  const insets = useSafeAreaInsets4();
@@ -2636,6 +2629,7 @@ function WebView({ type, local, onMessage, ...props }) {
2636
2629
  /** AdMobV2 */
2637
2630
  loadAppsInTossAdMob_isSupported: GoogleAdMob2.loadAppsInTossAdMob.isSupported,
2638
2631
  showAppsInTossAdMob_isSupported: GoogleAdMob2.showAppsInTossAdMob.isSupported,
2632
+ isAppsInTossAdMobLoaded_isSupported: GoogleAdMob2.isAppsInTossAdMobLoaded.isSupported,
2639
2633
  /** IntegratedAd */
2640
2634
  loadFullScreenAd_isSupported: loadFullScreenAdForWeb.isSupported,
2641
2635
  showFullScreenAd_isSupported: showFullScreenAd.isSupported,
@@ -2674,6 +2668,8 @@ function WebView({ type, local, onMessage, ...props }) {
2674
2668
  getPendingOrders: IAP.getPendingOrders,
2675
2669
  getCompletedOrRefundedOrders: IAP.getCompletedOrRefundedOrders,
2676
2670
  completeProductGrant: IAP.completeProductGrant,
2671
+ /** AdMobV2 */
2672
+ isAppsInTossAdMobLoaded: GoogleAdMob2.isAppsInTossAdMobLoaded,
2677
2673
  /** Toss Ads */
2678
2674
  tossAdEventLog,
2679
2675
  /** Private */
@@ -2718,7 +2714,7 @@ function WebView({ type, local, onMessage, ...props }) {
2718
2714
  ...props,
2719
2715
  ...headerPropForExternalWebView,
2720
2716
  source: {
2721
- uri,
2717
+ uri: url.href,
2722
2718
  // NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
2723
2719
  headers: {
2724
2720
  "User-Agent": userAgent
@@ -2744,11 +2740,11 @@ function WebView({ type, local, onMessage, ...props }) {
2744
2740
  allowsBackForwardNavigationGestures,
2745
2741
  onShouldStartLoadWithRequest: (event) => {
2746
2742
  try {
2747
- const url = new URL(event.url);
2748
- if (["https:", "http:"].includes(url.protocol) || url.href === "about:blank") {
2743
+ const url2 = new URL(event.url);
2744
+ if (["https:", "http:"].includes(url2.protocol) || url2.href === "about:blank") {
2749
2745
  return true;
2750
2746
  } else {
2751
- Linking.openURL(convertIntentURL(url) ?? url.href);
2747
+ Linking.openURL(convertIntentURL(url2) ?? url2.href);
2752
2748
  return false;
2753
2749
  }
2754
2750
  } catch (error) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "1.7.1",
4
+ "version": "1.8.1",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit",
@@ -55,11 +55,11 @@
55
55
  "ait": "./bin/ait.js"
56
56
  },
57
57
  "dependencies": {
58
- "@apps-in-toss/analytics": "1.7.1",
59
- "@apps-in-toss/cli": "1.7.1",
60
- "@apps-in-toss/native-modules": "1.7.1",
61
- "@apps-in-toss/plugins": "1.7.1",
62
- "@apps-in-toss/types": "1.7.1",
58
+ "@apps-in-toss/analytics": "1.8.1",
59
+ "@apps-in-toss/cli": "1.8.1",
60
+ "@apps-in-toss/native-modules": "1.8.1",
61
+ "@apps-in-toss/plugins": "1.8.1",
62
+ "@apps-in-toss/types": "1.8.1",
63
63
  "es-hangul": "^2.3.2"
64
64
  },
65
65
  "devDependencies": {