@apps-in-toss/framework 1.5.3 → 1.6.0
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 +436 -58
- package/dist/index.d.cts +68 -2
- package/dist/index.d.ts +68 -2
- package/dist/index.js +404 -24
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,8 @@ __export(src_exports, {
|
|
|
37
37
|
OverlayProvider: () => import_private10.OverlayProvider,
|
|
38
38
|
WebView: () => WebView,
|
|
39
39
|
env: () => env,
|
|
40
|
+
loadFullScreenAd: () => loadFullScreenAd,
|
|
41
|
+
showFullScreenAd: () => showFullScreenAd,
|
|
40
42
|
useCreateUserAgent: () => useCreateUserAgent,
|
|
41
43
|
useGeolocation: () => useGeolocation,
|
|
42
44
|
useOverlay: () => import_private10.useOverlay,
|
|
@@ -1417,16 +1419,16 @@ var AppsInToss = {
|
|
|
1417
1419
|
};
|
|
1418
1420
|
|
|
1419
1421
|
// src/components/WebView.tsx
|
|
1420
|
-
var
|
|
1422
|
+
var import_native_modules22 = require("@apps-in-toss/native-modules");
|
|
1421
1423
|
var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
|
|
1422
1424
|
var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
|
|
1423
1425
|
var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
|
|
1424
1426
|
var import_react_native_safe_area_context4 = require("@granite-js/native/react-native-safe-area-context");
|
|
1425
|
-
var
|
|
1427
|
+
var import_react_native37 = require("@granite-js/react-native");
|
|
1426
1428
|
var import_tds_react_native14 = require("@toss/tds-react-native");
|
|
1427
1429
|
var import_private9 = require("@toss/tds-react-native/private");
|
|
1428
1430
|
var import_react28 = require("react");
|
|
1429
|
-
var
|
|
1431
|
+
var import_react_native38 = require("react-native");
|
|
1430
1432
|
|
|
1431
1433
|
// src/components/GameWebView.tsx
|
|
1432
1434
|
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
@@ -1594,6 +1596,360 @@ function convertIntentURL(url) {
|
|
|
1594
1596
|
return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
|
|
1595
1597
|
}
|
|
1596
1598
|
|
|
1599
|
+
// src/ads/fetchTossAd.ts
|
|
1600
|
+
var import_native_modules15 = require("@apps-in-toss/native-modules");
|
|
1601
|
+
|
|
1602
|
+
// ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
1603
|
+
function noop() {
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
// src/ads/generateSessionId.ts
|
|
1607
|
+
function generateSessionId() {
|
|
1608
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
1609
|
+
const r = Math.random() * 16 | 0;
|
|
1610
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
1611
|
+
return v.toString(16);
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
// src/ads/constants.ts
|
|
1616
|
+
var sessionId = generateSessionId();
|
|
1617
|
+
|
|
1618
|
+
// src/ads/fetchTossAd.ts
|
|
1619
|
+
var ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
|
|
1620
|
+
var IOS_FETCH_TOSS_AD_SUPPORTED_VERSION = "5.241.0";
|
|
1621
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
1622
|
+
var ENVIRONMENT = (0, import_native_modules15.getOperationalEnvironment)();
|
|
1623
|
+
function fetchTossAd(params) {
|
|
1624
|
+
if (!fetchTossAd.isSupported()) {
|
|
1625
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
1626
|
+
return noop;
|
|
1627
|
+
}
|
|
1628
|
+
const { onEvent, onError, options } = params;
|
|
1629
|
+
const { adGroupId } = options;
|
|
1630
|
+
const unregisterCallbacks = import_native_modules15.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
1631
|
+
"fetchTossAd",
|
|
1632
|
+
{ spaceUnitId: adGroupId, sessionId, sdkId: options.sdkId, availableStyleIds: options.availableStyleIds },
|
|
1633
|
+
{
|
|
1634
|
+
onSuccess: (response) => {
|
|
1635
|
+
onEvent(response);
|
|
1636
|
+
},
|
|
1637
|
+
onError: (error) => {
|
|
1638
|
+
onError(error);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
);
|
|
1642
|
+
return unregisterCallbacks;
|
|
1643
|
+
}
|
|
1644
|
+
fetchTossAd.isSupported = () => {
|
|
1645
|
+
if (ENVIRONMENT !== "toss") {
|
|
1646
|
+
return false;
|
|
1647
|
+
}
|
|
1648
|
+
return (0, import_native_modules15.isMinVersionSupported)({
|
|
1649
|
+
android: ANDROID_FETCH_TOSS_AD_SUPPORTED_VERSION,
|
|
1650
|
+
ios: IOS_FETCH_TOSS_AD_SUPPORTED_VERSION
|
|
1651
|
+
});
|
|
1652
|
+
};
|
|
1653
|
+
|
|
1654
|
+
// src/ads/integratedAd.ts
|
|
1655
|
+
var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
1656
|
+
|
|
1657
|
+
// src/ads/generateRequestId.ts
|
|
1658
|
+
function generateRequestId() {
|
|
1659
|
+
const timestamp = Date.now().toString(36).toUpperCase();
|
|
1660
|
+
const random = Math.random().toString(36).substring(2, 7).toUpperCase();
|
|
1661
|
+
return `ait-${timestamp}${random}`;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
// src/ads/getReferrer.ts
|
|
1665
|
+
var import_react_native29 = require("@granite-js/react-native");
|
|
1666
|
+
function getReferrer() {
|
|
1667
|
+
try {
|
|
1668
|
+
return new URL((0, import_react_native29.getSchemeUri)()).searchParams.get("referrer");
|
|
1669
|
+
} catch {
|
|
1670
|
+
return null;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
// src/ads/remotes.ts
|
|
1675
|
+
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1676
|
+
|
|
1677
|
+
// src/ads/getIsDev.ts
|
|
1678
|
+
var import_react_native30 = require("@granite-js/react-native");
|
|
1679
|
+
function getIsDev() {
|
|
1680
|
+
try {
|
|
1681
|
+
return new URL((0, import_react_native30.getSchemeUri)()).searchParams.get("isDev") === "true";
|
|
1682
|
+
} catch {
|
|
1683
|
+
return false;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
// src/ads/remotes.ts
|
|
1688
|
+
var OPERATIONAL_ENVIRONMENT = (0, import_native_modules16.getOperationalEnvironment)();
|
|
1689
|
+
var OS = (0, import_native_modules16.getPlatformOS)();
|
|
1690
|
+
var APP_VER = (0, import_native_modules16.getTossAppVersion)();
|
|
1691
|
+
var ALPHA_EVENT_TRACKER_HTTP_ENDPOINT = "https://alpha-trillion.toss.im/trk/sdk-mediation/event";
|
|
1692
|
+
var LIVE_EVENT_TRACKER_HTTP_ENDPOINT = "https://trillion.toss.im/trk/sdk-mediation/event";
|
|
1693
|
+
function getPostEventTrackingUrl() {
|
|
1694
|
+
const isDev = getIsDev();
|
|
1695
|
+
if (OPERATIONAL_ENVIRONMENT === "sandbox" || isDev) {
|
|
1696
|
+
return ALPHA_EVENT_TRACKER_HTTP_ENDPOINT;
|
|
1697
|
+
}
|
|
1698
|
+
return LIVE_EVENT_TRACKER_HTTP_ENDPOINT;
|
|
1699
|
+
}
|
|
1700
|
+
function postEventTracking(params) {
|
|
1701
|
+
const endpoint = getPostEventTrackingUrl();
|
|
1702
|
+
const bodyJSON = JSON.stringify({
|
|
1703
|
+
...params,
|
|
1704
|
+
os: OS,
|
|
1705
|
+
appVer: APP_VER,
|
|
1706
|
+
deviceIdType: "NONE",
|
|
1707
|
+
platform: "RN"
|
|
1708
|
+
});
|
|
1709
|
+
return fetch(
|
|
1710
|
+
endpoint,
|
|
1711
|
+
{
|
|
1712
|
+
method: "POST",
|
|
1713
|
+
headers: {
|
|
1714
|
+
"Content-Type": "application/json"
|
|
1715
|
+
},
|
|
1716
|
+
body: bodyJSON
|
|
1717
|
+
}
|
|
1718
|
+
).catch(noop);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// src/ads/integratedAd.ts
|
|
1722
|
+
var INTEGRATED_AD_SDK_VERSION = "0.0.0";
|
|
1723
|
+
var ANDROID_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
|
|
1724
|
+
var IOS_INTEGRATED_AD_SUPPORTED_VERSION = "5.241.0";
|
|
1725
|
+
var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
|
|
1726
|
+
var INTG_AD_ADM_FALLBACK_RID_MAP = {};
|
|
1727
|
+
function integratedAdIsSupported() {
|
|
1728
|
+
return (0, import_native_modules17.isMinVersionSupported)({
|
|
1729
|
+
android: ANDROID_INTEGRATED_AD_SUPPORTED_VERSION,
|
|
1730
|
+
ios: IOS_INTEGRATED_AD_SUPPORTED_VERSION
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
function generateLoadFullScreenAd(sdkId) {
|
|
1734
|
+
const fn = (params) => {
|
|
1735
|
+
if (!import_native_modules17.GoogleAdMob.loadAppsInTossAdMob.isSupported()) {
|
|
1736
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
1737
|
+
return noop;
|
|
1738
|
+
}
|
|
1739
|
+
if (!integratedAdIsSupported()) {
|
|
1740
|
+
return import_native_modules17.GoogleAdMob.loadAppsInTossAdMob({
|
|
1741
|
+
...params,
|
|
1742
|
+
onEvent: (event) => {
|
|
1743
|
+
if (event.type === "loaded") {
|
|
1744
|
+
const requestId = generateRequestId();
|
|
1745
|
+
INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] = requestId;
|
|
1746
|
+
postEventTracking({
|
|
1747
|
+
eventName: "LOAD",
|
|
1748
|
+
spaceUnitId: params.options.adGroupId,
|
|
1749
|
+
requestId,
|
|
1750
|
+
responseId: event.data.responseInfo.responseId,
|
|
1751
|
+
mediationType: "ADMOB",
|
|
1752
|
+
format: "",
|
|
1753
|
+
adSourceName: event.data.responseInfo.loadedAdNetworkInfo?.adSourceName ?? "",
|
|
1754
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
return params.onEvent(event);
|
|
1758
|
+
},
|
|
1759
|
+
onError: (error) => {
|
|
1760
|
+
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
|
|
1761
|
+
postEventTracking({
|
|
1762
|
+
eventName: "FAILED_TO_LOAD",
|
|
1763
|
+
spaceUnitId: params.options.adGroupId,
|
|
1764
|
+
requestId,
|
|
1765
|
+
responseId: "",
|
|
1766
|
+
mediationType: "ADMOB",
|
|
1767
|
+
format: "",
|
|
1768
|
+
adSourceName: "",
|
|
1769
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1770
|
+
});
|
|
1771
|
+
return params.onError(error);
|
|
1772
|
+
}
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
const { onEvent, onError, options } = params;
|
|
1776
|
+
const { adGroupId } = options;
|
|
1777
|
+
const referrer = getReferrer();
|
|
1778
|
+
const unregisterCallbacks = import_native_modules17.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
1779
|
+
"loadTossAdOrAdmob",
|
|
1780
|
+
{ spaceUnitId: adGroupId, referrer, sessionId, sdkId },
|
|
1781
|
+
{
|
|
1782
|
+
onSuccess: () => {
|
|
1783
|
+
onEvent({ type: "loaded" });
|
|
1784
|
+
},
|
|
1785
|
+
onError: (error) => {
|
|
1786
|
+
onError(error);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
);
|
|
1790
|
+
return unregisterCallbacks;
|
|
1791
|
+
};
|
|
1792
|
+
fn.isSupported = import_native_modules17.GoogleAdMob.loadAppsInTossAdMob.isSupported;
|
|
1793
|
+
return fn;
|
|
1794
|
+
}
|
|
1795
|
+
var loadFullScreenAd = generateLoadFullScreenAd("107");
|
|
1796
|
+
var loadFullScreenAdForWeb = generateLoadFullScreenAd("107");
|
|
1797
|
+
function showFullScreenAd(params) {
|
|
1798
|
+
if (!import_native_modules17.GoogleAdMob.showAppsInTossAdMob.isSupported()) {
|
|
1799
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
1800
|
+
return noop;
|
|
1801
|
+
}
|
|
1802
|
+
if (!integratedAdIsSupported()) {
|
|
1803
|
+
return import_native_modules17.GoogleAdMob.showAppsInTossAdMob({
|
|
1804
|
+
...params,
|
|
1805
|
+
onEvent: (event) => {
|
|
1806
|
+
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
|
|
1807
|
+
switch (event.type) {
|
|
1808
|
+
case "show":
|
|
1809
|
+
postEventTracking({
|
|
1810
|
+
eventName: "SHOW",
|
|
1811
|
+
spaceUnitId: params.options.adGroupId,
|
|
1812
|
+
requestId,
|
|
1813
|
+
responseId: "",
|
|
1814
|
+
mediationType: "ADMOB",
|
|
1815
|
+
format: "",
|
|
1816
|
+
adSourceName: "",
|
|
1817
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1818
|
+
});
|
|
1819
|
+
break;
|
|
1820
|
+
case "failedToShow":
|
|
1821
|
+
postEventTracking({
|
|
1822
|
+
eventName: "FAILED_TO_SHOW",
|
|
1823
|
+
spaceUnitId: params.options.adGroupId,
|
|
1824
|
+
requestId,
|
|
1825
|
+
responseId: "",
|
|
1826
|
+
mediationType: "ADMOB",
|
|
1827
|
+
format: "",
|
|
1828
|
+
adSourceName: "",
|
|
1829
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1830
|
+
});
|
|
1831
|
+
break;
|
|
1832
|
+
case "impression":
|
|
1833
|
+
postEventTracking({
|
|
1834
|
+
eventName: "IMP",
|
|
1835
|
+
spaceUnitId: params.options.adGroupId,
|
|
1836
|
+
requestId,
|
|
1837
|
+
responseId: "",
|
|
1838
|
+
mediationType: "ADMOB",
|
|
1839
|
+
format: "",
|
|
1840
|
+
adSourceName: "",
|
|
1841
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1842
|
+
});
|
|
1843
|
+
break;
|
|
1844
|
+
case "clicked":
|
|
1845
|
+
postEventTracking({
|
|
1846
|
+
eventName: "CLICK",
|
|
1847
|
+
spaceUnitId: params.options.adGroupId,
|
|
1848
|
+
requestId,
|
|
1849
|
+
responseId: "",
|
|
1850
|
+
mediationType: "ADMOB",
|
|
1851
|
+
format: "",
|
|
1852
|
+
adSourceName: "",
|
|
1853
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1854
|
+
});
|
|
1855
|
+
break;
|
|
1856
|
+
case "dismissed":
|
|
1857
|
+
postEventTracking({
|
|
1858
|
+
eventName: "DISMISS",
|
|
1859
|
+
spaceUnitId: params.options.adGroupId,
|
|
1860
|
+
requestId,
|
|
1861
|
+
responseId: "",
|
|
1862
|
+
mediationType: "ADMOB",
|
|
1863
|
+
format: "",
|
|
1864
|
+
adSourceName: "",
|
|
1865
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1866
|
+
});
|
|
1867
|
+
break;
|
|
1868
|
+
case "userEarnedReward":
|
|
1869
|
+
postEventTracking({
|
|
1870
|
+
eventName: "USER_EARNED_REWARD",
|
|
1871
|
+
spaceUnitId: params.options.adGroupId,
|
|
1872
|
+
requestId,
|
|
1873
|
+
responseId: "",
|
|
1874
|
+
mediationType: "ADMOB",
|
|
1875
|
+
format: "",
|
|
1876
|
+
adSourceName: "",
|
|
1877
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1878
|
+
});
|
|
1879
|
+
break;
|
|
1880
|
+
}
|
|
1881
|
+
return params.onEvent(event);
|
|
1882
|
+
},
|
|
1883
|
+
onError: (error) => {
|
|
1884
|
+
const requestId = INTG_AD_ADM_FALLBACK_RID_MAP[params.options.adGroupId] ?? "";
|
|
1885
|
+
postEventTracking({
|
|
1886
|
+
eventName: "FAILED_TO_SHOW",
|
|
1887
|
+
spaceUnitId: params.options.adGroupId,
|
|
1888
|
+
requestId,
|
|
1889
|
+
responseId: "",
|
|
1890
|
+
mediationType: "ADMOB",
|
|
1891
|
+
format: "",
|
|
1892
|
+
adSourceName: "",
|
|
1893
|
+
sdkVer: INTEGRATED_AD_SDK_VERSION
|
|
1894
|
+
});
|
|
1895
|
+
return params.onError(error);
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
const { onEvent, onError, options } = params;
|
|
1900
|
+
const { adGroupId } = options;
|
|
1901
|
+
const referrer = getReferrer();
|
|
1902
|
+
const unregisterCallbacks = import_native_modules17.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
1903
|
+
"showTossAdOrAdmob",
|
|
1904
|
+
{ spaceUnitId: adGroupId, referrer, sessionId },
|
|
1905
|
+
{
|
|
1906
|
+
onAdClicked: () => {
|
|
1907
|
+
onEvent({ type: "clicked" });
|
|
1908
|
+
},
|
|
1909
|
+
onAdDismissed: () => {
|
|
1910
|
+
onEvent({ type: "dismissed" });
|
|
1911
|
+
},
|
|
1912
|
+
onAdFailedToShow: () => {
|
|
1913
|
+
onEvent({ type: "failedToShow" });
|
|
1914
|
+
},
|
|
1915
|
+
onAdImpression: () => {
|
|
1916
|
+
onEvent({ type: "impression" });
|
|
1917
|
+
},
|
|
1918
|
+
onAdShow: () => {
|
|
1919
|
+
onEvent({ type: "show" });
|
|
1920
|
+
},
|
|
1921
|
+
onUserEarnedReward: (data) => {
|
|
1922
|
+
onEvent({ type: "userEarnedReward", data });
|
|
1923
|
+
},
|
|
1924
|
+
onSuccess: () => {
|
|
1925
|
+
onEvent({ type: "requested" });
|
|
1926
|
+
},
|
|
1927
|
+
onError: (error) => {
|
|
1928
|
+
onError(error);
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
);
|
|
1932
|
+
return unregisterCallbacks;
|
|
1933
|
+
}
|
|
1934
|
+
showFullScreenAd.isSupported = import_native_modules17.GoogleAdMob.showAppsInTossAdMob.isSupported;
|
|
1935
|
+
|
|
1936
|
+
// src/ads/tossAdEventLog.ts
|
|
1937
|
+
var import_native_modules18 = require("@apps-in-toss/native-modules");
|
|
1938
|
+
var import_react_native31 = require("@granite-js/react-native");
|
|
1939
|
+
async function tossAdEventLog(params) {
|
|
1940
|
+
const referrer = getReferrer();
|
|
1941
|
+
const appName = import_react_native31.Granite.appName;
|
|
1942
|
+
const eventLogParams = {
|
|
1943
|
+
...params,
|
|
1944
|
+
params: {
|
|
1945
|
+
...params.params,
|
|
1946
|
+
referrer,
|
|
1947
|
+
app_name: appName
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
return import_native_modules18.INTERNAL__module.tossCoreEventLog(eventLogParams);
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1597
1953
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1598
1954
|
var import_react22 = require("react");
|
|
1599
1955
|
function serializeError(error) {
|
|
@@ -1769,7 +2125,7 @@ function useSafeAreaInsetsEmitter() {
|
|
|
1769
2125
|
}
|
|
1770
2126
|
|
|
1771
2127
|
// src/core/hooks/useWebBackHandler.tsx
|
|
1772
|
-
var
|
|
2128
|
+
var import_react_native32 = require("@granite-js/react-native");
|
|
1773
2129
|
var import_tds_react_native13 = require("@toss/tds-react-native");
|
|
1774
2130
|
var import_es_hangul5 = require("es-hangul");
|
|
1775
2131
|
var import_react25 = require("react");
|
|
@@ -1839,7 +2195,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1839
2195
|
hasBackEvent: hasWebBackEvent,
|
|
1840
2196
|
addEventListener: addWebBackEventListener,
|
|
1841
2197
|
removeEventListener: removeWebBackEventListener
|
|
1842
|
-
} = (0,
|
|
2198
|
+
} = (0, import_react_native32.useBackEventState)();
|
|
1843
2199
|
const logging = useNavigationBarLogging();
|
|
1844
2200
|
const { openConfirm } = (0, import_tds_react_native13.useDialog)();
|
|
1845
2201
|
const global2 = getAppsInTossGlobals();
|
|
@@ -1875,7 +2231,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1875
2231
|
logging.closePopupCtaClick(isConfirmed);
|
|
1876
2232
|
if (isConfirmed) {
|
|
1877
2233
|
captureExitLog(Date.now());
|
|
1878
|
-
(0,
|
|
2234
|
+
(0, import_react_native32.closeView)();
|
|
1879
2235
|
}
|
|
1880
2236
|
}
|
|
1881
2237
|
}, [
|
|
@@ -1918,8 +2274,8 @@ function mergeRefs(...refs) {
|
|
|
1918
2274
|
}
|
|
1919
2275
|
|
|
1920
2276
|
// src/hooks/useCreateUserAgent.ts
|
|
1921
|
-
var
|
|
1922
|
-
var
|
|
2277
|
+
var import_native_modules19 = require("@apps-in-toss/native-modules");
|
|
2278
|
+
var import_react_native33 = require("react-native");
|
|
1923
2279
|
var FontA11yCategory = {
|
|
1924
2280
|
Large: "Large",
|
|
1925
2281
|
xLarge: "xLarge",
|
|
@@ -2052,9 +2408,9 @@ function useCreateUserAgent({
|
|
|
2052
2408
|
safeArea,
|
|
2053
2409
|
safeAreaBottomTransparency
|
|
2054
2410
|
}) {
|
|
2055
|
-
const platform = (0,
|
|
2056
|
-
const appVersion = (0,
|
|
2057
|
-
const { fontScale } = (0,
|
|
2411
|
+
const platform = (0, import_native_modules19.getPlatformOS)();
|
|
2412
|
+
const appVersion = (0, import_native_modules19.getTossAppVersion)();
|
|
2413
|
+
const { fontScale } = (0, import_react_native33.useWindowDimensions)();
|
|
2058
2414
|
const platformString = platform === "ios" ? "iPhone" : "Android phone";
|
|
2059
2415
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
2060
2416
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
@@ -2075,17 +2431,17 @@ function useCreateUserAgent({
|
|
|
2075
2431
|
}
|
|
2076
2432
|
|
|
2077
2433
|
// src/hooks/useGeolocation.ts
|
|
2078
|
-
var
|
|
2079
|
-
var
|
|
2434
|
+
var import_native_modules20 = require("@apps-in-toss/native-modules");
|
|
2435
|
+
var import_react_native34 = require("@granite-js/react-native");
|
|
2080
2436
|
var import_react26 = require("react");
|
|
2081
2437
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
2082
|
-
const isVisible = (0,
|
|
2438
|
+
const isVisible = (0, import_react_native34.useVisibility)();
|
|
2083
2439
|
const [location, setLocation] = (0, import_react26.useState)(null);
|
|
2084
2440
|
(0, import_react26.useEffect)(() => {
|
|
2085
2441
|
if (!isVisible) {
|
|
2086
2442
|
return;
|
|
2087
2443
|
}
|
|
2088
|
-
return (0,
|
|
2444
|
+
return (0, import_native_modules20.startUpdateLocation)({
|
|
2089
2445
|
options: {
|
|
2090
2446
|
accuracy,
|
|
2091
2447
|
distanceInterval,
|
|
@@ -2099,11 +2455,11 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
2099
2455
|
}
|
|
2100
2456
|
|
|
2101
2457
|
// src/hooks/useWaitForReturnNavigator.tsx
|
|
2102
|
-
var
|
|
2458
|
+
var import_react_native35 = require("@granite-js/react-native");
|
|
2103
2459
|
var import_react27 = require("react");
|
|
2104
2460
|
function useWaitForReturnNavigator() {
|
|
2105
2461
|
const callbacks = (0, import_react27.useRef)([]).current;
|
|
2106
|
-
const navigation = (0,
|
|
2462
|
+
const navigation = (0, import_react_native35.useNavigation)();
|
|
2107
2463
|
const startNavigating = (0, import_react27.useCallback)(
|
|
2108
2464
|
(route, params) => {
|
|
2109
2465
|
return new Promise((resolve) => {
|
|
@@ -2124,7 +2480,7 @@ function useWaitForReturnNavigator() {
|
|
|
2124
2480
|
},
|
|
2125
2481
|
[callbacks]
|
|
2126
2482
|
);
|
|
2127
|
-
(0,
|
|
2483
|
+
(0, import_react_native35.useVisibilityChange)(handleVisibilityChange);
|
|
2128
2484
|
return startNavigating;
|
|
2129
2485
|
}
|
|
2130
2486
|
|
|
@@ -2138,8 +2494,8 @@ function useTopNavigation() {
|
|
|
2138
2494
|
}
|
|
2139
2495
|
|
|
2140
2496
|
// src/utils/log.ts
|
|
2141
|
-
var
|
|
2142
|
-
var
|
|
2497
|
+
var import_native_modules21 = require("@apps-in-toss/native-modules");
|
|
2498
|
+
var import_react_native36 = require("@granite-js/react-native");
|
|
2143
2499
|
|
|
2144
2500
|
// src/utils/extractDateFromUUIDv7.ts
|
|
2145
2501
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -2163,9 +2519,9 @@ var getGroupId = (url) => {
|
|
|
2163
2519
|
};
|
|
2164
2520
|
}
|
|
2165
2521
|
};
|
|
2166
|
-
var
|
|
2522
|
+
var getReferrer2 = () => {
|
|
2167
2523
|
try {
|
|
2168
|
-
const referrer = new URL((0,
|
|
2524
|
+
const referrer = new URL((0, import_react_native36.getSchemeUri)());
|
|
2169
2525
|
return referrer.searchParams.get("referrer");
|
|
2170
2526
|
} catch {
|
|
2171
2527
|
return "";
|
|
@@ -2178,12 +2534,12 @@ var trackScreen = (url) => {
|
|
|
2178
2534
|
log_name: `${groupId}::screen`,
|
|
2179
2535
|
params: {
|
|
2180
2536
|
search,
|
|
2181
|
-
referrer:
|
|
2537
|
+
referrer: getReferrer2(),
|
|
2182
2538
|
deployment_id: env.getDeploymentId(),
|
|
2183
2539
|
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
2184
2540
|
}
|
|
2185
2541
|
};
|
|
2186
|
-
return (0,
|
|
2542
|
+
return (0, import_native_modules21.eventLog)(log);
|
|
2187
2543
|
};
|
|
2188
2544
|
|
|
2189
2545
|
// src/components/WebView.tsx
|
|
@@ -2197,7 +2553,7 @@ var WEBVIEW_TYPES = {
|
|
|
2197
2553
|
};
|
|
2198
2554
|
function mergeSchemeQueryParamsInto(url) {
|
|
2199
2555
|
const baseUrl = new URL(url);
|
|
2200
|
-
const schemeUrl = new URL((0,
|
|
2556
|
+
const schemeUrl = new URL((0, import_react_native37.getSchemeUri)());
|
|
2201
2557
|
baseUrl.pathname = schemeUrl.pathname;
|
|
2202
2558
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
2203
2559
|
baseUrl.searchParams.set(key, value);
|
|
@@ -2209,7 +2565,7 @@ function getWebViewUri(local) {
|
|
|
2209
2565
|
const devUrl = `http://${local.host}:${local.port}`;
|
|
2210
2566
|
return mergeSchemeQueryParamsInto(devUrl).toString();
|
|
2211
2567
|
}
|
|
2212
|
-
const { url: rawUrl } =
|
|
2568
|
+
const { url: rawUrl } = import_native_modules22.AppsInTossModule.getWebBundleURL({});
|
|
2213
2569
|
const url = mergeSchemeQueryParamsInto(rawUrl);
|
|
2214
2570
|
const deploymentId = env.getDeploymentId();
|
|
2215
2571
|
if (deploymentId) {
|
|
@@ -2244,7 +2600,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2244
2600
|
webBackHandler.removeEventListener(onEvent);
|
|
2245
2601
|
};
|
|
2246
2602
|
},
|
|
2247
|
-
updateLocationEvent: ({ onEvent, onError, options }) =>
|
|
2603
|
+
updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules22.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
2248
2604
|
safeAreaInsetsChange: ({ onEvent }) => {
|
|
2249
2605
|
safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
|
|
2250
2606
|
return () => {
|
|
@@ -2252,18 +2608,23 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2252
2608
|
};
|
|
2253
2609
|
},
|
|
2254
2610
|
/** @internal */
|
|
2255
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
2611
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules22.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
2256
2612
|
/** AdMob */
|
|
2257
|
-
loadAdMobInterstitialAd:
|
|
2258
|
-
showAdMobInterstitialAd:
|
|
2259
|
-
loadAdMobRewardedAd:
|
|
2260
|
-
showAdMobRewardedAd:
|
|
2613
|
+
loadAdMobInterstitialAd: import_native_modules22.GoogleAdMob.loadAdMobInterstitialAd,
|
|
2614
|
+
showAdMobInterstitialAd: import_native_modules22.GoogleAdMob.showAdMobInterstitialAd,
|
|
2615
|
+
loadAdMobRewardedAd: import_native_modules22.GoogleAdMob.loadAdMobRewardedAd,
|
|
2616
|
+
showAdMobRewardedAd: import_native_modules22.GoogleAdMob.showAdMobRewardedAd,
|
|
2261
2617
|
/** AdMobV2 */
|
|
2262
|
-
loadAppsInTossAdMob:
|
|
2263
|
-
showAppsInTossAdMob:
|
|
2618
|
+
loadAppsInTossAdMob: import_native_modules22.GoogleAdMob.loadAppsInTossAdMob,
|
|
2619
|
+
showAppsInTossAdMob: import_native_modules22.GoogleAdMob.showAppsInTossAdMob,
|
|
2620
|
+
/** IntegratedAd */
|
|
2621
|
+
loadFullScreenAd: loadFullScreenAdForWeb,
|
|
2622
|
+
showFullScreenAd,
|
|
2623
|
+
/** TossAd */
|
|
2624
|
+
fetchTossAd,
|
|
2264
2625
|
/** IAP */
|
|
2265
|
-
iapCreateOneTimePurchaseOrder:
|
|
2266
|
-
requestOneTimePurchase:
|
|
2626
|
+
iapCreateOneTimePurchaseOrder: import_native_modules22.IAP.createOneTimePurchaseOrder,
|
|
2627
|
+
requestOneTimePurchase: import_native_modules22.requestOneTimePurchase
|
|
2267
2628
|
},
|
|
2268
2629
|
constantHandlerMap: {
|
|
2269
2630
|
...appsInTossConstantBridges,
|
|
@@ -2273,13 +2634,18 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2273
2634
|
getSafeAreaRight: () => insets.right,
|
|
2274
2635
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
2275
2636
|
/** AdMob */
|
|
2276
|
-
loadAdMobInterstitialAd_isSupported:
|
|
2277
|
-
showAdMobInterstitialAd_isSupported:
|
|
2278
|
-
loadAdMobRewardedAd_isSupported:
|
|
2279
|
-
showAdMobRewardedAd_isSupported:
|
|
2637
|
+
loadAdMobInterstitialAd_isSupported: import_native_modules22.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
2638
|
+
showAdMobInterstitialAd_isSupported: import_native_modules22.GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
2639
|
+
loadAdMobRewardedAd_isSupported: import_native_modules22.GoogleAdMob.loadAdMobRewardedAd.isSupported,
|
|
2640
|
+
showAdMobRewardedAd_isSupported: import_native_modules22.GoogleAdMob.showAdMobRewardedAd.isSupported,
|
|
2280
2641
|
/** AdMobV2 */
|
|
2281
|
-
loadAppsInTossAdMob_isSupported:
|
|
2282
|
-
showAppsInTossAdMob_isSupported:
|
|
2642
|
+
loadAppsInTossAdMob_isSupported: import_native_modules22.GoogleAdMob.loadAppsInTossAdMob.isSupported,
|
|
2643
|
+
showAppsInTossAdMob_isSupported: import_native_modules22.GoogleAdMob.showAppsInTossAdMob.isSupported,
|
|
2644
|
+
/** IntegratedAd */
|
|
2645
|
+
loadFullScreenAd_isSupported: loadFullScreenAdForWeb.isSupported,
|
|
2646
|
+
showFullScreenAd_isSupported: showFullScreenAd.isSupported,
|
|
2647
|
+
/** TossAd */
|
|
2648
|
+
fetchTossAd_isSupported: fetchTossAd.isSupported,
|
|
2283
2649
|
/** env */
|
|
2284
2650
|
getDeploymentId: env.getDeploymentId
|
|
2285
2651
|
},
|
|
@@ -2302,17 +2668,19 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2302
2668
|
getCurrentLocation: appsInTossAsyncBridges.getCurrentLocation,
|
|
2303
2669
|
openCamera: appsInTossAsyncBridges.openCamera,
|
|
2304
2670
|
/** Storage */
|
|
2305
|
-
getStorageItem:
|
|
2306
|
-
setStorageItem:
|
|
2307
|
-
removeStorageItem:
|
|
2308
|
-
clearItems:
|
|
2671
|
+
getStorageItem: import_native_modules22.Storage.getItem,
|
|
2672
|
+
setStorageItem: import_native_modules22.Storage.setItem,
|
|
2673
|
+
removeStorageItem: import_native_modules22.Storage.removeItem,
|
|
2674
|
+
clearItems: import_native_modules22.Storage.clearItems,
|
|
2309
2675
|
/** IAP */
|
|
2310
|
-
iapGetProductItemList:
|
|
2311
|
-
iapCreateOneTimePurchaseOrder:
|
|
2312
|
-
processProductGrant:
|
|
2313
|
-
getPendingOrders:
|
|
2314
|
-
getCompletedOrRefundedOrders:
|
|
2315
|
-
completeProductGrant:
|
|
2676
|
+
iapGetProductItemList: import_native_modules22.IAP.getProductItemList,
|
|
2677
|
+
iapCreateOneTimePurchaseOrder: import_native_modules22.iapCreateOneTimePurchaseOrder,
|
|
2678
|
+
processProductGrant: import_native_modules22.processProductGrant,
|
|
2679
|
+
getPendingOrders: import_native_modules22.IAP.getPendingOrders,
|
|
2680
|
+
getCompletedOrRefundedOrders: import_native_modules22.IAP.getCompletedOrRefundedOrders,
|
|
2681
|
+
completeProductGrant: import_native_modules22.IAP.completeProductGrant,
|
|
2682
|
+
/** Toss Ads */
|
|
2683
|
+
tossAdEventLog
|
|
2316
2684
|
}
|
|
2317
2685
|
});
|
|
2318
2686
|
const headerPropForExternalWebView = (0, import_react28.useMemo)(() => {
|
|
@@ -2341,8 +2709,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2341
2709
|
webBackHandler.handleWebBack();
|
|
2342
2710
|
return true;
|
|
2343
2711
|
};
|
|
2344
|
-
|
|
2345
|
-
return () =>
|
|
2712
|
+
import_react_native38.BackHandler.addEventListener("hardwareBackPress", callback);
|
|
2713
|
+
return () => import_react_native38.BackHandler.removeEventListener("hardwareBackPress", callback);
|
|
2346
2714
|
}, [webBackHandler]);
|
|
2347
2715
|
const globalScripts = useGlobalScripts();
|
|
2348
2716
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
@@ -2367,14 +2735,14 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2367
2735
|
props.onNavigationStateChange?.(event);
|
|
2368
2736
|
webBackHandler.onNavigationStateChange(event);
|
|
2369
2737
|
},
|
|
2370
|
-
userAgent:
|
|
2738
|
+
userAgent: import_react_native38.Platform.OS === "ios" ? userAgent : void 0,
|
|
2371
2739
|
sharedCookiesEnabled: true,
|
|
2372
2740
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
2373
2741
|
thirdPartyCookiesEnabled: true,
|
|
2374
2742
|
onMessage: handler.onMessage,
|
|
2375
2743
|
injectedJavaScript: globalScripts.afterLoad,
|
|
2376
2744
|
injectedJavaScriptBeforeContentLoaded: mergeScripts(handler.injectedJavaScript, globalScripts.beforeLoad),
|
|
2377
|
-
decelerationRate:
|
|
2745
|
+
decelerationRate: import_react_native38.Platform.OS === "ios" ? 1 : void 0,
|
|
2378
2746
|
allowsBackForwardNavigationGestures,
|
|
2379
2747
|
onShouldStartLoadWithRequest: (event) => {
|
|
2380
2748
|
try {
|
|
@@ -2382,7 +2750,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2382
2750
|
if (["https:", "http:"].includes(url.protocol)) {
|
|
2383
2751
|
return true;
|
|
2384
2752
|
} else {
|
|
2385
|
-
|
|
2753
|
+
import_react_native38.Linking.openURL(convertIntentURL(url) ?? url.href);
|
|
2386
2754
|
return false;
|
|
2387
2755
|
}
|
|
2388
2756
|
} catch (error) {
|
|
@@ -2390,7 +2758,15 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2390
2758
|
return false;
|
|
2391
2759
|
}
|
|
2392
2760
|
},
|
|
2393
|
-
originWhitelist: [
|
|
2761
|
+
originWhitelist: [
|
|
2762
|
+
"https://*",
|
|
2763
|
+
"http://*",
|
|
2764
|
+
"intoss://*",
|
|
2765
|
+
"intoss-private://*",
|
|
2766
|
+
"servicetoss://*",
|
|
2767
|
+
"supertoss://*",
|
|
2768
|
+
"intent://*"
|
|
2769
|
+
]
|
|
2394
2770
|
}
|
|
2395
2771
|
);
|
|
2396
2772
|
}
|
|
@@ -2475,6 +2851,8 @@ var Analytics2 = {
|
|
|
2475
2851
|
OverlayProvider,
|
|
2476
2852
|
WebView,
|
|
2477
2853
|
env,
|
|
2854
|
+
loadFullScreenAd,
|
|
2855
|
+
showFullScreenAd,
|
|
2478
2856
|
useCreateUserAgent,
|
|
2479
2857
|
useGeolocation,
|
|
2480
2858
|
useOverlay,
|