@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/index.cjs CHANGED
@@ -71,17 +71,34 @@ var import_analytics2 = require("@apps-in-toss/analytics");
71
71
  // src/core/registerApp.tsx
72
72
  var import_analytics = require("@apps-in-toss/analytics");
73
73
  var import_react_native6 = require("@toss-design-system/react-native");
74
- var import_react_native_bedrock9 = require("react-native-bedrock");
74
+ var import_react_native_bedrock11 = require("react-native-bedrock");
75
75
 
76
76
  // src/core/components/AppEvent.tsx
77
- var import_react2 = require("react");
78
- var import_react_native_bedrock2 = require("react-native-bedrock");
77
+ var import_react3 = require("react");
78
+ var import_react_native_bedrock4 = require("react-native-bedrock");
79
79
 
80
80
  // src/env.ts
81
81
  var env = {
82
82
  getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
83
83
  };
84
84
 
85
+ // src/hooks/useCaptureExitLog.ts
86
+ var import_react2 = require("react");
87
+ var import_react_native_bedrock3 = require("react-native-bedrock");
88
+
89
+ // src/core/hooks/useReferrer.ts
90
+ var import_react = require("react");
91
+ var import_react_native_bedrock = require("react-native-bedrock");
92
+ function useReferrer() {
93
+ return (0, import_react.useMemo)(() => {
94
+ try {
95
+ return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
96
+ } catch {
97
+ return null;
98
+ }
99
+ }, []);
100
+ }
101
+
85
102
  // src/native-modules/tossCore.ts
86
103
  var import_react_native3 = require("react-native");
87
104
 
@@ -203,21 +220,8 @@ function tossCoreEventLog(params) {
203
220
  });
204
221
  }
205
222
 
206
- // src/core/hooks/useReferrer.ts
207
- var import_react = require("react");
208
- var import_react_native_bedrock = require("react-native-bedrock");
209
- function useReferrer() {
210
- return (0, import_react.useMemo)(() => {
211
- try {
212
- return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
213
- } catch {
214
- return null;
215
- }
216
- }, []);
217
- }
218
-
219
- // src/core/components/AppEvent.tsx
220
- var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
223
+ // src/utils/isPrivateScheme.ts
224
+ var import_react_native_bedrock2 = require("react-native-bedrock");
221
225
  function isPrivateScheme() {
222
226
  try {
223
227
  return new URL((0, import_react_native_bedrock2.getSchemeUri)()).protocol === "intoss-private:";
@@ -225,9 +229,51 @@ function isPrivateScheme() {
225
229
  return false;
226
230
  }
227
231
  }
232
+
233
+ // src/hooks/useCaptureExitLog.ts
234
+ var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__stay_time";
235
+ var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
236
+ function useCaptureExitLog() {
237
+ const referrer = useReferrer();
238
+ const visible = (0, import_react_native_bedrock3.useVisibility)();
239
+ const enterTime = (0, import_react2.useRef)(void 0);
240
+ (0, import_react2.useEffect)(() => {
241
+ if (visible === true) {
242
+ enterTime.current = Date.now();
243
+ }
244
+ }, [visible]);
245
+ const captureExitLog = (0, import_react2.useCallback)(
246
+ (exitTime) => {
247
+ if (enterTime.current == null) {
248
+ return;
249
+ }
250
+ const stayTime = Math.floor(exitTime - enterTime.current);
251
+ tossCoreEventLog({
252
+ log_name: EXIT_IMPRESSION_LOG_NAME,
253
+ log_type: "event",
254
+ params: {
255
+ schema_id: EXIT_IMPRESSION_SCHEMA_ID,
256
+ event_type: "impression",
257
+ referrer,
258
+ deployment_id: env.getDeploymentId(),
259
+ app_name: import_react_native_bedrock3.Bedrock.appName,
260
+ is_private: isPrivateScheme(),
261
+ stay_time: stayTime.toString(),
262
+ exit_time: exitTime.toString()
263
+ }
264
+ });
265
+ enterTime.current = void 0;
266
+ },
267
+ [referrer]
268
+ );
269
+ return { captureExitLog };
270
+ }
271
+
272
+ // src/core/components/AppEvent.tsx
273
+ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
228
274
  function EntryAppEvent() {
229
275
  const referrer = useReferrer() ?? "";
230
- (0, import_react2.useEffect)(() => {
276
+ (0, import_react3.useEffect)(() => {
231
277
  tossCoreEventLog({
232
278
  log_name: "appsintoss_app_visit::impression__enter_appsintoss",
233
279
  log_type: "info",
@@ -236,7 +282,7 @@ function EntryAppEvent() {
236
282
  schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
237
283
  referrer,
238
284
  deployment_id: env.getDeploymentId(),
239
- app_name: import_react_native_bedrock2.Bedrock.appName,
285
+ app_name: import_react_native_bedrock4.Bedrock.appName,
240
286
  is_private: isPrivateScheme()
241
287
  }
242
288
  });
@@ -244,36 +290,47 @@ function EntryAppEvent() {
244
290
  return null;
245
291
  }
246
292
  function SystemAppEvent({ ...initialProps }) {
247
- (0, import_react2.useEffect)(() => {
293
+ (0, import_react3.useEffect)(() => {
248
294
  tossCoreEventLog({
249
295
  log_name: "AppsInTossInitialProps",
250
296
  log_type: "debug",
251
297
  params: {
252
298
  ...initialProps,
253
- schemeUri: (0, import_react_native_bedrock2.getSchemeUri)(),
299
+ schemeUri: (0, import_react_native_bedrock4.getSchemeUri)(),
254
300
  deployment_id: env.getDeploymentId(),
255
- app_name: import_react_native_bedrock2.Bedrock.appName,
301
+ app_name: import_react_native_bedrock4.Bedrock.appName,
256
302
  is_private: isPrivateScheme()
257
303
  }
258
304
  });
259
305
  }, [initialProps]);
260
306
  return null;
261
307
  }
308
+ function StayTimeAppEvent() {
309
+ const visible = (0, import_react_native_bedrock4.useVisibility)();
310
+ const { captureExitLog } = useCaptureExitLog();
311
+ (0, import_react3.useEffect)(() => {
312
+ if (visible === false) {
313
+ captureExitLog(Date.now());
314
+ }
315
+ }, [visible, captureExitLog]);
316
+ return null;
317
+ }
262
318
  var AppEvent = {
263
319
  Entry: EntryAppEvent,
264
- System: SystemAppEvent
320
+ System: SystemAppEvent,
321
+ StayTime: StayTimeAppEvent
265
322
  };
266
323
 
267
324
  // src/core/hooks/useAppsInTossBridge.ts
268
325
  var import_react_native5 = require("@toss-design-system/react-native");
269
- var import_react3 = require("react");
326
+ var import_react4 = require("react");
270
327
 
271
328
  // src/native-event-emitter/appsInTossEvent.ts
272
- var import_react_native_bedrock7 = require("react-native-bedrock");
329
+ var import_react_native_bedrock9 = require("react-native-bedrock");
273
330
 
274
331
  // src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
275
- var import_react_native_bedrock3 = require("react-native-bedrock");
276
- var EntryMessageExitedEvent = class extends import_react_native_bedrock3.BedrockEventDefinition {
332
+ var import_react_native_bedrock5 = require("react-native-bedrock");
333
+ var EntryMessageExitedEvent = class extends import_react_native_bedrock5.BedrockEventDefinition {
277
334
  name = "entryMessageExited";
278
335
  remove() {
279
336
  }
@@ -283,7 +340,7 @@ var EntryMessageExitedEvent = class extends import_react_native_bedrock3.Bedrock
283
340
  };
284
341
 
285
342
  // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
286
- var import_react_native_bedrock4 = require("react-native-bedrock");
343
+ var import_react_native_bedrock6 = require("react-native-bedrock");
287
344
 
288
345
  // src/native-modules/getPermission.ts
289
346
  function getPermission(permission) {
@@ -312,7 +369,7 @@ var import_react_native4 = require("react-native");
312
369
  var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
313
370
 
314
371
  // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
315
- var UpdateLocationEvent = class extends import_react_native_bedrock4.BedrockEventDefinition {
372
+ var UpdateLocationEvent = class extends import_react_native_bedrock6.BedrockEventDefinition {
316
373
  name = "updateLocationEvent";
317
374
  subscriptionCount = 0;
318
375
  ref = {
@@ -342,7 +399,7 @@ var UpdateLocationEvent = class extends import_react_native_bedrock4.BedrockEven
342
399
  };
343
400
 
344
401
  // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
345
- var import_react_native_bedrock5 = require("react-native-bedrock");
402
+ var import_react_native_bedrock7 = require("react-native-bedrock");
346
403
 
347
404
  // src/utils/generateUUID.ts
348
405
  function generateUUID(placeholder) {
@@ -399,7 +456,7 @@ var INTERNAL__appBridgeHandler = {
399
456
 
400
457
  // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
401
458
  var UNSAFE__nativeEventEmitter = nativeEventEmitter;
402
- var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native_bedrock5.BedrockEventDefinition {
459
+ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native_bedrock7.BedrockEventDefinition {
403
460
  static INTERNAL__appBridgeSubscription;
404
461
  name = "appBridgeCallbackEvent";
405
462
  constructor() {
@@ -429,8 +486,8 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_
429
486
  };
430
487
 
431
488
  // src/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
432
- var import_react_native_bedrock6 = require("react-native-bedrock");
433
- var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native_bedrock6.BedrockEventDefinition {
489
+ var import_react_native_bedrock8 = require("react-native-bedrock");
490
+ var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native_bedrock8.BedrockEventDefinition {
434
491
  name = "onVisibilityChangedByTransparentServiceWeb";
435
492
  subscription = null;
436
493
  remove() {
@@ -455,7 +512,7 @@ var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_n
455
512
  };
456
513
 
457
514
  // src/native-event-emitter/appsInTossEvent.ts
458
- var appsInTossEvent = new import_react_native_bedrock7.BedrockEvent([
515
+ var appsInTossEvent = new import_react_native_bedrock9.BedrockEvent([
459
516
  new UpdateLocationEvent(),
460
517
  new EntryMessageExitedEvent(),
461
518
  // Internal events
@@ -480,7 +537,7 @@ function toIcon(source) {
480
537
  function useAppsInTossBridge() {
481
538
  const controller = (0, import_react_native5.useBridge)();
482
539
  const appsInTossGlobals2 = getAppsInTossGlobals();
483
- (0, import_react3.useEffect)(() => {
540
+ (0, import_react4.useEffect)(() => {
484
541
  const commonProps = {
485
542
  serviceName: appsInTossGlobals2.brandDisplayName,
486
543
  icon: toIcon(appsInTossGlobals2.brandIcon),
@@ -682,7 +739,7 @@ async function getGameCenterGameProfile() {
682
739
  }
683
740
 
684
741
  // src/native-modules/openGameCenterLeaderboard.ts
685
- var import_react_native_bedrock8 = require("react-native-bedrock");
742
+ var import_react_native_bedrock10 = require("react-native-bedrock");
686
743
  async function openGameCenterLeaderboard() {
687
744
  if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
688
745
  return;
@@ -690,7 +747,7 @@ async function openGameCenterLeaderboard() {
690
747
  const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
691
748
  url.searchParams.set("appName", getAppName());
692
749
  url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
693
- return (0, import_react_native_bedrock8.openURL)(url.toString());
750
+ return (0, import_react_native_bedrock10.openURL)(url.toString());
694
751
  }
695
752
 
696
753
  // src/native-modules/submitGameCenterLeaderBoardScore.ts
@@ -706,6 +763,7 @@ async function submitGameCenterLeaderBoardScore(params) {
706
763
  var import_jsx_runtime = require("react/jsx-runtime");
707
764
  function AppsInTossContainer(Container, { children, ...initialProps }) {
708
765
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
766
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.StayTime, {}),
709
767
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.Entry, {}),
710
768
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.System, { ...initialProps }),
711
769
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native6.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TDSContainer, { ...initialProps, children }) }) })
@@ -720,7 +778,7 @@ function registerApp(container, { context, analytics }) {
720
778
  logger: (params) => void eventLog(params),
721
779
  debug: analytics?.debug ?? __DEV__
722
780
  });
723
- return import_react_native_bedrock9.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
781
+ return import_react_native_bedrock11.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
724
782
  appName: getAppName(),
725
783
  context,
726
784
  router: {
@@ -952,9 +1010,9 @@ var GoogleAdMob = {
952
1010
  // src/components/WebView.tsx
953
1011
  var import_react_native20 = require("@toss-design-system/react-native");
954
1012
  var import_private3 = require("@toss-design-system/react-native/private");
955
- var import_react9 = require("react");
1013
+ var import_react10 = require("react");
956
1014
  var import_react_native21 = require("react-native");
957
- var import_react_native_bedrock16 = require("react-native-bedrock");
1015
+ var import_react_native_bedrock18 = require("react-native-bedrock");
958
1016
  var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
959
1017
  var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
960
1018
 
@@ -962,20 +1020,20 @@ var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-brid
962
1020
  var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
963
1021
  var import_react_native17 = require("@toss-design-system/react-native");
964
1022
  var import_es_hangul2 = require("es-hangul");
965
- var import_react6 = require("react");
1023
+ var import_react7 = require("react");
966
1024
  var import_react_native18 = require("react-native");
967
- var import_react_native_bedrock12 = require("react-native-bedrock");
1025
+ var import_react_native_bedrock14 = require("react-native-bedrock");
968
1026
 
969
1027
  // src/components/GameProfile.tsx
970
1028
  var import_react_native10 = require("@toss-design-system/react-native");
971
- var import_react5 = require("react");
1029
+ var import_react6 = require("react");
972
1030
  var import_react_native11 = require("react-native");
973
1031
 
974
1032
  // src/hooks/useGameCenterProfile.ts
975
1033
  var import_react_native9 = require("@toss-design-system/react-native");
976
1034
  var import_es_hangul = require("es-hangul");
977
- var import_react4 = require("react");
978
- var import_react_native_bedrock11 = require("react-native-bedrock");
1035
+ var import_react5 = require("react");
1036
+ var import_react_native_bedrock13 = require("react-native-bedrock");
979
1037
 
980
1038
  // src/components/GameProfileToast.tsx
981
1039
  var import_react_native7 = require("@toss-design-system/react-native");
@@ -1028,7 +1086,7 @@ var getMarketLink = () => {
1028
1086
  };
1029
1087
 
1030
1088
  // src/utils/openTransparentWebView.ts
1031
- var import_react_native_bedrock10 = require("react-native-bedrock");
1089
+ var import_react_native_bedrock12 = require("react-native-bedrock");
1032
1090
 
1033
1091
  // src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
1034
1092
  function onVisibilityChangedByTransparentServiceWeb(eventParams) {
@@ -1066,29 +1124,29 @@ var openTransparentWebView = ({
1066
1124
  }
1067
1125
  }
1068
1126
  });
1069
- (0, import_react_native_bedrock10.openURL)(url.toString());
1127
+ (0, import_react_native_bedrock12.openURL)(url.toString());
1070
1128
  };
1071
1129
 
1072
1130
  // src/hooks/useGameCenterProfile.ts
1073
1131
  var useGameCenterProfile = (isReadyForProfileUI) => {
1074
- const [profileData, setProfileData] = (0, import_react4.useState)(void 0);
1075
- const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react4.useState)(true);
1076
- const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react4.useState)(false);
1132
+ const [profileData, setProfileData] = (0, import_react5.useState)(void 0);
1133
+ const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react5.useState)(true);
1134
+ const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react5.useState)(false);
1077
1135
  const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
1078
1136
  const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
1079
1137
  const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
1080
- const [isWebviewLoading, setIsWebviewLoading] = (0, import_react4.useState)(false);
1081
- const isCompletedProfileFlow = (0, import_react4.useRef)(false);
1138
+ const [isWebviewLoading, setIsWebviewLoading] = (0, import_react5.useState)(false);
1139
+ const isCompletedProfileFlow = (0, import_react5.useRef)(false);
1082
1140
  const { openAlert, openConfirm } = (0, import_react_native9.useDialog)();
1083
1141
  const { openGameProfileToast } = useGameProfileToast();
1084
- const openErrorAlert = (0, import_react4.useCallback)(async () => {
1142
+ const openErrorAlert = (0, import_react5.useCallback)(async () => {
1085
1143
  await openAlert({
1086
1144
  title: DEFAULT_ERROR.title,
1087
1145
  description: DEFAULT_ERROR.description
1088
1146
  });
1089
- (0, import_react_native_bedrock11.closeView)();
1147
+ (0, import_react_native_bedrock13.closeView)();
1090
1148
  }, [openAlert]);
1091
- const openProfileWebview = (0, import_react4.useCallback)(() => {
1149
+ const openProfileWebview = (0, import_react5.useCallback)(() => {
1092
1150
  if (isWebviewLoading) {
1093
1151
  return;
1094
1152
  }
@@ -1117,7 +1175,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
1117
1175
  }
1118
1176
  });
1119
1177
  }, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
1120
- const updateAppToSupportedMinVersion = (0, import_react4.useCallback)(async () => {
1178
+ const updateAppToSupportedMinVersion = (0, import_react5.useCallback)(async () => {
1121
1179
  const upddateConfirmDialogLabel = {
1122
1180
  title: `${(0, import_es_hangul.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
1123
1181
  \uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
@@ -1131,11 +1189,11 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
1131
1189
  closeOnDimmerClick: true
1132
1190
  });
1133
1191
  if (!isConfirmed) {
1134
- (0, import_react_native_bedrock11.closeView)();
1192
+ (0, import_react_native_bedrock13.closeView)();
1135
1193
  return;
1136
1194
  }
1137
1195
  const STORE_SCHEME = getMarketLink();
1138
- (0, import_react_native_bedrock11.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
1196
+ (0, import_react_native_bedrock13.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
1139
1197
  }, [openConfirm]);
1140
1198
  return {
1141
1199
  profileData,
@@ -1180,7 +1238,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1180
1238
  openErrorAlert,
1181
1239
  openGameProfileToast
1182
1240
  } = useGameCenterProfile(isReadyForProfileUI);
1183
- (0, import_react5.useEffect)(() => {
1241
+ (0, import_react6.useEffect)(() => {
1184
1242
  try {
1185
1243
  const getProfileData = async () => {
1186
1244
  const data = await getGameCenterGameProfile();
@@ -1193,7 +1251,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1193
1251
  setIsProfileDataLoading(false);
1194
1252
  }
1195
1253
  }, []);
1196
- (0, import_react5.useEffect)(() => {
1254
+ (0, import_react6.useEffect)(() => {
1197
1255
  const handleGameProfileFlow = async () => {
1198
1256
  if (!canShowBottomSheetOrToast) {
1199
1257
  return;
@@ -1381,11 +1439,12 @@ function GameNavigationBar({ onClose }) {
1381
1439
 
1382
1440
  // src/components/GameWebView.tsx
1383
1441
  var import_jsx_runtime6 = require("react/jsx-runtime");
1384
- var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref) {
1442
+ var GameWebView = (0, import_react7.forwardRef)(function GameWebView2(props, ref) {
1385
1443
  const { openConfirm } = (0, import_react_native17.useDialog)();
1386
1444
  const { brandDisplayName } = getAppsInTossGlobals();
1387
- const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react6.useState)(false);
1388
- const handleClose = (0, import_react6.useCallback)(async () => {
1445
+ const { captureExitLog } = useCaptureExitLog();
1446
+ const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react7.useState)(false);
1447
+ const handleClose = (0, import_react7.useCallback)(async () => {
1389
1448
  const isConfirmed = await openConfirm({
1390
1449
  title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1391
1450
  leftButton: "\uCDE8\uC18C",
@@ -1393,19 +1452,20 @@ var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref
1393
1452
  closeOnDimmerClick: true
1394
1453
  });
1395
1454
  if (isConfirmed) {
1396
- (0, import_react_native_bedrock12.closeView)();
1455
+ captureExitLog(Date.now());
1456
+ (0, import_react_native_bedrock14.closeView)();
1397
1457
  }
1398
- }, [brandDisplayName, openConfirm]);
1399
- (0, import_react6.useEffect)(() => {
1458
+ }, [brandDisplayName, captureExitLog, openConfirm]);
1459
+ (0, import_react7.useEffect)(() => {
1400
1460
  if (import_react_native18.Platform.OS === "ios") {
1401
- (0, import_react_native_bedrock12.setIosSwipeGestureEnabled)({ isEnabled: false });
1461
+ (0, import_react_native_bedrock14.setIosSwipeGestureEnabled)({ isEnabled: false });
1402
1462
  return () => {
1403
- (0, import_react_native_bedrock12.setIosSwipeGestureEnabled)({ isEnabled: true });
1463
+ (0, import_react_native_bedrock14.setIosSwipeGestureEnabled)({ isEnabled: true });
1404
1464
  };
1405
1465
  }
1406
1466
  return;
1407
1467
  }, []);
1408
- (0, import_react6.useEffect)(() => {
1468
+ (0, import_react7.useEffect)(() => {
1409
1469
  const backHandler = () => {
1410
1470
  handleClose();
1411
1471
  return true;
@@ -1415,7 +1475,7 @@ var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref
1415
1475
  import_react_native18.BackHandler.removeEventListener("hardwareBackPress", backHandler);
1416
1476
  };
1417
1477
  }, [handleClose]);
1418
- (0, import_react6.useEffect)(() => {
1478
+ (0, import_react7.useEffect)(() => {
1419
1479
  appsInTossEvent.addEventListener("entryMessageExited", {
1420
1480
  onEvent: () => {
1421
1481
  setIsEntryMessageExited(true);
@@ -1429,7 +1489,7 @@ var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref
1429
1489
  });
1430
1490
 
1431
1491
  // src/bridge-handler/useBridgeHandler.tsx
1432
- var import_react7 = require("react");
1492
+ var import_react8 = require("react");
1433
1493
  function serializeError(error) {
1434
1494
  return JSON.stringify(error, (_, value) => {
1435
1495
  if (value instanceof Error) {
@@ -1478,8 +1538,8 @@ function useBridgeHandler({
1478
1538
  eventListenerMap,
1479
1539
  injectedJavaScript: originalInjectedJavaScript
1480
1540
  }) {
1481
- const ref = (0, import_react7.useRef)(null);
1482
- const injectedJavaScript = (0, import_react7.useMemo)(
1541
+ const ref = (0, import_react8.useRef)(null);
1542
+ const injectedJavaScript = (0, import_react8.useMemo)(
1483
1543
  () => [
1484
1544
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
1485
1545
  Object.entries(constantHandlerMap).reduce(
@@ -1489,7 +1549,7 @@ function useBridgeHandler({
1489
1549
  },
1490
1550
  {}
1491
1551
  )
1492
- )}`,
1552
+ )};`,
1493
1553
  originalInjectedJavaScript,
1494
1554
  "true"
1495
1555
  ].join("\n"),
@@ -1505,7 +1565,7 @@ function useBridgeHandler({
1505
1565
  window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1506
1566
  `);
1507
1567
  };
1508
- const $onMessage = (0, import_react7.useCallback)(
1568
+ const $onMessage = (0, import_react8.useCallback)(
1509
1569
  async (e) => {
1510
1570
  onMessage?.(e);
1511
1571
  const data = JSON.parse(e.nativeEvent.data);
@@ -1572,7 +1632,7 @@ __export(event_bridges_exports, {
1572
1632
 
1573
1633
  // src/hooks/useCreateUserAgent.ts
1574
1634
  var import_react_native19 = require("react-native");
1575
- var import_react_native_bedrock13 = require("react-native-bedrock");
1635
+ var import_react_native_bedrock15 = require("react-native-bedrock");
1576
1636
  var FontA11yCategory = {
1577
1637
  Large: "Large",
1578
1638
  xLarge: "xLarge",
@@ -1705,7 +1765,7 @@ function useCreateUserAgent({
1705
1765
  safeArea,
1706
1766
  safeAreaBottomTransparency
1707
1767
  }) {
1708
- const platform = (0, import_react_native_bedrock13.getPlatformOS)();
1768
+ const platform = (0, import_react_native_bedrock15.getPlatformOS)();
1709
1769
  const appVersion = getTossAppVersion();
1710
1770
  const { fontScale } = (0, import_react_native19.useWindowDimensions)();
1711
1771
  const platformString = platform === "ios" ? "iPhone" : "Android";
@@ -1727,12 +1787,12 @@ function useCreateUserAgent({
1727
1787
  }
1728
1788
 
1729
1789
  // src/hooks/useGeolocation.ts
1730
- var import_react8 = require("react");
1731
- var import_react_native_bedrock14 = require("react-native-bedrock");
1790
+ var import_react9 = require("react");
1791
+ var import_react_native_bedrock16 = require("react-native-bedrock");
1732
1792
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1733
- const isVisible = (0, import_react_native_bedrock14.useVisibility)();
1734
- const [location, setLocation] = (0, import_react8.useState)(null);
1735
- (0, import_react8.useEffect)(() => {
1793
+ const isVisible = (0, import_react_native_bedrock16.useVisibility)();
1794
+ const [location, setLocation] = (0, import_react9.useState)(null);
1795
+ (0, import_react9.useEffect)(() => {
1736
1796
  if (!isVisible) {
1737
1797
  return;
1738
1798
  }
@@ -1750,7 +1810,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1750
1810
  }
1751
1811
 
1752
1812
  // src/utils/log.ts
1753
- var import_react_native_bedrock15 = require("react-native-bedrock");
1813
+ var import_react_native_bedrock17 = require("react-native-bedrock");
1754
1814
 
1755
1815
  // src/utils/extractDateFromUUIDv7.ts
1756
1816
  var extractDateFromUUIDv7 = (uuid) => {
@@ -1776,7 +1836,7 @@ var getGroupId = (url) => {
1776
1836
  };
1777
1837
  var getReferrer = () => {
1778
1838
  try {
1779
- const referrer = new URL((0, import_react_native_bedrock15.getSchemeUri)());
1839
+ const referrer = new URL((0, import_react_native_bedrock17.getSchemeUri)());
1780
1840
  return referrer.searchParams.get("referrer");
1781
1841
  } catch {
1782
1842
  return "";
@@ -1809,7 +1869,7 @@ var WEBVIEW_TYPES = {
1809
1869
  };
1810
1870
  function mergeSchemeQueryParamsInto(url) {
1811
1871
  const baseUrl = new URL(url);
1812
- const schemeUrl = new URL((0, import_react_native_bedrock16.getSchemeUri)());
1872
+ const schemeUrl = new URL((0, import_react_native_bedrock18.getSchemeUri)());
1813
1873
  baseUrl.pathname = schemeUrl.pathname;
1814
1874
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1815
1875
  baseUrl.searchParams.set(key, value);
@@ -1833,14 +1893,22 @@ function WebView({ type, local, onMessage, ...props }) {
1833
1893
  if (!TYPES.includes(type)) {
1834
1894
  throw new Error(`Invalid WebView type: '${type}'`);
1835
1895
  }
1836
- const bedrockEvent = (0, import_react_native_bedrock16.useBedrockEvent)();
1837
- const uri = (0, import_react9.useMemo)(() => getWebViewUri(local), [local]);
1896
+ const bedrockEvent = (0, import_react_native_bedrock18.useBedrockEvent)();
1897
+ const uri = (0, import_react10.useMemo)(() => getWebViewUri(local), [local]);
1838
1898
  const top = (0, import_private3.useSafeAreaTop)();
1839
1899
  const bottom = (0, import_private3.useSafeAreaBottom)();
1840
1900
  const global2 = getAppsInTossGlobals();
1841
1901
  const partner = (0, import_react_native20.usePartnerNavigation)();
1902
+ const disableTextSelectionCSS = `
1903
+ (function() {
1904
+ const style = document.createElement('style');
1905
+ 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; }';
1906
+ document.head.appendChild(style);
1907
+ })();
1908
+ `;
1842
1909
  const handler = useBridgeHandler({
1843
1910
  onMessage,
1911
+ injectedJavaScript: [disableTextSelectionCSS].join("\n"),
1844
1912
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1845
1913
  eventListenerMap: {
1846
1914
  ...event_bridges_exports,
@@ -1890,7 +1958,7 @@ function WebView({ type, local, onMessage, ...props }) {
1890
1958
  iapGetProductItemList: IAP.getProductItemList
1891
1959
  }
1892
1960
  });
1893
- const baseProps = (0, import_react9.useMemo)(() => {
1961
+ const baseProps = (0, import_react10.useMemo)(() => {
1894
1962
  switch (type) {
1895
1963
  case "partner": {
1896
1964
  const headerOnlyProp = {
@@ -1919,14 +1987,31 @@ function WebView({ type, local, onMessage, ...props }) {
1919
1987
  }, [type, props]);
1920
1988
  const BaseWebView = WEBVIEW_TYPES[type];
1921
1989
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1922
- const handleNavigationStateChange = (0, import_react9.useCallback)((event) => {
1923
- if (event.url) {
1924
- trackScreen(event.url);
1925
- }
1926
- }, []);
1990
+ const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react10.useState)(false);
1991
+ const handleNavigationStateChange = (0, import_react10.useCallback)(
1992
+ (event) => {
1993
+ if (event.url) {
1994
+ trackScreen(event.url);
1995
+ }
1996
+ setCanHistoryGoBack(event.canGoBack);
1997
+ },
1998
+ [setCanHistoryGoBack]
1999
+ );
1927
2000
  const userAgent = useCreateUserAgent({
1928
2001
  colorPreference: "light"
1929
2002
  });
2003
+ const backEvent = (0, import_react_native_bedrock18.useBackEvent)();
2004
+ const handleBackEvent = (0, import_react10.useCallback)(() => {
2005
+ if (canHistoryGoBack) {
2006
+ handler.ref.current?.goBack();
2007
+ } else {
2008
+ (0, import_react_native_bedrock18.closeView)();
2009
+ }
2010
+ }, [canHistoryGoBack, handler]);
2011
+ (0, import_react10.useEffect)(() => {
2012
+ backEvent.addEventListener(handleBackEvent);
2013
+ return () => backEvent.removeEventListener(handleBackEvent);
2014
+ }, [backEvent, handleBackEvent]);
1930
2015
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1931
2016
  BaseWebView,
1932
2017
  {