@apps-in-toss/framework 0.0.0-dev.1753241576118 → 0.0.0-dev.1754906858438
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 +183 -92
- package/dist/index.d.cts +110 -1
- package/dist/index.d.ts +110 -1
- package/dist/index.js +150 -58
- package/package.json +7 -7
- package/src/event-bridges.ts +1 -0
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: {
|
|
@@ -854,6 +912,29 @@ var Storage = {
|
|
|
854
912
|
clearItems
|
|
855
913
|
};
|
|
856
914
|
|
|
915
|
+
// src/native-modules/contactsViral.ts
|
|
916
|
+
function contactsViral(params) {
|
|
917
|
+
const isSupported = isMinVersionSupported({
|
|
918
|
+
android: "5.223.0",
|
|
919
|
+
ios: "5.223.0"
|
|
920
|
+
});
|
|
921
|
+
if (!isSupported) {
|
|
922
|
+
return () => {
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
const { onEvent, onError, options } = params;
|
|
926
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
|
|
927
|
+
onRewardFromContactsViral: (result) => {
|
|
928
|
+
onEvent({ type: "sendViral", data: result });
|
|
929
|
+
},
|
|
930
|
+
onSuccess: (result) => {
|
|
931
|
+
onEvent({ type: "close", data: result });
|
|
932
|
+
},
|
|
933
|
+
onError
|
|
934
|
+
});
|
|
935
|
+
return unregisterCallbacks;
|
|
936
|
+
}
|
|
937
|
+
|
|
857
938
|
// src/native-modules/index.ts
|
|
858
939
|
var TossPay = {
|
|
859
940
|
checkoutPayment
|
|
@@ -868,12 +949,14 @@ var GoogleAdMob = {
|
|
|
868
949
|
// src/components/WebView.tsx
|
|
869
950
|
import {
|
|
870
951
|
ExternalWebViewScreen,
|
|
871
|
-
PartnerWebViewScreen
|
|
952
|
+
PartnerWebViewScreen,
|
|
953
|
+
tdsEvent,
|
|
954
|
+
usePartnerNavigation
|
|
872
955
|
} from "@toss-design-system/react-native";
|
|
873
956
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
874
|
-
import { useCallback as
|
|
957
|
+
import { useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
875
958
|
import { Platform as Platform7 } from "react-native";
|
|
876
|
-
import { getSchemeUri as
|
|
959
|
+
import { getSchemeUri as getSchemeUri5, useBedrockEvent } from "react-native-bedrock";
|
|
877
960
|
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
878
961
|
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
879
962
|
|
|
@@ -883,19 +966,19 @@ import {
|
|
|
883
966
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
884
967
|
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
885
968
|
import { josa as josa2 } from "es-hangul";
|
|
886
|
-
import { forwardRef, useCallback as
|
|
969
|
+
import { forwardRef, useCallback as useCallback3, useEffect as useEffect5, useState as useState2 } from "react";
|
|
887
970
|
import { BackHandler, Platform as Platform6 } from "react-native";
|
|
888
971
|
import { closeView as closeView2, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
889
972
|
|
|
890
973
|
// src/components/GameProfile.tsx
|
|
891
974
|
import { Loader } from "@toss-design-system/react-native";
|
|
892
|
-
import { useEffect as
|
|
975
|
+
import { useEffect as useEffect4 } from "react";
|
|
893
976
|
import { Pressable, View } from "react-native";
|
|
894
977
|
|
|
895
978
|
// src/hooks/useGameCenterProfile.ts
|
|
896
979
|
import { useDialog } from "@toss-design-system/react-native";
|
|
897
980
|
import { josa } from "es-hangul";
|
|
898
|
-
import { useCallback, useRef, useState } from "react";
|
|
981
|
+
import { useCallback as useCallback2, useRef as useRef2, useState } from "react";
|
|
899
982
|
import { closeView, openURL as openURL3 } from "react-native-bedrock";
|
|
900
983
|
|
|
901
984
|
// src/components/GameProfileToast.tsx
|
|
@@ -999,17 +1082,17 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
999
1082
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1000
1083
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1001
1084
|
const [isWebviewLoading, setIsWebviewLoading] = useState(false);
|
|
1002
|
-
const isCompletedProfileFlow =
|
|
1085
|
+
const isCompletedProfileFlow = useRef2(false);
|
|
1003
1086
|
const { openAlert, openConfirm } = useDialog();
|
|
1004
1087
|
const { openGameProfileToast } = useGameProfileToast();
|
|
1005
|
-
const openErrorAlert =
|
|
1088
|
+
const openErrorAlert = useCallback2(async () => {
|
|
1006
1089
|
await openAlert({
|
|
1007
1090
|
title: DEFAULT_ERROR.title,
|
|
1008
1091
|
description: DEFAULT_ERROR.description
|
|
1009
1092
|
});
|
|
1010
1093
|
closeView();
|
|
1011
1094
|
}, [openAlert]);
|
|
1012
|
-
const openProfileWebview =
|
|
1095
|
+
const openProfileWebview = useCallback2(() => {
|
|
1013
1096
|
if (isWebviewLoading) {
|
|
1014
1097
|
return;
|
|
1015
1098
|
}
|
|
@@ -1038,7 +1121,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1038
1121
|
}
|
|
1039
1122
|
});
|
|
1040
1123
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1041
|
-
const updateAppToSupportedMinVersion =
|
|
1124
|
+
const updateAppToSupportedMinVersion = useCallback2(async () => {
|
|
1042
1125
|
const upddateConfirmDialogLabel = {
|
|
1043
1126
|
title: `${josa(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1044
1127
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
@@ -1101,7 +1184,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1101
1184
|
openErrorAlert,
|
|
1102
1185
|
openGameProfileToast
|
|
1103
1186
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1104
|
-
|
|
1187
|
+
useEffect4(() => {
|
|
1105
1188
|
try {
|
|
1106
1189
|
const getProfileData = async () => {
|
|
1107
1190
|
const data = await getGameCenterGameProfile();
|
|
@@ -1114,7 +1197,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1114
1197
|
setIsProfileDataLoading(false);
|
|
1115
1198
|
}
|
|
1116
1199
|
}, []);
|
|
1117
|
-
|
|
1200
|
+
useEffect4(() => {
|
|
1118
1201
|
const handleGameProfileFlow = async () => {
|
|
1119
1202
|
if (!canShowBottomSheetOrToast) {
|
|
1120
1203
|
return;
|
|
@@ -1305,8 +1388,9 @@ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-run
|
|
|
1305
1388
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1306
1389
|
const { openConfirm } = useDialog2();
|
|
1307
1390
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1391
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1308
1392
|
const [isEntryMessageExited, setIsEntryMessageExited] = useState2(false);
|
|
1309
|
-
const handleClose =
|
|
1393
|
+
const handleClose = useCallback3(async () => {
|
|
1310
1394
|
const isConfirmed = await openConfirm({
|
|
1311
1395
|
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1312
1396
|
leftButton: "\uCDE8\uC18C",
|
|
@@ -1314,10 +1398,11 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1314
1398
|
closeOnDimmerClick: true
|
|
1315
1399
|
});
|
|
1316
1400
|
if (isConfirmed) {
|
|
1401
|
+
captureExitLog(Date.now());
|
|
1317
1402
|
closeView2();
|
|
1318
1403
|
}
|
|
1319
|
-
}, [brandDisplayName, openConfirm]);
|
|
1320
|
-
|
|
1404
|
+
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1405
|
+
useEffect5(() => {
|
|
1321
1406
|
if (Platform6.OS === "ios") {
|
|
1322
1407
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
1323
1408
|
return () => {
|
|
@@ -1326,7 +1411,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1326
1411
|
}
|
|
1327
1412
|
return;
|
|
1328
1413
|
}, []);
|
|
1329
|
-
|
|
1414
|
+
useEffect5(() => {
|
|
1330
1415
|
const backHandler = () => {
|
|
1331
1416
|
handleClose();
|
|
1332
1417
|
return true;
|
|
@@ -1336,7 +1421,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1336
1421
|
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1337
1422
|
};
|
|
1338
1423
|
}, [handleClose]);
|
|
1339
|
-
|
|
1424
|
+
useEffect5(() => {
|
|
1340
1425
|
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1341
1426
|
onEvent: () => {
|
|
1342
1427
|
setIsEntryMessageExited(true);
|
|
@@ -1350,7 +1435,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1350
1435
|
});
|
|
1351
1436
|
|
|
1352
1437
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1353
|
-
import { useCallback as
|
|
1438
|
+
import { useCallback as useCallback4, useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
1354
1439
|
function serializeError(error) {
|
|
1355
1440
|
return JSON.stringify(error, (_, value) => {
|
|
1356
1441
|
if (value instanceof Error) {
|
|
@@ -1399,7 +1484,7 @@ function useBridgeHandler({
|
|
|
1399
1484
|
eventListenerMap,
|
|
1400
1485
|
injectedJavaScript: originalInjectedJavaScript
|
|
1401
1486
|
}) {
|
|
1402
|
-
const ref =
|
|
1487
|
+
const ref = useRef3(null);
|
|
1403
1488
|
const injectedJavaScript = useMemo2(
|
|
1404
1489
|
() => [
|
|
1405
1490
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
@@ -1426,7 +1511,7 @@ function useBridgeHandler({
|
|
|
1426
1511
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1427
1512
|
`);
|
|
1428
1513
|
};
|
|
1429
|
-
const $onMessage =
|
|
1514
|
+
const $onMessage = useCallback4(
|
|
1430
1515
|
async (e) => {
|
|
1431
1516
|
onMessage?.(e);
|
|
1432
1517
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1487,6 +1572,7 @@ __export(constant_bridges_exports, {
|
|
|
1487
1572
|
// src/event-bridges.ts
|
|
1488
1573
|
var event_bridges_exports = {};
|
|
1489
1574
|
__export(event_bridges_exports, {
|
|
1575
|
+
contactsViral: () => contactsViral,
|
|
1490
1576
|
startUpdateLocation: () => startUpdateLocation
|
|
1491
1577
|
});
|
|
1492
1578
|
|
|
@@ -1647,12 +1733,12 @@ function useCreateUserAgent({
|
|
|
1647
1733
|
}
|
|
1648
1734
|
|
|
1649
1735
|
// src/hooks/useGeolocation.ts
|
|
1650
|
-
import { useState as useState3, useEffect as
|
|
1651
|
-
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";
|
|
1652
1738
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1653
|
-
const isVisible =
|
|
1739
|
+
const isVisible = useVisibility3();
|
|
1654
1740
|
const [location, setLocation] = useState3(null);
|
|
1655
|
-
|
|
1741
|
+
useEffect6(() => {
|
|
1656
1742
|
if (!isVisible) {
|
|
1657
1743
|
return;
|
|
1658
1744
|
}
|
|
@@ -1670,7 +1756,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1670
1756
|
}
|
|
1671
1757
|
|
|
1672
1758
|
// src/utils/log.ts
|
|
1673
|
-
import { getSchemeUri as
|
|
1759
|
+
import { getSchemeUri as getSchemeUri4 } from "react-native-bedrock";
|
|
1674
1760
|
|
|
1675
1761
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1676
1762
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1696,7 +1782,7 @@ var getGroupId = (url) => {
|
|
|
1696
1782
|
};
|
|
1697
1783
|
var getReferrer = () => {
|
|
1698
1784
|
try {
|
|
1699
|
-
const referrer = new URL(
|
|
1785
|
+
const referrer = new URL(getSchemeUri4());
|
|
1700
1786
|
return referrer.searchParams.get("referrer");
|
|
1701
1787
|
} catch {
|
|
1702
1788
|
return "";
|
|
@@ -1729,7 +1815,7 @@ var WEBVIEW_TYPES = {
|
|
|
1729
1815
|
};
|
|
1730
1816
|
function mergeSchemeQueryParamsInto(url) {
|
|
1731
1817
|
const baseUrl = new URL(url);
|
|
1732
|
-
const schemeUrl = new URL(
|
|
1818
|
+
const schemeUrl = new URL(getSchemeUri5());
|
|
1733
1819
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1734
1820
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1735
1821
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1758,11 +1844,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1758
1844
|
const top = useSafeAreaTop2();
|
|
1759
1845
|
const bottom = useSafeAreaBottom();
|
|
1760
1846
|
const global2 = getAppsInTossGlobals();
|
|
1847
|
+
const partner = usePartnerNavigation();
|
|
1761
1848
|
const handler = useBridgeHandler({
|
|
1762
1849
|
onMessage,
|
|
1763
1850
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1764
1851
|
eventListenerMap: {
|
|
1765
1852
|
...event_bridges_exports,
|
|
1853
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", {
|
|
1854
|
+
onEvent,
|
|
1855
|
+
onError
|
|
1856
|
+
}),
|
|
1766
1857
|
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1767
1858
|
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1768
1859
|
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
@@ -1791,6 +1882,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1791
1882
|
asyncHandlerMap: {
|
|
1792
1883
|
...bedrockAsyncBridges,
|
|
1793
1884
|
...async_bridges_exports,
|
|
1885
|
+
addAccessoryButton: async (params) => partner.addAccessoryButton(params),
|
|
1886
|
+
removeAccessoryButton: async () => partner.removeAccessoryButton(),
|
|
1794
1887
|
/** internal */
|
|
1795
1888
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
1796
1889
|
/** Storage */
|
|
@@ -1810,9 +1903,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1810
1903
|
header: {
|
|
1811
1904
|
..."header" in props ? props.header : {},
|
|
1812
1905
|
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
1813
|
-
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
1814
|
-
rightButtons: void 0
|
|
1815
|
-
// TODO: onClick 이벤트를 받아야 하기에 런타임에서 설정 받아야 함
|
|
1906
|
+
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
1816
1907
|
}
|
|
1817
1908
|
};
|
|
1818
1909
|
return headerOnlyProp;
|
|
@@ -1834,7 +1925,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1834
1925
|
}, [type, props]);
|
|
1835
1926
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1836
1927
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1837
|
-
const handleNavigationStateChange =
|
|
1928
|
+
const handleNavigationStateChange = useCallback5((event) => {
|
|
1838
1929
|
if (event.url) {
|
|
1839
1930
|
trackScreen(event.url);
|
|
1840
1931
|
}
|
|
@@ -1905,6 +1996,7 @@ export {
|
|
|
1905
1996
|
WebView,
|
|
1906
1997
|
appLogin,
|
|
1907
1998
|
appsInTossEvent,
|
|
1999
|
+
contactsViral,
|
|
1908
2000
|
env,
|
|
1909
2001
|
eventLog,
|
|
1910
2002
|
fetchAlbumPhotos,
|
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.0-dev.
|
|
4
|
+
"version": "0.0.0-dev.1754906858438",
|
|
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.0-dev.
|
|
61
|
-
"@apps-in-toss/cli": "0.0.0-dev.
|
|
62
|
-
"@apps-in-toss/plugins": "0.0.0-dev.
|
|
60
|
+
"@apps-in-toss/analytics": "0.0.0-dev.1754906858438",
|
|
61
|
+
"@apps-in-toss/cli": "0.0.0-dev.1754906858438",
|
|
62
|
+
"@apps-in-toss/plugins": "0.0.0-dev.1754906858438",
|
|
63
63
|
"es-hangul": "^2.3.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@react-native-bedrock/native": "0.0.25",
|
|
68
68
|
"@react-native-bedrock/plugin-core": "0.0.25",
|
|
69
69
|
"@react-native-bedrock/utils": "0.0.25",
|
|
70
|
-
"@toss-design-system/react-native": "
|
|
70
|
+
"@toss-design-system/react-native": "0.7.2",
|
|
71
71
|
"@types/kill-port": "^2.0.1",
|
|
72
72
|
"@types/react": "18.3.3",
|
|
73
73
|
"es-toolkit": "^1.34.1",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@react-native-bedrock/native": ">= 0.0.18",
|
|
88
|
-
"@toss-design-system/react-native": ">= 0.
|
|
88
|
+
"@toss-design-system/react-native": ">= 0.7.0",
|
|
89
89
|
"@types/react": "*",
|
|
90
90
|
"react": "*",
|
|
91
91
|
"react-native": "*",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"access": "public"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "ab42632482e7b40fcb50088014b30643f0ad32e3"
|
|
98
98
|
}
|
package/src/event-bridges.ts
CHANGED