@apps-in-toss/framework 0.0.31 → 0.0.33
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/bridge-meta.js +1 -1
- package/dist/index.cjs +487 -118
- package/dist/index.d.cts +582 -439
- package/dist/index.d.ts +582 -439
- package/dist/index.js +457 -89
- package/package.json +7 -7
- package/src/async-bridges.ts +3 -0
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,8 +1546,8 @@ __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");
|
|
1183
1551
|
var FontA11yCategory = {
|
|
1184
1552
|
Large: "Large",
|
|
1185
1553
|
xLarge: "xLarge",
|
|
@@ -1312,9 +1680,9 @@ function useCreateUserAgent({
|
|
|
1312
1680
|
safeArea,
|
|
1313
1681
|
safeAreaBottomTransparency
|
|
1314
1682
|
}) {
|
|
1315
|
-
const platform = (0,
|
|
1683
|
+
const platform = (0, import_react_native_bedrock13.getPlatformOS)();
|
|
1316
1684
|
const appVersion = getTossAppVersion();
|
|
1317
|
-
const { fontScale } = (0,
|
|
1685
|
+
const { fontScale } = (0, import_react_native19.useWindowDimensions)();
|
|
1318
1686
|
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1319
1687
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1320
1688
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
@@ -1334,12 +1702,12 @@ function useCreateUserAgent({
|
|
|
1334
1702
|
}
|
|
1335
1703
|
|
|
1336
1704
|
// src/hooks/useGeolocation.ts
|
|
1337
|
-
var
|
|
1338
|
-
var
|
|
1705
|
+
var import_react8 = require("react");
|
|
1706
|
+
var import_react_native_bedrock14 = require("react-native-bedrock");
|
|
1339
1707
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1340
|
-
const isVisible = (0,
|
|
1341
|
-
const [location, setLocation] = (0,
|
|
1342
|
-
(0,
|
|
1708
|
+
const isVisible = (0, import_react_native_bedrock14.useVisibility)();
|
|
1709
|
+
const [location, setLocation] = (0, import_react8.useState)(null);
|
|
1710
|
+
(0, import_react8.useEffect)(() => {
|
|
1343
1711
|
if (!isVisible) {
|
|
1344
1712
|
return;
|
|
1345
1713
|
}
|
|
@@ -1357,7 +1725,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1357
1725
|
}
|
|
1358
1726
|
|
|
1359
1727
|
// src/utils/log.ts
|
|
1360
|
-
var
|
|
1728
|
+
var import_react_native_bedrock15 = require("react-native-bedrock");
|
|
1361
1729
|
|
|
1362
1730
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1363
1731
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1383,7 +1751,7 @@ var getGroupId = (url) => {
|
|
|
1383
1751
|
};
|
|
1384
1752
|
var getReferrer = () => {
|
|
1385
1753
|
try {
|
|
1386
|
-
const referrer = new URL((0,
|
|
1754
|
+
const referrer = new URL((0, import_react_native_bedrock15.getSchemeUri)());
|
|
1387
1755
|
return referrer.searchParams.get("referrer");
|
|
1388
1756
|
} catch {
|
|
1389
1757
|
return "";
|
|
@@ -1405,18 +1773,18 @@ var trackScreen = (url) => {
|
|
|
1405
1773
|
};
|
|
1406
1774
|
|
|
1407
1775
|
// src/components/WebView.tsx
|
|
1408
|
-
var
|
|
1776
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1409
1777
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1410
1778
|
var operationalEnvironment = getOperationalEnvironment();
|
|
1411
1779
|
var TYPES = ["partner", "external", "game"];
|
|
1412
1780
|
var WEBVIEW_TYPES = {
|
|
1413
|
-
partner:
|
|
1414
|
-
external:
|
|
1781
|
+
partner: import_react_native20.PartnerWebViewScreen,
|
|
1782
|
+
external: import_react_native20.ExternalWebViewScreen,
|
|
1415
1783
|
game: GameWebView
|
|
1416
1784
|
};
|
|
1417
1785
|
function mergeSchemeQueryParamsInto(url) {
|
|
1418
1786
|
const baseUrl = new URL(url);
|
|
1419
|
-
const schemeUrl = new URL((0,
|
|
1787
|
+
const schemeUrl = new URL((0, import_react_native_bedrock16.getSchemeUri)());
|
|
1420
1788
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1421
1789
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1422
1790
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1440,16 +1808,21 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1440
1808
|
if (!TYPES.includes(type)) {
|
|
1441
1809
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1442
1810
|
}
|
|
1443
|
-
const bedrockEvent = (0,
|
|
1444
|
-
const uri = (0,
|
|
1445
|
-
const top = (0,
|
|
1446
|
-
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)();
|
|
1447
1815
|
const global2 = getAppsInTossGlobals();
|
|
1816
|
+
const partner = (0, import_react_native20.usePartnerNavigation)();
|
|
1448
1817
|
const handler = useBridgeHandler({
|
|
1449
1818
|
onMessage,
|
|
1450
1819
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1451
1820
|
eventListenerMap: {
|
|
1452
1821
|
...event_bridges_exports,
|
|
1822
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native20.tdsEvent.addEventListener("navigationAccessoryEvent", {
|
|
1823
|
+
onEvent,
|
|
1824
|
+
onError
|
|
1825
|
+
}),
|
|
1453
1826
|
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1454
1827
|
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1455
1828
|
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
@@ -1478,6 +1851,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1478
1851
|
asyncHandlerMap: {
|
|
1479
1852
|
...bedrockAsyncBridges,
|
|
1480
1853
|
...async_bridges_exports,
|
|
1854
|
+
addAccessoryButton: async (params) => partner.addAccessoryButton(params),
|
|
1855
|
+
removeAccessoryButton: async () => partner.removeAccessoryButton(),
|
|
1481
1856
|
/** internal */
|
|
1482
1857
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
1483
1858
|
/** Storage */
|
|
@@ -1490,16 +1865,14 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1490
1865
|
iapGetProductItemList: IAP.getProductItemList
|
|
1491
1866
|
}
|
|
1492
1867
|
});
|
|
1493
|
-
const baseProps = (0,
|
|
1868
|
+
const baseProps = (0, import_react9.useMemo)(() => {
|
|
1494
1869
|
switch (type) {
|
|
1495
1870
|
case "partner": {
|
|
1496
1871
|
const headerOnlyProp = {
|
|
1497
1872
|
header: {
|
|
1498
1873
|
..."header" in props ? props.header : {},
|
|
1499
1874
|
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
1500
|
-
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
1501
|
-
rightButtons: void 0
|
|
1502
|
-
// TODO: onClick 이벤트를 받아야 하기에 런타임에서 설정 받아야 함
|
|
1875
|
+
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
1503
1876
|
}
|
|
1504
1877
|
};
|
|
1505
1878
|
return headerOnlyProp;
|
|
@@ -1521,7 +1894,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1521
1894
|
}, [type, props]);
|
|
1522
1895
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1523
1896
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1524
|
-
const handleNavigationStateChange = (0,
|
|
1897
|
+
const handleNavigationStateChange = (0, import_react9.useCallback)((event) => {
|
|
1525
1898
|
if (event.url) {
|
|
1526
1899
|
trackScreen(event.url);
|
|
1527
1900
|
}
|
|
@@ -1529,7 +1902,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1529
1902
|
const userAgent = useCreateUserAgent({
|
|
1530
1903
|
colorPreference: "light"
|
|
1531
1904
|
});
|
|
1532
|
-
return /* @__PURE__ */ (0,
|
|
1905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1533
1906
|
BaseWebView,
|
|
1534
1907
|
{
|
|
1535
1908
|
ref: handler.ref,
|
|
@@ -1542,14 +1915,15 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1542
1915
|
"User-Agent": userAgent
|
|
1543
1916
|
}
|
|
1544
1917
|
},
|
|
1545
|
-
userAgent:
|
|
1918
|
+
userAgent: import_react_native21.Platform.OS === "ios" ? userAgent : void 0,
|
|
1546
1919
|
sharedCookiesEnabled: true,
|
|
1547
1920
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1548
1921
|
thirdPartyCookiesEnabled: true,
|
|
1549
1922
|
onMessage: handler.onMessage,
|
|
1550
1923
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1551
1924
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1552
|
-
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
1925
|
+
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1926
|
+
decelerationRate: import_react_native21.Platform.OS === "ios" ? 1 : void 0
|
|
1553
1927
|
}
|
|
1554
1928
|
);
|
|
1555
1929
|
}
|
|
@@ -1571,14 +1945,6 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
1571
1945
|
return Accuracy3;
|
|
1572
1946
|
})(Accuracy2 || {});
|
|
1573
1947
|
|
|
1574
|
-
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1575
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1576
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
// src/private.ts
|
|
1580
|
-
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1581
|
-
|
|
1582
1948
|
// src/index.ts
|
|
1583
1949
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1584
1950
|
var Analytics2 = {
|
|
@@ -1607,15 +1973,18 @@ var Analytics2 = {
|
|
|
1607
1973
|
getClipboardText,
|
|
1608
1974
|
getCurrentLocation,
|
|
1609
1975
|
getDeviceId,
|
|
1976
|
+
getGameCenterGameProfile,
|
|
1610
1977
|
getOperationalEnvironment,
|
|
1611
1978
|
getTossAppVersion,
|
|
1612
1979
|
getTossShareLink,
|
|
1613
1980
|
isMinVersionSupported,
|
|
1614
1981
|
openCamera,
|
|
1982
|
+
openGameCenterLeaderboard,
|
|
1615
1983
|
saveBase64Data,
|
|
1616
1984
|
setClipboardText,
|
|
1617
1985
|
setDeviceOrientation,
|
|
1618
1986
|
startUpdateLocation,
|
|
1987
|
+
submitGameCenterLeaderBoardScore,
|
|
1619
1988
|
useCreateUserAgent,
|
|
1620
1989
|
useGeolocation,
|
|
1621
1990
|
...require("@apps-in-toss/analytics")
|