@apps-in-toss/framework 0.0.0-dev.1761559152736 → 0.0.0-dev.1763036638916
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 +365 -214
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +306 -155
- 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 {
|
|
@@ -1343,26 +1377,28 @@ var import_native_modules18 = require("@apps-in-toss/native-modules");
|
|
|
1343
1377
|
var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
|
|
1344
1378
|
var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
|
|
1345
1379
|
var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
|
|
1380
|
+
var import_react_native_safe_area_context4 = require("@granite-js/native/react-native-safe-area-context");
|
|
1346
1381
|
var import_react_native32 = require("@granite-js/react-native");
|
|
1347
1382
|
var import_tds_react_native14 = require("@toss/tds-react-native");
|
|
1348
1383
|
var import_private9 = require("@toss/tds-react-native/private");
|
|
1349
|
-
var
|
|
1384
|
+
var import_react29 = require("react");
|
|
1350
1385
|
var import_react_native33 = require("react-native");
|
|
1351
1386
|
|
|
1352
1387
|
// src/components/GameWebView.tsx
|
|
1353
1388
|
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
1354
1389
|
var import_react_native_webview = require("@granite-js/native/react-native-webview");
|
|
1355
|
-
var
|
|
1390
|
+
var import_react20 = require("react");
|
|
1356
1391
|
var import_react_native25 = require("react-native");
|
|
1357
1392
|
|
|
1358
1393
|
// src/components/NavigationBar/GameWebviewNavigationBar.tsx
|
|
1394
|
+
var import_react_native_safe_area_context2 = require("@granite-js/native/react-native-safe-area-context");
|
|
1359
1395
|
var import_react_native23 = require("@granite-js/react-native");
|
|
1360
1396
|
var import_tds_react_native11 = require("@toss/tds-react-native");
|
|
1361
1397
|
var import_private7 = require("@toss/tds-react-native/private");
|
|
1362
1398
|
var import_es_hangul3 = require("es-hangul");
|
|
1363
|
-
var
|
|
1399
|
+
var import_react19 = require("react");
|
|
1364
1400
|
var import_react_native24 = require("react-native");
|
|
1365
|
-
var
|
|
1401
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1366
1402
|
function GameWebviewNavigationBar() {
|
|
1367
1403
|
const safeAreaTop = (0, import_private7.useSafeAreaTop)();
|
|
1368
1404
|
const { openConfirm } = (0, import_tds_react_native11.useDialog)();
|
|
@@ -1370,9 +1406,9 @@ function GameWebviewNavigationBar() {
|
|
|
1370
1406
|
const global2 = getAppsInTossGlobals();
|
|
1371
1407
|
const logging = useNavigationBarLogging();
|
|
1372
1408
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1373
|
-
const
|
|
1374
|
-
const
|
|
1375
|
-
const handleGameWebviewClose = (0,
|
|
1409
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1410
|
+
const { right: safeAreaRight } = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
1411
|
+
const handleGameWebviewClose = (0, import_react19.useCallback)(async () => {
|
|
1376
1412
|
logging.closeButtonClick();
|
|
1377
1413
|
const isConfirmed = await openConfirm({
|
|
1378
1414
|
title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1387,9 +1423,9 @@ function GameWebviewNavigationBar() {
|
|
|
1387
1423
|
(0, import_react_native23.closeView)();
|
|
1388
1424
|
}
|
|
1389
1425
|
}, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
|
|
1390
|
-
return /* @__PURE__ */ (0,
|
|
1391
|
-
/* @__PURE__ */ (0,
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_tds_react_native11.PageNavbar, { preference: { type: "none" } }),
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1393
1429
|
import_react_native24.View,
|
|
1394
1430
|
{
|
|
1395
1431
|
style: {
|
|
@@ -1402,13 +1438,13 @@ function GameWebviewNavigationBar() {
|
|
|
1402
1438
|
position: "absolute",
|
|
1403
1439
|
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1404
1440
|
marginTop: safeAreaTop,
|
|
1405
|
-
paddingRight: 10
|
|
1441
|
+
paddingRight: safeAreaRight + 10
|
|
1406
1442
|
},
|
|
1407
1443
|
pointerEvents: "box-none",
|
|
1408
|
-
children: /* @__PURE__ */ (0,
|
|
1444
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1409
1445
|
import_private7.NavigationRightContent,
|
|
1410
1446
|
{
|
|
1411
|
-
fixedRightButton:
|
|
1447
|
+
fixedRightButton: navigationRightButton,
|
|
1412
1448
|
onPressDots: openMoreButtonBottomSheet,
|
|
1413
1449
|
onPressClose: () => {
|
|
1414
1450
|
handleGameWebviewClose();
|
|
@@ -1422,10 +1458,10 @@ function GameWebviewNavigationBar() {
|
|
|
1422
1458
|
}
|
|
1423
1459
|
|
|
1424
1460
|
// src/components/GameWebView.tsx
|
|
1425
|
-
var
|
|
1426
|
-
var GameWebView = (0,
|
|
1427
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1428
|
-
(0,
|
|
1461
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1462
|
+
var GameWebView = (0, import_react20.forwardRef)(function GameWebView2(props, ref) {
|
|
1463
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react20.useState)(false);
|
|
1464
|
+
(0, import_react20.useEffect)(() => {
|
|
1429
1465
|
if (import_react_native25.Platform.OS === "ios") {
|
|
1430
1466
|
(0, import_native_modules14.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1431
1467
|
return () => {
|
|
@@ -1434,30 +1470,30 @@ var GameWebView = (0, import_react19.forwardRef)(function GameWebView2(props, re
|
|
|
1434
1470
|
}
|
|
1435
1471
|
return;
|
|
1436
1472
|
}, []);
|
|
1437
|
-
(0,
|
|
1473
|
+
(0, import_react20.useEffect)(() => {
|
|
1438
1474
|
import_native_modules14.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1439
1475
|
onEvent: () => {
|
|
1440
1476
|
setIsEntryMessageExited(true);
|
|
1441
1477
|
}
|
|
1442
1478
|
});
|
|
1443
1479
|
}, []);
|
|
1444
|
-
return /* @__PURE__ */ (0,
|
|
1445
|
-
/* @__PURE__ */ (0,
|
|
1446
|
-
(0, import_native_modules14.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0,
|
|
1480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GameWebviewNavigationBar, {}),
|
|
1482
|
+
(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
1483
|
] });
|
|
1448
1484
|
});
|
|
1449
1485
|
|
|
1450
1486
|
// src/components/PartnerWebView.tsx
|
|
1451
1487
|
var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
|
|
1452
|
-
var
|
|
1488
|
+
var import_react22 = require("react");
|
|
1453
1489
|
|
|
1454
1490
|
// src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
|
|
1455
1491
|
var import_react_native26 = require("@granite-js/react-native");
|
|
1456
1492
|
var import_tds_react_native12 = require("@toss/tds-react-native");
|
|
1457
1493
|
var import_private8 = require("@toss/tds-react-native/private");
|
|
1458
1494
|
var import_es_hangul4 = require("es-hangul");
|
|
1459
|
-
var
|
|
1460
|
-
var
|
|
1495
|
+
var import_react21 = require("react");
|
|
1496
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1461
1497
|
function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
1462
1498
|
const globals = getAppsInTossGlobals();
|
|
1463
1499
|
const { captureExitLog } = useCaptureExitLog();
|
|
@@ -1467,8 +1503,8 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1467
1503
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1468
1504
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1469
1505
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1470
|
-
const
|
|
1471
|
-
const handleClose = (0,
|
|
1506
|
+
const { navigationRightButton } = useNavigationBarContext();
|
|
1507
|
+
const handleClose = (0, import_react21.useCallback)(async () => {
|
|
1472
1508
|
logging.closeButtonClick();
|
|
1473
1509
|
const isConfirmed = await openConfirm({
|
|
1474
1510
|
title: `${(0, import_es_hangul4.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -1483,7 +1519,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1483
1519
|
(0, import_react_native26.closeView)();
|
|
1484
1520
|
}
|
|
1485
1521
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1486
|
-
return /* @__PURE__ */ (0,
|
|
1522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1487
1523
|
import_private8.TopNavigation,
|
|
1488
1524
|
{
|
|
1489
1525
|
title: globals.brandDisplayName,
|
|
@@ -1493,23 +1529,23 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1493
1529
|
onPressTitle: withHomeButton ? onHomeButtonClick : void 0,
|
|
1494
1530
|
onPressClose: handleClose,
|
|
1495
1531
|
withHome: withHomeButton,
|
|
1496
|
-
fixedRightButton:
|
|
1497
|
-
children: /* @__PURE__ */ (0,
|
|
1532
|
+
fixedRightButton: navigationRightButton,
|
|
1533
|
+
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
1534
|
}
|
|
1499
1535
|
) });
|
|
1500
1536
|
}
|
|
1501
1537
|
|
|
1502
1538
|
// src/components/PartnerWebView.tsx
|
|
1503
|
-
var
|
|
1504
|
-
var PartnerWebView = (0,
|
|
1505
|
-
return /* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1507
|
-
/* @__PURE__ */ (0,
|
|
1539
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1540
|
+
var PartnerWebView = (0, import_react22.forwardRef)(function PartnerWebViewScreen({ onBackButtonClick, onHomeButtonClick, ...webViewProps }, ref) {
|
|
1541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_webview2.WebView, { ref, ...webViewProps, style: { flex: 1 } })
|
|
1508
1544
|
] });
|
|
1509
1545
|
});
|
|
1510
1546
|
|
|
1511
1547
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1512
|
-
var
|
|
1548
|
+
var import_react23 = require("react");
|
|
1513
1549
|
function serializeError(error) {
|
|
1514
1550
|
return JSON.stringify(error, (_, value) => {
|
|
1515
1551
|
if (value instanceof Error) {
|
|
@@ -1559,26 +1595,24 @@ function useBridgeHandler({
|
|
|
1559
1595
|
onMessage,
|
|
1560
1596
|
constantHandlerMap,
|
|
1561
1597
|
asyncHandlerMap,
|
|
1562
|
-
eventListenerMap
|
|
1563
|
-
injectedJavaScript: originalInjectedJavaScript
|
|
1598
|
+
eventListenerMap
|
|
1564
1599
|
}) {
|
|
1565
|
-
const ref = (0,
|
|
1566
|
-
const injectedJavaScript = (0,
|
|
1567
|
-
() =>
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
originalInjectedJavaScript,
|
|
1578
|
-
"true"
|
|
1579
|
-
].join("\n"),
|
|
1580
|
-
[constantHandlerMap, originalInjectedJavaScript]
|
|
1600
|
+
const ref = (0, import_react23.useRef)(null);
|
|
1601
|
+
const injectedJavaScript = (0, import_react23.useMemo)(
|
|
1602
|
+
() => `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1603
|
+
Object.entries(constantHandlerMap).reduce(
|
|
1604
|
+
(acc, [key, value]) => {
|
|
1605
|
+
acc[key] = typeof value === "function" ? value() : value;
|
|
1606
|
+
return acc;
|
|
1607
|
+
},
|
|
1608
|
+
{}
|
|
1609
|
+
)
|
|
1610
|
+
)};`,
|
|
1611
|
+
[constantHandlerMap]
|
|
1581
1612
|
);
|
|
1613
|
+
(0, import_react23.useEffect)(() => {
|
|
1614
|
+
ref.current?.injectJavaScript(injectedJavaScript);
|
|
1615
|
+
}, [injectedJavaScript]);
|
|
1582
1616
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
1583
1617
|
ref.current?.injectJavaScript(`
|
|
1584
1618
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
@@ -1590,10 +1624,10 @@ function useBridgeHandler({
|
|
|
1590
1624
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1591
1625
|
`);
|
|
1592
1626
|
};
|
|
1593
|
-
const $onMessage = (0,
|
|
1627
|
+
const $onMessage = (0, import_react23.useCallback)(
|
|
1594
1628
|
async (e) => {
|
|
1595
1629
|
onMessage?.(e);
|
|
1596
|
-
const data =
|
|
1630
|
+
const data = parseNativeEventData(e.nativeEvent.data);
|
|
1597
1631
|
if (typeof data !== "object" || data === null || typeof data.functionName !== "string" || typeof data.eventId !== "string" || typeof data.type !== "string" || !["addEventListener", "removeEventListener", "method"].includes(data.type)) {
|
|
1598
1632
|
return;
|
|
1599
1633
|
}
|
|
@@ -1639,15 +1673,59 @@ function useBridgeHandler({
|
|
|
1639
1673
|
onMessage: $onMessage
|
|
1640
1674
|
};
|
|
1641
1675
|
}
|
|
1676
|
+
function parseNativeEventData(data) {
|
|
1677
|
+
try {
|
|
1678
|
+
return JSON.parse(data);
|
|
1679
|
+
} catch (error) {
|
|
1680
|
+
console.error(error);
|
|
1681
|
+
return null;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
// src/core/hooks/useSafeAreaInsetsEmitter.tsx
|
|
1686
|
+
var import_react_native_safe_area_context3 = require("@granite-js/native/react-native-safe-area-context");
|
|
1687
|
+
var import_react24 = require("react");
|
|
1688
|
+
var EventEmitter = class {
|
|
1689
|
+
listeners = {};
|
|
1690
|
+
on(event, listener) {
|
|
1691
|
+
if (!this.listeners[event]) {
|
|
1692
|
+
this.listeners[event] = [];
|
|
1693
|
+
}
|
|
1694
|
+
this.listeners[event].push(listener);
|
|
1695
|
+
}
|
|
1696
|
+
emit(event, ...args) {
|
|
1697
|
+
if (!this.listeners[event]) {
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
this.listeners[event].forEach((listener) => listener(...args));
|
|
1701
|
+
}
|
|
1702
|
+
off(event, listener) {
|
|
1703
|
+
if (!this.listeners[event]) {
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
this.listeners[event] = this.listeners[event].filter((l) => l !== listener);
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
function useSafeAreaInsetsEmitter() {
|
|
1710
|
+
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
1711
|
+
const emitter = (0, import_react24.useMemo)(() => new EventEmitter(), []);
|
|
1712
|
+
(0, import_react24.useEffect)(() => {
|
|
1713
|
+
emitter.emit("safeAreaInsetsChange", insets);
|
|
1714
|
+
return () => {
|
|
1715
|
+
emitter.off("safeAreaInsetsChange", (listener) => listener(insets));
|
|
1716
|
+
};
|
|
1717
|
+
}, [emitter, insets]);
|
|
1718
|
+
return emitter;
|
|
1719
|
+
}
|
|
1642
1720
|
|
|
1643
1721
|
// src/core/hooks/useWebBackHandler.tsx
|
|
1644
1722
|
var import_react_native27 = require("@granite-js/react-native");
|
|
1645
1723
|
var import_tds_react_native13 = require("@toss/tds-react-native");
|
|
1646
1724
|
var import_es_hangul5 = require("es-hangul");
|
|
1647
|
-
var
|
|
1725
|
+
var import_react26 = require("react");
|
|
1648
1726
|
|
|
1649
1727
|
// src/hooks/useWebviewHistoryStack.tsx
|
|
1650
|
-
var
|
|
1728
|
+
var import_react25 = require("react");
|
|
1651
1729
|
var INITIAL_STATE = { stack: [], index: -1 };
|
|
1652
1730
|
function reducer(state, action) {
|
|
1653
1731
|
switch (action.type) {
|
|
@@ -1678,11 +1756,11 @@ function reducer(state, action) {
|
|
|
1678
1756
|
}
|
|
1679
1757
|
}
|
|
1680
1758
|
function useWebViewHistory() {
|
|
1681
|
-
const [state, dispatch] = (0,
|
|
1682
|
-
const onNavigationStateChange = (0,
|
|
1759
|
+
const [state, dispatch] = (0, import_react25.useReducer)(reducer, INITIAL_STATE);
|
|
1760
|
+
const onNavigationStateChange = (0, import_react25.useCallback)(({ url, canGoForward: canGoForward2 }) => {
|
|
1683
1761
|
dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
|
|
1684
1762
|
}, []);
|
|
1685
|
-
const { canGoBack, canGoForward } = (0,
|
|
1763
|
+
const { canGoBack, canGoForward } = (0, import_react25.useMemo)(() => {
|
|
1686
1764
|
const canBack = state.index > 0;
|
|
1687
1765
|
const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
|
|
1688
1766
|
return { canGoBack: canBack, canGoForward: canFwd };
|
|
@@ -1715,19 +1793,19 @@ function useWebBackHandler(webViewRef) {
|
|
|
1715
1793
|
const logging = useNavigationBarLogging();
|
|
1716
1794
|
const { openConfirm } = (0, import_tds_react_native13.useDialog)();
|
|
1717
1795
|
const global2 = getAppsInTossGlobals();
|
|
1718
|
-
const addEventListener = (0,
|
|
1796
|
+
const addEventListener = (0, import_react26.useCallback)(
|
|
1719
1797
|
(handler) => {
|
|
1720
1798
|
addWebBackEventListener(handler);
|
|
1721
1799
|
},
|
|
1722
1800
|
[addWebBackEventListener]
|
|
1723
1801
|
);
|
|
1724
|
-
const removeEventListener = (0,
|
|
1802
|
+
const removeEventListener = (0, import_react26.useCallback)(
|
|
1725
1803
|
(handler) => {
|
|
1726
1804
|
removeWebBackEventListener(handler);
|
|
1727
1805
|
},
|
|
1728
1806
|
[removeWebBackEventListener]
|
|
1729
1807
|
);
|
|
1730
|
-
const handleWebBack = (0,
|
|
1808
|
+
const handleWebBack = (0, import_react26.useCallback)(async () => {
|
|
1731
1809
|
if (hasWebBackEvent) {
|
|
1732
1810
|
for (const handler of webBackHandlersRef) {
|
|
1733
1811
|
handler();
|
|
@@ -1760,7 +1838,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1760
1838
|
openConfirm,
|
|
1761
1839
|
webViewRef
|
|
1762
1840
|
]);
|
|
1763
|
-
const handleWebHome = (0,
|
|
1841
|
+
const handleWebHome = (0, import_react26.useCallback)(() => {
|
|
1764
1842
|
logging.homeButtonClick();
|
|
1765
1843
|
if (hasWebBackEvent) {
|
|
1766
1844
|
for (const handler of webBackHandlersRef) {
|
|
@@ -1770,7 +1848,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1770
1848
|
}
|
|
1771
1849
|
webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
|
|
1772
1850
|
}, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
|
|
1773
|
-
return (0,
|
|
1851
|
+
return (0, import_react26.useMemo)(
|
|
1774
1852
|
() => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
|
|
1775
1853
|
[addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
|
|
1776
1854
|
);
|
|
@@ -1927,7 +2005,7 @@ function useCreateUserAgent({
|
|
|
1927
2005
|
const platform = (0, import_native_modules15.getPlatformOS)();
|
|
1928
2006
|
const appVersion = (0, import_native_modules15.getTossAppVersion)();
|
|
1929
2007
|
const { fontScale } = (0, import_react_native28.useWindowDimensions)();
|
|
1930
|
-
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
2008
|
+
const platformString = platform === "ios" ? "iPhone" : "Android phone";
|
|
1931
2009
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1932
2010
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1933
2011
|
return [
|
|
@@ -1948,11 +2026,11 @@ function useCreateUserAgent({
|
|
|
1948
2026
|
// src/hooks/useGeolocation.ts
|
|
1949
2027
|
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1950
2028
|
var import_react_native29 = require("@granite-js/react-native");
|
|
1951
|
-
var
|
|
2029
|
+
var import_react27 = require("react");
|
|
1952
2030
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1953
2031
|
const isVisible = (0, import_react_native29.useVisibility)();
|
|
1954
|
-
const [location, setLocation] = (0,
|
|
1955
|
-
(0,
|
|
2032
|
+
const [location, setLocation] = (0, import_react27.useState)(null);
|
|
2033
|
+
(0, import_react27.useEffect)(() => {
|
|
1956
2034
|
if (!isVisible) {
|
|
1957
2035
|
return;
|
|
1958
2036
|
}
|
|
@@ -1971,11 +2049,11 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1971
2049
|
|
|
1972
2050
|
// src/hooks/useWaitForReturnNavigator.tsx
|
|
1973
2051
|
var import_react_native30 = require("@granite-js/react-native");
|
|
1974
|
-
var
|
|
2052
|
+
var import_react28 = require("react");
|
|
1975
2053
|
function useWaitForReturnNavigator() {
|
|
1976
|
-
const callbacks = (0,
|
|
2054
|
+
const callbacks = (0, import_react28.useRef)([]).current;
|
|
1977
2055
|
const navigation = (0, import_react_native30.useNavigation)();
|
|
1978
|
-
const startNavigating = (0,
|
|
2056
|
+
const startNavigating = (0, import_react28.useCallback)(
|
|
1979
2057
|
(route, params) => {
|
|
1980
2058
|
return new Promise((resolve) => {
|
|
1981
2059
|
callbacks.push(resolve);
|
|
@@ -1984,7 +2062,7 @@ function useWaitForReturnNavigator() {
|
|
|
1984
2062
|
},
|
|
1985
2063
|
[callbacks, navigation]
|
|
1986
2064
|
);
|
|
1987
|
-
const handleVisibilityChange = (0,
|
|
2065
|
+
const handleVisibilityChange = (0, import_react28.useCallback)(
|
|
1988
2066
|
(state) => {
|
|
1989
2067
|
if (state === "visible" && callbacks.length > 0) {
|
|
1990
2068
|
for (const callback of callbacks) {
|
|
@@ -1999,6 +2077,15 @@ function useWaitForReturnNavigator() {
|
|
|
1999
2077
|
return startNavigating;
|
|
2000
2078
|
}
|
|
2001
2079
|
|
|
2080
|
+
// src/hooks/useTopNavigation.tsx
|
|
2081
|
+
function useTopNavigation() {
|
|
2082
|
+
const { addNavigationRightButton, removeNavigationRightButton } = useNavigationBarContext();
|
|
2083
|
+
return {
|
|
2084
|
+
addAccessoryButton: addNavigationRightButton,
|
|
2085
|
+
removeAccessoryButton: removeNavigationRightButton
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2002
2089
|
// src/utils/log.ts
|
|
2003
2090
|
var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
2004
2091
|
var import_react_native31 = require("@granite-js/react-native");
|
|
@@ -2049,7 +2136,7 @@ var trackScreen = (url) => {
|
|
|
2049
2136
|
};
|
|
2050
2137
|
|
|
2051
2138
|
// src/components/WebView.tsx
|
|
2052
|
-
var
|
|
2139
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2053
2140
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
2054
2141
|
var TYPES = ["partner", "external", "game"];
|
|
2055
2142
|
var WEBVIEW_TYPES = {
|
|
@@ -2083,26 +2170,20 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2083
2170
|
if (!TYPES.includes(type)) {
|
|
2084
2171
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
2085
2172
|
}
|
|
2086
|
-
const webViewRef = (0,
|
|
2173
|
+
const webViewRef = (0, import_react29.useRef)(null);
|
|
2087
2174
|
const webBackHandler = useWebBackHandler(webViewRef);
|
|
2088
|
-
const uri = (0,
|
|
2175
|
+
const uri = (0, import_react29.useMemo)(() => getWebViewUri(local), [local]);
|
|
2089
2176
|
const top = (0, import_private9.useSafeAreaTop)();
|
|
2090
2177
|
const bottom = (0, import_private9.useSafeAreaBottom)();
|
|
2178
|
+
const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
|
|
2091
2179
|
const global2 = getAppsInTossGlobals();
|
|
2092
|
-
const
|
|
2093
|
-
const
|
|
2094
|
-
|
|
2095
|
-
const style = document.createElement('style');
|
|
2096
|
-
style.textContent = '*:not(input):not(textarea) { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; }';
|
|
2097
|
-
document.head.appendChild(style);
|
|
2098
|
-
})();
|
|
2099
|
-
`;
|
|
2100
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react27.useState)(
|
|
2180
|
+
const navigationBarContext = useNavigationBarContext();
|
|
2181
|
+
const safeAreaInsetsEmitter = useSafeAreaInsetsEmitter();
|
|
2182
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react29.useState)(
|
|
2101
2183
|
props.allowsBackForwardNavigationGestures
|
|
2102
2184
|
);
|
|
2103
2185
|
const handler = useBridgeHandler({
|
|
2104
2186
|
onMessage,
|
|
2105
|
-
injectedJavaScript: [disableTextSelectionCSS].join("\n"),
|
|
2106
2187
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2107
2188
|
eventListenerMap: {
|
|
2108
2189
|
...appsInTossEventBridges,
|
|
@@ -2115,6 +2196,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2115
2196
|
},
|
|
2116
2197
|
entryMessageExited: ({ onEvent, onError }) => import_native_modules18.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
2117
2198
|
updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
2199
|
+
safeAreaInsetsChange: ({ onEvent }) => {
|
|
2200
|
+
safeAreaInsetsEmitter.on("safeAreaInsetsChange", onEvent);
|
|
2201
|
+
return () => {
|
|
2202
|
+
safeAreaInsetsEmitter.off("safeAreaInsetsChange", onEvent);
|
|
2203
|
+
};
|
|
2204
|
+
},
|
|
2118
2205
|
/** @internal */
|
|
2119
2206
|
appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
2120
2207
|
/** AdMob */
|
|
@@ -2133,6 +2220,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2133
2220
|
...appsInTossConstantBridges,
|
|
2134
2221
|
getSafeAreaTop: () => top,
|
|
2135
2222
|
getSafeAreaBottom: () => bottom,
|
|
2223
|
+
getSafeAreaLeft: () => insets.left,
|
|
2224
|
+
getSafeAreaRight: () => insets.right,
|
|
2136
2225
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
2137
2226
|
/** AdMob */
|
|
2138
2227
|
loadAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
@@ -2151,8 +2240,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2151
2240
|
setAllowsBackForwardNavigationGestures(options.isEnabled);
|
|
2152
2241
|
return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
|
|
2153
2242
|
},
|
|
2154
|
-
addAccessoryButton: async (params) =>
|
|
2155
|
-
removeAccessoryButton: async () =>
|
|
2243
|
+
addAccessoryButton: async (params) => navigationBarContext.addNavigationRightButton(params),
|
|
2244
|
+
removeAccessoryButton: async () => navigationBarContext.removeNavigationRightButton(),
|
|
2156
2245
|
/** permissions */
|
|
2157
2246
|
requestPermission: appsInTossAsyncBridges.requestPermission,
|
|
2158
2247
|
openPermissionDialog: appsInTossAsyncBridges.openPermissionDialog,
|
|
@@ -2177,7 +2266,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2177
2266
|
completeProductGrant: import_native_modules18.IAP.completeProductGrant
|
|
2178
2267
|
}
|
|
2179
2268
|
});
|
|
2180
|
-
const headerPropForExternalWebView = (0,
|
|
2269
|
+
const headerPropForExternalWebView = (0, import_react29.useMemo)(() => {
|
|
2181
2270
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
2182
2271
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
2183
2272
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -2198,7 +2287,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2198
2287
|
colorPreference: "light"
|
|
2199
2288
|
});
|
|
2200
2289
|
const refs = mergeRefs(handler.ref, webViewRef);
|
|
2201
|
-
(0,
|
|
2290
|
+
(0, import_react29.useEffect)(() => {
|
|
2202
2291
|
const callback = () => {
|
|
2203
2292
|
webBackHandler.handleWebBack();
|
|
2204
2293
|
return true;
|
|
@@ -2206,7 +2295,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2206
2295
|
import_react_native33.BackHandler.addEventListener("hardwareBackPress", callback);
|
|
2207
2296
|
return () => import_react_native33.BackHandler.removeEventListener("hardwareBackPress", callback);
|
|
2208
2297
|
}, [webBackHandler]);
|
|
2209
|
-
|
|
2298
|
+
const globalScripts = useGlobalScripts();
|
|
2299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2210
2300
|
BaseWebView,
|
|
2211
2301
|
{
|
|
2212
2302
|
ref: refs,
|
|
@@ -2233,13 +2323,74 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2233
2323
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
2234
2324
|
thirdPartyCookiesEnabled: true,
|
|
2235
2325
|
onMessage: handler.onMessage,
|
|
2236
|
-
injectedJavaScript:
|
|
2237
|
-
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
2326
|
+
injectedJavaScript: globalScripts.afterLoad,
|
|
2327
|
+
injectedJavaScriptBeforeContentLoaded: mergeScripts(handler.injectedJavaScript, globalScripts.beforeLoad),
|
|
2238
2328
|
decelerationRate: import_react_native33.Platform.OS === "ios" ? 1 : void 0,
|
|
2239
2329
|
allowsBackForwardNavigationGestures
|
|
2240
2330
|
}
|
|
2241
2331
|
);
|
|
2242
2332
|
}
|
|
2333
|
+
function useGlobalScripts() {
|
|
2334
|
+
const global2 = getAppsInTossGlobals();
|
|
2335
|
+
const disableTextSelectionCSS = `
|
|
2336
|
+
const style = document.createElement('style');
|
|
2337
|
+
style.textContent = '*:not(input):not(textarea) { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; }';
|
|
2338
|
+
document.head.appendChild(style);
|
|
2339
|
+
`;
|
|
2340
|
+
const applyGameResourcesCache = `
|
|
2341
|
+
(function () {
|
|
2342
|
+
if (typeof caches === 'undefined') {
|
|
2343
|
+
return;
|
|
2344
|
+
}
|
|
2345
|
+
const cacheKeyPrefix = '@apps-in-toss/caches/';
|
|
2346
|
+
const cacheKey = \`\${cacheKeyPrefix}${global2.deploymentId}\`;
|
|
2347
|
+
window.addEventListener('load', async () => {
|
|
2348
|
+
const keys = await caches.keys();
|
|
2349
|
+
for (const key of keys) {
|
|
2350
|
+
if (key.startsWith(cacheKeyPrefix) && key !== cacheKey) {
|
|
2351
|
+
await caches.delete(key);
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
window.fetch = new Proxy(window.fetch, {
|
|
2356
|
+
async apply(originalFetch, thisArg, args) {
|
|
2357
|
+
const request = new Request(args[0], args[1]);
|
|
2358
|
+
if (!/\\.(data|wasm|framework\\.js)(?:\\.gz|\\.br|\\.unityweb)?$/.test(request.url)) {
|
|
2359
|
+
return await originalFetch.call(thisArg, request);
|
|
2360
|
+
}
|
|
2361
|
+
const cache = await caches.open(cacheKey);
|
|
2362
|
+
const cached = await cache.match(request);
|
|
2363
|
+
if (cached) {
|
|
2364
|
+
const eTag = cached.headers.get('ETag');
|
|
2365
|
+
const lastModified = cached.headers.get('Last-Modified');
|
|
2366
|
+
if (eTag) {
|
|
2367
|
+
request.headers.set('If-None-Match', eTag);
|
|
2368
|
+
}
|
|
2369
|
+
if (lastModified) {
|
|
2370
|
+
request.headers.set('If-Modified-Since', lastModified);
|
|
2371
|
+
}
|
|
2372
|
+
const revalidated = await originalFetch.call(thisArg, request);
|
|
2373
|
+
if (revalidated.status === 304) {
|
|
2374
|
+
return cached;
|
|
2375
|
+
}
|
|
2376
|
+
cache.put(request, revalidated.clone());
|
|
2377
|
+
return revalidated;
|
|
2378
|
+
}
|
|
2379
|
+
const response = await originalFetch.call(thisArg, request);
|
|
2380
|
+
cache.put(request, response.clone());
|
|
2381
|
+
return response;
|
|
2382
|
+
},
|
|
2383
|
+
});
|
|
2384
|
+
})();
|
|
2385
|
+
`;
|
|
2386
|
+
return {
|
|
2387
|
+
beforeLoad: mergeScripts(global2.webViewType === "game" && applyGameResourcesCache),
|
|
2388
|
+
afterLoad: mergeScripts(disableTextSelectionCSS)
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
function mergeScripts(...scripts) {
|
|
2392
|
+
return scripts.filter((script) => typeof script === "string").join("\n");
|
|
2393
|
+
}
|
|
2243
2394
|
|
|
2244
2395
|
// src/index.ts
|
|
2245
2396
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|