@apps-in-toss/framework 1.1.1 → 1.1.3

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.
Files changed (3) hide show
  1. package/dist/index.cjs +563 -386
  2. package/dist/index.js +469 -287
  3. package/package.json +9 -9
package/dist/index.cjs CHANGED
@@ -38,14 +38,14 @@ __export(src_exports, {
38
38
  env: () => env,
39
39
  useCreateUserAgent: () => useCreateUserAgent,
40
40
  useGeolocation: () => useGeolocation,
41
- useTopNavigation: () => import_private6.useTopNavigation
41
+ useTopNavigation: () => import_private8.useTopNavigation
42
42
  });
43
43
  module.exports = __toCommonJS(src_exports);
44
44
  var import_analytics2 = require("@apps-in-toss/analytics");
45
45
 
46
46
  // src/core/registerApp.tsx
47
47
  var import_analytics = require("@apps-in-toss/analytics");
48
- var import_native_modules9 = require("@apps-in-toss/native-modules");
48
+ var import_native_modules8 = require("@apps-in-toss/native-modules");
49
49
  var import_react_native17 = require("@granite-js/react-native");
50
50
  var import_react_native18 = require("@toss-design-system/react-native");
51
51
  var import_react_native19 = require("react-native");
@@ -191,18 +191,58 @@ function AppUpdate() {
191
191
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
192
192
  }
193
193
 
194
- // src/core/components/BuiltinNavigationBar/index.tsx
195
- var import_native_modules7 = require("@apps-in-toss/native-modules");
196
- var import_react_native13 = require("@granite-js/react-native");
197
- var import_react_native14 = require("@toss-design-system/react-native");
194
+ // src/core/hooks/useAppsInTossBridge.ts
195
+ var import_native_modules3 = require("@apps-in-toss/native-modules");
196
+ var import_react_native6 = require("@toss-design-system/react-native");
197
+ var import_react5 = require("react");
198
+
199
+ // src/core/utils/getAppsInTossGlobals.ts
200
+ function getAppsInTossGlobals() {
201
+ if (global.__appsInToss == null) {
202
+ throw new Error("invalid apps-in-toss globals");
203
+ }
204
+ return global.__appsInToss;
205
+ }
206
+
207
+ // src/core/utils/toIcon.ts
208
+ function toIcon(source) {
209
+ return source.startsWith("http") ? { source: { uri: source } } : { name: source };
210
+ }
211
+
212
+ // src/core/hooks/useAppsInTossBridge.ts
213
+ function useAppsInTossBridge() {
214
+ const controller = (0, import_react_native6.useBridge)();
215
+ const appsInTossGlobals = getAppsInTossGlobals();
216
+ (0, import_react5.useEffect)(() => {
217
+ const commonProps = {
218
+ serviceName: appsInTossGlobals.brandDisplayName,
219
+ icon: toIcon(appsInTossGlobals.brandIcon),
220
+ color: appsInTossGlobals.brandPrimaryColor,
221
+ colorMode: appsInTossGlobals.brandBridgeColorMode
222
+ };
223
+ controller.open({
224
+ ...commonProps,
225
+ onExited: () => {
226
+ import_native_modules3.appsInTossEvent.emit("entryMessageExited", void 0);
227
+ }
228
+ });
229
+ }, []);
230
+ }
231
+
232
+ // src/components/NavigationBar/RNNavigationBar.tsx
233
+ var import_react_native14 = require("@granite-js/react-native");
234
+ var import_react_native15 = require("@toss-design-system/react-native");
198
235
  var import_private2 = require("@toss-design-system/react-native/private");
199
236
  var import_es_hangul = require("es-hangul");
200
- var import_react7 = require("react");
201
- var import_react_native15 = require("react-native");
237
+ var import_react9 = require("react");
238
+ var import_react_native16 = require("react-native");
202
239
 
203
- // src/core/components/BuiltinNavigationBar/useBuiltinNavigationBarLogging.tsx
204
- var import_native_modules3 = require("@apps-in-toss/native-modules");
205
- var import_react_native6 = require("@granite-js/react-native");
240
+ // src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
241
+ var import_react6 = require("react");
242
+
243
+ // src/components/NavigationBar/common/useNavigationBarLogging.tsx
244
+ var import_native_modules4 = require("@apps-in-toss/native-modules");
245
+ var import_react_native7 = require("@granite-js/react-native");
206
246
  var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
207
247
  var NAVI_BAR_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__navigation_bar";
208
248
  var CLOSE_POPUP_SHOW_SCHEMA_ID = 1644490;
@@ -213,14 +253,14 @@ var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
213
253
  var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
214
254
  var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
215
255
  var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
216
- function useBuiltinNavigationBarLogging() {
256
+ function useNavigationBarLogging() {
217
257
  const referrer = useReferrer();
218
258
  const baseParams = {
219
259
  referrer,
220
- app_name: import_react_native6.Granite.appName
260
+ app_name: import_react_native7.Granite.appName
221
261
  };
222
262
  const logNavBarImpression = (naviBarConfig) => {
223
- import_native_modules3.INTERNAL__module.tossCoreEventLog({
263
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
224
264
  log_name: NAVI_BAR_IMPRESSION_LOG_NAME,
225
265
  log_type: "event",
226
266
  params: {
@@ -232,7 +272,7 @@ function useBuiltinNavigationBarLogging() {
232
272
  });
233
273
  };
234
274
  const logHomeButtonClick = () => {
235
- import_native_modules3.INTERNAL__module.tossCoreEventLog({
275
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
236
276
  log_name: HOME_BUTTON_CLICK_LOG_NAME,
237
277
  log_type: "event",
238
278
  params: {
@@ -243,7 +283,7 @@ function useBuiltinNavigationBarLogging() {
243
283
  });
244
284
  };
245
285
  const logCloseButtonClick = () => {
246
- import_native_modules3.INTERNAL__module.tossCoreEventLog({
286
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
247
287
  log_name: CLOSE_BUTTON_CLICK_LOG_NAME,
248
288
  log_type: "event",
249
289
  params: {
@@ -254,7 +294,7 @@ function useBuiltinNavigationBarLogging() {
254
294
  });
255
295
  };
256
296
  const logClosePopupShow = () => {
257
- import_native_modules3.INTERNAL__module.tossCoreEventLog({
297
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
258
298
  log_name: CLOSE_POPUP_SHOW_LOG_NAME,
259
299
  log_type: "popup",
260
300
  params: {
@@ -264,7 +304,7 @@ function useBuiltinNavigationBarLogging() {
264
304
  });
265
305
  };
266
306
  const logClosePopupCtaClick = (confirm) => {
267
- import_native_modules3.INTERNAL__module.tossCoreEventLog({
307
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
268
308
  log_name: CLOSE_POPUP_CTA_CLICK_LOG_NAME,
269
309
  log_type: "event",
270
310
  params: {
@@ -284,16 +324,33 @@ function useBuiltinNavigationBarLogging() {
284
324
  };
285
325
  }
286
326
 
327
+ // src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
328
+ var import_jsx_runtime2 = require("react/jsx-runtime");
329
+ function NavigationBarImpressionArea({
330
+ children,
331
+ withHomeButton
332
+ }) {
333
+ const hasLogged = (0, import_react6.useRef)(false);
334
+ const logging = useNavigationBarLogging();
335
+ (0, import_react6.useEffect)(() => {
336
+ if (hasLogged.current === false) {
337
+ logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
338
+ hasLogged.current = true;
339
+ }
340
+ }, [logging, withHomeButton]);
341
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
342
+ }
343
+
287
344
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
288
- var import_native_modules6 = require("@apps-in-toss/native-modules");
289
- var import_react_native11 = require("@granite-js/react-native");
290
- var import_react_native12 = require("@toss-design-system/react-native");
345
+ var import_native_modules7 = require("@apps-in-toss/native-modules");
346
+ var import_react_native12 = require("@granite-js/react-native");
347
+ var import_react_native13 = require("@toss-design-system/react-native");
291
348
  var import_private = require("@toss-design-system/react-native/private");
292
- var import_react6 = require("react");
349
+ var import_react8 = require("react");
293
350
 
294
351
  // src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
295
- var import_native_modules4 = require("@apps-in-toss/native-modules");
296
- var import_react_native7 = require("@granite-js/react-native");
352
+ var import_native_modules5 = require("@apps-in-toss/native-modules");
353
+ var import_react_native8 = require("@granite-js/react-native");
297
354
  var BOTTOM_SHEET_SCHEMA_ID = 1596825;
298
355
  var BOTTOM_SHEET_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more";
299
356
  var BOTTOM_SHEET_OPEN_SCHEMA_ID = 1596829;
@@ -306,10 +363,10 @@ function useMoreButtonBottomSheetLogging() {
306
363
  const referrer = useReferrer();
307
364
  const baseParams = {
308
365
  referrer,
309
- app_name: import_react_native7.Granite.appName
366
+ app_name: import_react_native8.Granite.appName
310
367
  };
311
368
  const logBottomSheetShow = () => {
312
- import_native_modules4.INTERNAL__module.tossCoreEventLog({
369
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
313
370
  log_name: BOTTOM_SHEET_LOG_NAME,
314
371
  log_type: "popup",
315
372
  params: {
@@ -319,7 +376,7 @@ function useMoreButtonBottomSheetLogging() {
319
376
  });
320
377
  };
321
378
  const logBottomSheetOpen = () => {
322
- import_native_modules4.INTERNAL__module.tossCoreEventLog({
379
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
323
380
  log_name: BOTTOM_SHEET_OPEN_LOG_NAME,
324
381
  log_type: "event",
325
382
  params: {
@@ -330,7 +387,7 @@ function useMoreButtonBottomSheetLogging() {
330
387
  });
331
388
  };
332
389
  const logBottomSheetCloseClick = () => {
333
- import_native_modules4.INTERNAL__module.tossCoreEventLog({
390
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
334
391
  log_name: BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME,
335
392
  log_type: "event",
336
393
  params: {
@@ -341,7 +398,7 @@ function useMoreButtonBottomSheetLogging() {
341
398
  });
342
399
  };
343
400
  const logBottomSheetMenuClick = ({ title }) => {
344
- import_native_modules4.INTERNAL__module.tossCoreEventLog({
401
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
345
402
  log_name: BOTTOM_SHEET_MENU_CLICK_LOG_NAME,
346
403
  log_type: "event",
347
404
  params: {
@@ -361,24 +418,24 @@ function useMoreButtonBottomSheetLogging() {
361
418
  }
362
419
 
363
420
  // src/hooks/useAppUpdateDialog.tsx
364
- var import_native_modules5 = require("@apps-in-toss/native-modules");
365
- var import_react_native9 = require("@granite-js/react-native");
366
- var import_react_native10 = require("@toss-design-system/react-native");
367
- var import_react5 = require("react");
421
+ var import_native_modules6 = require("@apps-in-toss/native-modules");
422
+ var import_react_native10 = require("@granite-js/react-native");
423
+ var import_react_native11 = require("@toss-design-system/react-native");
424
+ var import_react7 = require("react");
368
425
 
369
426
  // src/utils/market.ts
370
- var import_react_native8 = require("react-native");
427
+ var import_react_native9 = require("react-native");
371
428
  var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
372
429
  var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
373
430
  var getMarketLink = () => {
374
- return import_react_native8.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
431
+ return import_react_native9.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
375
432
  };
376
433
 
377
434
  // src/hooks/useAppUpdateDialog.tsx
378
435
  function useAppUpdateDialog() {
379
- const { openConfirm } = (0, import_react_native10.useDialog)();
436
+ const { openConfirm } = (0, import_react_native11.useDialog)();
380
437
  const logging = useAppUpdateDialogLogging();
381
- const openAppUpdateDialog = (0, import_react5.useCallback)(
438
+ const openAppUpdateDialog = (0, import_react7.useCallback)(
382
439
  async ({
383
440
  title,
384
441
  description,
@@ -399,7 +456,7 @@ function useAppUpdateDialog() {
399
456
  }
400
457
  logging.update();
401
458
  const STORE_SCHEME = getMarketLink();
402
- (0, import_react_native9.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
459
+ (0, import_react_native10.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
403
460
  },
404
461
  [logging, openConfirm]
405
462
  );
@@ -415,10 +472,10 @@ function useAppUpdateDialogLogging() {
415
472
  const referrer = useReferrer();
416
473
  const baseParams = {
417
474
  referrer,
418
- app_name: import_react_native9.Granite.appName
475
+ app_name: import_react_native10.Granite.appName
419
476
  };
420
477
  const logUpdateClick = () => {
421
- import_native_modules5.INTERNAL__module.tossCoreEventLog({
478
+ import_native_modules6.INTERNAL__module.tossCoreEventLog({
422
479
  log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
423
480
  log_type: "event",
424
481
  params: {
@@ -430,7 +487,7 @@ function useAppUpdateDialogLogging() {
430
487
  });
431
488
  };
432
489
  const logCloseClick = () => {
433
- import_native_modules5.INTERNAL__module.tossCoreEventLog({
490
+ import_native_modules6.INTERNAL__module.tossCoreEventLog({
434
491
  log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
435
492
  log_type: "event",
436
493
  params: {
@@ -442,7 +499,7 @@ function useAppUpdateDialogLogging() {
442
499
  });
443
500
  };
444
501
  const logDialogShow = () => {
445
- import_native_modules5.INTERNAL__module.tossCoreEventLog({
502
+ import_native_modules6.INTERNAL__module.tossCoreEventLog({
446
503
  log_name: UPDATE_DIALOG_LOG_NAME,
447
504
  log_type: "popup",
448
505
  params: {
@@ -462,34 +519,26 @@ function ensureValue(value, name) {
462
519
  return value;
463
520
  }
464
521
 
465
- // src/core/utils/getAppsInTossGlobals.ts
466
- function getAppsInTossGlobals() {
467
- if (global.__appsInToss == null) {
468
- throw new Error("invalid apps-in-toss globals");
469
- }
470
- return global.__appsInToss;
471
- }
472
-
473
522
  // src/core/hooks/useMoreButtonBottomSheet/index.tsx
474
- var import_jsx_runtime2 = require("react/jsx-runtime");
523
+ var import_jsx_runtime3 = require("react/jsx-runtime");
475
524
  var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
476
525
  function useMoreButtonBottomSheet() {
477
526
  const globals = getAppsInTossGlobals();
478
527
  const adaptive = (0, import_private.useAdaptive)();
479
- const [itemList, setItemList] = (0, import_react6.useState)([]);
528
+ const [itemList, setItemList] = (0, import_react8.useState)([]);
480
529
  const appUpdateDialog = useAppUpdateDialog();
481
530
  const logging = useMoreButtonBottomSheetLogging();
482
531
  const overlay = (0, import_private.useOverlay)();
483
532
  const title = ensureValue(globals.brandDisplayName, "displayName");
484
- const isSupported = (0, import_native_modules6.isMinVersionSupported)({
533
+ const isSupported = (0, import_native_modules7.isMinVersionSupported)({
485
534
  android: "5.226.0",
486
535
  ios: "5.226.0"
487
536
  });
488
- (0, import_react6.useEffect)(() => {
537
+ (0, import_react8.useEffect)(() => {
489
538
  if (!isSupported) {
490
539
  return;
491
540
  }
492
- import_native_modules6.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
541
+ import_native_modules7.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
493
542
  APP_BRIDGE_METHOD_NAME,
494
543
  {},
495
544
  {
@@ -512,18 +561,18 @@ function useMoreButtonBottomSheet() {
512
561
  logging.close();
513
562
  close();
514
563
  };
515
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BottomSheetImpressionArea, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
516
- import_react_native12.BottomSheet.Root,
564
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BottomSheetImpressionArea, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
565
+ import_react_native13.BottomSheet.Root,
517
566
  {
518
- header: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
519
- import_react_native12.ListHeader,
567
+ header: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
568
+ import_react_native13.ListHeader,
520
569
  {
521
- title: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native12.ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
570
+ title: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native13.ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
522
571
  }
523
572
  ),
524
573
  open: isOpen,
525
- cta: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
526
- import_react_native12.BottomSheet.CTA,
574
+ cta: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
575
+ import_react_native13.BottomSheet.CTA,
527
576
  {
528
577
  size: "large",
529
578
  type: "dark",
@@ -536,20 +585,20 @@ function useMoreButtonBottomSheet() {
536
585
  ),
537
586
  onClose: handleClose,
538
587
  onExited: exit,
539
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native12.List, { rowSeparator: "none", children: itemList.map((item) => {
540
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
541
- import_react_native12.ListRow,
588
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native13.List, { rowSeparator: "none", children: itemList.map((item) => {
589
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
590
+ import_react_native13.ListRow,
542
591
  {
543
- left: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
544
- import_react_native12.ListRow.Icon,
592
+ left: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
593
+ import_react_native13.ListRow.Icon,
545
594
  {
546
595
  color: globals.brandPrimaryColor,
547
596
  source: { uri: item.contactIconUrl },
548
597
  type: "background"
549
598
  }
550
599
  ),
551
- contents: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
552
- import_react_native12.ListRow.Texts,
600
+ contents: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
601
+ import_react_native13.ListRow.Texts,
553
602
  {
554
603
  type: "1RowTypeA",
555
604
  top: item.contactItemName,
@@ -559,7 +608,7 @@ function useMoreButtonBottomSheet() {
559
608
  verticalPadding: "extraSmall",
560
609
  onPress: () => {
561
610
  logging.menuClick({ title: item.contactItemName });
562
- (0, import_react_native11.openURL)(item.contactUri);
611
+ (0, import_react_native12.openURL)(item.contactUri);
563
612
  }
564
613
  },
565
614
  item.contactItemName
@@ -573,10 +622,10 @@ function useMoreButtonBottomSheet() {
573
622
  }
574
623
  function BottomSheetImpressionArea({ children }) {
575
624
  const logging = useMoreButtonBottomSheetLogging();
576
- (0, import_react6.useEffect)(() => {
625
+ (0, import_react8.useEffect)(() => {
577
626
  logging.show();
578
627
  }, [logging]);
579
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
628
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
580
629
  }
581
630
 
582
631
  // src/core/utils/safeParseNavigationBar.ts
@@ -591,48 +640,26 @@ function safeParseNavigationBar(navigationBar) {
591
640
  }
592
641
  }
593
642
 
594
- // src/core/utils/toIcon.ts
595
- function toIcon(source) {
596
- return source.startsWith("http") ? { source: { uri: source } } : { name: source };
597
- }
598
-
599
- // src/core/components/BuiltinNavigationBar/index.tsx
600
- var import_jsx_runtime3 = require("react/jsx-runtime");
601
- function BuiltinNavigationBar() {
643
+ // src/components/NavigationBar/RNNavigationBar.tsx
644
+ var import_jsx_runtime4 = require("react/jsx-runtime");
645
+ function RNNavigationBar() {
602
646
  const globals = getAppsInTossGlobals();
603
647
  const { captureExitLog } = useCaptureExitLog();
604
- const logging = useBuiltinNavigationBarLogging();
605
- const { openConfirm } = (0, import_react_native14.useDialog)();
648
+ const logging = useNavigationBarLogging();
649
+ const { openConfirm } = (0, import_react_native15.useDialog)();
606
650
  const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
607
651
  const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
608
652
  const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
609
653
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
610
654
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
611
- const isExternalWebView = globals.webViewType === "external";
612
- const isGameWebView = globals.webViewType === "game";
613
- const backEventContext = (0, import_react_native13.useBackEventContext)();
655
+ const backEventContext = (0, import_react_native14.useBackEventContext)();
614
656
  const handleBackOrClose = useBackOrCloseNavigation();
615
- const navigation = (0, import_react_native13.useNavigation)();
616
- const handlePressTitle = (0, import_react7.useCallback)(() => {
657
+ const navigation = (0, import_react_native14.useNavigation)();
658
+ const handlePressTitle = (0, import_react9.useCallback)(() => {
617
659
  logging.homeButtonClick();
618
- if (globals.webViewType != null) {
619
- import_native_modules7.appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
620
- return;
621
- }
622
660
  navigation.navigate("/");
623
- }, [logging, globals.webViewType, navigation]);
624
- const handleBack = (0, import_react7.useCallback)(() => {
625
- if (globals.webViewType != null) {
626
- import_native_modules7.appsInTossEvent.emit("backButtonClickEvent", void 0);
627
- return;
628
- }
629
- if (backEventContext.hasBackEvent) {
630
- backEventContext.onBack();
631
- return;
632
- }
633
- handleBackOrClose();
634
- }, [globals.webViewType, backEventContext, handleBackOrClose]);
635
- const handleClose = (0, import_react7.useCallback)(async () => {
661
+ }, [logging, navigation]);
662
+ const handleClose = (0, import_react9.useCallback)(async () => {
636
663
  logging.closeButtonClick();
637
664
  const isConfirmed = await openConfirm({
638
665
  title: `${(0, import_es_hangul.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
@@ -644,29 +671,33 @@ function BuiltinNavigationBar() {
644
671
  logging.closePopupCtaClick(isConfirmed);
645
672
  if (isConfirmed) {
646
673
  captureExitLog(Date.now());
647
- (0, import_react_native13.closeView)();
674
+ (0, import_react_native14.closeView)();
648
675
  }
649
676
  }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
650
- const handleBackEvent = (0, import_react7.useCallback)(() => {
651
- handleBack();
652
- return true;
653
- }, [handleBack]);
654
- (0, import_react7.useEffect)(() => {
655
- import_react_native15.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
677
+ const handleBack = (0, import_react9.useCallback)(() => {
678
+ if (backEventContext.hasBackEvent) {
679
+ backEventContext.onBack();
680
+ return;
681
+ }
682
+ handleBackOrClose();
683
+ }, [backEventContext, handleBackOrClose]);
684
+ (0, import_react9.useEffect)(() => {
685
+ const handleAndroidBackEvent = () => {
686
+ handleBack();
687
+ return true;
688
+ };
689
+ import_react_native16.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
656
690
  return () => {
657
- import_react_native15.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
691
+ import_react_native16.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
658
692
  };
659
- }, [handleBackEvent]);
660
- if (isExternalWebView) {
661
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
662
- }
663
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
693
+ }, [handleBack]);
694
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
664
695
  import_private2.TopNavigation,
665
696
  {
666
697
  title: globals.brandDisplayName,
667
698
  icon: toIcon(globals.brandIcon),
668
699
  onPressDots: openMoreButtonBottomSheet,
669
- contentVisible: isGameWebView ? false : true,
700
+ contentVisible: true,
670
701
  onPressTitle: withHomeButton ? handlePressTitle : void 0,
671
702
  onPressClose: handleClose,
672
703
  withHome: withHomeButton,
@@ -675,96 +706,59 @@ function BuiltinNavigationBar() {
675
706
  icon: initialAccessoryButton.icon,
676
707
  id: initialAccessoryButton.id
677
708
  } : void 0,
678
- children: isGameWebView === false ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private2.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private2.NavigationBackButton, { onPress: handleBack, canGoBack: false }) }) : null
709
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_private2.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_private2.NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
679
710
  }
680
711
  ) });
681
712
  }
682
713
  function useBackOrCloseNavigation() {
683
- const navigation = (0, import_react_native13.useNavigation)();
714
+ const navigation = (0, import_react_native14.useNavigation)();
684
715
  const { captureExitLog } = useCaptureExitLog();
685
- return (0, import_react7.useCallback)(() => {
716
+ return (0, import_react9.useCallback)(() => {
686
717
  if (navigation.canGoBack()) {
687
718
  navigation.goBack();
688
719
  } else {
689
720
  captureExitLog(Date.now());
690
- (0, import_react_native13.closeView)();
721
+ (0, import_react_native14.closeView)();
691
722
  }
692
- }, [navigation]);
693
- }
694
- function BuiltinNavigationBarImpressionArea({
695
- children,
696
- withHomeButton
697
- }) {
698
- const hasLogged = (0, import_react7.useRef)(false);
699
- const logging = useBuiltinNavigationBarLogging();
700
- (0, import_react7.useEffect)(() => {
701
- if (hasLogged.current === false) {
702
- logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
703
- hasLogged.current = true;
704
- }
705
- }, []);
706
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
707
- }
708
-
709
- // src/core/hooks/useAppsInTossBridge.ts
710
- var import_native_modules8 = require("@apps-in-toss/native-modules");
711
- var import_react_native16 = require("@toss-design-system/react-native");
712
- var import_react8 = require("react");
713
- function useAppsInTossBridge() {
714
- const controller = (0, import_react_native16.useBridge)();
715
- const appsInTossGlobals = getAppsInTossGlobals();
716
- (0, import_react8.useEffect)(() => {
717
- const commonProps = {
718
- serviceName: appsInTossGlobals.brandDisplayName,
719
- icon: toIcon(appsInTossGlobals.brandIcon),
720
- color: appsInTossGlobals.brandPrimaryColor,
721
- colorMode: appsInTossGlobals.brandBridgeColorMode
722
- };
723
- controller.open({
724
- ...commonProps,
725
- onExited: () => {
726
- import_native_modules8.appsInTossEvent.emit("entryMessageExited", void 0);
727
- }
728
- });
729
- }, []);
723
+ }, [captureExitLog, navigation]);
730
724
  }
731
725
 
732
726
  // src/core/registerApp.tsx
733
- var import_jsx_runtime4 = require("react/jsx-runtime");
727
+ var import_jsx_runtime5 = require("react/jsx-runtime");
734
728
  function AppsInTossContainer(Container, { children, ...initialProps }) {
735
- if (!(0, import_native_modules9.isMinVersionSupported)({
729
+ if (!(0, import_native_modules8.isMinVersionSupported)({
736
730
  android: "5.220.0",
737
731
  ios: "5.221.0"
738
732
  })) {
739
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
740
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.Entry, {}),
741
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.System, { ...initialProps }),
742
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppUpdate, {})
733
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
734
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.Entry, {}),
735
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.System, { ...initialProps }),
736
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppUpdate, {})
743
737
  ] });
744
738
  }
745
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
746
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.StayTime, {}),
747
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.Entry, {}),
748
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.System, { ...initialProps }),
749
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native18.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TDSContainer, { ...initialProps, children }) }) })
739
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
740
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.StayTime, {}),
741
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.Entry, {}),
742
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.System, { ...initialProps }),
743
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native18.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TDSContainer, { ...initialProps, children }) }) })
750
744
  ] });
751
745
  }
752
746
  function TDSContainer({ children }) {
753
747
  useAppsInTossBridge();
754
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
748
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
755
749
  }
756
750
  function registerApp(container, { context, analytics }) {
757
751
  const appName = getAppName();
758
752
  const isRegistered = import_react_native19.AppRegistry.getAppKeys().includes(appName);
759
753
  if (!isRegistered) {
760
754
  import_analytics.Analytics.init({
761
- logger: (params) => void (0, import_native_modules9.eventLog)(params),
755
+ logger: (params) => void (0, import_native_modules8.eventLog)(params),
762
756
  debug: analytics?.debug ?? __DEV__
763
757
  });
764
758
  const App = import_react_native17.Granite.registerApp(AppsInTossContainer.bind(null, container), {
765
759
  appName,
766
760
  context,
767
- setIosSwipeGestureEnabled: import_native_modules9.setIosSwipeGestureEnabled,
761
+ setIosSwipeGestureEnabled: import_native_modules8.setIosSwipeGestureEnabled,
768
762
  router: {
769
763
  screenContainer: AppsInTossScreenContainer,
770
764
  defaultScreenOption: {
@@ -777,8 +771,9 @@ function registerApp(container, { context, analytics }) {
777
771
  return global.Page;
778
772
  }
779
773
  function AppsInTossScreenContainer({ children }) {
780
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_analytics.Analytics.Screen, { children: [
781
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BuiltinNavigationBar, {}),
774
+ const isReactNativeService = getAppsInTossGlobals().webViewType == null;
775
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_analytics.Analytics.Screen, { children: [
776
+ isReactNativeService && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RNNavigationBar, {}),
782
777
  children
783
778
  ] });
784
779
  }
@@ -801,51 +796,50 @@ var import_native_modules17 = require("@apps-in-toss/native-modules");
801
796
  var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
802
797
  var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
803
798
  var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
804
- var import_react_native30 = require("@granite-js/react-native");
799
+ var import_react_native36 = require("@granite-js/react-native");
805
800
  var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridges"), 1);
806
801
  var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
807
- var import_react_native31 = require("@toss-design-system/react-native");
808
- var import_private5 = require("@toss-design-system/react-native/private");
809
- var import_es_hangul3 = require("es-hangul");
810
- var import_react15 = require("react");
811
- var import_react_native32 = require("react-native");
802
+ var import_react_native37 = require("@toss-design-system/react-native");
803
+ var import_private7 = require("@toss-design-system/react-native/private");
804
+ var import_react19 = require("react");
805
+ var import_react_native38 = require("react-native");
812
806
 
813
807
  // src/components/GameWebView.tsx
814
- var import_native_modules13 = require("@apps-in-toss/native-modules");
808
+ var import_native_modules12 = require("@apps-in-toss/native-modules");
815
809
  var import_react_native_webview = require("@granite-js/native/react-native-webview");
816
- var import_react11 = require("react");
817
- var import_react_native26 = require("react-native");
810
+ var import_react13 = require("react");
811
+ var import_react_native29 = require("react-native");
818
812
 
819
813
  // src/components/GameProfile.tsx
820
- var import_native_modules12 = require("@apps-in-toss/native-modules");
814
+ var import_native_modules11 = require("@apps-in-toss/native-modules");
821
815
  var import_react_native24 = require("@toss-design-system/react-native");
822
- var import_react10 = require("react");
816
+ var import_react11 = require("react");
823
817
  var import_react_native25 = require("react-native");
824
818
 
825
819
  // src/constant/game-center.ts
826
- var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
820
+ var GAME_PROFILE_WEBVIEW_URL = "servicetoss://game-center/profile";
827
821
  var GAME_CENTER_MIN_VERSION = {
828
822
  android: "5.221.0",
829
823
  ios: "5.221.0"
830
824
  };
831
825
 
832
826
  // src/hooks/useGameCenterProfile.ts
833
- var import_native_modules11 = require("@apps-in-toss/native-modules");
827
+ var import_native_modules10 = require("@apps-in-toss/native-modules");
834
828
  var import_react_native22 = require("@granite-js/react-native");
835
829
  var import_react_native23 = require("@toss-design-system/react-native");
836
830
  var import_es_hangul2 = require("es-hangul");
837
- var import_react9 = require("react");
831
+ var import_react10 = require("react");
838
832
 
839
833
  // src/components/GameProfileToast.tsx
840
834
  var import_react_native20 = require("@toss-design-system/react-native");
841
835
  var import_private3 = require("@toss-design-system/react-native/private");
842
- var import_jsx_runtime5 = require("react/jsx-runtime");
836
+ var import_jsx_runtime6 = require("react/jsx-runtime");
843
837
  var useGameProfileToast = () => {
844
838
  const overlay = (0, import_private3.useOverlay)();
845
839
  const openGameProfileToast = (nickname, profileImageUri) => {
846
840
  return new Promise((resolve) => {
847
841
  overlay.open(({ isOpen, close, exit }) => {
848
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_private3.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_private3.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
842
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_private3.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_private3.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
849
843
  import_react_native20.Toast,
850
844
  {
851
845
  open: isOpen,
@@ -856,7 +850,7 @@ var useGameProfileToast = () => {
856
850
  onExited: exit,
857
851
  position: "top",
858
852
  text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
859
- icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
853
+ icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
860
854
  import_react_native20.Asset.Image,
861
855
  {
862
856
  style: { borderRadius: 64, overflow: "hidden" },
@@ -882,8 +876,8 @@ var DEFAULT_ERROR = {
882
876
  var import_react_native21 = require("@granite-js/react-native");
883
877
 
884
878
  // src/private.ts
885
- var import_native_modules10 = require("@apps-in-toss/native-modules");
886
- var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules10.onVisibilityChangedByTransparentServiceWeb;
879
+ var import_native_modules9 = require("@apps-in-toss/native-modules");
880
+ var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules9.onVisibilityChangedByTransparentServiceWeb;
887
881
 
888
882
  // src/utils/openTransparentWebView.ts
889
883
  var openTransparentWebView = ({
@@ -918,24 +912,24 @@ var openTransparentWebView = ({
918
912
 
919
913
  // src/hooks/useGameCenterProfile.ts
920
914
  var useGameCenterProfile = (isReadyForProfileUI) => {
921
- const [profileData, setProfileData] = (0, import_react9.useState)(void 0);
922
- const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react9.useState)(true);
923
- const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react9.useState)(false);
915
+ const [profileData, setProfileData] = (0, import_react10.useState)(void 0);
916
+ const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react10.useState)(true);
917
+ const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react10.useState)(false);
924
918
  const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
925
919
  const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
926
920
  const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
927
- const [isWebviewLoading, setIsWebviewLoading] = (0, import_react9.useState)(false);
928
- const isCompletedProfileFlow = (0, import_react9.useRef)(false);
921
+ const [isWebviewLoading, setIsWebviewLoading] = (0, import_react10.useState)(false);
922
+ const isCompletedProfileFlow = (0, import_react10.useRef)(false);
929
923
  const { openAlert, openConfirm } = (0, import_react_native23.useDialog)();
930
924
  const { openGameProfileToast } = useGameProfileToast();
931
- const openErrorAlert = (0, import_react9.useCallback)(async () => {
925
+ const openErrorAlert = (0, import_react10.useCallback)(async () => {
932
926
  await openAlert({
933
927
  title: DEFAULT_ERROR.title,
934
928
  description: DEFAULT_ERROR.description
935
929
  });
936
930
  (0, import_react_native22.closeView)();
937
931
  }, [openAlert]);
938
- const openProfileWebview = (0, import_react9.useCallback)(() => {
932
+ const openProfileWebview = (0, import_react10.useCallback)(() => {
939
933
  if (isWebviewLoading) {
940
934
  return;
941
935
  }
@@ -947,7 +941,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
947
941
  try {
948
942
  setIsWebviewLoading(false);
949
943
  setIsProfileDataRefetching(true);
950
- const data = await (0, import_native_modules11.getGameCenterGameProfile)();
944
+ const data = await (0, import_native_modules10.getGameCenterGameProfile)();
951
945
  setProfileData(data);
952
946
  setIsProfileDataRefetching(false);
953
947
  if (data?.statusCode === "SUCCESS") {
@@ -964,7 +958,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
964
958
  }
965
959
  });
966
960
  }, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
967
- const updateAppToSupportedMinVersion = (0, import_react9.useCallback)(async () => {
961
+ const updateAppToSupportedMinVersion = (0, import_react10.useCallback)(async () => {
968
962
  const upddateConfirmDialogLabel = {
969
963
  title: `${(0, import_es_hangul2.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
970
964
  \uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
@@ -1011,7 +1005,7 @@ var Z_INDEX = {
1011
1005
  };
1012
1006
 
1013
1007
  // src/components/GameProfile.tsx
1014
- var import_jsx_runtime6 = require("react/jsx-runtime");
1008
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1015
1009
  var GameProfile = ({ children, isReadyForProfileUI }) => {
1016
1010
  const {
1017
1011
  profileData,
@@ -1027,10 +1021,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1027
1021
  openErrorAlert,
1028
1022
  openGameProfileToast
1029
1023
  } = useGameCenterProfile(isReadyForProfileUI);
1030
- (0, import_react10.useEffect)(() => {
1024
+ (0, import_react11.useEffect)(() => {
1031
1025
  try {
1032
1026
  const getProfileData = async () => {
1033
- const data = await (0, import_native_modules12.getGameCenterGameProfile)();
1027
+ const data = await (0, import_native_modules11.getGameCenterGameProfile)();
1034
1028
  setProfileData(data);
1035
1029
  setIsProfileDataLoading(false);
1036
1030
  };
@@ -1040,7 +1034,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1040
1034
  setIsProfileDataLoading(false);
1041
1035
  }
1042
1036
  }, []);
1043
- (0, import_react10.useEffect)(() => {
1037
+ (0, import_react11.useEffect)(() => {
1044
1038
  const handleGameProfileFlow = async () => {
1045
1039
  if (!canShowBottomSheetOrToast) {
1046
1040
  return;
@@ -1049,7 +1043,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1049
1043
  return;
1050
1044
  }
1051
1045
  isCompletedProfileFlow.current = true;
1052
- if (!(0, import_native_modules12.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1046
+ if (!(0, import_native_modules11.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1053
1047
  updateAppToSupportedMinVersion();
1054
1048
  return;
1055
1049
  }
@@ -1070,10 +1064,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1070
1064
  profileData,
1071
1065
  updateAppToSupportedMinVersion
1072
1066
  ]);
1073
- if (!(0, import_native_modules12.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1074
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1075
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1076
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1067
+ if (!(0, import_native_modules11.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1068
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1069
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1070
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1077
1071
  import_react_native25.Pressable,
1078
1072
  {
1079
1073
  style: {
@@ -1087,9 +1081,9 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1087
1081
  ] });
1088
1082
  }
1089
1083
  if (shouldShowLoadingOverlay || isProfileDataRefetching) {
1090
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1091
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1092
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1084
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1085
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1086
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1093
1087
  import_react_native25.View,
1094
1088
  {
1095
1089
  style: {
@@ -1098,15 +1092,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1098
1092
  alignItems: "center",
1099
1093
  backgroundColor: "rgba(0, 0, 0, 0.2)"
1100
1094
  },
1101
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native24.Loader, { size: "large", type: "light" })
1095
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native24.Loader, { size: "large", type: "light" })
1102
1096
  }
1103
1097
  )
1104
1098
  ] });
1105
1099
  }
1106
1100
  if (shouldShowProfileNotFoundOverlay) {
1107
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1108
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1109
- shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1101
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1102
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1103
+ shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1110
1104
  import_react_native25.Pressable,
1111
1105
  {
1112
1106
  style: {
@@ -1119,7 +1113,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1119
1113
  )
1120
1114
  ] });
1121
1115
  }
1122
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }) });
1116
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }) });
1123
1117
  };
1124
1118
  var overlayStyle = {
1125
1119
  position: "absolute",
@@ -1130,32 +1124,163 @@ var overlayStyle = {
1130
1124
  zIndex: Z_INDEX.PROFILE_OVERLAY
1131
1125
  };
1132
1126
 
1127
+ // src/components/NavigationBar/GameWebviewNavigationBar.tsx
1128
+ var import_react_native26 = require("@granite-js/react-native");
1129
+ var import_react_native27 = require("@toss-design-system/react-native");
1130
+ var import_private5 = require("@toss-design-system/react-native/private");
1131
+ var import_es_hangul3 = require("es-hangul");
1132
+ var import_react12 = require("react");
1133
+ var import_react_native28 = require("react-native");
1134
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1135
+ function GameWebviewNavigationBar() {
1136
+ const safeAreaTop = (0, import_private5.useSafeAreaTop)();
1137
+ const { openConfirm } = (0, import_react_native27.useDialog)();
1138
+ const { captureExitLog } = useCaptureExitLog();
1139
+ const global2 = getAppsInTossGlobals();
1140
+ const logging = useNavigationBarLogging();
1141
+ const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1142
+ const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1143
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1144
+ const handleGameWebviewClose = (0, import_react12.useCallback)(async () => {
1145
+ const isConfirmed = await openConfirm({
1146
+ title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1147
+ leftButton: "\uCDE8\uC18C",
1148
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
1149
+ closeOnDimmerClick: true,
1150
+ onEntered: logging.closePopupShow
1151
+ });
1152
+ logging.closePopupCtaClick(isConfirmed);
1153
+ if (isConfirmed) {
1154
+ captureExitLog(Date.now());
1155
+ (0, import_react_native26.closeView)();
1156
+ }
1157
+ }, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
1158
+ (0, import_react12.useEffect)(() => {
1159
+ const handleAndroidBackEvent = () => {
1160
+ handleGameWebviewClose();
1161
+ return true;
1162
+ };
1163
+ import_react_native28.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1164
+ return () => import_react_native28.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1165
+ }, [handleGameWebviewClose]);
1166
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1167
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native27.PageNavbar, { preference: { type: "none" } }),
1168
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1169
+ import_react_native28.View,
1170
+ {
1171
+ style: {
1172
+ width: "100%",
1173
+ // TODO: UI관련 스타일 설정은 TDS로 이관
1174
+ height: import_react_native28.Platform.OS === "ios" ? 44 : 54,
1175
+ flexDirection: "row",
1176
+ alignItems: "center",
1177
+ justifyContent: "flex-end",
1178
+ position: "absolute",
1179
+ zIndex: Z_INDEX.CLOSE_BUTTON,
1180
+ marginTop: safeAreaTop,
1181
+ paddingRight: 10
1182
+ },
1183
+ pointerEvents: "box-none",
1184
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1185
+ import_private5.NavigationRightContent,
1186
+ {
1187
+ fixedRightButton: initialAccessoryButton,
1188
+ onPressDots: openMoreButtonBottomSheet,
1189
+ onPressClose: () => {
1190
+ logging.closeButtonClick();
1191
+ handleGameWebviewClose();
1192
+ },
1193
+ theme: "dark"
1194
+ }
1195
+ )
1196
+ }
1197
+ )
1198
+ ] });
1199
+ }
1200
+
1133
1201
  // src/components/GameWebView.tsx
1134
- var import_jsx_runtime7 = require("react/jsx-runtime");
1135
- var GameWebView = (0, import_react11.forwardRef)(function GameWebView2(props, ref) {
1136
- const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react11.useState)(false);
1137
- (0, import_react11.useEffect)(() => {
1138
- if (import_react_native26.Platform.OS === "ios") {
1139
- (0, import_native_modules13.setIosSwipeGestureEnabled)({ isEnabled: false });
1202
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1203
+ var GameWebView = (0, import_react13.forwardRef)(function GameWebView2(props, ref) {
1204
+ const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react13.useState)(false);
1205
+ (0, import_react13.useEffect)(() => {
1206
+ if (import_react_native29.Platform.OS === "ios") {
1207
+ (0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: false });
1140
1208
  return () => {
1141
- (0, import_native_modules13.setIosSwipeGestureEnabled)({ isEnabled: true });
1209
+ (0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: true });
1142
1210
  };
1143
1211
  }
1144
1212
  return;
1145
1213
  }, []);
1146
- (0, import_react11.useEffect)(() => {
1147
- import_native_modules13.appsInTossEvent.addEventListener("entryMessageExited", {
1214
+ (0, import_react13.useEffect)(() => {
1215
+ import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", {
1148
1216
  onEvent: () => {
1149
1217
  setIsEntryMessageExited(true);
1150
1218
  }
1151
1219
  });
1152
1220
  }, []);
1153
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: (0, import_native_modules13.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_webview.WebView, { ref, ...props }) });
1221
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1222
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GameWebviewNavigationBar, {}),
1223
+ (0, import_native_modules12.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_webview.WebView, { ref, ...props })
1224
+ ] });
1154
1225
  });
1155
1226
 
1156
1227
  // src/components/PartnerWebView.tsx
1228
+ var import_native_modules14 = require("@apps-in-toss/native-modules");
1157
1229
  var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
1158
- var import_react12 = require("react");
1230
+ var import_react16 = require("react");
1231
+ var import_react_native33 = require("react-native");
1232
+
1233
+ // src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
1234
+ var import_react_native30 = require("@granite-js/react-native");
1235
+ var import_react_native31 = require("@toss-design-system/react-native");
1236
+ var import_private6 = require("@toss-design-system/react-native/private");
1237
+ var import_es_hangul4 = require("es-hangul");
1238
+ var import_react14 = require("react");
1239
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1240
+ function PartnerWebviewNavigationBar({ handleBackEvent, handleHomeIconButtonClick }) {
1241
+ const globals = getAppsInTossGlobals();
1242
+ const { captureExitLog } = useCaptureExitLog();
1243
+ const logging = useNavigationBarLogging();
1244
+ const { openConfirm } = (0, import_react_native31.useDialog)();
1245
+ const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
1246
+ const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
1247
+ const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
1248
+ const withBackButton = parsedNavigationBar?.withBackButton ?? true;
1249
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1250
+ const handlePressTitle = (0, import_react14.useCallback)(() => {
1251
+ logging.homeButtonClick();
1252
+ handleHomeIconButtonClick();
1253
+ }, [handleHomeIconButtonClick, logging]);
1254
+ const handleClose = (0, import_react14.useCallback)(async () => {
1255
+ logging.closeButtonClick();
1256
+ const isConfirmed = await openConfirm({
1257
+ title: `${(0, import_es_hangul4.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1258
+ leftButton: "\uCDE8\uC18C",
1259
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
1260
+ closeOnDimmerClick: true,
1261
+ onEntered: logging.closePopupShow
1262
+ });
1263
+ logging.closePopupCtaClick(isConfirmed);
1264
+ if (isConfirmed) {
1265
+ captureExitLog(Date.now());
1266
+ (0, import_react_native30.closeView)();
1267
+ }
1268
+ }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
1269
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1270
+ import_private6.TopNavigation,
1271
+ {
1272
+ title: globals.brandDisplayName,
1273
+ icon: toIcon(globals.brandIcon),
1274
+ onPressDots: openMoreButtonBottomSheet,
1275
+ contentVisible: true,
1276
+ onPressTitle: withHomeButton ? handlePressTitle : void 0,
1277
+ onPressClose: handleClose,
1278
+ withHome: withHomeButton,
1279
+ fixedRightButton: initialAccessoryButton,
1280
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_private6.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_private6.NavigationBackButton, { onPress: handleBackEvent, canGoBack: false }) })
1281
+ }
1282
+ ) });
1283
+ }
1159
1284
 
1160
1285
  // src/core/utils/mergeRefs.ts
1161
1286
  function mergeRefs(...refs) {
@@ -1170,22 +1295,186 @@ function mergeRefs(...refs) {
1170
1295
  };
1171
1296
  }
1172
1297
 
1298
+ // src/hooks/useWebviewHistoryStack.tsx
1299
+ var import_react15 = require("react");
1300
+ var INITIAL_STATE = { stack: [], index: -1 };
1301
+ function reducer(state, action) {
1302
+ switch (action.type) {
1303
+ case "NAVIGATION_CHANGE": {
1304
+ const { url, canGoForward } = action;
1305
+ if (state.stack.length === 0) {
1306
+ return { stack: [url], index: 0 };
1307
+ }
1308
+ const { stack, index } = state;
1309
+ const cur = stack[index];
1310
+ if (url === cur) {
1311
+ return state;
1312
+ }
1313
+ const prev = index > 0 ? stack[index - 1] : void 0;
1314
+ const next = index < stack.length - 1 ? stack[index + 1] : void 0;
1315
+ if (prev && url === prev && canGoForward) {
1316
+ return { ...state, index: index - 1 };
1317
+ }
1318
+ if (next && url === next) {
1319
+ return { ...state, index: index + 1 };
1320
+ }
1321
+ const base = stack.slice(0, index + 1);
1322
+ const nextStack = [...base, url];
1323
+ return { stack: nextStack, index: nextStack.length - 1 };
1324
+ }
1325
+ default:
1326
+ return state;
1327
+ }
1328
+ }
1329
+ function useWebViewHistory() {
1330
+ const [state, dispatch] = (0, import_react15.useReducer)(reducer, INITIAL_STATE);
1331
+ const onNavigationStateChange = (0, import_react15.useCallback)(({ url, canGoForward: canGoForward2 }) => {
1332
+ dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
1333
+ }, []);
1334
+ const { canGoBack, canGoForward } = (0, import_react15.useMemo)(() => {
1335
+ const canBack = state.index > 0;
1336
+ const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
1337
+ return { canGoBack: canBack, canGoForward: canFwd };
1338
+ }, [state.index, state.stack.length]);
1339
+ return { onNavigationStateChange, canGoBack, canGoForward };
1340
+ }
1341
+
1342
+ // src/utils/log.ts
1343
+ var import_native_modules13 = require("@apps-in-toss/native-modules");
1344
+ var import_react_native32 = require("@granite-js/react-native");
1345
+
1346
+ // src/utils/extractDateFromUUIDv7.ts
1347
+ var extractDateFromUUIDv7 = (uuid) => {
1348
+ const timestampHex = uuid.split("-").join("").slice(0, 12);
1349
+ const timestamp = Number.parseInt(timestampHex, 16);
1350
+ return new Date(timestamp);
1351
+ };
1352
+
1353
+ // src/utils/log.ts
1354
+ var getGroupId = (url) => {
1355
+ try {
1356
+ const urlObject = new URL(url);
1357
+ return {
1358
+ groupId: urlObject.pathname,
1359
+ search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1360
+ };
1361
+ } catch {
1362
+ return {
1363
+ groupId: "unknown",
1364
+ search: "unknown"
1365
+ };
1366
+ }
1367
+ };
1368
+ var getReferrer = () => {
1369
+ try {
1370
+ const referrer = new URL((0, import_react_native32.getSchemeUri)());
1371
+ return referrer.searchParams.get("referrer");
1372
+ } catch {
1373
+ return "";
1374
+ }
1375
+ };
1376
+ var trackScreen = (url) => {
1377
+ const { groupId, search } = getGroupId(url);
1378
+ const log = {
1379
+ log_type: "screen",
1380
+ log_name: `${groupId}::screen`,
1381
+ params: {
1382
+ search,
1383
+ referrer: getReferrer(),
1384
+ deployment_id: env.getDeploymentId(),
1385
+ deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1386
+ }
1387
+ };
1388
+ return (0, import_native_modules13.eventLog)(log);
1389
+ };
1390
+
1173
1391
  // src/components/PartnerWebView.tsx
1174
- var import_jsx_runtime8 = require("react/jsx-runtime");
1175
- var PartnerWebView = (0, import_react12.forwardRef)(
1392
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1393
+ var PartnerWebView = (0, import_react16.forwardRef)(
1176
1394
  function PartnerWebViewScreen(webViewProps, ref) {
1177
- const webViewRef = (0, import_react12.useRef)(null);
1395
+ const webViewRef = (0, import_react16.useRef)(null);
1178
1396
  const refs = mergeRefs(ref, webViewRef);
1179
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_webview2.WebView, { ref: refs, ...webViewProps, style: { flex: 1 } });
1397
+ const { captureExitLog } = useCaptureExitLog();
1398
+ const { canGoBack, onNavigationStateChange } = useWebViewHistory();
1399
+ const historyBackScript = `
1400
+ (function() {
1401
+ window.history.back();
1402
+ true;
1403
+ })();
1404
+ `;
1405
+ const historyHomeScript = `
1406
+ (function() {
1407
+ window.location.href = '/';
1408
+ true;
1409
+ })();
1410
+ `;
1411
+ const handleBackEvent = (0, import_react16.useCallback)(() => {
1412
+ if (canGoBack) {
1413
+ webViewRef.current?.injectJavaScript(historyBackScript);
1414
+ } else {
1415
+ captureExitLog(Date.now());
1416
+ (0, import_native_modules14.closeView)();
1417
+ }
1418
+ }, [canGoBack, captureExitLog, historyBackScript]);
1419
+ (0, import_react16.useEffect)(() => {
1420
+ const handleAndroidBackEvent = () => {
1421
+ if (canGoBack) {
1422
+ webViewRef.current?.injectJavaScript(historyBackScript);
1423
+ return true;
1424
+ } else {
1425
+ captureExitLog(Date.now());
1426
+ return false;
1427
+ }
1428
+ };
1429
+ import_react_native33.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
1430
+ return () => import_react_native33.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
1431
+ }, [canGoBack, captureExitLog, historyBackScript]);
1432
+ const handleHomeIconButtonClick = (0, import_react16.useCallback)(() => {
1433
+ webViewRef.current?.injectJavaScript(historyHomeScript);
1434
+ }, [historyHomeScript]);
1435
+ const handleNavigationStateChange = (0, import_react16.useCallback)(
1436
+ (event) => {
1437
+ if (event.url) {
1438
+ trackScreen(event.url);
1439
+ }
1440
+ onNavigationStateChange(event);
1441
+ },
1442
+ [onNavigationStateChange]
1443
+ );
1444
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1445
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1446
+ PartnerWebviewNavigationBar,
1447
+ {
1448
+ handleBackEvent,
1449
+ handleHomeIconButtonClick
1450
+ }
1451
+ ),
1452
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1453
+ import_react_native_webview2.WebView,
1454
+ {
1455
+ ref: refs,
1456
+ ...webViewProps,
1457
+ style: { flex: 1 },
1458
+ onNavigationStateChange: (event) => {
1459
+ webViewProps?.onNavigationStateChange?.(event);
1460
+ handleNavigationStateChange(event);
1461
+ }
1462
+ }
1463
+ )
1464
+ ] });
1180
1465
  }
1181
1466
  );
1182
1467
 
1183
1468
  // src/bridge-handler/useBridgeHandler.tsx
1184
- var import_react13 = require("react");
1469
+ var import_react17 = require("react");
1185
1470
  function serializeError(error) {
1186
1471
  return JSON.stringify(error, (_, value) => {
1187
1472
  if (value instanceof Error) {
1188
1473
  return {
1474
+ ...Object.entries(value).reduce((acc, [key, value2]) => {
1475
+ acc[key] = value2;
1476
+ return acc;
1477
+ }, {}),
1189
1478
  name: value.name,
1190
1479
  message: value.message,
1191
1480
  stack: value.stack,
@@ -1230,8 +1519,8 @@ function useBridgeHandler({
1230
1519
  eventListenerMap,
1231
1520
  injectedJavaScript: originalInjectedJavaScript
1232
1521
  }) {
1233
- const ref = (0, import_react13.useRef)(null);
1234
- const injectedJavaScript = (0, import_react13.useMemo)(
1522
+ const ref = (0, import_react17.useRef)(null);
1523
+ const injectedJavaScript = (0, import_react17.useMemo)(
1235
1524
  () => [
1236
1525
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
1237
1526
  Object.entries(constantHandlerMap).reduce(
@@ -1258,7 +1547,7 @@ function useBridgeHandler({
1258
1547
  window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
1259
1548
  `);
1260
1549
  };
1261
- const $onMessage = (0, import_react13.useCallback)(
1550
+ const $onMessage = (0, import_react17.useCallback)(
1262
1551
  async (e) => {
1263
1552
  onMessage?.(e);
1264
1553
  const data = JSON.parse(e.nativeEvent.data);
@@ -1309,8 +1598,8 @@ function useBridgeHandler({
1309
1598
  }
1310
1599
 
1311
1600
  // src/hooks/useCreateUserAgent.ts
1312
- var import_native_modules14 = require("@apps-in-toss/native-modules");
1313
- var import_react_native27 = require("react-native");
1601
+ var import_native_modules15 = require("@apps-in-toss/native-modules");
1602
+ var import_react_native34 = require("react-native");
1314
1603
  var FontA11yCategory = {
1315
1604
  Large: "Large",
1316
1605
  xLarge: "xLarge",
@@ -1443,9 +1732,9 @@ function useCreateUserAgent({
1443
1732
  safeArea,
1444
1733
  safeAreaBottomTransparency
1445
1734
  }) {
1446
- const platform = (0, import_native_modules14.getPlatformOS)();
1447
- const appVersion = (0, import_native_modules14.getTossAppVersion)();
1448
- const { fontScale } = (0, import_react_native27.useWindowDimensions)();
1735
+ const platform = (0, import_native_modules15.getPlatformOS)();
1736
+ const appVersion = (0, import_native_modules15.getTossAppVersion)();
1737
+ const { fontScale } = (0, import_react_native34.useWindowDimensions)();
1449
1738
  const platformString = platform === "ios" ? "iPhone" : "Android";
1450
1739
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
1451
1740
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
@@ -1465,17 +1754,17 @@ function useCreateUserAgent({
1465
1754
  }
1466
1755
 
1467
1756
  // src/hooks/useGeolocation.ts
1468
- var import_native_modules15 = require("@apps-in-toss/native-modules");
1469
- var import_react_native28 = require("@granite-js/react-native");
1470
- var import_react14 = require("react");
1757
+ var import_native_modules16 = require("@apps-in-toss/native-modules");
1758
+ var import_react_native35 = require("@granite-js/react-native");
1759
+ var import_react18 = require("react");
1471
1760
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1472
- const isVisible = (0, import_react_native28.useVisibility)();
1473
- const [location, setLocation] = (0, import_react14.useState)(null);
1474
- (0, import_react14.useEffect)(() => {
1761
+ const isVisible = (0, import_react_native35.useVisibility)();
1762
+ const [location, setLocation] = (0, import_react18.useState)(null);
1763
+ (0, import_react18.useEffect)(() => {
1475
1764
  if (!isVisible) {
1476
1765
  return;
1477
1766
  }
1478
- return (0, import_native_modules15.startUpdateLocation)({
1767
+ return (0, import_native_modules16.startUpdateLocation)({
1479
1768
  options: {
1480
1769
  accuracy,
1481
1770
  distanceInterval,
@@ -1488,67 +1777,18 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1488
1777
  return location;
1489
1778
  }
1490
1779
 
1491
- // src/utils/log.ts
1492
- var import_native_modules16 = require("@apps-in-toss/native-modules");
1493
- var import_react_native29 = require("@granite-js/react-native");
1494
-
1495
- // src/utils/extractDateFromUUIDv7.ts
1496
- var extractDateFromUUIDv7 = (uuid) => {
1497
- const timestampHex = uuid.split("-").join("").slice(0, 12);
1498
- const timestamp = Number.parseInt(timestampHex, 16);
1499
- return new Date(timestamp);
1500
- };
1501
-
1502
- // src/utils/log.ts
1503
- var getGroupId = (url) => {
1504
- try {
1505
- const urlObject = new URL(url);
1506
- return {
1507
- groupId: urlObject.pathname,
1508
- search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1509
- };
1510
- } catch {
1511
- return {
1512
- groupId: "unknown",
1513
- search: "unknown"
1514
- };
1515
- }
1516
- };
1517
- var getReferrer = () => {
1518
- try {
1519
- const referrer = new URL((0, import_react_native29.getSchemeUri)());
1520
- return referrer.searchParams.get("referrer");
1521
- } catch {
1522
- return "";
1523
- }
1524
- };
1525
- var trackScreen = (url) => {
1526
- const { groupId, search } = getGroupId(url);
1527
- const log = {
1528
- log_type: "screen",
1529
- log_name: `${groupId}::screen`,
1530
- params: {
1531
- search,
1532
- referrer: getReferrer(),
1533
- deployment_id: env.getDeploymentId(),
1534
- deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1535
- }
1536
- };
1537
- return (0, import_native_modules16.eventLog)(log);
1538
- };
1539
-
1540
1780
  // src/components/WebView.tsx
1541
- var import_jsx_runtime9 = require("react/jsx-runtime");
1781
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1542
1782
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
1543
1783
  var TYPES = ["partner", "external", "game"];
1544
1784
  var WEBVIEW_TYPES = {
1545
1785
  partner: PartnerWebView,
1546
- external: import_react_native31.ExternalWebViewScreen,
1786
+ external: import_react_native37.ExternalWebViewScreen,
1547
1787
  game: GameWebView
1548
1788
  };
1549
1789
  function mergeSchemeQueryParamsInto(url) {
1550
1790
  const baseUrl = new URL(url);
1551
- const schemeUrl = new URL((0, import_react_native30.getSchemeUri)());
1791
+ const schemeUrl = new URL((0, import_react_native36.getSchemeUri)());
1552
1792
  baseUrl.pathname = schemeUrl.pathname;
1553
1793
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1554
1794
  baseUrl.searchParams.set(key, value);
@@ -1572,14 +1812,12 @@ function WebView({ type, local, onMessage, ...props }) {
1572
1812
  if (!TYPES.includes(type)) {
1573
1813
  throw new Error(`Invalid WebView type: '${type}'`);
1574
1814
  }
1575
- const { openConfirm } = (0, import_react_native31.useDialog)();
1576
- const { captureExitLog } = useCaptureExitLog();
1577
- const graniteEvent = (0, import_react_native30.useGraniteEvent)();
1578
- const uri = (0, import_react15.useMemo)(() => getWebViewUri(local), [local]);
1579
- const top = (0, import_private5.useSafeAreaTop)();
1580
- const bottom = (0, import_private5.useSafeAreaBottom)();
1815
+ const graniteEvent = (0, import_react_native36.useGraniteEvent)();
1816
+ const uri = (0, import_react19.useMemo)(() => getWebViewUri(local), [local]);
1817
+ const top = (0, import_private7.useSafeAreaTop)();
1818
+ const bottom = (0, import_private7.useSafeAreaBottom)();
1581
1819
  const global2 = getAppsInTossGlobals();
1582
- const topNavigation = (0, import_private5.useTopNavigation)();
1820
+ const topNavigation = (0, import_private7.useTopNavigation)();
1583
1821
  const disableTextSelectionCSS = `
1584
1822
  (function() {
1585
1823
  const style = document.createElement('style');
@@ -1587,7 +1825,7 @@ function WebView({ type, local, onMessage, ...props }) {
1587
1825
  document.head.appendChild(style);
1588
1826
  })();
1589
1827
  `;
1590
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react15.useState)(
1828
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react19.useState)(
1591
1829
  props.allowsBackForwardNavigationGestures
1592
1830
  );
1593
1831
  const handler = useBridgeHandler({
@@ -1596,7 +1834,7 @@ function WebView({ type, local, onMessage, ...props }) {
1596
1834
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1597
1835
  eventListenerMap: {
1598
1836
  ...appsInTossEventBridges,
1599
- navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native31.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1837
+ navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native37.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1600
1838
  backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1601
1839
  entryMessageExited: ({ onEvent, onError }) => import_native_modules17.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1602
1840
  updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
@@ -1609,7 +1847,10 @@ function WebView({ type, local, onMessage, ...props }) {
1609
1847
  showAdMobRewardedAd: import_native_modules17.GoogleAdMob.showAdMobRewardedAd,
1610
1848
  /** AdMobV2 */
1611
1849
  loadAppsInTossAdMob: import_native_modules17.GoogleAdMob.loadAppsInTossAdMob,
1612
- showAppsInTossAdMob: import_native_modules17.GoogleAdMob.showAppsInTossAdMob
1850
+ showAppsInTossAdMob: import_native_modules17.GoogleAdMob.showAppsInTossAdMob,
1851
+ /** IAP */
1852
+ iapCreateOneTimePurchaseOrder: import_native_modules17.IAP.createOneTimePurchaseOrder,
1853
+ requestOneTimePurchase: import_native_modules17.requestOneTimePurchase
1613
1854
  },
1614
1855
  constantHandlerMap: {
1615
1856
  ...graniteConstantBridges,
@@ -1653,11 +1894,12 @@ function WebView({ type, local, onMessage, ...props }) {
1653
1894
  removeStorageItem: import_native_modules17.Storage.removeItem,
1654
1895
  clearItems: import_native_modules17.Storage.clearItems,
1655
1896
  /** IAP */
1656
- iapCreateOneTimePurchaseOrder: import_native_modules17.IAP.createOneTimePurchaseOrder,
1657
- iapGetProductItemList: import_native_modules17.IAP.getProductItemList
1897
+ iapGetProductItemList: import_native_modules17.IAP.getProductItemList,
1898
+ iapCreateOneTimePurchaseOrder: import_native_modules17.iapCreateOneTimePurchaseOrder,
1899
+ processProductGrant: import_native_modules17.processProductGrant
1658
1900
  }
1659
1901
  });
1660
- const headerPropForExternalWebView = (0, import_react15.useMemo)(() => {
1902
+ const headerPropForExternalWebView = (0, import_react19.useMemo)(() => {
1661
1903
  const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1662
1904
  const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1663
1905
  const withBackButton = parsedNavigationBar?.withBackButton ?? true;
@@ -1674,74 +1916,10 @@ function WebView({ type, local, onMessage, ...props }) {
1674
1916
  }, [global2.navigationBar, type]);
1675
1917
  const BaseWebView = WEBVIEW_TYPES[type];
1676
1918
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1677
- const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react15.useState)(false);
1678
- const handleNavigationStateChange = (0, import_react15.useCallback)(
1679
- (event) => {
1680
- if (event.url) {
1681
- trackScreen(event.url);
1682
- }
1683
- setCanHistoryGoBack(event.canGoBack);
1684
- },
1685
- [setCanHistoryGoBack]
1686
- );
1687
1919
  const userAgent = useCreateUserAgent({
1688
1920
  colorPreference: "light"
1689
1921
  });
1690
- const handleGameWebviewClose = (0, import_react15.useCallback)(async () => {
1691
- const isConfirmed = await openConfirm({
1692
- title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1693
- leftButton: "\uCDE8\uC18C",
1694
- rightButton: "\uC885\uB8CC\uD558\uAE30",
1695
- closeOnDimmerClick: true
1696
- });
1697
- if (isConfirmed) {
1698
- captureExitLog(Date.now());
1699
- (0, import_react_native30.closeView)();
1700
- }
1701
- }, [captureExitLog, openConfirm, global2.brandDisplayName]);
1702
- const handleBackEvent = (0, import_react15.useCallback)(() => {
1703
- if (type === "game") {
1704
- handleGameWebviewClose();
1705
- return true;
1706
- }
1707
- if (canHistoryGoBack) {
1708
- handler.ref.current?.goBack();
1709
- return true;
1710
- } else {
1711
- return false;
1712
- }
1713
- }, [canHistoryGoBack, handleGameWebviewClose, handler.ref, type]);
1714
- (0, import_react15.useEffect)(() => {
1715
- import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
1716
- return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
1717
- }, [handleBackEvent]);
1718
- (0, import_react15.useEffect)(() => {
1719
- return import_native_modules17.appsInTossEvent.addEventListener("homeIconButtonClickEvent", {
1720
- onEvent: () => {
1721
- handler.ref?.current?.injectJavaScript(`
1722
- (function() {
1723
- window.history.replaceState(null, '', '/');
1724
- true;
1725
- })();
1726
- `);
1727
- }
1728
- });
1729
- }, [handler.ref]);
1730
- (0, import_react15.useEffect)(() => {
1731
- return import_native_modules17.appsInTossEvent.addEventListener("backButtonClickEvent", {
1732
- onEvent: () => {
1733
- if (type === "game") {
1734
- handleGameWebviewClose();
1735
- } else if (canHistoryGoBack) {
1736
- handler.ref.current?.goBack();
1737
- } else {
1738
- captureExitLog(Date.now());
1739
- (0, import_react_native30.closeView)();
1740
- }
1741
- }
1742
- });
1743
- }, [handler.ref, canHistoryGoBack, handleGameWebviewClose, captureExitLog, type]);
1744
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1922
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1745
1923
  BaseWebView,
1746
1924
  {
1747
1925
  ref: handler.ref,
@@ -1754,15 +1932,14 @@ function WebView({ type, local, onMessage, ...props }) {
1754
1932
  "User-Agent": userAgent
1755
1933
  }
1756
1934
  },
1757
- userAgent: import_react_native32.Platform.OS === "ios" ? userAgent : void 0,
1935
+ userAgent: import_react_native38.Platform.OS === "ios" ? userAgent : void 0,
1758
1936
  sharedCookiesEnabled: true,
1759
1937
  webviewDebuggingEnabled: webViewDebuggingEnabled,
1760
1938
  thirdPartyCookiesEnabled: true,
1761
1939
  onMessage: handler.onMessage,
1762
- onNavigationStateChange: handleNavigationStateChange,
1763
1940
  injectedJavaScript: handler.injectedJavaScript,
1764
1941
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
1765
- decelerationRate: import_react_native32.Platform.OS === "ios" ? 1 : void 0,
1942
+ decelerationRate: import_react_native38.Platform.OS === "ios" ? 1 : void 0,
1766
1943
  allowsBackForwardNavigationGestures
1767
1944
  }
1768
1945
  );
@@ -1770,7 +1947,7 @@ function WebView({ type, local, onMessage, ...props }) {
1770
1947
 
1771
1948
  // src/index.ts
1772
1949
  __reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
1773
- var import_private6 = require("@toss-design-system/react-native/private");
1950
+ var import_private8 = require("@toss-design-system/react-native/private");
1774
1951
  __reExport(src_exports, require("@apps-in-toss/native-modules"), module.exports);
1775
1952
  __reExport(src_exports, require("@apps-in-toss/types"), module.exports);
1776
1953
  var Analytics2 = {