@apps-in-toss/framework 0.0.0-dev.1752114017143 → 0.0.0-dev.1753241576118
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 +663 -128
- package/dist/index.d.cts +592 -439
- package/dist/index.d.ts +592 -439
- package/dist/index.js +637 -106
- package/package.json +6 -5
- package/src/async-bridges.ts +3 -0
package/dist/index.cjs
CHANGED
|
@@ -49,15 +49,19 @@ __export(src_exports, {
|
|
|
49
49
|
getClipboardText: () => getClipboardText,
|
|
50
50
|
getCurrentLocation: () => getCurrentLocation,
|
|
51
51
|
getDeviceId: () => getDeviceId,
|
|
52
|
+
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
52
53
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
53
54
|
getTossAppVersion: () => getTossAppVersion,
|
|
54
55
|
getTossShareLink: () => getTossShareLink,
|
|
55
56
|
isMinVersionSupported: () => isMinVersionSupported,
|
|
56
57
|
openCamera: () => openCamera,
|
|
58
|
+
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
57
59
|
saveBase64Data: () => saveBase64Data,
|
|
58
60
|
setClipboardText: () => setClipboardText,
|
|
59
61
|
setDeviceOrientation: () => setDeviceOrientation,
|
|
60
62
|
startUpdateLocation: () => startUpdateLocation,
|
|
63
|
+
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore,
|
|
64
|
+
useCreateUserAgent: () => useCreateUserAgent,
|
|
61
65
|
useGeolocation: () => useGeolocation
|
|
62
66
|
});
|
|
63
67
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -66,7 +70,7 @@ var import_analytics2 = require("@apps-in-toss/analytics");
|
|
|
66
70
|
// src/core/registerApp.tsx
|
|
67
71
|
var import_analytics = require("@apps-in-toss/analytics");
|
|
68
72
|
var import_react_native6 = require("@toss-design-system/react-native");
|
|
69
|
-
var
|
|
73
|
+
var import_react_native_bedrock9 = require("react-native-bedrock");
|
|
70
74
|
|
|
71
75
|
// src/core/components/AppEvent.tsx
|
|
72
76
|
var import_react2 = require("react");
|
|
@@ -501,11 +505,14 @@ __export(async_bridges_exports, {
|
|
|
501
505
|
fetchContacts: () => fetchContacts,
|
|
502
506
|
getClipboardText: () => getClipboardText,
|
|
503
507
|
getCurrentLocation: () => getCurrentLocation,
|
|
508
|
+
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
504
509
|
getTossShareLink: () => getTossShareLink,
|
|
505
510
|
openCamera: () => openCamera,
|
|
511
|
+
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
506
512
|
saveBase64Data: () => saveBase64Data,
|
|
507
513
|
setClipboardText: () => setClipboardText,
|
|
508
|
-
setDeviceOrientation: () => setDeviceOrientation
|
|
514
|
+
setDeviceOrientation: () => setDeviceOrientation,
|
|
515
|
+
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore
|
|
509
516
|
});
|
|
510
517
|
|
|
511
518
|
// src/native-modules/setClipboardText.ts
|
|
@@ -657,6 +664,43 @@ async function saveBase64Data(params) {
|
|
|
657
664
|
await AppsInTossModule.saveBase64Data(params);
|
|
658
665
|
}
|
|
659
666
|
|
|
667
|
+
// src/constant/game-center.ts
|
|
668
|
+
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
669
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
670
|
+
android: "5.221.0",
|
|
671
|
+
ios: "5.221.0"
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
// src/native-modules/getGameCenterGameProfile.ts
|
|
675
|
+
async function getGameCenterGameProfile() {
|
|
676
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
677
|
+
if (!isSupported) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
return AppsInTossModule.getGameCenterGameProfile({});
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// src/native-modules/openGameCenterLeaderboard.ts
|
|
684
|
+
var import_react_native_bedrock8 = require("react-native-bedrock");
|
|
685
|
+
async function openGameCenterLeaderboard() {
|
|
686
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
690
|
+
url.searchParams.set("appName", getAppName());
|
|
691
|
+
url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
|
|
692
|
+
return (0, import_react_native_bedrock8.openURL)(url.toString());
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// src/native-modules/submitGameCenterLeaderBoardScore.ts
|
|
696
|
+
async function submitGameCenterLeaderBoardScore(params) {
|
|
697
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
698
|
+
if (!isSupported) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
|
|
702
|
+
}
|
|
703
|
+
|
|
660
704
|
// src/core/registerApp.tsx
|
|
661
705
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
662
706
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
@@ -675,7 +719,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
675
719
|
logger: (params) => void eventLog(params),
|
|
676
720
|
debug: analytics?.debug ?? __DEV__
|
|
677
721
|
});
|
|
678
|
-
return
|
|
722
|
+
return import_react_native_bedrock9.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
|
|
679
723
|
appName: getAppName(),
|
|
680
724
|
context,
|
|
681
725
|
router: {
|
|
@@ -811,38 +855,15 @@ loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
|
811
855
|
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
812
856
|
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
813
857
|
|
|
814
|
-
// src/native-modules/getTossAppVersion.ts
|
|
815
|
-
function getTossAppVersion() {
|
|
816
|
-
return AppsInTossModule.tossAppVersion;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
858
|
// src/native-modules/getDeviceId.ts
|
|
820
859
|
function getDeviceId() {
|
|
821
860
|
return AppsInTossModule.deviceId;
|
|
822
861
|
}
|
|
823
862
|
|
|
824
|
-
// src/native-modules/
|
|
825
|
-
function
|
|
826
|
-
return AppsInTossModule.
|
|
827
|
-
}
|
|
828
|
-
function setItem(key, value) {
|
|
829
|
-
return AppsInTossModule.setStorageItem({
|
|
830
|
-
key,
|
|
831
|
-
value
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
function removeItem(key) {
|
|
835
|
-
return AppsInTossModule.removeStorageItem({ key });
|
|
836
|
-
}
|
|
837
|
-
function clearItems() {
|
|
838
|
-
return AppsInTossModule.clearStorage({});
|
|
863
|
+
// src/native-modules/getTossAppVersion.ts
|
|
864
|
+
function getTossAppVersion() {
|
|
865
|
+
return AppsInTossModule.tossAppVersion;
|
|
839
866
|
}
|
|
840
|
-
var Storage = {
|
|
841
|
-
getItem,
|
|
842
|
-
setItem,
|
|
843
|
-
removeItem,
|
|
844
|
-
clearItems
|
|
845
|
-
};
|
|
846
867
|
|
|
847
868
|
// src/native-modules/iap.ts
|
|
848
869
|
async function createOneTimePurchaseOrder(params) {
|
|
@@ -870,6 +891,29 @@ var IAP = {
|
|
|
870
891
|
getProductItemList
|
|
871
892
|
};
|
|
872
893
|
|
|
894
|
+
// src/native-modules/storage.ts
|
|
895
|
+
function getItem(key) {
|
|
896
|
+
return AppsInTossModule.getStorageItem({ key });
|
|
897
|
+
}
|
|
898
|
+
function setItem(key, value) {
|
|
899
|
+
return AppsInTossModule.setStorageItem({
|
|
900
|
+
key,
|
|
901
|
+
value
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
function removeItem(key) {
|
|
905
|
+
return AppsInTossModule.removeStorageItem({ key });
|
|
906
|
+
}
|
|
907
|
+
function clearItems() {
|
|
908
|
+
return AppsInTossModule.clearStorage({});
|
|
909
|
+
}
|
|
910
|
+
var Storage = {
|
|
911
|
+
getItem,
|
|
912
|
+
setItem,
|
|
913
|
+
removeItem,
|
|
914
|
+
clearItems
|
|
915
|
+
};
|
|
916
|
+
|
|
873
917
|
// src/native-modules/index.ts
|
|
874
918
|
var TossPay = {
|
|
875
919
|
checkoutPayment
|
|
@@ -882,35 +926,353 @@ var GoogleAdMob = {
|
|
|
882
926
|
};
|
|
883
927
|
|
|
884
928
|
// src/components/WebView.tsx
|
|
885
|
-
var
|
|
886
|
-
var
|
|
887
|
-
var
|
|
888
|
-
var
|
|
929
|
+
var import_react_native20 = require("@toss-design-system/react-native");
|
|
930
|
+
var import_private3 = require("@toss-design-system/react-native/private");
|
|
931
|
+
var import_react9 = require("react");
|
|
932
|
+
var import_react_native21 = require("react-native");
|
|
933
|
+
var import_react_native_bedrock16 = require("react-native-bedrock");
|
|
889
934
|
var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
|
|
890
935
|
var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
|
|
891
936
|
|
|
892
937
|
// src/components/GameWebView.tsx
|
|
893
938
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
894
|
-
var
|
|
939
|
+
var import_react_native17 = require("@toss-design-system/react-native");
|
|
940
|
+
var import_es_hangul2 = require("es-hangul");
|
|
941
|
+
var import_react6 = require("react");
|
|
942
|
+
var import_react_native18 = require("react-native");
|
|
943
|
+
var import_react_native_bedrock12 = require("react-native-bedrock");
|
|
944
|
+
|
|
945
|
+
// src/components/GameProfile.tsx
|
|
946
|
+
var import_react_native10 = require("@toss-design-system/react-native");
|
|
947
|
+
var import_react5 = require("react");
|
|
948
|
+
var import_react_native11 = require("react-native");
|
|
949
|
+
|
|
950
|
+
// src/hooks/useGameCenterProfile.ts
|
|
951
|
+
var import_react_native9 = require("@toss-design-system/react-native");
|
|
895
952
|
var import_es_hangul = require("es-hangul");
|
|
896
953
|
var import_react4 = require("react");
|
|
897
|
-
var
|
|
898
|
-
|
|
954
|
+
var import_react_native_bedrock11 = require("react-native-bedrock");
|
|
955
|
+
|
|
956
|
+
// src/components/GameProfileToast.tsx
|
|
957
|
+
var import_react_native7 = require("@toss-design-system/react-native");
|
|
958
|
+
var import_private = require("@toss-design-system/react-native/private");
|
|
959
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
960
|
+
var useGameProfileToast = () => {
|
|
961
|
+
const overlay = (0, import_private.useOverlay)();
|
|
962
|
+
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
963
|
+
return new Promise((resolve) => {
|
|
964
|
+
overlay.open(({ isOpen, close, exit }) => {
|
|
965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_private.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_private.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
966
|
+
import_react_native7.Toast,
|
|
967
|
+
{
|
|
968
|
+
open: isOpen,
|
|
969
|
+
onClose: () => {
|
|
970
|
+
resolve();
|
|
971
|
+
close();
|
|
972
|
+
},
|
|
973
|
+
onExited: exit,
|
|
974
|
+
position: "top",
|
|
975
|
+
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
976
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
977
|
+
import_react_native7.Asset.Image,
|
|
978
|
+
{
|
|
979
|
+
style: { borderRadius: 64, overflow: "hidden" },
|
|
980
|
+
frameShape: import_react_native7.Asset.frameShape.CleanW32,
|
|
981
|
+
source: { uri: profileImageUri }
|
|
982
|
+
}
|
|
983
|
+
)
|
|
984
|
+
}
|
|
985
|
+
) }) });
|
|
986
|
+
});
|
|
987
|
+
});
|
|
988
|
+
};
|
|
989
|
+
return { openGameProfileToast };
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
// src/utils/error.ts
|
|
993
|
+
var DEFAULT_ERROR = {
|
|
994
|
+
title: "\uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694",
|
|
995
|
+
description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
// src/utils/market.ts
|
|
999
|
+
var import_react_native8 = require("react-native");
|
|
1000
|
+
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
1001
|
+
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
1002
|
+
var getMarketLink = () => {
|
|
1003
|
+
return import_react_native8.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// src/utils/openTransparentWebView.ts
|
|
1007
|
+
var import_react_native_bedrock10 = require("react-native-bedrock");
|
|
1008
|
+
|
|
1009
|
+
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1010
|
+
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1011
|
+
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// src/private.ts
|
|
1015
|
+
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1016
|
+
|
|
1017
|
+
// src/utils/openTransparentWebView.ts
|
|
1018
|
+
var openTransparentWebView = ({
|
|
1019
|
+
webUrl,
|
|
1020
|
+
cleanupWhenDismissed = true,
|
|
1021
|
+
onEvent,
|
|
1022
|
+
onError,
|
|
1023
|
+
callbackId = "fn",
|
|
1024
|
+
params
|
|
1025
|
+
}) => {
|
|
1026
|
+
const url = new URL("supertoss://transparent-service-web");
|
|
1027
|
+
url.searchParams.set("url", webUrl);
|
|
1028
|
+
url.searchParams.set("onVisibilityChangeCallback", callbackId);
|
|
1029
|
+
Object.entries(params ?? {}).forEach(([key, value]) => {
|
|
1030
|
+
url.searchParams.set(key, value);
|
|
1031
|
+
});
|
|
1032
|
+
const cleanup = INTERNAL__onVisibilityChangedByTransparentServiceWeb({
|
|
1033
|
+
options: { callbackId },
|
|
1034
|
+
onError: (error) => {
|
|
1035
|
+
onError(error);
|
|
1036
|
+
cleanup();
|
|
1037
|
+
},
|
|
1038
|
+
onEvent: (value) => {
|
|
1039
|
+
onEvent(value);
|
|
1040
|
+
if (cleanupWhenDismissed && value === true) {
|
|
1041
|
+
cleanup();
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
(0, import_react_native_bedrock10.openURL)(url.toString());
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
// src/hooks/useGameCenterProfile.ts
|
|
1049
|
+
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
1050
|
+
const [profileData, setProfileData] = (0, import_react4.useState)(void 0);
|
|
1051
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react4.useState)(true);
|
|
1052
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react4.useState)(false);
|
|
1053
|
+
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
1054
|
+
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1055
|
+
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1056
|
+
const [isWebviewLoading, setIsWebviewLoading] = (0, import_react4.useState)(false);
|
|
1057
|
+
const isCompletedProfileFlow = (0, import_react4.useRef)(false);
|
|
1058
|
+
const { openAlert, openConfirm } = (0, import_react_native9.useDialog)();
|
|
1059
|
+
const { openGameProfileToast } = useGameProfileToast();
|
|
1060
|
+
const openErrorAlert = (0, import_react4.useCallback)(async () => {
|
|
1061
|
+
await openAlert({
|
|
1062
|
+
title: DEFAULT_ERROR.title,
|
|
1063
|
+
description: DEFAULT_ERROR.description
|
|
1064
|
+
});
|
|
1065
|
+
(0, import_react_native_bedrock11.closeView)();
|
|
1066
|
+
}, [openAlert]);
|
|
1067
|
+
const openProfileWebview = (0, import_react4.useCallback)(() => {
|
|
1068
|
+
if (isWebviewLoading) {
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
setIsWebviewLoading(true);
|
|
1072
|
+
openTransparentWebView({
|
|
1073
|
+
webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
|
|
1074
|
+
onEvent: async (isClosedTransparentWebView) => {
|
|
1075
|
+
if (isClosedTransparentWebView) {
|
|
1076
|
+
try {
|
|
1077
|
+
setIsWebviewLoading(false);
|
|
1078
|
+
setIsProfileDataRefetching(true);
|
|
1079
|
+
const data = await getGameCenterGameProfile();
|
|
1080
|
+
setProfileData(data);
|
|
1081
|
+
setIsProfileDataRefetching(false);
|
|
1082
|
+
if (data?.statusCode === "SUCCESS") {
|
|
1083
|
+
openGameProfileToast(data.nickname, data.profileImageUri);
|
|
1084
|
+
}
|
|
1085
|
+
} catch (_) {
|
|
1086
|
+
setIsProfileDataRefetching(false);
|
|
1087
|
+
openErrorAlert();
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
onError: () => {
|
|
1092
|
+
openErrorAlert();
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1096
|
+
const updateAppToSupportedMinVersion = (0, import_react4.useCallback)(async () => {
|
|
1097
|
+
const upddateConfirmDialogLabel = {
|
|
1098
|
+
title: `${(0, import_es_hangul.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1099
|
+
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
1100
|
+
leftButton: "\uB2EB\uAE30",
|
|
1101
|
+
rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
|
|
1102
|
+
};
|
|
1103
|
+
const isConfirmed = await openConfirm({
|
|
1104
|
+
title: upddateConfirmDialogLabel.title,
|
|
1105
|
+
leftButton: upddateConfirmDialogLabel.leftButton,
|
|
1106
|
+
rightButton: upddateConfirmDialogLabel.rightButton,
|
|
1107
|
+
closeOnDimmerClick: true
|
|
1108
|
+
});
|
|
1109
|
+
if (!isConfirmed) {
|
|
1110
|
+
(0, import_react_native_bedrock11.closeView)();
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
const STORE_SCHEME = getMarketLink();
|
|
1114
|
+
(0, import_react_native_bedrock11.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
1115
|
+
}, [openConfirm]);
|
|
1116
|
+
return {
|
|
1117
|
+
profileData,
|
|
1118
|
+
isProfileDataLoading,
|
|
1119
|
+
isProfileDataRefetching,
|
|
1120
|
+
shouldShowLoadingOverlay,
|
|
1121
|
+
shouldShowProfileNotFoundOverlay,
|
|
1122
|
+
canShowBottomSheetOrToast,
|
|
1123
|
+
isCompletedProfileFlow,
|
|
1124
|
+
updateAppToSupportedMinVersion,
|
|
1125
|
+
setIsProfileDataLoading,
|
|
1126
|
+
openProfileWebview,
|
|
1127
|
+
setProfileData,
|
|
1128
|
+
openErrorAlert,
|
|
1129
|
+
openGameProfileToast
|
|
1130
|
+
};
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
// src/utils/zIndex.ts
|
|
1134
|
+
var Z_INDEX = {
|
|
1135
|
+
/* 게임 프로필을 위한 overlay
|
|
1136
|
+
*/
|
|
1137
|
+
PROFILE_OVERLAY: 9998,
|
|
1138
|
+
// 게임을 종료할 수 있는 X 버튼
|
|
1139
|
+
CLOSE_BUTTON: 9999
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
// src/components/GameProfile.tsx
|
|
1143
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1144
|
+
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1145
|
+
const {
|
|
1146
|
+
profileData,
|
|
1147
|
+
isProfileDataRefetching,
|
|
1148
|
+
shouldShowLoadingOverlay,
|
|
1149
|
+
shouldShowProfileNotFoundOverlay,
|
|
1150
|
+
canShowBottomSheetOrToast,
|
|
1151
|
+
isCompletedProfileFlow,
|
|
1152
|
+
openProfileWebview,
|
|
1153
|
+
updateAppToSupportedMinVersion,
|
|
1154
|
+
setIsProfileDataLoading,
|
|
1155
|
+
setProfileData,
|
|
1156
|
+
openErrorAlert,
|
|
1157
|
+
openGameProfileToast
|
|
1158
|
+
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1159
|
+
(0, import_react5.useEffect)(() => {
|
|
1160
|
+
try {
|
|
1161
|
+
const getProfileData = async () => {
|
|
1162
|
+
const data = await getGameCenterGameProfile();
|
|
1163
|
+
setProfileData(data);
|
|
1164
|
+
setIsProfileDataLoading(false);
|
|
1165
|
+
};
|
|
1166
|
+
getProfileData();
|
|
1167
|
+
} catch (_) {
|
|
1168
|
+
openErrorAlert();
|
|
1169
|
+
setIsProfileDataLoading(false);
|
|
1170
|
+
}
|
|
1171
|
+
}, []);
|
|
1172
|
+
(0, import_react5.useEffect)(() => {
|
|
1173
|
+
const handleGameProfileFlow = async () => {
|
|
1174
|
+
if (!canShowBottomSheetOrToast) {
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
if (isCompletedProfileFlow.current) {
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
isCompletedProfileFlow.current = true;
|
|
1181
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
1182
|
+
updateAppToSupportedMinVersion();
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
if (profileData?.statusCode === "SUCCESS") {
|
|
1186
|
+
openGameProfileToast(profileData.nickname, profileData.profileImageUri);
|
|
1187
|
+
return;
|
|
1188
|
+
}
|
|
1189
|
+
if (profileData?.statusCode === "PROFILE_NOT_FOUND") {
|
|
1190
|
+
openProfileWebview();
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
handleGameProfileFlow();
|
|
1194
|
+
}, [
|
|
1195
|
+
canShowBottomSheetOrToast,
|
|
1196
|
+
isCompletedProfileFlow,
|
|
1197
|
+
openGameProfileToast,
|
|
1198
|
+
openProfileWebview,
|
|
1199
|
+
profileData,
|
|
1200
|
+
updateAppToSupportedMinVersion
|
|
1201
|
+
]);
|
|
1202
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
1203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
|
|
1205
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1206
|
+
import_react_native11.Pressable,
|
|
1207
|
+
{
|
|
1208
|
+
style: {
|
|
1209
|
+
...overlayStyle
|
|
1210
|
+
},
|
|
1211
|
+
onPress: () => {
|
|
1212
|
+
updateAppToSupportedMinVersion();
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
)
|
|
1216
|
+
] });
|
|
1217
|
+
}
|
|
1218
|
+
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1220
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
|
|
1221
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1222
|
+
import_react_native11.View,
|
|
1223
|
+
{
|
|
1224
|
+
style: {
|
|
1225
|
+
...overlayStyle,
|
|
1226
|
+
justifyContent: "center",
|
|
1227
|
+
alignItems: "center",
|
|
1228
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1229
|
+
},
|
|
1230
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native10.Loader, { size: "large", type: "light" })
|
|
1231
|
+
}
|
|
1232
|
+
)
|
|
1233
|
+
] });
|
|
1234
|
+
}
|
|
1235
|
+
if (shouldShowProfileNotFoundOverlay) {
|
|
1236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
|
|
1238
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1239
|
+
import_react_native11.Pressable,
|
|
1240
|
+
{
|
|
1241
|
+
style: {
|
|
1242
|
+
...overlayStyle
|
|
1243
|
+
},
|
|
1244
|
+
onPress: () => {
|
|
1245
|
+
openProfileWebview();
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
)
|
|
1249
|
+
] });
|
|
1250
|
+
}
|
|
1251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1252
|
+
};
|
|
1253
|
+
var overlayStyle = {
|
|
1254
|
+
position: "absolute",
|
|
1255
|
+
top: 0,
|
|
1256
|
+
left: 0,
|
|
1257
|
+
right: 0,
|
|
1258
|
+
bottom: 0,
|
|
1259
|
+
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1260
|
+
};
|
|
899
1261
|
|
|
900
1262
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
901
1263
|
var import_react_native_svg = require("@react-native-bedrock/native/react-native-svg");
|
|
902
|
-
var
|
|
903
|
-
var
|
|
1264
|
+
var import_react_native15 = require("@toss-design-system/react-native");
|
|
1265
|
+
var import_react_native16 = require("react-native");
|
|
904
1266
|
|
|
905
1267
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
906
|
-
var
|
|
1268
|
+
var import_react_native13 = require("react-native");
|
|
907
1269
|
|
|
908
1270
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
909
|
-
var
|
|
1271
|
+
var import_react_native12 = require("react-native");
|
|
910
1272
|
function byPlatform({
|
|
911
1273
|
...props
|
|
912
1274
|
}) {
|
|
913
|
-
return (props[
|
|
1275
|
+
return (props[import_react_native12.Platform.OS] ?? props.fallback)();
|
|
914
1276
|
}
|
|
915
1277
|
|
|
916
1278
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -918,21 +1280,21 @@ var RIGHT_MARGIN = 24;
|
|
|
918
1280
|
var IOS_DEFAULT_MARGIN = 20;
|
|
919
1281
|
|
|
920
1282
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
921
|
-
var
|
|
1283
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
922
1284
|
function IOSHeaderRight(props) {
|
|
923
|
-
return /* @__PURE__ */ (0,
|
|
1285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.ios, ...props });
|
|
924
1286
|
}
|
|
925
1287
|
function AndroidHeaderRight(props) {
|
|
926
|
-
return /* @__PURE__ */ (0,
|
|
1288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.android, ...props });
|
|
927
1289
|
}
|
|
928
1290
|
function HeaderRight(props) {
|
|
929
1291
|
return byPlatform({
|
|
930
|
-
ios: () => /* @__PURE__ */ (0,
|
|
931
|
-
android: () => /* @__PURE__ */ (0,
|
|
932
|
-
fallback: () => /* @__PURE__ */ (0,
|
|
1292
|
+
ios: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IOSHeaderRight, { ...props }),
|
|
1293
|
+
android: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AndroidHeaderRight, { ...props }),
|
|
1294
|
+
fallback: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IOSHeaderRight, { ...props })
|
|
933
1295
|
});
|
|
934
1296
|
}
|
|
935
|
-
var styles =
|
|
1297
|
+
var styles = import_react_native13.StyleSheet.create({
|
|
936
1298
|
ios: {
|
|
937
1299
|
marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
|
|
938
1300
|
flexDirection: "row"
|
|
@@ -944,48 +1306,48 @@ var styles = import_react_native8.StyleSheet.create({
|
|
|
944
1306
|
|
|
945
1307
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
946
1308
|
var import_react_native_safe_area_context = require("@react-native-bedrock/native/react-native-safe-area-context");
|
|
947
|
-
var
|
|
1309
|
+
var import_react_native14 = require("react-native");
|
|
948
1310
|
function useSafeAreaTop() {
|
|
949
1311
|
const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
950
|
-
const hasDynamicIsland =
|
|
1312
|
+
const hasDynamicIsland = import_react_native14.Platform.OS === "ios" && safeAreaInsets.top > 50;
|
|
951
1313
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
952
1314
|
return safeAreaTop;
|
|
953
1315
|
}
|
|
954
1316
|
|
|
955
1317
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
956
|
-
var
|
|
1318
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
957
1319
|
var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xmlns="https://www.w3.org/2000/svg"><rect fill="#031832" fill-opacity=".46" height="30" rx="15" width="30"/><rect height="29.5" rx="14.75" stroke="#d9d9ff" stroke-opacity=".11" stroke-width=".5" width="29.5" x=".25" y=".25"/><path clip-rule="evenodd" d="m16.5119 15.0014 4.7092-4.7092c.0929-.0928.1666-.2031.2169-.32441.0503-.12134.0762-.25141.0762-.38276.0001-.13136-.0258-.26144-.076-.38281s-.1239-.23166-.2167-.32457c-.0929-.09291-.2031-.16662-.3245-.21692-.1213-.05031-.2514-.07622-.3827-.07626-.1314-.00004-.2615.0258-.3828.07603-.1214.05023-.2317.12388-.3246.21673l-4.7092 4.70997-4.71-4.70997c-.1897-.17718-.4408-.27373-.70034-.26927s-.5072.10959-.69069.2932c-.1835.1836-.28848.43132-.29279.69087-.00432.25954.09238.51057.26968.70017l4.71004 4.7092-4.71004 4.7092c-.1392.1401-.23385.3183-.27204.5121-.0382.1939-.01823.3946.05739.5771s.20351.3386.36759.4486.35702.169.55456.1697c.25583 0 .51164-.0975.70664-.2925l4.71-4.71 4.7092 4.71c.0927.093.2029.1668.3243.2172.1213.0504.2514.0763.3828.0763s.2614-.0259.3828-.0763c.1213-.0504.2315-.1242.3243-.2172.0929-.0929.1667-.2032.217-.3246s.0762-.2515.0762-.3829-.0259-.2616-.0762-.383-.1241-.2317-.217-.3245z" fill="#fdfdfe" fill-opacity=".89" fill-rule="evenodd"/></svg>';
|
|
958
1320
|
function GameNavigationBar({ onClose }) {
|
|
959
1321
|
const safeAreaTop = useSafeAreaTop();
|
|
960
|
-
return /* @__PURE__ */ (0,
|
|
961
|
-
/* @__PURE__ */ (0,
|
|
962
|
-
/* @__PURE__ */ (0,
|
|
963
|
-
|
|
1322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1323
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native15.PageNavbar, { preference: { type: "none" } }),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1325
|
+
import_react_native16.View,
|
|
964
1326
|
{
|
|
965
1327
|
style: {
|
|
966
1328
|
width: "100%",
|
|
967
|
-
height:
|
|
1329
|
+
height: import_react_native16.Platform.OS === "ios" ? 44 : 54,
|
|
968
1330
|
flexDirection: "row",
|
|
969
1331
|
alignItems: "center",
|
|
970
1332
|
justifyContent: "flex-end",
|
|
971
1333
|
position: "absolute",
|
|
972
|
-
zIndex:
|
|
1334
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
973
1335
|
marginTop: safeAreaTop,
|
|
974
|
-
paddingRight:
|
|
1336
|
+
paddingRight: import_react_native16.Platform.OS === "ios" ? 10 : 8
|
|
975
1337
|
},
|
|
976
1338
|
pointerEvents: "box-none",
|
|
977
|
-
children: /* @__PURE__ */ (0,
|
|
978
|
-
|
|
1339
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1340
|
+
import_react_native16.TouchableOpacity,
|
|
979
1341
|
{
|
|
980
1342
|
hitSlop: { left: 8, right: 8 },
|
|
981
1343
|
accessibilityRole: "button",
|
|
982
1344
|
accessible: true,
|
|
983
1345
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
984
1346
|
style: {
|
|
985
|
-
padding:
|
|
1347
|
+
padding: import_react_native16.Platform.OS === "ios" ? 7 : 9
|
|
986
1348
|
},
|
|
987
1349
|
onPress: onClose,
|
|
988
|
-
children: /* @__PURE__ */ (0,
|
|
1350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
989
1351
|
}
|
|
990
1352
|
) })
|
|
991
1353
|
}
|
|
@@ -994,48 +1356,56 @@ function GameNavigationBar({ onClose }) {
|
|
|
994
1356
|
}
|
|
995
1357
|
|
|
996
1358
|
// src/components/GameWebView.tsx
|
|
997
|
-
var
|
|
998
|
-
var GameWebView = (0,
|
|
999
|
-
const { openConfirm } = (0,
|
|
1359
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1360
|
+
var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref) {
|
|
1361
|
+
const { openConfirm } = (0, import_react_native17.useDialog)();
|
|
1000
1362
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1001
|
-
const
|
|
1363
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react6.useState)(false);
|
|
1364
|
+
const handleClose = (0, import_react6.useCallback)(async () => {
|
|
1002
1365
|
const isConfirmed = await openConfirm({
|
|
1003
|
-
title: `${(0,
|
|
1366
|
+
title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1004
1367
|
leftButton: "\uCDE8\uC18C",
|
|
1005
1368
|
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1006
1369
|
closeOnDimmerClick: true
|
|
1007
1370
|
});
|
|
1008
1371
|
if (isConfirmed) {
|
|
1009
|
-
(0,
|
|
1372
|
+
(0, import_react_native_bedrock12.closeView)();
|
|
1010
1373
|
}
|
|
1011
1374
|
}, [brandDisplayName, openConfirm]);
|
|
1012
|
-
(0,
|
|
1013
|
-
if (
|
|
1014
|
-
(0,
|
|
1375
|
+
(0, import_react6.useEffect)(() => {
|
|
1376
|
+
if (import_react_native18.Platform.OS === "ios") {
|
|
1377
|
+
(0, import_react_native_bedrock12.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1015
1378
|
return () => {
|
|
1016
|
-
(0,
|
|
1379
|
+
(0, import_react_native_bedrock12.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
1017
1380
|
};
|
|
1018
1381
|
}
|
|
1019
1382
|
return;
|
|
1020
1383
|
}, []);
|
|
1021
|
-
(0,
|
|
1384
|
+
(0, import_react6.useEffect)(() => {
|
|
1022
1385
|
const backHandler = () => {
|
|
1023
1386
|
handleClose();
|
|
1024
1387
|
return true;
|
|
1025
1388
|
};
|
|
1026
|
-
|
|
1389
|
+
import_react_native18.BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
1027
1390
|
return () => {
|
|
1028
|
-
|
|
1391
|
+
import_react_native18.BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1029
1392
|
};
|
|
1030
1393
|
}, [handleClose]);
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1394
|
+
(0, import_react6.useEffect)(() => {
|
|
1395
|
+
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1396
|
+
onEvent: () => {
|
|
1397
|
+
setIsEntryMessageExited(true);
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
}, []);
|
|
1401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GameNavigationBar, { onClose: handleClose }),
|
|
1403
|
+
getOperationalEnvironment() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_webview.WebView, { ref, ...props })
|
|
1034
1404
|
] });
|
|
1035
1405
|
});
|
|
1036
1406
|
|
|
1037
1407
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1038
|
-
var
|
|
1408
|
+
var import_react7 = require("react");
|
|
1039
1409
|
function serializeError(error) {
|
|
1040
1410
|
return JSON.stringify(error, (_, value) => {
|
|
1041
1411
|
if (value instanceof Error) {
|
|
@@ -1084,8 +1454,8 @@ function useBridgeHandler({
|
|
|
1084
1454
|
eventListenerMap,
|
|
1085
1455
|
injectedJavaScript: originalInjectedJavaScript
|
|
1086
1456
|
}) {
|
|
1087
|
-
const ref = (0,
|
|
1088
|
-
const injectedJavaScript = (0,
|
|
1457
|
+
const ref = (0, import_react7.useRef)(null);
|
|
1458
|
+
const injectedJavaScript = (0, import_react7.useMemo)(
|
|
1089
1459
|
() => [
|
|
1090
1460
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1091
1461
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1111,7 +1481,7 @@ function useBridgeHandler({
|
|
|
1111
1481
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1112
1482
|
`);
|
|
1113
1483
|
};
|
|
1114
|
-
const $onMessage = (0,
|
|
1484
|
+
const $onMessage = (0, import_react7.useCallback)(
|
|
1115
1485
|
async (e) => {
|
|
1116
1486
|
onMessage?.(e);
|
|
1117
1487
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1175,8 +1545,187 @@ __export(event_bridges_exports, {
|
|
|
1175
1545
|
startUpdateLocation: () => startUpdateLocation
|
|
1176
1546
|
});
|
|
1177
1547
|
|
|
1548
|
+
// src/hooks/useCreateUserAgent.ts
|
|
1549
|
+
var import_react_native19 = require("react-native");
|
|
1550
|
+
var import_react_native_bedrock13 = require("react-native-bedrock");
|
|
1551
|
+
var FontA11yCategory = {
|
|
1552
|
+
Large: "Large",
|
|
1553
|
+
xLarge: "xLarge",
|
|
1554
|
+
xxLarge: "xxLarge",
|
|
1555
|
+
xxxLarge: "xxxLarge",
|
|
1556
|
+
A11y_Medium: "A11y_Medium",
|
|
1557
|
+
A11y_Large: "A11y_Large",
|
|
1558
|
+
A11y_xLarge: "A11y_xLarge",
|
|
1559
|
+
A11y_xxLarge: "A11y_xxLarge",
|
|
1560
|
+
A11y_xxxLarge: "A11y_xxxLarge"
|
|
1561
|
+
};
|
|
1562
|
+
var androidFontScaleMap = {
|
|
1563
|
+
100: FontA11yCategory.Large,
|
|
1564
|
+
110: FontA11yCategory.xLarge,
|
|
1565
|
+
120: FontA11yCategory.xxLarge,
|
|
1566
|
+
135: FontA11yCategory.xxxLarge,
|
|
1567
|
+
160: FontA11yCategory.A11y_Medium,
|
|
1568
|
+
190: FontA11yCategory.A11y_Large,
|
|
1569
|
+
235: FontA11yCategory.A11y_xLarge,
|
|
1570
|
+
275: FontA11yCategory.A11y_xxLarge,
|
|
1571
|
+
310: FontA11yCategory.A11y_xxxLarge
|
|
1572
|
+
};
|
|
1573
|
+
var iosScaleToAndroidScale = {
|
|
1574
|
+
0.823: 100,
|
|
1575
|
+
0.882: 100,
|
|
1576
|
+
0.941: 100,
|
|
1577
|
+
1: 100,
|
|
1578
|
+
1.118: 110,
|
|
1579
|
+
1.235: 120,
|
|
1580
|
+
1.353: 135,
|
|
1581
|
+
1.786: 160,
|
|
1582
|
+
2.143: 190,
|
|
1583
|
+
2.643: 235,
|
|
1584
|
+
3.143: 275,
|
|
1585
|
+
3.571: 310
|
|
1586
|
+
};
|
|
1587
|
+
function convertToAndroidStyleScale(fontScale, platform) {
|
|
1588
|
+
if (platform === "android") {
|
|
1589
|
+
if (fontScale <= 1) {
|
|
1590
|
+
return 100;
|
|
1591
|
+
}
|
|
1592
|
+
const scaledValue = Math.round(fontScale * 100);
|
|
1593
|
+
const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
|
|
1594
|
+
let closestKey = keys[0];
|
|
1595
|
+
let minDiff = Math.abs(scaledValue - closestKey);
|
|
1596
|
+
for (const key of keys) {
|
|
1597
|
+
const diff = Math.abs(scaledValue - key);
|
|
1598
|
+
if (diff < minDiff) {
|
|
1599
|
+
minDiff = diff;
|
|
1600
|
+
closestKey = key;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
return closestKey;
|
|
1604
|
+
} else {
|
|
1605
|
+
const iosScales = Object.keys(iosScaleToAndroidScale).map(Number);
|
|
1606
|
+
let closestScale = iosScales[0];
|
|
1607
|
+
let minDiff = Math.abs(fontScale - closestScale);
|
|
1608
|
+
for (const scale of iosScales) {
|
|
1609
|
+
const diff = Math.abs(fontScale - scale);
|
|
1610
|
+
if (diff < minDiff) {
|
|
1611
|
+
minDiff = diff;
|
|
1612
|
+
closestScale = scale;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
return iosScaleToAndroidScale[closestScale];
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
function mapIOSFontScaleToCategory(fontScale) {
|
|
1619
|
+
if (fontScale < 1) {
|
|
1620
|
+
return FontA11yCategory.Large;
|
|
1621
|
+
}
|
|
1622
|
+
if (Math.abs(fontScale - 1) < 0.05) {
|
|
1623
|
+
return FontA11yCategory.Large;
|
|
1624
|
+
}
|
|
1625
|
+
if (Math.abs(fontScale - 1.118) < 0.05) {
|
|
1626
|
+
return FontA11yCategory.xLarge;
|
|
1627
|
+
}
|
|
1628
|
+
if (Math.abs(fontScale - 1.235) < 0.05) {
|
|
1629
|
+
return FontA11yCategory.xxLarge;
|
|
1630
|
+
}
|
|
1631
|
+
if (Math.abs(fontScale - 1.353) < 0.05) {
|
|
1632
|
+
return FontA11yCategory.xxxLarge;
|
|
1633
|
+
}
|
|
1634
|
+
if (Math.abs(fontScale - 1.786) < 0.05) {
|
|
1635
|
+
return FontA11yCategory.A11y_Medium;
|
|
1636
|
+
}
|
|
1637
|
+
if (Math.abs(fontScale - 2.143) < 0.05) {
|
|
1638
|
+
return FontA11yCategory.A11y_Large;
|
|
1639
|
+
}
|
|
1640
|
+
if (Math.abs(fontScale - 2.643) < 0.05) {
|
|
1641
|
+
return FontA11yCategory.A11y_xLarge;
|
|
1642
|
+
}
|
|
1643
|
+
if (Math.abs(fontScale - 3.143) < 0.05) {
|
|
1644
|
+
return FontA11yCategory.A11y_xxLarge;
|
|
1645
|
+
}
|
|
1646
|
+
if (Math.abs(fontScale - 3.571) < 0.05) {
|
|
1647
|
+
return FontA11yCategory.A11y_xxxLarge;
|
|
1648
|
+
}
|
|
1649
|
+
return FontA11yCategory.Large;
|
|
1650
|
+
}
|
|
1651
|
+
function mapAndroidFontScaleToCategory(fontScale) {
|
|
1652
|
+
if (fontScale <= 1) {
|
|
1653
|
+
return androidFontScaleMap[100];
|
|
1654
|
+
}
|
|
1655
|
+
const scaledValue = Math.round(fontScale * 100);
|
|
1656
|
+
const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
|
|
1657
|
+
if (keys.length === 0) {
|
|
1658
|
+
return androidFontScaleMap[100];
|
|
1659
|
+
}
|
|
1660
|
+
let closestKey = keys[0];
|
|
1661
|
+
let minDiff = Math.abs(scaledValue - closestKey);
|
|
1662
|
+
for (const key of keys) {
|
|
1663
|
+
const diff = Math.abs(scaledValue - key);
|
|
1664
|
+
if (diff < minDiff) {
|
|
1665
|
+
minDiff = diff;
|
|
1666
|
+
closestKey = key;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
return androidFontScaleMap[closestKey];
|
|
1670
|
+
}
|
|
1671
|
+
function mapFontScaleToCategory(fontScale, platform) {
|
|
1672
|
+
return platform === "ios" ? mapIOSFontScaleToCategory(fontScale) : mapAndroidFontScaleToCategory(fontScale);
|
|
1673
|
+
}
|
|
1674
|
+
function useCreateUserAgent({
|
|
1675
|
+
batteryModePreference,
|
|
1676
|
+
colorPreference,
|
|
1677
|
+
locale,
|
|
1678
|
+
navbarPreference,
|
|
1679
|
+
pureSafeArea,
|
|
1680
|
+
safeArea,
|
|
1681
|
+
safeAreaBottomTransparency
|
|
1682
|
+
}) {
|
|
1683
|
+
const platform = (0, import_react_native_bedrock13.getPlatformOS)();
|
|
1684
|
+
const appVersion = getTossAppVersion();
|
|
1685
|
+
const { fontScale } = (0, import_react_native19.useWindowDimensions)();
|
|
1686
|
+
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1687
|
+
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1688
|
+
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1689
|
+
return [
|
|
1690
|
+
`TossApp/${appVersion}`,
|
|
1691
|
+
batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
|
|
1692
|
+
colorPreference && `TossColorPreference/${colorPreference}`,
|
|
1693
|
+
`TossFontAccessibility/${fontA11y}`,
|
|
1694
|
+
`TossFontScale/${normalizedFontScale}`,
|
|
1695
|
+
locale && `TossLocale/${locale}`,
|
|
1696
|
+
navbarPreference && `TossNavbarPreference/${navbarPreference}`,
|
|
1697
|
+
pureSafeArea && `TossPureSafeArea/${pureSafeArea}`,
|
|
1698
|
+
safeArea && `TossSafeArea/${safeArea}`,
|
|
1699
|
+
safeAreaBottomTransparency && `TossSafeAreaBottomTransparency/${safeAreaBottomTransparency}`,
|
|
1700
|
+
platformString
|
|
1701
|
+
].filter(Boolean).join(" ");
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
// src/hooks/useGeolocation.ts
|
|
1705
|
+
var import_react8 = require("react");
|
|
1706
|
+
var import_react_native_bedrock14 = require("react-native-bedrock");
|
|
1707
|
+
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1708
|
+
const isVisible = (0, import_react_native_bedrock14.useVisibility)();
|
|
1709
|
+
const [location, setLocation] = (0, import_react8.useState)(null);
|
|
1710
|
+
(0, import_react8.useEffect)(() => {
|
|
1711
|
+
if (!isVisible) {
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
return startUpdateLocation({
|
|
1715
|
+
options: {
|
|
1716
|
+
accuracy,
|
|
1717
|
+
distanceInterval,
|
|
1718
|
+
timeInterval
|
|
1719
|
+
},
|
|
1720
|
+
onEvent: setLocation,
|
|
1721
|
+
onError: console.error
|
|
1722
|
+
});
|
|
1723
|
+
}, [accuracy, distanceInterval, timeInterval, isVisible]);
|
|
1724
|
+
return location;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1178
1727
|
// src/utils/log.ts
|
|
1179
|
-
var
|
|
1728
|
+
var import_react_native_bedrock15 = require("react-native-bedrock");
|
|
1180
1729
|
|
|
1181
1730
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1182
1731
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1202,7 +1751,7 @@ var getGroupId = (url) => {
|
|
|
1202
1751
|
};
|
|
1203
1752
|
var getReferrer = () => {
|
|
1204
1753
|
try {
|
|
1205
|
-
const referrer = new URL((0,
|
|
1754
|
+
const referrer = new URL((0, import_react_native_bedrock15.getSchemeUri)());
|
|
1206
1755
|
return referrer.searchParams.get("referrer");
|
|
1207
1756
|
} catch {
|
|
1208
1757
|
return "";
|
|
@@ -1224,18 +1773,18 @@ var trackScreen = (url) => {
|
|
|
1224
1773
|
};
|
|
1225
1774
|
|
|
1226
1775
|
// src/components/WebView.tsx
|
|
1227
|
-
var
|
|
1776
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1228
1777
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1229
1778
|
var operationalEnvironment = getOperationalEnvironment();
|
|
1230
1779
|
var TYPES = ["partner", "external", "game"];
|
|
1231
1780
|
var WEBVIEW_TYPES = {
|
|
1232
|
-
partner:
|
|
1233
|
-
external:
|
|
1781
|
+
partner: import_react_native20.PartnerWebViewScreen,
|
|
1782
|
+
external: import_react_native20.ExternalWebViewScreen,
|
|
1234
1783
|
game: GameWebView
|
|
1235
1784
|
};
|
|
1236
1785
|
function mergeSchemeQueryParamsInto(url) {
|
|
1237
1786
|
const baseUrl = new URL(url);
|
|
1238
|
-
const schemeUrl = new URL((0,
|
|
1787
|
+
const schemeUrl = new URL((0, import_react_native_bedrock16.getSchemeUri)());
|
|
1239
1788
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1240
1789
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1241
1790
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1259,10 +1808,11 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1259
1808
|
if (!TYPES.includes(type)) {
|
|
1260
1809
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1261
1810
|
}
|
|
1262
|
-
const bedrockEvent = (0,
|
|
1263
|
-
const uri = (0,
|
|
1264
|
-
const top = (0,
|
|
1265
|
-
const bottom = (0,
|
|
1811
|
+
const bedrockEvent = (0, import_react_native_bedrock16.useBedrockEvent)();
|
|
1812
|
+
const uri = (0, import_react9.useMemo)(() => getWebViewUri(local), [local]);
|
|
1813
|
+
const top = (0, import_private3.useSafeAreaTop)();
|
|
1814
|
+
const bottom = (0, import_private3.useSafeAreaBottom)();
|
|
1815
|
+
const global2 = getAppsInTossGlobals();
|
|
1266
1816
|
const handler = useBridgeHandler({
|
|
1267
1817
|
onMessage,
|
|
1268
1818
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1284,6 +1834,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1284
1834
|
...constant_bridges_exports,
|
|
1285
1835
|
getSafeAreaTop: () => top,
|
|
1286
1836
|
getSafeAreaBottom: () => bottom,
|
|
1837
|
+
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
1287
1838
|
/** AdMob */
|
|
1288
1839
|
loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1289
1840
|
showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
@@ -1307,7 +1858,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1307
1858
|
iapGetProductItemList: IAP.getProductItemList
|
|
1308
1859
|
}
|
|
1309
1860
|
});
|
|
1310
|
-
const baseProps = (0,
|
|
1861
|
+
const baseProps = (0, import_react9.useMemo)(() => {
|
|
1311
1862
|
switch (type) {
|
|
1312
1863
|
case "partner": {
|
|
1313
1864
|
const headerOnlyProp = {
|
|
@@ -1338,25 +1889,36 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1338
1889
|
}, [type, props]);
|
|
1339
1890
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1340
1891
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1341
|
-
const handleNavigationStateChange = (0,
|
|
1892
|
+
const handleNavigationStateChange = (0, import_react9.useCallback)((event) => {
|
|
1342
1893
|
if (event.url) {
|
|
1343
1894
|
trackScreen(event.url);
|
|
1344
1895
|
}
|
|
1345
1896
|
}, []);
|
|
1346
|
-
|
|
1897
|
+
const userAgent = useCreateUserAgent({
|
|
1898
|
+
colorPreference: "light"
|
|
1899
|
+
});
|
|
1900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1347
1901
|
BaseWebView,
|
|
1348
1902
|
{
|
|
1349
1903
|
ref: handler.ref,
|
|
1350
1904
|
...props,
|
|
1351
1905
|
...baseProps,
|
|
1352
|
-
source: {
|
|
1906
|
+
source: {
|
|
1907
|
+
uri,
|
|
1908
|
+
// NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
|
|
1909
|
+
headers: {
|
|
1910
|
+
"User-Agent": userAgent
|
|
1911
|
+
}
|
|
1912
|
+
},
|
|
1913
|
+
userAgent: import_react_native21.Platform.OS === "ios" ? userAgent : void 0,
|
|
1353
1914
|
sharedCookiesEnabled: true,
|
|
1354
1915
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1355
1916
|
thirdPartyCookiesEnabled: true,
|
|
1356
1917
|
onMessage: handler.onMessage,
|
|
1357
1918
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1358
1919
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1359
|
-
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
1920
|
+
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1921
|
+
decelerationRate: import_react_native21.Platform.OS === "ios" ? 1 : void 0
|
|
1360
1922
|
}
|
|
1361
1923
|
);
|
|
1362
1924
|
}
|
|
@@ -1367,29 +1929,6 @@ function ensureValue(value, name) {
|
|
|
1367
1929
|
return value;
|
|
1368
1930
|
}
|
|
1369
1931
|
|
|
1370
|
-
// src/hooks/useGeolocation.ts
|
|
1371
|
-
var import_react7 = require("react");
|
|
1372
|
-
var import_react_native_bedrock12 = require("react-native-bedrock");
|
|
1373
|
-
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1374
|
-
const isVisible = (0, import_react_native_bedrock12.useVisibility)();
|
|
1375
|
-
const [location, setLocation] = (0, import_react7.useState)(null);
|
|
1376
|
-
(0, import_react7.useEffect)(() => {
|
|
1377
|
-
if (!isVisible) {
|
|
1378
|
-
return;
|
|
1379
|
-
}
|
|
1380
|
-
return startUpdateLocation({
|
|
1381
|
-
options: {
|
|
1382
|
-
accuracy,
|
|
1383
|
-
distanceInterval,
|
|
1384
|
-
timeInterval
|
|
1385
|
-
},
|
|
1386
|
-
onEvent: setLocation,
|
|
1387
|
-
onError: console.error
|
|
1388
|
-
});
|
|
1389
|
-
}, [accuracy, distanceInterval, timeInterval, isVisible]);
|
|
1390
|
-
return location;
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
1932
|
// src/types.ts
|
|
1394
1933
|
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
1395
1934
|
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
@@ -1401,14 +1940,6 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
1401
1940
|
return Accuracy3;
|
|
1402
1941
|
})(Accuracy2 || {});
|
|
1403
1942
|
|
|
1404
|
-
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1405
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1406
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
// src/private.ts
|
|
1410
|
-
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1411
|
-
|
|
1412
1943
|
// src/index.ts
|
|
1413
1944
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1414
1945
|
var Analytics2 = {
|
|
@@ -1437,15 +1968,19 @@ var Analytics2 = {
|
|
|
1437
1968
|
getClipboardText,
|
|
1438
1969
|
getCurrentLocation,
|
|
1439
1970
|
getDeviceId,
|
|
1971
|
+
getGameCenterGameProfile,
|
|
1440
1972
|
getOperationalEnvironment,
|
|
1441
1973
|
getTossAppVersion,
|
|
1442
1974
|
getTossShareLink,
|
|
1443
1975
|
isMinVersionSupported,
|
|
1444
1976
|
openCamera,
|
|
1977
|
+
openGameCenterLeaderboard,
|
|
1445
1978
|
saveBase64Data,
|
|
1446
1979
|
setClipboardText,
|
|
1447
1980
|
setDeviceOrientation,
|
|
1448
1981
|
startUpdateLocation,
|
|
1982
|
+
submitGameCenterLeaderBoardScore,
|
|
1983
|
+
useCreateUserAgent,
|
|
1449
1984
|
useGeolocation,
|
|
1450
1985
|
...require("@apps-in-toss/analytics")
|
|
1451
1986
|
});
|