@apps-in-toss/framework 1.4.3 → 1.4.5
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 +225 -185
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +157 -117
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
useCreateUserAgent: () => useCreateUserAgent,
|
|
41
41
|
useGeolocation: () => useGeolocation,
|
|
42
42
|
useOverlay: () => import_private10.useOverlay,
|
|
43
|
-
useTopNavigation: () =>
|
|
43
|
+
useTopNavigation: () => useTopNavigation,
|
|
44
44
|
useWaitForReturnNavigator: () => useWaitForReturnNavigator
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -194,9 +194,7 @@ function AppUpdate() {
|
|
|
194
194
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
// src/core/
|
|
198
|
-
var import_native_modules3 = require("@apps-in-toss/native-modules");
|
|
199
|
-
var import_tds_react_native = require("@toss/tds-react-native");
|
|
197
|
+
// src/core/context/NavigationBarContext.tsx
|
|
200
198
|
var import_react5 = require("react");
|
|
201
199
|
|
|
202
200
|
// src/core/utils/getAppsInTossGlobals.ts
|
|
@@ -207,6 +205,54 @@ function getAppsInTossGlobals() {
|
|
|
207
205
|
return global.__appsInToss;
|
|
208
206
|
}
|
|
209
207
|
|
|
208
|
+
// src/core/utils/safeParseNavigationBar.ts
|
|
209
|
+
function safeParseNavigationBar(navigationBar) {
|
|
210
|
+
if (typeof navigationBar === "object") {
|
|
211
|
+
return navigationBar;
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
return JSON.parse(navigationBar);
|
|
215
|
+
} catch {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// src/core/context/NavigationBarContext.tsx
|
|
221
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
222
|
+
var NavigationBarContext = (0, import_react5.createContext)(null);
|
|
223
|
+
function NavigationBarContextProvider({ children }) {
|
|
224
|
+
const globals = getAppsInTossGlobals();
|
|
225
|
+
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
226
|
+
const [navigationRightButton, setNavigationRightButton] = (0, import_react5.useState)(
|
|
227
|
+
parsedNavigationBar?.initialAccessoryButton
|
|
228
|
+
);
|
|
229
|
+
const addNavigationRightButton = (button) => {
|
|
230
|
+
setNavigationRightButton(button);
|
|
231
|
+
};
|
|
232
|
+
const removeNavigationRightButton = () => {
|
|
233
|
+
setNavigationRightButton(void 0);
|
|
234
|
+
};
|
|
235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
236
|
+
NavigationBarContext.Provider,
|
|
237
|
+
{
|
|
238
|
+
value: { navigationRightButton, addNavigationRightButton, removeNavigationRightButton },
|
|
239
|
+
children
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
function useNavigationBarContext() {
|
|
244
|
+
const context = (0, import_react5.useContext)(NavigationBarContext);
|
|
245
|
+
if (context == null) {
|
|
246
|
+
throw Error("useNavigationBarContext must be used within NavigationBarContextProvider");
|
|
247
|
+
}
|
|
248
|
+
return context;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
252
|
+
var import_native_modules3 = require("@apps-in-toss/native-modules");
|
|
253
|
+
var import_tds_react_native = require("@toss/tds-react-native");
|
|
254
|
+
var import_react6 = require("react");
|
|
255
|
+
|
|
210
256
|
// src/core/utils/toIcon.ts
|
|
211
257
|
function toIcon(source) {
|
|
212
258
|
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
@@ -216,7 +262,7 @@ function toIcon(source) {
|
|
|
216
262
|
function useAppsInTossBridge() {
|
|
217
263
|
const controller = (0, import_tds_react_native.useBridge)();
|
|
218
264
|
const appsInTossGlobals = getAppsInTossGlobals();
|
|
219
|
-
(0,
|
|
265
|
+
(0, import_react6.useEffect)(() => {
|
|
220
266
|
const isGameApp = appsInTossGlobals.webViewType === "game" || appsInTossGlobals.appType === "game";
|
|
221
267
|
controller.open({
|
|
222
268
|
serviceName: appsInTossGlobals.brandDisplayName,
|
|
@@ -232,7 +278,7 @@ function useAppsInTossBridge() {
|
|
|
232
278
|
|
|
233
279
|
// src/components/RNAppContainer.tsx
|
|
234
280
|
var import_native_modules12 = require("@apps-in-toss/native-modules");
|
|
235
|
-
var
|
|
281
|
+
var import_react18 = require("react");
|
|
236
282
|
var import_react_native20 = require("react-native");
|
|
237
283
|
|
|
238
284
|
// src/components/GameInitializer.tsx
|
|
@@ -240,7 +286,7 @@ var import_native_modules7 = require("@apps-in-toss/native-modules");
|
|
|
240
286
|
var import_react_native10 = require("@granite-js/react-native");
|
|
241
287
|
var import_tds_react_native5 = require("@toss/tds-react-native");
|
|
242
288
|
var import_es_hangul = require("es-hangul");
|
|
243
|
-
var
|
|
289
|
+
var import_react12 = require("react");
|
|
244
290
|
var import_react_native11 = require("react-native");
|
|
245
291
|
|
|
246
292
|
// src/constant/game-center.ts
|
|
@@ -254,7 +300,7 @@ var GAME_MIN_VERSION = {
|
|
|
254
300
|
var import_native_modules4 = require("@apps-in-toss/native-modules");
|
|
255
301
|
var import_react_native7 = require("@granite-js/react-native");
|
|
256
302
|
var import_tds_react_native2 = require("@toss/tds-react-native");
|
|
257
|
-
var
|
|
303
|
+
var import_react7 = require("react");
|
|
258
304
|
|
|
259
305
|
// src/utils/market.ts
|
|
260
306
|
var import_react_native6 = require("react-native");
|
|
@@ -268,7 +314,7 @@ var getMarketLink = () => {
|
|
|
268
314
|
function useAppUpdateDialog() {
|
|
269
315
|
const { openConfirm } = (0, import_tds_react_native2.useDialog)();
|
|
270
316
|
const logging = useAppUpdateDialogLogging();
|
|
271
|
-
const openAppUpdateDialog = (0,
|
|
317
|
+
const openAppUpdateDialog = (0, import_react7.useCallback)(
|
|
272
318
|
async ({
|
|
273
319
|
title,
|
|
274
320
|
description,
|
|
@@ -348,12 +394,12 @@ function useAppUpdateDialogLogging() {
|
|
|
348
394
|
|
|
349
395
|
// src/hooks/useGameCenterProfile.ts
|
|
350
396
|
var import_native_modules6 = require("@apps-in-toss/native-modules");
|
|
351
|
-
var
|
|
397
|
+
var import_react11 = require("react");
|
|
352
398
|
|
|
353
399
|
// src/hooks/useErrorAlert.ts
|
|
354
400
|
var import_react_native8 = require("@granite-js/react-native");
|
|
355
401
|
var import_tds_react_native3 = require("@toss/tds-react-native");
|
|
356
|
-
var
|
|
402
|
+
var import_react8 = require("react");
|
|
357
403
|
|
|
358
404
|
// src/utils/error.ts
|
|
359
405
|
var DEFAULT_ERROR = {
|
|
@@ -364,7 +410,7 @@ var DEFAULT_ERROR = {
|
|
|
364
410
|
// src/hooks/useErrorAlert.ts
|
|
365
411
|
var useErrorAlert = () => {
|
|
366
412
|
const { openAlert } = (0, import_tds_react_native3.useDialog)();
|
|
367
|
-
const openErrorAlert = (0,
|
|
413
|
+
const openErrorAlert = (0, import_react8.useCallback)(async () => {
|
|
368
414
|
await openAlert({
|
|
369
415
|
title: DEFAULT_ERROR.title,
|
|
370
416
|
description: DEFAULT_ERROR.description
|
|
@@ -375,7 +421,7 @@ var useErrorAlert = () => {
|
|
|
375
421
|
};
|
|
376
422
|
|
|
377
423
|
// src/hooks/useTransparentWebview.tsx
|
|
378
|
-
var
|
|
424
|
+
var import_react9 = require("react");
|
|
379
425
|
|
|
380
426
|
// src/utils/openTransparentWebView.ts
|
|
381
427
|
var import_react_native9 = require("@granite-js/react-native");
|
|
@@ -417,9 +463,9 @@ var openTransparentWebView = ({
|
|
|
417
463
|
|
|
418
464
|
// src/hooks/useTransparentWebview.tsx
|
|
419
465
|
var useTransparentWebview = () => {
|
|
420
|
-
const [isWebviewLoading, setIsWebviewLoading] = (0,
|
|
466
|
+
const [isWebviewLoading, setIsWebviewLoading] = (0, import_react9.useState)(false);
|
|
421
467
|
const { open: openErrorAlert } = useErrorAlert();
|
|
422
|
-
const _openTransparentWebview = (0,
|
|
468
|
+
const _openTransparentWebview = (0, import_react9.useCallback)(
|
|
423
469
|
({ webUrl, onClose, onError }) => {
|
|
424
470
|
if (isWebviewLoading) {
|
|
425
471
|
return;
|
|
@@ -453,15 +499,15 @@ var useTransparentWebview = () => {
|
|
|
453
499
|
// src/components/GameProfileToast.tsx
|
|
454
500
|
var import_tds_react_native4 = require("@toss/tds-react-native");
|
|
455
501
|
var import_private2 = require("@toss/tds-react-native/private");
|
|
456
|
-
var
|
|
457
|
-
var
|
|
502
|
+
var import_react10 = require("react");
|
|
503
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
458
504
|
var useGameProfileToast = () => {
|
|
459
505
|
const overlay = (0, import_private2.useOverlay)();
|
|
460
|
-
const openGameProfileToast = (0,
|
|
506
|
+
const openGameProfileToast = (0, import_react10.useCallback)(
|
|
461
507
|
(nickname, profileImageUri) => {
|
|
462
508
|
return new Promise((resolve) => {
|
|
463
509
|
overlay.open(({ isOpen, close, exit }) => {
|
|
464
|
-
return /* @__PURE__ */ (0,
|
|
510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private2.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private2.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
465
511
|
import_tds_react_native4.Toast,
|
|
466
512
|
{
|
|
467
513
|
open: isOpen,
|
|
@@ -472,7 +518,7 @@ var useGameProfileToast = () => {
|
|
|
472
518
|
onExited: exit,
|
|
473
519
|
position: "top",
|
|
474
520
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
475
|
-
icon: /* @__PURE__ */ (0,
|
|
521
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
476
522
|
import_tds_react_native4.Asset.Image,
|
|
477
523
|
{
|
|
478
524
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
@@ -492,16 +538,16 @@ var useGameProfileToast = () => {
|
|
|
492
538
|
|
|
493
539
|
// src/hooks/useGameCenterProfile.ts
|
|
494
540
|
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
495
|
-
const [profileData, setProfileData] = (0,
|
|
496
|
-
const [isProfileDataLoading, setIsProfileDataLoading] = (0,
|
|
497
|
-
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0,
|
|
541
|
+
const [profileData, setProfileData] = (0, import_react11.useState)(void 0);
|
|
542
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react11.useState)(true);
|
|
543
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react11.useState)(false);
|
|
498
544
|
const shouldShowProfileLoadingOverlay = isProfileDataLoading && isReadyForProfileUI || isProfileDataRefetching;
|
|
499
545
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
500
546
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
501
547
|
const { openGameProfileToast } = useGameProfileToast();
|
|
502
548
|
const { open: openErrorAlert } = useErrorAlert();
|
|
503
549
|
const { open: openTransparentWebView2 } = useTransparentWebview();
|
|
504
|
-
const fetchProfileData = (0,
|
|
550
|
+
const fetchProfileData = (0, import_react11.useCallback)(async () => {
|
|
505
551
|
try {
|
|
506
552
|
const data = await (0, import_native_modules6.getGameCenterGameProfile)();
|
|
507
553
|
setProfileData(data);
|
|
@@ -511,7 +557,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
511
557
|
setIsProfileDataLoading(false);
|
|
512
558
|
}
|
|
513
559
|
}, [openErrorAlert]);
|
|
514
|
-
const refetchProfileData = (0,
|
|
560
|
+
const refetchProfileData = (0, import_react11.useCallback)(async () => {
|
|
515
561
|
try {
|
|
516
562
|
setIsProfileDataRefetching(true);
|
|
517
563
|
const data = await (0, import_native_modules6.getGameCenterGameProfile)();
|
|
@@ -525,7 +571,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
525
571
|
openErrorAlert();
|
|
526
572
|
}
|
|
527
573
|
}, [openErrorAlert, openGameProfileToast]);
|
|
528
|
-
const openProfileWebview = (0,
|
|
574
|
+
const openProfileWebview = (0, import_react11.useCallback)(() => {
|
|
529
575
|
openTransparentWebView2({
|
|
530
576
|
webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
|
|
531
577
|
onClose: async () => {
|
|
@@ -558,7 +604,7 @@ var Z_INDEX = {
|
|
|
558
604
|
};
|
|
559
605
|
|
|
560
606
|
// src/components/GameInitializer.tsx
|
|
561
|
-
var
|
|
607
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
562
608
|
var GameInitializer = ({ children, isReadyForProfileUI }) => {
|
|
563
609
|
const {
|
|
564
610
|
profileData,
|
|
@@ -569,12 +615,12 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
|
|
|
569
615
|
openGameProfileToast,
|
|
570
616
|
fetchProfileData
|
|
571
617
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
572
|
-
const isCompletedFlow = (0,
|
|
618
|
+
const isCompletedFlow = (0, import_react12.useRef)(false);
|
|
573
619
|
const { open: openAppUpdateDialog } = useAppUpdateDialog();
|
|
574
|
-
(0,
|
|
620
|
+
(0, import_react12.useEffect)(() => {
|
|
575
621
|
fetchProfileData();
|
|
576
622
|
}, []);
|
|
577
|
-
(0,
|
|
623
|
+
(0, import_react12.useEffect)(() => {
|
|
578
624
|
const handleGameProfileFlow = async () => {
|
|
579
625
|
if (!canShowBottomSheetOrToast) {
|
|
580
626
|
return;
|
|
@@ -611,9 +657,9 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
|
|
|
611
657
|
profileData
|
|
612
658
|
]);
|
|
613
659
|
if (!(0, import_native_modules7.isMinVersionSupported)(GAME_MIN_VERSION)) {
|
|
614
|
-
return /* @__PURE__ */ (0,
|
|
615
|
-
/* @__PURE__ */ (0,
|
|
616
|
-
/* @__PURE__ */ (0,
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
|
|
662
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
617
663
|
import_react_native11.Pressable,
|
|
618
664
|
{
|
|
619
665
|
style: {
|
|
@@ -633,9 +679,9 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
|
|
|
633
679
|
] });
|
|
634
680
|
}
|
|
635
681
|
if (shouldShowProfileLoadingOverlay) {
|
|
636
|
-
return /* @__PURE__ */ (0,
|
|
637
|
-
/* @__PURE__ */ (0,
|
|
638
|
-
/* @__PURE__ */ (0,
|
|
682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
639
685
|
import_react_native11.View,
|
|
640
686
|
{
|
|
641
687
|
style: {
|
|
@@ -644,15 +690,15 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
|
|
|
644
690
|
alignItems: "center",
|
|
645
691
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
646
692
|
},
|
|
647
|
-
children: /* @__PURE__ */ (0,
|
|
693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tds_react_native5.Loader, { size: "large", type: "light" })
|
|
648
694
|
}
|
|
649
695
|
)
|
|
650
696
|
] });
|
|
651
697
|
}
|
|
652
698
|
if (shouldShowProfileNotFoundOverlay) {
|
|
653
|
-
return /* @__PURE__ */ (0,
|
|
654
|
-
/* @__PURE__ */ (0,
|
|
655
|
-
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0,
|
|
699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
700
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
|
|
701
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
656
702
|
import_react_native11.Pressable,
|
|
657
703
|
{
|
|
658
704
|
style: {
|
|
@@ -665,7 +711,7 @@ var GameInitializer = ({ children, isReadyForProfileUI }) => {
|
|
|
665
711
|
)
|
|
666
712
|
] });
|
|
667
713
|
}
|
|
668
|
-
return /* @__PURE__ */ (0,
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }) });
|
|
669
715
|
};
|
|
670
716
|
var overlayStyle = {
|
|
671
717
|
position: "absolute",
|
|
@@ -680,10 +726,10 @@ var overlayStyle = {
|
|
|
680
726
|
var import_private5 = require("@toss/tds-react-native/private");
|
|
681
727
|
|
|
682
728
|
// src/components/NavigationBar/RNNavigationBar/hooks/useHardwareBackPress.ts
|
|
683
|
-
var
|
|
729
|
+
var import_react13 = require("react");
|
|
684
730
|
var import_react_native12 = require("react-native");
|
|
685
731
|
function useHardwareBackPress(handler) {
|
|
686
|
-
(0,
|
|
732
|
+
(0, import_react13.useEffect)(() => {
|
|
687
733
|
const handleBackPress = () => {
|
|
688
734
|
handler();
|
|
689
735
|
return true;
|
|
@@ -695,16 +741,16 @@ function useHardwareBackPress(handler) {
|
|
|
695
741
|
|
|
696
742
|
// src/components/NavigationBar/RNNavigationBar/hooks/useNavigationEvent.ts
|
|
697
743
|
var import_react_native14 = require("@granite-js/react-native");
|
|
698
|
-
var
|
|
744
|
+
var import_react15 = require("react");
|
|
699
745
|
|
|
700
746
|
// src/components/NavigationBar/RNNavigationBar/hooks/useCloseConfirm.ts
|
|
701
747
|
var import_tds_react_native6 = require("@toss/tds-react-native");
|
|
702
748
|
var import_es_hangul2 = require("es-hangul");
|
|
703
|
-
var
|
|
749
|
+
var import_react14 = require("react");
|
|
704
750
|
function useCloseConfirm() {
|
|
705
751
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
706
752
|
const { openConfirm } = (0, import_tds_react_native6.useDialog)();
|
|
707
|
-
return (0,
|
|
753
|
+
return (0, import_react14.useCallback)(async ({ onEntered }) => {
|
|
708
754
|
return await openConfirm({
|
|
709
755
|
title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
710
756
|
leftButton: "\uCDE8\uC18C",
|
|
@@ -806,7 +852,7 @@ function useNavigationEvent() {
|
|
|
806
852
|
const navigation = (0, import_react_native14.useNavigation)();
|
|
807
853
|
const closeConfirm = useCloseConfirm();
|
|
808
854
|
const { captureExitLog } = useCaptureExitLog();
|
|
809
|
-
return (0,
|
|
855
|
+
return (0, import_react15.useMemo)(() => {
|
|
810
856
|
const close = async () => {
|
|
811
857
|
const hasConfirmed = await closeConfirm({
|
|
812
858
|
onEntered: logging.closePopupShow
|
|
@@ -844,7 +890,7 @@ var import_native_modules11 = require("@apps-in-toss/native-modules");
|
|
|
844
890
|
var import_react_native18 = require("@granite-js/react-native");
|
|
845
891
|
var import_tds_react_native8 = require("@toss/tds-react-native");
|
|
846
892
|
var import_private4 = require("@toss/tds-react-native/private");
|
|
847
|
-
var
|
|
893
|
+
var import_react16 = require("react");
|
|
848
894
|
|
|
849
895
|
// src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
|
|
850
896
|
var import_native_modules10 = require("@apps-in-toss/native-modules");
|
|
@@ -932,7 +978,7 @@ function addParamsToUrl(url, params) {
|
|
|
932
978
|
}
|
|
933
979
|
|
|
934
980
|
// src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
|
|
935
|
-
var
|
|
981
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
936
982
|
var SHARE_SCHEME_REFERRER = "appsintoss.common_module_share";
|
|
937
983
|
var APP_SHARE_MENU_INFO = {
|
|
938
984
|
contactItemName: "\uACF5\uC720\uD558\uAE30",
|
|
@@ -948,10 +994,10 @@ function AppShareListMenu() {
|
|
|
948
994
|
const schemeForShare = addParamsToUrl(initialScheme, {
|
|
949
995
|
referrer: SHARE_SCHEME_REFERRER
|
|
950
996
|
});
|
|
951
|
-
return /* @__PURE__ */ (0,
|
|
997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
952
998
|
import_tds_react_native7.ListRow,
|
|
953
999
|
{
|
|
954
|
-
left: /* @__PURE__ */ (0,
|
|
1000
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
955
1001
|
import_tds_react_native7.ListRow.Icon,
|
|
956
1002
|
{
|
|
957
1003
|
color: globals.brandPrimaryColor,
|
|
@@ -959,7 +1005,7 @@ function AppShareListMenu() {
|
|
|
959
1005
|
type: "background"
|
|
960
1006
|
}
|
|
961
1007
|
),
|
|
962
|
-
contents: /* @__PURE__ */ (0,
|
|
1008
|
+
contents: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
963
1009
|
import_tds_react_native7.ListRow.Texts,
|
|
964
1010
|
{
|
|
965
1011
|
type: "1RowTypeA",
|
|
@@ -998,7 +1044,7 @@ function ensureValue(value, name) {
|
|
|
998
1044
|
}
|
|
999
1045
|
|
|
1000
1046
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
1001
|
-
var
|
|
1047
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1002
1048
|
var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
|
|
1003
1049
|
var MIN_VERSION = {
|
|
1004
1050
|
BOTTOM_SHEET: {
|
|
@@ -1013,14 +1059,14 @@ var MIN_VERSION = {
|
|
|
1013
1059
|
function useMoreButtonBottomSheet() {
|
|
1014
1060
|
const globals = getAppsInTossGlobals();
|
|
1015
1061
|
const adaptive = (0, import_private4.useAdaptive)();
|
|
1016
|
-
const [itemList, setItemList] = (0,
|
|
1062
|
+
const [itemList, setItemList] = (0, import_react16.useState)([]);
|
|
1017
1063
|
const appUpdateDialog = useAppUpdateDialog();
|
|
1018
1064
|
const logging = useMoreButtonBottomSheetLogging();
|
|
1019
1065
|
const overlay = (0, import_private4.useOverlay)();
|
|
1020
1066
|
const title = ensureValue(globals.brandDisplayName, "displayName");
|
|
1021
1067
|
const isBottomSheetSupported = (0, import_native_modules11.isMinVersionSupported)(MIN_VERSION.BOTTOM_SHEET);
|
|
1022
1068
|
const isShareListMenuSupported = (0, import_native_modules11.isMinVersionSupported)(MIN_VERSION.SHARE_LIST_MENU);
|
|
1023
|
-
(0,
|
|
1069
|
+
(0, import_react16.useEffect)(() => {
|
|
1024
1070
|
if (!isBottomSheetSupported) {
|
|
1025
1071
|
return;
|
|
1026
1072
|
}
|
|
@@ -1047,17 +1093,17 @@ function useMoreButtonBottomSheet() {
|
|
|
1047
1093
|
logging.close();
|
|
1048
1094
|
close();
|
|
1049
1095
|
};
|
|
1050
|
-
return /* @__PURE__ */ (0,
|
|
1096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BottomSheetImpressionArea, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1051
1097
|
import_tds_react_native8.BottomSheet.Root,
|
|
1052
1098
|
{
|
|
1053
|
-
header: /* @__PURE__ */ (0,
|
|
1099
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1054
1100
|
import_tds_react_native8.ListHeader,
|
|
1055
1101
|
{
|
|
1056
|
-
title: /* @__PURE__ */ (0,
|
|
1102
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_tds_react_native8.ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
|
|
1057
1103
|
}
|
|
1058
1104
|
),
|
|
1059
1105
|
open: isOpen,
|
|
1060
|
-
cta: /* @__PURE__ */ (0,
|
|
1106
|
+
cta: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1061
1107
|
import_tds_react_native8.BottomSheet.CTA,
|
|
1062
1108
|
{
|
|
1063
1109
|
size: "large",
|
|
@@ -1071,12 +1117,12 @@ function useMoreButtonBottomSheet() {
|
|
|
1071
1117
|
),
|
|
1072
1118
|
onClose: handleClose,
|
|
1073
1119
|
onExited: exit,
|
|
1074
|
-
children: /* @__PURE__ */ (0,
|
|
1120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_tds_react_native8.List, { rowSeparator: "none", children: [
|
|
1075
1121
|
itemList.map((item) => {
|
|
1076
|
-
return /* @__PURE__ */ (0,
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1077
1123
|
import_tds_react_native8.ListRow,
|
|
1078
1124
|
{
|
|
1079
|
-
left: /* @__PURE__ */ (0,
|
|
1125
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1080
1126
|
import_tds_react_native8.ListRow.Icon,
|
|
1081
1127
|
{
|
|
1082
1128
|
color: globals.brandPrimaryColor,
|
|
@@ -1084,7 +1130,7 @@ function useMoreButtonBottomSheet() {
|
|
|
1084
1130
|
type: "background"
|
|
1085
1131
|
}
|
|
1086
1132
|
),
|
|
1087
|
-
contents: /* @__PURE__ */ (0,
|
|
1133
|
+
contents: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1088
1134
|
import_tds_react_native8.ListRow.Texts,
|
|
1089
1135
|
{
|
|
1090
1136
|
type: "1RowTypeA",
|
|
@@ -1101,7 +1147,7 @@ function useMoreButtonBottomSheet() {
|
|
|
1101
1147
|
item.contactItemName
|
|
1102
1148
|
);
|
|
1103
1149
|
}),
|
|
1104
|
-
isShareListMenuSupported && /* @__PURE__ */ (0,
|
|
1150
|
+
isShareListMenuSupported && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AppShareListMenu, {})
|
|
1105
1151
|
] })
|
|
1106
1152
|
}
|
|
1107
1153
|
) });
|
|
@@ -1111,54 +1157,42 @@ function useMoreButtonBottomSheet() {
|
|
|
1111
1157
|
}
|
|
1112
1158
|
function BottomSheetImpressionArea({ children }) {
|
|
1113
1159
|
const logging = useMoreButtonBottomSheetLogging();
|
|
1114
|
-
(0,
|
|
1160
|
+
(0, import_react16.useEffect)(() => {
|
|
1115
1161
|
logging.show();
|
|
1116
1162
|
}, [logging]);
|
|
1117
|
-
return /* @__PURE__ */ (0,
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
// src/core/utils/safeParseNavigationBar.ts
|
|
1121
|
-
function safeParseNavigationBar(navigationBar) {
|
|
1122
|
-
if (typeof navigationBar === "object") {
|
|
1123
|
-
return navigationBar;
|
|
1124
|
-
}
|
|
1125
|
-
try {
|
|
1126
|
-
return JSON.parse(navigationBar);
|
|
1127
|
-
} catch {
|
|
1128
|
-
return null;
|
|
1129
|
-
}
|
|
1163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children });
|
|
1130
1164
|
}
|
|
1131
1165
|
|
|
1132
1166
|
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
1133
|
-
var
|
|
1134
|
-
var
|
|
1167
|
+
var import_react17 = require("react");
|
|
1168
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1135
1169
|
function NavigationBarImpressionArea({
|
|
1136
1170
|
children,
|
|
1137
1171
|
withHomeButton
|
|
1138
1172
|
}) {
|
|
1139
|
-
const hasLogged = (0,
|
|
1173
|
+
const hasLogged = (0, import_react17.useRef)(false);
|
|
1140
1174
|
const logging = useNavigationBarLogging();
|
|
1141
|
-
(0,
|
|
1175
|
+
(0, import_react17.useEffect)(() => {
|
|
1142
1176
|
if (hasLogged.current === false) {
|
|
1143
1177
|
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
1144
1178
|
hasLogged.current = true;
|
|
1145
1179
|
}
|
|
1146
1180
|
}, [logging, withHomeButton]);
|
|
1147
|
-
return /* @__PURE__ */ (0,
|
|
1181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children });
|
|
1148
1182
|
}
|
|
1149
1183
|
|
|
1150
1184
|
// src/components/NavigationBar/RNNavigationBar/Default.tsx
|
|
1151
|
-
var
|
|
1185
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1152
1186
|
function DefaultNavigationBar() {
|
|
1153
1187
|
const globals = getAppsInTossGlobals();
|
|
1154
1188
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1155
1189
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1156
1190
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1157
1191
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1158
|
-
const
|
|
1192
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1159
1193
|
const navigationEvent = useNavigationEvent();
|
|
1160
1194
|
useHardwareBackPress(navigationEvent.handleBack);
|
|
1161
|
-
return /* @__PURE__ */ (0,
|
|
1195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1162
1196
|
import_private5.TopNavigation,
|
|
1163
1197
|
{
|
|
1164
1198
|
title: globals.brandDisplayName,
|
|
@@ -1168,8 +1202,8 @@ function DefaultNavigationBar() {
|
|
|
1168
1202
|
onPressTitle: withHomeButton ? navigationEvent.handleHomeButtonClick : void 0,
|
|
1169
1203
|
onPressClose: navigationEvent.handleCloseButtonClick,
|
|
1170
1204
|
withHome: withHomeButton,
|
|
1171
|
-
fixedRightButton:
|
|
1172
|
-
children: /* @__PURE__ */ (0,
|
|
1205
|
+
fixedRightButton: navigationRightButton,
|
|
1206
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_private5.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_private5.NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
|
|
1173
1207
|
}
|
|
1174
1208
|
) });
|
|
1175
1209
|
}
|
|
@@ -1179,19 +1213,17 @@ var import_react_native_safe_area_context = require("@granite-js/native/react-na
|
|
|
1179
1213
|
var import_tds_react_native9 = require("@toss/tds-react-native");
|
|
1180
1214
|
var import_private6 = require("@toss/tds-react-native/private");
|
|
1181
1215
|
var import_react_native19 = require("react-native");
|
|
1182
|
-
var
|
|
1216
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1183
1217
|
function GameNavigationBar() {
|
|
1184
1218
|
const safeAreaTop = (0, import_private6.useSafeAreaTop)();
|
|
1185
|
-
const global2 = getAppsInTossGlobals();
|
|
1186
1219
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1187
1220
|
const navigationEvent = useNavigationEvent();
|
|
1221
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1188
1222
|
const { right: safeAreaRight } = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
1189
1223
|
useHardwareBackPress(navigationEvent.handleBack);
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_tds_react_native9.PageNavbar, { preference: { type: "none" } }),
|
|
1194
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_tds_react_native9.PageNavbar, { preference: { type: "none" } }),
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1195
1227
|
import_react_native19.View,
|
|
1196
1228
|
{
|
|
1197
1229
|
style: {
|
|
@@ -1207,10 +1239,10 @@ function GameNavigationBar() {
|
|
|
1207
1239
|
paddingRight: safeAreaRight + 10
|
|
1208
1240
|
},
|
|
1209
1241
|
pointerEvents: "box-none",
|
|
1210
|
-
children: /* @__PURE__ */ (0,
|
|
1242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1211
1243
|
import_private6.NavigationRightContent,
|
|
1212
1244
|
{
|
|
1213
|
-
fixedRightButton:
|
|
1245
|
+
fixedRightButton: navigationRightButton,
|
|
1214
1246
|
onPressDots: openMoreButtonBottomSheet,
|
|
1215
1247
|
onPressClose: navigationEvent.handleCloseButtonClick,
|
|
1216
1248
|
theme: "dark"
|
|
@@ -1234,20 +1266,20 @@ __reExport(bridge_entry_exports, require("@apps-in-toss/native-modules/constant-
|
|
|
1234
1266
|
__reExport(bridge_entry_exports, require("@apps-in-toss/native-modules/event-bridges"));
|
|
1235
1267
|
|
|
1236
1268
|
// src/components/RNAppContainer.tsx
|
|
1237
|
-
var
|
|
1269
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1238
1270
|
function RNAppContainer({ children }) {
|
|
1239
1271
|
const global2 = getAppsInTossGlobals();
|
|
1240
1272
|
switch (global2.appType) {
|
|
1241
1273
|
case "game":
|
|
1242
|
-
return /* @__PURE__ */ (0,
|
|
1274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameAppContainer, { children });
|
|
1243
1275
|
case "general":
|
|
1244
1276
|
default:
|
|
1245
|
-
return /* @__PURE__ */ (0,
|
|
1277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GeneralAppContainer, { children });
|
|
1246
1278
|
}
|
|
1247
1279
|
}
|
|
1248
1280
|
function GameAppContainer({ children }) {
|
|
1249
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1250
|
-
(0,
|
|
1281
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react18.useState)(false);
|
|
1282
|
+
(0, import_react18.useEffect)(() => {
|
|
1251
1283
|
if (import_react_native20.Platform.OS === "ios") {
|
|
1252
1284
|
(0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1253
1285
|
return () => {
|
|
@@ -1256,48 +1288,48 @@ function GameAppContainer({ children }) {
|
|
|
1256
1288
|
}
|
|
1257
1289
|
return;
|
|
1258
1290
|
}, []);
|
|
1259
|
-
(0,
|
|
1291
|
+
(0, import_react18.useEffect)(() => {
|
|
1260
1292
|
import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1261
1293
|
onEvent: () => {
|
|
1262
1294
|
setIsEntryMessageExited(true);
|
|
1263
1295
|
}
|
|
1264
1296
|
});
|
|
1265
1297
|
}, []);
|
|
1266
|
-
return /* @__PURE__ */ (0,
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1268
|
-
(0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0,
|
|
1298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RNNavigationBar.Game, {}),
|
|
1300
|
+
(0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children }) : children
|
|
1269
1301
|
] });
|
|
1270
1302
|
}
|
|
1271
1303
|
function GeneralAppContainer({ children }) {
|
|
1272
|
-
return /* @__PURE__ */ (0,
|
|
1273
|
-
/* @__PURE__ */ (0,
|
|
1304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RNNavigationBar.Default, {}),
|
|
1274
1306
|
children
|
|
1275
1307
|
] });
|
|
1276
1308
|
}
|
|
1277
1309
|
|
|
1278
1310
|
// src/core/registerApp.tsx
|
|
1279
|
-
var
|
|
1311
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1280
1312
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
1281
1313
|
if (!(0, import_native_modules13.isMinVersionSupported)({
|
|
1282
1314
|
android: "5.220.0",
|
|
1283
1315
|
ios: "5.221.0"
|
|
1284
1316
|
})) {
|
|
1285
|
-
return /* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
/* @__PURE__ */ (0,
|
|
1317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AppEvent.Entry, {}),
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AppEvent.System, { ...initialProps }),
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AppUpdate, {})
|
|
1289
1321
|
] });
|
|
1290
1322
|
}
|
|
1291
|
-
return /* @__PURE__ */ (0,
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1293
|
-
/* @__PURE__ */ (0,
|
|
1294
|
-
/* @__PURE__ */ (0,
|
|
1295
|
-
/* @__PURE__ */ (0,
|
|
1323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AppEvent.StayTime, {}),
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AppEvent.Entry, {}),
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AppEvent.System, { ...initialProps }),
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_tds_react_native10.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TDSContainer, { ...initialProps, children }) }) })
|
|
1296
1328
|
] });
|
|
1297
1329
|
}
|
|
1298
1330
|
function TDSContainer({ children }) {
|
|
1299
1331
|
useAppsInTossBridge();
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children });
|
|
1301
1333
|
}
|
|
1302
1334
|
function registerApp(container, { context, analytics }) {
|
|
1303
1335
|
const appName = getAppName();
|
|
@@ -1324,7 +1356,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
1324
1356
|
}
|
|
1325
1357
|
function AppsInTossScreenContainer({ children }) {
|
|
1326
1358
|
const isRNApp = getAppsInTossGlobals().webViewType == null;
|
|
1327
|
-
return /* @__PURE__ */ (0,
|
|
1359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NavigationBarContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_analytics.Analytics.Screen, { children: isRNApp ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RNAppContainer, { children }) : children }) });
|
|
1328
1360
|
}
|
|
1329
1361
|
function getAppName() {
|
|
1330
1362
|
try {
|
|
@@ -1348,13 +1380,13 @@ var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event
|
|
|
1348
1380
|
var import_react_native32 = require("@granite-js/react-native");
|
|
1349
1381
|
var import_tds_react_native14 = require("@toss/tds-react-native");
|
|
1350
1382
|
var import_private9 = require("@toss/tds-react-native/private");
|
|
1351
|
-
var
|
|
1383
|
+
var import_react28 = require("react");
|
|
1352
1384
|
var import_react_native33 = require("react-native");
|
|
1353
1385
|
|
|
1354
1386
|
// src/components/GameWebView.tsx
|
|
1355
1387
|
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
1356
1388
|
var import_react_native_webview = require("@granite-js/native/react-native-webview");
|
|
1357
|
-
var
|
|
1389
|
+
var import_react20 = require("react");
|
|
1358
1390
|
var import_react_native25 = require("react-native");
|
|
1359
1391
|
|
|
1360
1392
|
// src/components/NavigationBar/GameWebviewNavigationBar.tsx
|
|
@@ -1363,9 +1395,9 @@ var import_react_native23 = require("@granite-js/react-native");
|
|
|
1363
1395
|
var import_tds_react_native11 = require("@toss/tds-react-native");
|
|
1364
1396
|
var import_private7 = require("@toss/tds-react-native/private");
|
|
1365
1397
|
var import_es_hangul3 = require("es-hangul");
|
|
1366
|
-
var
|
|
1398
|
+
var import_react19 = require("react");
|
|
1367
1399
|
var import_react_native24 = require("react-native");
|
|
1368
|
-
var
|
|
1400
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1369
1401
|
function GameWebviewNavigationBar() {
|
|
1370
1402
|
const safeAreaTop = (0, import_private7.useSafeAreaTop)();
|
|
1371
1403
|
const { openConfirm } = (0, import_tds_react_native11.useDialog)();
|
|
@@ -1373,10 +1405,9 @@ function GameWebviewNavigationBar() {
|
|
|
1373
1405
|
const global2 = getAppsInTossGlobals();
|
|
1374
1406
|
const logging = useNavigationBarLogging();
|
|
1375
1407
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1408
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1376
1409
|
const { right: safeAreaRight } = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
1377
|
-
const
|
|
1378
|
-
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1379
|
-
const handleGameWebviewClose = (0, import_react18.useCallback)(async () => {
|
|
1410
|
+
const handleGameWebviewClose = (0, import_react19.useCallback)(async () => {
|
|
1380
1411
|
logging.closeButtonClick();
|
|
1381
1412
|
const isConfirmed = await openConfirm({
|
|
1382
1413
|
title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1391,9 +1422,9 @@ function GameWebviewNavigationBar() {
|
|
|
1391
1422
|
(0, import_react_native23.closeView)();
|
|
1392
1423
|
}
|
|
1393
1424
|
}, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
|
|
1394
|
-
return /* @__PURE__ */ (0,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1396
|
-
/* @__PURE__ */ (0,
|
|
1425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_tds_react_native11.PageNavbar, { preference: { type: "none" } }),
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1397
1428
|
import_react_native24.View,
|
|
1398
1429
|
{
|
|
1399
1430
|
style: {
|
|
@@ -1409,10 +1440,10 @@ function GameWebviewNavigationBar() {
|
|
|
1409
1440
|
paddingRight: safeAreaRight + 10
|
|
1410
1441
|
},
|
|
1411
1442
|
pointerEvents: "box-none",
|
|
1412
|
-
children: /* @__PURE__ */ (0,
|
|
1443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1413
1444
|
import_private7.NavigationRightContent,
|
|
1414
1445
|
{
|
|
1415
|
-
fixedRightButton:
|
|
1446
|
+
fixedRightButton: navigationRightButton,
|
|
1416
1447
|
onPressDots: openMoreButtonBottomSheet,
|
|
1417
1448
|
onPressClose: () => {
|
|
1418
1449
|
handleGameWebviewClose();
|
|
@@ -1426,10 +1457,10 @@ function GameWebviewNavigationBar() {
|
|
|
1426
1457
|
}
|
|
1427
1458
|
|
|
1428
1459
|
// src/components/GameWebView.tsx
|
|
1429
|
-
var
|
|
1430
|
-
var GameWebView = (0,
|
|
1431
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1432
|
-
(0,
|
|
1460
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1461
|
+
var GameWebView = (0, import_react20.forwardRef)(function GameWebView2(props, ref) {
|
|
1462
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react20.useState)(false);
|
|
1463
|
+
(0, import_react20.useEffect)(() => {
|
|
1433
1464
|
if (import_react_native25.Platform.OS === "ios") {
|
|
1434
1465
|
(0, import_native_modules14.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1435
1466
|
return () => {
|
|
@@ -1438,30 +1469,30 @@ var GameWebView = (0, import_react19.forwardRef)(function GameWebView2(props, re
|
|
|
1438
1469
|
}
|
|
1439
1470
|
return;
|
|
1440
1471
|
}, []);
|
|
1441
|
-
(0,
|
|
1472
|
+
(0, import_react20.useEffect)(() => {
|
|
1442
1473
|
import_native_modules14.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1443
1474
|
onEvent: () => {
|
|
1444
1475
|
setIsEntryMessageExited(true);
|
|
1445
1476
|
}
|
|
1446
1477
|
});
|
|
1447
1478
|
}, []);
|
|
1448
|
-
return /* @__PURE__ */ (0,
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1450
|
-
(0, import_native_modules14.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0,
|
|
1479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GameWebviewNavigationBar, {}),
|
|
1481
|
+
(0, import_native_modules14.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GameInitializer, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_webview.WebView, { ref, ...props })
|
|
1451
1482
|
] });
|
|
1452
1483
|
});
|
|
1453
1484
|
|
|
1454
1485
|
// src/components/PartnerWebView.tsx
|
|
1455
1486
|
var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
|
|
1456
|
-
var
|
|
1487
|
+
var import_react22 = require("react");
|
|
1457
1488
|
|
|
1458
1489
|
// src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
|
|
1459
1490
|
var import_react_native26 = require("@granite-js/react-native");
|
|
1460
1491
|
var import_tds_react_native12 = require("@toss/tds-react-native");
|
|
1461
1492
|
var import_private8 = require("@toss/tds-react-native/private");
|
|
1462
1493
|
var import_es_hangul4 = require("es-hangul");
|
|
1463
|
-
var
|
|
1464
|
-
var
|
|
1494
|
+
var import_react21 = require("react");
|
|
1495
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1465
1496
|
function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
1466
1497
|
const globals = getAppsInTossGlobals();
|
|
1467
1498
|
const { captureExitLog } = useCaptureExitLog();
|
|
@@ -1471,8 +1502,8 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1471
1502
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1472
1503
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1473
1504
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1474
|
-
const
|
|
1475
|
-
const handleClose = (0,
|
|
1505
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1506
|
+
const handleClose = (0, import_react21.useCallback)(async () => {
|
|
1476
1507
|
logging.closeButtonClick();
|
|
1477
1508
|
const isConfirmed = await openConfirm({
|
|
1478
1509
|
title: `${(0, import_es_hangul4.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1487,7 +1518,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1487
1518
|
(0, import_react_native26.closeView)();
|
|
1488
1519
|
}
|
|
1489
1520
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1490
|
-
return /* @__PURE__ */ (0,
|
|
1521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1491
1522
|
import_private8.TopNavigation,
|
|
1492
1523
|
{
|
|
1493
1524
|
title: globals.brandDisplayName,
|
|
@@ -1497,23 +1528,23 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1497
1528
|
onPressTitle: withHomeButton ? onHomeButtonClick : void 0,
|
|
1498
1529
|
onPressClose: handleClose,
|
|
1499
1530
|
withHome: withHomeButton,
|
|
1500
|
-
fixedRightButton:
|
|
1501
|
-
children: /* @__PURE__ */ (0,
|
|
1531
|
+
fixedRightButton: navigationRightButton,
|
|
1532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_private8.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_private8.NavigationBackButton, { onPress: onBackButtonClick, canGoBack: false }) })
|
|
1502
1533
|
}
|
|
1503
1534
|
) });
|
|
1504
1535
|
}
|
|
1505
1536
|
|
|
1506
1537
|
// src/components/PartnerWebView.tsx
|
|
1507
|
-
var
|
|
1508
|
-
var PartnerWebView = (0,
|
|
1509
|
-
return /* @__PURE__ */ (0,
|
|
1510
|
-
/* @__PURE__ */ (0,
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1538
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1539
|
+
var PartnerWebView = (0, import_react22.forwardRef)(function PartnerWebViewScreen({ onBackButtonClick, onHomeButtonClick, ...webViewProps }, ref) {
|
|
1540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_webview2.WebView, { ref, ...webViewProps, style: { flex: 1 } })
|
|
1512
1543
|
] });
|
|
1513
1544
|
});
|
|
1514
1545
|
|
|
1515
1546
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1516
|
-
var
|
|
1547
|
+
var import_react23 = require("react");
|
|
1517
1548
|
function serializeError(error) {
|
|
1518
1549
|
return JSON.stringify(error, (_, value) => {
|
|
1519
1550
|
if (value instanceof Error) {
|
|
@@ -1566,8 +1597,8 @@ function useBridgeHandler({
|
|
|
1566
1597
|
eventListenerMap,
|
|
1567
1598
|
injectedJavaScript: originalInjectedJavaScript
|
|
1568
1599
|
}) {
|
|
1569
|
-
const ref = (0,
|
|
1570
|
-
const injectedJavaScript = (0,
|
|
1600
|
+
const ref = (0, import_react23.useRef)(null);
|
|
1601
|
+
const injectedJavaScript = (0, import_react23.useMemo)(
|
|
1571
1602
|
() => [
|
|
1572
1603
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1573
1604
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1594,7 +1625,7 @@ function useBridgeHandler({
|
|
|
1594
1625
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1595
1626
|
`);
|
|
1596
1627
|
};
|
|
1597
|
-
const $onMessage = (0,
|
|
1628
|
+
const $onMessage = (0, import_react23.useCallback)(
|
|
1598
1629
|
async (e) => {
|
|
1599
1630
|
onMessage?.(e);
|
|
1600
1631
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1648,10 +1679,10 @@ function useBridgeHandler({
|
|
|
1648
1679
|
var import_react_native27 = require("@granite-js/react-native");
|
|
1649
1680
|
var import_tds_react_native13 = require("@toss/tds-react-native");
|
|
1650
1681
|
var import_es_hangul5 = require("es-hangul");
|
|
1651
|
-
var
|
|
1682
|
+
var import_react25 = require("react");
|
|
1652
1683
|
|
|
1653
1684
|
// src/hooks/useWebviewHistoryStack.tsx
|
|
1654
|
-
var
|
|
1685
|
+
var import_react24 = require("react");
|
|
1655
1686
|
var INITIAL_STATE = { stack: [], index: -1 };
|
|
1656
1687
|
function reducer(state, action) {
|
|
1657
1688
|
switch (action.type) {
|
|
@@ -1682,11 +1713,11 @@ function reducer(state, action) {
|
|
|
1682
1713
|
}
|
|
1683
1714
|
}
|
|
1684
1715
|
function useWebViewHistory() {
|
|
1685
|
-
const [state, dispatch] = (0,
|
|
1686
|
-
const onNavigationStateChange = (0,
|
|
1716
|
+
const [state, dispatch] = (0, import_react24.useReducer)(reducer, INITIAL_STATE);
|
|
1717
|
+
const onNavigationStateChange = (0, import_react24.useCallback)(({ url, canGoForward: canGoForward2 }) => {
|
|
1687
1718
|
dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
|
|
1688
1719
|
}, []);
|
|
1689
|
-
const { canGoBack, canGoForward } = (0,
|
|
1720
|
+
const { canGoBack, canGoForward } = (0, import_react24.useMemo)(() => {
|
|
1690
1721
|
const canBack = state.index > 0;
|
|
1691
1722
|
const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
|
|
1692
1723
|
return { canGoBack: canBack, canGoForward: canFwd };
|
|
@@ -1719,19 +1750,19 @@ function useWebBackHandler(webViewRef) {
|
|
|
1719
1750
|
const logging = useNavigationBarLogging();
|
|
1720
1751
|
const { openConfirm } = (0, import_tds_react_native13.useDialog)();
|
|
1721
1752
|
const global2 = getAppsInTossGlobals();
|
|
1722
|
-
const addEventListener = (0,
|
|
1753
|
+
const addEventListener = (0, import_react25.useCallback)(
|
|
1723
1754
|
(handler) => {
|
|
1724
1755
|
addWebBackEventListener(handler);
|
|
1725
1756
|
},
|
|
1726
1757
|
[addWebBackEventListener]
|
|
1727
1758
|
);
|
|
1728
|
-
const removeEventListener = (0,
|
|
1759
|
+
const removeEventListener = (0, import_react25.useCallback)(
|
|
1729
1760
|
(handler) => {
|
|
1730
1761
|
removeWebBackEventListener(handler);
|
|
1731
1762
|
},
|
|
1732
1763
|
[removeWebBackEventListener]
|
|
1733
1764
|
);
|
|
1734
|
-
const handleWebBack = (0,
|
|
1765
|
+
const handleWebBack = (0, import_react25.useCallback)(async () => {
|
|
1735
1766
|
if (hasWebBackEvent) {
|
|
1736
1767
|
for (const handler of webBackHandlersRef) {
|
|
1737
1768
|
handler();
|
|
@@ -1764,7 +1795,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1764
1795
|
openConfirm,
|
|
1765
1796
|
webViewRef
|
|
1766
1797
|
]);
|
|
1767
|
-
const handleWebHome = (0,
|
|
1798
|
+
const handleWebHome = (0, import_react25.useCallback)(() => {
|
|
1768
1799
|
logging.homeButtonClick();
|
|
1769
1800
|
if (hasWebBackEvent) {
|
|
1770
1801
|
for (const handler of webBackHandlersRef) {
|
|
@@ -1774,7 +1805,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1774
1805
|
}
|
|
1775
1806
|
webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
|
|
1776
1807
|
}, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
|
|
1777
|
-
return (0,
|
|
1808
|
+
return (0, import_react25.useMemo)(
|
|
1778
1809
|
() => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
|
|
1779
1810
|
[addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
|
|
1780
1811
|
);
|
|
@@ -1931,7 +1962,7 @@ function useCreateUserAgent({
|
|
|
1931
1962
|
const platform = (0, import_native_modules15.getPlatformOS)();
|
|
1932
1963
|
const appVersion = (0, import_native_modules15.getTossAppVersion)();
|
|
1933
1964
|
const { fontScale } = (0, import_react_native28.useWindowDimensions)();
|
|
1934
|
-
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1965
|
+
const platformString = platform === "ios" ? "iPhone" : "Android phone";
|
|
1935
1966
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1936
1967
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1937
1968
|
return [
|
|
@@ -1952,11 +1983,11 @@ function useCreateUserAgent({
|
|
|
1952
1983
|
// src/hooks/useGeolocation.ts
|
|
1953
1984
|
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1954
1985
|
var import_react_native29 = require("@granite-js/react-native");
|
|
1955
|
-
var
|
|
1986
|
+
var import_react26 = require("react");
|
|
1956
1987
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1957
1988
|
const isVisible = (0, import_react_native29.useVisibility)();
|
|
1958
|
-
const [location, setLocation] = (0,
|
|
1959
|
-
(0,
|
|
1989
|
+
const [location, setLocation] = (0, import_react26.useState)(null);
|
|
1990
|
+
(0, import_react26.useEffect)(() => {
|
|
1960
1991
|
if (!isVisible) {
|
|
1961
1992
|
return;
|
|
1962
1993
|
}
|
|
@@ -1975,11 +2006,11 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1975
2006
|
|
|
1976
2007
|
// src/hooks/useWaitForReturnNavigator.tsx
|
|
1977
2008
|
var import_react_native30 = require("@granite-js/react-native");
|
|
1978
|
-
var
|
|
2009
|
+
var import_react27 = require("react");
|
|
1979
2010
|
function useWaitForReturnNavigator() {
|
|
1980
|
-
const callbacks = (0,
|
|
2011
|
+
const callbacks = (0, import_react27.useRef)([]).current;
|
|
1981
2012
|
const navigation = (0, import_react_native30.useNavigation)();
|
|
1982
|
-
const startNavigating = (0,
|
|
2013
|
+
const startNavigating = (0, import_react27.useCallback)(
|
|
1983
2014
|
(route, params) => {
|
|
1984
2015
|
return new Promise((resolve) => {
|
|
1985
2016
|
callbacks.push(resolve);
|
|
@@ -1988,7 +2019,7 @@ function useWaitForReturnNavigator() {
|
|
|
1988
2019
|
},
|
|
1989
2020
|
[callbacks, navigation]
|
|
1990
2021
|
);
|
|
1991
|
-
const handleVisibilityChange = (0,
|
|
2022
|
+
const handleVisibilityChange = (0, import_react27.useCallback)(
|
|
1992
2023
|
(state) => {
|
|
1993
2024
|
if (state === "visible" && callbacks.length > 0) {
|
|
1994
2025
|
for (const callback of callbacks) {
|
|
@@ -2003,6 +2034,15 @@ function useWaitForReturnNavigator() {
|
|
|
2003
2034
|
return startNavigating;
|
|
2004
2035
|
}
|
|
2005
2036
|
|
|
2037
|
+
// src/hooks/useTopNavigation.tsx
|
|
2038
|
+
function useTopNavigation() {
|
|
2039
|
+
const { addNavigationRightButton, removeNavigationRightButton } = useNavigationBarContext();
|
|
2040
|
+
return {
|
|
2041
|
+
addAccessoryButton: addNavigationRightButton,
|
|
2042
|
+
removeAccessoryButton: removeNavigationRightButton
|
|
2043
|
+
};
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2006
2046
|
// src/utils/log.ts
|
|
2007
2047
|
var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
2008
2048
|
var import_react_native31 = require("@granite-js/react-native");
|
|
@@ -2053,7 +2093,7 @@ var trackScreen = (url) => {
|
|
|
2053
2093
|
};
|
|
2054
2094
|
|
|
2055
2095
|
// src/components/WebView.tsx
|
|
2056
|
-
var
|
|
2096
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2057
2097
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
2058
2098
|
var TYPES = ["partner", "external", "game"];
|
|
2059
2099
|
var WEBVIEW_TYPES = {
|
|
@@ -2087,13 +2127,13 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2087
2127
|
if (!TYPES.includes(type)) {
|
|
2088
2128
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
2089
2129
|
}
|
|
2090
|
-
const webViewRef = (0,
|
|
2130
|
+
const webViewRef = (0, import_react28.useRef)(null);
|
|
2091
2131
|
const webBackHandler = useWebBackHandler(webViewRef);
|
|
2092
|
-
const uri = (0,
|
|
2132
|
+
const uri = (0, import_react28.useMemo)(() => getWebViewUri(local), [local]);
|
|
2093
2133
|
const top = (0, import_private9.useSafeAreaTop)();
|
|
2094
2134
|
const bottom = (0, import_private9.useSafeAreaBottom)();
|
|
2095
2135
|
const global2 = getAppsInTossGlobals();
|
|
2096
|
-
const
|
|
2136
|
+
const navigationBarContext = useNavigationBarContext();
|
|
2097
2137
|
const disableTextSelectionCSS = `
|
|
2098
2138
|
(function() {
|
|
2099
2139
|
const style = document.createElement('style');
|
|
@@ -2101,7 +2141,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2101
2141
|
document.head.appendChild(style);
|
|
2102
2142
|
})();
|
|
2103
2143
|
`;
|
|
2104
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0,
|
|
2144
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react28.useState)(
|
|
2105
2145
|
props.allowsBackForwardNavigationGestures
|
|
2106
2146
|
);
|
|
2107
2147
|
const handler = useBridgeHandler({
|
|
@@ -2155,8 +2195,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2155
2195
|
setAllowsBackForwardNavigationGestures(options.isEnabled);
|
|
2156
2196
|
return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
|
|
2157
2197
|
},
|
|
2158
|
-
addAccessoryButton: async (params) =>
|
|
2159
|
-
removeAccessoryButton: async () =>
|
|
2198
|
+
addAccessoryButton: async (params) => navigationBarContext.addNavigationRightButton(params),
|
|
2199
|
+
removeAccessoryButton: async () => navigationBarContext.removeNavigationRightButton(),
|
|
2160
2200
|
/** permissions */
|
|
2161
2201
|
requestPermission: appsInTossAsyncBridges.requestPermission,
|
|
2162
2202
|
openPermissionDialog: appsInTossAsyncBridges.openPermissionDialog,
|
|
@@ -2181,7 +2221,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2181
2221
|
completeProductGrant: import_native_modules18.IAP.completeProductGrant
|
|
2182
2222
|
}
|
|
2183
2223
|
});
|
|
2184
|
-
const headerPropForExternalWebView = (0,
|
|
2224
|
+
const headerPropForExternalWebView = (0, import_react28.useMemo)(() => {
|
|
2185
2225
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
2186
2226
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
2187
2227
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -2202,7 +2242,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2202
2242
|
colorPreference: "light"
|
|
2203
2243
|
});
|
|
2204
2244
|
const refs = mergeRefs(handler.ref, webViewRef);
|
|
2205
|
-
(0,
|
|
2245
|
+
(0, import_react28.useEffect)(() => {
|
|
2206
2246
|
const callback = () => {
|
|
2207
2247
|
webBackHandler.handleWebBack();
|
|
2208
2248
|
return true;
|
|
@@ -2210,7 +2250,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2210
2250
|
import_react_native33.BackHandler.addEventListener("hardwareBackPress", callback);
|
|
2211
2251
|
return () => import_react_native33.BackHandler.removeEventListener("hardwareBackPress", callback);
|
|
2212
2252
|
}, [webBackHandler]);
|
|
2213
|
-
return /* @__PURE__ */ (0,
|
|
2253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2214
2254
|
BaseWebView,
|
|
2215
2255
|
{
|
|
2216
2256
|
ref: refs,
|