@apps-in-toss/framework 2.9.3 → 2.10.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/dist/index.cjs +577 -144
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +541 -103
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -1366,7 +1366,7 @@ function AppTitle({ title, iconUrl, theme = "light" }) {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
1368
|
),
|
|
1369
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1369
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1370
1370
|
import_react_native24.Text,
|
|
1371
1371
|
{
|
|
1372
1372
|
numberOfLines: 1,
|
|
@@ -1482,6 +1482,10 @@ function DefaultNavigationBar() {
|
|
|
1482
1482
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1483
1483
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1484
1484
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1485
|
+
const withIcon = parsedNavigationBar?.withIcon ?? true;
|
|
1486
|
+
const withTitle = parsedNavigationBar?.withTitle ?? true;
|
|
1487
|
+
const iconURL = withIcon ? globals.brandIcon : void 0;
|
|
1488
|
+
const title = withTitle ? globals.brandDisplayName : void 0;
|
|
1485
1489
|
const theme = parsedNavigationBar?.theme ?? "light";
|
|
1486
1490
|
const { navigationRightButton } = useNavigationBarContext();
|
|
1487
1491
|
const navigationEvent = useNavigationEvent();
|
|
@@ -1490,7 +1494,7 @@ function DefaultNavigationBar() {
|
|
|
1490
1494
|
TopNavigation,
|
|
1491
1495
|
{
|
|
1492
1496
|
left: withBackButton ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BackButton, { theme, onPress: navigationEvent.handleBack }) : null,
|
|
1493
|
-
center: withHomeButton ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HomeButton, { theme, onPress: navigationEvent.handleHomeButtonClick, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppTitle, { theme, title
|
|
1497
|
+
center: title || iconURL ? withHomeButton ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HomeButton, { theme, onPress: navigationEvent.handleHomeButtonClick, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppTitle, { theme, title, iconUrl: iconURL }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppTitle, { theme, title, iconUrl: iconURL }) : null,
|
|
1494
1498
|
right: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1495
1499
|
Menu2,
|
|
1496
1500
|
{
|
|
@@ -1654,7 +1658,7 @@ var AppsInToss = {
|
|
|
1654
1658
|
};
|
|
1655
1659
|
|
|
1656
1660
|
// src/components/WebView.tsx
|
|
1657
|
-
var
|
|
1661
|
+
var import_native_modules19 = require("@apps-in-toss/native-modules");
|
|
1658
1662
|
var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
|
|
1659
1663
|
var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
|
|
1660
1664
|
var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
|
|
@@ -1748,6 +1752,10 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1748
1752
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1749
1753
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1750
1754
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1755
|
+
const withIcon = parsedNavigationBar?.withIcon ?? true;
|
|
1756
|
+
const withTitle = parsedNavigationBar?.withTitle ?? true;
|
|
1757
|
+
const iconURL = withIcon ? globals.brandIcon : void 0;
|
|
1758
|
+
const title = withTitle ? globals.brandDisplayName : void 0;
|
|
1751
1759
|
const theme = parsedNavigationBar?.theme ?? "light";
|
|
1752
1760
|
const { navigationRightButton } = useNavigationBarContext();
|
|
1753
1761
|
const handleClose = (0, import_react20.useCallback)(async () => {
|
|
@@ -1758,7 +1766,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1758
1766
|
TopNavigation,
|
|
1759
1767
|
{
|
|
1760
1768
|
left: withBackButton ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BackButton, { theme, onPress: onBackButtonClick }) : null,
|
|
1761
|
-
center: withHomeButton ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(HomeButton, { theme, onPress: onHomeButtonClick, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AppTitle, { theme, title
|
|
1769
|
+
center: title || iconURL ? withHomeButton ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(HomeButton, { theme, onPress: onHomeButtonClick, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AppTitle, { theme, title, iconUrl: iconURL }) }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AppTitle, { theme, title, iconUrl: iconURL }) : null,
|
|
1762
1770
|
right: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1763
1771
|
Menu2,
|
|
1764
1772
|
{
|
|
@@ -1794,7 +1802,7 @@ function convertIntentURL(url) {
|
|
|
1794
1802
|
return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
|
|
1795
1803
|
}
|
|
1796
1804
|
|
|
1797
|
-
// src/ads/
|
|
1805
|
+
// src/ads/fetchAppsInTossAd.ts
|
|
1798
1806
|
var import_native_modules12 = require("@apps-in-toss/native-modules");
|
|
1799
1807
|
|
|
1800
1808
|
// ../../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
@@ -1822,14 +1830,50 @@ function generateSessionId() {
|
|
|
1822
1830
|
// src/ads/constants.ts
|
|
1823
1831
|
var sessionId = generateSessionId();
|
|
1824
1832
|
|
|
1833
|
+
// src/ads/fetchAppsInTossAd.ts
|
|
1834
|
+
var ANDROID_SUPPORTED_VERSION = "5.264.0";
|
|
1835
|
+
var IOS_SUPPORTED_VERSION = "5.264.0";
|
|
1836
|
+
var APP_BRIDGE_METHOD_NAME2 = "fetchAppsInTossAd";
|
|
1837
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
1838
|
+
function fetchAppsInTossAd(params) {
|
|
1839
|
+
const { body, onEvent, onError } = params;
|
|
1840
|
+
if (!fetchAppsInTossAd.isSupported()) {
|
|
1841
|
+
onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
1842
|
+
return noop;
|
|
1843
|
+
}
|
|
1844
|
+
const spaceUnitId = normalizeAdGroupId(body.spaceUnitId);
|
|
1845
|
+
if (spaceUnitId.length === 0) {
|
|
1846
|
+
onError(createInvalidAdGroupIdError());
|
|
1847
|
+
return noop;
|
|
1848
|
+
}
|
|
1849
|
+
return import_native_modules12.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
1850
|
+
APP_BRIDGE_METHOD_NAME2,
|
|
1851
|
+
{ ...body, spaceUnitId, sessionId: body.sessionId ?? sessionId },
|
|
1852
|
+
{
|
|
1853
|
+
onSuccess: onEvent,
|
|
1854
|
+
onError
|
|
1855
|
+
}
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
fetchAppsInTossAd.isSupported = () => {
|
|
1859
|
+
if ((0, import_native_modules12.getOperationalEnvironment)() !== "toss") {
|
|
1860
|
+
return false;
|
|
1861
|
+
}
|
|
1862
|
+
return (0, import_native_modules12.isMinVersionSupported)({
|
|
1863
|
+
android: ANDROID_SUPPORTED_VERSION,
|
|
1864
|
+
ios: IOS_SUPPORTED_VERSION
|
|
1865
|
+
});
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1825
1868
|
// src/ads/fetchTossAd.ts
|
|
1869
|
+
var import_native_modules13 = require("@apps-in-toss/native-modules");
|
|
1826
1870
|
var ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
|
|
1827
1871
|
var IOS_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
|
|
1828
|
-
var
|
|
1829
|
-
var ENVIRONMENT = (0,
|
|
1872
|
+
var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
|
|
1873
|
+
var ENVIRONMENT = (0, import_native_modules13.getOperationalEnvironment)();
|
|
1830
1874
|
function fetchTossAd(params) {
|
|
1831
1875
|
if (!fetchTossAd.isSupported()) {
|
|
1832
|
-
params.onError(new Error(
|
|
1876
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
1833
1877
|
return noop;
|
|
1834
1878
|
}
|
|
1835
1879
|
const { onEvent, onError, options } = params;
|
|
@@ -1839,7 +1883,7 @@ function fetchTossAd(params) {
|
|
|
1839
1883
|
return noop;
|
|
1840
1884
|
}
|
|
1841
1885
|
const wireHeaders = options.headers;
|
|
1842
|
-
const unregisterCallbacks =
|
|
1886
|
+
const unregisterCallbacks = import_native_modules13.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
1843
1887
|
"fetchTossAd",
|
|
1844
1888
|
{
|
|
1845
1889
|
spaceUnitId: adGroupId,
|
|
@@ -1863,14 +1907,14 @@ fetchTossAd.isSupported = () => {
|
|
|
1863
1907
|
if (ENVIRONMENT !== "toss") {
|
|
1864
1908
|
return false;
|
|
1865
1909
|
}
|
|
1866
|
-
return (0,
|
|
1910
|
+
return (0, import_native_modules13.isMinVersionSupported)({
|
|
1867
1911
|
android: ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION,
|
|
1868
1912
|
ios: IOS_FETCH_TOSS_AD_SUPPORTED_VERSION
|
|
1869
1913
|
});
|
|
1870
1914
|
};
|
|
1871
1915
|
|
|
1872
1916
|
// src/ads/integratedAd.ts
|
|
1873
|
-
var
|
|
1917
|
+
var import_native_modules15 = require("@apps-in-toss/native-modules");
|
|
1874
1918
|
|
|
1875
1919
|
// src/ads/generateRequestId.ts
|
|
1876
1920
|
function generateRequestId() {
|
|
@@ -1890,7 +1934,7 @@ function getReferrer() {
|
|
|
1890
1934
|
}
|
|
1891
1935
|
|
|
1892
1936
|
// src/ads/remotes.ts
|
|
1893
|
-
var
|
|
1937
|
+
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
1894
1938
|
|
|
1895
1939
|
// src/ads/getIsDev.ts
|
|
1896
1940
|
var import_react_native33 = require("@granite-js/react-native");
|
|
@@ -1903,9 +1947,9 @@ function getIsDev() {
|
|
|
1903
1947
|
}
|
|
1904
1948
|
|
|
1905
1949
|
// src/ads/remotes.ts
|
|
1906
|
-
var OPERATIONAL_ENVIRONMENT = (0,
|
|
1907
|
-
var OS = (0,
|
|
1908
|
-
var APP_VER = (0,
|
|
1950
|
+
var OPERATIONAL_ENVIRONMENT = (0, import_native_modules14.getOperationalEnvironment)();
|
|
1951
|
+
var OS = (0, import_native_modules14.getPlatformOS)();
|
|
1952
|
+
var APP_VER = (0, import_native_modules14.getTossAppVersion)();
|
|
1909
1953
|
var ALPHA_EVENT_TRACKER_HTTP_ENDPOINT = "https://alpha-trillion.toss.im/trk/sdk-mediation/event";
|
|
1910
1954
|
var LIVE_EVENT_TRACKER_HTTP_ENDPOINT = "https://trillion.toss.im/trk/sdk-mediation/event";
|
|
1911
1955
|
function getPostEventTrackingUrl() {
|
|
@@ -1937,18 +1981,18 @@ function postEventTracking(params) {
|
|
|
1937
1981
|
var INTEGRATED_AD_SDK_VERSION = "0.0.0";
|
|
1938
1982
|
var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
|
|
1939
1983
|
var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.247.0";
|
|
1940
|
-
var
|
|
1984
|
+
var UNSUPPORTED_ERROR_MESSAGE3 = "This feature is not supported in the current environment";
|
|
1941
1985
|
var INTG_AD_ADM_FALLBACK_RID_MAP = {};
|
|
1942
1986
|
function integratedAdIsSupported() {
|
|
1943
|
-
return (0,
|
|
1987
|
+
return (0, import_native_modules15.isMinVersionSupported)({
|
|
1944
1988
|
android: ANDROID_INTEGRATED_AD_SUPPORTED_VERSION,
|
|
1945
1989
|
ios: IOS_INTEGRATED_AD_SUPPORTED_VERSION
|
|
1946
1990
|
});
|
|
1947
1991
|
}
|
|
1948
1992
|
function generateLoadFullScreenAd(sdkId) {
|
|
1949
1993
|
const fn = (params) => {
|
|
1950
|
-
if (!
|
|
1951
|
-
params.onError(new Error(
|
|
1994
|
+
if (!import_native_modules15.GoogleAdMob.loadAppsInTossAdMob.isSupported()) {
|
|
1995
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE3));
|
|
1952
1996
|
return noop;
|
|
1953
1997
|
}
|
|
1954
1998
|
const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
|
|
@@ -1966,7 +2010,7 @@ function generateLoadFullScreenAd(sdkId) {
|
|
|
1966
2010
|
if (!integratedAdIsSupported()) {
|
|
1967
2011
|
const fallbackOptions = { ...normalizedParams.options };
|
|
1968
2012
|
delete fallbackOptions.headers;
|
|
1969
|
-
return
|
|
2013
|
+
return import_native_modules15.GoogleAdMob.loadAppsInTossAdMob({
|
|
1970
2014
|
...normalizedParams,
|
|
1971
2015
|
options: fallbackOptions,
|
|
1972
2016
|
onEvent: (event) => {
|
|
@@ -2006,7 +2050,7 @@ function generateLoadFullScreenAd(sdkId) {
|
|
|
2006
2050
|
const { adGroupId } = options;
|
|
2007
2051
|
const referrer = getReferrer();
|
|
2008
2052
|
const wireHeaders = options.headers;
|
|
2009
|
-
const unregisterCallbacks =
|
|
2053
|
+
const unregisterCallbacks = import_native_modules15.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
2010
2054
|
"loadTossAdOrAdmob",
|
|
2011
2055
|
{
|
|
2012
2056
|
spaceUnitId: adGroupId,
|
|
@@ -2026,14 +2070,14 @@ function generateLoadFullScreenAd(sdkId) {
|
|
|
2026
2070
|
);
|
|
2027
2071
|
return unregisterCallbacks;
|
|
2028
2072
|
};
|
|
2029
|
-
fn.isSupported =
|
|
2073
|
+
fn.isSupported = import_native_modules15.GoogleAdMob.loadAppsInTossAdMob.isSupported;
|
|
2030
2074
|
return fn;
|
|
2031
2075
|
}
|
|
2032
2076
|
var loadFullScreenAd = generateLoadFullScreenAd("107");
|
|
2033
2077
|
var loadFullScreenAdForWeb = generateLoadFullScreenAd("107");
|
|
2034
2078
|
function showFullScreenAd(params) {
|
|
2035
|
-
if (!
|
|
2036
|
-
params.onError(new Error(
|
|
2079
|
+
if (!import_native_modules15.GoogleAdMob.showAppsInTossAdMob.isSupported()) {
|
|
2080
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE3));
|
|
2037
2081
|
return noop;
|
|
2038
2082
|
}
|
|
2039
2083
|
const normalizedAdGroupId = normalizeAdGroupId(params.options.adGroupId);
|
|
@@ -2049,7 +2093,7 @@ function showFullScreenAd(params) {
|
|
|
2049
2093
|
}
|
|
2050
2094
|
};
|
|
2051
2095
|
if (!integratedAdIsSupported()) {
|
|
2052
|
-
return
|
|
2096
|
+
return import_native_modules15.GoogleAdMob.showAppsInTossAdMob({
|
|
2053
2097
|
...normalizedParams,
|
|
2054
2098
|
onEvent: (event) => {
|
|
2055
2099
|
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[normalizedAdGroupId] ?? "";
|
|
@@ -2148,7 +2192,7 @@ function showFullScreenAd(params) {
|
|
|
2148
2192
|
const { onEvent, onError, options } = normalizedParams;
|
|
2149
2193
|
const { adGroupId } = options;
|
|
2150
2194
|
const referrer = getReferrer();
|
|
2151
|
-
const unregisterCallbacks =
|
|
2195
|
+
const unregisterCallbacks = import_native_modules15.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
2152
2196
|
"showTossAdOrAdmob",
|
|
2153
2197
|
{ spaceUnitId: adGroupId, referrer, sessionId },
|
|
2154
2198
|
{
|
|
@@ -2181,7 +2225,7 @@ function showFullScreenAd(params) {
|
|
|
2181
2225
|
);
|
|
2182
2226
|
return unregisterCallbacks;
|
|
2183
2227
|
}
|
|
2184
|
-
showFullScreenAd.isSupported =
|
|
2228
|
+
showFullScreenAd.isSupported = import_native_modules15.GoogleAdMob.showAppsInTossAdMob.isSupported;
|
|
2185
2229
|
|
|
2186
2230
|
// src/ads/tossAdEventLog.ts
|
|
2187
2231
|
var import_react_native34 = require("@granite-js/react-native");
|
|
@@ -2494,7 +2538,7 @@ function mergeRefs(...refs) {
|
|
|
2494
2538
|
}
|
|
2495
2539
|
|
|
2496
2540
|
// src/hooks/useCreateUserAgent.ts
|
|
2497
|
-
var
|
|
2541
|
+
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
2498
2542
|
var import_react_native36 = require("react-native");
|
|
2499
2543
|
var FontA11yCategory = {
|
|
2500
2544
|
Large: "Large",
|
|
@@ -2628,8 +2672,8 @@ function useCreateUserAgent({
|
|
|
2628
2672
|
safeArea,
|
|
2629
2673
|
safeAreaBottomTransparency
|
|
2630
2674
|
}) {
|
|
2631
|
-
const platform = (0,
|
|
2632
|
-
const appVersion = (0,
|
|
2675
|
+
const platform = (0, import_native_modules16.getPlatformOS)();
|
|
2676
|
+
const appVersion = (0, import_native_modules16.getTossAppVersion)();
|
|
2633
2677
|
const { fontScale } = (0, import_react_native36.useWindowDimensions)();
|
|
2634
2678
|
const platformString = platform === "ios" ? "iPhone" : "Android phone";
|
|
2635
2679
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
@@ -2651,7 +2695,7 @@ function useCreateUserAgent({
|
|
|
2651
2695
|
}
|
|
2652
2696
|
|
|
2653
2697
|
// src/hooks/useGeolocation.ts
|
|
2654
|
-
var
|
|
2698
|
+
var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
2655
2699
|
var import_react_native37 = require("@granite-js/react-native");
|
|
2656
2700
|
var import_react26 = require("react");
|
|
2657
2701
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
@@ -2661,7 +2705,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
2661
2705
|
if (!isVisible) {
|
|
2662
2706
|
return;
|
|
2663
2707
|
}
|
|
2664
|
-
return (0,
|
|
2708
|
+
return (0, import_native_modules17.startUpdateLocation)({
|
|
2665
2709
|
options: {
|
|
2666
2710
|
accuracy,
|
|
2667
2711
|
distanceInterval,
|
|
@@ -2714,7 +2758,7 @@ function useTopNavigation() {
|
|
|
2714
2758
|
}
|
|
2715
2759
|
|
|
2716
2760
|
// src/hooks/useWebViewMemoryDebug.tsx
|
|
2717
|
-
var
|
|
2761
|
+
var import_native_modules18 = require("@apps-in-toss/native-modules");
|
|
2718
2762
|
var import_react_native39 = require("@granite-js/react-native");
|
|
2719
2763
|
var import_tds_react_native15 = require("@toss/tds-react-native");
|
|
2720
2764
|
function useHandleWebViewProcessDidTerminate(webViewRef) {
|
|
@@ -2742,7 +2786,7 @@ function webViewDebugLog(logName, params) {
|
|
|
2742
2786
|
deployment_id: global2.deploymentId
|
|
2743
2787
|
}
|
|
2744
2788
|
};
|
|
2745
|
-
if ((0,
|
|
2789
|
+
if ((0, import_native_modules18.getOperationalEnvironment)() === "toss") {
|
|
2746
2790
|
sendLog(event, { pipelines: ["core"] });
|
|
2747
2791
|
} else {
|
|
2748
2792
|
console.log("[webViewDebugLog]", event);
|
|
@@ -2842,7 +2886,7 @@ function getWebViewURL(local) {
|
|
|
2842
2886
|
const devUrl = `http://${local.host}:${local.port}`;
|
|
2843
2887
|
return mergeSchemeQueryParamsInto(devUrl);
|
|
2844
2888
|
}
|
|
2845
|
-
const { url: rawUrl } = (0,
|
|
2889
|
+
const { url: rawUrl } = (0, import_native_modules19.safeSyncPostMessage)("getWebBundleURL", {});
|
|
2846
2890
|
const url = mergeSchemeQueryParamsInto(rawUrl);
|
|
2847
2891
|
const deploymentId = env.getDeploymentId();
|
|
2848
2892
|
if (deploymentId) {
|
|
@@ -2876,39 +2920,43 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2876
2920
|
};
|
|
2877
2921
|
},
|
|
2878
2922
|
homeEvent: ({ onEvent }) => homeEvent.subscribe(onEvent),
|
|
2879
|
-
updateLocationEvent: ({ onEvent, onError, options }) =>
|
|
2923
|
+
updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules19.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
2880
2924
|
safeAreaInsetsChange: ({ onEvent }) => safeAreaInsetsEvent.subscribe(onEvent),
|
|
2881
2925
|
/** @internal */
|
|
2882
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
2926
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules19.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
2883
2927
|
/** AdMobV2 */
|
|
2884
|
-
loadAppsInTossAdMob:
|
|
2885
|
-
showAppsInTossAdMob:
|
|
2928
|
+
loadAppsInTossAdMob: import_native_modules19.GoogleAdMob.loadAppsInTossAdMob,
|
|
2929
|
+
showAppsInTossAdMob: import_native_modules19.GoogleAdMob.showAppsInTossAdMob,
|
|
2886
2930
|
/** IntegratedAd */
|
|
2887
2931
|
loadFullScreenAd: loadFullScreenAdForWeb,
|
|
2888
2932
|
showFullScreenAd,
|
|
2889
2933
|
/** TossAd */
|
|
2890
2934
|
fetchTossAd,
|
|
2935
|
+
// v1.4 배너: web 이벤트 브릿지는 payload를 options로 전달하지만 fetchAppsInTossAd는 body로 받으므로 어댑팅한다.
|
|
2936
|
+
fetchAppsInTossAd: ({ onEvent, onError, options }) => fetchAppsInTossAd({ body: options, onEvent, onError }),
|
|
2891
2937
|
/** IAP */
|
|
2892
|
-
iapCreateOneTimePurchaseOrder:
|
|
2893
|
-
requestSubscriptionPurchase:
|
|
2894
|
-
requestOneTimePurchase:
|
|
2895
|
-
requestNotificationAgreement:
|
|
2938
|
+
iapCreateOneTimePurchaseOrder: import_native_modules19.IAP.createOneTimePurchaseOrder,
|
|
2939
|
+
requestSubscriptionPurchase: import_native_modules19.requestSubscriptionPurchase,
|
|
2940
|
+
requestOneTimePurchase: import_native_modules19.requestOneTimePurchase,
|
|
2941
|
+
requestNotificationAgreement: import_native_modules19.requestNotificationAgreement
|
|
2896
2942
|
},
|
|
2897
2943
|
constantHandlerMap: {
|
|
2898
2944
|
...appsInTossConstantBridges,
|
|
2899
2945
|
getSafeAreaInsets: () => insets,
|
|
2900
2946
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
2901
|
-
getServerTime_isSupported:
|
|
2902
|
-
requestReview_isSupported:
|
|
2947
|
+
getServerTime_isSupported: import_native_modules19.getServerTime.isSupported,
|
|
2948
|
+
requestReview_isSupported: import_native_modules19.requestReview.isSupported,
|
|
2949
|
+
getDeclaredAgeRange_isSupported: import_native_modules19.getDeclaredAgeRange.isSupported,
|
|
2903
2950
|
/** AdMobV2 */
|
|
2904
|
-
loadAppsInTossAdMob_isSupported:
|
|
2905
|
-
showAppsInTossAdMob_isSupported:
|
|
2906
|
-
isAppsInTossAdMobLoaded_isSupported:
|
|
2951
|
+
loadAppsInTossAdMob_isSupported: import_native_modules19.GoogleAdMob.loadAppsInTossAdMob.isSupported,
|
|
2952
|
+
showAppsInTossAdMob_isSupported: import_native_modules19.GoogleAdMob.showAppsInTossAdMob.isSupported,
|
|
2953
|
+
isAppsInTossAdMobLoaded_isSupported: import_native_modules19.GoogleAdMob.isAppsInTossAdMobLoaded.isSupported,
|
|
2907
2954
|
/** IntegratedAd */
|
|
2908
2955
|
loadFullScreenAd_isSupported: loadFullScreenAdForWeb.isSupported,
|
|
2909
2956
|
showFullScreenAd_isSupported: showFullScreenAd.isSupported,
|
|
2910
2957
|
/** TossAd */
|
|
2911
2958
|
fetchTossAd_isSupported: fetchTossAd.isSupported,
|
|
2959
|
+
fetchAppsInTossAd_isSupported: fetchAppsInTossAd.isSupported,
|
|
2912
2960
|
/** env */
|
|
2913
2961
|
getDeploymentId: env.getDeploymentId,
|
|
2914
2962
|
getWebViewType: env.getWebViewType,
|
|
@@ -2916,7 +2964,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2916
2964
|
},
|
|
2917
2965
|
asyncHandlerMap: {
|
|
2918
2966
|
...appsInTossAsyncBridges,
|
|
2919
|
-
getServerTime:
|
|
2967
|
+
getServerTime: import_native_modules19.getServerTime,
|
|
2920
2968
|
setIosSwipeGestureEnabled: (options) => {
|
|
2921
2969
|
setAllowsBackForwardNavigationGestures(options.isEnabled);
|
|
2922
2970
|
return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
|
|
@@ -2934,20 +2982,20 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2934
2982
|
getCurrentLocation: appsInTossAsyncBridges.getCurrentLocation,
|
|
2935
2983
|
openCamera: appsInTossAsyncBridges.openCamera,
|
|
2936
2984
|
/** Storage */
|
|
2937
|
-
getStorageItem:
|
|
2938
|
-
setStorageItem:
|
|
2939
|
-
removeStorageItem:
|
|
2940
|
-
clearItems:
|
|
2985
|
+
getStorageItem: import_native_modules19.Storage.getItem,
|
|
2986
|
+
setStorageItem: import_native_modules19.Storage.setItem,
|
|
2987
|
+
removeStorageItem: import_native_modules19.Storage.removeItem,
|
|
2988
|
+
clearItems: import_native_modules19.Storage.clearItems,
|
|
2941
2989
|
/** IAP */
|
|
2942
|
-
iapGetProductItemList:
|
|
2943
|
-
iapCreateOneTimePurchaseOrder:
|
|
2944
|
-
processProductGrant:
|
|
2945
|
-
getPendingOrders:
|
|
2946
|
-
getCompletedOrRefundedOrders:
|
|
2947
|
-
completeProductGrant:
|
|
2948
|
-
getSubscriptionInfo:
|
|
2990
|
+
iapGetProductItemList: import_native_modules19.IAP.getProductItemList,
|
|
2991
|
+
iapCreateOneTimePurchaseOrder: import_native_modules19.iapCreateOneTimePurchaseOrder,
|
|
2992
|
+
processProductGrant: import_native_modules19.processProductGrant,
|
|
2993
|
+
getPendingOrders: import_native_modules19.IAP.getPendingOrders,
|
|
2994
|
+
getCompletedOrRefundedOrders: import_native_modules19.IAP.getCompletedOrRefundedOrders,
|
|
2995
|
+
completeProductGrant: import_native_modules19.IAP.completeProductGrant,
|
|
2996
|
+
getSubscriptionInfo: import_native_modules19.IAP.getSubscriptionInfo,
|
|
2949
2997
|
/** AdMobV2 */
|
|
2950
|
-
isAppsInTossAdMobLoaded:
|
|
2998
|
+
isAppsInTossAdMobLoaded: import_native_modules19.GoogleAdMob.isAppsInTossAdMobLoaded,
|
|
2951
2999
|
/** Toss Ads */
|
|
2952
3000
|
tossAdEventLog,
|
|
2953
3001
|
/** Private */
|
|
@@ -3172,6 +3220,159 @@ var AD_STATUS_ERROR_MAP = {
|
|
|
3172
3220
|
}
|
|
3173
3221
|
};
|
|
3174
3222
|
|
|
3223
|
+
// src/ads/inlineAd/errorTracking.ts
|
|
3224
|
+
var BANNER_ERROR_LOG_NAME = "display_ads_all::error__banner";
|
|
3225
|
+
var MAX_STACK_TRACE_LENGTH = 255;
|
|
3226
|
+
function logBannerErrorToAppLog(info) {
|
|
3227
|
+
void tossAdEventLog({
|
|
3228
|
+
log_name: BANNER_ERROR_LOG_NAME,
|
|
3229
|
+
log_type: "debug",
|
|
3230
|
+
params: {
|
|
3231
|
+
error_code: info.errorCode,
|
|
3232
|
+
error_message: info.errorMessage,
|
|
3233
|
+
ad_group_id: info.adGroupId,
|
|
3234
|
+
mediation_id: info.mediationId,
|
|
3235
|
+
event_context_token: info.eventContextToken
|
|
3236
|
+
}
|
|
3237
|
+
}).catch(noop);
|
|
3238
|
+
}
|
|
3239
|
+
function trackBannerError(info) {
|
|
3240
|
+
if (info.endpointError) {
|
|
3241
|
+
void fetch(info.endpointError, {
|
|
3242
|
+
method: "POST",
|
|
3243
|
+
headers: { "Content-Type": "application/json" },
|
|
3244
|
+
body: JSON.stringify({
|
|
3245
|
+
eventContextToken: info.eventContextToken,
|
|
3246
|
+
mediationId: info.mediationId,
|
|
3247
|
+
errorCode: info.errorCode,
|
|
3248
|
+
errorMessage: info.errorMessage,
|
|
3249
|
+
stackTrace: info.stackTrace?.slice(0, MAX_STACK_TRACE_LENGTH)
|
|
3250
|
+
})
|
|
3251
|
+
// POST 실패(CORS·네트워크) → 앱로그 fallback (endpoint와 같은 채널이라 함께 막히는 경우 대비).
|
|
3252
|
+
}).catch(() => logBannerErrorToAppLog(info));
|
|
3253
|
+
return;
|
|
3254
|
+
}
|
|
3255
|
+
logBannerErrorToAppLog(info);
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
// src/ads/inlineAd/loadAd.ts
|
|
3259
|
+
var import_native_modules20 = require("@apps-in-toss/native-modules");
|
|
3260
|
+
|
|
3261
|
+
// src/ads/fetchAppsInTossAdSchema.ts
|
|
3262
|
+
var APPS_IN_TOSS_AD_SPEC_VERSION = "1.4.1";
|
|
3263
|
+
var FETCH_APPS_IN_TOSS_AD_DEVICE_MACRO = "{{device}}";
|
|
3264
|
+
var TOSS_APP_BUNDLE_IDS = {
|
|
3265
|
+
ios: "com.vivarepublica.cash",
|
|
3266
|
+
android: "viva.republica.toss"
|
|
3267
|
+
};
|
|
3268
|
+
function resolveTossAppBundleId(os) {
|
|
3269
|
+
return TOSS_APP_BUNDLE_IDS[os];
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
// package.json
|
|
3273
|
+
var package_default = {
|
|
3274
|
+
name: "@apps-in-toss/framework",
|
|
3275
|
+
type: "module",
|
|
3276
|
+
version: "2.10.1",
|
|
3277
|
+
description: "The framework for Apps In Toss",
|
|
3278
|
+
scripts: {
|
|
3279
|
+
typecheck: "tsc --noEmit",
|
|
3280
|
+
test: "vitest --no-watch",
|
|
3281
|
+
"test:no-parallel": "vitest --no-watch --config=vitest.no-parallel.config.mts",
|
|
3282
|
+
lint: "eslint .",
|
|
3283
|
+
build: "tsup"
|
|
3284
|
+
},
|
|
3285
|
+
main: "./dist/index.cjs",
|
|
3286
|
+
module: "./dist/index.js",
|
|
3287
|
+
types: "./dist/index.d.ts",
|
|
3288
|
+
exports: {
|
|
3289
|
+
".": {
|
|
3290
|
+
types: "./dist/index.d.ts",
|
|
3291
|
+
import: "./dist/index.js",
|
|
3292
|
+
require: "./dist/index.cjs"
|
|
3293
|
+
},
|
|
3294
|
+
"./plugins": {
|
|
3295
|
+
types: "./dist/plugins/index.d.ts",
|
|
3296
|
+
import: "./dist/plugins/index.js",
|
|
3297
|
+
require: "./dist/plugins/index.cjs"
|
|
3298
|
+
},
|
|
3299
|
+
"./internal": {
|
|
3300
|
+
types: "./dist/internal.d.ts",
|
|
3301
|
+
import: "./dist/internal.js",
|
|
3302
|
+
require: "./dist/internal.cjs"
|
|
3303
|
+
},
|
|
3304
|
+
"./bridge-entry": "./src/bridge-entry.ts",
|
|
3305
|
+
"./bridge-meta": {
|
|
3306
|
+
types: "./dist/bridge-meta.d.ts",
|
|
3307
|
+
default: "./dist/bridge-meta.js"
|
|
3308
|
+
},
|
|
3309
|
+
"./jest": {
|
|
3310
|
+
types: "./dist/jest/index.d.ts",
|
|
3311
|
+
import: "./dist/jest/index.js",
|
|
3312
|
+
require: "./dist/jest/index.cjs"
|
|
3313
|
+
},
|
|
3314
|
+
"./package.json": "./package.json"
|
|
3315
|
+
},
|
|
3316
|
+
files: [
|
|
3317
|
+
"dist/**/*",
|
|
3318
|
+
"src/bridge-entry.ts",
|
|
3319
|
+
"src/async-bridges.ts",
|
|
3320
|
+
"src/constant-bridges.ts",
|
|
3321
|
+
"src/event-bridges.ts",
|
|
3322
|
+
"hermesc/**/*",
|
|
3323
|
+
"plugins.d.ts",
|
|
3324
|
+
"jest.d.ts"
|
|
3325
|
+
],
|
|
3326
|
+
bin: {
|
|
3327
|
+
ait: "./bin/ait.js"
|
|
3328
|
+
},
|
|
3329
|
+
dependencies: {
|
|
3330
|
+
"@apps-in-toss/analytics": "workspace:*",
|
|
3331
|
+
"@apps-in-toss/cli": "workspace:*",
|
|
3332
|
+
"@apps-in-toss/native-modules": "workspace:*",
|
|
3333
|
+
"@apps-in-toss/plugins": "workspace:*",
|
|
3334
|
+
"@apps-in-toss/types": "workspace:*",
|
|
3335
|
+
"@apps-in-toss/user-scripts": "workspace:^",
|
|
3336
|
+
"es-hangul": "^2.3.2"
|
|
3337
|
+
},
|
|
3338
|
+
devDependencies: {
|
|
3339
|
+
"@apps-in-toss/ait-format": "1.0.0",
|
|
3340
|
+
"@babel/runtime": "^7",
|
|
3341
|
+
"@granite-js/mpack": "catalog:granite-js",
|
|
3342
|
+
"@granite-js/native": "catalog:granite-js",
|
|
3343
|
+
"@granite-js/plugin-core": "catalog:granite-js",
|
|
3344
|
+
"@granite-js/react-native": "catalog:granite-js",
|
|
3345
|
+
"@granite-js/utils": "catalog:granite-js",
|
|
3346
|
+
"@toss/tds-react-native": "catalog:react-native",
|
|
3347
|
+
"@types/kill-port": "2.0.1",
|
|
3348
|
+
"@types/react": "catalog:react-native",
|
|
3349
|
+
"brick-module": "catalog:brick-module",
|
|
3350
|
+
"es-toolkit": "^1.34.1",
|
|
3351
|
+
eslint: "^9.7.0",
|
|
3352
|
+
execa: "catalog:tooling",
|
|
3353
|
+
jsdom: "^25.0.1",
|
|
3354
|
+
"kill-port": "2.0.1",
|
|
3355
|
+
react: "catalog:react-native",
|
|
3356
|
+
"react-native": "catalog:react-native",
|
|
3357
|
+
tsup: "^8.3.5",
|
|
3358
|
+
typescript: "5.8.3",
|
|
3359
|
+
vitest: "^3.0.3",
|
|
3360
|
+
"workspace-tools": "^0.38.2"
|
|
3361
|
+
},
|
|
3362
|
+
peerDependencies: {
|
|
3363
|
+
"@granite-js/native": "*",
|
|
3364
|
+
"@granite-js/react-native": "*",
|
|
3365
|
+
"@toss/tds-react-native": ">=2.0.0",
|
|
3366
|
+
"@types/react": "*",
|
|
3367
|
+
"brick-module": "*",
|
|
3368
|
+
react: "*",
|
|
3369
|
+
"react-native": "*"
|
|
3370
|
+
}
|
|
3371
|
+
};
|
|
3372
|
+
|
|
3373
|
+
// src/ads/sdkVersion.ts
|
|
3374
|
+
var SDK_VERSION = package_default.version;
|
|
3375
|
+
|
|
3175
3376
|
// src/ads/inlineAd/loadAd.ts
|
|
3176
3377
|
function createError(code, message) {
|
|
3177
3378
|
return {
|
|
@@ -3198,6 +3399,28 @@ function fetchTossAdPromise(options) {
|
|
|
3198
3399
|
});
|
|
3199
3400
|
});
|
|
3200
3401
|
}
|
|
3402
|
+
function requestAd(adGroupId) {
|
|
3403
|
+
if (fetchAppsInTossAd.isSupported()) {
|
|
3404
|
+
const body = {
|
|
3405
|
+
specVersion: APPS_IN_TOSS_AD_SPEC_VERSION,
|
|
3406
|
+
platform: "RN",
|
|
3407
|
+
spaceUnitId: adGroupId,
|
|
3408
|
+
sdkVersion: SDK_VERSION,
|
|
3409
|
+
availableStyleIds: AVAILABLE_STYLE_IDS,
|
|
3410
|
+
// device는 매크로키만 보내고 native가 실제 device로 치환한다.
|
|
3411
|
+
device: FETCH_APPS_IN_TOSS_AD_DEVICE_MACRO,
|
|
3412
|
+
app: {
|
|
3413
|
+
version: (0, import_native_modules20.getTossAppVersion)(),
|
|
3414
|
+
bundle: resolveTossAppBundleId((0, import_native_modules20.getPlatformOS)()),
|
|
3415
|
+
subBundle: global.__granite?.app?.name ?? ""
|
|
3416
|
+
}
|
|
3417
|
+
};
|
|
3418
|
+
return new Promise((resolve, reject) => {
|
|
3419
|
+
fetchAppsInTossAd({ body, onEvent: resolve, onError: reject });
|
|
3420
|
+
});
|
|
3421
|
+
}
|
|
3422
|
+
return fetchTossAdPromise({ adGroupId, sdkId: SDK_ID, availableStyleIds: AVAILABLE_STYLE_IDS });
|
|
3423
|
+
}
|
|
3201
3424
|
function isApiResponse(payload) {
|
|
3202
3425
|
return Boolean(payload && typeof payload === "object" && "resultType" in payload);
|
|
3203
3426
|
}
|
|
@@ -3211,6 +3434,7 @@ function normalizeAdResponse(adResponse) {
|
|
|
3211
3434
|
})).filter((ad) => AVAILABLE_STYLE_IDS.includes(String(ad.styleId))) : [];
|
|
3212
3435
|
return {
|
|
3213
3436
|
requestId: adResponse.requestId ?? "",
|
|
3437
|
+
eventContextToken: adResponse.eventContextToken ?? "",
|
|
3214
3438
|
status: adResponse.status ?? "OK",
|
|
3215
3439
|
ads,
|
|
3216
3440
|
ext: adResponse.ext
|
|
@@ -3251,7 +3475,7 @@ async function loadAd(adGroupId) {
|
|
|
3251
3475
|
error: createError(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE)
|
|
3252
3476
|
};
|
|
3253
3477
|
}
|
|
3254
|
-
if (!fetchTossAd.isSupported()) {
|
|
3478
|
+
if (!fetchAppsInTossAd.isSupported() && !fetchTossAd.isSupported()) {
|
|
3255
3479
|
return {
|
|
3256
3480
|
type: "error",
|
|
3257
3481
|
error: createError(ERROR_CODES.SDK_NOT_INITIALIZED, "This feature is not supported in the current environment")
|
|
@@ -3259,11 +3483,7 @@ async function loadAd(adGroupId) {
|
|
|
3259
3483
|
}
|
|
3260
3484
|
let response;
|
|
3261
3485
|
try {
|
|
3262
|
-
const raw = await
|
|
3263
|
-
adGroupId: normalizedAdGroupId,
|
|
3264
|
-
sdkId: SDK_ID,
|
|
3265
|
-
availableStyleIds: AVAILABLE_STYLE_IDS
|
|
3266
|
-
});
|
|
3486
|
+
const raw = await requestAd(normalizedAdGroupId);
|
|
3267
3487
|
response = normalizeApiResponse(raw);
|
|
3268
3488
|
} catch (error) {
|
|
3269
3489
|
if (isAdError(error)) {
|
|
@@ -3365,6 +3585,162 @@ function supertossWeb(uri) {
|
|
|
3365
3585
|
return `supertoss://web?url=${encodeURIComponent(uri)}&external=true`;
|
|
3366
3586
|
}
|
|
3367
3587
|
|
|
3588
|
+
// src/ads/inlineAd/renderConfig.ts
|
|
3589
|
+
var listBannerPalette = {
|
|
3590
|
+
"1": {
|
|
3591
|
+
light: {
|
|
3592
|
+
title: "#4e5968",
|
|
3593
|
+
subtitle: "#6b7684",
|
|
3594
|
+
adClearance: "#b0b8c1",
|
|
3595
|
+
iconBg: "rgba(2,32,71,0.05)",
|
|
3596
|
+
iconBorder: "rgba(2,32,71,0.05)"
|
|
3597
|
+
},
|
|
3598
|
+
dark: {
|
|
3599
|
+
title: "rgba(253,253,255,0.75)",
|
|
3600
|
+
subtitle: "rgba(248,248,255,0.6)",
|
|
3601
|
+
adClearance: "rgba(242,242,255,0.47)",
|
|
3602
|
+
iconBg: "#ffffff",
|
|
3603
|
+
iconBorder: "rgba(217,217,255,0.11)"
|
|
3604
|
+
}
|
|
3605
|
+
},
|
|
3606
|
+
"2": {
|
|
3607
|
+
light: {
|
|
3608
|
+
title: "#4e5968",
|
|
3609
|
+
subtitle: "#6b7684",
|
|
3610
|
+
adClearance: "#b0b8c1",
|
|
3611
|
+
iconBg: "rgba(2,32,71,0.05)",
|
|
3612
|
+
iconBorder: "rgba(2,32,71,0.05)"
|
|
3613
|
+
},
|
|
3614
|
+
dark: {
|
|
3615
|
+
title: "rgba(253,253,255,0.75)",
|
|
3616
|
+
subtitle: "rgba(248,248,255,0.6)",
|
|
3617
|
+
adClearance: "rgba(242,242,255,0.47)",
|
|
3618
|
+
iconBg: "rgba(217,217,255,0.11)",
|
|
3619
|
+
iconBorder: "rgba(217,217,255,0.11)"
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
};
|
|
3623
|
+
var feedBannerPalette = {
|
|
3624
|
+
"1": {
|
|
3625
|
+
light: {
|
|
3626
|
+
brandLogoBg: "rgba(2,32,71,0.05)",
|
|
3627
|
+
brandLogoBorder: "rgba(2,32,71,0.05)",
|
|
3628
|
+
brandName: "#6b7684",
|
|
3629
|
+
adBadge: "#8b95a1",
|
|
3630
|
+
title: "#333d4b",
|
|
3631
|
+
subtitle: "#4e5968",
|
|
3632
|
+
adClearance: "#8b95a1",
|
|
3633
|
+
imageOverlayBorder: "rgba(2,32,71,0.05)"
|
|
3634
|
+
},
|
|
3635
|
+
dark: {
|
|
3636
|
+
brandLogoBg: "#ffffff",
|
|
3637
|
+
brandLogoBorder: "rgba(217,217,255,0.11)",
|
|
3638
|
+
brandName: "#9e9ea4",
|
|
3639
|
+
adBadge: "#7e7e87",
|
|
3640
|
+
title: "#e4e4e5",
|
|
3641
|
+
subtitle: "#c3c3c6",
|
|
3642
|
+
adClearance: "#7e7e87",
|
|
3643
|
+
imageOverlayBorder: "rgba(217,217,255,0.11)"
|
|
3644
|
+
}
|
|
3645
|
+
},
|
|
3646
|
+
"2": {
|
|
3647
|
+
light: {
|
|
3648
|
+
brandLogoBg: "rgba(2,32,71,0.05)",
|
|
3649
|
+
brandLogoBorder: "rgba(2,32,71,0.05)",
|
|
3650
|
+
brandName: "#6b7684",
|
|
3651
|
+
adBadge: "#8b95a1",
|
|
3652
|
+
title: "#333d4b",
|
|
3653
|
+
subtitle: "#4e5968",
|
|
3654
|
+
adClearance: "#8b95a1",
|
|
3655
|
+
imageOverlayBorder: "rgba(2,32,71,0.05)"
|
|
3656
|
+
},
|
|
3657
|
+
dark: {
|
|
3658
|
+
brandLogoBg: "rgba(217,217,255,0.11)",
|
|
3659
|
+
brandLogoBorder: "rgba(217,217,255,0.11)",
|
|
3660
|
+
brandName: "#9e9ea4",
|
|
3661
|
+
adBadge: "#7e7e87",
|
|
3662
|
+
title: "#e4e4e5",
|
|
3663
|
+
subtitle: "#c3c3c6",
|
|
3664
|
+
adClearance: "#7e7e87",
|
|
3665
|
+
imageOverlayBorder: "rgba(217,217,255,0.11)"
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
};
|
|
3669
|
+
function resolveCreativeVersion(creativeVersion) {
|
|
3670
|
+
return String(creativeVersion) === "2" ? "2" : "1";
|
|
3671
|
+
}
|
|
3672
|
+
function resolveListBannerRenderConfig(creativeVersion, theme) {
|
|
3673
|
+
const version = resolveCreativeVersion(creativeVersion);
|
|
3674
|
+
const isV2 = version === "2";
|
|
3675
|
+
return {
|
|
3676
|
+
colors: listBannerPalette[version][theme],
|
|
3677
|
+
defaultPaddingValue: DEFAULT_INLINE_AD_PADDING_BANNER,
|
|
3678
|
+
titleSlotId: isV2 ? "1001" : "101",
|
|
3679
|
+
subtitleSlotId: isV2 ? "1002" : "102",
|
|
3680
|
+
iconImageSlotId: isV2 ? "2505" : "202",
|
|
3681
|
+
adClearancePaddingRight: isV2 ? 24 : void 0
|
|
3682
|
+
};
|
|
3683
|
+
}
|
|
3684
|
+
function resolveFeedBannerRenderConfig(creativeVersion, theme) {
|
|
3685
|
+
const version = resolveCreativeVersion(creativeVersion);
|
|
3686
|
+
const isV2 = version === "2";
|
|
3687
|
+
return {
|
|
3688
|
+
colors: feedBannerPalette[version][theme],
|
|
3689
|
+
defaultPaddingValue: isV2 ? DEFAULT_INLINE_AD_PADDING_BANNER : DEFAULT_INLINE_AD_PADDING_NATIVE_IMAGE,
|
|
3690
|
+
brandImageSlotId: isV2 ? "2500" : "202",
|
|
3691
|
+
brandNameSlotId: isV2 ? "1004" : "103",
|
|
3692
|
+
titleSlotId: isV2 ? "1000" : "101",
|
|
3693
|
+
subtitleSlotId: isV2 ? "1002" : "102",
|
|
3694
|
+
mainImageSlotId: isV2 ? "2005" : "201",
|
|
3695
|
+
ctaButtonSlotId: "0",
|
|
3696
|
+
adBadgeText: isV2 ? "AD" : "\uAD11\uACE0",
|
|
3697
|
+
showTextArea: !isV2,
|
|
3698
|
+
adBadgePaddingLeft: isV2 ? 1 : void 0,
|
|
3699
|
+
imageButtonBackgroundColor: isV2 ? "#000000" : void 0,
|
|
3700
|
+
cardOverlayBorderWidth: isV2 ? 1.5 : void 0
|
|
3701
|
+
};
|
|
3702
|
+
}
|
|
3703
|
+
|
|
3704
|
+
// src/ads/inlineAd/resultTracking.ts
|
|
3705
|
+
async function fireResultTracking(result, adGroupId, ctx) {
|
|
3706
|
+
if (result.type !== "success") {
|
|
3707
|
+
return;
|
|
3708
|
+
}
|
|
3709
|
+
if (ctx.resultEndpoint == null || ctx.mediationId == null) {
|
|
3710
|
+
return;
|
|
3711
|
+
}
|
|
3712
|
+
const body = {
|
|
3713
|
+
mediationId: ctx.mediationId,
|
|
3714
|
+
spaceUnitId: adGroupId,
|
|
3715
|
+
requestId: result.response?.requestId ?? "",
|
|
3716
|
+
eventContextToken: ctx.eventContextToken,
|
|
3717
|
+
winnerSource: "TOSS",
|
|
3718
|
+
content: null,
|
|
3719
|
+
adUnitId: ctx.adUnitId ?? null,
|
|
3720
|
+
placementId: ctx.placementId ?? null,
|
|
3721
|
+
tossFailed: null
|
|
3722
|
+
};
|
|
3723
|
+
try {
|
|
3724
|
+
const res = await fetch(ctx.resultEndpoint, {
|
|
3725
|
+
method: "POST",
|
|
3726
|
+
headers: { "Content-Type": "application/json" },
|
|
3727
|
+
body: JSON.stringify(body)
|
|
3728
|
+
});
|
|
3729
|
+
if (!res.ok) {
|
|
3730
|
+
throw new Error(`HTTP ${res.status}`);
|
|
3731
|
+
}
|
|
3732
|
+
} catch (error) {
|
|
3733
|
+
trackBannerError({
|
|
3734
|
+
errorCode: ERROR_CODES.NETWORK_ERROR,
|
|
3735
|
+
errorMessage: `RESULT_TRACKING failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
3736
|
+
adGroupId,
|
|
3737
|
+
mediationId: ctx.mediationId,
|
|
3738
|
+
eventContextToken: ctx.eventContextToken,
|
|
3739
|
+
endpointError: ctx.errorEndpoint
|
|
3740
|
+
});
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3368
3744
|
// src/ads/inlineAd/tracking.ts
|
|
3369
3745
|
var GlobalEventDeduplicator = class _GlobalEventDeduplicator {
|
|
3370
3746
|
static MAX_EVENTS = 1e4;
|
|
@@ -3387,12 +3763,13 @@ var GlobalEventDeduplicator = class _GlobalEventDeduplicator {
|
|
|
3387
3763
|
};
|
|
3388
3764
|
var globalEventDeduplicator = new GlobalEventDeduplicator();
|
|
3389
3765
|
var EventTracker = class {
|
|
3390
|
-
constructor(eventTrackingUrls = [], eventTypes = [], eventPayload = "", requestId, creativeId, requestHeaders) {
|
|
3766
|
+
constructor(eventTrackingUrls = [], eventTypes = [], eventPayload = "", requestId, creativeId, requestHeaders, onTrackingError) {
|
|
3391
3767
|
this.eventTrackingUrls = eventTrackingUrls;
|
|
3392
3768
|
this.eventPayload = eventPayload;
|
|
3393
3769
|
this.requestId = requestId;
|
|
3394
3770
|
this.creativeId = creativeId;
|
|
3395
3771
|
this.requestHeaders = requestHeaders;
|
|
3772
|
+
this.onTrackingError = onTrackingError;
|
|
3396
3773
|
this.eventTypes = new Set(eventTypes);
|
|
3397
3774
|
this.repeatableEvents = /* @__PURE__ */ new Set(["VIEW_MUTE", "VIEW_UNMUTE"]);
|
|
3398
3775
|
}
|
|
@@ -3416,7 +3793,13 @@ var EventTracker = class {
|
|
|
3416
3793
|
type: eventType,
|
|
3417
3794
|
data: this.eventPayload
|
|
3418
3795
|
};
|
|
3419
|
-
await Promise.allSettled(
|
|
3796
|
+
const results = await Promise.allSettled(
|
|
3797
|
+
this.eventTrackingUrls.map((url) => this.sendTrackingRequest(url, payload))
|
|
3798
|
+
);
|
|
3799
|
+
const failedUrls = this.eventTrackingUrls.filter((_, index) => results[index]?.status === "rejected");
|
|
3800
|
+
if (failedUrls.length > 0) {
|
|
3801
|
+
this.onTrackingError?.(failedUrls);
|
|
3802
|
+
}
|
|
3420
3803
|
if (!this.repeatableEvents.has(eventType) && this.requestId && this.creativeId) {
|
|
3421
3804
|
globalEventDeduplicator.markTracked(this.requestId, this.creativeId, eventType);
|
|
3422
3805
|
}
|
|
@@ -3429,14 +3812,33 @@ var EventTracker = class {
|
|
|
3429
3812
|
if (this.requestId) {
|
|
3430
3813
|
headers["X-Toss-RequestId"] = this.requestId;
|
|
3431
3814
|
}
|
|
3432
|
-
await fetch(url, {
|
|
3815
|
+
const response = await fetch(url, {
|
|
3433
3816
|
method: "POST",
|
|
3434
3817
|
headers,
|
|
3435
3818
|
body: JSON.stringify(payload)
|
|
3436
3819
|
});
|
|
3820
|
+
if (!response.ok) {
|
|
3821
|
+
throw new Error(`HTTP ${response.status}`);
|
|
3822
|
+
}
|
|
3437
3823
|
}
|
|
3438
3824
|
};
|
|
3439
3825
|
|
|
3826
|
+
// src/ads/inlineAd/trackingContext.ts
|
|
3827
|
+
function nonEmptyString(value) {
|
|
3828
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
3829
|
+
}
|
|
3830
|
+
function extractAdTrackingContext(response) {
|
|
3831
|
+
const mediation = response?.ext?.mediation;
|
|
3832
|
+
return {
|
|
3833
|
+
mediationId: nonEmptyString(mediation?.mediationId),
|
|
3834
|
+
eventContextToken: nonEmptyString(response?.eventContextToken),
|
|
3835
|
+
resultEndpoint: nonEmptyString(mediation?.endpoint?.result),
|
|
3836
|
+
errorEndpoint: nonEmptyString(mediation?.endpoint?.error),
|
|
3837
|
+
adUnitId: nonEmptyString(mediation?.admob?.adUnitId),
|
|
3838
|
+
placementId: typeof mediation?.admob?.placementId === "number" ? mediation.admob.placementId : void 0
|
|
3839
|
+
};
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3440
3842
|
// src/ads/inlineAd/ui/FeedBannerAdView.tsx
|
|
3441
3843
|
var import_react_native_svg2 = require("@granite-js/native/react-native-svg");
|
|
3442
3844
|
var import_react29 = require("react");
|
|
@@ -3446,6 +3848,12 @@ var ARROW_PATH = "m7.5 20.4c-.5-.5-.5-1.2 0-1.7l6.7-6.7-6.8-6.7c-.5-.5-.5-1.2 0-
|
|
|
3446
3848
|
function FeedBannerAdView({
|
|
3447
3849
|
brandName,
|
|
3448
3850
|
brandLogoUri,
|
|
3851
|
+
brandImageSlotId,
|
|
3852
|
+
brandNameSlotId,
|
|
3853
|
+
titleSlotId,
|
|
3854
|
+
subtitleSlotId,
|
|
3855
|
+
mainImageSlotId,
|
|
3856
|
+
ctaButtonSlotId,
|
|
3449
3857
|
title,
|
|
3450
3858
|
subtitle,
|
|
3451
3859
|
mainImageUri,
|
|
@@ -3453,6 +3861,11 @@ function FeedBannerAdView({
|
|
|
3453
3861
|
ctaTextColor,
|
|
3454
3862
|
ctaBackgroundColor,
|
|
3455
3863
|
adClearanceText,
|
|
3864
|
+
adBadgeText,
|
|
3865
|
+
showTextArea,
|
|
3866
|
+
adBadgePaddingLeft,
|
|
3867
|
+
imageButtonBackgroundColor,
|
|
3868
|
+
cardOverlayBorderWidth,
|
|
3456
3869
|
colors: colors4,
|
|
3457
3870
|
isAdBadgeEnabled,
|
|
3458
3871
|
paddingStyle,
|
|
@@ -3490,7 +3903,7 @@ function FeedBannerAdView({
|
|
|
3490
3903
|
import_react_native44.Pressable,
|
|
3491
3904
|
{
|
|
3492
3905
|
accessibilityRole: "button",
|
|
3493
|
-
onPress: () => onPress(
|
|
3906
|
+
onPress: () => onPress(brandImageSlotId),
|
|
3494
3907
|
onPressIn: handlePressIn,
|
|
3495
3908
|
onPressOut: handlePressOut,
|
|
3496
3909
|
style: styles.logoContainer,
|
|
@@ -3505,7 +3918,7 @@ function FeedBannerAdView({
|
|
|
3505
3918
|
import_react_native44.Pressable,
|
|
3506
3919
|
{
|
|
3507
3920
|
accessibilityRole: "button",
|
|
3508
|
-
onPress: () => onPress(
|
|
3921
|
+
onPress: () => onPress(brandNameSlotId),
|
|
3509
3922
|
onPressIn: handlePressIn,
|
|
3510
3923
|
onPressOut: handlePressOut,
|
|
3511
3924
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -3519,15 +3932,23 @@ function FeedBannerAdView({
|
|
|
3519
3932
|
)
|
|
3520
3933
|
}
|
|
3521
3934
|
),
|
|
3522
|
-
isAdBadgeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3935
|
+
isAdBadgeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3936
|
+
import_react_native44.Text,
|
|
3937
|
+
{
|
|
3938
|
+
allowFontScaling: false,
|
|
3939
|
+
numberOfLines: 1,
|
|
3940
|
+
style: [styles.adBadge, { color: colors4.adBadge, paddingLeft: adBadgePaddingLeft }],
|
|
3941
|
+
children: adBadgeText
|
|
3942
|
+
}
|
|
3943
|
+
) : null
|
|
3523
3944
|
] })
|
|
3524
3945
|
] }),
|
|
3525
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_native44.View, { style: styles.textArea, children: [
|
|
3946
|
+
showTextArea ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_native44.View, { style: styles.textArea, children: [
|
|
3526
3947
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3527
3948
|
import_react_native44.Pressable,
|
|
3528
3949
|
{
|
|
3529
3950
|
accessibilityRole: "button",
|
|
3530
|
-
onPress: () => onPress(
|
|
3951
|
+
onPress: () => onPress(titleSlotId),
|
|
3531
3952
|
onPressIn: handlePressIn,
|
|
3532
3953
|
onPressOut: handlePressOut,
|
|
3533
3954
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native44.Text, { allowFontScaling: false, style: [styles.title, { color: colors4.title }], children: title })
|
|
@@ -3537,23 +3958,26 @@ function FeedBannerAdView({
|
|
|
3537
3958
|
import_react_native44.Pressable,
|
|
3538
3959
|
{
|
|
3539
3960
|
accessibilityRole: "button",
|
|
3540
|
-
onPress: () => onPress(
|
|
3961
|
+
onPress: () => onPress(subtitleSlotId),
|
|
3541
3962
|
onPressIn: handlePressIn,
|
|
3542
3963
|
onPressOut: handlePressOut,
|
|
3543
3964
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native44.Text, { allowFontScaling: false, style: [styles.subtitle, { color: colors4.subtitle }], children: subtitle })
|
|
3544
3965
|
}
|
|
3545
3966
|
)
|
|
3546
|
-
] })
|
|
3967
|
+
] }) : null
|
|
3547
3968
|
] }),
|
|
3548
3969
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_native44.View, { style: styles.card, children: [
|
|
3549
3970
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3550
3971
|
import_react_native44.Pressable,
|
|
3551
3972
|
{
|
|
3552
3973
|
accessibilityRole: "button",
|
|
3553
|
-
onPress: () => onPress(
|
|
3974
|
+
onPress: () => onPress(mainImageSlotId),
|
|
3554
3975
|
onPressIn: handlePressIn,
|
|
3555
3976
|
onPressOut: handlePressOut,
|
|
3556
|
-
style:
|
|
3977
|
+
style: [
|
|
3978
|
+
styles.imageButton,
|
|
3979
|
+
imageButtonBackgroundColor ? { backgroundColor: imageButtonBackgroundColor } : null
|
|
3980
|
+
],
|
|
3557
3981
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native44.View, { style: styles.imageContainer, children: mainImageUri ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native44.Image, { source: { uri: mainImageUri }, style: styles.mainImage, resizeMode: "cover" }) : null })
|
|
3558
3982
|
}
|
|
3559
3983
|
),
|
|
@@ -3561,7 +3985,7 @@ function FeedBannerAdView({
|
|
|
3561
3985
|
import_react_native44.Pressable,
|
|
3562
3986
|
{
|
|
3563
3987
|
accessibilityRole: "button",
|
|
3564
|
-
onPress: () => onPress(
|
|
3988
|
+
onPress: () => onPress(ctaButtonSlotId),
|
|
3565
3989
|
onPressIn: handlePressIn,
|
|
3566
3990
|
onPressOut: handlePressOut,
|
|
3567
3991
|
style: [styles.cta, { backgroundColor: resolvedCtaBackground }],
|
|
@@ -3571,7 +3995,18 @@ function FeedBannerAdView({
|
|
|
3571
3995
|
]
|
|
3572
3996
|
}
|
|
3573
3997
|
),
|
|
3574
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3998
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3999
|
+
import_react_native44.View,
|
|
4000
|
+
{
|
|
4001
|
+
style: [
|
|
4002
|
+
styles.cardOverlay,
|
|
4003
|
+
{
|
|
4004
|
+
borderColor: colors4.imageOverlayBorder,
|
|
4005
|
+
borderWidth: cardOverlayBorderWidth ?? styles.cardOverlay.borderWidth
|
|
4006
|
+
}
|
|
4007
|
+
]
|
|
4008
|
+
}
|
|
4009
|
+
)
|
|
3575
4010
|
] }),
|
|
3576
4011
|
adClearanceText ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native44.Text, { allowFontScaling: false, style: [styles.adClearance, { color: colors4.adClearance }], children: adClearanceText }) : null
|
|
3577
4012
|
] })
|
|
@@ -3701,8 +4136,12 @@ var SQUIRCLE_PATH = "M0 17.352C0 3.564 3.564 0 17.352 0H18.648C32.436 0 36 3.564
|
|
|
3701
4136
|
function ListBannerAdView({
|
|
3702
4137
|
title,
|
|
3703
4138
|
subtitle,
|
|
4139
|
+
titleSlotId,
|
|
4140
|
+
subtitleSlotId,
|
|
4141
|
+
iconImageSlotId,
|
|
3704
4142
|
adClearanceText,
|
|
3705
4143
|
adClearanceFontSize,
|
|
4144
|
+
adClearancePaddingRight,
|
|
3706
4145
|
imageUri,
|
|
3707
4146
|
paddingStyle,
|
|
3708
4147
|
colors: colors4,
|
|
@@ -3738,7 +4177,7 @@ function ListBannerAdView({
|
|
|
3738
4177
|
import_react_native45.Pressable,
|
|
3739
4178
|
{
|
|
3740
4179
|
accessibilityRole: "button",
|
|
3741
|
-
onPress: () => onPress(
|
|
4180
|
+
onPress: () => onPress(iconImageSlotId),
|
|
3742
4181
|
onPressIn: handlePressIn,
|
|
3743
4182
|
onPressOut: handlePressOut,
|
|
3744
4183
|
style: styles2.iconWrapper,
|
|
@@ -3773,7 +4212,7 @@ function ListBannerAdView({
|
|
|
3773
4212
|
import_react_native45.Pressable,
|
|
3774
4213
|
{
|
|
3775
4214
|
accessibilityRole: "button",
|
|
3776
|
-
onPress: () => onPress(
|
|
4215
|
+
onPress: () => onPress(titleSlotId),
|
|
3777
4216
|
onPressIn: handlePressIn,
|
|
3778
4217
|
onPressOut: handlePressOut,
|
|
3779
4218
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native45.Text, { allowFontScaling: false, style: [styles2.title, { color: colors4.title }], children: title })
|
|
@@ -3783,7 +4222,7 @@ function ListBannerAdView({
|
|
|
3783
4222
|
import_react_native45.Pressable,
|
|
3784
4223
|
{
|
|
3785
4224
|
accessibilityRole: "button",
|
|
3786
|
-
onPress: () => onPress(
|
|
4225
|
+
onPress: () => onPress(subtitleSlotId),
|
|
3787
4226
|
onPressIn: handlePressIn,
|
|
3788
4227
|
onPressOut: handlePressOut,
|
|
3789
4228
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_native45.Text, { allowFontScaling: false, style: [styles2.subtitle, { color: colors4.subtitle }], children: subtitle })
|
|
@@ -3800,7 +4239,8 @@ function ListBannerAdView({
|
|
|
3800
4239
|
{
|
|
3801
4240
|
color: colors4.adClearance,
|
|
3802
4241
|
fontSize: adClearanceFontSize,
|
|
3803
|
-
lineHeight: adClearanceFontSize * 1.2
|
|
4242
|
+
lineHeight: adClearanceFontSize * 1.2,
|
|
4243
|
+
paddingRight: adClearancePaddingRight
|
|
3804
4244
|
}
|
|
3805
4245
|
],
|
|
3806
4246
|
children: adClearanceText
|
|
@@ -3912,12 +4352,12 @@ function buildBannerEventPayload(slotId, adGroupId, ad) {
|
|
|
3912
4352
|
}
|
|
3913
4353
|
};
|
|
3914
4354
|
}
|
|
3915
|
-
function buildBannerErrorPayload(slotId, adGroupId, error) {
|
|
4355
|
+
function buildBannerErrorPayload(slotId, adGroupId, error, mediationId) {
|
|
3916
4356
|
return {
|
|
3917
4357
|
slotId,
|
|
3918
4358
|
adGroupId,
|
|
3919
4359
|
adMetadata: {},
|
|
3920
|
-
error
|
|
4360
|
+
error: mediationId ? { ...error, mediationId } : error
|
|
3921
4361
|
};
|
|
3922
4362
|
}
|
|
3923
4363
|
function buildNoFillPayload(slotId, adGroupId) {
|
|
@@ -3930,44 +4370,6 @@ function buildNoFillPayload(slotId, adGroupId) {
|
|
|
3930
4370
|
|
|
3931
4371
|
// src/ads/inlineAd/InlineAd.tsx
|
|
3932
4372
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3933
|
-
var themePalette = {
|
|
3934
|
-
light: {
|
|
3935
|
-
title: "#4e5968",
|
|
3936
|
-
subtitle: "#6b7684",
|
|
3937
|
-
adClearance: "#b0b8c1",
|
|
3938
|
-
iconBg: "rgba(2,32,71,0.05)",
|
|
3939
|
-
iconBorder: "rgba(2,32,71,0.05)"
|
|
3940
|
-
},
|
|
3941
|
-
dark: {
|
|
3942
|
-
title: "rgba(253,253,255,0.75)",
|
|
3943
|
-
subtitle: "rgba(248,248,255,0.6)",
|
|
3944
|
-
adClearance: "rgba(242,242,255,0.47)",
|
|
3945
|
-
iconBg: "#ffffff",
|
|
3946
|
-
iconBorder: "rgba(217,217,255,0.11)"
|
|
3947
|
-
}
|
|
3948
|
-
};
|
|
3949
|
-
var feedThemePalette = {
|
|
3950
|
-
light: {
|
|
3951
|
-
brandLogoBg: "rgba(2,32,71,0.05)",
|
|
3952
|
-
brandLogoBorder: "rgba(2,32,71,0.05)",
|
|
3953
|
-
brandName: "#6b7684",
|
|
3954
|
-
adBadge: "#8b95a1",
|
|
3955
|
-
title: "#333d4b",
|
|
3956
|
-
subtitle: "#4e5968",
|
|
3957
|
-
adClearance: "#8b95a1",
|
|
3958
|
-
imageOverlayBorder: "rgba(2,32,71,0.05)"
|
|
3959
|
-
},
|
|
3960
|
-
dark: {
|
|
3961
|
-
brandLogoBg: "#ffffff",
|
|
3962
|
-
brandLogoBorder: "rgba(217,217,255,0.11)",
|
|
3963
|
-
brandName: "#9e9ea4",
|
|
3964
|
-
adBadge: "#7e7e87",
|
|
3965
|
-
title: "#e4e4e5",
|
|
3966
|
-
subtitle: "#c3c3c6",
|
|
3967
|
-
adClearance: "#7e7e87",
|
|
3968
|
-
imageOverlayBorder: "rgba(217,217,255,0.11)"
|
|
3969
|
-
}
|
|
3970
|
-
};
|
|
3971
4373
|
function createError2(code, message) {
|
|
3972
4374
|
return {
|
|
3973
4375
|
code,
|
|
@@ -4045,8 +4447,6 @@ function InlineAd(props) {
|
|
|
4045
4447
|
const resolvedTheme = selectedTheme === "auto" ? colorScheme === "dark" ? "dark" : "light" : selectedTheme;
|
|
4046
4448
|
const resolvedTone = tone ?? DEFAULT_INLINE_AD_TONE;
|
|
4047
4449
|
const resolvedVariant = variant ?? DEFAULT_INLINE_AD_VARIANT;
|
|
4048
|
-
const colors4 = themePalette[resolvedTheme];
|
|
4049
|
-
const feedColors = feedThemePalette[resolvedTheme];
|
|
4050
4450
|
const backgroundColor = resolvedTone === "grey" ? resolvedTheme === "dark" ? "#101013" : "#f2f4f7" : resolvedTheme === "dark" ? "#17171c" : "#ffffff";
|
|
4051
4451
|
callbacksRef.current = {
|
|
4052
4452
|
onAdRendered,
|
|
@@ -4068,35 +4468,43 @@ function InlineAd(props) {
|
|
|
4068
4468
|
}, []);
|
|
4069
4469
|
(0, import_react31.useEffect)(() => {
|
|
4070
4470
|
const normalizedAdGroupId = normalizeAdGroupId(adGroupId);
|
|
4471
|
+
const emitFailure = (error, responseContext) => {
|
|
4472
|
+
callbacksRef.current.onAdFailedToRender?.(
|
|
4473
|
+
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, error, responseContext?.mediationId)
|
|
4474
|
+
);
|
|
4475
|
+
trackBannerError({
|
|
4476
|
+
errorCode: error.code,
|
|
4477
|
+
errorMessage: error.message,
|
|
4478
|
+
adGroupId: normalizedAdGroupId,
|
|
4479
|
+
mediationId: responseContext?.mediationId,
|
|
4480
|
+
eventContextToken: responseContext?.eventContextToken,
|
|
4481
|
+
endpointError: responseContext?.errorEndpoint
|
|
4482
|
+
});
|
|
4483
|
+
};
|
|
4071
4484
|
const loadAdRequest = () => {
|
|
4072
4485
|
if (loadingRef.current) {
|
|
4073
4486
|
return;
|
|
4074
4487
|
}
|
|
4075
4488
|
if (normalizedAdGroupId.length === 0) {
|
|
4076
|
-
|
|
4077
|
-
callbacksRef.current.onAdFailedToRender?.(
|
|
4078
|
-
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, error)
|
|
4079
|
-
);
|
|
4489
|
+
emitFailure(createError2(ERROR_CODES.INVALID_SPACE, INVALID_AD_GROUP_ID_ERROR_MESSAGE));
|
|
4080
4490
|
return;
|
|
4081
4491
|
}
|
|
4082
4492
|
loadingRef.current = true;
|
|
4083
4493
|
loadAd(normalizedAdGroupId).then((result) => {
|
|
4084
4494
|
if (!isMountedRef.current) return;
|
|
4495
|
+
const responseContext = extractAdTrackingContext(result.response);
|
|
4496
|
+
void fireResultTracking(result, normalizedAdGroupId, responseContext);
|
|
4085
4497
|
if (result.type === "noFill") {
|
|
4086
4498
|
callbacksRef.current.onNoFill?.(buildNoFillPayload(slotIdRef.current, normalizedAdGroupId));
|
|
4087
4499
|
return;
|
|
4088
4500
|
}
|
|
4089
4501
|
if (result.type === "error") {
|
|
4090
|
-
|
|
4091
|
-
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, result.error)
|
|
4092
|
-
);
|
|
4502
|
+
emitFailure(result.error, responseContext);
|
|
4093
4503
|
return;
|
|
4094
4504
|
}
|
|
4095
4505
|
if (!isValidCreative(result.ad)) {
|
|
4096
4506
|
const invalidError = createError2(ERROR_CODES.INTERNAL_ERROR, "Invalid creative payload");
|
|
4097
|
-
|
|
4098
|
-
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, invalidError)
|
|
4099
|
-
);
|
|
4507
|
+
emitFailure(invalidError, responseContext);
|
|
4100
4508
|
return;
|
|
4101
4509
|
}
|
|
4102
4510
|
if (result.responseExt?.refetchSeconds !== void 0) {
|
|
@@ -4113,21 +4521,29 @@ function InlineAd(props) {
|
|
|
4113
4521
|
}
|
|
4114
4522
|
const payload = buildBannerEventPayload(slotIdRef.current, normalizedAdGroupId, result.ad);
|
|
4115
4523
|
eventPayloadRef.current = payload;
|
|
4524
|
+
const reportEventTrackingFailure = (failedUrls) => trackBannerError({
|
|
4525
|
+
errorCode: ERROR_CODES.NETWORK_ERROR,
|
|
4526
|
+
errorMessage: `eventTracking delivery failed (${failedUrls.length})`,
|
|
4527
|
+
adGroupId: normalizedAdGroupId,
|
|
4528
|
+
mediationId: responseContext.mediationId,
|
|
4529
|
+
eventContextToken: responseContext.eventContextToken,
|
|
4530
|
+
endpointError: responseContext.errorEndpoint
|
|
4531
|
+
});
|
|
4116
4532
|
eventTrackerRef.current = new EventTracker(
|
|
4117
4533
|
result.ad.eventTrackingUrls ?? [],
|
|
4118
4534
|
result.ad.eventTypes ?? [],
|
|
4119
4535
|
result.ad.eventPayload ?? "",
|
|
4120
4536
|
result.requestId,
|
|
4121
|
-
result.ad.creative?.id
|
|
4537
|
+
result.ad.creative?.id,
|
|
4538
|
+
void 0,
|
|
4539
|
+
reportEventTrackingFailure
|
|
4122
4540
|
);
|
|
4123
4541
|
setIsAdBadgeEnabled(result.responseExt?.isAdBadgeEnabled !== false);
|
|
4124
4542
|
setAd(result.ad);
|
|
4125
4543
|
}).catch((error) => {
|
|
4126
4544
|
if (!isMountedRef.current) return;
|
|
4127
4545
|
const adError = error instanceof Error ? createError2(ERROR_CODES.INTERNAL_ERROR, error.message) : createError2(ERROR_CODES.INTERNAL_ERROR, "Unknown error");
|
|
4128
|
-
|
|
4129
|
-
buildBannerErrorPayload(slotIdRef.current, normalizedAdGroupId, adError)
|
|
4130
|
-
);
|
|
4546
|
+
emitFailure(adError);
|
|
4131
4547
|
}).finally(() => {
|
|
4132
4548
|
loadingRef.current = false;
|
|
4133
4549
|
});
|
|
@@ -4166,7 +4582,9 @@ function InlineAd(props) {
|
|
|
4166
4582
|
}
|
|
4167
4583
|
const impressionKey = `${ad.requestId ?? "request"}:${ad.creative?.id ?? "creative"}`;
|
|
4168
4584
|
const resolvedStyleId = ad.styleId || LIST_BANNER_STYLE_ID;
|
|
4169
|
-
const
|
|
4585
|
+
const listBannerConfig = resolveListBannerRenderConfig(ad.creativeVersion, resolvedTheme);
|
|
4586
|
+
const feedBannerConfig = resolveFeedBannerRenderConfig(ad.creativeVersion, resolvedTheme);
|
|
4587
|
+
const defaultPaddingValue = resolvedStyleId === LIST_BANNER_STYLE_ID ? listBannerConfig.defaultPaddingValue : feedBannerConfig.defaultPaddingValue;
|
|
4170
4588
|
const paddingStyle = resolvePaddingStyle(defaultPaddingValue);
|
|
4171
4589
|
const isListBanner = String(resolvedStyleId) === LIST_BANNER_STYLE_ID;
|
|
4172
4590
|
const isFeedBanner = String(resolvedStyleId) === FEED_BANNER_STYLE_ID;
|
|
@@ -4262,11 +4680,15 @@ function InlineAd(props) {
|
|
|
4262
4680
|
{
|
|
4263
4681
|
title: listCreative.title,
|
|
4264
4682
|
subtitle: subtitleText,
|
|
4683
|
+
titleSlotId: listBannerConfig.titleSlotId,
|
|
4684
|
+
subtitleSlotId: listBannerConfig.subtitleSlotId,
|
|
4685
|
+
iconImageSlotId: listBannerConfig.iconImageSlotId,
|
|
4265
4686
|
adClearanceText,
|
|
4266
4687
|
adClearanceFontSize,
|
|
4688
|
+
adClearancePaddingRight: listBannerConfig.adClearancePaddingRight,
|
|
4267
4689
|
imageUri,
|
|
4268
4690
|
paddingStyle,
|
|
4269
|
-
colors:
|
|
4691
|
+
colors: listBannerConfig.colors,
|
|
4270
4692
|
onPress: handleClick
|
|
4271
4693
|
}
|
|
4272
4694
|
) : null,
|
|
@@ -4275,6 +4697,12 @@ function InlineAd(props) {
|
|
|
4275
4697
|
{
|
|
4276
4698
|
brandName: feedCreative.brandName,
|
|
4277
4699
|
brandLogoUri,
|
|
4700
|
+
brandImageSlotId: feedBannerConfig.brandImageSlotId,
|
|
4701
|
+
brandNameSlotId: feedBannerConfig.brandNameSlotId,
|
|
4702
|
+
titleSlotId: feedBannerConfig.titleSlotId,
|
|
4703
|
+
subtitleSlotId: feedBannerConfig.subtitleSlotId,
|
|
4704
|
+
mainImageSlotId: feedBannerConfig.mainImageSlotId,
|
|
4705
|
+
ctaButtonSlotId: feedBannerConfig.ctaButtonSlotId,
|
|
4278
4706
|
title: feedCreative.title,
|
|
4279
4707
|
subtitle: feedCreative.subTitle,
|
|
4280
4708
|
mainImageUri,
|
|
@@ -4282,7 +4710,12 @@ function InlineAd(props) {
|
|
|
4282
4710
|
ctaTextColor: feedCreative.ctaTextColor,
|
|
4283
4711
|
ctaBackgroundColor: feedCreative.ctaBackgroundColor,
|
|
4284
4712
|
adClearanceText,
|
|
4285
|
-
|
|
4713
|
+
adBadgeText: feedBannerConfig.adBadgeText,
|
|
4714
|
+
showTextArea: feedBannerConfig.showTextArea,
|
|
4715
|
+
adBadgePaddingLeft: feedBannerConfig.adBadgePaddingLeft,
|
|
4716
|
+
imageButtonBackgroundColor: feedBannerConfig.imageButtonBackgroundColor,
|
|
4717
|
+
cardOverlayBorderWidth: feedBannerConfig.cardOverlayBorderWidth,
|
|
4718
|
+
colors: feedBannerConfig.colors,
|
|
4286
4719
|
isAdBadgeEnabled,
|
|
4287
4720
|
paddingStyle,
|
|
4288
4721
|
onPress: handleClick
|