@apps-in-toss/framework 1.1.1 → 1.1.2
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 +462 -356
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +330 -228
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -149,16 +149,56 @@ function AppUpdate() {
|
|
|
149
149
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
// src/core/
|
|
152
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
153
153
|
import { appsInTossEvent } from "@apps-in-toss/native-modules";
|
|
154
|
+
import { useBridge } from "@toss-design-system/react-native";
|
|
155
|
+
import { useEffect as useEffect4 } from "react";
|
|
156
|
+
|
|
157
|
+
// src/core/utils/getAppsInTossGlobals.ts
|
|
158
|
+
function getAppsInTossGlobals() {
|
|
159
|
+
if (global.__appsInToss == null) {
|
|
160
|
+
throw new Error("invalid apps-in-toss globals");
|
|
161
|
+
}
|
|
162
|
+
return global.__appsInToss;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// src/core/utils/toIcon.ts
|
|
166
|
+
function toIcon(source) {
|
|
167
|
+
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
171
|
+
function useAppsInTossBridge() {
|
|
172
|
+
const controller = useBridge();
|
|
173
|
+
const appsInTossGlobals = getAppsInTossGlobals();
|
|
174
|
+
useEffect4(() => {
|
|
175
|
+
const commonProps = {
|
|
176
|
+
serviceName: appsInTossGlobals.brandDisplayName,
|
|
177
|
+
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
178
|
+
color: appsInTossGlobals.brandPrimaryColor,
|
|
179
|
+
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
180
|
+
};
|
|
181
|
+
controller.open({
|
|
182
|
+
...commonProps,
|
|
183
|
+
onExited: () => {
|
|
184
|
+
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}, []);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// src/components/NavigationBar/RNNavigationBar.tsx
|
|
154
191
|
import { closeView, useBackEventContext, useNavigation } from "@granite-js/react-native";
|
|
155
192
|
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
156
193
|
import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss-design-system/react-native/private";
|
|
157
194
|
import { josa } from "es-hangul";
|
|
158
|
-
import { useCallback as useCallback3, useEffect as
|
|
195
|
+
import { useCallback as useCallback3, useEffect as useEffect7 } from "react";
|
|
159
196
|
import { BackHandler } from "react-native";
|
|
160
197
|
|
|
161
|
-
// src/
|
|
198
|
+
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
199
|
+
import { useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
200
|
+
|
|
201
|
+
// src/components/NavigationBar/common/useNavigationBarLogging.tsx
|
|
162
202
|
import { INTERNAL__module as INTERNAL__module3 } from "@apps-in-toss/native-modules";
|
|
163
203
|
import { Granite as Granite3 } from "@granite-js/react-native";
|
|
164
204
|
var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
|
|
@@ -171,7 +211,7 @@ var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
|
|
|
171
211
|
var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
|
|
172
212
|
var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
|
|
173
213
|
var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
|
|
174
|
-
function
|
|
214
|
+
function useNavigationBarLogging() {
|
|
175
215
|
const referrer = useReferrer();
|
|
176
216
|
const baseParams = {
|
|
177
217
|
referrer,
|
|
@@ -242,12 +282,29 @@ function useBuiltinNavigationBarLogging() {
|
|
|
242
282
|
};
|
|
243
283
|
}
|
|
244
284
|
|
|
285
|
+
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
286
|
+
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
287
|
+
function NavigationBarImpressionArea({
|
|
288
|
+
children,
|
|
289
|
+
withHomeButton
|
|
290
|
+
}) {
|
|
291
|
+
const hasLogged = useRef2(false);
|
|
292
|
+
const logging = useNavigationBarLogging();
|
|
293
|
+
useEffect5(() => {
|
|
294
|
+
if (hasLogged.current === false) {
|
|
295
|
+
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
296
|
+
hasLogged.current = true;
|
|
297
|
+
}
|
|
298
|
+
}, [logging, withHomeButton]);
|
|
299
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children });
|
|
300
|
+
}
|
|
301
|
+
|
|
245
302
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
246
303
|
import { INTERNAL__appBridgeHandler, isMinVersionSupported } from "@apps-in-toss/native-modules";
|
|
247
304
|
import { openURL as openURL3 } from "@granite-js/react-native";
|
|
248
305
|
import { BottomSheet, List, ListHeader, ListRow } from "@toss-design-system/react-native";
|
|
249
306
|
import { useAdaptive, useOverlay } from "@toss-design-system/react-native/private";
|
|
250
|
-
import { useEffect as
|
|
307
|
+
import { useEffect as useEffect6, useState } from "react";
|
|
251
308
|
|
|
252
309
|
// src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
|
|
253
310
|
import { INTERNAL__module as INTERNAL__module4 } from "@apps-in-toss/native-modules";
|
|
@@ -420,16 +477,8 @@ function ensureValue(value, name) {
|
|
|
420
477
|
return value;
|
|
421
478
|
}
|
|
422
479
|
|
|
423
|
-
// src/core/utils/getAppsInTossGlobals.ts
|
|
424
|
-
function getAppsInTossGlobals() {
|
|
425
|
-
if (global.__appsInToss == null) {
|
|
426
|
-
throw new Error("invalid apps-in-toss globals");
|
|
427
|
-
}
|
|
428
|
-
return global.__appsInToss;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
480
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
432
|
-
import { Fragment as
|
|
481
|
+
import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
|
|
433
482
|
var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
|
|
434
483
|
function useMoreButtonBottomSheet() {
|
|
435
484
|
const globals = getAppsInTossGlobals();
|
|
@@ -443,7 +492,7 @@ function useMoreButtonBottomSheet() {
|
|
|
443
492
|
android: "5.226.0",
|
|
444
493
|
ios: "5.226.0"
|
|
445
494
|
});
|
|
446
|
-
|
|
495
|
+
useEffect6(() => {
|
|
447
496
|
if (!isSupported) {
|
|
448
497
|
return;
|
|
449
498
|
}
|
|
@@ -470,17 +519,17 @@ function useMoreButtonBottomSheet() {
|
|
|
470
519
|
logging.close();
|
|
471
520
|
close();
|
|
472
521
|
};
|
|
473
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ jsx3(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx3(
|
|
474
523
|
BottomSheet.Root,
|
|
475
524
|
{
|
|
476
|
-
header: /* @__PURE__ */
|
|
525
|
+
header: /* @__PURE__ */ jsx3(
|
|
477
526
|
ListHeader,
|
|
478
527
|
{
|
|
479
|
-
title: /* @__PURE__ */
|
|
528
|
+
title: /* @__PURE__ */ jsx3(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
|
|
480
529
|
}
|
|
481
530
|
),
|
|
482
531
|
open: isOpen,
|
|
483
|
-
cta: /* @__PURE__ */
|
|
532
|
+
cta: /* @__PURE__ */ jsx3(
|
|
484
533
|
BottomSheet.CTA,
|
|
485
534
|
{
|
|
486
535
|
size: "large",
|
|
@@ -494,11 +543,11 @@ function useMoreButtonBottomSheet() {
|
|
|
494
543
|
),
|
|
495
544
|
onClose: handleClose,
|
|
496
545
|
onExited: exit,
|
|
497
|
-
children: /* @__PURE__ */
|
|
498
|
-
return /* @__PURE__ */
|
|
546
|
+
children: /* @__PURE__ */ jsx3(List, { rowSeparator: "none", children: itemList.map((item) => {
|
|
547
|
+
return /* @__PURE__ */ jsx3(
|
|
499
548
|
ListRow,
|
|
500
549
|
{
|
|
501
|
-
left: /* @__PURE__ */
|
|
550
|
+
left: /* @__PURE__ */ jsx3(
|
|
502
551
|
ListRow.Icon,
|
|
503
552
|
{
|
|
504
553
|
color: globals.brandPrimaryColor,
|
|
@@ -506,7 +555,7 @@ function useMoreButtonBottomSheet() {
|
|
|
506
555
|
type: "background"
|
|
507
556
|
}
|
|
508
557
|
),
|
|
509
|
-
contents: /* @__PURE__ */
|
|
558
|
+
contents: /* @__PURE__ */ jsx3(
|
|
510
559
|
ListRow.Texts,
|
|
511
560
|
{
|
|
512
561
|
type: "1RowTypeA",
|
|
@@ -531,10 +580,10 @@ function useMoreButtonBottomSheet() {
|
|
|
531
580
|
}
|
|
532
581
|
function BottomSheetImpressionArea({ children }) {
|
|
533
582
|
const logging = useMoreButtonBottomSheetLogging();
|
|
534
|
-
|
|
583
|
+
useEffect6(() => {
|
|
535
584
|
logging.show();
|
|
536
585
|
}, [logging]);
|
|
537
|
-
return /* @__PURE__ */
|
|
586
|
+
return /* @__PURE__ */ jsx3(Fragment3, { children });
|
|
538
587
|
}
|
|
539
588
|
|
|
540
589
|
// src/core/utils/safeParseNavigationBar.ts
|
|
@@ -549,47 +598,25 @@ function safeParseNavigationBar(navigationBar) {
|
|
|
549
598
|
}
|
|
550
599
|
}
|
|
551
600
|
|
|
552
|
-
// src/
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
// src/core/components/BuiltinNavigationBar/index.tsx
|
|
558
|
-
import { Fragment as Fragment3, jsx as jsx3 } from "react/jsx-runtime";
|
|
559
|
-
function BuiltinNavigationBar() {
|
|
601
|
+
// src/components/NavigationBar/RNNavigationBar.tsx
|
|
602
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
603
|
+
function RNNavigationBar() {
|
|
560
604
|
const globals = getAppsInTossGlobals();
|
|
561
605
|
const { captureExitLog } = useCaptureExitLog();
|
|
562
|
-
const logging =
|
|
606
|
+
const logging = useNavigationBarLogging();
|
|
563
607
|
const { openConfirm } = useDialog2();
|
|
564
608
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
565
609
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
566
610
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
567
611
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
568
612
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
569
|
-
const isExternalWebView = globals.webViewType === "external";
|
|
570
|
-
const isGameWebView = globals.webViewType === "game";
|
|
571
613
|
const backEventContext = useBackEventContext();
|
|
572
614
|
const handleBackOrClose = useBackOrCloseNavigation();
|
|
573
615
|
const navigation = useNavigation();
|
|
574
616
|
const handlePressTitle = useCallback3(() => {
|
|
575
617
|
logging.homeButtonClick();
|
|
576
|
-
if (globals.webViewType != null) {
|
|
577
|
-
appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
618
|
navigation.navigate("/");
|
|
581
|
-
}, [logging,
|
|
582
|
-
const handleBack = useCallback3(() => {
|
|
583
|
-
if (globals.webViewType != null) {
|
|
584
|
-
appsInTossEvent.emit("backButtonClickEvent", void 0);
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
if (backEventContext.hasBackEvent) {
|
|
588
|
-
backEventContext.onBack();
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
handleBackOrClose();
|
|
592
|
-
}, [globals.webViewType, backEventContext, handleBackOrClose]);
|
|
619
|
+
}, [logging, navigation]);
|
|
593
620
|
const handleClose = useCallback3(async () => {
|
|
594
621
|
logging.closeButtonClick();
|
|
595
622
|
const isConfirmed = await openConfirm({
|
|
@@ -605,26 +632,30 @@ function BuiltinNavigationBar() {
|
|
|
605
632
|
closeView();
|
|
606
633
|
}
|
|
607
634
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
635
|
+
const handleBack = useCallback3(() => {
|
|
636
|
+
if (backEventContext.hasBackEvent) {
|
|
637
|
+
backEventContext.onBack();
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
handleBackOrClose();
|
|
641
|
+
}, [backEventContext, handleBackOrClose]);
|
|
642
|
+
useEffect7(() => {
|
|
643
|
+
const handleAndroidBackEvent = () => {
|
|
644
|
+
handleBack();
|
|
645
|
+
return true;
|
|
646
|
+
};
|
|
647
|
+
BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
614
648
|
return () => {
|
|
615
|
-
BackHandler.removeEventListener("hardwareBackPress",
|
|
649
|
+
BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
616
650
|
};
|
|
617
|
-
}, [
|
|
618
|
-
|
|
619
|
-
return /* @__PURE__ */ jsx3(Fragment3, {});
|
|
620
|
-
}
|
|
621
|
-
return /* @__PURE__ */ jsx3(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx3(
|
|
651
|
+
}, [handleBack]);
|
|
652
|
+
return /* @__PURE__ */ jsx4(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx4(
|
|
622
653
|
TopNavigation,
|
|
623
654
|
{
|
|
624
655
|
title: globals.brandDisplayName,
|
|
625
656
|
icon: toIcon(globals.brandIcon),
|
|
626
657
|
onPressDots: openMoreButtonBottomSheet,
|
|
627
|
-
contentVisible:
|
|
658
|
+
contentVisible: true,
|
|
628
659
|
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
629
660
|
onPressClose: handleClose,
|
|
630
661
|
withHome: withHomeButton,
|
|
@@ -633,7 +664,7 @@ function BuiltinNavigationBar() {
|
|
|
633
664
|
icon: initialAccessoryButton.icon,
|
|
634
665
|
id: initialAccessoryButton.id
|
|
635
666
|
} : void 0,
|
|
636
|
-
children:
|
|
667
|
+
children: /* @__PURE__ */ jsx4(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx4(NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
|
|
637
668
|
}
|
|
638
669
|
) });
|
|
639
670
|
}
|
|
@@ -647,69 +678,32 @@ function useBackOrCloseNavigation() {
|
|
|
647
678
|
captureExitLog(Date.now());
|
|
648
679
|
closeView();
|
|
649
680
|
}
|
|
650
|
-
}, [navigation]);
|
|
651
|
-
}
|
|
652
|
-
function BuiltinNavigationBarImpressionArea({
|
|
653
|
-
children,
|
|
654
|
-
withHomeButton
|
|
655
|
-
}) {
|
|
656
|
-
const hasLogged = useRef2(false);
|
|
657
|
-
const logging = useBuiltinNavigationBarLogging();
|
|
658
|
-
useEffect5(() => {
|
|
659
|
-
if (hasLogged.current === false) {
|
|
660
|
-
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
661
|
-
hasLogged.current = true;
|
|
662
|
-
}
|
|
663
|
-
}, []);
|
|
664
|
-
return /* @__PURE__ */ jsx3(Fragment3, { children });
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
// src/core/hooks/useAppsInTossBridge.ts
|
|
668
|
-
import { appsInTossEvent as appsInTossEvent2 } from "@apps-in-toss/native-modules";
|
|
669
|
-
import { useBridge } from "@toss-design-system/react-native";
|
|
670
|
-
import { useEffect as useEffect6 } from "react";
|
|
671
|
-
function useAppsInTossBridge() {
|
|
672
|
-
const controller = useBridge();
|
|
673
|
-
const appsInTossGlobals = getAppsInTossGlobals();
|
|
674
|
-
useEffect6(() => {
|
|
675
|
-
const commonProps = {
|
|
676
|
-
serviceName: appsInTossGlobals.brandDisplayName,
|
|
677
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
678
|
-
color: appsInTossGlobals.brandPrimaryColor,
|
|
679
|
-
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
680
|
-
};
|
|
681
|
-
controller.open({
|
|
682
|
-
...commonProps,
|
|
683
|
-
onExited: () => {
|
|
684
|
-
appsInTossEvent2.emit("entryMessageExited", void 0);
|
|
685
|
-
}
|
|
686
|
-
});
|
|
687
|
-
}, []);
|
|
681
|
+
}, [captureExitLog, navigation]);
|
|
688
682
|
}
|
|
689
683
|
|
|
690
684
|
// src/core/registerApp.tsx
|
|
691
|
-
import { Fragment as Fragment4, jsx as
|
|
685
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
692
686
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
693
687
|
if (!isMinVersionSupported2({
|
|
694
688
|
android: "5.220.0",
|
|
695
689
|
ios: "5.221.0"
|
|
696
690
|
})) {
|
|
697
691
|
return /* @__PURE__ */ jsxs(Fragment4, { children: [
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ jsx5(AppEvent.Entry, {}),
|
|
693
|
+
/* @__PURE__ */ jsx5(AppEvent.System, { ...initialProps }),
|
|
694
|
+
/* @__PURE__ */ jsx5(AppUpdate, {})
|
|
701
695
|
] });
|
|
702
696
|
}
|
|
703
697
|
return /* @__PURE__ */ jsxs(Fragment4, { children: [
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ jsx5(AppEvent.StayTime, {}),
|
|
699
|
+
/* @__PURE__ */ jsx5(AppEvent.Entry, {}),
|
|
700
|
+
/* @__PURE__ */ jsx5(AppEvent.System, { ...initialProps }),
|
|
701
|
+
/* @__PURE__ */ jsx5(Container, { ...initialProps, children: /* @__PURE__ */ jsx5(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx5(TDSContainer, { ...initialProps, children }) }) })
|
|
708
702
|
] });
|
|
709
703
|
}
|
|
710
704
|
function TDSContainer({ children }) {
|
|
711
705
|
useAppsInTossBridge();
|
|
712
|
-
return /* @__PURE__ */
|
|
706
|
+
return /* @__PURE__ */ jsx5(Fragment4, { children });
|
|
713
707
|
}
|
|
714
708
|
function registerApp(container, { context, analytics }) {
|
|
715
709
|
const appName = getAppName();
|
|
@@ -735,8 +729,9 @@ function registerApp(container, { context, analytics }) {
|
|
|
735
729
|
return global.Page;
|
|
736
730
|
}
|
|
737
731
|
function AppsInTossScreenContainer({ children }) {
|
|
732
|
+
const isReactNativeService = getAppsInTossGlobals().webViewType == null;
|
|
738
733
|
return /* @__PURE__ */ jsxs(Analytics.Screen, { children: [
|
|
739
|
-
/* @__PURE__ */
|
|
734
|
+
isReactNativeService && /* @__PURE__ */ jsx5(RNNavigationBar, {}),
|
|
740
735
|
children
|
|
741
736
|
] });
|
|
742
737
|
}
|
|
@@ -755,39 +750,34 @@ var AppsInToss = {
|
|
|
755
750
|
};
|
|
756
751
|
|
|
757
752
|
// src/components/WebView.tsx
|
|
758
|
-
import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as
|
|
753
|
+
import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInTossEvent5 } from "@apps-in-toss/native-modules";
|
|
759
754
|
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
760
755
|
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
761
756
|
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
762
|
-
import {
|
|
757
|
+
import { getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/react-native";
|
|
763
758
|
import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
|
|
764
759
|
import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
|
|
765
|
-
import {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
} from "@toss-design-system/react-native";
|
|
770
|
-
import { useSafeAreaBottom, useSafeAreaTop, useTopNavigation } from "@toss-design-system/react-native/private";
|
|
771
|
-
import { josa as josa3 } from "es-hangul";
|
|
772
|
-
import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo3, useState as useState5 } from "react";
|
|
773
|
-
import { BackHandler as BackHandler2, Platform as Platform3 } from "react-native";
|
|
760
|
+
import { ExternalWebViewScreen, tdsEvent } from "@toss-design-system/react-native";
|
|
761
|
+
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2, useTopNavigation } from "@toss-design-system/react-native/private";
|
|
762
|
+
import { useCallback as useCallback9, useMemo as useMemo3, useState as useState5 } from "react";
|
|
763
|
+
import { Platform as Platform4 } from "react-native";
|
|
774
764
|
|
|
775
765
|
// src/components/GameWebView.tsx
|
|
776
|
-
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as
|
|
766
|
+
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent2, getOperationalEnvironment } from "@apps-in-toss/native-modules";
|
|
777
767
|
import {
|
|
778
768
|
WebView as PlainWebView
|
|
779
769
|
} from "@granite-js/native/react-native-webview";
|
|
780
|
-
import { forwardRef, useEffect as
|
|
781
|
-
import { Platform as
|
|
770
|
+
import { forwardRef, useEffect as useEffect10, useState as useState3 } from "react";
|
|
771
|
+
import { Platform as Platform3 } from "react-native";
|
|
782
772
|
|
|
783
773
|
// src/components/GameProfile.tsx
|
|
784
774
|
import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported as isMinVersionSupported3 } from "@apps-in-toss/native-modules";
|
|
785
775
|
import { Loader } from "@toss-design-system/react-native";
|
|
786
|
-
import { useEffect as
|
|
776
|
+
import { useEffect as useEffect8 } from "react";
|
|
787
777
|
import { Pressable, View } from "react-native";
|
|
788
778
|
|
|
789
779
|
// src/constant/game-center.ts
|
|
790
|
-
var GAME_PROFILE_WEBVIEW_URL = "
|
|
780
|
+
var GAME_PROFILE_WEBVIEW_URL = "servicetoss://game-center/profile";
|
|
791
781
|
var GAME_CENTER_MIN_VERSION = {
|
|
792
782
|
android: "5.221.0",
|
|
793
783
|
ios: "5.221.0"
|
|
@@ -803,13 +793,13 @@ import { useCallback as useCallback4, useRef as useRef3, useState as useState2 }
|
|
|
803
793
|
// src/components/GameProfileToast.tsx
|
|
804
794
|
import { Asset, Toast } from "@toss-design-system/react-native";
|
|
805
795
|
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay as useOverlay2 } from "@toss-design-system/react-native/private";
|
|
806
|
-
import { jsx as
|
|
796
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
807
797
|
var useGameProfileToast = () => {
|
|
808
798
|
const overlay = useOverlay2();
|
|
809
799
|
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
810
800
|
return new Promise((resolve) => {
|
|
811
801
|
overlay.open(({ isOpen, close, exit }) => {
|
|
812
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ jsx6(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx6(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx6(
|
|
813
803
|
Toast,
|
|
814
804
|
{
|
|
815
805
|
open: isOpen,
|
|
@@ -820,7 +810,7 @@ var useGameProfileToast = () => {
|
|
|
820
810
|
onExited: exit,
|
|
821
811
|
position: "top",
|
|
822
812
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
823
|
-
icon: /* @__PURE__ */
|
|
813
|
+
icon: /* @__PURE__ */ jsx6(
|
|
824
814
|
Asset.Image,
|
|
825
815
|
{
|
|
826
816
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
@@ -975,7 +965,7 @@ var Z_INDEX = {
|
|
|
975
965
|
};
|
|
976
966
|
|
|
977
967
|
// src/components/GameProfile.tsx
|
|
978
|
-
import { Fragment as Fragment5, jsx as
|
|
968
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
979
969
|
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
980
970
|
const {
|
|
981
971
|
profileData,
|
|
@@ -991,7 +981,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
991
981
|
openErrorAlert,
|
|
992
982
|
openGameProfileToast
|
|
993
983
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
994
|
-
|
|
984
|
+
useEffect8(() => {
|
|
995
985
|
try {
|
|
996
986
|
const getProfileData = async () => {
|
|
997
987
|
const data = await getGameCenterGameProfile2();
|
|
@@ -1004,7 +994,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1004
994
|
setIsProfileDataLoading(false);
|
|
1005
995
|
}
|
|
1006
996
|
}, []);
|
|
1007
|
-
|
|
997
|
+
useEffect8(() => {
|
|
1008
998
|
const handleGameProfileFlow = async () => {
|
|
1009
999
|
if (!canShowBottomSheetOrToast) {
|
|
1010
1000
|
return;
|
|
@@ -1036,8 +1026,8 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1036
1026
|
]);
|
|
1037
1027
|
if (!isMinVersionSupported3(GAME_CENTER_MIN_VERSION)) {
|
|
1038
1028
|
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1030
|
+
/* @__PURE__ */ jsx7(
|
|
1041
1031
|
Pressable,
|
|
1042
1032
|
{
|
|
1043
1033
|
style: {
|
|
@@ -1052,8 +1042,8 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1052
1042
|
}
|
|
1053
1043
|
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1054
1044
|
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1055
|
-
/* @__PURE__ */
|
|
1056
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1046
|
+
/* @__PURE__ */ jsx7(
|
|
1057
1047
|
View,
|
|
1058
1048
|
{
|
|
1059
1049
|
style: {
|
|
@@ -1062,15 +1052,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1062
1052
|
alignItems: "center",
|
|
1063
1053
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1064
1054
|
},
|
|
1065
|
-
children: /* @__PURE__ */
|
|
1055
|
+
children: /* @__PURE__ */ jsx7(Loader, { size: "large", type: "light" })
|
|
1066
1056
|
}
|
|
1067
1057
|
)
|
|
1068
1058
|
] });
|
|
1069
1059
|
}
|
|
1070
1060
|
if (shouldShowProfileNotFoundOverlay) {
|
|
1071
1061
|
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1072
|
-
/* @__PURE__ */
|
|
1073
|
-
shouldShowProfileNotFoundOverlay && /* @__PURE__ */
|
|
1062
|
+
/* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1063
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx7(
|
|
1074
1064
|
Pressable,
|
|
1075
1065
|
{
|
|
1076
1066
|
style: {
|
|
@@ -1083,7 +1073,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1083
1073
|
)
|
|
1084
1074
|
] });
|
|
1085
1075
|
}
|
|
1086
|
-
return /* @__PURE__ */
|
|
1076
|
+
return /* @__PURE__ */ jsx7(Fragment5, { children: /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1087
1077
|
};
|
|
1088
1078
|
var overlayStyle = {
|
|
1089
1079
|
position: "absolute",
|
|
@@ -1094,12 +1084,86 @@ var overlayStyle = {
|
|
|
1094
1084
|
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1095
1085
|
};
|
|
1096
1086
|
|
|
1087
|
+
// src/components/NavigationBar/GameWebviewNavigationBar.tsx
|
|
1088
|
+
import { closeView as closeView3 } from "@granite-js/react-native";
|
|
1089
|
+
import { PageNavbar, useDialog as useDialog4 } from "@toss-design-system/react-native";
|
|
1090
|
+
import { NavigationRightContent, useSafeAreaTop } from "@toss-design-system/react-native/private";
|
|
1091
|
+
import { josa as josa3 } from "es-hangul";
|
|
1092
|
+
import { useCallback as useCallback5, useEffect as useEffect9 } from "react";
|
|
1093
|
+
import { BackHandler as BackHandler2, Platform as Platform2, View as View2 } from "react-native";
|
|
1094
|
+
import { Fragment as Fragment6, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1095
|
+
function GameWebviewNavigationBar() {
|
|
1096
|
+
const safeAreaTop = useSafeAreaTop();
|
|
1097
|
+
const { openConfirm } = useDialog4();
|
|
1098
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1099
|
+
const global2 = getAppsInTossGlobals();
|
|
1100
|
+
const logging = useNavigationBarLogging();
|
|
1101
|
+
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1102
|
+
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
1103
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1104
|
+
const handleGameWebviewClose = useCallback5(async () => {
|
|
1105
|
+
const isConfirmed = await openConfirm({
|
|
1106
|
+
title: `${josa3(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1107
|
+
leftButton: "\uCDE8\uC18C",
|
|
1108
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1109
|
+
closeOnDimmerClick: true,
|
|
1110
|
+
onEntered: logging.closePopupShow
|
|
1111
|
+
});
|
|
1112
|
+
logging.closePopupCtaClick(isConfirmed);
|
|
1113
|
+
if (isConfirmed) {
|
|
1114
|
+
captureExitLog(Date.now());
|
|
1115
|
+
closeView3();
|
|
1116
|
+
}
|
|
1117
|
+
}, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
|
|
1118
|
+
useEffect9(() => {
|
|
1119
|
+
const handleAndroidBackEvent = () => {
|
|
1120
|
+
handleGameWebviewClose();
|
|
1121
|
+
return true;
|
|
1122
|
+
};
|
|
1123
|
+
BackHandler2.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1124
|
+
return () => BackHandler2.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1125
|
+
}, [handleGameWebviewClose]);
|
|
1126
|
+
return /* @__PURE__ */ jsxs3(Fragment6, { children: [
|
|
1127
|
+
/* @__PURE__ */ jsx8(PageNavbar, { preference: { type: "none" } }),
|
|
1128
|
+
/* @__PURE__ */ jsx8(
|
|
1129
|
+
View2,
|
|
1130
|
+
{
|
|
1131
|
+
style: {
|
|
1132
|
+
width: "100%",
|
|
1133
|
+
// TODO: UI관련 스타일 설정은 TDS로 이관
|
|
1134
|
+
height: Platform2.OS === "ios" ? 44 : 54,
|
|
1135
|
+
flexDirection: "row",
|
|
1136
|
+
alignItems: "center",
|
|
1137
|
+
justifyContent: "flex-end",
|
|
1138
|
+
position: "absolute",
|
|
1139
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1140
|
+
marginTop: safeAreaTop,
|
|
1141
|
+
paddingRight: 10
|
|
1142
|
+
},
|
|
1143
|
+
pointerEvents: "box-none",
|
|
1144
|
+
children: /* @__PURE__ */ jsx8(
|
|
1145
|
+
NavigationRightContent,
|
|
1146
|
+
{
|
|
1147
|
+
fixedRightButton: initialAccessoryButton,
|
|
1148
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
1149
|
+
onPressClose: () => {
|
|
1150
|
+
logging.closeButtonClick();
|
|
1151
|
+
handleGameWebviewClose();
|
|
1152
|
+
},
|
|
1153
|
+
theme: "dark"
|
|
1154
|
+
}
|
|
1155
|
+
)
|
|
1156
|
+
}
|
|
1157
|
+
)
|
|
1158
|
+
] });
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1097
1161
|
// src/components/GameWebView.tsx
|
|
1098
|
-
import { Fragment as
|
|
1162
|
+
import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1099
1163
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1100
1164
|
const [isEntryMessageExited, setIsEntryMessageExited] = useState3(false);
|
|
1101
|
-
|
|
1102
|
-
if (
|
|
1165
|
+
useEffect10(() => {
|
|
1166
|
+
if (Platform3.OS === "ios") {
|
|
1103
1167
|
setIosSwipeGestureEnabled2({ isEnabled: false });
|
|
1104
1168
|
return () => {
|
|
1105
1169
|
setIosSwipeGestureEnabled2({ isEnabled: true });
|
|
@@ -1107,21 +1171,79 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1107
1171
|
}
|
|
1108
1172
|
return;
|
|
1109
1173
|
}, []);
|
|
1110
|
-
|
|
1111
|
-
|
|
1174
|
+
useEffect10(() => {
|
|
1175
|
+
appsInTossEvent2.addEventListener("entryMessageExited", {
|
|
1112
1176
|
onEvent: () => {
|
|
1113
1177
|
setIsEntryMessageExited(true);
|
|
1114
1178
|
}
|
|
1115
1179
|
});
|
|
1116
1180
|
}, []);
|
|
1117
|
-
return /* @__PURE__ */
|
|
1181
|
+
return /* @__PURE__ */ jsxs4(Fragment7, { children: [
|
|
1182
|
+
/* @__PURE__ */ jsx9(GameWebviewNavigationBar, {}),
|
|
1183
|
+
getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx9(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx9(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx9(PlainWebView, { ref, ...props })
|
|
1184
|
+
] });
|
|
1118
1185
|
});
|
|
1119
1186
|
|
|
1120
1187
|
// src/components/PartnerWebView.tsx
|
|
1188
|
+
import { appsInTossEvent as appsInTossEvent4, closeView as closeView5 } from "@apps-in-toss/native-modules";
|
|
1121
1189
|
import {
|
|
1122
1190
|
WebView as PlainWebView2
|
|
1123
1191
|
} from "@granite-js/native/react-native-webview";
|
|
1124
|
-
import { forwardRef as forwardRef2, useRef as useRef4 } from "react";
|
|
1192
|
+
import { forwardRef as forwardRef2, useCallback as useCallback7, useEffect as useEffect11, useRef as useRef4 } from "react";
|
|
1193
|
+
import { BackHandler as BackHandler3 } from "react-native";
|
|
1194
|
+
|
|
1195
|
+
// src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
|
|
1196
|
+
import { appsInTossEvent as appsInTossEvent3 } from "@apps-in-toss/native-modules";
|
|
1197
|
+
import { closeView as closeView4 } from "@granite-js/react-native";
|
|
1198
|
+
import { useDialog as useDialog5 } from "@toss-design-system/react-native";
|
|
1199
|
+
import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss-design-system/react-native/private";
|
|
1200
|
+
import { josa as josa4 } from "es-hangul";
|
|
1201
|
+
import { useCallback as useCallback6 } from "react";
|
|
1202
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1203
|
+
function PartnerWebviewNavigationBar({ handleBackEvent }) {
|
|
1204
|
+
const globals = getAppsInTossGlobals();
|
|
1205
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1206
|
+
const logging = useNavigationBarLogging();
|
|
1207
|
+
const { openConfirm } = useDialog5();
|
|
1208
|
+
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1209
|
+
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1210
|
+
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1211
|
+
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1212
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1213
|
+
const handlePressTitle = useCallback6(() => {
|
|
1214
|
+
logging.homeButtonClick();
|
|
1215
|
+
appsInTossEvent3.emit("homeIconButtonClickEvent", void 0);
|
|
1216
|
+
}, [logging]);
|
|
1217
|
+
const handleClose = useCallback6(async () => {
|
|
1218
|
+
logging.closeButtonClick();
|
|
1219
|
+
const isConfirmed = await openConfirm({
|
|
1220
|
+
title: `${josa4(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1221
|
+
leftButton: "\uCDE8\uC18C",
|
|
1222
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1223
|
+
closeOnDimmerClick: true,
|
|
1224
|
+
onEntered: logging.closePopupShow
|
|
1225
|
+
});
|
|
1226
|
+
logging.closePopupCtaClick(isConfirmed);
|
|
1227
|
+
if (isConfirmed) {
|
|
1228
|
+
captureExitLog(Date.now());
|
|
1229
|
+
closeView4();
|
|
1230
|
+
}
|
|
1231
|
+
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1232
|
+
return /* @__PURE__ */ jsx10(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx10(
|
|
1233
|
+
TopNavigation2,
|
|
1234
|
+
{
|
|
1235
|
+
title: globals.brandDisplayName,
|
|
1236
|
+
icon: toIcon(globals.brandIcon),
|
|
1237
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
1238
|
+
contentVisible: true,
|
|
1239
|
+
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
1240
|
+
onPressClose: handleClose,
|
|
1241
|
+
withHome: withHomeButton,
|
|
1242
|
+
fixedRightButton: initialAccessoryButton,
|
|
1243
|
+
children: /* @__PURE__ */ jsx10(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx10(NavigationBackButton2, { onPress: handleBackEvent, canGoBack: false }) })
|
|
1244
|
+
}
|
|
1245
|
+
) });
|
|
1246
|
+
}
|
|
1125
1247
|
|
|
1126
1248
|
// src/core/utils/mergeRefs.ts
|
|
1127
1249
|
function mergeRefs(...refs) {
|
|
@@ -1137,17 +1259,52 @@ function mergeRefs(...refs) {
|
|
|
1137
1259
|
}
|
|
1138
1260
|
|
|
1139
1261
|
// src/components/PartnerWebView.tsx
|
|
1140
|
-
import { jsx as
|
|
1141
|
-
var PartnerWebView = forwardRef2(
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
);
|
|
1262
|
+
import { Fragment as Fragment8, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1263
|
+
var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ canHistoryGoBack, ...webViewProps }, ref) {
|
|
1264
|
+
const webViewRef = useRef4(null);
|
|
1265
|
+
const refs = mergeRefs(ref, webViewRef);
|
|
1266
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1267
|
+
const handleBackEvent = useCallback7(() => {
|
|
1268
|
+
if (canHistoryGoBack) {
|
|
1269
|
+
webViewRef.current?.goBack();
|
|
1270
|
+
} else {
|
|
1271
|
+
captureExitLog(Date.now());
|
|
1272
|
+
closeView5();
|
|
1273
|
+
}
|
|
1274
|
+
}, [canHistoryGoBack, captureExitLog]);
|
|
1275
|
+
useEffect11(() => {
|
|
1276
|
+
const handleAndroidBackEvent = () => {
|
|
1277
|
+
if (canHistoryGoBack) {
|
|
1278
|
+
webViewRef.current?.goBack();
|
|
1279
|
+
return true;
|
|
1280
|
+
} else {
|
|
1281
|
+
captureExitLog(Date.now());
|
|
1282
|
+
return false;
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
BackHandler3.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1286
|
+
return () => BackHandler3.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1287
|
+
}, [canHistoryGoBack, captureExitLog]);
|
|
1288
|
+
useEffect11(() => {
|
|
1289
|
+
return appsInTossEvent4.addEventListener("homeIconButtonClickEvent", {
|
|
1290
|
+
onEvent: () => {
|
|
1291
|
+
webViewRef.current?.injectJavaScript(`
|
|
1292
|
+
(function() {
|
|
1293
|
+
window.history.replaceState(null, '', '/');
|
|
1294
|
+
true;
|
|
1295
|
+
})();
|
|
1296
|
+
`);
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
}, [webViewRef]);
|
|
1300
|
+
return /* @__PURE__ */ jsxs5(Fragment8, { children: [
|
|
1301
|
+
/* @__PURE__ */ jsx11(PartnerWebviewNavigationBar, { handleBackEvent }),
|
|
1302
|
+
/* @__PURE__ */ jsx11(PlainWebView2, { ref: refs, ...webViewProps, style: { flex: 1 } })
|
|
1303
|
+
] });
|
|
1304
|
+
});
|
|
1148
1305
|
|
|
1149
1306
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1150
|
-
import { useCallback as
|
|
1307
|
+
import { useCallback as useCallback8, useMemo as useMemo2, useRef as useRef5 } from "react";
|
|
1151
1308
|
function serializeError(error) {
|
|
1152
1309
|
return JSON.stringify(error, (_, value) => {
|
|
1153
1310
|
if (value instanceof Error) {
|
|
@@ -1224,7 +1381,7 @@ function useBridgeHandler({
|
|
|
1224
1381
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1225
1382
|
`);
|
|
1226
1383
|
};
|
|
1227
|
-
const $onMessage =
|
|
1384
|
+
const $onMessage = useCallback8(
|
|
1228
1385
|
async (e) => {
|
|
1229
1386
|
onMessage?.(e);
|
|
1230
1387
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1433,11 +1590,11 @@ function useCreateUserAgent({
|
|
|
1433
1590
|
// src/hooks/useGeolocation.ts
|
|
1434
1591
|
import { startUpdateLocation } from "@apps-in-toss/native-modules";
|
|
1435
1592
|
import { useVisibility as useVisibility3 } from "@granite-js/react-native";
|
|
1436
|
-
import { useEffect as
|
|
1593
|
+
import { useEffect as useEffect12, useState as useState4 } from "react";
|
|
1437
1594
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1438
1595
|
const isVisible = useVisibility3();
|
|
1439
1596
|
const [location, setLocation] = useState4(null);
|
|
1440
|
-
|
|
1597
|
+
useEffect12(() => {
|
|
1441
1598
|
if (!isVisible) {
|
|
1442
1599
|
return;
|
|
1443
1600
|
}
|
|
@@ -1504,7 +1661,7 @@ var trackScreen = (url) => {
|
|
|
1504
1661
|
};
|
|
1505
1662
|
|
|
1506
1663
|
// src/components/WebView.tsx
|
|
1507
|
-
import { jsx as
|
|
1664
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1508
1665
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1509
1666
|
var TYPES = ["partner", "external", "game"];
|
|
1510
1667
|
var WEBVIEW_TYPES = {
|
|
@@ -1538,11 +1695,9 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1538
1695
|
if (!TYPES.includes(type)) {
|
|
1539
1696
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1540
1697
|
}
|
|
1541
|
-
const { openConfirm } = useDialog4();
|
|
1542
|
-
const { captureExitLog } = useCaptureExitLog();
|
|
1543
1698
|
const graniteEvent = useGraniteEvent();
|
|
1544
1699
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1545
|
-
const top =
|
|
1700
|
+
const top = useSafeAreaTop2();
|
|
1546
1701
|
const bottom = useSafeAreaBottom();
|
|
1547
1702
|
const global2 = getAppsInTossGlobals();
|
|
1548
1703
|
const topNavigation = useTopNavigation();
|
|
@@ -1564,10 +1719,10 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1564
1719
|
...appsInTossEventBridges,
|
|
1565
1720
|
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
|
|
1566
1721
|
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1567
|
-
entryMessageExited: ({ onEvent, onError }) =>
|
|
1568
|
-
updateLocationEvent: ({ onEvent, onError, options }) =>
|
|
1722
|
+
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent5.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1723
|
+
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent5.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1569
1724
|
/** @internal */
|
|
1570
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
1725
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent5.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1571
1726
|
/** AdMob */
|
|
1572
1727
|
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1573
1728
|
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
@@ -1641,7 +1796,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1641
1796
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1642
1797
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1643
1798
|
const [canHistoryGoBack, setCanHistoryGoBack] = useState5(false);
|
|
1644
|
-
const handleNavigationStateChange =
|
|
1799
|
+
const handleNavigationStateChange = useCallback9(
|
|
1645
1800
|
(event) => {
|
|
1646
1801
|
if (event.url) {
|
|
1647
1802
|
trackScreen(event.url);
|
|
@@ -1653,61 +1808,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1653
1808
|
const userAgent = useCreateUserAgent({
|
|
1654
1809
|
colorPreference: "light"
|
|
1655
1810
|
});
|
|
1656
|
-
|
|
1657
|
-
const isConfirmed = await openConfirm({
|
|
1658
|
-
title: `${josa3(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1659
|
-
leftButton: "\uCDE8\uC18C",
|
|
1660
|
-
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1661
|
-
closeOnDimmerClick: true
|
|
1662
|
-
});
|
|
1663
|
-
if (isConfirmed) {
|
|
1664
|
-
captureExitLog(Date.now());
|
|
1665
|
-
closeView3();
|
|
1666
|
-
}
|
|
1667
|
-
}, [captureExitLog, openConfirm, global2.brandDisplayName]);
|
|
1668
|
-
const handleBackEvent = useCallback6(() => {
|
|
1669
|
-
if (type === "game") {
|
|
1670
|
-
handleGameWebviewClose();
|
|
1671
|
-
return true;
|
|
1672
|
-
}
|
|
1673
|
-
if (canHistoryGoBack) {
|
|
1674
|
-
handler.ref.current?.goBack();
|
|
1675
|
-
return true;
|
|
1676
|
-
} else {
|
|
1677
|
-
return false;
|
|
1678
|
-
}
|
|
1679
|
-
}, [canHistoryGoBack, handleGameWebviewClose, handler.ref, type]);
|
|
1680
|
-
useEffect10(() => {
|
|
1681
|
-
BackHandler2.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1682
|
-
return () => BackHandler2.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
1683
|
-
}, [handleBackEvent]);
|
|
1684
|
-
useEffect10(() => {
|
|
1685
|
-
return appsInTossEvent4.addEventListener("homeIconButtonClickEvent", {
|
|
1686
|
-
onEvent: () => {
|
|
1687
|
-
handler.ref?.current?.injectJavaScript(`
|
|
1688
|
-
(function() {
|
|
1689
|
-
window.history.replaceState(null, '', '/');
|
|
1690
|
-
true;
|
|
1691
|
-
})();
|
|
1692
|
-
`);
|
|
1693
|
-
}
|
|
1694
|
-
});
|
|
1695
|
-
}, [handler.ref]);
|
|
1696
|
-
useEffect10(() => {
|
|
1697
|
-
return appsInTossEvent4.addEventListener("backButtonClickEvent", {
|
|
1698
|
-
onEvent: () => {
|
|
1699
|
-
if (type === "game") {
|
|
1700
|
-
handleGameWebviewClose();
|
|
1701
|
-
} else if (canHistoryGoBack) {
|
|
1702
|
-
handler.ref.current?.goBack();
|
|
1703
|
-
} else {
|
|
1704
|
-
captureExitLog(Date.now());
|
|
1705
|
-
closeView3();
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
});
|
|
1709
|
-
}, [handler.ref, canHistoryGoBack, handleGameWebviewClose, captureExitLog, type]);
|
|
1710
|
-
return /* @__PURE__ */ jsx9(
|
|
1811
|
+
return /* @__PURE__ */ jsx12(
|
|
1711
1812
|
BaseWebView,
|
|
1712
1813
|
{
|
|
1713
1814
|
ref: handler.ref,
|
|
@@ -1720,15 +1821,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1720
1821
|
"User-Agent": userAgent
|
|
1721
1822
|
}
|
|
1722
1823
|
},
|
|
1723
|
-
userAgent:
|
|
1824
|
+
userAgent: Platform4.OS === "ios" ? userAgent : void 0,
|
|
1724
1825
|
sharedCookiesEnabled: true,
|
|
1725
1826
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1726
1827
|
thirdPartyCookiesEnabled: true,
|
|
1727
1828
|
onMessage: handler.onMessage,
|
|
1829
|
+
canHistoryGoBack,
|
|
1728
1830
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1729
1831
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1730
1832
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1731
|
-
decelerationRate:
|
|
1833
|
+
decelerationRate: Platform4.OS === "ios" ? 1 : void 0,
|
|
1732
1834
|
allowsBackForwardNavigationGestures
|
|
1733
1835
|
}
|
|
1734
1836
|
);
|