@apps-in-toss/framework 1.1.0 → 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 -318
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +328 -184
- package/package.json +14 -14
- package/dist/types.cjs +0 -24
- package/dist/types.d.cts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
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,44 +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
|
-
const overrideCanGoBack = !backEventContext.hasBackEvent;
|
|
573
614
|
const handleBackOrClose = useBackOrCloseNavigation();
|
|
574
615
|
const navigation = useNavigation();
|
|
575
616
|
const handlePressTitle = useCallback3(() => {
|
|
576
617
|
logging.homeButtonClick();
|
|
577
|
-
if (globals.webViewType != null) {
|
|
578
|
-
appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
618
|
navigation.navigate("/");
|
|
582
|
-
}, [logging,
|
|
583
|
-
const handleBack = useCallback3(() => {
|
|
584
|
-
if (!overrideCanGoBack) {
|
|
585
|
-
backEventContext.onBack();
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
handleBackOrClose();
|
|
589
|
-
}, [overrideCanGoBack, handleBackOrClose, backEventContext]);
|
|
619
|
+
}, [logging, navigation]);
|
|
590
620
|
const handleClose = useCallback3(async () => {
|
|
591
621
|
logging.closeButtonClick();
|
|
592
622
|
const isConfirmed = await openConfirm({
|
|
@@ -602,26 +632,30 @@ function BuiltinNavigationBar() {
|
|
|
602
632
|
closeView();
|
|
603
633
|
}
|
|
604
634
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
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();
|
|
608
645
|
return true;
|
|
609
646
|
};
|
|
610
|
-
BackHandler.addEventListener("hardwareBackPress",
|
|
647
|
+
BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
611
648
|
return () => {
|
|
612
|
-
BackHandler.removeEventListener("hardwareBackPress",
|
|
649
|
+
BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
613
650
|
};
|
|
614
|
-
}, [
|
|
615
|
-
|
|
616
|
-
return /* @__PURE__ */ jsx3(Fragment3, {});
|
|
617
|
-
}
|
|
618
|
-
return /* @__PURE__ */ jsx3(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx3(
|
|
651
|
+
}, [handleBack]);
|
|
652
|
+
return /* @__PURE__ */ jsx4(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx4(
|
|
619
653
|
TopNavigation,
|
|
620
654
|
{
|
|
621
655
|
title: globals.brandDisplayName,
|
|
622
656
|
icon: toIcon(globals.brandIcon),
|
|
623
657
|
onPressDots: openMoreButtonBottomSheet,
|
|
624
|
-
contentVisible:
|
|
658
|
+
contentVisible: true,
|
|
625
659
|
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
626
660
|
onPressClose: handleClose,
|
|
627
661
|
withHome: withHomeButton,
|
|
@@ -630,81 +664,46 @@ function BuiltinNavigationBar() {
|
|
|
630
664
|
icon: initialAccessoryButton.icon,
|
|
631
665
|
id: initialAccessoryButton.id
|
|
632
666
|
} : void 0,
|
|
633
|
-
children:
|
|
667
|
+
children: /* @__PURE__ */ jsx4(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx4(NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
|
|
634
668
|
}
|
|
635
669
|
) });
|
|
636
670
|
}
|
|
637
671
|
function useBackOrCloseNavigation() {
|
|
638
672
|
const navigation = useNavigation();
|
|
673
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
639
674
|
return useCallback3(() => {
|
|
640
675
|
if (navigation.canGoBack()) {
|
|
641
676
|
navigation.goBack();
|
|
642
677
|
} else {
|
|
678
|
+
captureExitLog(Date.now());
|
|
643
679
|
closeView();
|
|
644
680
|
}
|
|
645
|
-
}, [navigation]);
|
|
646
|
-
}
|
|
647
|
-
function BuiltinNavigationBarImpressionArea({
|
|
648
|
-
children,
|
|
649
|
-
withHomeButton
|
|
650
|
-
}) {
|
|
651
|
-
const hasLogged = useRef2(false);
|
|
652
|
-
const logging = useBuiltinNavigationBarLogging();
|
|
653
|
-
useEffect5(() => {
|
|
654
|
-
if (hasLogged.current === false) {
|
|
655
|
-
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
656
|
-
hasLogged.current = true;
|
|
657
|
-
}
|
|
658
|
-
}, []);
|
|
659
|
-
return /* @__PURE__ */ jsx3(Fragment3, { children });
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
// src/core/hooks/useAppsInTossBridge.ts
|
|
663
|
-
import { appsInTossEvent as appsInTossEvent2 } from "@apps-in-toss/native-modules";
|
|
664
|
-
import { useBridge } from "@toss-design-system/react-native";
|
|
665
|
-
import { useEffect as useEffect6 } from "react";
|
|
666
|
-
function useAppsInTossBridge() {
|
|
667
|
-
const controller = useBridge();
|
|
668
|
-
const appsInTossGlobals = getAppsInTossGlobals();
|
|
669
|
-
useEffect6(() => {
|
|
670
|
-
const commonProps = {
|
|
671
|
-
serviceName: appsInTossGlobals.brandDisplayName,
|
|
672
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
673
|
-
color: appsInTossGlobals.brandPrimaryColor,
|
|
674
|
-
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
675
|
-
};
|
|
676
|
-
controller.open({
|
|
677
|
-
...commonProps,
|
|
678
|
-
onExited: () => {
|
|
679
|
-
appsInTossEvent2.emit("entryMessageExited", void 0);
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
|
-
}, []);
|
|
681
|
+
}, [captureExitLog, navigation]);
|
|
683
682
|
}
|
|
684
683
|
|
|
685
684
|
// src/core/registerApp.tsx
|
|
686
|
-
import { Fragment as Fragment4, jsx as
|
|
685
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
687
686
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
688
687
|
if (!isMinVersionSupported2({
|
|
689
688
|
android: "5.220.0",
|
|
690
689
|
ios: "5.221.0"
|
|
691
690
|
})) {
|
|
692
691
|
return /* @__PURE__ */ jsxs(Fragment4, { children: [
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ jsx5(AppEvent.Entry, {}),
|
|
693
|
+
/* @__PURE__ */ jsx5(AppEvent.System, { ...initialProps }),
|
|
694
|
+
/* @__PURE__ */ jsx5(AppUpdate, {})
|
|
696
695
|
] });
|
|
697
696
|
}
|
|
698
697
|
return /* @__PURE__ */ jsxs(Fragment4, { children: [
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
-
/* @__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 }) }) })
|
|
703
702
|
] });
|
|
704
703
|
}
|
|
705
704
|
function TDSContainer({ children }) {
|
|
706
705
|
useAppsInTossBridge();
|
|
707
|
-
return /* @__PURE__ */
|
|
706
|
+
return /* @__PURE__ */ jsx5(Fragment4, { children });
|
|
708
707
|
}
|
|
709
708
|
function registerApp(container, { context, analytics }) {
|
|
710
709
|
const appName = getAppName();
|
|
@@ -730,8 +729,9 @@ function registerApp(container, { context, analytics }) {
|
|
|
730
729
|
return global.Page;
|
|
731
730
|
}
|
|
732
731
|
function AppsInTossScreenContainer({ children }) {
|
|
732
|
+
const isReactNativeService = getAppsInTossGlobals().webViewType == null;
|
|
733
733
|
return /* @__PURE__ */ jsxs(Analytics.Screen, { children: [
|
|
734
|
-
/* @__PURE__ */
|
|
734
|
+
isReactNativeService && /* @__PURE__ */ jsx5(RNNavigationBar, {}),
|
|
735
735
|
children
|
|
736
736
|
] });
|
|
737
737
|
}
|
|
@@ -750,7 +750,7 @@ var AppsInToss = {
|
|
|
750
750
|
};
|
|
751
751
|
|
|
752
752
|
// src/components/WebView.tsx
|
|
753
|
-
import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as
|
|
753
|
+
import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInTossEvent5 } from "@apps-in-toss/native-modules";
|
|
754
754
|
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
755
755
|
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
756
756
|
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
@@ -758,26 +758,26 @@ import { getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/reac
|
|
|
758
758
|
import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
|
|
759
759
|
import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
|
|
760
760
|
import { ExternalWebViewScreen, tdsEvent } from "@toss-design-system/react-native";
|
|
761
|
-
import { useSafeAreaBottom, useSafeAreaTop, useTopNavigation } from "@toss-design-system/react-native/private";
|
|
762
|
-
import { useCallback as
|
|
763
|
-
import {
|
|
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";
|
|
764
764
|
|
|
765
765
|
// src/components/GameWebView.tsx
|
|
766
|
-
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as
|
|
766
|
+
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent2, getOperationalEnvironment } from "@apps-in-toss/native-modules";
|
|
767
767
|
import {
|
|
768
768
|
WebView as PlainWebView
|
|
769
769
|
} from "@granite-js/native/react-native-webview";
|
|
770
|
-
import { forwardRef, useEffect as
|
|
771
|
-
import { Platform as
|
|
770
|
+
import { forwardRef, useEffect as useEffect10, useState as useState3 } from "react";
|
|
771
|
+
import { Platform as Platform3 } from "react-native";
|
|
772
772
|
|
|
773
773
|
// src/components/GameProfile.tsx
|
|
774
774
|
import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported as isMinVersionSupported3 } from "@apps-in-toss/native-modules";
|
|
775
775
|
import { Loader } from "@toss-design-system/react-native";
|
|
776
|
-
import { useEffect as
|
|
776
|
+
import { useEffect as useEffect8 } from "react";
|
|
777
777
|
import { Pressable, View } from "react-native";
|
|
778
778
|
|
|
779
779
|
// src/constant/game-center.ts
|
|
780
|
-
var GAME_PROFILE_WEBVIEW_URL = "
|
|
780
|
+
var GAME_PROFILE_WEBVIEW_URL = "servicetoss://game-center/profile";
|
|
781
781
|
var GAME_CENTER_MIN_VERSION = {
|
|
782
782
|
android: "5.221.0",
|
|
783
783
|
ios: "5.221.0"
|
|
@@ -793,13 +793,13 @@ import { useCallback as useCallback4, useRef as useRef3, useState as useState2 }
|
|
|
793
793
|
// src/components/GameProfileToast.tsx
|
|
794
794
|
import { Asset, Toast } from "@toss-design-system/react-native";
|
|
795
795
|
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay as useOverlay2 } from "@toss-design-system/react-native/private";
|
|
796
|
-
import { jsx as
|
|
796
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
797
797
|
var useGameProfileToast = () => {
|
|
798
798
|
const overlay = useOverlay2();
|
|
799
799
|
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
800
800
|
return new Promise((resolve) => {
|
|
801
801
|
overlay.open(({ isOpen, close, exit }) => {
|
|
802
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ jsx6(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx6(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx6(
|
|
803
803
|
Toast,
|
|
804
804
|
{
|
|
805
805
|
open: isOpen,
|
|
@@ -810,7 +810,7 @@ var useGameProfileToast = () => {
|
|
|
810
810
|
onExited: exit,
|
|
811
811
|
position: "top",
|
|
812
812
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
813
|
-
icon: /* @__PURE__ */
|
|
813
|
+
icon: /* @__PURE__ */ jsx6(
|
|
814
814
|
Asset.Image,
|
|
815
815
|
{
|
|
816
816
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
@@ -965,7 +965,7 @@ var Z_INDEX = {
|
|
|
965
965
|
};
|
|
966
966
|
|
|
967
967
|
// src/components/GameProfile.tsx
|
|
968
|
-
import { Fragment as Fragment5, jsx as
|
|
968
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
969
969
|
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
970
970
|
const {
|
|
971
971
|
profileData,
|
|
@@ -981,7 +981,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
981
981
|
openErrorAlert,
|
|
982
982
|
openGameProfileToast
|
|
983
983
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
984
|
-
|
|
984
|
+
useEffect8(() => {
|
|
985
985
|
try {
|
|
986
986
|
const getProfileData = async () => {
|
|
987
987
|
const data = await getGameCenterGameProfile2();
|
|
@@ -994,7 +994,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
994
994
|
setIsProfileDataLoading(false);
|
|
995
995
|
}
|
|
996
996
|
}, []);
|
|
997
|
-
|
|
997
|
+
useEffect8(() => {
|
|
998
998
|
const handleGameProfileFlow = async () => {
|
|
999
999
|
if (!canShowBottomSheetOrToast) {
|
|
1000
1000
|
return;
|
|
@@ -1026,8 +1026,8 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1026
1026
|
]);
|
|
1027
1027
|
if (!isMinVersionSupported3(GAME_CENTER_MIN_VERSION)) {
|
|
1028
1028
|
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1030
|
+
/* @__PURE__ */ jsx7(
|
|
1031
1031
|
Pressable,
|
|
1032
1032
|
{
|
|
1033
1033
|
style: {
|
|
@@ -1042,8 +1042,8 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1044
1044
|
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1046
|
+
/* @__PURE__ */ jsx7(
|
|
1047
1047
|
View,
|
|
1048
1048
|
{
|
|
1049
1049
|
style: {
|
|
@@ -1052,15 +1052,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1052
1052
|
alignItems: "center",
|
|
1053
1053
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1054
1054
|
},
|
|
1055
|
-
children: /* @__PURE__ */
|
|
1055
|
+
children: /* @__PURE__ */ jsx7(Loader, { size: "large", type: "light" })
|
|
1056
1056
|
}
|
|
1057
1057
|
)
|
|
1058
1058
|
] });
|
|
1059
1059
|
}
|
|
1060
1060
|
if (shouldShowProfileNotFoundOverlay) {
|
|
1061
1061
|
return /* @__PURE__ */ jsxs2(Fragment5, { children: [
|
|
1062
|
-
/* @__PURE__ */
|
|
1063
|
-
shouldShowProfileNotFoundOverlay && /* @__PURE__ */
|
|
1062
|
+
/* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1063
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx7(
|
|
1064
1064
|
Pressable,
|
|
1065
1065
|
{
|
|
1066
1066
|
style: {
|
|
@@ -1073,7 +1073,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1073
1073
|
)
|
|
1074
1074
|
] });
|
|
1075
1075
|
}
|
|
1076
|
-
return /* @__PURE__ */
|
|
1076
|
+
return /* @__PURE__ */ jsx7(Fragment5, { children: /* @__PURE__ */ jsx7(View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1077
1077
|
};
|
|
1078
1078
|
var overlayStyle = {
|
|
1079
1079
|
position: "absolute",
|
|
@@ -1084,12 +1084,86 @@ var overlayStyle = {
|
|
|
1084
1084
|
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1085
1085
|
};
|
|
1086
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
|
+
|
|
1087
1161
|
// src/components/GameWebView.tsx
|
|
1088
|
-
import { Fragment as
|
|
1162
|
+
import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1089
1163
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1090
1164
|
const [isEntryMessageExited, setIsEntryMessageExited] = useState3(false);
|
|
1091
|
-
|
|
1092
|
-
if (
|
|
1165
|
+
useEffect10(() => {
|
|
1166
|
+
if (Platform3.OS === "ios") {
|
|
1093
1167
|
setIosSwipeGestureEnabled2({ isEnabled: false });
|
|
1094
1168
|
return () => {
|
|
1095
1169
|
setIosSwipeGestureEnabled2({ isEnabled: true });
|
|
@@ -1097,21 +1171,79 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1097
1171
|
}
|
|
1098
1172
|
return;
|
|
1099
1173
|
}, []);
|
|
1100
|
-
|
|
1101
|
-
|
|
1174
|
+
useEffect10(() => {
|
|
1175
|
+
appsInTossEvent2.addEventListener("entryMessageExited", {
|
|
1102
1176
|
onEvent: () => {
|
|
1103
1177
|
setIsEntryMessageExited(true);
|
|
1104
1178
|
}
|
|
1105
1179
|
});
|
|
1106
1180
|
}, []);
|
|
1107
|
-
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
|
+
] });
|
|
1108
1185
|
});
|
|
1109
1186
|
|
|
1110
1187
|
// src/components/PartnerWebView.tsx
|
|
1188
|
+
import { appsInTossEvent as appsInTossEvent4, closeView as closeView5 } from "@apps-in-toss/native-modules";
|
|
1111
1189
|
import {
|
|
1112
1190
|
WebView as PlainWebView2
|
|
1113
1191
|
} from "@granite-js/native/react-native-webview";
|
|
1114
|
-
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
|
+
}
|
|
1115
1247
|
|
|
1116
1248
|
// src/core/utils/mergeRefs.ts
|
|
1117
1249
|
function mergeRefs(...refs) {
|
|
@@ -1127,17 +1259,52 @@ function mergeRefs(...refs) {
|
|
|
1127
1259
|
}
|
|
1128
1260
|
|
|
1129
1261
|
// src/components/PartnerWebView.tsx
|
|
1130
|
-
import { jsx as
|
|
1131
|
-
var PartnerWebView = forwardRef2(
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
);
|
|
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
|
+
});
|
|
1138
1305
|
|
|
1139
1306
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1140
|
-
import { useCallback as
|
|
1307
|
+
import { useCallback as useCallback8, useMemo as useMemo2, useRef as useRef5 } from "react";
|
|
1141
1308
|
function serializeError(error) {
|
|
1142
1309
|
return JSON.stringify(error, (_, value) => {
|
|
1143
1310
|
if (value instanceof Error) {
|
|
@@ -1214,7 +1381,7 @@ function useBridgeHandler({
|
|
|
1214
1381
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1215
1382
|
`);
|
|
1216
1383
|
};
|
|
1217
|
-
const $onMessage =
|
|
1384
|
+
const $onMessage = useCallback8(
|
|
1218
1385
|
async (e) => {
|
|
1219
1386
|
onMessage?.(e);
|
|
1220
1387
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1423,11 +1590,11 @@ function useCreateUserAgent({
|
|
|
1423
1590
|
// src/hooks/useGeolocation.ts
|
|
1424
1591
|
import { startUpdateLocation } from "@apps-in-toss/native-modules";
|
|
1425
1592
|
import { useVisibility as useVisibility3 } from "@granite-js/react-native";
|
|
1426
|
-
import { useEffect as
|
|
1593
|
+
import { useEffect as useEffect12, useState as useState4 } from "react";
|
|
1427
1594
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1428
1595
|
const isVisible = useVisibility3();
|
|
1429
1596
|
const [location, setLocation] = useState4(null);
|
|
1430
|
-
|
|
1597
|
+
useEffect12(() => {
|
|
1431
1598
|
if (!isVisible) {
|
|
1432
1599
|
return;
|
|
1433
1600
|
}
|
|
@@ -1494,7 +1661,7 @@ var trackScreen = (url) => {
|
|
|
1494
1661
|
};
|
|
1495
1662
|
|
|
1496
1663
|
// src/components/WebView.tsx
|
|
1497
|
-
import { jsx as
|
|
1664
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1498
1665
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1499
1666
|
var TYPES = ["partner", "external", "game"];
|
|
1500
1667
|
var WEBVIEW_TYPES = {
|
|
@@ -1530,7 +1697,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1530
1697
|
}
|
|
1531
1698
|
const graniteEvent = useGraniteEvent();
|
|
1532
1699
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1533
|
-
const top =
|
|
1700
|
+
const top = useSafeAreaTop2();
|
|
1534
1701
|
const bottom = useSafeAreaBottom();
|
|
1535
1702
|
const global2 = getAppsInTossGlobals();
|
|
1536
1703
|
const topNavigation = useTopNavigation();
|
|
@@ -1552,10 +1719,10 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1552
1719
|
...appsInTossEventBridges,
|
|
1553
1720
|
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
|
|
1554
1721
|
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1555
|
-
entryMessageExited: ({ onEvent, onError }) =>
|
|
1556
|
-
updateLocationEvent: ({ onEvent, onError, options }) =>
|
|
1722
|
+
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent5.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1723
|
+
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent5.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1557
1724
|
/** @internal */
|
|
1558
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
1725
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent5.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1559
1726
|
/** AdMob */
|
|
1560
1727
|
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1561
1728
|
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
@@ -1629,7 +1796,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1629
1796
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1630
1797
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1631
1798
|
const [canHistoryGoBack, setCanHistoryGoBack] = useState5(false);
|
|
1632
|
-
const handleNavigationStateChange =
|
|
1799
|
+
const handleNavigationStateChange = useCallback9(
|
|
1633
1800
|
(event) => {
|
|
1634
1801
|
if (event.url) {
|
|
1635
1802
|
trackScreen(event.url);
|
|
@@ -1641,31 +1808,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1641
1808
|
const userAgent = useCreateUserAgent({
|
|
1642
1809
|
colorPreference: "light"
|
|
1643
1810
|
});
|
|
1644
|
-
|
|
1645
|
-
if (canHistoryGoBack) {
|
|
1646
|
-
handler.ref.current?.goBack();
|
|
1647
|
-
return true;
|
|
1648
|
-
} else {
|
|
1649
|
-
return false;
|
|
1650
|
-
}
|
|
1651
|
-
}, [canHistoryGoBack, handler]);
|
|
1652
|
-
useEffect10(() => {
|
|
1653
|
-
BackHandler2.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1654
|
-
return () => BackHandler2.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
1655
|
-
}, [handleBackEvent]);
|
|
1656
|
-
useEffect10(() => {
|
|
1657
|
-
return appsInTossEvent4.addEventListener("homeIconButtonClickEvent", {
|
|
1658
|
-
onEvent: () => {
|
|
1659
|
-
handler.ref?.current?.injectJavaScript(`
|
|
1660
|
-
(function() {
|
|
1661
|
-
window.history.replaceState(null, '', '/');
|
|
1662
|
-
true;
|
|
1663
|
-
})();
|
|
1664
|
-
`);
|
|
1665
|
-
}
|
|
1666
|
-
});
|
|
1667
|
-
}, [handler.ref]);
|
|
1668
|
-
return /* @__PURE__ */ jsx9(
|
|
1811
|
+
return /* @__PURE__ */ jsx12(
|
|
1669
1812
|
BaseWebView,
|
|
1670
1813
|
{
|
|
1671
1814
|
ref: handler.ref,
|
|
@@ -1678,15 +1821,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1678
1821
|
"User-Agent": userAgent
|
|
1679
1822
|
}
|
|
1680
1823
|
},
|
|
1681
|
-
userAgent:
|
|
1824
|
+
userAgent: Platform4.OS === "ios" ? userAgent : void 0,
|
|
1682
1825
|
sharedCookiesEnabled: true,
|
|
1683
1826
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1684
1827
|
thirdPartyCookiesEnabled: true,
|
|
1685
1828
|
onMessage: handler.onMessage,
|
|
1829
|
+
canHistoryGoBack,
|
|
1686
1830
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1687
1831
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1688
1832
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1689
|
-
decelerationRate:
|
|
1833
|
+
decelerationRate: Platform4.OS === "ios" ? 1 : void 0,
|
|
1690
1834
|
allowsBackForwardNavigationGestures
|
|
1691
1835
|
}
|
|
1692
1836
|
);
|