@apps-in-toss/framework 0.0.35 → 0.0.37
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.d.ts +1 -0
- package/dist/bridge-meta.js +183 -0
- package/dist/index.cjs +179 -94
- package/dist/index.js +144 -59
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -10,17 +10,34 @@ import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
|
10
10
|
// src/core/registerApp.tsx
|
|
11
11
|
import { Analytics } from "@apps-in-toss/analytics";
|
|
12
12
|
import { TDSProvider } from "@toss-design-system/react-native";
|
|
13
|
-
import { Bedrock as
|
|
13
|
+
import { Bedrock as Bedrock3 } from "react-native-bedrock";
|
|
14
14
|
|
|
15
15
|
// src/core/components/AppEvent.tsx
|
|
16
|
-
import { useEffect } from "react";
|
|
17
|
-
import { Bedrock, getSchemeUri as
|
|
16
|
+
import { useEffect as useEffect2 } from "react";
|
|
17
|
+
import { Bedrock as Bedrock2, getSchemeUri as getSchemeUri3, useVisibility as useVisibility2 } from "react-native-bedrock";
|
|
18
18
|
|
|
19
19
|
// src/env.ts
|
|
20
20
|
var env = {
|
|
21
21
|
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
// src/hooks/useCaptureExitLog.ts
|
|
25
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
26
|
+
import { Bedrock, useVisibility } from "react-native-bedrock";
|
|
27
|
+
|
|
28
|
+
// src/core/hooks/useReferrer.ts
|
|
29
|
+
import { useMemo } from "react";
|
|
30
|
+
import { getSchemeUri } from "react-native-bedrock";
|
|
31
|
+
function useReferrer() {
|
|
32
|
+
return useMemo(() => {
|
|
33
|
+
try {
|
|
34
|
+
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
}
|
|
40
|
+
|
|
24
41
|
// src/native-modules/tossCore.ts
|
|
25
42
|
import { NativeModules as NativeModules2 } from "react-native";
|
|
26
43
|
|
|
@@ -142,21 +159,8 @@ function tossCoreEventLog(params) {
|
|
|
142
159
|
});
|
|
143
160
|
}
|
|
144
161
|
|
|
145
|
-
// src/
|
|
146
|
-
import {
|
|
147
|
-
import { getSchemeUri } from "react-native-bedrock";
|
|
148
|
-
function useReferrer() {
|
|
149
|
-
return useMemo(() => {
|
|
150
|
-
try {
|
|
151
|
-
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
152
|
-
} catch {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
}, []);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// src/core/components/AppEvent.tsx
|
|
159
|
-
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
162
|
+
// src/utils/isPrivateScheme.ts
|
|
163
|
+
import { getSchemeUri as getSchemeUri2 } from "react-native-bedrock";
|
|
160
164
|
function isPrivateScheme() {
|
|
161
165
|
try {
|
|
162
166
|
return new URL(getSchemeUri2()).protocol === "intoss-private:";
|
|
@@ -164,9 +168,51 @@ function isPrivateScheme() {
|
|
|
164
168
|
return false;
|
|
165
169
|
}
|
|
166
170
|
}
|
|
171
|
+
|
|
172
|
+
// src/hooks/useCaptureExitLog.ts
|
|
173
|
+
var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__stay_time";
|
|
174
|
+
var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
|
|
175
|
+
function useCaptureExitLog() {
|
|
176
|
+
const referrer = useReferrer();
|
|
177
|
+
const visible = useVisibility();
|
|
178
|
+
const enterTime = useRef(void 0);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
if (visible === true) {
|
|
181
|
+
enterTime.current = Date.now();
|
|
182
|
+
}
|
|
183
|
+
}, [visible]);
|
|
184
|
+
const captureExitLog = useCallback(
|
|
185
|
+
(exitTime) => {
|
|
186
|
+
if (enterTime.current == null) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
190
|
+
tossCoreEventLog({
|
|
191
|
+
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
192
|
+
log_type: "event",
|
|
193
|
+
params: {
|
|
194
|
+
schema_id: EXIT_IMPRESSION_SCHEMA_ID,
|
|
195
|
+
event_type: "impression",
|
|
196
|
+
referrer,
|
|
197
|
+
deployment_id: env.getDeploymentId(),
|
|
198
|
+
app_name: Bedrock.appName,
|
|
199
|
+
is_private: isPrivateScheme(),
|
|
200
|
+
stay_time: stayTime.toString(),
|
|
201
|
+
exit_time: exitTime.toString()
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
enterTime.current = void 0;
|
|
205
|
+
},
|
|
206
|
+
[referrer]
|
|
207
|
+
);
|
|
208
|
+
return { captureExitLog };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/core/components/AppEvent.tsx
|
|
212
|
+
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
167
213
|
function EntryAppEvent() {
|
|
168
214
|
const referrer = useReferrer() ?? "";
|
|
169
|
-
|
|
215
|
+
useEffect2(() => {
|
|
170
216
|
tossCoreEventLog({
|
|
171
217
|
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
172
218
|
log_type: "info",
|
|
@@ -175,7 +221,7 @@ function EntryAppEvent() {
|
|
|
175
221
|
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
176
222
|
referrer,
|
|
177
223
|
deployment_id: env.getDeploymentId(),
|
|
178
|
-
app_name:
|
|
224
|
+
app_name: Bedrock2.appName,
|
|
179
225
|
is_private: isPrivateScheme()
|
|
180
226
|
}
|
|
181
227
|
});
|
|
@@ -183,29 +229,40 @@ function EntryAppEvent() {
|
|
|
183
229
|
return null;
|
|
184
230
|
}
|
|
185
231
|
function SystemAppEvent({ ...initialProps }) {
|
|
186
|
-
|
|
232
|
+
useEffect2(() => {
|
|
187
233
|
tossCoreEventLog({
|
|
188
234
|
log_name: "AppsInTossInitialProps",
|
|
189
235
|
log_type: "debug",
|
|
190
236
|
params: {
|
|
191
237
|
...initialProps,
|
|
192
|
-
schemeUri:
|
|
238
|
+
schemeUri: getSchemeUri3(),
|
|
193
239
|
deployment_id: env.getDeploymentId(),
|
|
194
|
-
app_name:
|
|
240
|
+
app_name: Bedrock2.appName,
|
|
195
241
|
is_private: isPrivateScheme()
|
|
196
242
|
}
|
|
197
243
|
});
|
|
198
244
|
}, [initialProps]);
|
|
199
245
|
return null;
|
|
200
246
|
}
|
|
247
|
+
function StayTimeAppEvent() {
|
|
248
|
+
const visible = useVisibility2();
|
|
249
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
250
|
+
useEffect2(() => {
|
|
251
|
+
if (visible === false) {
|
|
252
|
+
captureExitLog(Date.now());
|
|
253
|
+
}
|
|
254
|
+
}, [visible, captureExitLog]);
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
201
257
|
var AppEvent = {
|
|
202
258
|
Entry: EntryAppEvent,
|
|
203
|
-
System: SystemAppEvent
|
|
259
|
+
System: SystemAppEvent,
|
|
260
|
+
StayTime: StayTimeAppEvent
|
|
204
261
|
};
|
|
205
262
|
|
|
206
263
|
// src/core/hooks/useAppsInTossBridge.ts
|
|
207
264
|
import { useBridge } from "@toss-design-system/react-native";
|
|
208
|
-
import { useEffect as
|
|
265
|
+
import { useEffect as useEffect3 } from "react";
|
|
209
266
|
|
|
210
267
|
// src/native-event-emitter/appsInTossEvent.ts
|
|
211
268
|
import { BedrockEvent } from "react-native-bedrock";
|
|
@@ -419,7 +476,7 @@ function toIcon(source) {
|
|
|
419
476
|
function useAppsInTossBridge() {
|
|
420
477
|
const controller = useBridge();
|
|
421
478
|
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
422
|
-
|
|
479
|
+
useEffect3(() => {
|
|
423
480
|
const commonProps = {
|
|
424
481
|
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
425
482
|
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
@@ -645,6 +702,7 @@ async function submitGameCenterLeaderBoardScore(params) {
|
|
|
645
702
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
646
703
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
647
704
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
705
|
+
/* @__PURE__ */ jsx(AppEvent.StayTime, {}),
|
|
648
706
|
/* @__PURE__ */ jsx(AppEvent.Entry, {}),
|
|
649
707
|
/* @__PURE__ */ jsx(AppEvent.System, { ...initialProps }),
|
|
650
708
|
/* @__PURE__ */ jsx(Container, { ...initialProps, children: /* @__PURE__ */ jsx(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx(TDSContainer, { ...initialProps, children }) }) })
|
|
@@ -659,7 +717,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
659
717
|
logger: (params) => void eventLog(params),
|
|
660
718
|
debug: analytics?.debug ?? __DEV__
|
|
661
719
|
});
|
|
662
|
-
return
|
|
720
|
+
return Bedrock3.registerApp(AppsInTossContainer.bind(null, container), {
|
|
663
721
|
appName: getAppName(),
|
|
664
722
|
context,
|
|
665
723
|
router: {
|
|
@@ -896,9 +954,9 @@ import {
|
|
|
896
954
|
usePartnerNavigation
|
|
897
955
|
} from "@toss-design-system/react-native";
|
|
898
956
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
899
|
-
import { useCallback as
|
|
957
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo3, useState as useState4 } from "react";
|
|
900
958
|
import { Platform as Platform7 } from "react-native";
|
|
901
|
-
import { getSchemeUri as
|
|
959
|
+
import { getSchemeUri as getSchemeUri5, useBackEvent, useBedrockEvent, closeView as closeView3 } from "react-native-bedrock";
|
|
902
960
|
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
903
961
|
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
904
962
|
|
|
@@ -908,19 +966,19 @@ import {
|
|
|
908
966
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
909
967
|
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
910
968
|
import { josa as josa2 } from "es-hangul";
|
|
911
|
-
import { forwardRef, useCallback as
|
|
969
|
+
import { forwardRef, useCallback as useCallback3, useEffect as useEffect5, useState as useState2 } from "react";
|
|
912
970
|
import { BackHandler, Platform as Platform6 } from "react-native";
|
|
913
971
|
import { closeView as closeView2, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
914
972
|
|
|
915
973
|
// src/components/GameProfile.tsx
|
|
916
974
|
import { Loader } from "@toss-design-system/react-native";
|
|
917
|
-
import { useEffect as
|
|
975
|
+
import { useEffect as useEffect4 } from "react";
|
|
918
976
|
import { Pressable, View } from "react-native";
|
|
919
977
|
|
|
920
978
|
// src/hooks/useGameCenterProfile.ts
|
|
921
979
|
import { useDialog } from "@toss-design-system/react-native";
|
|
922
980
|
import { josa } from "es-hangul";
|
|
923
|
-
import { useCallback, useRef, useState } from "react";
|
|
981
|
+
import { useCallback as useCallback2, useRef as useRef2, useState } from "react";
|
|
924
982
|
import { closeView, openURL as openURL3 } from "react-native-bedrock";
|
|
925
983
|
|
|
926
984
|
// src/components/GameProfileToast.tsx
|
|
@@ -1024,17 +1082,17 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1024
1082
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1025
1083
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1026
1084
|
const [isWebviewLoading, setIsWebviewLoading] = useState(false);
|
|
1027
|
-
const isCompletedProfileFlow =
|
|
1085
|
+
const isCompletedProfileFlow = useRef2(false);
|
|
1028
1086
|
const { openAlert, openConfirm } = useDialog();
|
|
1029
1087
|
const { openGameProfileToast } = useGameProfileToast();
|
|
1030
|
-
const openErrorAlert =
|
|
1088
|
+
const openErrorAlert = useCallback2(async () => {
|
|
1031
1089
|
await openAlert({
|
|
1032
1090
|
title: DEFAULT_ERROR.title,
|
|
1033
1091
|
description: DEFAULT_ERROR.description
|
|
1034
1092
|
});
|
|
1035
1093
|
closeView();
|
|
1036
1094
|
}, [openAlert]);
|
|
1037
|
-
const openProfileWebview =
|
|
1095
|
+
const openProfileWebview = useCallback2(() => {
|
|
1038
1096
|
if (isWebviewLoading) {
|
|
1039
1097
|
return;
|
|
1040
1098
|
}
|
|
@@ -1063,7 +1121,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1063
1121
|
}
|
|
1064
1122
|
});
|
|
1065
1123
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1066
|
-
const updateAppToSupportedMinVersion =
|
|
1124
|
+
const updateAppToSupportedMinVersion = useCallback2(async () => {
|
|
1067
1125
|
const upddateConfirmDialogLabel = {
|
|
1068
1126
|
title: `${josa(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1069
1127
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
@@ -1126,7 +1184,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1126
1184
|
openErrorAlert,
|
|
1127
1185
|
openGameProfileToast
|
|
1128
1186
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1129
|
-
|
|
1187
|
+
useEffect4(() => {
|
|
1130
1188
|
try {
|
|
1131
1189
|
const getProfileData = async () => {
|
|
1132
1190
|
const data = await getGameCenterGameProfile();
|
|
@@ -1139,7 +1197,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1139
1197
|
setIsProfileDataLoading(false);
|
|
1140
1198
|
}
|
|
1141
1199
|
}, []);
|
|
1142
|
-
|
|
1200
|
+
useEffect4(() => {
|
|
1143
1201
|
const handleGameProfileFlow = async () => {
|
|
1144
1202
|
if (!canShowBottomSheetOrToast) {
|
|
1145
1203
|
return;
|
|
@@ -1330,8 +1388,9 @@ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-run
|
|
|
1330
1388
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1331
1389
|
const { openConfirm } = useDialog2();
|
|
1332
1390
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1391
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1333
1392
|
const [isEntryMessageExited, setIsEntryMessageExited] = useState2(false);
|
|
1334
|
-
const handleClose =
|
|
1393
|
+
const handleClose = useCallback3(async () => {
|
|
1335
1394
|
const isConfirmed = await openConfirm({
|
|
1336
1395
|
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1337
1396
|
leftButton: "\uCDE8\uC18C",
|
|
@@ -1339,10 +1398,11 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1339
1398
|
closeOnDimmerClick: true
|
|
1340
1399
|
});
|
|
1341
1400
|
if (isConfirmed) {
|
|
1401
|
+
captureExitLog(Date.now());
|
|
1342
1402
|
closeView2();
|
|
1343
1403
|
}
|
|
1344
|
-
}, [brandDisplayName, openConfirm]);
|
|
1345
|
-
|
|
1404
|
+
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1405
|
+
useEffect5(() => {
|
|
1346
1406
|
if (Platform6.OS === "ios") {
|
|
1347
1407
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
1348
1408
|
return () => {
|
|
@@ -1351,7 +1411,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1351
1411
|
}
|
|
1352
1412
|
return;
|
|
1353
1413
|
}, []);
|
|
1354
|
-
|
|
1414
|
+
useEffect5(() => {
|
|
1355
1415
|
const backHandler = () => {
|
|
1356
1416
|
handleClose();
|
|
1357
1417
|
return true;
|
|
@@ -1361,7 +1421,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1361
1421
|
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1362
1422
|
};
|
|
1363
1423
|
}, [handleClose]);
|
|
1364
|
-
|
|
1424
|
+
useEffect5(() => {
|
|
1365
1425
|
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1366
1426
|
onEvent: () => {
|
|
1367
1427
|
setIsEntryMessageExited(true);
|
|
@@ -1375,7 +1435,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1375
1435
|
});
|
|
1376
1436
|
|
|
1377
1437
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1378
|
-
import { useCallback as
|
|
1438
|
+
import { useCallback as useCallback4, useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
1379
1439
|
function serializeError(error) {
|
|
1380
1440
|
return JSON.stringify(error, (_, value) => {
|
|
1381
1441
|
if (value instanceof Error) {
|
|
@@ -1424,7 +1484,7 @@ function useBridgeHandler({
|
|
|
1424
1484
|
eventListenerMap,
|
|
1425
1485
|
injectedJavaScript: originalInjectedJavaScript
|
|
1426
1486
|
}) {
|
|
1427
|
-
const ref =
|
|
1487
|
+
const ref = useRef3(null);
|
|
1428
1488
|
const injectedJavaScript = useMemo2(
|
|
1429
1489
|
() => [
|
|
1430
1490
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
@@ -1435,7 +1495,7 @@ function useBridgeHandler({
|
|
|
1435
1495
|
},
|
|
1436
1496
|
{}
|
|
1437
1497
|
)
|
|
1438
|
-
)}
|
|
1498
|
+
)};`,
|
|
1439
1499
|
originalInjectedJavaScript,
|
|
1440
1500
|
"true"
|
|
1441
1501
|
].join("\n"),
|
|
@@ -1451,7 +1511,7 @@ function useBridgeHandler({
|
|
|
1451
1511
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1452
1512
|
`);
|
|
1453
1513
|
};
|
|
1454
|
-
const $onMessage =
|
|
1514
|
+
const $onMessage = useCallback4(
|
|
1455
1515
|
async (e) => {
|
|
1456
1516
|
onMessage?.(e);
|
|
1457
1517
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1673,12 +1733,12 @@ function useCreateUserAgent({
|
|
|
1673
1733
|
}
|
|
1674
1734
|
|
|
1675
1735
|
// src/hooks/useGeolocation.ts
|
|
1676
|
-
import { useState as useState3, useEffect as
|
|
1677
|
-
import { useVisibility } from "react-native-bedrock";
|
|
1736
|
+
import { useState as useState3, useEffect as useEffect6 } from "react";
|
|
1737
|
+
import { useVisibility as useVisibility3 } from "react-native-bedrock";
|
|
1678
1738
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1679
|
-
const isVisible =
|
|
1739
|
+
const isVisible = useVisibility3();
|
|
1680
1740
|
const [location, setLocation] = useState3(null);
|
|
1681
|
-
|
|
1741
|
+
useEffect6(() => {
|
|
1682
1742
|
if (!isVisible) {
|
|
1683
1743
|
return;
|
|
1684
1744
|
}
|
|
@@ -1696,7 +1756,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1696
1756
|
}
|
|
1697
1757
|
|
|
1698
1758
|
// src/utils/log.ts
|
|
1699
|
-
import { getSchemeUri as
|
|
1759
|
+
import { getSchemeUri as getSchemeUri4 } from "react-native-bedrock";
|
|
1700
1760
|
|
|
1701
1761
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1702
1762
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1722,7 +1782,7 @@ var getGroupId = (url) => {
|
|
|
1722
1782
|
};
|
|
1723
1783
|
var getReferrer = () => {
|
|
1724
1784
|
try {
|
|
1725
|
-
const referrer = new URL(
|
|
1785
|
+
const referrer = new URL(getSchemeUri4());
|
|
1726
1786
|
return referrer.searchParams.get("referrer");
|
|
1727
1787
|
} catch {
|
|
1728
1788
|
return "";
|
|
@@ -1755,7 +1815,7 @@ var WEBVIEW_TYPES = {
|
|
|
1755
1815
|
};
|
|
1756
1816
|
function mergeSchemeQueryParamsInto(url) {
|
|
1757
1817
|
const baseUrl = new URL(url);
|
|
1758
|
-
const schemeUrl = new URL(
|
|
1818
|
+
const schemeUrl = new URL(getSchemeUri5());
|
|
1759
1819
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1760
1820
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1761
1821
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1785,8 +1845,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1785
1845
|
const bottom = useSafeAreaBottom();
|
|
1786
1846
|
const global2 = getAppsInTossGlobals();
|
|
1787
1847
|
const partner = usePartnerNavigation();
|
|
1848
|
+
const disableTextSelectionCSS = `
|
|
1849
|
+
(function() {
|
|
1850
|
+
const style = document.createElement('style');
|
|
1851
|
+
style.textContent = '*:not(input):not(textarea) { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; }';
|
|
1852
|
+
document.head.appendChild(style);
|
|
1853
|
+
})();
|
|
1854
|
+
`;
|
|
1788
1855
|
const handler = useBridgeHandler({
|
|
1789
1856
|
onMessage,
|
|
1857
|
+
injectedJavaScript: [disableTextSelectionCSS].join("\n"),
|
|
1790
1858
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1791
1859
|
eventListenerMap: {
|
|
1792
1860
|
...event_bridges_exports,
|
|
@@ -1865,14 +1933,31 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1865
1933
|
}, [type, props]);
|
|
1866
1934
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1867
1935
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1936
|
+
const [canHistoryGoBack, setCanHistoryGoBack] = useState4(false);
|
|
1937
|
+
const handleNavigationStateChange = useCallback5(
|
|
1938
|
+
(event) => {
|
|
1939
|
+
if (event.url) {
|
|
1940
|
+
trackScreen(event.url);
|
|
1941
|
+
}
|
|
1942
|
+
setCanHistoryGoBack(event.canGoBack);
|
|
1943
|
+
},
|
|
1944
|
+
[setCanHistoryGoBack]
|
|
1945
|
+
);
|
|
1873
1946
|
const userAgent = useCreateUserAgent({
|
|
1874
1947
|
colorPreference: "light"
|
|
1875
1948
|
});
|
|
1949
|
+
const backEvent = useBackEvent();
|
|
1950
|
+
const handleBackEvent = useCallback5(() => {
|
|
1951
|
+
if (canHistoryGoBack) {
|
|
1952
|
+
handler.ref.current?.goBack();
|
|
1953
|
+
} else {
|
|
1954
|
+
closeView3();
|
|
1955
|
+
}
|
|
1956
|
+
}, [canHistoryGoBack, handler]);
|
|
1957
|
+
useEffect7(() => {
|
|
1958
|
+
backEvent.addEventListener(handleBackEvent);
|
|
1959
|
+
return () => backEvent.removeEventListener(handleBackEvent);
|
|
1960
|
+
}, [backEvent, handleBackEvent]);
|
|
1876
1961
|
return /* @__PURE__ */ jsx7(
|
|
1877
1962
|
BaseWebView,
|
|
1878
1963
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/framework",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.37",
|
|
5
5
|
"description": "The framework for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"ait": "./bin/ait.js"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@apps-in-toss/analytics": "0.0.
|
|
61
|
-
"@apps-in-toss/cli": "0.0.
|
|
62
|
-
"@apps-in-toss/plugins": "0.0.
|
|
60
|
+
"@apps-in-toss/analytics": "0.0.37",
|
|
61
|
+
"@apps-in-toss/cli": "0.0.37",
|
|
62
|
+
"@apps-in-toss/plugins": "0.0.37",
|
|
63
63
|
"es-hangul": "^2.3.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"access": "public"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "009779504a353e1b39160e813bf80514cbf7278b"
|
|
98
98
|
}
|