@apps-in-toss/framework 0.0.30 → 0.0.32
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 +606 -118
- package/dist/index.d.cts +583 -441
- package/dist/index.d.ts +583 -441
- package/dist/index.js +574 -89
- package/package.json +5 -5
- package/src/async-bridges.ts +3 -0
- package/dist/bridge-meta.d.ts +0 -1
- package/dist/bridge-meta.js +0 -183
package/dist/index.cjs
CHANGED
|
@@ -49,15 +49,18 @@ __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,
|
|
61
64
|
useCreateUserAgent: () => useCreateUserAgent,
|
|
62
65
|
useGeolocation: () => useGeolocation
|
|
63
66
|
});
|
|
@@ -67,7 +70,7 @@ var import_analytics2 = require("@apps-in-toss/analytics");
|
|
|
67
70
|
// src/core/registerApp.tsx
|
|
68
71
|
var import_analytics = require("@apps-in-toss/analytics");
|
|
69
72
|
var import_react_native6 = require("@toss-design-system/react-native");
|
|
70
|
-
var
|
|
73
|
+
var import_react_native_bedrock9 = require("react-native-bedrock");
|
|
71
74
|
|
|
72
75
|
// src/core/components/AppEvent.tsx
|
|
73
76
|
var import_react2 = require("react");
|
|
@@ -502,11 +505,14 @@ __export(async_bridges_exports, {
|
|
|
502
505
|
fetchContacts: () => fetchContacts,
|
|
503
506
|
getClipboardText: () => getClipboardText,
|
|
504
507
|
getCurrentLocation: () => getCurrentLocation,
|
|
508
|
+
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
505
509
|
getTossShareLink: () => getTossShareLink,
|
|
506
510
|
openCamera: () => openCamera,
|
|
511
|
+
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
507
512
|
saveBase64Data: () => saveBase64Data,
|
|
508
513
|
setClipboardText: () => setClipboardText,
|
|
509
|
-
setDeviceOrientation: () => setDeviceOrientation
|
|
514
|
+
setDeviceOrientation: () => setDeviceOrientation,
|
|
515
|
+
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore
|
|
510
516
|
});
|
|
511
517
|
|
|
512
518
|
// src/native-modules/setClipboardText.ts
|
|
@@ -658,6 +664,43 @@ async function saveBase64Data(params) {
|
|
|
658
664
|
await AppsInTossModule.saveBase64Data(params);
|
|
659
665
|
}
|
|
660
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
|
+
|
|
661
704
|
// src/core/registerApp.tsx
|
|
662
705
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
663
706
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
@@ -676,7 +719,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
676
719
|
logger: (params) => void eventLog(params),
|
|
677
720
|
debug: analytics?.debug ?? __DEV__
|
|
678
721
|
});
|
|
679
|
-
return
|
|
722
|
+
return import_react_native_bedrock9.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
|
|
680
723
|
appName: getAppName(),
|
|
681
724
|
context,
|
|
682
725
|
router: {
|
|
@@ -812,38 +855,15 @@ loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
|
812
855
|
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
813
856
|
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
814
857
|
|
|
815
|
-
// src/native-modules/getTossAppVersion.ts
|
|
816
|
-
function getTossAppVersion() {
|
|
817
|
-
return AppsInTossModule.tossAppVersion;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
858
|
// src/native-modules/getDeviceId.ts
|
|
821
859
|
function getDeviceId() {
|
|
822
860
|
return AppsInTossModule.deviceId;
|
|
823
861
|
}
|
|
824
862
|
|
|
825
|
-
// src/native-modules/
|
|
826
|
-
function
|
|
827
|
-
return AppsInTossModule.
|
|
828
|
-
}
|
|
829
|
-
function setItem(key, value) {
|
|
830
|
-
return AppsInTossModule.setStorageItem({
|
|
831
|
-
key,
|
|
832
|
-
value
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
function removeItem(key) {
|
|
836
|
-
return AppsInTossModule.removeStorageItem({ key });
|
|
837
|
-
}
|
|
838
|
-
function clearItems() {
|
|
839
|
-
return AppsInTossModule.clearStorage({});
|
|
863
|
+
// src/native-modules/getTossAppVersion.ts
|
|
864
|
+
function getTossAppVersion() {
|
|
865
|
+
return AppsInTossModule.tossAppVersion;
|
|
840
866
|
}
|
|
841
|
-
var Storage = {
|
|
842
|
-
getItem,
|
|
843
|
-
setItem,
|
|
844
|
-
removeItem,
|
|
845
|
-
clearItems
|
|
846
|
-
};
|
|
847
867
|
|
|
848
868
|
// src/native-modules/iap.ts
|
|
849
869
|
async function createOneTimePurchaseOrder(params) {
|
|
@@ -871,6 +891,29 @@ var IAP = {
|
|
|
871
891
|
getProductItemList
|
|
872
892
|
};
|
|
873
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
|
+
|
|
874
917
|
// src/native-modules/index.ts
|
|
875
918
|
var TossPay = {
|
|
876
919
|
checkoutPayment
|
|
@@ -883,36 +926,353 @@ var GoogleAdMob = {
|
|
|
883
926
|
};
|
|
884
927
|
|
|
885
928
|
// src/components/WebView.tsx
|
|
886
|
-
var
|
|
887
|
-
var
|
|
888
|
-
var
|
|
889
|
-
var
|
|
890
|
-
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");
|
|
891
934
|
var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
|
|
892
935
|
var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
|
|
893
936
|
|
|
894
937
|
// src/components/GameWebView.tsx
|
|
895
938
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
896
|
-
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");
|
|
897
952
|
var import_es_hangul = require("es-hangul");
|
|
898
953
|
var import_react4 = require("react");
|
|
899
|
-
var
|
|
900
|
-
|
|
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
|
+
};
|
|
901
1261
|
|
|
902
1262
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
903
1263
|
var import_react_native_svg = require("@react-native-bedrock/native/react-native-svg");
|
|
904
|
-
var
|
|
905
|
-
var
|
|
1264
|
+
var import_react_native15 = require("@toss-design-system/react-native");
|
|
1265
|
+
var import_react_native16 = require("react-native");
|
|
906
1266
|
|
|
907
1267
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
908
|
-
var
|
|
1268
|
+
var import_react_native13 = require("react-native");
|
|
909
1269
|
|
|
910
1270
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
911
|
-
var
|
|
1271
|
+
var import_react_native12 = require("react-native");
|
|
912
1272
|
function byPlatform({
|
|
913
1273
|
...props
|
|
914
1274
|
}) {
|
|
915
|
-
return (props[
|
|
1275
|
+
return (props[import_react_native12.Platform.OS] ?? props.fallback)();
|
|
916
1276
|
}
|
|
917
1277
|
|
|
918
1278
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -920,21 +1280,21 @@ var RIGHT_MARGIN = 24;
|
|
|
920
1280
|
var IOS_DEFAULT_MARGIN = 20;
|
|
921
1281
|
|
|
922
1282
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
923
|
-
var
|
|
1283
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
924
1284
|
function IOSHeaderRight(props) {
|
|
925
|
-
return /* @__PURE__ */ (0,
|
|
1285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.ios, ...props });
|
|
926
1286
|
}
|
|
927
1287
|
function AndroidHeaderRight(props) {
|
|
928
|
-
return /* @__PURE__ */ (0,
|
|
1288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.android, ...props });
|
|
929
1289
|
}
|
|
930
1290
|
function HeaderRight(props) {
|
|
931
1291
|
return byPlatform({
|
|
932
|
-
ios: () => /* @__PURE__ */ (0,
|
|
933
|
-
android: () => /* @__PURE__ */ (0,
|
|
934
|
-
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 })
|
|
935
1295
|
});
|
|
936
1296
|
}
|
|
937
|
-
var styles =
|
|
1297
|
+
var styles = import_react_native13.StyleSheet.create({
|
|
938
1298
|
ios: {
|
|
939
1299
|
marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
|
|
940
1300
|
flexDirection: "row"
|
|
@@ -946,48 +1306,48 @@ var styles = import_react_native8.StyleSheet.create({
|
|
|
946
1306
|
|
|
947
1307
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
948
1308
|
var import_react_native_safe_area_context = require("@react-native-bedrock/native/react-native-safe-area-context");
|
|
949
|
-
var
|
|
1309
|
+
var import_react_native14 = require("react-native");
|
|
950
1310
|
function useSafeAreaTop() {
|
|
951
1311
|
const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
952
|
-
const hasDynamicIsland =
|
|
1312
|
+
const hasDynamicIsland = import_react_native14.Platform.OS === "ios" && safeAreaInsets.top > 50;
|
|
953
1313
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
954
1314
|
return safeAreaTop;
|
|
955
1315
|
}
|
|
956
1316
|
|
|
957
1317
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
958
|
-
var
|
|
1318
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
959
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>';
|
|
960
1320
|
function GameNavigationBar({ onClose }) {
|
|
961
1321
|
const safeAreaTop = useSafeAreaTop();
|
|
962
|
-
return /* @__PURE__ */ (0,
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
964
|
-
/* @__PURE__ */ (0,
|
|
965
|
-
|
|
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,
|
|
966
1326
|
{
|
|
967
1327
|
style: {
|
|
968
1328
|
width: "100%",
|
|
969
|
-
height:
|
|
1329
|
+
height: import_react_native16.Platform.OS === "ios" ? 44 : 54,
|
|
970
1330
|
flexDirection: "row",
|
|
971
1331
|
alignItems: "center",
|
|
972
1332
|
justifyContent: "flex-end",
|
|
973
1333
|
position: "absolute",
|
|
974
|
-
zIndex:
|
|
1334
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
975
1335
|
marginTop: safeAreaTop,
|
|
976
|
-
paddingRight:
|
|
1336
|
+
paddingRight: import_react_native16.Platform.OS === "ios" ? 10 : 8
|
|
977
1337
|
},
|
|
978
1338
|
pointerEvents: "box-none",
|
|
979
|
-
children: /* @__PURE__ */ (0,
|
|
980
|
-
|
|
1339
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1340
|
+
import_react_native16.TouchableOpacity,
|
|
981
1341
|
{
|
|
982
1342
|
hitSlop: { left: 8, right: 8 },
|
|
983
1343
|
accessibilityRole: "button",
|
|
984
1344
|
accessible: true,
|
|
985
1345
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
986
1346
|
style: {
|
|
987
|
-
padding:
|
|
1347
|
+
padding: import_react_native16.Platform.OS === "ios" ? 7 : 9
|
|
988
1348
|
},
|
|
989
1349
|
onPress: onClose,
|
|
990
|
-
children: /* @__PURE__ */ (0,
|
|
1350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
991
1351
|
}
|
|
992
1352
|
) })
|
|
993
1353
|
}
|
|
@@ -996,48 +1356,56 @@ function GameNavigationBar({ onClose }) {
|
|
|
996
1356
|
}
|
|
997
1357
|
|
|
998
1358
|
// src/components/GameWebView.tsx
|
|
999
|
-
var
|
|
1000
|
-
var GameWebView = (0,
|
|
1001
|
-
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)();
|
|
1002
1362
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1003
|
-
const
|
|
1363
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react6.useState)(false);
|
|
1364
|
+
const handleClose = (0, import_react6.useCallback)(async () => {
|
|
1004
1365
|
const isConfirmed = await openConfirm({
|
|
1005
|
-
title: `${(0,
|
|
1366
|
+
title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1006
1367
|
leftButton: "\uCDE8\uC18C",
|
|
1007
1368
|
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1008
1369
|
closeOnDimmerClick: true
|
|
1009
1370
|
});
|
|
1010
1371
|
if (isConfirmed) {
|
|
1011
|
-
(0,
|
|
1372
|
+
(0, import_react_native_bedrock12.closeView)();
|
|
1012
1373
|
}
|
|
1013
1374
|
}, [brandDisplayName, openConfirm]);
|
|
1014
|
-
(0,
|
|
1015
|
-
if (
|
|
1016
|
-
(0,
|
|
1375
|
+
(0, import_react6.useEffect)(() => {
|
|
1376
|
+
if (import_react_native18.Platform.OS === "ios") {
|
|
1377
|
+
(0, import_react_native_bedrock12.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1017
1378
|
return () => {
|
|
1018
|
-
(0,
|
|
1379
|
+
(0, import_react_native_bedrock12.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
1019
1380
|
};
|
|
1020
1381
|
}
|
|
1021
1382
|
return;
|
|
1022
1383
|
}, []);
|
|
1023
|
-
(0,
|
|
1384
|
+
(0, import_react6.useEffect)(() => {
|
|
1024
1385
|
const backHandler = () => {
|
|
1025
1386
|
handleClose();
|
|
1026
1387
|
return true;
|
|
1027
1388
|
};
|
|
1028
|
-
|
|
1389
|
+
import_react_native18.BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
1029
1390
|
return () => {
|
|
1030
|
-
|
|
1391
|
+
import_react_native18.BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1031
1392
|
};
|
|
1032
1393
|
}, [handleClose]);
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
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 })
|
|
1036
1404
|
] });
|
|
1037
1405
|
});
|
|
1038
1406
|
|
|
1039
1407
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1040
|
-
var
|
|
1408
|
+
var import_react7 = require("react");
|
|
1041
1409
|
function serializeError(error) {
|
|
1042
1410
|
return JSON.stringify(error, (_, value) => {
|
|
1043
1411
|
if (value instanceof Error) {
|
|
@@ -1086,8 +1454,8 @@ function useBridgeHandler({
|
|
|
1086
1454
|
eventListenerMap,
|
|
1087
1455
|
injectedJavaScript: originalInjectedJavaScript
|
|
1088
1456
|
}) {
|
|
1089
|
-
const ref = (0,
|
|
1090
|
-
const injectedJavaScript = (0,
|
|
1457
|
+
const ref = (0, import_react7.useRef)(null);
|
|
1458
|
+
const injectedJavaScript = (0, import_react7.useMemo)(
|
|
1091
1459
|
() => [
|
|
1092
1460
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1093
1461
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1113,7 +1481,7 @@ function useBridgeHandler({
|
|
|
1113
1481
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1114
1482
|
`);
|
|
1115
1483
|
};
|
|
1116
|
-
const $onMessage = (0,
|
|
1484
|
+
const $onMessage = (0, import_react7.useCallback)(
|
|
1117
1485
|
async (e) => {
|
|
1118
1486
|
onMessage?.(e);
|
|
1119
1487
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1178,28 +1546,152 @@ __export(event_bridges_exports, {
|
|
|
1178
1546
|
});
|
|
1179
1547
|
|
|
1180
1548
|
// src/hooks/useCreateUserAgent.ts
|
|
1181
|
-
var
|
|
1182
|
-
var
|
|
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
|
+
}
|
|
1183
1674
|
function useCreateUserAgent({
|
|
1184
1675
|
batteryModePreference,
|
|
1185
1676
|
colorPreference,
|
|
1186
|
-
fontA11y,
|
|
1187
1677
|
locale,
|
|
1188
1678
|
navbarPreference,
|
|
1189
1679
|
pureSafeArea,
|
|
1190
1680
|
safeArea,
|
|
1191
1681
|
safeAreaBottomTransparency
|
|
1192
1682
|
}) {
|
|
1193
|
-
const platform = (0,
|
|
1683
|
+
const platform = (0, import_react_native_bedrock13.getPlatformOS)();
|
|
1194
1684
|
const appVersion = getTossAppVersion();
|
|
1195
|
-
const fontScale = (0,
|
|
1685
|
+
const { fontScale } = (0, import_react_native19.useWindowDimensions)();
|
|
1196
1686
|
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1687
|
+
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1688
|
+
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1197
1689
|
return [
|
|
1198
1690
|
`TossApp/${appVersion}`,
|
|
1199
1691
|
batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
|
|
1200
1692
|
colorPreference && `TossColorPreference/${colorPreference}`,
|
|
1201
|
-
|
|
1202
|
-
|
|
1693
|
+
`TossFontAccessibility/${fontA11y}`,
|
|
1694
|
+
`TossFontScale/${normalizedFontScale}`,
|
|
1203
1695
|
locale && `TossLocale/${locale}`,
|
|
1204
1696
|
navbarPreference && `TossNavbarPreference/${navbarPreference}`,
|
|
1205
1697
|
pureSafeArea && `TossPureSafeArea/${pureSafeArea}`,
|
|
@@ -1210,12 +1702,12 @@ function useCreateUserAgent({
|
|
|
1210
1702
|
}
|
|
1211
1703
|
|
|
1212
1704
|
// src/hooks/useGeolocation.ts
|
|
1213
|
-
var
|
|
1214
|
-
var
|
|
1705
|
+
var import_react8 = require("react");
|
|
1706
|
+
var import_react_native_bedrock14 = require("react-native-bedrock");
|
|
1215
1707
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1216
|
-
const isVisible = (0,
|
|
1217
|
-
const [location, setLocation] = (0,
|
|
1218
|
-
(0,
|
|
1708
|
+
const isVisible = (0, import_react_native_bedrock14.useVisibility)();
|
|
1709
|
+
const [location, setLocation] = (0, import_react8.useState)(null);
|
|
1710
|
+
(0, import_react8.useEffect)(() => {
|
|
1219
1711
|
if (!isVisible) {
|
|
1220
1712
|
return;
|
|
1221
1713
|
}
|
|
@@ -1233,7 +1725,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1233
1725
|
}
|
|
1234
1726
|
|
|
1235
1727
|
// src/utils/log.ts
|
|
1236
|
-
var
|
|
1728
|
+
var import_react_native_bedrock15 = require("react-native-bedrock");
|
|
1237
1729
|
|
|
1238
1730
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1239
1731
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1259,7 +1751,7 @@ var getGroupId = (url) => {
|
|
|
1259
1751
|
};
|
|
1260
1752
|
var getReferrer = () => {
|
|
1261
1753
|
try {
|
|
1262
|
-
const referrer = new URL((0,
|
|
1754
|
+
const referrer = new URL((0, import_react_native_bedrock15.getSchemeUri)());
|
|
1263
1755
|
return referrer.searchParams.get("referrer");
|
|
1264
1756
|
} catch {
|
|
1265
1757
|
return "";
|
|
@@ -1281,18 +1773,18 @@ var trackScreen = (url) => {
|
|
|
1281
1773
|
};
|
|
1282
1774
|
|
|
1283
1775
|
// src/components/WebView.tsx
|
|
1284
|
-
var
|
|
1776
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1285
1777
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1286
1778
|
var operationalEnvironment = getOperationalEnvironment();
|
|
1287
1779
|
var TYPES = ["partner", "external", "game"];
|
|
1288
1780
|
var WEBVIEW_TYPES = {
|
|
1289
|
-
partner:
|
|
1290
|
-
external:
|
|
1781
|
+
partner: import_react_native20.PartnerWebViewScreen,
|
|
1782
|
+
external: import_react_native20.ExternalWebViewScreen,
|
|
1291
1783
|
game: GameWebView
|
|
1292
1784
|
};
|
|
1293
1785
|
function mergeSchemeQueryParamsInto(url) {
|
|
1294
1786
|
const baseUrl = new URL(url);
|
|
1295
|
-
const schemeUrl = new URL((0,
|
|
1787
|
+
const schemeUrl = new URL((0, import_react_native_bedrock16.getSchemeUri)());
|
|
1296
1788
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1297
1789
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1298
1790
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1316,10 +1808,10 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1316
1808
|
if (!TYPES.includes(type)) {
|
|
1317
1809
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1318
1810
|
}
|
|
1319
|
-
const bedrockEvent = (0,
|
|
1320
|
-
const uri = (0,
|
|
1321
|
-
const top = (0,
|
|
1322
|
-
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)();
|
|
1323
1815
|
const global2 = getAppsInTossGlobals();
|
|
1324
1816
|
const handler = useBridgeHandler({
|
|
1325
1817
|
onMessage,
|
|
@@ -1366,7 +1858,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1366
1858
|
iapGetProductItemList: IAP.getProductItemList
|
|
1367
1859
|
}
|
|
1368
1860
|
});
|
|
1369
|
-
const baseProps = (0,
|
|
1861
|
+
const baseProps = (0, import_react9.useMemo)(() => {
|
|
1370
1862
|
switch (type) {
|
|
1371
1863
|
case "partner": {
|
|
1372
1864
|
const headerOnlyProp = {
|
|
@@ -1397,7 +1889,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1397
1889
|
}, [type, props]);
|
|
1398
1890
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1399
1891
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1400
|
-
const handleNavigationStateChange = (0,
|
|
1892
|
+
const handleNavigationStateChange = (0, import_react9.useCallback)((event) => {
|
|
1401
1893
|
if (event.url) {
|
|
1402
1894
|
trackScreen(event.url);
|
|
1403
1895
|
}
|
|
@@ -1405,7 +1897,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1405
1897
|
const userAgent = useCreateUserAgent({
|
|
1406
1898
|
colorPreference: "light"
|
|
1407
1899
|
});
|
|
1408
|
-
return /* @__PURE__ */ (0,
|
|
1900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1409
1901
|
BaseWebView,
|
|
1410
1902
|
{
|
|
1411
1903
|
ref: handler.ref,
|
|
@@ -1418,14 +1910,15 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1418
1910
|
"User-Agent": userAgent
|
|
1419
1911
|
}
|
|
1420
1912
|
},
|
|
1421
|
-
userAgent:
|
|
1913
|
+
userAgent: import_react_native21.Platform.OS === "ios" ? userAgent : void 0,
|
|
1422
1914
|
sharedCookiesEnabled: true,
|
|
1423
1915
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1424
1916
|
thirdPartyCookiesEnabled: true,
|
|
1425
1917
|
onMessage: handler.onMessage,
|
|
1426
1918
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1427
1919
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1428
|
-
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
1920
|
+
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1921
|
+
decelerationRate: import_react_native21.Platform.OS === "ios" ? 1 : void 0
|
|
1429
1922
|
}
|
|
1430
1923
|
);
|
|
1431
1924
|
}
|
|
@@ -1447,14 +1940,6 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
1447
1940
|
return Accuracy3;
|
|
1448
1941
|
})(Accuracy2 || {});
|
|
1449
1942
|
|
|
1450
|
-
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1451
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1452
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
// src/private.ts
|
|
1456
|
-
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1457
|
-
|
|
1458
1943
|
// src/index.ts
|
|
1459
1944
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1460
1945
|
var Analytics2 = {
|
|
@@ -1483,15 +1968,18 @@ var Analytics2 = {
|
|
|
1483
1968
|
getClipboardText,
|
|
1484
1969
|
getCurrentLocation,
|
|
1485
1970
|
getDeviceId,
|
|
1971
|
+
getGameCenterGameProfile,
|
|
1486
1972
|
getOperationalEnvironment,
|
|
1487
1973
|
getTossAppVersion,
|
|
1488
1974
|
getTossShareLink,
|
|
1489
1975
|
isMinVersionSupported,
|
|
1490
1976
|
openCamera,
|
|
1977
|
+
openGameCenterLeaderboard,
|
|
1491
1978
|
saveBase64Data,
|
|
1492
1979
|
setClipboardText,
|
|
1493
1980
|
setDeviceOrientation,
|
|
1494
1981
|
startUpdateLocation,
|
|
1982
|
+
submitGameCenterLeaderBoardScore,
|
|
1495
1983
|
useCreateUserAgent,
|
|
1496
1984
|
useGeolocation,
|
|
1497
1985
|
...require("@apps-in-toss/analytics")
|