@apps-in-toss/framework 2.4.0 → 2.4.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
@@ -1661,6 +1661,15 @@ var import_native_modules16 = require("@apps-in-toss/native-modules");
1661
1661
  function noop() {
1662
1662
  }
1663
1663
 
1664
+ // src/ads/adGroupId.ts
1665
+ var INVALID_AD_GROUP_ID_ERROR_MESSAGE = "\uC798\uBABB\uB41C \uC694\uCCAD\uC774\uC5D0\uC694. \uD544\uC694\uD55C \uAC12\uC774 \uBE44\uC5B4 \uC788\uC5B4\uC694.";
1666
+ function normalizeAdGroupId(adGroupId) {
1667
+ return adGroupId.trim();
1668
+ }
1669
+ function createInvalidAdGroupIdError() {
1670
+ return new Error(INVALID_AD_GROUP_ID_ERROR_MESSAGE);
1671
+ }
1672
+
1664
1673
  // src/ads/generateSessionId.ts
1665
1674
  function generateSessionId() {
1666
1675
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -1684,7 +1693,11 @@ function fetchTossAd(params) {
1684
1693
  return noop;
1685
1694
  }
1686
1695
  const { onEvent, onError, options } = params;
1687
- const { adGroupId } = options;
1696
+ const adGroupId = normalizeAdGroupId(options.adGroupId);
1697
+ if (adGroupId.length === 0) {
1698
+ params.onError(createInvalidAdGroupIdError());
1699
+ return noop;
1700
+ }
1688
1701
  const unregisterCallbacks = import_native_modules16.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
1689
1702
  "fetchTossAd",
1690
1703
  { spaceUnitId: adGroupId, sessionId, sdkId: options.sdkId, availableStyleIds: options.availableStyleIds },
@@ -1775,8 +1788,8 @@ function postEventTracking(params) {
1775
1788
 
1776
1789
  // src/ads/integratedAd.ts
1777
1790
  var INTEGRATED_AD_SDK_VERSION = "0.0.0";
1778
- var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1779
- var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1791
+ var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
1792
+ var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
1780
1793
  var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
1781
1794
  var INTG_AD_ADM_FALLBACK_RID_MAP = {};
1782
1795
  function integratedAdIsSupported() {
@@ -1791,16 +1804,28 @@ function generateLoadFullScreenAd(sdkId) {
1791
1804
  params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1792
1805
  return noop;
1793
1806
  }
1807
+ const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
1808
+ if (normalizedAdGroupId.length === 0) {
1809
+ params.onError(createInvalidAdGroupIdError());
1810
+ return noop;
1811
+ }
1812
+ const normalizedParams = {
1813
+ ...params,
1814
+ options: {
1815
+ ...params.options,
1816
+ adGroupId: normalizedAdGroupId
1817
+ }
1818
+ };
1794
1819
  if (!integratedAdIsSupported()) {
1795
1820
  return import_native_modules18.GoogleAdMob.loadAppsInTossAdMob({
1796
- ...params,
1821
+ ...normalizedParams,
1797
1822
  onEvent: (event) => {
1798
1823
  if (event.type === "loaded") {
1799
1824
  const requestId = generateRequestId();
1800
- INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] = requestId;
1825
+ INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] = requestId;
1801
1826
  postEventTracking({
1802
1827
  eventName: "LOAD",
1803
- spaceUnitId: params.options.adGroupId,
1828
+ spaceUnitId: normalizedAdGroupId,
1804
1829
  requestId,
1805
1830
  responseId: event.data.responseInfo.responseId,
1806
1831
  mediationType: "ADMOB",
@@ -1809,13 +1834,13 @@ function generateLoadFullScreenAd(sdkId) {
1809
1834
  sdkVer: INTEGRATED_AD_SDK_VERSION
1810
1835
  });
1811
1836
  }
1812
- return params.onEvent(event);
1837
+ return normalizedParams.onEvent(event);
1813
1838
  },
1814
1839
  onError: (error) => {
1815
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1840
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
1816
1841
  postEventTracking({
1817
1842
  eventName: "FAILED_TO_LOAD",
1818
- spaceUnitId: params.options.adGroupId,
1843
+ spaceUnitId: normalizedAdGroupId,
1819
1844
  requestId,
1820
1845
  responseId: "",
1821
1846
  mediationType: "ADMOB",
@@ -1823,11 +1848,11 @@ function generateLoadFullScreenAd(sdkId) {
1823
1848
  adSourceName: "",
1824
1849
  sdkVer: INTEGRATED_AD_SDK_VERSION
1825
1850
  });
1826
- return params.onError(error);
1851
+ return normalizedParams.onError(error);
1827
1852
  }
1828
1853
  });
1829
1854
  }
1830
- const { onEvent, onError, options } = params;
1855
+ const { onEvent, onError, options } = normalizedParams;
1831
1856
  const { adGroupId } = options;
1832
1857
  const referrer = getReferrer();
1833
1858
  const unregisterCallbacks = import_native_modules18.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
@@ -1854,16 +1879,28 @@ function showFullScreenAd(params) {
1854
1879
  params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1855
1880
  return noop;
1856
1881
  }
1882
+ const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
1883
+ if (normalizedAdGroupId.length === 0) {
1884
+ params.onError(createInvalidAdGroupIdError());
1885
+ return noop;
1886
+ }
1887
+ const normalizedParams = {
1888
+ ...params,
1889
+ options: {
1890
+ ...params.options,
1891
+ adGroupId: normalizedAdGroupId
1892
+ }
1893
+ };
1857
1894
  if (!integratedAdIsSupported()) {
1858
1895
  return import_native_modules18.GoogleAdMob.showAppsInTossAdMob({
1859
- ...params,
1896
+ ...normalizedParams,
1860
1897
  onEvent: (event) => {
1861
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1898
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
1862
1899
  switch (event.type) {
1863
1900
  case "show":
1864
1901
  postEventTracking({
1865
1902
  eventName: "SHOW",
1866
- spaceUnitId: params.options.adGroupId,
1903
+ spaceUnitId: normalizedAdGroupId,
1867
1904
  requestId,
1868
1905
  responseId: "",
1869
1906
  mediationType: "ADMOB",
@@ -1875,7 +1912,7 @@ function showFullScreenAd(params) {
1875
1912
  case "failedToShow":
1876
1913
  postEventTracking({
1877
1914
  eventName: "FAILED_TO_SHOW",
1878
- spaceUnitId: params.options.adGroupId,
1915
+ spaceUnitId: normalizedAdGroupId,
1879
1916
  requestId,
1880
1917
  responseId: "",
1881
1918
  mediationType: "ADMOB",
@@ -1887,7 +1924,7 @@ function showFullScreenAd(params) {
1887
1924
  case "impression":
1888
1925
  postEventTracking({
1889
1926
  eventName: "IMP",
1890
- spaceUnitId: params.options.adGroupId,
1927
+ spaceUnitId: normalizedAdGroupId,
1891
1928
  requestId,
1892
1929
  responseId: "",
1893
1930
  mediationType: "ADMOB",
@@ -1899,7 +1936,7 @@ function showFullScreenAd(params) {
1899
1936
  case "clicked":
1900
1937
  postEventTracking({
1901
1938
  eventName: "CLICK",
1902
- spaceUnitId: params.options.adGroupId,
1939
+ spaceUnitId: normalizedAdGroupId,
1903
1940
  requestId,
1904
1941
  responseId: "",
1905
1942
  mediationType: "ADMOB",
@@ -1911,7 +1948,7 @@ function showFullScreenAd(params) {
1911
1948
  case "dismissed":
1912
1949
  postEventTracking({
1913
1950
  eventName: "DISMISS",
1914
- spaceUnitId: params.options.adGroupId,
1951
+ spaceUnitId: normalizedAdGroupId,
1915
1952
  requestId,
1916
1953
  responseId: "",
1917
1954
  mediationType: "ADMOB",
@@ -1923,7 +1960,7 @@ function showFullScreenAd(params) {
1923
1960
  case "userEarnedReward":
1924
1961
  postEventTracking({
1925
1962
  eventName: "USER_EARNED_REWARD",
1926
- spaceUnitId: params.options.adGroupId,
1963
+ spaceUnitId: normalizedAdGroupId,
1927
1964
  requestId,
1928
1965
  responseId: "",
1929
1966
  mediationType: "ADMOB",
@@ -1933,13 +1970,13 @@ function showFullScreenAd(params) {
1933
1970
  });
1934
1971
  break;
1935
1972
  }
1936
- return params.onEvent(event);
1973
+ return normalizedParams.onEvent(event);
1937
1974
  },
1938
1975
  onError: (error) => {
1939
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1976
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
1940
1977
  postEventTracking({
1941
1978
  eventName: "FAILED_TO_SHOW",
1942
- spaceUnitId: params.options.adGroupId,
1979
+ spaceUnitId: normalizedAdGroupId,
1943
1980
  requestId,
1944
1981
  responseId: "",
1945
1982
  mediationType: "ADMOB",
@@ -1947,11 +1984,11 @@ function showFullScreenAd(params) {
1947
1984
  adSourceName: "",
1948
1985
  sdkVer: INTEGRATED_AD_SDK_VERSION
1949
1986
  });
1950
- return params.onError(error);
1987
+ return normalizedParams.onError(error);
1951
1988
  }
1952
1989
  });
1953
1990
  }
1954
- const { onEvent, onError, options } = params;
1991
+ const { onEvent, onError, options } = normalizedParams;
1955
1992
  const { adGroupId } = options;
1956
1993
  const referrer = getReferrer();
1957
1994
  const unregisterCallbacks = import_native_modules18.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
@@ -3038,10 +3075,11 @@ function isStructurallyValidAd(ad) {
3038
3075
  return Boolean(ad && ad.creative && typeof ad.creative === "object");
3039
3076
  }
3040
3077
  async function loadAd(adGroupId) {
3041
- if (!adGroupId) {
3078
+ const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
3079
+ if (normalizedAdGroupId.length === 0) {
3042
3080
  return {
3043
3081
  type: "error",
3044
- error: createError(ERROR_CODES.INVALID_SPACE, "Invalid adGroupId - adGroupId must be provided")
3082
+ error: createError(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE)
3045
3083
  };
3046
3084
  }
3047
3085
  if (!fetchTossAd.isSupported()) {
@@ -3053,7 +3091,7 @@ async function loadAd(adGroupId) {
3053
3091
  let response;
3054
3092
  try {
3055
3093
  const raw = await fetchTossAdPromise({
3056
- adGroupId,
3094
+ adGroupId: normalizedAdGroupId,
3057
3095
  sdkId: SDK_ID,
3058
3096
  availableStyleIds: AVAILABLE_STYLE_IDS
3059
3097
  });
@@ -3860,35 +3898,35 @@ function InlineAd(props) {
3860
3898
  };
3861
3899
  }, []);
3862
3900
  (0, import_react31.useEffect)(() => {
3901
+ const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
3863
3902
  const loadAdRequest = () => {
3864
3903
  if (loadingRef.current) {
3865
3904
  return;
3866
3905
  }
3867
- if (!adGroupId) {
3868
- const error = createError2(
3869
- ERROR_CODES.INVALID_SPACE,
3870
- `${ERROR_MESSAGES[ERROR_CODES.INVALID_SPACE]} - adGroupId must be provided`
3906
+ if (normalizedAdGroupId.length === 0) {
3907
+ const error = createError2(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE);
3908
+ callbacksRef.current.onAdFailedToRender?.(
3909
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, error)
3871
3910
  );
3872
- callbacksRef.current.onAdFailedToRender?.(buildBannerErrorPayload(slotIdRef.current, adGroupId, error));
3873
3911
  return;
3874
3912
  }
3875
3913
  loadingRef.current = true;
3876
- loadAd(adGroupId).then((result) => {
3914
+ loadAd(normalizedAdGroupId).then((result) => {
3877
3915
  if (!isMountedRef.current) return;
3878
3916
  if (result.type === "noFill") {
3879
- callbacksRef.current.onNoFill?.(buildNoFillPayload(slotIdRef.current, adGroupId));
3917
+ callbacksRef.current.onNoFill?.(buildNoFillPayload(slotIdRef.current, normalizedAdGroupId));
3880
3918
  return;
3881
3919
  }
3882
3920
  if (result.type === "error") {
3883
3921
  callbacksRef.current.onAdFailedToRender?.(
3884
- buildBannerErrorPayload(slotIdRef.current, adGroupId, result.error)
3922
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, result.error)
3885
3923
  );
3886
3924
  return;
3887
3925
  }
3888
3926
  if (!isValidCreative(result.ad)) {
3889
3927
  const invalidError = createError2(ERROR_CODES.INTERNAL_ERROR, "Invalid creative payload");
3890
3928
  callbacksRef.current.onAdFailedToRender?.(
3891
- buildBannerErrorPayload(slotIdRef.current, adGroupId, invalidError)
3929
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, invalidError)
3892
3930
  );
3893
3931
  return;
3894
3932
  }
@@ -3904,7 +3942,7 @@ function InlineAd(props) {
3904
3942
  clearTimeout(viewableTimerRef.current);
3905
3943
  viewableTimerRef.current = null;
3906
3944
  }
3907
- const payload = buildBannerEventPayload(slotIdRef.current, adGroupId, result.ad);
3945
+ const payload = buildBannerEventPayload(slotIdRef.current, normalizedAdGroupId, result.ad);
3908
3946
  eventPayloadRef.current = payload;
3909
3947
  eventTrackerRef.current = new EventTracker(
3910
3948
  result.ad.eventTrackingUrls ?? [],
@@ -3918,7 +3956,9 @@ function InlineAd(props) {
3918
3956
  }).catch((error) => {
3919
3957
  if (!isMountedRef.current) return;
3920
3958
  const adError = error instanceof Error ? createError2(ERROR_CODES.INTERNAL_ERROR, error.message) : createError2(ERROR_CODES.INTERNAL_ERROR, "Unknown error");
3921
- callbacksRef.current.onAdFailedToRender?.(buildBannerErrorPayload(slotIdRef.current, adGroupId, adError));
3959
+ callbacksRef.current.onAdFailedToRender?.(
3960
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, adError)
3961
+ );
3922
3962
  }).finally(() => {
3923
3963
  loadingRef.current = false;
3924
3964
  });
package/dist/index.js CHANGED
@@ -1648,6 +1648,15 @@ import {
1648
1648
  function noop() {
1649
1649
  }
1650
1650
 
1651
+ // src/ads/adGroupId.ts
1652
+ var INVALID_AD_GROUP_ID_ERROR_MESSAGE = "\uC798\uBABB\uB41C \uC694\uCCAD\uC774\uC5D0\uC694. \uD544\uC694\uD55C \uAC12\uC774 \uBE44\uC5B4 \uC788\uC5B4\uC694.";
1653
+ function normalizeAdGroupId(adGroupId) {
1654
+ return adGroupId.trim();
1655
+ }
1656
+ function createInvalidAdGroupIdError() {
1657
+ return new Error(INVALID_AD_GROUP_ID_ERROR_MESSAGE);
1658
+ }
1659
+
1651
1660
  // src/ads/generateSessionId.ts
1652
1661
  function generateSessionId() {
1653
1662
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -1671,7 +1680,11 @@ function fetchTossAd(params) {
1671
1680
  return noop;
1672
1681
  }
1673
1682
  const { onEvent, onError, options } = params;
1674
- const { adGroupId } = options;
1683
+ const adGroupId = normalizeAdGroupId(options.adGroupId);
1684
+ if (adGroupId.length === 0) {
1685
+ params.onError(createInvalidAdGroupIdError());
1686
+ return noop;
1687
+ }
1675
1688
  const unregisterCallbacks = INTERNAL__appBridgeHandler3.invokeAppBridgeMethod(
1676
1689
  "fetchTossAd",
1677
1690
  { spaceUnitId: adGroupId, sessionId, sdkId: options.sdkId, availableStyleIds: options.availableStyleIds },
@@ -1762,8 +1775,8 @@ function postEventTracking(params) {
1762
1775
 
1763
1776
  // src/ads/integratedAd.ts
1764
1777
  var INTEGRATED_AD_SDK_VERSION = "0.0.0";
1765
- var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1766
- var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.244.1";
1778
+ var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
1779
+ var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
1767
1780
  var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
1768
1781
  var INTG_AD_ADM_FALLBACK_RID_MAP = {};
1769
1782
  function integratedAdIsSupported() {
@@ -1778,16 +1791,28 @@ function generateLoadFullScreenAd(sdkId) {
1778
1791
  params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1779
1792
  return noop;
1780
1793
  }
1794
+ const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
1795
+ if (normalizedAdGroupId.length === 0) {
1796
+ params.onError(createInvalidAdGroupIdError());
1797
+ return noop;
1798
+ }
1799
+ const normalizedParams = {
1800
+ ...params,
1801
+ options: {
1802
+ ...params.options,
1803
+ adGroupId: normalizedAdGroupId
1804
+ }
1805
+ };
1781
1806
  if (!integratedAdIsSupported()) {
1782
1807
  return GoogleAdMob.loadAppsInTossAdMob({
1783
- ...params,
1808
+ ...normalizedParams,
1784
1809
  onEvent: (event) => {
1785
1810
  if (event.type === "loaded") {
1786
1811
  const requestId = generateRequestId();
1787
- INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] = requestId;
1812
+ INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] = requestId;
1788
1813
  postEventTracking({
1789
1814
  eventName: "LOAD",
1790
- spaceUnitId: params.options.adGroupId,
1815
+ spaceUnitId: normalizedAdGroupId,
1791
1816
  requestId,
1792
1817
  responseId: event.data.responseInfo.responseId,
1793
1818
  mediationType: "ADMOB",
@@ -1796,13 +1821,13 @@ function generateLoadFullScreenAd(sdkId) {
1796
1821
  sdkVer: INTEGRATED_AD_SDK_VERSION
1797
1822
  });
1798
1823
  }
1799
- return params.onEvent(event);
1824
+ return normalizedParams.onEvent(event);
1800
1825
  },
1801
1826
  onError: (error) => {
1802
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1827
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
1803
1828
  postEventTracking({
1804
1829
  eventName: "FAILED_TO_LOAD",
1805
- spaceUnitId: params.options.adGroupId,
1830
+ spaceUnitId: normalizedAdGroupId,
1806
1831
  requestId,
1807
1832
  responseId: "",
1808
1833
  mediationType: "ADMOB",
@@ -1810,11 +1835,11 @@ function generateLoadFullScreenAd(sdkId) {
1810
1835
  adSourceName: "",
1811
1836
  sdkVer: INTEGRATED_AD_SDK_VERSION
1812
1837
  });
1813
- return params.onError(error);
1838
+ return normalizedParams.onError(error);
1814
1839
  }
1815
1840
  });
1816
1841
  }
1817
- const { onEvent, onError, options } = params;
1842
+ const { onEvent, onError, options } = normalizedParams;
1818
1843
  const { adGroupId } = options;
1819
1844
  const referrer = getReferrer();
1820
1845
  const unregisterCallbacks = INTERNAL__appBridgeHandler4.invokeAppBridgeMethod(
@@ -1841,16 +1866,28 @@ function showFullScreenAd(params) {
1841
1866
  params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
1842
1867
  return noop;
1843
1868
  }
1869
+ const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
1870
+ if (normalizedAdGroupId.length === 0) {
1871
+ params.onError(createInvalidAdGroupIdError());
1872
+ return noop;
1873
+ }
1874
+ const normalizedParams = {
1875
+ ...params,
1876
+ options: {
1877
+ ...params.options,
1878
+ adGroupId: normalizedAdGroupId
1879
+ }
1880
+ };
1844
1881
  if (!integratedAdIsSupported()) {
1845
1882
  return GoogleAdMob.showAppsInTossAdMob({
1846
- ...params,
1883
+ ...normalizedParams,
1847
1884
  onEvent: (event) => {
1848
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1885
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
1849
1886
  switch (event.type) {
1850
1887
  case "show":
1851
1888
  postEventTracking({
1852
1889
  eventName: "SHOW",
1853
- spaceUnitId: params.options.adGroupId,
1890
+ spaceUnitId: normalizedAdGroupId,
1854
1891
  requestId,
1855
1892
  responseId: "",
1856
1893
  mediationType: "ADMOB",
@@ -1862,7 +1899,7 @@ function showFullScreenAd(params) {
1862
1899
  case "failedToShow":
1863
1900
  postEventTracking({
1864
1901
  eventName: "FAILED_TO_SHOW",
1865
- spaceUnitId: params.options.adGroupId,
1902
+ spaceUnitId: normalizedAdGroupId,
1866
1903
  requestId,
1867
1904
  responseId: "",
1868
1905
  mediationType: "ADMOB",
@@ -1874,7 +1911,7 @@ function showFullScreenAd(params) {
1874
1911
  case "impression":
1875
1912
  postEventTracking({
1876
1913
  eventName: "IMP",
1877
- spaceUnitId: params.options.adGroupId,
1914
+ spaceUnitId: normalizedAdGroupId,
1878
1915
  requestId,
1879
1916
  responseId: "",
1880
1917
  mediationType: "ADMOB",
@@ -1886,7 +1923,7 @@ function showFullScreenAd(params) {
1886
1923
  case "clicked":
1887
1924
  postEventTracking({
1888
1925
  eventName: "CLICK",
1889
- spaceUnitId: params.options.adGroupId,
1926
+ spaceUnitId: normalizedAdGroupId,
1890
1927
  requestId,
1891
1928
  responseId: "",
1892
1929
  mediationType: "ADMOB",
@@ -1898,7 +1935,7 @@ function showFullScreenAd(params) {
1898
1935
  case "dismissed":
1899
1936
  postEventTracking({
1900
1937
  eventName: "DISMISS",
1901
- spaceUnitId: params.options.adGroupId,
1938
+ spaceUnitId: normalizedAdGroupId,
1902
1939
  requestId,
1903
1940
  responseId: "",
1904
1941
  mediationType: "ADMOB",
@@ -1910,7 +1947,7 @@ function showFullScreenAd(params) {
1910
1947
  case "userEarnedReward":
1911
1948
  postEventTracking({
1912
1949
  eventName: "USER_EARNED_REWARD",
1913
- spaceUnitId: params.options.adGroupId,
1950
+ spaceUnitId: normalizedAdGroupId,
1914
1951
  requestId,
1915
1952
  responseId: "",
1916
1953
  mediationType: "ADMOB",
@@ -1920,13 +1957,13 @@ function showFullScreenAd(params) {
1920
1957
  });
1921
1958
  break;
1922
1959
  }
1923
- return params.onEvent(event);
1960
+ return normalizedParams.onEvent(event);
1924
1961
  },
1925
1962
  onError: (error) => {
1926
- const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
1963
+ const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
1927
1964
  postEventTracking({
1928
1965
  eventName: "FAILED_TO_SHOW",
1929
- spaceUnitId: params.options.adGroupId,
1966
+ spaceUnitId: normalizedAdGroupId,
1930
1967
  requestId,
1931
1968
  responseId: "",
1932
1969
  mediationType: "ADMOB",
@@ -1934,11 +1971,11 @@ function showFullScreenAd(params) {
1934
1971
  adSourceName: "",
1935
1972
  sdkVer: INTEGRATED_AD_SDK_VERSION
1936
1973
  });
1937
- return params.onError(error);
1974
+ return normalizedParams.onError(error);
1938
1975
  }
1939
1976
  });
1940
1977
  }
1941
- const { onEvent, onError, options } = params;
1978
+ const { onEvent, onError, options } = normalizedParams;
1942
1979
  const { adGroupId } = options;
1943
1980
  const referrer = getReferrer();
1944
1981
  const unregisterCallbacks = INTERNAL__appBridgeHandler4.invokeAppBridgeMethod(
@@ -3025,10 +3062,11 @@ function isStructurallyValidAd(ad) {
3025
3062
  return Boolean(ad && ad.creative && typeof ad.creative === "object");
3026
3063
  }
3027
3064
  async function loadAd(adGroupId) {
3028
- if (!adGroupId) {
3065
+ const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
3066
+ if (normalizedAdGroupId.length === 0) {
3029
3067
  return {
3030
3068
  type: "error",
3031
- error: createError(ERROR_CODES.INVALID_SPACE, "Invalid adGroupId - adGroupId must be provided")
3069
+ error: createError(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE)
3032
3070
  };
3033
3071
  }
3034
3072
  if (!fetchTossAd.isSupported()) {
@@ -3040,7 +3078,7 @@ async function loadAd(adGroupId) {
3040
3078
  let response;
3041
3079
  try {
3042
3080
  const raw = await fetchTossAdPromise({
3043
- adGroupId,
3081
+ adGroupId: normalizedAdGroupId,
3044
3082
  sdkId: SDK_ID,
3045
3083
  availableStyleIds: AVAILABLE_STYLE_IDS
3046
3084
  });
@@ -3855,35 +3893,35 @@ function InlineAd(props) {
3855
3893
  };
3856
3894
  }, []);
3857
3895
  useEffect14(() => {
3896
+ const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
3858
3897
  const loadAdRequest = () => {
3859
3898
  if (loadingRef.current) {
3860
3899
  return;
3861
3900
  }
3862
- if (!adGroupId) {
3863
- const error = createError2(
3864
- ERROR_CODES.INVALID_SPACE,
3865
- `${ERROR_MESSAGES[ERROR_CODES.INVALID_SPACE]} - adGroupId must be provided`
3901
+ if (normalizedAdGroupId.length === 0) {
3902
+ const error = createError2(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE);
3903
+ callbacksRef.current.onAdFailedToRender?.(
3904
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, error)
3866
3905
  );
3867
- callbacksRef.current.onAdFailedToRender?.(buildBannerErrorPayload(slotIdRef.current, adGroupId, error));
3868
3906
  return;
3869
3907
  }
3870
3908
  loadingRef.current = true;
3871
- loadAd(adGroupId).then((result) => {
3909
+ loadAd(normalizedAdGroupId).then((result) => {
3872
3910
  if (!isMountedRef.current) return;
3873
3911
  if (result.type === "noFill") {
3874
- callbacksRef.current.onNoFill?.(buildNoFillPayload(slotIdRef.current, adGroupId));
3912
+ callbacksRef.current.onNoFill?.(buildNoFillPayload(slotIdRef.current, normalizedAdGroupId));
3875
3913
  return;
3876
3914
  }
3877
3915
  if (result.type === "error") {
3878
3916
  callbacksRef.current.onAdFailedToRender?.(
3879
- buildBannerErrorPayload(slotIdRef.current, adGroupId, result.error)
3917
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, result.error)
3880
3918
  );
3881
3919
  return;
3882
3920
  }
3883
3921
  if (!isValidCreative(result.ad)) {
3884
3922
  const invalidError = createError2(ERROR_CODES.INTERNAL_ERROR, "Invalid creative payload");
3885
3923
  callbacksRef.current.onAdFailedToRender?.(
3886
- buildBannerErrorPayload(slotIdRef.current, adGroupId, invalidError)
3924
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, invalidError)
3887
3925
  );
3888
3926
  return;
3889
3927
  }
@@ -3899,7 +3937,7 @@ function InlineAd(props) {
3899
3937
  clearTimeout(viewableTimerRef.current);
3900
3938
  viewableTimerRef.current = null;
3901
3939
  }
3902
- const payload = buildBannerEventPayload(slotIdRef.current, adGroupId, result.ad);
3940
+ const payload = buildBannerEventPayload(slotIdRef.current, normalizedAdGroupId, result.ad);
3903
3941
  eventPayloadRef.current = payload;
3904
3942
  eventTrackerRef.current = new EventTracker(
3905
3943
  result.ad.eventTrackingUrls ?? [],
@@ -3913,7 +3951,9 @@ function InlineAd(props) {
3913
3951
  }).catch((error) => {
3914
3952
  if (!isMountedRef.current) return;
3915
3953
  const adError = error instanceof Error ? createError2(ERROR_CODES.INTERNAL_ERROR, error.message) : createError2(ERROR_CODES.INTERNAL_ERROR, "Unknown error");
3916
- callbacksRef.current.onAdFailedToRender?.(buildBannerErrorPayload(slotIdRef.current, adGroupId, adError));
3954
+ callbacksRef.current.onAdFailedToRender?.(
3955
+ buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, adError)
3956
+ );
3917
3957
  }).finally(() => {
3918
3958
  loadingRef.current = false;
3919
3959
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "2.4.0",
4
+ "version": "2.4.2",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit",
@@ -55,12 +55,12 @@
55
55
  "ait": "./bin/ait.js"
56
56
  },
57
57
  "dependencies": {
58
- "@apps-in-toss/analytics": "2.4.0",
59
- "@apps-in-toss/cli": "2.4.0",
60
- "@apps-in-toss/native-modules": "2.4.0",
61
- "@apps-in-toss/plugins": "2.4.0",
62
- "@apps-in-toss/types": "2.4.0",
63
- "@apps-in-toss/user-scripts": "^2.4.0",
58
+ "@apps-in-toss/analytics": "2.4.2",
59
+ "@apps-in-toss/cli": "2.4.2",
60
+ "@apps-in-toss/native-modules": "2.4.2",
61
+ "@apps-in-toss/plugins": "2.4.2",
62
+ "@apps-in-toss/types": "2.4.2",
63
+ "@apps-in-toss/user-scripts": "^2.4.2",
64
64
  "es-hangul": "^2.3.2"
65
65
  },
66
66
  "devDependencies": {