@apps-in-toss/framework 1.0.1 → 1.0.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.
package/dist/index.cjs CHANGED
@@ -37,16 +37,18 @@ __export(src_exports, {
37
37
  WebView: () => WebView,
38
38
  env: () => env,
39
39
  useCreateUserAgent: () => useCreateUserAgent,
40
- useGeolocation: () => useGeolocation
40
+ useGeolocation: () => useGeolocation,
41
+ useTopNavigation: () => import_private6.useTopNavigation
41
42
  });
42
43
  module.exports = __toCommonJS(src_exports);
43
44
  var import_analytics2 = require("@apps-in-toss/analytics");
44
45
 
45
46
  // src/core/registerApp.tsx
46
47
  var import_analytics = require("@apps-in-toss/analytics");
47
- var import_native_modules4 = require("@apps-in-toss/native-modules");
48
- var import_react_native7 = require("@granite-js/react-native");
49
- var import_react_native8 = require("@toss-design-system/react-native");
48
+ var import_native_modules9 = require("@apps-in-toss/native-modules");
49
+ var import_react_native17 = require("@granite-js/react-native");
50
+ var import_react_native18 = require("@toss-design-system/react-native");
51
+ var import_react_native19 = require("react-native");
50
52
 
51
53
  // src/core/components/AppEvent.tsx
52
54
  var import_native_modules2 = require("@apps-in-toss/native-modules");
@@ -189,11 +191,277 @@ function AppUpdate() {
189
191
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
190
192
  }
191
193
 
192
- // src/core/hooks/useAppsInTossBridge.ts
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");
198
+ var import_private2 = require("@toss-design-system/react-native/private");
199
+ var import_es_hangul = require("es-hangul");
200
+ var import_react7 = require("react");
201
+ var import_react_native15 = require("react-native");
202
+
203
+ // src/core/components/BuiltinNavigationBar/useBuiltinNavigationBarLogging.tsx
193
204
  var import_native_modules3 = require("@apps-in-toss/native-modules");
194
- var import_react_native6 = require("@toss-design-system/react-native");
205
+ var import_react_native6 = require("@granite-js/react-native");
206
+ var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
207
+ var NAVI_BAR_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__navigation_bar";
208
+ var CLOSE_POPUP_SHOW_SCHEMA_ID = 1644490;
209
+ var CLOSE_POPUP_SHOW_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app";
210
+ var CLOSE_BUTTON_CLICK_SCHEMA_ID = 1596831;
211
+ var CLOSE_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_close";
212
+ var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
213
+ var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
214
+ var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
215
+ var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
216
+ function useBuiltinNavigationBarLogging() {
217
+ const referrer = useReferrer();
218
+ const baseParams = {
219
+ referrer,
220
+ app_name: import_react_native6.Granite.appName
221
+ };
222
+ const logNavBarImpression = (naviBarConfig) => {
223
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
224
+ log_name: NAVI_BAR_IMPRESSION_LOG_NAME,
225
+ log_type: "event",
226
+ params: {
227
+ ...naviBarConfig,
228
+ ...baseParams,
229
+ event_type: "impression",
230
+ schema_id: NAVI_BAR_IMPRESSION_SCHEMA_ID
231
+ }
232
+ });
233
+ };
234
+ const logHomeButtonClick = () => {
235
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
236
+ log_name: HOME_BUTTON_CLICK_LOG_NAME,
237
+ log_type: "event",
238
+ params: {
239
+ ...baseParams,
240
+ event_type: "click",
241
+ schema_id: HOME_BUTTON_CLICK_SCHEMA_ID
242
+ }
243
+ });
244
+ };
245
+ const logCloseButtonClick = () => {
246
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
247
+ log_name: CLOSE_BUTTON_CLICK_LOG_NAME,
248
+ log_type: "event",
249
+ params: {
250
+ ...baseParams,
251
+ event_type: "click",
252
+ schema_id: CLOSE_BUTTON_CLICK_SCHEMA_ID
253
+ }
254
+ });
255
+ };
256
+ const logClosePopupShow = () => {
257
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
258
+ log_name: CLOSE_POPUP_SHOW_LOG_NAME,
259
+ log_type: "popup",
260
+ params: {
261
+ ...baseParams,
262
+ schema_id: CLOSE_POPUP_SHOW_SCHEMA_ID
263
+ }
264
+ });
265
+ };
266
+ const logClosePopupCtaClick = (confirm) => {
267
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
268
+ log_name: CLOSE_POPUP_CTA_CLICK_LOG_NAME,
269
+ log_type: "event",
270
+ params: {
271
+ ...baseParams,
272
+ close_yn: confirm ? "Y" : "N",
273
+ schema_id: CLOSE_POPUP_CTA_CLICK_SCHEMA_ID,
274
+ event_type: "click"
275
+ }
276
+ });
277
+ };
278
+ return {
279
+ navBarImpression: logNavBarImpression,
280
+ closePopupShow: logClosePopupShow,
281
+ closePopupCtaClick: logClosePopupCtaClick,
282
+ closeButtonClick: logCloseButtonClick,
283
+ homeButtonClick: logHomeButtonClick
284
+ };
285
+ }
286
+
287
+ // 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");
291
+ var import_private = require("@toss-design-system/react-native/private");
292
+ var import_react6 = require("react");
293
+
294
+ // 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");
297
+ var BOTTOM_SHEET_SCHEMA_ID = 1596825;
298
+ var BOTTOM_SHEET_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more";
299
+ var BOTTOM_SHEET_OPEN_SCHEMA_ID = 1596829;
300
+ var BOTTOM_SHEET_OPEN_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_more";
301
+ var BOTTOM_SHEET_CLOSE_CLICK_SCHEMA_ID = 1596843;
302
+ var BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more::click__close";
303
+ var BOTTOM_SHEET_MENU_CLICK_SCHEMA_ID = 1596841;
304
+ var BOTTOM_SHEET_MENU_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more::click__menu";
305
+ function useMoreButtonBottomSheetLogging() {
306
+ const referrer = useReferrer();
307
+ const baseParams = {
308
+ referrer,
309
+ app_name: import_react_native7.Granite.appName
310
+ };
311
+ const logBottomSheetShow = () => {
312
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
313
+ log_name: BOTTOM_SHEET_LOG_NAME,
314
+ log_type: "popup",
315
+ params: {
316
+ ...baseParams,
317
+ schema_id: BOTTOM_SHEET_SCHEMA_ID
318
+ }
319
+ });
320
+ };
321
+ const logBottomSheetOpen = () => {
322
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
323
+ log_name: BOTTOM_SHEET_OPEN_LOG_NAME,
324
+ log_type: "event",
325
+ params: {
326
+ ...baseParams,
327
+ schema_id: BOTTOM_SHEET_OPEN_SCHEMA_ID,
328
+ event_type: "click"
329
+ }
330
+ });
331
+ };
332
+ const logBottomSheetCloseClick = () => {
333
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
334
+ log_name: BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME,
335
+ log_type: "event",
336
+ params: {
337
+ ...baseParams,
338
+ schema_id: BOTTOM_SHEET_CLOSE_CLICK_SCHEMA_ID,
339
+ event_type: "click"
340
+ }
341
+ });
342
+ };
343
+ const logBottomSheetMenuClick = ({ title }) => {
344
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
345
+ log_name: BOTTOM_SHEET_MENU_CLICK_LOG_NAME,
346
+ log_type: "event",
347
+ params: {
348
+ ...baseParams,
349
+ schema_id: BOTTOM_SHEET_MENU_CLICK_SCHEMA_ID,
350
+ event_type: "click",
351
+ item_title: title
352
+ }
353
+ });
354
+ };
355
+ return {
356
+ show: logBottomSheetShow,
357
+ open: logBottomSheetOpen,
358
+ close: logBottomSheetCloseClick,
359
+ menuClick: logBottomSheetMenuClick
360
+ };
361
+ }
362
+
363
+ // 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");
195
367
  var import_react5 = require("react");
196
368
 
369
+ // src/utils/market.ts
370
+ var import_react_native8 = require("react-native");
371
+ var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
372
+ var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
373
+ var getMarketLink = () => {
374
+ return import_react_native8.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
375
+ };
376
+
377
+ // src/hooks/useAppUpdateDialog.tsx
378
+ function useAppUpdateDialog() {
379
+ const { openConfirm } = (0, import_react_native10.useDialog)();
380
+ const logging = useAppUpdateDialogLogging();
381
+ const openAppUpdateDialog = (0, import_react5.useCallback)(
382
+ async ({
383
+ title,
384
+ description,
385
+ leftButton = "\uB2EB\uAE30",
386
+ rightButton = "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
387
+ }) => {
388
+ logging.show();
389
+ const isConfirmed = await openConfirm({
390
+ title,
391
+ description,
392
+ leftButton,
393
+ rightButton,
394
+ closeOnDimmerClick: true
395
+ });
396
+ if (!isConfirmed) {
397
+ logging.close();
398
+ return;
399
+ }
400
+ logging.update();
401
+ const STORE_SCHEME = getMarketLink();
402
+ (0, import_react_native9.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
403
+ },
404
+ [logging, openConfirm]
405
+ );
406
+ return {
407
+ open: openAppUpdateDialog
408
+ };
409
+ }
410
+ var UPDATE_DIALOG_SCHEMA_ID = 1634992;
411
+ var UPDATE_DIALOG_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__app_update";
412
+ var UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID = 1634996;
413
+ var UPDATE_DIALOG_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__app_update::click__cta";
414
+ function useAppUpdateDialogLogging() {
415
+ const referrer = useReferrer();
416
+ const baseParams = {
417
+ referrer,
418
+ app_name: import_react_native9.Granite.appName
419
+ };
420
+ const logUpdateClick = () => {
421
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
422
+ log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
423
+ log_type: "event",
424
+ params: {
425
+ ...baseParams,
426
+ schema_id: UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID,
427
+ event_type: "click",
428
+ button_type: "update"
429
+ }
430
+ });
431
+ };
432
+ const logCloseClick = () => {
433
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
434
+ log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
435
+ log_type: "event",
436
+ params: {
437
+ ...baseParams,
438
+ schema_id: UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID,
439
+ event_type: "click",
440
+ button_type: "close"
441
+ }
442
+ });
443
+ };
444
+ const logDialogShow = () => {
445
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
446
+ log_name: UPDATE_DIALOG_LOG_NAME,
447
+ log_type: "popup",
448
+ params: {
449
+ ...baseParams,
450
+ schema_id: UPDATE_DIALOG_SCHEMA_ID
451
+ }
452
+ });
453
+ };
454
+ return { update: logUpdateClick, close: logCloseClick, show: logDialogShow };
455
+ }
456
+
457
+ // src/core/utils/ensureValue.ts
458
+ function ensureValue(value, name) {
459
+ if (value === void 0) {
460
+ throw new Error(`${name} is required`);
461
+ }
462
+ return value;
463
+ }
464
+
197
465
  // src/core/utils/getAppsInTossGlobals.ts
198
466
  function getAppsInTossGlobals() {
199
467
  if (global.__appsInToss == null) {
@@ -202,73 +470,312 @@ function getAppsInTossGlobals() {
202
470
  return global.__appsInToss;
203
471
  }
204
472
 
473
+ // src/core/hooks/useMoreButtonBottomSheet/index.tsx
474
+ var import_jsx_runtime2 = require("react/jsx-runtime");
475
+ var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
476
+ function useMoreButtonBottomSheet() {
477
+ const globals = getAppsInTossGlobals();
478
+ const adaptive = (0, import_private.useAdaptive)();
479
+ const [itemList, setItemList] = (0, import_react6.useState)([]);
480
+ const appUpdateDialog = useAppUpdateDialog();
481
+ const logging = useMoreButtonBottomSheetLogging();
482
+ const overlay = (0, import_private.useOverlay)();
483
+ const title = ensureValue(globals.brandDisplayName, "displayName");
484
+ const isSupported = (0, import_native_modules6.isMinVersionSupported)({
485
+ android: "5.226.0",
486
+ ios: "5.226.0"
487
+ });
488
+ (0, import_react6.useEffect)(() => {
489
+ if (!isSupported) {
490
+ return;
491
+ }
492
+ import_native_modules6.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
493
+ APP_BRIDGE_METHOD_NAME,
494
+ {},
495
+ {
496
+ onSuccess: ({ items }) => setItemList(items),
497
+ onError: (error) => console.error("\uBA54\uB274 \uBAA9\uB85D\uC744 \uAC00\uC838\uC624\uB294 \uB370 \uC2E4\uD328\uD588\uC5B4\uC694:", error)
498
+ }
499
+ );
500
+ }, [isSupported]);
501
+ const onClickHandler = async () => {
502
+ logging.open();
503
+ if (!isSupported) {
504
+ await appUpdateDialog.open({
505
+ title: `\uC774 \uAE30\uB2A5\uC744 \uC4F0\uB824\uBA74 \uC571 \uC5C5\uB370\uC774\uD2B8\uAC00 \uD544\uC694\uD574\uC694`,
506
+ description: `\uBB38\uC758, \uAD8C\uD55C \uC124\uC815, \uC2E0\uACE0 \uB4F1 \uAE30\uB2A5\uC744 \uC4F8 \uC218 \uC788\uC5B4\uC694`
507
+ });
508
+ return;
509
+ }
510
+ overlay.open(({ isOpen, exit, close }) => {
511
+ const handleClose = () => {
512
+ logging.close();
513
+ close();
514
+ };
515
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BottomSheetImpressionArea, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
516
+ import_react_native12.BottomSheet.Root,
517
+ {
518
+ header: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
519
+ import_react_native12.ListHeader,
520
+ {
521
+ title: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native12.ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
522
+ }
523
+ ),
524
+ open: isOpen,
525
+ cta: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
526
+ import_react_native12.BottomSheet.CTA,
527
+ {
528
+ size: "large",
529
+ type: "dark",
530
+ style: "weak",
531
+ onPress: () => {
532
+ handleClose();
533
+ },
534
+ children: "\uB2EB\uAE30"
535
+ }
536
+ ),
537
+ onClose: handleClose,
538
+ 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,
542
+ {
543
+ left: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
544
+ import_react_native12.ListRow.Icon,
545
+ {
546
+ color: globals.brandPrimaryColor,
547
+ source: { uri: item.contactIconUrl },
548
+ type: "background"
549
+ }
550
+ ),
551
+ contents: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
552
+ import_react_native12.ListRow.Texts,
553
+ {
554
+ type: "1RowTypeA",
555
+ top: item.contactItemName,
556
+ topProps: { color: adaptive.grey700 }
557
+ }
558
+ ),
559
+ verticalPadding: "extraSmall",
560
+ onPress: () => {
561
+ logging.menuClick({ title: item.contactItemName });
562
+ (0, import_react_native11.openURL)(item.contactUri);
563
+ }
564
+ },
565
+ item.contactItemName
566
+ );
567
+ }) })
568
+ }
569
+ ) });
570
+ });
571
+ };
572
+ return { open: onClickHandler };
573
+ }
574
+ function BottomSheetImpressionArea({ children }) {
575
+ const logging = useMoreButtonBottomSheetLogging();
576
+ (0, import_react6.useEffect)(() => {
577
+ logging.show();
578
+ }, [logging]);
579
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
580
+ }
581
+
582
+ // src/core/utils/safeParseNavigationBar.ts
583
+ function safeParseNavigationBar(navigationBar) {
584
+ if (typeof navigationBar === "object") {
585
+ return navigationBar;
586
+ }
587
+ try {
588
+ return JSON.parse(navigationBar);
589
+ } catch {
590
+ return null;
591
+ }
592
+ }
593
+
205
594
  // src/core/utils/toIcon.ts
206
595
  function toIcon(source) {
207
596
  return source.startsWith("http") ? { source: { uri: source } } : { name: source };
208
597
  }
209
598
 
599
+ // src/core/components/BuiltinNavigationBar/index.tsx
600
+ var import_jsx_runtime3 = require("react/jsx-runtime");
601
+ function BuiltinNavigationBar() {
602
+ const globals = getAppsInTossGlobals();
603
+ const { captureExitLog } = useCaptureExitLog();
604
+ const logging = useBuiltinNavigationBarLogging();
605
+ const { openConfirm } = (0, import_react_native14.useDialog)();
606
+ const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
607
+ const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
608
+ const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
609
+ const withBackButton = parsedNavigationBar?.withBackButton ?? true;
610
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
611
+ const isExternalWebView = globals.webViewType === "external";
612
+ const isGameWebView = globals.webViewType === "game";
613
+ const backEventContext = (0, import_react_native13.useBackEventContext)();
614
+ const overrideCanGoBack = !backEventContext.hasBackEvent;
615
+ const handleBackOrClose = useBackOrCloseNavigation();
616
+ const navigation = (0, import_react_native13.useNavigation)();
617
+ const handlePressTitle = (0, import_react7.useCallback)(() => {
618
+ logging.homeButtonClick();
619
+ if (globals.webViewType != null) {
620
+ import_native_modules7.appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
621
+ return;
622
+ }
623
+ navigation.navigate("/");
624
+ }, [logging, globals.webViewType, navigation]);
625
+ const handleBack = (0, import_react7.useCallback)(() => {
626
+ if (!overrideCanGoBack) {
627
+ backEventContext.onBack();
628
+ return;
629
+ }
630
+ handleBackOrClose();
631
+ }, [overrideCanGoBack, handleBackOrClose, backEventContext]);
632
+ const handleClose = (0, import_react7.useCallback)(async () => {
633
+ logging.closeButtonClick();
634
+ const isConfirmed = await openConfirm({
635
+ title: `${(0, import_es_hangul.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
636
+ leftButton: "\uCDE8\uC18C",
637
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
638
+ closeOnDimmerClick: true,
639
+ onEntered: logging.closePopupShow
640
+ });
641
+ logging.closePopupCtaClick(isConfirmed);
642
+ if (isConfirmed) {
643
+ captureExitLog(Date.now());
644
+ (0, import_react_native13.closeView)();
645
+ }
646
+ }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
647
+ (0, import_react7.useEffect)(() => {
648
+ const backHandler = () => {
649
+ handleClose();
650
+ return true;
651
+ };
652
+ import_react_native15.BackHandler.addEventListener("hardwareBackPress", backHandler);
653
+ return () => {
654
+ import_react_native15.BackHandler.removeEventListener("hardwareBackPress", backHandler);
655
+ };
656
+ }, [handleClose]);
657
+ if (isExternalWebView) {
658
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
659
+ }
660
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
661
+ import_private2.TopNavigation,
662
+ {
663
+ title: globals.brandDisplayName,
664
+ icon: toIcon(globals.brandIcon),
665
+ onPressDots: openMoreButtonBottomSheet,
666
+ contentVisible: isGameWebView ? false : true,
667
+ onPressTitle: withHomeButton ? handlePressTitle : void 0,
668
+ onPressClose: handleClose,
669
+ withHome: withHomeButton,
670
+ fixedRightButton: initialAccessoryButton ? {
671
+ title: initialAccessoryButton.title,
672
+ icon: initialAccessoryButton.icon,
673
+ id: initialAccessoryButton.id
674
+ } : void 0,
675
+ 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
676
+ }
677
+ ) });
678
+ }
679
+ function useBackOrCloseNavigation() {
680
+ const navigation = (0, import_react_native13.useNavigation)();
681
+ return (0, import_react7.useCallback)(() => {
682
+ if (navigation.canGoBack()) {
683
+ navigation.goBack();
684
+ } else {
685
+ (0, import_react_native13.closeView)();
686
+ }
687
+ }, [navigation]);
688
+ }
689
+ function BuiltinNavigationBarImpressionArea({
690
+ children,
691
+ withHomeButton
692
+ }) {
693
+ const hasLogged = (0, import_react7.useRef)(false);
694
+ const logging = useBuiltinNavigationBarLogging();
695
+ (0, import_react7.useEffect)(() => {
696
+ if (hasLogged.current === false) {
697
+ logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
698
+ hasLogged.current = true;
699
+ }
700
+ }, []);
701
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
702
+ }
703
+
210
704
  // src/core/hooks/useAppsInTossBridge.ts
705
+ var import_native_modules8 = require("@apps-in-toss/native-modules");
706
+ var import_react_native16 = require("@toss-design-system/react-native");
707
+ var import_react8 = require("react");
211
708
  function useAppsInTossBridge() {
212
- const controller = (0, import_react_native6.useBridge)();
213
- const appsInTossGlobals2 = getAppsInTossGlobals();
214
- (0, import_react5.useEffect)(() => {
709
+ const controller = (0, import_react_native16.useBridge)();
710
+ const appsInTossGlobals = getAppsInTossGlobals();
711
+ (0, import_react8.useEffect)(() => {
215
712
  const commonProps = {
216
- serviceName: appsInTossGlobals2.brandDisplayName,
217
- icon: toIcon(appsInTossGlobals2.brandIcon),
218
- color: appsInTossGlobals2.brandPrimaryColor,
219
- colorMode: appsInTossGlobals2.brandBridgeColorMode
713
+ serviceName: appsInTossGlobals.brandDisplayName,
714
+ icon: toIcon(appsInTossGlobals.brandIcon),
715
+ color: appsInTossGlobals.brandPrimaryColor,
716
+ colorMode: appsInTossGlobals.brandBridgeColorMode
220
717
  };
221
718
  controller.open({
222
719
  ...commonProps,
223
720
  onExited: () => {
224
- import_native_modules3.appsInTossEvent.emit("entryMessageExited", void 0);
721
+ import_native_modules8.appsInTossEvent.emit("entryMessageExited", void 0);
225
722
  }
226
723
  });
227
724
  }, []);
228
725
  }
229
726
 
230
727
  // src/core/registerApp.tsx
231
- var import_jsx_runtime2 = require("react/jsx-runtime");
728
+ var import_jsx_runtime4 = require("react/jsx-runtime");
232
729
  function AppsInTossContainer(Container, { children, ...initialProps }) {
233
- if (!(0, import_native_modules4.isMinVersionSupported)({
730
+ if (!(0, import_native_modules9.isMinVersionSupported)({
234
731
  android: "5.220.0",
235
732
  ios: "5.221.0"
236
733
  })) {
237
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
238
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.Entry, {}),
239
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.System, { ...initialProps }),
240
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppUpdate, {})
734
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.Entry, {}),
736
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.System, { ...initialProps }),
737
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppUpdate, {})
241
738
  ] });
242
739
  }
243
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
244
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.StayTime, {}),
245
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.Entry, {}),
246
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.System, { ...initialProps }),
247
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native8.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TDSContainer, { ...initialProps, children }) }) })
740
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
741
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.StayTime, {}),
742
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.Entry, {}),
743
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.System, { ...initialProps }),
744
+ /* @__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 }) }) })
248
745
  ] });
249
746
  }
250
747
  function TDSContainer({ children }) {
251
748
  useAppsInTossBridge();
252
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
749
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
253
750
  }
254
751
  function registerApp(container, { context, analytics }) {
255
- import_analytics.Analytics.init({
256
- logger: (params) => void (0, import_native_modules4.eventLog)(params),
257
- debug: analytics?.debug ?? __DEV__
258
- });
259
- const App = import_react_native7.Granite.registerApp(AppsInTossContainer.bind(null, container), {
260
- appName: getAppName(),
261
- context,
262
- setIosSwipeGestureEnabled: import_native_modules4.setIosSwipeGestureEnabled,
263
- router: {
264
- screenContainer: import_analytics.Analytics.Screen,
265
- defaultScreenOption: {
266
- statusBarStyle: "dark"
752
+ const appName = getAppName();
753
+ const isRegistered = import_react_native19.AppRegistry.getAppKeys().includes(appName);
754
+ if (!isRegistered) {
755
+ import_analytics.Analytics.init({
756
+ logger: (params) => void (0, import_native_modules9.eventLog)(params),
757
+ debug: analytics?.debug ?? __DEV__
758
+ });
759
+ const App = import_react_native17.Granite.registerApp(AppsInTossContainer.bind(null, container), {
760
+ appName,
761
+ context,
762
+ setIosSwipeGestureEnabled: import_native_modules9.setIosSwipeGestureEnabled,
763
+ router: {
764
+ screenContainer: AppsInTossScreenContainer,
765
+ defaultScreenOption: {
766
+ statusBarStyle: "dark"
767
+ }
267
768
  }
268
- }
269
- });
270
- global.Page = App;
271
- return App;
769
+ });
770
+ global.Page = App;
771
+ }
772
+ return global.Page;
773
+ }
774
+ function AppsInTossScreenContainer({ children }) {
775
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_analytics.Analytics.Screen, { children: [
776
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BuiltinNavigationBar, {}),
777
+ children
778
+ ] });
272
779
  }
273
780
  function getAppName() {
274
781
  try {
@@ -285,32 +792,29 @@ var AppsInToss = {
285
792
  };
286
793
 
287
794
  // src/components/WebView.tsx
288
- var import_native_modules12 = require("@apps-in-toss/native-modules");
795
+ var import_native_modules17 = require("@apps-in-toss/native-modules");
289
796
  var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
290
797
  var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
291
798
  var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
292
- var import_react_native27 = require("@granite-js/react-native");
799
+ var import_react_native30 = require("@granite-js/react-native");
293
800
  var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridges"), 1);
294
801
  var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
295
- var import_react_native28 = require("@toss-design-system/react-native");
296
- var import_private3 = require("@toss-design-system/react-native/private");
297
- var import_react11 = require("react");
298
- var import_react_native29 = require("react-native");
802
+ var import_react_native31 = require("@toss-design-system/react-native");
803
+ var import_private5 = require("@toss-design-system/react-native/private");
804
+ var import_react15 = require("react");
805
+ var import_react_native32 = require("react-native");
299
806
 
300
807
  // src/components/GameWebView.tsx
301
- var import_native_modules8 = require("@apps-in-toss/native-modules");
808
+ var import_native_modules13 = require("@apps-in-toss/native-modules");
302
809
  var import_react_native_webview = require("@granite-js/native/react-native-webview");
303
- var import_react_native21 = require("@granite-js/react-native");
304
- var import_react_native22 = require("@toss-design-system/react-native");
305
- var import_es_hangul2 = require("es-hangul");
306
- var import_react8 = require("react");
307
- var import_react_native23 = require("react-native");
810
+ var import_react11 = require("react");
811
+ var import_react_native26 = require("react-native");
308
812
 
309
813
  // src/components/GameProfile.tsx
310
- var import_native_modules7 = require("@apps-in-toss/native-modules");
311
- var import_react_native14 = require("@toss-design-system/react-native");
312
- var import_react7 = require("react");
313
- var import_react_native15 = require("react-native");
814
+ var import_native_modules12 = require("@apps-in-toss/native-modules");
815
+ var import_react_native24 = require("@toss-design-system/react-native");
816
+ var import_react10 = require("react");
817
+ var import_react_native25 = require("react-native");
314
818
 
315
819
  // src/constant/game-center.ts
316
820
  var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
@@ -320,23 +824,23 @@ var GAME_CENTER_MIN_VERSION = {
320
824
  };
321
825
 
322
826
  // src/hooks/useGameCenterProfile.ts
323
- var import_native_modules6 = require("@apps-in-toss/native-modules");
324
- var import_react_native12 = require("@granite-js/react-native");
325
- var import_react_native13 = require("@toss-design-system/react-native");
326
- var import_es_hangul = require("es-hangul");
327
- var import_react6 = require("react");
827
+ var import_native_modules11 = require("@apps-in-toss/native-modules");
828
+ var import_react_native22 = require("@granite-js/react-native");
829
+ var import_react_native23 = require("@toss-design-system/react-native");
830
+ var import_es_hangul2 = require("es-hangul");
831
+ var import_react9 = require("react");
328
832
 
329
833
  // src/components/GameProfileToast.tsx
330
- var import_react_native9 = require("@toss-design-system/react-native");
331
- var import_private = require("@toss-design-system/react-native/private");
332
- var import_jsx_runtime3 = require("react/jsx-runtime");
834
+ var import_react_native20 = require("@toss-design-system/react-native");
835
+ var import_private3 = require("@toss-design-system/react-native/private");
836
+ var import_jsx_runtime5 = require("react/jsx-runtime");
333
837
  var useGameProfileToast = () => {
334
- const overlay = (0, import_private.useOverlay)();
838
+ const overlay = (0, import_private3.useOverlay)();
335
839
  const openGameProfileToast = (nickname, profileImageUri) => {
336
840
  return new Promise((resolve) => {
337
841
  overlay.open(({ isOpen, close, exit }) => {
338
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
339
- import_react_native9.Toast,
842
+ 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)(
843
+ import_react_native20.Toast,
340
844
  {
341
845
  open: isOpen,
342
846
  onClose: () => {
@@ -346,11 +850,11 @@ var useGameProfileToast = () => {
346
850
  onExited: exit,
347
851
  position: "top",
348
852
  text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
349
- icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
350
- import_react_native9.Asset.Image,
853
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
854
+ import_react_native20.Asset.Image,
351
855
  {
352
856
  style: { borderRadius: 64, overflow: "hidden" },
353
- frameShape: import_react_native9.Asset.frameShape.CleanW32,
857
+ frameShape: import_react_native20.Asset.frameShape.CleanW32,
354
858
  source: { uri: profileImageUri }
355
859
  }
356
860
  )
@@ -368,20 +872,12 @@ var DEFAULT_ERROR = {
368
872
  description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
369
873
  };
370
874
 
371
- // src/utils/market.ts
372
- var import_react_native10 = require("react-native");
373
- var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
374
- var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
375
- var getMarketLink = () => {
376
- return import_react_native10.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
377
- };
378
-
379
875
  // src/utils/openTransparentWebView.ts
380
- var import_react_native11 = require("@granite-js/react-native");
876
+ var import_react_native21 = require("@granite-js/react-native");
381
877
 
382
878
  // src/private.ts
383
- var import_native_modules5 = require("@apps-in-toss/native-modules");
384
- var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules5.onVisibilityChangedByTransparentServiceWeb;
879
+ var import_native_modules10 = require("@apps-in-toss/native-modules");
880
+ var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules10.onVisibilityChangedByTransparentServiceWeb;
385
881
 
386
882
  // src/utils/openTransparentWebView.ts
387
883
  var openTransparentWebView = ({
@@ -411,29 +907,29 @@ var openTransparentWebView = ({
411
907
  }
412
908
  }
413
909
  });
414
- (0, import_react_native11.openURL)(url.toString());
910
+ (0, import_react_native21.openURL)(url.toString());
415
911
  };
416
912
 
417
913
  // src/hooks/useGameCenterProfile.ts
418
914
  var useGameCenterProfile = (isReadyForProfileUI) => {
419
- const [profileData, setProfileData] = (0, import_react6.useState)(void 0);
420
- const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react6.useState)(true);
421
- const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react6.useState)(false);
915
+ const [profileData, setProfileData] = (0, import_react9.useState)(void 0);
916
+ const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react9.useState)(true);
917
+ const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react9.useState)(false);
422
918
  const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
423
919
  const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
424
920
  const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
425
- const [isWebviewLoading, setIsWebviewLoading] = (0, import_react6.useState)(false);
426
- const isCompletedProfileFlow = (0, import_react6.useRef)(false);
427
- const { openAlert, openConfirm } = (0, import_react_native13.useDialog)();
921
+ const [isWebviewLoading, setIsWebviewLoading] = (0, import_react9.useState)(false);
922
+ const isCompletedProfileFlow = (0, import_react9.useRef)(false);
923
+ const { openAlert, openConfirm } = (0, import_react_native23.useDialog)();
428
924
  const { openGameProfileToast } = useGameProfileToast();
429
- const openErrorAlert = (0, import_react6.useCallback)(async () => {
925
+ const openErrorAlert = (0, import_react9.useCallback)(async () => {
430
926
  await openAlert({
431
927
  title: DEFAULT_ERROR.title,
432
928
  description: DEFAULT_ERROR.description
433
929
  });
434
- (0, import_react_native12.closeView)();
930
+ (0, import_react_native22.closeView)();
435
931
  }, [openAlert]);
436
- const openProfileWebview = (0, import_react6.useCallback)(() => {
932
+ const openProfileWebview = (0, import_react9.useCallback)(() => {
437
933
  if (isWebviewLoading) {
438
934
  return;
439
935
  }
@@ -445,7 +941,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
445
941
  try {
446
942
  setIsWebviewLoading(false);
447
943
  setIsProfileDataRefetching(true);
448
- const data = await (0, import_native_modules6.getGameCenterGameProfile)();
944
+ const data = await (0, import_native_modules11.getGameCenterGameProfile)();
449
945
  setProfileData(data);
450
946
  setIsProfileDataRefetching(false);
451
947
  if (data?.statusCode === "SUCCESS") {
@@ -462,9 +958,9 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
462
958
  }
463
959
  });
464
960
  }, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
465
- const updateAppToSupportedMinVersion = (0, import_react6.useCallback)(async () => {
961
+ const updateAppToSupportedMinVersion = (0, import_react9.useCallback)(async () => {
466
962
  const upddateConfirmDialogLabel = {
467
- title: `${(0, import_es_hangul.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
963
+ title: `${(0, import_es_hangul2.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
468
964
  \uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
469
965
  leftButton: "\uB2EB\uAE30",
470
966
  rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
@@ -476,11 +972,11 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
476
972
  closeOnDimmerClick: true
477
973
  });
478
974
  if (!isConfirmed) {
479
- (0, import_react_native12.closeView)();
975
+ (0, import_react_native22.closeView)();
480
976
  return;
481
977
  }
482
978
  const STORE_SCHEME = getMarketLink();
483
- (0, import_react_native12.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
979
+ (0, import_react_native22.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
484
980
  }, [openConfirm]);
485
981
  return {
486
982
  profileData,
@@ -509,7 +1005,7 @@ var Z_INDEX = {
509
1005
  };
510
1006
 
511
1007
  // src/components/GameProfile.tsx
512
- var import_jsx_runtime4 = require("react/jsx-runtime");
1008
+ var import_jsx_runtime6 = require("react/jsx-runtime");
513
1009
  var GameProfile = ({ children, isReadyForProfileUI }) => {
514
1010
  const {
515
1011
  profileData,
@@ -525,10 +1021,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
525
1021
  openErrorAlert,
526
1022
  openGameProfileToast
527
1023
  } = useGameCenterProfile(isReadyForProfileUI);
528
- (0, import_react7.useEffect)(() => {
1024
+ (0, import_react10.useEffect)(() => {
529
1025
  try {
530
1026
  const getProfileData = async () => {
531
- const data = await (0, import_native_modules7.getGameCenterGameProfile)();
1027
+ const data = await (0, import_native_modules12.getGameCenterGameProfile)();
532
1028
  setProfileData(data);
533
1029
  setIsProfileDataLoading(false);
534
1030
  };
@@ -538,7 +1034,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
538
1034
  setIsProfileDataLoading(false);
539
1035
  }
540
1036
  }, []);
541
- (0, import_react7.useEffect)(() => {
1037
+ (0, import_react10.useEffect)(() => {
542
1038
  const handleGameProfileFlow = async () => {
543
1039
  if (!canShowBottomSheetOrToast) {
544
1040
  return;
@@ -547,7 +1043,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
547
1043
  return;
548
1044
  }
549
1045
  isCompletedProfileFlow.current = true;
550
- if (!(0, import_native_modules7.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1046
+ if (!(0, import_native_modules12.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
551
1047
  updateAppToSupportedMinVersion();
552
1048
  return;
553
1049
  }
@@ -568,11 +1064,11 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
568
1064
  profileData,
569
1065
  updateAppToSupportedMinVersion
570
1066
  ]);
571
- if (!(0, import_native_modules7.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
572
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
573
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }),
574
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
575
- import_react_native15.Pressable,
1067
+ if (!(0, import_native_modules12.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1068
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1069
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1070
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1071
+ import_react_native25.Pressable,
576
1072
  {
577
1073
  style: {
578
1074
  ...overlayStyle
@@ -585,10 +1081,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
585
1081
  ] });
586
1082
  }
587
1083
  if (shouldShowLoadingOverlay || isProfileDataRefetching) {
588
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
589
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }),
590
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
591
- import_react_native15.View,
1084
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1085
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1086
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1087
+ import_react_native25.View,
592
1088
  {
593
1089
  style: {
594
1090
  ...overlayStyle,
@@ -596,16 +1092,16 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
596
1092
  alignItems: "center",
597
1093
  backgroundColor: "rgba(0, 0, 0, 0.2)"
598
1094
  },
599
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native14.Loader, { size: "large", type: "light" })
1095
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native24.Loader, { size: "large", type: "light" })
600
1096
  }
601
1097
  )
602
1098
  ] });
603
1099
  }
604
1100
  if (shouldShowProfileNotFoundOverlay) {
605
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
606
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }),
607
- shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
608
- import_react_native15.Pressable,
1101
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1102
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1103
+ shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1104
+ import_react_native25.Pressable,
609
1105
  {
610
1106
  style: {
611
1107
  ...overlayStyle
@@ -617,7 +1113,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
617
1113
  )
618
1114
  ] });
619
1115
  }
620
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }) });
1116
+ 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 }) });
621
1117
  };
622
1118
  var overlayStyle = {
623
1119
  position: "absolute",
@@ -628,155 +1124,58 @@ var overlayStyle = {
628
1124
  zIndex: Z_INDEX.PROFILE_OVERLAY
629
1125
  };
630
1126
 
631
- // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
632
- var import_react_native_svg = require("@granite-js/native/react-native-svg");
633
- var import_react_native19 = require("@toss-design-system/react-native");
634
- var import_react_native20 = require("react-native");
635
-
636
- // src/components/GameWebViewNavigationBar/HeaderRight.tsx
637
- var import_react_native17 = require("react-native");
638
-
639
- // src/components/GameWebViewNavigationBar/byPlatform.ts
640
- var import_react_native16 = require("react-native");
641
- function byPlatform({
642
- ...props
643
- }) {
644
- return (props[import_react_native16.Platform.OS] ?? props.fallback)();
645
- }
646
-
647
- // src/components/GameWebViewNavigationBar/constants.ts
648
- var RIGHT_MARGIN = 24;
649
- var IOS_DEFAULT_MARGIN = 20;
650
-
651
- // src/components/GameWebViewNavigationBar/HeaderRight.tsx
652
- var import_jsx_runtime5 = require("react/jsx-runtime");
653
- function IOSHeaderRight(props) {
654
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native17.View, { style: styles.ios, ...props });
655
- }
656
- function AndroidHeaderRight(props) {
657
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native17.View, { style: styles.android, ...props });
658
- }
659
- function HeaderRight(props) {
660
- return byPlatform({
661
- ios: () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IOSHeaderRight, { ...props }),
662
- android: () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AndroidHeaderRight, { ...props }),
663
- fallback: () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IOSHeaderRight, { ...props })
664
- });
665
- }
666
- var styles = import_react_native17.StyleSheet.create({
667
- ios: {
668
- marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
669
- flexDirection: "row"
670
- },
671
- android: {
672
- flexDirection: "row"
673
- }
674
- });
675
-
676
- // src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
677
- var import_react_native_safe_area_context = require("@granite-js/native/react-native-safe-area-context");
678
- var import_react_native18 = require("react-native");
679
- function useSafeAreaTop() {
680
- const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
681
- const hasDynamicIsland = import_react_native18.Platform.OS === "ios" && safeAreaInsets.top > 50;
682
- const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
683
- return safeAreaTop;
684
- }
685
-
686
- // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
687
- var import_jsx_runtime6 = require("react/jsx-runtime");
688
- var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xmlns="https://www.w3.org/2000/svg"><rect fill="#031832" fill-opacity=".46" height="30" rx="15" width="30"/><rect height="29.5" rx="14.75" stroke="#d9d9ff" stroke-opacity=".11" stroke-width=".5" width="29.5" x=".25" y=".25"/><path clip-rule="evenodd" d="m16.5119 15.0014 4.7092-4.7092c.0929-.0928.1666-.2031.2169-.32441.0503-.12134.0762-.25141.0762-.38276.0001-.13136-.0258-.26144-.076-.38281s-.1239-.23166-.2167-.32457c-.0929-.09291-.2031-.16662-.3245-.21692-.1213-.05031-.2514-.07622-.3827-.07626-.1314-.00004-.2615.0258-.3828.07603-.1214.05023-.2317.12388-.3246.21673l-4.7092 4.70997-4.71-4.70997c-.1897-.17718-.4408-.27373-.70034-.26927s-.5072.10959-.69069.2932c-.1835.1836-.28848.43132-.29279.69087-.00432.25954.09238.51057.26968.70017l4.71004 4.7092-4.71004 4.7092c-.1392.1401-.23385.3183-.27204.5121-.0382.1939-.01823.3946.05739.5771s.20351.3386.36759.4486.35702.169.55456.1697c.25583 0 .51164-.0975.70664-.2925l4.71-4.71 4.7092 4.71c.0927.093.2029.1668.3243.2172.1213.0504.2514.0763.3828.0763s.2614-.0259.3828-.0763c.1213-.0504.2315-.1242.3243-.2172.0929-.0929.1667-.2032.217-.3246s.0762-.2515.0762-.3829-.0259-.2616-.0762-.383-.1241-.2317-.217-.3245z" fill="#fdfdfe" fill-opacity=".89" fill-rule="evenodd"/></svg>';
689
- function GameNavigationBar({ onClose }) {
690
- const safeAreaTop = useSafeAreaTop();
691
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
692
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native19.PageNavbar, { preference: { type: "none" } }),
693
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
694
- import_react_native20.View,
695
- {
696
- style: {
697
- width: "100%",
698
- height: import_react_native20.Platform.OS === "ios" ? 44 : 54,
699
- flexDirection: "row",
700
- alignItems: "center",
701
- justifyContent: "flex-end",
702
- position: "absolute",
703
- zIndex: Z_INDEX.CLOSE_BUTTON,
704
- marginTop: safeAreaTop,
705
- paddingRight: import_react_native20.Platform.OS === "ios" ? 10 : 8
706
- },
707
- pointerEvents: "box-none",
708
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
709
- import_react_native20.TouchableOpacity,
710
- {
711
- hitSlop: { left: 8, right: 8 },
712
- accessibilityRole: "button",
713
- accessible: true,
714
- accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
715
- style: {
716
- padding: import_react_native20.Platform.OS === "ios" ? 7 : 9
717
- },
718
- onPress: onClose,
719
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
720
- }
721
- ) })
722
- }
723
- )
724
- ] });
725
- }
726
-
727
1127
  // src/components/GameWebView.tsx
728
1128
  var import_jsx_runtime7 = require("react/jsx-runtime");
729
- var GameWebView = (0, import_react8.forwardRef)(function GameWebView2(props, ref) {
730
- const { openConfirm } = (0, import_react_native22.useDialog)();
731
- const { brandDisplayName } = getAppsInTossGlobals();
732
- const { captureExitLog } = useCaptureExitLog();
733
- const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react8.useState)(false);
734
- const handleClose = (0, import_react8.useCallback)(async () => {
735
- const isConfirmed = await openConfirm({
736
- title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
737
- leftButton: "\uCDE8\uC18C",
738
- rightButton: "\uC885\uB8CC\uD558\uAE30",
739
- closeOnDimmerClick: true
740
- });
741
- if (isConfirmed) {
742
- captureExitLog(Date.now());
743
- (0, import_react_native21.closeView)();
744
- }
745
- }, [brandDisplayName, captureExitLog, openConfirm]);
746
- (0, import_react8.useEffect)(() => {
747
- if (import_react_native23.Platform.OS === "ios") {
748
- (0, import_native_modules8.setIosSwipeGestureEnabled)({ isEnabled: false });
1129
+ var GameWebView = (0, import_react11.forwardRef)(function GameWebView2(props, ref) {
1130
+ const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react11.useState)(false);
1131
+ (0, import_react11.useEffect)(() => {
1132
+ if (import_react_native26.Platform.OS === "ios") {
1133
+ (0, import_native_modules13.setIosSwipeGestureEnabled)({ isEnabled: false });
749
1134
  return () => {
750
- (0, import_native_modules8.setIosSwipeGestureEnabled)({ isEnabled: true });
1135
+ (0, import_native_modules13.setIosSwipeGestureEnabled)({ isEnabled: true });
751
1136
  };
752
1137
  }
753
1138
  return;
754
1139
  }, []);
755
- (0, import_react8.useEffect)(() => {
756
- const backHandler = () => {
757
- handleClose();
758
- return true;
759
- };
760
- import_react_native23.BackHandler.addEventListener("hardwareBackPress", backHandler);
761
- return () => {
762
- import_react_native23.BackHandler.removeEventListener("hardwareBackPress", backHandler);
763
- };
764
- }, [handleClose]);
765
- (0, import_react8.useEffect)(() => {
766
- import_native_modules8.appsInTossEvent.addEventListener("entryMessageExited", {
1140
+ (0, import_react11.useEffect)(() => {
1141
+ import_native_modules13.appsInTossEvent.addEventListener("entryMessageExited", {
767
1142
  onEvent: () => {
768
1143
  setIsEntryMessageExited(true);
769
1144
  }
770
1145
  });
771
1146
  }, []);
772
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
773
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GameNavigationBar, { onClose: handleClose }),
774
- (0, import_native_modules8.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 })
775
- ] });
1147
+ 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 }) });
776
1148
  });
777
1149
 
1150
+ // src/components/PartnerWebView.tsx
1151
+ var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
1152
+ var import_react12 = require("react");
1153
+
1154
+ // src/core/utils/mergeRefs.ts
1155
+ function mergeRefs(...refs) {
1156
+ return (value) => {
1157
+ refs.forEach((ref) => {
1158
+ if (typeof ref === "function") {
1159
+ ref(value);
1160
+ } else if (ref != null) {
1161
+ ref.current = value;
1162
+ }
1163
+ });
1164
+ };
1165
+ }
1166
+
1167
+ // src/components/PartnerWebView.tsx
1168
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1169
+ var PartnerWebView = (0, import_react12.forwardRef)(
1170
+ function PartnerWebViewScreen(webViewProps, ref) {
1171
+ const webViewRef = (0, import_react12.useRef)(null);
1172
+ const refs = mergeRefs(ref, webViewRef);
1173
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_webview2.WebView, { ref: refs, ...webViewProps, style: { flex: 1 } });
1174
+ }
1175
+ );
1176
+
778
1177
  // src/bridge-handler/useBridgeHandler.tsx
779
- var import_react9 = require("react");
1178
+ var import_react13 = require("react");
780
1179
  function serializeError(error) {
781
1180
  return JSON.stringify(error, (_, value) => {
782
1181
  if (value instanceof Error) {
@@ -825,8 +1224,8 @@ function useBridgeHandler({
825
1224
  eventListenerMap,
826
1225
  injectedJavaScript: originalInjectedJavaScript
827
1226
  }) {
828
- const ref = (0, import_react9.useRef)(null);
829
- const injectedJavaScript = (0, import_react9.useMemo)(
1227
+ const ref = (0, import_react13.useRef)(null);
1228
+ const injectedJavaScript = (0, import_react13.useMemo)(
830
1229
  () => [
831
1230
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
832
1231
  Object.entries(constantHandlerMap).reduce(
@@ -852,7 +1251,7 @@ function useBridgeHandler({
852
1251
  window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
853
1252
  `);
854
1253
  };
855
- const $onMessage = (0, import_react9.useCallback)(
1254
+ const $onMessage = (0, import_react13.useCallback)(
856
1255
  async (e) => {
857
1256
  onMessage?.(e);
858
1257
  const data = JSON.parse(e.nativeEvent.data);
@@ -903,8 +1302,8 @@ function useBridgeHandler({
903
1302
  }
904
1303
 
905
1304
  // src/hooks/useCreateUserAgent.ts
906
- var import_native_modules9 = require("@apps-in-toss/native-modules");
907
- var import_react_native24 = require("react-native");
1305
+ var import_native_modules14 = require("@apps-in-toss/native-modules");
1306
+ var import_react_native27 = require("react-native");
908
1307
  var FontA11yCategory = {
909
1308
  Large: "Large",
910
1309
  xLarge: "xLarge",
@@ -1037,9 +1436,9 @@ function useCreateUserAgent({
1037
1436
  safeArea,
1038
1437
  safeAreaBottomTransparency
1039
1438
  }) {
1040
- const platform = (0, import_native_modules9.getPlatformOS)();
1041
- const appVersion = (0, import_native_modules9.getTossAppVersion)();
1042
- const { fontScale } = (0, import_react_native24.useWindowDimensions)();
1439
+ const platform = (0, import_native_modules14.getPlatformOS)();
1440
+ const appVersion = (0, import_native_modules14.getTossAppVersion)();
1441
+ const { fontScale } = (0, import_react_native27.useWindowDimensions)();
1043
1442
  const platformString = platform === "ios" ? "iPhone" : "Android";
1044
1443
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
1045
1444
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
@@ -1059,17 +1458,17 @@ function useCreateUserAgent({
1059
1458
  }
1060
1459
 
1061
1460
  // src/hooks/useGeolocation.ts
1062
- var import_native_modules10 = require("@apps-in-toss/native-modules");
1063
- var import_react_native25 = require("@granite-js/react-native");
1064
- var import_react10 = require("react");
1461
+ var import_native_modules15 = require("@apps-in-toss/native-modules");
1462
+ var import_react_native28 = require("@granite-js/react-native");
1463
+ var import_react14 = require("react");
1065
1464
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1066
- const isVisible = (0, import_react_native25.useVisibility)();
1067
- const [location, setLocation] = (0, import_react10.useState)(null);
1068
- (0, import_react10.useEffect)(() => {
1465
+ const isVisible = (0, import_react_native28.useVisibility)();
1466
+ const [location, setLocation] = (0, import_react14.useState)(null);
1467
+ (0, import_react14.useEffect)(() => {
1069
1468
  if (!isVisible) {
1070
1469
  return;
1071
1470
  }
1072
- return (0, import_native_modules10.startUpdateLocation)({
1471
+ return (0, import_native_modules15.startUpdateLocation)({
1073
1472
  options: {
1074
1473
  accuracy,
1075
1474
  distanceInterval,
@@ -1083,8 +1482,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1083
1482
  }
1084
1483
 
1085
1484
  // src/utils/log.ts
1086
- var import_native_modules11 = require("@apps-in-toss/native-modules");
1087
- var import_react_native26 = require("@granite-js/react-native");
1485
+ var import_native_modules16 = require("@apps-in-toss/native-modules");
1486
+ var import_react_native29 = require("@granite-js/react-native");
1088
1487
 
1089
1488
  // src/utils/extractDateFromUUIDv7.ts
1090
1489
  var extractDateFromUUIDv7 = (uuid) => {
@@ -1110,7 +1509,7 @@ var getGroupId = (url) => {
1110
1509
  };
1111
1510
  var getReferrer = () => {
1112
1511
  try {
1113
- const referrer = new URL((0, import_react_native26.getSchemeUri)());
1512
+ const referrer = new URL((0, import_react_native29.getSchemeUri)());
1114
1513
  return referrer.searchParams.get("referrer");
1115
1514
  } catch {
1116
1515
  return "";
@@ -1128,22 +1527,21 @@ var trackScreen = (url) => {
1128
1527
  deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1129
1528
  }
1130
1529
  };
1131
- return (0, import_native_modules11.eventLog)(log);
1530
+ return (0, import_native_modules16.eventLog)(log);
1132
1531
  };
1133
1532
 
1134
1533
  // src/components/WebView.tsx
1135
- var import_jsx_runtime8 = require("react/jsx-runtime");
1136
- var appsInTossGlobals = getAppsInTossGlobals();
1534
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1137
1535
  var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
1138
1536
  var TYPES = ["partner", "external", "game"];
1139
1537
  var WEBVIEW_TYPES = {
1140
- partner: import_react_native28.PartnerWebViewScreen,
1141
- external: import_react_native28.ExternalWebViewScreen,
1538
+ partner: PartnerWebView,
1539
+ external: import_react_native31.ExternalWebViewScreen,
1142
1540
  game: GameWebView
1143
1541
  };
1144
1542
  function mergeSchemeQueryParamsInto(url) {
1145
1543
  const baseUrl = new URL(url);
1146
- const schemeUrl = new URL((0, import_react_native27.getSchemeUri)());
1544
+ const schemeUrl = new URL((0, import_react_native30.getSchemeUri)());
1147
1545
  baseUrl.pathname = schemeUrl.pathname;
1148
1546
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1149
1547
  baseUrl.searchParams.set(key, value);
@@ -1155,7 +1553,7 @@ function getWebViewUri(local) {
1155
1553
  const devUrl = `http://${local.host}:${local.port}`;
1156
1554
  return mergeSchemeQueryParamsInto(devUrl).toString();
1157
1555
  }
1158
- const { url: rawUrl } = import_native_modules12.AppsInTossModule.getWebBundleURL({});
1556
+ const { url: rawUrl } = import_native_modules17.AppsInTossModule.getWebBundleURL({});
1159
1557
  const url = mergeSchemeQueryParamsInto(rawUrl);
1160
1558
  const deploymentId = env.getDeploymentId();
1161
1559
  if (deploymentId) {
@@ -1167,12 +1565,12 @@ function WebView({ type, local, onMessage, ...props }) {
1167
1565
  if (!TYPES.includes(type)) {
1168
1566
  throw new Error(`Invalid WebView type: '${type}'`);
1169
1567
  }
1170
- const graniteEvent = (0, import_react_native27.useGraniteEvent)();
1171
- const uri = (0, import_react11.useMemo)(() => getWebViewUri(local), [local]);
1172
- const top = (0, import_private3.useSafeAreaTop)();
1173
- const bottom = (0, import_private3.useSafeAreaBottom)();
1568
+ const graniteEvent = (0, import_react_native30.useGraniteEvent)();
1569
+ const uri = (0, import_react15.useMemo)(() => getWebViewUri(local), [local]);
1570
+ const top = (0, import_private5.useSafeAreaTop)();
1571
+ const bottom = (0, import_private5.useSafeAreaBottom)();
1174
1572
  const global2 = getAppsInTossGlobals();
1175
- const partner = (0, import_react_native28.usePartnerNavigation)();
1573
+ const topNavigation = (0, import_private5.useTopNavigation)();
1176
1574
  const disableTextSelectionCSS = `
1177
1575
  (function() {
1178
1576
  const style = document.createElement('style');
@@ -1180,7 +1578,7 @@ function WebView({ type, local, onMessage, ...props }) {
1180
1578
  document.head.appendChild(style);
1181
1579
  })();
1182
1580
  `;
1183
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react11.useState)(
1581
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react15.useState)(
1184
1582
  props.allowsBackForwardNavigationGestures
1185
1583
  );
1186
1584
  const handler = useBridgeHandler({
@@ -1189,20 +1587,20 @@ function WebView({ type, local, onMessage, ...props }) {
1189
1587
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1190
1588
  eventListenerMap: {
1191
1589
  ...appsInTossEventBridges,
1192
- navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native28.tdsEvent.addEventListener("navigationAccessoryEvent", {
1193
- onEvent,
1194
- onError
1195
- }),
1590
+ navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native31.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1196
1591
  backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1197
- entryMessageExited: ({ onEvent, onError }) => import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1198
- updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules12.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1592
+ entryMessageExited: ({ onEvent, onError }) => import_native_modules17.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1593
+ updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1199
1594
  /** @internal */
1200
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules12.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1595
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1201
1596
  /** AdMob */
1202
- loadAdMobInterstitialAd: import_native_modules12.GoogleAdMob.loadAdMobInterstitialAd,
1203
- showAdMobInterstitialAd: import_native_modules12.GoogleAdMob.showAdMobInterstitialAd,
1204
- loadAdMobRewardedAd: import_native_modules12.GoogleAdMob.loadAdMobRewardedAd,
1205
- showAdMobRewardedAd: import_native_modules12.GoogleAdMob.showAdMobRewardedAd
1597
+ loadAdMobInterstitialAd: import_native_modules17.GoogleAdMob.loadAdMobInterstitialAd,
1598
+ showAdMobInterstitialAd: import_native_modules17.GoogleAdMob.showAdMobInterstitialAd,
1599
+ loadAdMobRewardedAd: import_native_modules17.GoogleAdMob.loadAdMobRewardedAd,
1600
+ showAdMobRewardedAd: import_native_modules17.GoogleAdMob.showAdMobRewardedAd,
1601
+ /** AdMobV2 */
1602
+ loadAppsInTossAdMob: import_native_modules17.GoogleAdMob.loadAppsInTossAdMob,
1603
+ showAppsInTossAdMob: import_native_modules17.GoogleAdMob.showAppsInTossAdMob
1206
1604
  },
1207
1605
  constantHandlerMap: {
1208
1606
  ...graniteConstantBridges,
@@ -1211,10 +1609,13 @@ function WebView({ type, local, onMessage, ...props }) {
1211
1609
  getSafeAreaBottom: () => bottom,
1212
1610
  ...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
1213
1611
  /** AdMob */
1214
- loadAdMobInterstitialAd_isSupported: import_native_modules12.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1215
- showAdMobInterstitialAd_isSupported: import_native_modules12.GoogleAdMob.showAdMobInterstitialAd.isSupported,
1216
- loadAdMobRewardedAd_isSupported: import_native_modules12.GoogleAdMob.loadAdMobRewardedAd.isSupported,
1217
- showAdMobRewardedAd_isSupported: import_native_modules12.GoogleAdMob.showAdMobRewardedAd.isSupported,
1612
+ loadAdMobInterstitialAd_isSupported: import_native_modules17.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1613
+ showAdMobInterstitialAd_isSupported: import_native_modules17.GoogleAdMob.showAdMobInterstitialAd.isSupported,
1614
+ loadAdMobRewardedAd_isSupported: import_native_modules17.GoogleAdMob.loadAdMobRewardedAd.isSupported,
1615
+ showAdMobRewardedAd_isSupported: import_native_modules17.GoogleAdMob.showAdMobRewardedAd.isSupported,
1616
+ /** AdMobV2 */
1617
+ loadAppsInTossAdMob_isSupported: import_native_modules17.GoogleAdMob.loadAppsInTossAdMob.isSupported,
1618
+ showAppsInTossAdMob_isSupported: import_native_modules17.GoogleAdMob.showAppsInTossAdMob.isSupported,
1218
1619
  /** env */
1219
1620
  getDeploymentId: env.getDeploymentId
1220
1621
  },
@@ -1225,51 +1626,39 @@ function WebView({ type, local, onMessage, ...props }) {
1225
1626
  setAllowsBackForwardNavigationGestures(options.isEnabled);
1226
1627
  return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
1227
1628
  },
1228
- addAccessoryButton: async (params) => partner.addAccessoryButton(params),
1229
- removeAccessoryButton: async () => partner.removeAccessoryButton(),
1629
+ addAccessoryButton: async (params) => topNavigation.addAccessoryButton(params),
1630
+ removeAccessoryButton: async () => topNavigation.removeAccessoryButton(),
1230
1631
  /** internal */
1231
- openPermissionDialog: import_native_modules12.AppsInTossModule.openPermissionDialog,
1632
+ openPermissionDialog: import_native_modules17.AppsInTossModule.openPermissionDialog,
1232
1633
  /** Storage */
1233
- getStorageItem: import_native_modules12.Storage.getItem,
1234
- setStorageItem: import_native_modules12.Storage.setItem,
1235
- removeStorageItem: import_native_modules12.Storage.removeItem,
1236
- clearItems: import_native_modules12.Storage.clearItems,
1634
+ getStorageItem: import_native_modules17.Storage.getItem,
1635
+ setStorageItem: import_native_modules17.Storage.setItem,
1636
+ removeStorageItem: import_native_modules17.Storage.removeItem,
1637
+ clearItems: import_native_modules17.Storage.clearItems,
1237
1638
  /** IAP */
1238
- iapCreateOneTimePurchaseOrder: import_native_modules12.IAP.createOneTimePurchaseOrder,
1239
- iapGetProductItemList: import_native_modules12.IAP.getProductItemList
1639
+ iapCreateOneTimePurchaseOrder: import_native_modules17.IAP.createOneTimePurchaseOrder,
1640
+ iapGetProductItemList: import_native_modules17.IAP.getProductItemList
1240
1641
  }
1241
1642
  });
1242
- const baseProps = (0, import_react11.useMemo)(() => {
1243
- switch (type) {
1244
- case "partner": {
1245
- const headerOnlyProp = {
1246
- header: {
1247
- ..."header" in props ? props.header : {},
1248
- icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
1249
- title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
1250
- }
1251
- };
1252
- return headerOnlyProp;
1253
- }
1254
- case "external": {
1255
- const headerOnlyProp = {
1256
- header: {
1257
- ..."header" in props ? props.header : {},
1258
- icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
1259
- title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
1260
- }
1261
- };
1262
- return headerOnlyProp;
1263
- }
1264
- default: {
1265
- return {};
1266
- }
1643
+ const headerPropForExternalWebView = (0, import_react15.useMemo)(() => {
1644
+ const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1645
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1646
+ const withBackButton = parsedNavigationBar?.withBackButton ?? true;
1647
+ if (type === "external" && initialAccessoryButton != null) {
1648
+ return {
1649
+ header: {
1650
+ withBackButton,
1651
+ title: initialAccessoryButton.title,
1652
+ icon: initialAccessoryButton.icon
1653
+ }
1654
+ };
1267
1655
  }
1268
- }, [type, props]);
1656
+ return {};
1657
+ }, [global2.navigationBar, type]);
1269
1658
  const BaseWebView = WEBVIEW_TYPES[type];
1270
1659
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1271
- const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react11.useState)(false);
1272
- const handleNavigationStateChange = (0, import_react11.useCallback)(
1660
+ const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react15.useState)(false);
1661
+ const handleNavigationStateChange = (0, import_react15.useCallback)(
1273
1662
  (event) => {
1274
1663
  if (event.url) {
1275
1664
  trackScreen(event.url);
@@ -1281,7 +1670,7 @@ function WebView({ type, local, onMessage, ...props }) {
1281
1670
  const userAgent = useCreateUserAgent({
1282
1671
  colorPreference: "light"
1283
1672
  });
1284
- const handleBackEvent = (0, import_react11.useCallback)(() => {
1673
+ const handleBackEvent = (0, import_react15.useCallback)(() => {
1285
1674
  if (canHistoryGoBack) {
1286
1675
  handler.ref.current?.goBack();
1287
1676
  return true;
@@ -1289,16 +1678,28 @@ function WebView({ type, local, onMessage, ...props }) {
1289
1678
  return false;
1290
1679
  }
1291
1680
  }, [canHistoryGoBack, handler]);
1292
- (0, import_react11.useEffect)(() => {
1293
- import_react_native29.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
1294
- return () => import_react_native29.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
1681
+ (0, import_react15.useEffect)(() => {
1682
+ import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
1683
+ return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
1295
1684
  }, [handleBackEvent]);
1296
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1685
+ (0, import_react15.useEffect)(() => {
1686
+ return import_native_modules17.appsInTossEvent.addEventListener("homeIconButtonClickEvent", {
1687
+ onEvent: () => {
1688
+ handler.ref?.current?.injectJavaScript(`
1689
+ (function() {
1690
+ window.history.replaceState(null, '', '/');
1691
+ true;
1692
+ })();
1693
+ `);
1694
+ }
1695
+ });
1696
+ }, [handler.ref]);
1697
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1297
1698
  BaseWebView,
1298
1699
  {
1299
1700
  ref: handler.ref,
1300
1701
  ...props,
1301
- ...baseProps,
1702
+ ...headerPropForExternalWebView,
1302
1703
  source: {
1303
1704
  uri,
1304
1705
  // NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
@@ -1306,7 +1707,7 @@ function WebView({ type, local, onMessage, ...props }) {
1306
1707
  "User-Agent": userAgent
1307
1708
  }
1308
1709
  },
1309
- userAgent: import_react_native29.Platform.OS === "ios" ? userAgent : void 0,
1710
+ userAgent: import_react_native32.Platform.OS === "ios" ? userAgent : void 0,
1310
1711
  sharedCookiesEnabled: true,
1311
1712
  webviewDebuggingEnabled: webViewDebuggingEnabled,
1312
1713
  thirdPartyCookiesEnabled: true,
@@ -1314,20 +1715,15 @@ function WebView({ type, local, onMessage, ...props }) {
1314
1715
  onNavigationStateChange: handleNavigationStateChange,
1315
1716
  injectedJavaScript: handler.injectedJavaScript,
1316
1717
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
1317
- decelerationRate: import_react_native29.Platform.OS === "ios" ? 1 : void 0,
1718
+ decelerationRate: import_react_native32.Platform.OS === "ios" ? 1 : void 0,
1318
1719
  allowsBackForwardNavigationGestures
1319
1720
  }
1320
1721
  );
1321
1722
  }
1322
- function ensureValue(value, name) {
1323
- if (value === void 0) {
1324
- throw new Error(`${name} is required`);
1325
- }
1326
- return value;
1327
- }
1328
1723
 
1329
1724
  // src/index.ts
1330
1725
  __reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
1726
+ var import_private6 = require("@toss-design-system/react-native/private");
1331
1727
  __reExport(src_exports, require("@apps-in-toss/native-modules"), module.exports);
1332
1728
  var Analytics2 = {
1333
1729
  init: import_analytics2.Analytics.init,
@@ -1344,6 +1740,7 @@ var Analytics2 = {
1344
1740
  env,
1345
1741
  useCreateUserAgent,
1346
1742
  useGeolocation,
1743
+ useTopNavigation,
1347
1744
  ...require("@apps-in-toss/analytics"),
1348
1745
  ...require("@apps-in-toss/native-modules")
1349
1746
  });