@apps-in-toss/framework 1.4.9 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +326 -218
- package/dist/index.js +219 -111
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
|
18
18
|
// src/core/registerApp.tsx
|
|
19
19
|
import { Analytics } from "@apps-in-toss/analytics";
|
|
20
20
|
import { isMinVersionSupported as isMinVersionSupported3, setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, eventLog } from "@apps-in-toss/native-modules";
|
|
21
|
-
import { Granite as
|
|
21
|
+
import { Granite as Granite7 } from "@granite-js/react-native";
|
|
22
22
|
import { TDSProvider } from "@toss/tds-react-native";
|
|
23
23
|
import { AppRegistry } from "react-native";
|
|
24
24
|
|
|
@@ -856,18 +856,22 @@ function useNavigationEvent() {
|
|
|
856
856
|
|
|
857
857
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
858
858
|
import { INTERNAL__appBridgeHandler, isMinVersionSupported as isMinVersionSupported2 } from "@apps-in-toss/native-modules";
|
|
859
|
-
import { openURL as
|
|
860
|
-
import { BottomSheet, List, ListHeader
|
|
859
|
+
import { openURL as openURL5 } from "@granite-js/react-native";
|
|
860
|
+
import { BottomSheet, List, ListHeader } from "@toss/tds-react-native";
|
|
861
861
|
import { useAdaptive as useAdaptive2, useOverlay as useOverlay2 } from "@toss/tds-react-native/private";
|
|
862
862
|
import { useEffect as useEffect7, useState as useState4 } from "react";
|
|
863
863
|
|
|
864
864
|
// src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
|
|
865
865
|
import { getOperationalEnvironment } from "@apps-in-toss/native-modules";
|
|
866
866
|
import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
|
|
867
|
-
import {
|
|
868
|
-
import { useAdaptive } from "@toss/tds-react-native/private";
|
|
867
|
+
import { useDialog as useDialog4 } from "@toss/tds-react-native";
|
|
869
868
|
import { NativeModules } from "react-native";
|
|
870
869
|
|
|
870
|
+
// src/core/hooks/useMoreButtonBottomSheet/Menu.tsx
|
|
871
|
+
import { ListRow, Asset as Asset2 } from "@toss/tds-react-native";
|
|
872
|
+
import { useAdaptive } from "@toss/tds-react-native/private";
|
|
873
|
+
import { View as View2 } from "react-native";
|
|
874
|
+
|
|
871
875
|
// src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
|
|
872
876
|
import { INTERNAL__module as INTERNAL__module5 } from "@apps-in-toss/native-modules";
|
|
873
877
|
import { Granite as Granite5 } from "@granite-js/react-native";
|
|
@@ -937,6 +941,82 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
937
941
|
};
|
|
938
942
|
}
|
|
939
943
|
|
|
944
|
+
// src/core/hooks/useMoreButtonBottomSheet/Menu.tsx
|
|
945
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
946
|
+
function Menu({ title, iconURL, onPress }) {
|
|
947
|
+
const globals = getAppsInTossGlobals();
|
|
948
|
+
const adaptive = useAdaptive();
|
|
949
|
+
const iconName = getIconName(iconURL);
|
|
950
|
+
const logging = useMoreButtonBottomSheetLogging();
|
|
951
|
+
const brandPrimaryColorRGB = hexToRGB(globals.brandPrimaryColor);
|
|
952
|
+
const iconBackgroundColor = brandPrimaryColorRGB ? `rgba(${brandPrimaryColorRGB.join(",")},0.1)` : adaptive.grey100;
|
|
953
|
+
return /* @__PURE__ */ jsx5(
|
|
954
|
+
ListRow,
|
|
955
|
+
{
|
|
956
|
+
left: /* @__PURE__ */ jsx5(
|
|
957
|
+
View2,
|
|
958
|
+
{
|
|
959
|
+
style: {
|
|
960
|
+
width: 30,
|
|
961
|
+
height: 30,
|
|
962
|
+
borderRadius: 10,
|
|
963
|
+
flexDirection: "row",
|
|
964
|
+
alignItems: "center",
|
|
965
|
+
justifyContent: "center",
|
|
966
|
+
marginRight: 16,
|
|
967
|
+
backgroundColor: iconBackgroundColor
|
|
968
|
+
},
|
|
969
|
+
children: iconName ? /* @__PURE__ */ jsx5(
|
|
970
|
+
Asset2.Icon,
|
|
971
|
+
{
|
|
972
|
+
frameShape: { width: 20, height: 20 },
|
|
973
|
+
color: globals.brandPrimaryColor,
|
|
974
|
+
name: iconName
|
|
975
|
+
}
|
|
976
|
+
) : /* @__PURE__ */ jsx5(
|
|
977
|
+
Asset2.Image,
|
|
978
|
+
{
|
|
979
|
+
frameShape: { width: 20, height: 20 },
|
|
980
|
+
source: { uri: iconURL }
|
|
981
|
+
}
|
|
982
|
+
)
|
|
983
|
+
}
|
|
984
|
+
),
|
|
985
|
+
contents: /* @__PURE__ */ jsx5(
|
|
986
|
+
ListRow.Texts,
|
|
987
|
+
{
|
|
988
|
+
type: "1RowTypeA",
|
|
989
|
+
top: title,
|
|
990
|
+
topProps: { color: adaptive.grey700 }
|
|
991
|
+
}
|
|
992
|
+
),
|
|
993
|
+
verticalPadding: "extraSmall",
|
|
994
|
+
onPress: () => {
|
|
995
|
+
logging.menuClick({ title });
|
|
996
|
+
onPress?.();
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
var iconNameRegExp = /^(icon-|icn-(?!(car|sec|bank-(fill|square|horizontal))-))(.+)/i;
|
|
1002
|
+
var iconURLRegExp = /^https:\/\/static\.toss\.im\/icons\/(png\/\dx|svg|pdf)\/((icon-|icn-(?!(car|sec|bank-(fill|square|horizontal))-))(.+))\.(png|svg|pdf)$/i;
|
|
1003
|
+
function isIconUrl(url) {
|
|
1004
|
+
return iconNameRegExp.test(url) || iconURLRegExp.test(url);
|
|
1005
|
+
}
|
|
1006
|
+
function getIconName(url) {
|
|
1007
|
+
if (!isIconUrl(url)) {
|
|
1008
|
+
return null;
|
|
1009
|
+
}
|
|
1010
|
+
if (iconNameRegExp.test(url)) {
|
|
1011
|
+
return url;
|
|
1012
|
+
}
|
|
1013
|
+
return url.match(iconURLRegExp)?.[2];
|
|
1014
|
+
}
|
|
1015
|
+
function hexToRGB(hex) {
|
|
1016
|
+
const rgb = hex.toLowerCase().match(/[0-9,a-f]{2}/g)?.map((str) => parseInt(str, 16));
|
|
1017
|
+
return rgb?.length === 3 ? rgb : void 0;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
940
1020
|
// src/core/utils/url.ts
|
|
941
1021
|
function addParamsToUrl(url, params) {
|
|
942
1022
|
const urlObj = new URL(url);
|
|
@@ -947,42 +1027,24 @@ function addParamsToUrl(url, params) {
|
|
|
947
1027
|
}
|
|
948
1028
|
|
|
949
1029
|
// src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
|
|
950
|
-
import { jsx as
|
|
1030
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
951
1031
|
var SHARE_SCHEME_REFERRER = "appsintoss.common_module_share";
|
|
952
1032
|
var APP_SHARE_MENU_INFO = {
|
|
953
1033
|
contactItemName: "\uACF5\uC720\uD558\uAE30",
|
|
954
1034
|
contactIconUrl: "https://static.toss.im/icons/png/4x/icon-share-dots-mono.png"
|
|
955
1035
|
};
|
|
956
1036
|
function AppShareListMenu() {
|
|
957
|
-
const globals = getAppsInTossGlobals();
|
|
958
|
-
const adaptive = useAdaptive();
|
|
959
|
-
const logging = useMoreButtonBottomSheetLogging();
|
|
960
1037
|
const initialScheme = getSchemeUri4();
|
|
961
1038
|
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
962
1039
|
const { openConfirm } = useDialog4();
|
|
963
1040
|
const schemeForShare = addParamsToUrl(initialScheme, {
|
|
964
1041
|
referrer: SHARE_SCHEME_REFERRER
|
|
965
1042
|
});
|
|
966
|
-
return /* @__PURE__ */
|
|
967
|
-
|
|
1043
|
+
return /* @__PURE__ */ jsx6(
|
|
1044
|
+
Menu,
|
|
968
1045
|
{
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
{
|
|
972
|
-
color: globals.brandPrimaryColor,
|
|
973
|
-
source: { uri: APP_SHARE_MENU_INFO.contactIconUrl },
|
|
974
|
-
type: "background"
|
|
975
|
-
}
|
|
976
|
-
),
|
|
977
|
-
contents: /* @__PURE__ */ jsx5(
|
|
978
|
-
ListRow.Texts,
|
|
979
|
-
{
|
|
980
|
-
type: "1RowTypeA",
|
|
981
|
-
top: APP_SHARE_MENU_INFO.contactItemName,
|
|
982
|
-
topProps: { color: adaptive.grey700 }
|
|
983
|
-
}
|
|
984
|
-
),
|
|
985
|
-
verticalPadding: "extraSmall",
|
|
1046
|
+
title: APP_SHARE_MENU_INFO.contactItemName,
|
|
1047
|
+
iconURL: APP_SHARE_MENU_INFO.contactIconUrl,
|
|
986
1048
|
onPress: () => {
|
|
987
1049
|
if (isSandbox) {
|
|
988
1050
|
openConfirm({
|
|
@@ -993,7 +1055,6 @@ function AppShareListMenu() {
|
|
|
993
1055
|
});
|
|
994
1056
|
return;
|
|
995
1057
|
}
|
|
996
|
-
logging.menuClick({ title: APP_SHARE_MENU_INFO.contactItemName });
|
|
997
1058
|
NativeModules.AppsInTossModule.shareWithScheme({
|
|
998
1059
|
params: {
|
|
999
1060
|
schemeURL: schemeForShare
|
|
@@ -1004,6 +1065,25 @@ function AppShareListMenu() {
|
|
|
1004
1065
|
);
|
|
1005
1066
|
}
|
|
1006
1067
|
|
|
1068
|
+
// src/core/hooks/useMoreButtonBottomSheet/PermissionsMenu.tsx
|
|
1069
|
+
import { getOperationalEnvironment as getOperationalEnvironment2 } from "@apps-in-toss/native-modules";
|
|
1070
|
+
import { Granite as Granite6, openURL as openURL4 } from "@granite-js/react-native";
|
|
1071
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1072
|
+
function PermissionsMenu() {
|
|
1073
|
+
const globals = getAppsInTossGlobals();
|
|
1074
|
+
if (getOperationalEnvironment2() === "sandbox") {
|
|
1075
|
+
return null;
|
|
1076
|
+
}
|
|
1077
|
+
return /* @__PURE__ */ jsx7(
|
|
1078
|
+
Menu,
|
|
1079
|
+
{
|
|
1080
|
+
title: "\uAD8C\uD55C \uC124\uC815",
|
|
1081
|
+
iconURL: "https://static.toss.im/icons/png/4x/icon-setting-mono.png",
|
|
1082
|
+
onPress: () => openURL4(`servicetoss://apps-in-toss-menu/permissions?appName=${Granite6.appName}&displayAppName=${globals.brandDisplayName}`)
|
|
1083
|
+
}
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1007
1087
|
// src/core/utils/ensureValue.ts
|
|
1008
1088
|
function ensureValue(value, name) {
|
|
1009
1089
|
if (value === void 0) {
|
|
@@ -1013,7 +1093,7 @@ function ensureValue(value, name) {
|
|
|
1013
1093
|
}
|
|
1014
1094
|
|
|
1015
1095
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
1016
|
-
import { Fragment as Fragment3, jsx as
|
|
1096
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1017
1097
|
var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
|
|
1018
1098
|
var MIN_VERSION = {
|
|
1019
1099
|
BOTTOM_SHEET: {
|
|
@@ -1023,6 +1103,10 @@ var MIN_VERSION = {
|
|
|
1023
1103
|
SHARE_LIST_MENU: {
|
|
1024
1104
|
android: "5.230.0",
|
|
1025
1105
|
ios: "5.230.0"
|
|
1106
|
+
},
|
|
1107
|
+
PERMISSIONS_MENU: {
|
|
1108
|
+
android: "5.238.0",
|
|
1109
|
+
ios: "5.237.0"
|
|
1026
1110
|
}
|
|
1027
1111
|
};
|
|
1028
1112
|
function useMoreButtonBottomSheet() {
|
|
@@ -1035,6 +1119,7 @@ function useMoreButtonBottomSheet() {
|
|
|
1035
1119
|
const title = ensureValue(globals.brandDisplayName, "displayName");
|
|
1036
1120
|
const isBottomSheetSupported = isMinVersionSupported2(MIN_VERSION.BOTTOM_SHEET);
|
|
1037
1121
|
const isShareListMenuSupported = isMinVersionSupported2(MIN_VERSION.SHARE_LIST_MENU);
|
|
1122
|
+
const [isPermissionsMenuSupported, setIsPermissionsMenuSupported] = useState4(false);
|
|
1038
1123
|
useEffect7(() => {
|
|
1039
1124
|
if (!isBottomSheetSupported) {
|
|
1040
1125
|
return;
|
|
@@ -1047,6 +1132,16 @@ function useMoreButtonBottomSheet() {
|
|
|
1047
1132
|
onError: (error) => console.error("\uBA54\uB274 \uBAA9\uB85D\uC744 \uAC00\uC838\uC624\uB294 \uB370 \uC2E4\uD328\uD588\uC5B4\uC694:", error)
|
|
1048
1133
|
}
|
|
1049
1134
|
);
|
|
1135
|
+
if (isMinVersionSupported2(MIN_VERSION.PERMISSIONS_MENU)) {
|
|
1136
|
+
INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
1137
|
+
"getAllPermission",
|
|
1138
|
+
{},
|
|
1139
|
+
{
|
|
1140
|
+
onSuccess: (permissions) => setIsPermissionsMenuSupported(permissions.length > 0),
|
|
1141
|
+
onError: (error) => console.error("\uAD8C\uD55C \uBAA9\uB85D\uC744 \uAC00\uC838\uC624\uB294 \uB370 \uC2E4\uD328\uD588\uC5B4\uC694:", error)
|
|
1142
|
+
}
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1050
1145
|
}, [isBottomSheetSupported]);
|
|
1051
1146
|
const onClickHandler = async () => {
|
|
1052
1147
|
logging.open();
|
|
@@ -1062,17 +1157,17 @@ function useMoreButtonBottomSheet() {
|
|
|
1062
1157
|
logging.close();
|
|
1063
1158
|
close();
|
|
1064
1159
|
};
|
|
1065
|
-
return /* @__PURE__ */
|
|
1160
|
+
return /* @__PURE__ */ jsx8(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx8(
|
|
1066
1161
|
BottomSheet.Root,
|
|
1067
1162
|
{
|
|
1068
|
-
header: /* @__PURE__ */
|
|
1163
|
+
header: /* @__PURE__ */ jsx8(
|
|
1069
1164
|
ListHeader,
|
|
1070
1165
|
{
|
|
1071
|
-
title: /* @__PURE__ */
|
|
1166
|
+
title: /* @__PURE__ */ jsx8(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
|
|
1072
1167
|
}
|
|
1073
1168
|
),
|
|
1074
1169
|
open: isOpen,
|
|
1075
|
-
cta: /* @__PURE__ */
|
|
1170
|
+
cta: /* @__PURE__ */ jsx8(
|
|
1076
1171
|
BottomSheet.CTA,
|
|
1077
1172
|
{
|
|
1078
1173
|
size: "large",
|
|
@@ -1087,36 +1182,19 @@ function useMoreButtonBottomSheet() {
|
|
|
1087
1182
|
onClose: handleClose,
|
|
1088
1183
|
onExited: exit,
|
|
1089
1184
|
children: /* @__PURE__ */ jsxs2(List, { rowSeparator: "none", children: [
|
|
1090
|
-
itemList.map(
|
|
1091
|
-
|
|
1092
|
-
|
|
1185
|
+
itemList.map(
|
|
1186
|
+
(item) => /* @__PURE__ */ jsx8(
|
|
1187
|
+
Menu,
|
|
1093
1188
|
{
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
color: globals.brandPrimaryColor,
|
|
1098
|
-
source: { uri: item.contactIconUrl },
|
|
1099
|
-
type: "background"
|
|
1100
|
-
}
|
|
1101
|
-
),
|
|
1102
|
-
contents: /* @__PURE__ */ jsx6(
|
|
1103
|
-
ListRow2.Texts,
|
|
1104
|
-
{
|
|
1105
|
-
type: "1RowTypeA",
|
|
1106
|
-
top: item.contactItemName,
|
|
1107
|
-
topProps: { color: adaptive.grey700 }
|
|
1108
|
-
}
|
|
1109
|
-
),
|
|
1110
|
-
verticalPadding: "extraSmall",
|
|
1111
|
-
onPress: () => {
|
|
1112
|
-
logging.menuClick({ title: item.contactItemName });
|
|
1113
|
-
openURL4(item.contactUri);
|
|
1114
|
-
}
|
|
1189
|
+
title: item.contactItemName,
|
|
1190
|
+
iconURL: item.contactIconUrl,
|
|
1191
|
+
onPress: () => openURL5(item.contactUri)
|
|
1115
1192
|
},
|
|
1116
1193
|
item.contactItemName
|
|
1117
|
-
)
|
|
1118
|
-
|
|
1119
|
-
isShareListMenuSupported && /* @__PURE__ */
|
|
1194
|
+
)
|
|
1195
|
+
),
|
|
1196
|
+
isShareListMenuSupported && /* @__PURE__ */ jsx8(AppShareListMenu, {}),
|
|
1197
|
+
isPermissionsMenuSupported && /* @__PURE__ */ jsx8(PermissionsMenu, {})
|
|
1120
1198
|
] })
|
|
1121
1199
|
}
|
|
1122
1200
|
) });
|
|
@@ -1129,12 +1207,12 @@ function BottomSheetImpressionArea({ children }) {
|
|
|
1129
1207
|
useEffect7(() => {
|
|
1130
1208
|
logging.show();
|
|
1131
1209
|
}, [logging]);
|
|
1132
|
-
return /* @__PURE__ */
|
|
1210
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children });
|
|
1133
1211
|
}
|
|
1134
1212
|
|
|
1135
1213
|
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
1136
1214
|
import { useEffect as useEffect8, useRef as useRef3 } from "react";
|
|
1137
|
-
import { Fragment as Fragment4, jsx as
|
|
1215
|
+
import { Fragment as Fragment4, jsx as jsx9 } from "react/jsx-runtime";
|
|
1138
1216
|
function NavigationBarImpressionArea({
|
|
1139
1217
|
children,
|
|
1140
1218
|
withHomeButton
|
|
@@ -1147,11 +1225,11 @@ function NavigationBarImpressionArea({
|
|
|
1147
1225
|
hasLogged.current = true;
|
|
1148
1226
|
}
|
|
1149
1227
|
}, [logging, withHomeButton]);
|
|
1150
|
-
return /* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ jsx9(Fragment4, { children });
|
|
1151
1229
|
}
|
|
1152
1230
|
|
|
1153
1231
|
// src/components/NavigationBar/RNNavigationBar/Default.tsx
|
|
1154
|
-
import { jsx as
|
|
1232
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1155
1233
|
function DefaultNavigationBar() {
|
|
1156
1234
|
const globals = getAppsInTossGlobals();
|
|
1157
1235
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
@@ -1161,7 +1239,7 @@ function DefaultNavigationBar() {
|
|
|
1161
1239
|
const { navigationRightButton } = useNavigationBarContext();
|
|
1162
1240
|
const navigationEvent = useNavigationEvent();
|
|
1163
1241
|
useHardwareBackPress(navigationEvent.handleBack);
|
|
1164
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ jsx10(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx10(
|
|
1165
1243
|
TopNavigation,
|
|
1166
1244
|
{
|
|
1167
1245
|
title: globals.brandDisplayName,
|
|
@@ -1172,7 +1250,8 @@ function DefaultNavigationBar() {
|
|
|
1172
1250
|
onPressClose: navigationEvent.handleCloseButtonClick,
|
|
1173
1251
|
withHome: withHomeButton,
|
|
1174
1252
|
fixedRightButton: navigationRightButton,
|
|
1175
|
-
|
|
1253
|
+
leftVisible: withBackButton,
|
|
1254
|
+
children: /* @__PURE__ */ jsx10(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx10(NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
|
|
1176
1255
|
}
|
|
1177
1256
|
) });
|
|
1178
1257
|
}
|
|
@@ -1181,8 +1260,8 @@ function DefaultNavigationBar() {
|
|
|
1181
1260
|
import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-context";
|
|
1182
1261
|
import { PageNavbar } from "@toss/tds-react-native";
|
|
1183
1262
|
import { NavigationRightContent, useSafeAreaTop } from "@toss/tds-react-native/private";
|
|
1184
|
-
import { Platform as Platform2, View as
|
|
1185
|
-
import { Fragment as Fragment5, jsx as
|
|
1263
|
+
import { Platform as Platform2, View as View3 } from "react-native";
|
|
1264
|
+
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1186
1265
|
function GameNavigationBar() {
|
|
1187
1266
|
const safeAreaTop = useSafeAreaTop();
|
|
1188
1267
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
@@ -1191,9 +1270,9 @@ function GameNavigationBar() {
|
|
|
1191
1270
|
const { right: safeAreaRight } = useSafeAreaInsets();
|
|
1192
1271
|
useHardwareBackPress(navigationEvent.handleBack);
|
|
1193
1272
|
return /* @__PURE__ */ jsxs3(Fragment5, { children: [
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
|
|
1273
|
+
/* @__PURE__ */ jsx11(PageNavbar, { preference: { type: "none" } }),
|
|
1274
|
+
/* @__PURE__ */ jsx11(
|
|
1275
|
+
View3,
|
|
1197
1276
|
{
|
|
1198
1277
|
style: {
|
|
1199
1278
|
width: "100%",
|
|
@@ -1208,7 +1287,7 @@ function GameNavigationBar() {
|
|
|
1208
1287
|
paddingRight: safeAreaRight + 10
|
|
1209
1288
|
},
|
|
1210
1289
|
pointerEvents: "box-none",
|
|
1211
|
-
children: /* @__PURE__ */
|
|
1290
|
+
children: /* @__PURE__ */ jsx11(
|
|
1212
1291
|
NavigationRightContent,
|
|
1213
1292
|
{
|
|
1214
1293
|
fixedRightButton: navigationRightButton,
|
|
@@ -1238,15 +1317,15 @@ import * as constant_bridges_star from "@apps-in-toss/native-modules/constant-br
|
|
|
1238
1317
|
import * as event_bridges_star from "@apps-in-toss/native-modules/event-bridges";
|
|
1239
1318
|
|
|
1240
1319
|
// src/components/RNAppContainer.tsx
|
|
1241
|
-
import { Fragment as Fragment6, jsx as
|
|
1320
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1242
1321
|
function RNAppContainer({ children }) {
|
|
1243
1322
|
const global2 = getAppsInTossGlobals();
|
|
1244
1323
|
switch (global2.appType) {
|
|
1245
1324
|
case "game":
|
|
1246
|
-
return /* @__PURE__ */
|
|
1325
|
+
return /* @__PURE__ */ jsx12(GameAppContainer, { children });
|
|
1247
1326
|
case "general":
|
|
1248
1327
|
default:
|
|
1249
|
-
return /* @__PURE__ */
|
|
1328
|
+
return /* @__PURE__ */ jsx12(GeneralAppContainer, { children });
|
|
1250
1329
|
}
|
|
1251
1330
|
}
|
|
1252
1331
|
function GameAppContainer({ children }) {
|
|
@@ -1268,40 +1347,40 @@ function GameAppContainer({ children }) {
|
|
|
1268
1347
|
});
|
|
1269
1348
|
}, []);
|
|
1270
1349
|
return /* @__PURE__ */ jsxs4(Fragment6, { children: [
|
|
1271
|
-
/* @__PURE__ */
|
|
1272
|
-
(0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ jsx12(RNNavigationBar.Game, {}),
|
|
1351
|
+
(0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx12(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children }) : children
|
|
1273
1352
|
] });
|
|
1274
1353
|
}
|
|
1275
1354
|
function GeneralAppContainer({ children }) {
|
|
1276
1355
|
return /* @__PURE__ */ jsxs4(Fragment6, { children: [
|
|
1277
|
-
/* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ jsx12(RNNavigationBar.Default, {}),
|
|
1278
1357
|
children
|
|
1279
1358
|
] });
|
|
1280
1359
|
}
|
|
1281
1360
|
|
|
1282
1361
|
// src/core/registerApp.tsx
|
|
1283
|
-
import { Fragment as Fragment7, jsx as
|
|
1362
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1284
1363
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
1285
1364
|
if (!isMinVersionSupported3({
|
|
1286
1365
|
android: "5.220.0",
|
|
1287
1366
|
ios: "5.221.0"
|
|
1288
1367
|
})) {
|
|
1289
1368
|
return /* @__PURE__ */ jsxs5(Fragment7, { children: [
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1292
|
-
/* @__PURE__ */
|
|
1369
|
+
/* @__PURE__ */ jsx13(AppEvent.Entry, {}),
|
|
1370
|
+
/* @__PURE__ */ jsx13(AppEvent.System, { ...initialProps }),
|
|
1371
|
+
/* @__PURE__ */ jsx13(AppUpdate, {})
|
|
1293
1372
|
] });
|
|
1294
1373
|
}
|
|
1295
1374
|
return /* @__PURE__ */ jsxs5(Fragment7, { children: [
|
|
1296
|
-
/* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1298
|
-
/* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1375
|
+
/* @__PURE__ */ jsx13(AppEvent.StayTime, {}),
|
|
1376
|
+
/* @__PURE__ */ jsx13(AppEvent.Entry, {}),
|
|
1377
|
+
/* @__PURE__ */ jsx13(AppEvent.System, { ...initialProps }),
|
|
1378
|
+
/* @__PURE__ */ jsx13(Container, { ...initialProps, children: /* @__PURE__ */ jsx13(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx13(TDSContainer, { ...initialProps, children }) }) })
|
|
1300
1379
|
] });
|
|
1301
1380
|
}
|
|
1302
1381
|
function TDSContainer({ children }) {
|
|
1303
1382
|
useAppsInTossBridge();
|
|
1304
|
-
return /* @__PURE__ */
|
|
1383
|
+
return /* @__PURE__ */ jsx13(Fragment7, { children });
|
|
1305
1384
|
}
|
|
1306
1385
|
function registerApp(container, { context, analytics }) {
|
|
1307
1386
|
const appName = getAppName();
|
|
@@ -1311,7 +1390,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
1311
1390
|
logger: (params) => void eventLog(params),
|
|
1312
1391
|
debug: analytics?.debug ?? __DEV__
|
|
1313
1392
|
});
|
|
1314
|
-
const App =
|
|
1393
|
+
const App = Granite7.registerApp(AppsInTossContainer.bind(null, container), {
|
|
1315
1394
|
appName,
|
|
1316
1395
|
context,
|
|
1317
1396
|
setIosSwipeGestureEnabled: setIosSwipeGestureEnabled2,
|
|
@@ -1328,7 +1407,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
1328
1407
|
}
|
|
1329
1408
|
function AppsInTossScreenContainer({ children }) {
|
|
1330
1409
|
const isRNApp = getAppsInTossGlobals().webViewType == null;
|
|
1331
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsx13(NavigationBarContextProvider, { children: /* @__PURE__ */ jsx13(Analytics.Screen, { children: isRNApp ? /* @__PURE__ */ jsx13(RNAppContainer, { children }) : children }) });
|
|
1332
1411
|
}
|
|
1333
1412
|
function getAppName() {
|
|
1334
1413
|
try {
|
|
@@ -1363,10 +1442,10 @@ import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
|
|
|
1363
1442
|
import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
|
|
1364
1443
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3 } from "@toss/tds-react-native/private";
|
|
1365
1444
|
import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef6, useState as useState8 } from "react";
|
|
1366
|
-
import { BackHandler as BackHandler2, Platform as Platform6 } from "react-native";
|
|
1445
|
+
import { BackHandler as BackHandler2, Linking, Platform as Platform6 } from "react-native";
|
|
1367
1446
|
|
|
1368
1447
|
// src/components/GameWebView.tsx
|
|
1369
|
-
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment as
|
|
1448
|
+
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment as getOperationalEnvironment4 } from "@apps-in-toss/native-modules";
|
|
1370
1449
|
import {
|
|
1371
1450
|
WebView as PlainWebView
|
|
1372
1451
|
} from "@granite-js/native/react-native-webview";
|
|
@@ -1380,8 +1459,8 @@ import { PageNavbar as PageNavbar2, useDialog as useDialog5 } from "@toss/tds-re
|
|
|
1380
1459
|
import { NavigationRightContent as NavigationRightContent2, useSafeAreaTop as useSafeAreaTop2 } from "@toss/tds-react-native/private";
|
|
1381
1460
|
import { josa as josa3 } from "es-hangul";
|
|
1382
1461
|
import { useCallback as useCallback8 } from "react";
|
|
1383
|
-
import { Platform as Platform4, View as
|
|
1384
|
-
import { Fragment as Fragment8, jsx as
|
|
1462
|
+
import { Platform as Platform4, View as View4 } from "react-native";
|
|
1463
|
+
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1385
1464
|
function GameWebviewNavigationBar() {
|
|
1386
1465
|
const safeAreaTop = useSafeAreaTop2();
|
|
1387
1466
|
const { openConfirm } = useDialog5();
|
|
@@ -1407,9 +1486,9 @@ function GameWebviewNavigationBar() {
|
|
|
1407
1486
|
}
|
|
1408
1487
|
}, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
|
|
1409
1488
|
return /* @__PURE__ */ jsxs6(Fragment8, { children: [
|
|
1410
|
-
/* @__PURE__ */
|
|
1411
|
-
/* @__PURE__ */
|
|
1412
|
-
|
|
1489
|
+
/* @__PURE__ */ jsx14(PageNavbar2, { preference: { type: "none" } }),
|
|
1490
|
+
/* @__PURE__ */ jsx14(
|
|
1491
|
+
View4,
|
|
1413
1492
|
{
|
|
1414
1493
|
style: {
|
|
1415
1494
|
width: "100%",
|
|
@@ -1424,7 +1503,7 @@ function GameWebviewNavigationBar() {
|
|
|
1424
1503
|
paddingRight: safeAreaRight + 10
|
|
1425
1504
|
},
|
|
1426
1505
|
pointerEvents: "box-none",
|
|
1427
|
-
children: /* @__PURE__ */
|
|
1506
|
+
children: /* @__PURE__ */ jsx14(
|
|
1428
1507
|
NavigationRightContent2,
|
|
1429
1508
|
{
|
|
1430
1509
|
fixedRightButton: navigationRightButton,
|
|
@@ -1441,7 +1520,7 @@ function GameWebviewNavigationBar() {
|
|
|
1441
1520
|
}
|
|
1442
1521
|
|
|
1443
1522
|
// src/components/GameWebView.tsx
|
|
1444
|
-
import { Fragment as Fragment9, jsx as
|
|
1523
|
+
import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1445
1524
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1446
1525
|
const [isEntryMessageExited, setIsEntryMessageExited] = useState6(false);
|
|
1447
1526
|
useEffect10(() => {
|
|
@@ -1461,8 +1540,8 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1461
1540
|
});
|
|
1462
1541
|
}, []);
|
|
1463
1542
|
return /* @__PURE__ */ jsxs7(Fragment9, { children: [
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
|
|
1543
|
+
/* @__PURE__ */ jsx15(GameWebviewNavigationBar, {}),
|
|
1544
|
+
getOperationalEnvironment4() === "toss" ? /* @__PURE__ */ jsx15(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx15(PlainWebView, { ref, ...props })
|
|
1466
1545
|
] });
|
|
1467
1546
|
});
|
|
1468
1547
|
|
|
@@ -1478,7 +1557,7 @@ import { useDialog as useDialog6 } from "@toss/tds-react-native";
|
|
|
1478
1557
|
import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss/tds-react-native/private";
|
|
1479
1558
|
import { josa as josa4 } from "es-hangul";
|
|
1480
1559
|
import { useCallback as useCallback9 } from "react";
|
|
1481
|
-
import { jsx as
|
|
1560
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1482
1561
|
function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
1483
1562
|
const globals = getAppsInTossGlobals();
|
|
1484
1563
|
const { captureExitLog } = useCaptureExitLog();
|
|
@@ -1504,7 +1583,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1504
1583
|
closeView5();
|
|
1505
1584
|
}
|
|
1506
1585
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1507
|
-
return /* @__PURE__ */
|
|
1586
|
+
return /* @__PURE__ */ jsx16(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx16(
|
|
1508
1587
|
TopNavigation2,
|
|
1509
1588
|
{
|
|
1510
1589
|
title: globals.brandDisplayName,
|
|
@@ -1515,20 +1594,34 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1515
1594
|
onPressClose: handleClose,
|
|
1516
1595
|
withHome: withHomeButton,
|
|
1517
1596
|
fixedRightButton: navigationRightButton,
|
|
1518
|
-
|
|
1597
|
+
leftVisible: withBackButton,
|
|
1598
|
+
children: /* @__PURE__ */ jsx16(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx16(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
|
|
1519
1599
|
}
|
|
1520
1600
|
) });
|
|
1521
1601
|
}
|
|
1522
1602
|
|
|
1523
1603
|
// src/components/PartnerWebView.tsx
|
|
1524
|
-
import { Fragment as Fragment10, jsx as
|
|
1604
|
+
import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1525
1605
|
var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ onBackButtonClick, onHomeButtonClick, ...webViewProps }, ref) {
|
|
1526
1606
|
return /* @__PURE__ */ jsxs8(Fragment10, { children: [
|
|
1527
|
-
/* @__PURE__ */
|
|
1528
|
-
/* @__PURE__ */
|
|
1607
|
+
/* @__PURE__ */ jsx17(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
|
|
1608
|
+
/* @__PURE__ */ jsx17(PlainWebView2, { ref, ...webViewProps, style: { flex: 1 } })
|
|
1529
1609
|
] });
|
|
1530
1610
|
});
|
|
1531
1611
|
|
|
1612
|
+
// src/components/utils/url.ts
|
|
1613
|
+
function convertIntentURL(url) {
|
|
1614
|
+
if (url.protocol !== "intent:") {
|
|
1615
|
+
return null;
|
|
1616
|
+
}
|
|
1617
|
+
const components = url.hash.replace("#Intent;", "").split(";").map((component) => component.split("="));
|
|
1618
|
+
const scheme = components.find(([key]) => key === "scheme")?.[1];
|
|
1619
|
+
if (!scheme) {
|
|
1620
|
+
return null;
|
|
1621
|
+
}
|
|
1622
|
+
return `${scheme}://${url.hostname}${url.pathname}${url.search}`;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1532
1625
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1533
1626
|
import { useCallback as useCallback10, useEffect as useEffect11, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
1534
1627
|
function serializeError(error) {
|
|
@@ -1994,6 +2087,7 @@ function useCreateUserAgent({
|
|
|
1994
2087
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1995
2088
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1996
2089
|
return [
|
|
2090
|
+
"AppsInToss",
|
|
1997
2091
|
`TossApp/${appVersion}`,
|
|
1998
2092
|
batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
|
|
1999
2093
|
colorPreference && `TossColorPreference/${colorPreference}`,
|
|
@@ -2121,7 +2215,7 @@ var trackScreen = (url) => {
|
|
|
2121
2215
|
};
|
|
2122
2216
|
|
|
2123
2217
|
// src/components/WebView.tsx
|
|
2124
|
-
import { jsx as
|
|
2218
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2125
2219
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
2126
2220
|
var TYPES = ["partner", "external", "game"];
|
|
2127
2221
|
var WEBVIEW_TYPES = {
|
|
@@ -2169,7 +2263,6 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2169
2263
|
);
|
|
2170
2264
|
const handler = useBridgeHandler({
|
|
2171
2265
|
onMessage,
|
|
2172
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2173
2266
|
eventListenerMap: {
|
|
2174
2267
|
...appsInTossEventBridges,
|
|
2175
2268
|
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
|
|
@@ -2281,7 +2374,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2281
2374
|
return () => BackHandler2.removeEventListener("hardwareBackPress", callback);
|
|
2282
2375
|
}, [webBackHandler]);
|
|
2283
2376
|
const globalScripts = useGlobalScripts();
|
|
2284
|
-
return /* @__PURE__ */
|
|
2377
|
+
return /* @__PURE__ */ jsx18(
|
|
2285
2378
|
BaseWebView,
|
|
2286
2379
|
{
|
|
2287
2380
|
ref: refs,
|
|
@@ -2311,7 +2404,22 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2311
2404
|
injectedJavaScript: globalScripts.afterLoad,
|
|
2312
2405
|
injectedJavaScriptBeforeContentLoaded: mergeScripts(handler.injectedJavaScript, globalScripts.beforeLoad),
|
|
2313
2406
|
decelerationRate: Platform6.OS === "ios" ? 1 : void 0,
|
|
2314
|
-
allowsBackForwardNavigationGestures
|
|
2407
|
+
allowsBackForwardNavigationGestures,
|
|
2408
|
+
onShouldStartLoadWithRequest: (event) => {
|
|
2409
|
+
try {
|
|
2410
|
+
const url = new URL(event.url);
|
|
2411
|
+
if (["https:", "http:"].includes(url.protocol)) {
|
|
2412
|
+
return true;
|
|
2413
|
+
} else {
|
|
2414
|
+
Linking.openURL(convertIntentURL(url) ?? url.href);
|
|
2415
|
+
return false;
|
|
2416
|
+
}
|
|
2417
|
+
} catch (error) {
|
|
2418
|
+
console.error(error);
|
|
2419
|
+
return false;
|
|
2420
|
+
}
|
|
2421
|
+
},
|
|
2422
|
+
originWhitelist: ["https://*", "http://*", "intoss://*", "intoss-private://*", "servicetoss://*", "supertoss://*", "intent://*"]
|
|
2315
2423
|
}
|
|
2316
2424
|
);
|
|
2317
2425
|
}
|