@apps-in-toss/framework 0.0.0-dev.1761276327591 → 0.0.0-dev.1762248930136
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 +231 -187
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +163 -119
- 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,28 +1202,28 @@ 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
|
}
|
|
1176
1210
|
|
|
1177
1211
|
// src/components/NavigationBar/RNNavigationBar/Game.tsx
|
|
1212
|
+
var import_react_native_safe_area_context = require("@granite-js/native/react-native-safe-area-context");
|
|
1178
1213
|
var import_tds_react_native9 = require("@toss/tds-react-native");
|
|
1179
1214
|
var import_private6 = require("@toss/tds-react-native/private");
|
|
1180
1215
|
var import_react_native19 = require("react-native");
|
|
1181
|
-
var
|
|
1216
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1182
1217
|
function GameNavigationBar() {
|
|
1183
1218
|
const safeAreaTop = (0, import_private6.useSafeAreaTop)();
|
|
1184
|
-
const global2 = getAppsInTossGlobals();
|
|
1185
1219
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1186
1220
|
const navigationEvent = useNavigationEvent();
|
|
1221
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1222
|
+
const { right: safeAreaRight } = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
1187
1223
|
useHardwareBackPress(navigationEvent.handleBack);
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_tds_react_native9.PageNavbar, { preference: { type: "none" } }),
|
|
1192
|
-
/* @__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)(
|
|
1193
1227
|
import_react_native19.View,
|
|
1194
1228
|
{
|
|
1195
1229
|
style: {
|
|
@@ -1202,13 +1236,13 @@ function GameNavigationBar() {
|
|
|
1202
1236
|
position: "absolute",
|
|
1203
1237
|
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1204
1238
|
marginTop: safeAreaTop,
|
|
1205
|
-
paddingRight: 10
|
|
1239
|
+
paddingRight: safeAreaRight + 10
|
|
1206
1240
|
},
|
|
1207
1241
|
pointerEvents: "box-none",
|
|
1208
|
-
children: /* @__PURE__ */ (0,
|
|
1242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1209
1243
|
import_private6.NavigationRightContent,
|
|
1210
1244
|
{
|
|
1211
|
-
fixedRightButton:
|
|
1245
|
+
fixedRightButton: navigationRightButton,
|
|
1212
1246
|
onPressDots: openMoreButtonBottomSheet,
|
|
1213
1247
|
onPressClose: navigationEvent.handleCloseButtonClick,
|
|
1214
1248
|
theme: "dark"
|
|
@@ -1232,20 +1266,20 @@ __reExport(bridge_entry_exports, require("@apps-in-toss/native-modules/constant-
|
|
|
1232
1266
|
__reExport(bridge_entry_exports, require("@apps-in-toss/native-modules/event-bridges"));
|
|
1233
1267
|
|
|
1234
1268
|
// src/components/RNAppContainer.tsx
|
|
1235
|
-
var
|
|
1269
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1236
1270
|
function RNAppContainer({ children }) {
|
|
1237
1271
|
const global2 = getAppsInTossGlobals();
|
|
1238
1272
|
switch (global2.appType) {
|
|
1239
1273
|
case "game":
|
|
1240
|
-
return /* @__PURE__ */ (0,
|
|
1274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameAppContainer, { children });
|
|
1241
1275
|
case "general":
|
|
1242
1276
|
default:
|
|
1243
|
-
return /* @__PURE__ */ (0,
|
|
1277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GeneralAppContainer, { children });
|
|
1244
1278
|
}
|
|
1245
1279
|
}
|
|
1246
1280
|
function GameAppContainer({ children }) {
|
|
1247
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1248
|
-
(0,
|
|
1281
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react18.useState)(false);
|
|
1282
|
+
(0, import_react18.useEffect)(() => {
|
|
1249
1283
|
if (import_react_native20.Platform.OS === "ios") {
|
|
1250
1284
|
(0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1251
1285
|
return () => {
|
|
@@ -1254,48 +1288,48 @@ function GameAppContainer({ children }) {
|
|
|
1254
1288
|
}
|
|
1255
1289
|
return;
|
|
1256
1290
|
}, []);
|
|
1257
|
-
(0,
|
|
1291
|
+
(0, import_react18.useEffect)(() => {
|
|
1258
1292
|
import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1259
1293
|
onEvent: () => {
|
|
1260
1294
|
setIsEntryMessageExited(true);
|
|
1261
1295
|
}
|
|
1262
1296
|
});
|
|
1263
1297
|
}, []);
|
|
1264
|
-
return /* @__PURE__ */ (0,
|
|
1265
|
-
/* @__PURE__ */ (0,
|
|
1266
|
-
(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
|
|
1267
1301
|
] });
|
|
1268
1302
|
}
|
|
1269
1303
|
function GeneralAppContainer({ children }) {
|
|
1270
|
-
return /* @__PURE__ */ (0,
|
|
1271
|
-
/* @__PURE__ */ (0,
|
|
1304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RNNavigationBar.Default, {}),
|
|
1272
1306
|
children
|
|
1273
1307
|
] });
|
|
1274
1308
|
}
|
|
1275
1309
|
|
|
1276
1310
|
// src/core/registerApp.tsx
|
|
1277
|
-
var
|
|
1311
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1278
1312
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
1279
1313
|
if (!(0, import_native_modules13.isMinVersionSupported)({
|
|
1280
1314
|
android: "5.220.0",
|
|
1281
1315
|
ios: "5.221.0"
|
|
1282
1316
|
})) {
|
|
1283
|
-
return /* @__PURE__ */ (0,
|
|
1284
|
-
/* @__PURE__ */ (0,
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1286
|
-
/* @__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, {})
|
|
1287
1321
|
] });
|
|
1288
1322
|
}
|
|
1289
|
-
return /* @__PURE__ */ (0,
|
|
1290
|
-
/* @__PURE__ */ (0,
|
|
1291
|
-
/* @__PURE__ */ (0,
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1293
|
-
/* @__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 }) }) })
|
|
1294
1328
|
] });
|
|
1295
1329
|
}
|
|
1296
1330
|
function TDSContainer({ children }) {
|
|
1297
1331
|
useAppsInTossBridge();
|
|
1298
|
-
return /* @__PURE__ */ (0,
|
|
1332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children });
|
|
1299
1333
|
}
|
|
1300
1334
|
function registerApp(container, { context, analytics }) {
|
|
1301
1335
|
const appName = getAppName();
|
|
@@ -1322,7 +1356,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
1322
1356
|
}
|
|
1323
1357
|
function AppsInTossScreenContainer({ children }) {
|
|
1324
1358
|
const isRNApp = getAppsInTossGlobals().webViewType == null;
|
|
1325
|
-
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 }) });
|
|
1326
1360
|
}
|
|
1327
1361
|
function getAppName() {
|
|
1328
1362
|
try {
|
|
@@ -1346,23 +1380,24 @@ var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event
|
|
|
1346
1380
|
var import_react_native32 = require("@granite-js/react-native");
|
|
1347
1381
|
var import_tds_react_native14 = require("@toss/tds-react-native");
|
|
1348
1382
|
var import_private9 = require("@toss/tds-react-native/private");
|
|
1349
|
-
var
|
|
1383
|
+
var import_react28 = require("react");
|
|
1350
1384
|
var import_react_native33 = require("react-native");
|
|
1351
1385
|
|
|
1352
1386
|
// src/components/GameWebView.tsx
|
|
1353
1387
|
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
1354
1388
|
var import_react_native_webview = require("@granite-js/native/react-native-webview");
|
|
1355
|
-
var
|
|
1389
|
+
var import_react20 = require("react");
|
|
1356
1390
|
var import_react_native25 = require("react-native");
|
|
1357
1391
|
|
|
1358
1392
|
// src/components/NavigationBar/GameWebviewNavigationBar.tsx
|
|
1393
|
+
var import_react_native_safe_area_context2 = require("@granite-js/native/react-native-safe-area-context");
|
|
1359
1394
|
var import_react_native23 = require("@granite-js/react-native");
|
|
1360
1395
|
var import_tds_react_native11 = require("@toss/tds-react-native");
|
|
1361
1396
|
var import_private7 = require("@toss/tds-react-native/private");
|
|
1362
1397
|
var import_es_hangul3 = require("es-hangul");
|
|
1363
|
-
var
|
|
1398
|
+
var import_react19 = require("react");
|
|
1364
1399
|
var import_react_native24 = require("react-native");
|
|
1365
|
-
var
|
|
1400
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1366
1401
|
function GameWebviewNavigationBar() {
|
|
1367
1402
|
const safeAreaTop = (0, import_private7.useSafeAreaTop)();
|
|
1368
1403
|
const { openConfirm } = (0, import_tds_react_native11.useDialog)();
|
|
@@ -1370,9 +1405,9 @@ function GameWebviewNavigationBar() {
|
|
|
1370
1405
|
const global2 = getAppsInTossGlobals();
|
|
1371
1406
|
const logging = useNavigationBarLogging();
|
|
1372
1407
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1373
|
-
const
|
|
1374
|
-
const
|
|
1375
|
-
const handleGameWebviewClose = (0,
|
|
1408
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1409
|
+
const { right: safeAreaRight } = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
1410
|
+
const handleGameWebviewClose = (0, import_react19.useCallback)(async () => {
|
|
1376
1411
|
logging.closeButtonClick();
|
|
1377
1412
|
const isConfirmed = await openConfirm({
|
|
1378
1413
|
title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1387,9 +1422,9 @@ function GameWebviewNavigationBar() {
|
|
|
1387
1422
|
(0, import_react_native23.closeView)();
|
|
1388
1423
|
}
|
|
1389
1424
|
}, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
|
|
1390
|
-
return /* @__PURE__ */ (0,
|
|
1391
|
-
/* @__PURE__ */ (0,
|
|
1392
|
-
/* @__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)(
|
|
1393
1428
|
import_react_native24.View,
|
|
1394
1429
|
{
|
|
1395
1430
|
style: {
|
|
@@ -1402,13 +1437,13 @@ function GameWebviewNavigationBar() {
|
|
|
1402
1437
|
position: "absolute",
|
|
1403
1438
|
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1404
1439
|
marginTop: safeAreaTop,
|
|
1405
|
-
paddingRight: 10
|
|
1440
|
+
paddingRight: safeAreaRight + 10
|
|
1406
1441
|
},
|
|
1407
1442
|
pointerEvents: "box-none",
|
|
1408
|
-
children: /* @__PURE__ */ (0,
|
|
1443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1409
1444
|
import_private7.NavigationRightContent,
|
|
1410
1445
|
{
|
|
1411
|
-
fixedRightButton:
|
|
1446
|
+
fixedRightButton: navigationRightButton,
|
|
1412
1447
|
onPressDots: openMoreButtonBottomSheet,
|
|
1413
1448
|
onPressClose: () => {
|
|
1414
1449
|
handleGameWebviewClose();
|
|
@@ -1422,10 +1457,10 @@ function GameWebviewNavigationBar() {
|
|
|
1422
1457
|
}
|
|
1423
1458
|
|
|
1424
1459
|
// src/components/GameWebView.tsx
|
|
1425
|
-
var
|
|
1426
|
-
var GameWebView = (0,
|
|
1427
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1428
|
-
(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)(() => {
|
|
1429
1464
|
if (import_react_native25.Platform.OS === "ios") {
|
|
1430
1465
|
(0, import_native_modules14.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1431
1466
|
return () => {
|
|
@@ -1434,30 +1469,30 @@ var GameWebView = (0, import_react19.forwardRef)(function GameWebView2(props, re
|
|
|
1434
1469
|
}
|
|
1435
1470
|
return;
|
|
1436
1471
|
}, []);
|
|
1437
|
-
(0,
|
|
1472
|
+
(0, import_react20.useEffect)(() => {
|
|
1438
1473
|
import_native_modules14.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1439
1474
|
onEvent: () => {
|
|
1440
1475
|
setIsEntryMessageExited(true);
|
|
1441
1476
|
}
|
|
1442
1477
|
});
|
|
1443
1478
|
}, []);
|
|
1444
|
-
return /* @__PURE__ */ (0,
|
|
1445
|
-
/* @__PURE__ */ (0,
|
|
1446
|
-
(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 })
|
|
1447
1482
|
] });
|
|
1448
1483
|
});
|
|
1449
1484
|
|
|
1450
1485
|
// src/components/PartnerWebView.tsx
|
|
1451
1486
|
var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
|
|
1452
|
-
var
|
|
1487
|
+
var import_react22 = require("react");
|
|
1453
1488
|
|
|
1454
1489
|
// src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
|
|
1455
1490
|
var import_react_native26 = require("@granite-js/react-native");
|
|
1456
1491
|
var import_tds_react_native12 = require("@toss/tds-react-native");
|
|
1457
1492
|
var import_private8 = require("@toss/tds-react-native/private");
|
|
1458
1493
|
var import_es_hangul4 = require("es-hangul");
|
|
1459
|
-
var
|
|
1460
|
-
var
|
|
1494
|
+
var import_react21 = require("react");
|
|
1495
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1461
1496
|
function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
1462
1497
|
const globals = getAppsInTossGlobals();
|
|
1463
1498
|
const { captureExitLog } = useCaptureExitLog();
|
|
@@ -1467,8 +1502,8 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1467
1502
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1468
1503
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1469
1504
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1470
|
-
const
|
|
1471
|
-
const handleClose = (0,
|
|
1505
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1506
|
+
const handleClose = (0, import_react21.useCallback)(async () => {
|
|
1472
1507
|
logging.closeButtonClick();
|
|
1473
1508
|
const isConfirmed = await openConfirm({
|
|
1474
1509
|
title: `${(0, import_es_hangul4.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1483,7 +1518,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1483
1518
|
(0, import_react_native26.closeView)();
|
|
1484
1519
|
}
|
|
1485
1520
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1486
|
-
return /* @__PURE__ */ (0,
|
|
1521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1487
1522
|
import_private8.TopNavigation,
|
|
1488
1523
|
{
|
|
1489
1524
|
title: globals.brandDisplayName,
|
|
@@ -1493,23 +1528,23 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1493
1528
|
onPressTitle: withHomeButton ? onHomeButtonClick : void 0,
|
|
1494
1529
|
onPressClose: handleClose,
|
|
1495
1530
|
withHome: withHomeButton,
|
|
1496
|
-
fixedRightButton:
|
|
1497
|
-
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 }) })
|
|
1498
1533
|
}
|
|
1499
1534
|
) });
|
|
1500
1535
|
}
|
|
1501
1536
|
|
|
1502
1537
|
// src/components/PartnerWebView.tsx
|
|
1503
|
-
var
|
|
1504
|
-
var PartnerWebView = (0,
|
|
1505
|
-
return /* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1507
|
-
/* @__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 } })
|
|
1508
1543
|
] });
|
|
1509
1544
|
});
|
|
1510
1545
|
|
|
1511
1546
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1512
|
-
var
|
|
1547
|
+
var import_react23 = require("react");
|
|
1513
1548
|
function serializeError(error) {
|
|
1514
1549
|
return JSON.stringify(error, (_, value) => {
|
|
1515
1550
|
if (value instanceof Error) {
|
|
@@ -1562,8 +1597,8 @@ function useBridgeHandler({
|
|
|
1562
1597
|
eventListenerMap,
|
|
1563
1598
|
injectedJavaScript: originalInjectedJavaScript
|
|
1564
1599
|
}) {
|
|
1565
|
-
const ref = (0,
|
|
1566
|
-
const injectedJavaScript = (0,
|
|
1600
|
+
const ref = (0, import_react23.useRef)(null);
|
|
1601
|
+
const injectedJavaScript = (0, import_react23.useMemo)(
|
|
1567
1602
|
() => [
|
|
1568
1603
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1569
1604
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1590,7 +1625,7 @@ function useBridgeHandler({
|
|
|
1590
1625
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1591
1626
|
`);
|
|
1592
1627
|
};
|
|
1593
|
-
const $onMessage = (0,
|
|
1628
|
+
const $onMessage = (0, import_react23.useCallback)(
|
|
1594
1629
|
async (e) => {
|
|
1595
1630
|
onMessage?.(e);
|
|
1596
1631
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1644,10 +1679,10 @@ function useBridgeHandler({
|
|
|
1644
1679
|
var import_react_native27 = require("@granite-js/react-native");
|
|
1645
1680
|
var import_tds_react_native13 = require("@toss/tds-react-native");
|
|
1646
1681
|
var import_es_hangul5 = require("es-hangul");
|
|
1647
|
-
var
|
|
1682
|
+
var import_react25 = require("react");
|
|
1648
1683
|
|
|
1649
1684
|
// src/hooks/useWebviewHistoryStack.tsx
|
|
1650
|
-
var
|
|
1685
|
+
var import_react24 = require("react");
|
|
1651
1686
|
var INITIAL_STATE = { stack: [], index: -1 };
|
|
1652
1687
|
function reducer(state, action) {
|
|
1653
1688
|
switch (action.type) {
|
|
@@ -1678,11 +1713,11 @@ function reducer(state, action) {
|
|
|
1678
1713
|
}
|
|
1679
1714
|
}
|
|
1680
1715
|
function useWebViewHistory() {
|
|
1681
|
-
const [state, dispatch] = (0,
|
|
1682
|
-
const onNavigationStateChange = (0,
|
|
1716
|
+
const [state, dispatch] = (0, import_react24.useReducer)(reducer, INITIAL_STATE);
|
|
1717
|
+
const onNavigationStateChange = (0, import_react24.useCallback)(({ url, canGoForward: canGoForward2 }) => {
|
|
1683
1718
|
dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
|
|
1684
1719
|
}, []);
|
|
1685
|
-
const { canGoBack, canGoForward } = (0,
|
|
1720
|
+
const { canGoBack, canGoForward } = (0, import_react24.useMemo)(() => {
|
|
1686
1721
|
const canBack = state.index > 0;
|
|
1687
1722
|
const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
|
|
1688
1723
|
return { canGoBack: canBack, canGoForward: canFwd };
|
|
@@ -1715,19 +1750,19 @@ function useWebBackHandler(webViewRef) {
|
|
|
1715
1750
|
const logging = useNavigationBarLogging();
|
|
1716
1751
|
const { openConfirm } = (0, import_tds_react_native13.useDialog)();
|
|
1717
1752
|
const global2 = getAppsInTossGlobals();
|
|
1718
|
-
const addEventListener = (0,
|
|
1753
|
+
const addEventListener = (0, import_react25.useCallback)(
|
|
1719
1754
|
(handler) => {
|
|
1720
1755
|
addWebBackEventListener(handler);
|
|
1721
1756
|
},
|
|
1722
1757
|
[addWebBackEventListener]
|
|
1723
1758
|
);
|
|
1724
|
-
const removeEventListener = (0,
|
|
1759
|
+
const removeEventListener = (0, import_react25.useCallback)(
|
|
1725
1760
|
(handler) => {
|
|
1726
1761
|
removeWebBackEventListener(handler);
|
|
1727
1762
|
},
|
|
1728
1763
|
[removeWebBackEventListener]
|
|
1729
1764
|
);
|
|
1730
|
-
const handleWebBack = (0,
|
|
1765
|
+
const handleWebBack = (0, import_react25.useCallback)(async () => {
|
|
1731
1766
|
if (hasWebBackEvent) {
|
|
1732
1767
|
for (const handler of webBackHandlersRef) {
|
|
1733
1768
|
handler();
|
|
@@ -1760,7 +1795,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1760
1795
|
openConfirm,
|
|
1761
1796
|
webViewRef
|
|
1762
1797
|
]);
|
|
1763
|
-
const handleWebHome = (0,
|
|
1798
|
+
const handleWebHome = (0, import_react25.useCallback)(() => {
|
|
1764
1799
|
logging.homeButtonClick();
|
|
1765
1800
|
if (hasWebBackEvent) {
|
|
1766
1801
|
for (const handler of webBackHandlersRef) {
|
|
@@ -1770,7 +1805,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1770
1805
|
}
|
|
1771
1806
|
webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
|
|
1772
1807
|
}, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
|
|
1773
|
-
return (0,
|
|
1808
|
+
return (0, import_react25.useMemo)(
|
|
1774
1809
|
() => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
|
|
1775
1810
|
[addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
|
|
1776
1811
|
);
|
|
@@ -1927,7 +1962,7 @@ function useCreateUserAgent({
|
|
|
1927
1962
|
const platform = (0, import_native_modules15.getPlatformOS)();
|
|
1928
1963
|
const appVersion = (0, import_native_modules15.getTossAppVersion)();
|
|
1929
1964
|
const { fontScale } = (0, import_react_native28.useWindowDimensions)();
|
|
1930
|
-
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1965
|
+
const platformString = platform === "ios" ? "iPhone" : "Android phone";
|
|
1931
1966
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1932
1967
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1933
1968
|
return [
|
|
@@ -1948,11 +1983,11 @@ function useCreateUserAgent({
|
|
|
1948
1983
|
// src/hooks/useGeolocation.ts
|
|
1949
1984
|
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1950
1985
|
var import_react_native29 = require("@granite-js/react-native");
|
|
1951
|
-
var
|
|
1986
|
+
var import_react26 = require("react");
|
|
1952
1987
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1953
1988
|
const isVisible = (0, import_react_native29.useVisibility)();
|
|
1954
|
-
const [location, setLocation] = (0,
|
|
1955
|
-
(0,
|
|
1989
|
+
const [location, setLocation] = (0, import_react26.useState)(null);
|
|
1990
|
+
(0, import_react26.useEffect)(() => {
|
|
1956
1991
|
if (!isVisible) {
|
|
1957
1992
|
return;
|
|
1958
1993
|
}
|
|
@@ -1971,11 +2006,11 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1971
2006
|
|
|
1972
2007
|
// src/hooks/useWaitForReturnNavigator.tsx
|
|
1973
2008
|
var import_react_native30 = require("@granite-js/react-native");
|
|
1974
|
-
var
|
|
2009
|
+
var import_react27 = require("react");
|
|
1975
2010
|
function useWaitForReturnNavigator() {
|
|
1976
|
-
const callbacks = (0,
|
|
2011
|
+
const callbacks = (0, import_react27.useRef)([]).current;
|
|
1977
2012
|
const navigation = (0, import_react_native30.useNavigation)();
|
|
1978
|
-
const startNavigating = (0,
|
|
2013
|
+
const startNavigating = (0, import_react27.useCallback)(
|
|
1979
2014
|
(route, params) => {
|
|
1980
2015
|
return new Promise((resolve) => {
|
|
1981
2016
|
callbacks.push(resolve);
|
|
@@ -1984,7 +2019,7 @@ function useWaitForReturnNavigator() {
|
|
|
1984
2019
|
},
|
|
1985
2020
|
[callbacks, navigation]
|
|
1986
2021
|
);
|
|
1987
|
-
const handleVisibilityChange = (0,
|
|
2022
|
+
const handleVisibilityChange = (0, import_react27.useCallback)(
|
|
1988
2023
|
(state) => {
|
|
1989
2024
|
if (state === "visible" && callbacks.length > 0) {
|
|
1990
2025
|
for (const callback of callbacks) {
|
|
@@ -1999,6 +2034,15 @@ function useWaitForReturnNavigator() {
|
|
|
1999
2034
|
return startNavigating;
|
|
2000
2035
|
}
|
|
2001
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
|
+
|
|
2002
2046
|
// src/utils/log.ts
|
|
2003
2047
|
var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
2004
2048
|
var import_react_native31 = require("@granite-js/react-native");
|
|
@@ -2049,7 +2093,7 @@ var trackScreen = (url) => {
|
|
|
2049
2093
|
};
|
|
2050
2094
|
|
|
2051
2095
|
// src/components/WebView.tsx
|
|
2052
|
-
var
|
|
2096
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2053
2097
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
2054
2098
|
var TYPES = ["partner", "external", "game"];
|
|
2055
2099
|
var WEBVIEW_TYPES = {
|
|
@@ -2083,13 +2127,13 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2083
2127
|
if (!TYPES.includes(type)) {
|
|
2084
2128
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
2085
2129
|
}
|
|
2086
|
-
const webViewRef = (0,
|
|
2130
|
+
const webViewRef = (0, import_react28.useRef)(null);
|
|
2087
2131
|
const webBackHandler = useWebBackHandler(webViewRef);
|
|
2088
|
-
const uri = (0,
|
|
2132
|
+
const uri = (0, import_react28.useMemo)(() => getWebViewUri(local), [local]);
|
|
2089
2133
|
const top = (0, import_private9.useSafeAreaTop)();
|
|
2090
2134
|
const bottom = (0, import_private9.useSafeAreaBottom)();
|
|
2091
2135
|
const global2 = getAppsInTossGlobals();
|
|
2092
|
-
const
|
|
2136
|
+
const navigationBarContext = useNavigationBarContext();
|
|
2093
2137
|
const disableTextSelectionCSS = `
|
|
2094
2138
|
(function() {
|
|
2095
2139
|
const style = document.createElement('style');
|
|
@@ -2097,7 +2141,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2097
2141
|
document.head.appendChild(style);
|
|
2098
2142
|
})();
|
|
2099
2143
|
`;
|
|
2100
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0,
|
|
2144
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react28.useState)(
|
|
2101
2145
|
props.allowsBackForwardNavigationGestures
|
|
2102
2146
|
);
|
|
2103
2147
|
const handler = useBridgeHandler({
|
|
@@ -2151,8 +2195,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2151
2195
|
setAllowsBackForwardNavigationGestures(options.isEnabled);
|
|
2152
2196
|
return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
|
|
2153
2197
|
},
|
|
2154
|
-
addAccessoryButton: async (params) =>
|
|
2155
|
-
removeAccessoryButton: async () =>
|
|
2198
|
+
addAccessoryButton: async (params) => navigationBarContext.addNavigationRightButton(params),
|
|
2199
|
+
removeAccessoryButton: async () => navigationBarContext.removeNavigationRightButton(),
|
|
2156
2200
|
/** permissions */
|
|
2157
2201
|
requestPermission: appsInTossAsyncBridges.requestPermission,
|
|
2158
2202
|
openPermissionDialog: appsInTossAsyncBridges.openPermissionDialog,
|
|
@@ -2177,7 +2221,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2177
2221
|
completeProductGrant: import_native_modules18.IAP.completeProductGrant
|
|
2178
2222
|
}
|
|
2179
2223
|
});
|
|
2180
|
-
const headerPropForExternalWebView = (0,
|
|
2224
|
+
const headerPropForExternalWebView = (0, import_react28.useMemo)(() => {
|
|
2181
2225
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
2182
2226
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
2183
2227
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -2198,7 +2242,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2198
2242
|
colorPreference: "light"
|
|
2199
2243
|
});
|
|
2200
2244
|
const refs = mergeRefs(handler.ref, webViewRef);
|
|
2201
|
-
(0,
|
|
2245
|
+
(0, import_react28.useEffect)(() => {
|
|
2202
2246
|
const callback = () => {
|
|
2203
2247
|
webBackHandler.handleWebBack();
|
|
2204
2248
|
return true;
|
|
@@ -2206,7 +2250,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2206
2250
|
import_react_native33.BackHandler.addEventListener("hardwareBackPress", callback);
|
|
2207
2251
|
return () => import_react_native33.BackHandler.removeEventListener("hardwareBackPress", callback);
|
|
2208
2252
|
}, [webBackHandler]);
|
|
2209
|
-
return /* @__PURE__ */ (0,
|
|
2253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2210
2254
|
BaseWebView,
|
|
2211
2255
|
{
|
|
2212
2256
|
ref: refs,
|