@apps-in-toss/framework 1.1.0 → 1.1.1
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 +49 -11
- package/dist/index.js +55 -13
- package/package.json +12 -12
- package/dist/types.cjs +0 -24
- package/dist/types.d.cts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
package/dist/index.cjs
CHANGED
|
@@ -611,7 +611,6 @@ function BuiltinNavigationBar() {
|
|
|
611
611
|
const isExternalWebView = globals.webViewType === "external";
|
|
612
612
|
const isGameWebView = globals.webViewType === "game";
|
|
613
613
|
const backEventContext = (0, import_react_native13.useBackEventContext)();
|
|
614
|
-
const overrideCanGoBack = !backEventContext.hasBackEvent;
|
|
615
614
|
const handleBackOrClose = useBackOrCloseNavigation();
|
|
616
615
|
const navigation = (0, import_react_native13.useNavigation)();
|
|
617
616
|
const handlePressTitle = (0, import_react7.useCallback)(() => {
|
|
@@ -623,12 +622,16 @@ function BuiltinNavigationBar() {
|
|
|
623
622
|
navigation.navigate("/");
|
|
624
623
|
}, [logging, globals.webViewType, navigation]);
|
|
625
624
|
const handleBack = (0, import_react7.useCallback)(() => {
|
|
626
|
-
if (
|
|
625
|
+
if (globals.webViewType != null) {
|
|
626
|
+
import_native_modules7.appsInTossEvent.emit("backButtonClickEvent", void 0);
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (backEventContext.hasBackEvent) {
|
|
627
630
|
backEventContext.onBack();
|
|
628
631
|
return;
|
|
629
632
|
}
|
|
630
633
|
handleBackOrClose();
|
|
631
|
-
}, [
|
|
634
|
+
}, [globals.webViewType, backEventContext, handleBackOrClose]);
|
|
632
635
|
const handleClose = (0, import_react7.useCallback)(async () => {
|
|
633
636
|
logging.closeButtonClick();
|
|
634
637
|
const isConfirmed = await openConfirm({
|
|
@@ -644,16 +647,16 @@ function BuiltinNavigationBar() {
|
|
|
644
647
|
(0, import_react_native13.closeView)();
|
|
645
648
|
}
|
|
646
649
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
650
|
+
const handleBackEvent = (0, import_react7.useCallback)(() => {
|
|
651
|
+
handleBack();
|
|
652
|
+
return true;
|
|
653
|
+
}, [handleBack]);
|
|
647
654
|
(0, import_react7.useEffect)(() => {
|
|
648
|
-
|
|
649
|
-
handleClose();
|
|
650
|
-
return true;
|
|
651
|
-
};
|
|
652
|
-
import_react_native15.BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
655
|
+
import_react_native15.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
|
|
653
656
|
return () => {
|
|
654
|
-
import_react_native15.BackHandler.removeEventListener("hardwareBackPress",
|
|
657
|
+
import_react_native15.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
655
658
|
};
|
|
656
|
-
}, [
|
|
659
|
+
}, [handleBackEvent]);
|
|
657
660
|
if (isExternalWebView) {
|
|
658
661
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
|
|
659
662
|
}
|
|
@@ -678,10 +681,12 @@ function BuiltinNavigationBar() {
|
|
|
678
681
|
}
|
|
679
682
|
function useBackOrCloseNavigation() {
|
|
680
683
|
const navigation = (0, import_react_native13.useNavigation)();
|
|
684
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
681
685
|
return (0, import_react7.useCallback)(() => {
|
|
682
686
|
if (navigation.canGoBack()) {
|
|
683
687
|
navigation.goBack();
|
|
684
688
|
} else {
|
|
689
|
+
captureExitLog(Date.now());
|
|
685
690
|
(0, import_react_native13.closeView)();
|
|
686
691
|
}
|
|
687
692
|
}, [navigation]);
|
|
@@ -801,6 +806,7 @@ var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridge
|
|
|
801
806
|
var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
|
|
802
807
|
var import_react_native31 = require("@toss-design-system/react-native");
|
|
803
808
|
var import_private5 = require("@toss-design-system/react-native/private");
|
|
809
|
+
var import_es_hangul3 = require("es-hangul");
|
|
804
810
|
var import_react15 = require("react");
|
|
805
811
|
var import_react_native32 = require("react-native");
|
|
806
812
|
|
|
@@ -1566,6 +1572,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1566
1572
|
if (!TYPES.includes(type)) {
|
|
1567
1573
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1568
1574
|
}
|
|
1575
|
+
const { openConfirm } = (0, import_react_native31.useDialog)();
|
|
1576
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1569
1577
|
const graniteEvent = (0, import_react_native30.useGraniteEvent)();
|
|
1570
1578
|
const uri = (0, import_react15.useMemo)(() => getWebViewUri(local), [local]);
|
|
1571
1579
|
const top = (0, import_private5.useSafeAreaTop)();
|
|
@@ -1679,14 +1687,30 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1679
1687
|
const userAgent = useCreateUserAgent({
|
|
1680
1688
|
colorPreference: "light"
|
|
1681
1689
|
});
|
|
1690
|
+
const handleGameWebviewClose = (0, import_react15.useCallback)(async () => {
|
|
1691
|
+
const isConfirmed = await openConfirm({
|
|
1692
|
+
title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1693
|
+
leftButton: "\uCDE8\uC18C",
|
|
1694
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1695
|
+
closeOnDimmerClick: true
|
|
1696
|
+
});
|
|
1697
|
+
if (isConfirmed) {
|
|
1698
|
+
captureExitLog(Date.now());
|
|
1699
|
+
(0, import_react_native30.closeView)();
|
|
1700
|
+
}
|
|
1701
|
+
}, [captureExitLog, openConfirm, global2.brandDisplayName]);
|
|
1682
1702
|
const handleBackEvent = (0, import_react15.useCallback)(() => {
|
|
1703
|
+
if (type === "game") {
|
|
1704
|
+
handleGameWebviewClose();
|
|
1705
|
+
return true;
|
|
1706
|
+
}
|
|
1683
1707
|
if (canHistoryGoBack) {
|
|
1684
1708
|
handler.ref.current?.goBack();
|
|
1685
1709
|
return true;
|
|
1686
1710
|
} else {
|
|
1687
1711
|
return false;
|
|
1688
1712
|
}
|
|
1689
|
-
}, [canHistoryGoBack, handler]);
|
|
1713
|
+
}, [canHistoryGoBack, handleGameWebviewClose, handler.ref, type]);
|
|
1690
1714
|
(0, import_react15.useEffect)(() => {
|
|
1691
1715
|
import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1692
1716
|
return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
@@ -1703,6 +1727,20 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1703
1727
|
}
|
|
1704
1728
|
});
|
|
1705
1729
|
}, [handler.ref]);
|
|
1730
|
+
(0, import_react15.useEffect)(() => {
|
|
1731
|
+
return import_native_modules17.appsInTossEvent.addEventListener("backButtonClickEvent", {
|
|
1732
|
+
onEvent: () => {
|
|
1733
|
+
if (type === "game") {
|
|
1734
|
+
handleGameWebviewClose();
|
|
1735
|
+
} else if (canHistoryGoBack) {
|
|
1736
|
+
handler.ref.current?.goBack();
|
|
1737
|
+
} else {
|
|
1738
|
+
captureExitLog(Date.now());
|
|
1739
|
+
(0, import_react_native30.closeView)();
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
}, [handler.ref, canHistoryGoBack, handleGameWebviewClose, captureExitLog, type]);
|
|
1706
1744
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1707
1745
|
BaseWebView,
|
|
1708
1746
|
{
|
package/dist/index.js
CHANGED
|
@@ -569,7 +569,6 @@ function BuiltinNavigationBar() {
|
|
|
569
569
|
const isExternalWebView = globals.webViewType === "external";
|
|
570
570
|
const isGameWebView = globals.webViewType === "game";
|
|
571
571
|
const backEventContext = useBackEventContext();
|
|
572
|
-
const overrideCanGoBack = !backEventContext.hasBackEvent;
|
|
573
572
|
const handleBackOrClose = useBackOrCloseNavigation();
|
|
574
573
|
const navigation = useNavigation();
|
|
575
574
|
const handlePressTitle = useCallback3(() => {
|
|
@@ -581,12 +580,16 @@ function BuiltinNavigationBar() {
|
|
|
581
580
|
navigation.navigate("/");
|
|
582
581
|
}, [logging, globals.webViewType, navigation]);
|
|
583
582
|
const handleBack = useCallback3(() => {
|
|
584
|
-
if (
|
|
583
|
+
if (globals.webViewType != null) {
|
|
584
|
+
appsInTossEvent.emit("backButtonClickEvent", void 0);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
if (backEventContext.hasBackEvent) {
|
|
585
588
|
backEventContext.onBack();
|
|
586
589
|
return;
|
|
587
590
|
}
|
|
588
591
|
handleBackOrClose();
|
|
589
|
-
}, [
|
|
592
|
+
}, [globals.webViewType, backEventContext, handleBackOrClose]);
|
|
590
593
|
const handleClose = useCallback3(async () => {
|
|
591
594
|
logging.closeButtonClick();
|
|
592
595
|
const isConfirmed = await openConfirm({
|
|
@@ -602,16 +605,16 @@ function BuiltinNavigationBar() {
|
|
|
602
605
|
closeView();
|
|
603
606
|
}
|
|
604
607
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
608
|
+
const handleBackEvent = useCallback3(() => {
|
|
609
|
+
handleBack();
|
|
610
|
+
return true;
|
|
611
|
+
}, [handleBack]);
|
|
605
612
|
useEffect5(() => {
|
|
606
|
-
|
|
607
|
-
handleClose();
|
|
608
|
-
return true;
|
|
609
|
-
};
|
|
610
|
-
BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
613
|
+
BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
|
|
611
614
|
return () => {
|
|
612
|
-
BackHandler.removeEventListener("hardwareBackPress",
|
|
615
|
+
BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
613
616
|
};
|
|
614
|
-
}, [
|
|
617
|
+
}, [handleBackEvent]);
|
|
615
618
|
if (isExternalWebView) {
|
|
616
619
|
return /* @__PURE__ */ jsx3(Fragment3, {});
|
|
617
620
|
}
|
|
@@ -636,10 +639,12 @@ function BuiltinNavigationBar() {
|
|
|
636
639
|
}
|
|
637
640
|
function useBackOrCloseNavigation() {
|
|
638
641
|
const navigation = useNavigation();
|
|
642
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
639
643
|
return useCallback3(() => {
|
|
640
644
|
if (navigation.canGoBack()) {
|
|
641
645
|
navigation.goBack();
|
|
642
646
|
} else {
|
|
647
|
+
captureExitLog(Date.now());
|
|
643
648
|
closeView();
|
|
644
649
|
}
|
|
645
650
|
}, [navigation]);
|
|
@@ -754,11 +759,16 @@ import { GoogleAdMob, IAP, Storage, AppsInTossModule, appsInTossEvent as appsInT
|
|
|
754
759
|
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
755
760
|
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
756
761
|
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
757
|
-
import { getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/react-native";
|
|
762
|
+
import { closeView as closeView3, getSchemeUri as getSchemeUri5, useGraniteEvent } from "@granite-js/react-native";
|
|
758
763
|
import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
|
|
759
764
|
import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
|
|
760
|
-
import {
|
|
765
|
+
import {
|
|
766
|
+
ExternalWebViewScreen,
|
|
767
|
+
tdsEvent,
|
|
768
|
+
useDialog as useDialog4
|
|
769
|
+
} from "@toss-design-system/react-native";
|
|
761
770
|
import { useSafeAreaBottom, useSafeAreaTop, useTopNavigation } from "@toss-design-system/react-native/private";
|
|
771
|
+
import { josa as josa3 } from "es-hangul";
|
|
762
772
|
import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo3, useState as useState5 } from "react";
|
|
763
773
|
import { BackHandler as BackHandler2, Platform as Platform3 } from "react-native";
|
|
764
774
|
|
|
@@ -1528,6 +1538,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1528
1538
|
if (!TYPES.includes(type)) {
|
|
1529
1539
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1530
1540
|
}
|
|
1541
|
+
const { openConfirm } = useDialog4();
|
|
1542
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1531
1543
|
const graniteEvent = useGraniteEvent();
|
|
1532
1544
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1533
1545
|
const top = useSafeAreaTop();
|
|
@@ -1641,14 +1653,30 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1641
1653
|
const userAgent = useCreateUserAgent({
|
|
1642
1654
|
colorPreference: "light"
|
|
1643
1655
|
});
|
|
1656
|
+
const handleGameWebviewClose = useCallback6(async () => {
|
|
1657
|
+
const isConfirmed = await openConfirm({
|
|
1658
|
+
title: `${josa3(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1659
|
+
leftButton: "\uCDE8\uC18C",
|
|
1660
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1661
|
+
closeOnDimmerClick: true
|
|
1662
|
+
});
|
|
1663
|
+
if (isConfirmed) {
|
|
1664
|
+
captureExitLog(Date.now());
|
|
1665
|
+
closeView3();
|
|
1666
|
+
}
|
|
1667
|
+
}, [captureExitLog, openConfirm, global2.brandDisplayName]);
|
|
1644
1668
|
const handleBackEvent = useCallback6(() => {
|
|
1669
|
+
if (type === "game") {
|
|
1670
|
+
handleGameWebviewClose();
|
|
1671
|
+
return true;
|
|
1672
|
+
}
|
|
1645
1673
|
if (canHistoryGoBack) {
|
|
1646
1674
|
handler.ref.current?.goBack();
|
|
1647
1675
|
return true;
|
|
1648
1676
|
} else {
|
|
1649
1677
|
return false;
|
|
1650
1678
|
}
|
|
1651
|
-
}, [canHistoryGoBack, handler]);
|
|
1679
|
+
}, [canHistoryGoBack, handleGameWebviewClose, handler.ref, type]);
|
|
1652
1680
|
useEffect10(() => {
|
|
1653
1681
|
BackHandler2.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1654
1682
|
return () => BackHandler2.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
@@ -1665,6 +1693,20 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1665
1693
|
}
|
|
1666
1694
|
});
|
|
1667
1695
|
}, [handler.ref]);
|
|
1696
|
+
useEffect10(() => {
|
|
1697
|
+
return appsInTossEvent4.addEventListener("backButtonClickEvent", {
|
|
1698
|
+
onEvent: () => {
|
|
1699
|
+
if (type === "game") {
|
|
1700
|
+
handleGameWebviewClose();
|
|
1701
|
+
} else if (canHistoryGoBack) {
|
|
1702
|
+
handler.ref.current?.goBack();
|
|
1703
|
+
} else {
|
|
1704
|
+
captureExitLog(Date.now());
|
|
1705
|
+
closeView3();
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
});
|
|
1709
|
+
}, [handler.ref, canHistoryGoBack, handleGameWebviewClose, captureExitLog, type]);
|
|
1668
1710
|
return /* @__PURE__ */ jsx9(
|
|
1669
1711
|
BaseWebView,
|
|
1670
1712
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/framework",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "The framework for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
"ait": "./bin/ait.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@apps-in-toss/analytics": "1.1.
|
|
60
|
-
"@apps-in-toss/cli": "1.1.
|
|
61
|
-
"@apps-in-toss/native-modules": "1.1.
|
|
62
|
-
"@apps-in-toss/plugins": "1.1.
|
|
63
|
-
"@apps-in-toss/types": "1.1.
|
|
59
|
+
"@apps-in-toss/analytics": "1.1.1",
|
|
60
|
+
"@apps-in-toss/cli": "1.1.1",
|
|
61
|
+
"@apps-in-toss/native-modules": "1.1.1",
|
|
62
|
+
"@apps-in-toss/plugins": "1.1.1",
|
|
63
|
+
"@apps-in-toss/types": "1.1.1",
|
|
64
64
|
"es-hangul": "^2.3.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@babel/runtime": "^7",
|
|
68
|
-
"@granite-js/mpack": "0.1.
|
|
69
|
-
"@granite-js/native": "0.1.
|
|
70
|
-
"@granite-js/plugin-core": "0.1.
|
|
71
|
-
"@granite-js/react-native": "0.1.
|
|
72
|
-
"@granite-js/utils": "0.1.
|
|
68
|
+
"@granite-js/mpack": "0.1.22",
|
|
69
|
+
"@granite-js/native": "0.1.22",
|
|
70
|
+
"@granite-js/plugin-core": "0.1.22",
|
|
71
|
+
"@granite-js/react-native": "0.1.22",
|
|
72
|
+
"@granite-js/utils": "0.1.22",
|
|
73
73
|
"@toss-design-system/react-native": "1.1.0",
|
|
74
74
|
"@types/kill-port": "^2.0.3",
|
|
75
75
|
"@types/react": "18.3.3",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "0e0af7d44ed8ad2615a237650b9682c68ab5861e"
|
|
100
100
|
}
|
package/dist/types.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
|
|
17
|
-
// src/types.ts
|
|
18
|
-
var types_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(types_exports);
|
|
20
|
-
__reExport(types_exports, require("@apps-in-toss/types"), module.exports);
|
|
21
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
-
0 && (module.exports = {
|
|
23
|
-
...require("@apps-in-toss/types")
|
|
24
|
-
});
|
package/dist/types.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@apps-in-toss/types';
|
package/dist/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@apps-in-toss/types';
|
package/dist/types.js
DELETED