@apps-in-toss/framework 0.0.19 → 0.0.21
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 +38 -19
- package/dist/index.d.cts +35 -5
- package/dist/index.d.ts +35 -5
- package/dist/index.js +40 -22
- package/package.json +12 -11
- package/src/constant-bridges.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(src_exports, {
|
|
|
41
41
|
fetchContacts: () => fetchContacts,
|
|
42
42
|
getClipboardText: () => getClipboardText,
|
|
43
43
|
getCurrentLocation: () => getCurrentLocation,
|
|
44
|
+
getDeviceId: () => getDeviceId,
|
|
44
45
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
45
46
|
getTossAppVersion: () => getTossAppVersion,
|
|
46
47
|
openCamera: () => openCamera,
|
|
@@ -289,6 +290,11 @@ function getTossAppVersion() {
|
|
|
289
290
|
return AppsInTossModule.tossAppVersion;
|
|
290
291
|
}
|
|
291
292
|
|
|
293
|
+
// src/native-modules/getDeviceId.ts
|
|
294
|
+
function getDeviceId() {
|
|
295
|
+
return AppsInTossModule.deviceId;
|
|
296
|
+
}
|
|
297
|
+
|
|
292
298
|
// src/native-modules/storage.ts
|
|
293
299
|
function getItem(key) {
|
|
294
300
|
return AppsInTossModule.getStorageItem({ key });
|
|
@@ -329,6 +335,7 @@ var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-brid
|
|
|
329
335
|
// src/components/GameWebView.tsx
|
|
330
336
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
331
337
|
var import_react_native10 = require("@toss-design-system/react-native");
|
|
338
|
+
var import_es_hangul = require("es-hangul");
|
|
332
339
|
var import_react2 = require("react");
|
|
333
340
|
var import_react_native11 = require("react-native");
|
|
334
341
|
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
@@ -416,7 +423,7 @@ function GameNavigationBar({ onClose }) {
|
|
|
416
423
|
hitSlop: { left: 8, right: 8 },
|
|
417
424
|
accessibilityRole: "button",
|
|
418
425
|
accessible: true,
|
|
419
|
-
accessibilityLabel: "\
|
|
426
|
+
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
420
427
|
style: {
|
|
421
428
|
padding: import_react_native9.Platform.OS === "ios" ? 7 : 9
|
|
422
429
|
},
|
|
@@ -434,6 +441,17 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
|
434
441
|
var GameWebView = (0, import_react2.forwardRef)(function GameWebView2(props, ref) {
|
|
435
442
|
const { openConfirm } = (0, import_react_native10.useDialog)();
|
|
436
443
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
444
|
+
const handleClose = (0, import_react2.useCallback)(async () => {
|
|
445
|
+
const isConfirmed = await openConfirm({
|
|
446
|
+
title: `${(0, import_es_hangul.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
447
|
+
leftButton: "\uCDE8\uC18C",
|
|
448
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
449
|
+
closeOnDimmerClick: true
|
|
450
|
+
});
|
|
451
|
+
if (isConfirmed) {
|
|
452
|
+
(0, import_react_native_bedrock4.closeView)();
|
|
453
|
+
}
|
|
454
|
+
}, [brandDisplayName, openConfirm]);
|
|
437
455
|
(0, import_react2.useEffect)(() => {
|
|
438
456
|
if (import_react_native11.Platform.OS === "ios") {
|
|
439
457
|
(0, import_react_native_bedrock4.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
@@ -443,23 +461,18 @@ var GameWebView = (0, import_react2.forwardRef)(function GameWebView2(props, ref
|
|
|
443
461
|
}
|
|
444
462
|
return;
|
|
445
463
|
}, []);
|
|
464
|
+
(0, import_react2.useEffect)(() => {
|
|
465
|
+
const backHandler = () => {
|
|
466
|
+
handleClose();
|
|
467
|
+
return true;
|
|
468
|
+
};
|
|
469
|
+
import_react_native11.BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
470
|
+
return () => {
|
|
471
|
+
import_react_native11.BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
472
|
+
};
|
|
473
|
+
}, [handleClose]);
|
|
446
474
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
447
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
448
|
-
GameNavigationBar,
|
|
449
|
-
{
|
|
450
|
-
onClose: async () => {
|
|
451
|
-
const isConfirmed = await openConfirm({
|
|
452
|
-
title: `${brandDisplayName}\uC744 \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
453
|
-
leftButton: "\uCDE8\uC18C",
|
|
454
|
-
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
455
|
-
closeOnDimmerClick: true
|
|
456
|
-
});
|
|
457
|
-
if (isConfirmed) {
|
|
458
|
-
(0, import_react_native_bedrock4.closeView)();
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
),
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GameNavigationBar, { onClose: handleClose }),
|
|
463
476
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native11.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
|
|
464
477
|
] });
|
|
465
478
|
});
|
|
@@ -481,6 +494,7 @@ __export(async_bridges_exports, {
|
|
|
481
494
|
// src/constant-bridges.ts
|
|
482
495
|
var constant_bridges_exports = {};
|
|
483
496
|
__export(constant_bridges_exports, {
|
|
497
|
+
getDeviceId: () => getDeviceId,
|
|
484
498
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
485
499
|
getTossAppVersion: () => getTossAppVersion
|
|
486
500
|
});
|
|
@@ -531,13 +545,17 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
531
545
|
if (!TYPES.includes(type)) {
|
|
532
546
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
533
547
|
}
|
|
548
|
+
const bedrockEvent = (0, import_react_native_bedrock5.useBedrockEvent)();
|
|
534
549
|
const uri = (0, import_react3.useMemo)(() => getWebViewUri(local), [local]);
|
|
535
550
|
const top = (0, import_private.useSafeAreaTop)();
|
|
536
551
|
const bottom = (0, import_private.useSafeAreaBottom)();
|
|
537
552
|
const handler = (0, import_react_native_bedrock5.useBridgeHandler)({
|
|
538
553
|
onMessage,
|
|
539
554
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
540
|
-
eventListenerMap:
|
|
555
|
+
eventListenerMap: {
|
|
556
|
+
...event_bridges_exports,
|
|
557
|
+
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options })
|
|
558
|
+
},
|
|
541
559
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
542
560
|
// @ts-expect-error
|
|
543
561
|
constantHandlerMap: {
|
|
@@ -551,7 +569,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
551
569
|
asyncHandlerMap: {
|
|
552
570
|
...bedrockAsyncBridges,
|
|
553
571
|
...async_bridges_exports,
|
|
554
|
-
|
|
572
|
+
/** internal */
|
|
555
573
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
556
574
|
/** Storage */
|
|
557
575
|
getStorageItem: Storage.getItem,
|
|
@@ -663,6 +681,7 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
663
681
|
fetchContacts,
|
|
664
682
|
getClipboardText,
|
|
665
683
|
getCurrentLocation,
|
|
684
|
+
getDeviceId,
|
|
666
685
|
getOperationalEnvironment,
|
|
667
686
|
getTossAppVersion,
|
|
668
687
|
openCamera,
|
package/dist/index.d.cts
CHANGED
|
@@ -70,7 +70,7 @@ interface Location {
|
|
|
70
70
|
*/
|
|
71
71
|
timestamp: number;
|
|
72
72
|
/**
|
|
73
|
-
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/reference/framework/Types/LocationCoords.html)을 참고해주세요.
|
|
73
|
+
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/react-native/reference/framework/Types/LocationCoords.html)을 참고해주세요.
|
|
74
74
|
*/
|
|
75
75
|
coords: LocationCoords;
|
|
76
76
|
}
|
|
@@ -154,7 +154,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
154
154
|
* @param {number} [options.accuracy] 위치 정확도를 설정해요.
|
|
155
155
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
156
156
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
157
|
-
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
157
|
+
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
160
|
* ### 위치 정보 변경 감지하기
|
|
@@ -858,7 +858,7 @@ interface GetCurrentLocationOptions {
|
|
|
858
858
|
*
|
|
859
859
|
* @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
|
|
860
860
|
* @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
|
|
861
|
-
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
861
|
+
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
862
862
|
*
|
|
863
863
|
* @example
|
|
864
864
|
* ### 디바이스의 현재 위치 정보 가져오기
|
|
@@ -1057,6 +1057,36 @@ declare function getOperationalEnvironment(): 'toss' | 'sandbox';
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
declare function getTossAppVersion(): string;
|
|
1059
1059
|
|
|
1060
|
+
/**
|
|
1061
|
+
* @public
|
|
1062
|
+
* @category 환경 확인
|
|
1063
|
+
* @kind function
|
|
1064
|
+
* @name getDeviceId
|
|
1065
|
+
* @description
|
|
1066
|
+
* 사용 중인 기기의 고유 식별자를 문자열로 반환해요.
|
|
1067
|
+
*
|
|
1068
|
+
* 이 함수는 현재 사용 중인 기기의 고유 식별자를 문자열로 반환해요. 기기별로 설정이나 데이터를 저장하거나 사용자의 기기를 식별해서 로그를 기록하고 분석하는 데 사용할 수 있어요. 같은 사용자의 여러 기기를 구분하는 데도 유용해요.
|
|
1069
|
+
*
|
|
1070
|
+
* @returns {string} 기기의 고유 식별자를 나타내는 문자열이에요.
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ### 기기 고유 식별자 가져오기
|
|
1074
|
+
*
|
|
1075
|
+
* ```tsx
|
|
1076
|
+
* import { getDeviceId } from '@apps-in-toss/framework';
|
|
1077
|
+
* import { Text } from 'react-native';
|
|
1078
|
+
*
|
|
1079
|
+
* function MyPage() {
|
|
1080
|
+
* const id = getDeviceId();
|
|
1081
|
+
*
|
|
1082
|
+
* return (
|
|
1083
|
+
* <Text>사용자의 기기 고유 식별자: {id}</Text>
|
|
1084
|
+
* );
|
|
1085
|
+
* }
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
declare function getDeviceId(): string;
|
|
1089
|
+
|
|
1060
1090
|
/**
|
|
1061
1091
|
* @public
|
|
1062
1092
|
* @category 저장소
|
|
@@ -1190,7 +1220,7 @@ type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
|
1190
1220
|
* @param {Accuracy} [options.accuracy] 위치 정확도를 설정해요. `Accuracy.Lowest`: 오차범위 3KM 이내, `Accuracy.Low`: 오차범위 1KM 이내, `Accuracy.Balanced`: 오차범위 몇 백미터 이내, `Accuracy.High`: 오차범위 10M 이내, `Accuracy.Highest`: 가장 높은 정확도, `Accuracy.BestForNavigation`: 네비게이션을 위한 최고 정확도
|
|
1191
1221
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
1192
1222
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
1193
|
-
* @returns {Location | null} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
1223
|
+
* @returns {Location | null} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
1194
1224
|
*
|
|
1195
1225
|
* @example
|
|
1196
1226
|
* ### 위치 정보 변경 감지하기
|
|
@@ -1226,4 +1256,4 @@ declare const env: {
|
|
|
1226
1256
|
getDeploymentId: () => string | undefined;
|
|
1227
1257
|
};
|
|
1228
1258
|
|
|
1229
|
-
export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getOperationalEnvironment, getTossAppVersion, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
|
1259
|
+
export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getDeviceId, getOperationalEnvironment, getTossAppVersion, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
package/dist/index.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ interface Location {
|
|
|
70
70
|
*/
|
|
71
71
|
timestamp: number;
|
|
72
72
|
/**
|
|
73
|
-
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/reference/framework/Types/LocationCoords.html)을 참고해주세요.
|
|
73
|
+
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/react-native/reference/framework/Types/LocationCoords.html)을 참고해주세요.
|
|
74
74
|
*/
|
|
75
75
|
coords: LocationCoords;
|
|
76
76
|
}
|
|
@@ -154,7 +154,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
154
154
|
* @param {number} [options.accuracy] 위치 정확도를 설정해요.
|
|
155
155
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
156
156
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
157
|
-
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
157
|
+
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
160
|
* ### 위치 정보 변경 감지하기
|
|
@@ -858,7 +858,7 @@ interface GetCurrentLocationOptions {
|
|
|
858
858
|
*
|
|
859
859
|
* @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
|
|
860
860
|
* @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
|
|
861
|
-
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
861
|
+
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
862
862
|
*
|
|
863
863
|
* @example
|
|
864
864
|
* ### 디바이스의 현재 위치 정보 가져오기
|
|
@@ -1057,6 +1057,36 @@ declare function getOperationalEnvironment(): 'toss' | 'sandbox';
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
declare function getTossAppVersion(): string;
|
|
1059
1059
|
|
|
1060
|
+
/**
|
|
1061
|
+
* @public
|
|
1062
|
+
* @category 환경 확인
|
|
1063
|
+
* @kind function
|
|
1064
|
+
* @name getDeviceId
|
|
1065
|
+
* @description
|
|
1066
|
+
* 사용 중인 기기의 고유 식별자를 문자열로 반환해요.
|
|
1067
|
+
*
|
|
1068
|
+
* 이 함수는 현재 사용 중인 기기의 고유 식별자를 문자열로 반환해요. 기기별로 설정이나 데이터를 저장하거나 사용자의 기기를 식별해서 로그를 기록하고 분석하는 데 사용할 수 있어요. 같은 사용자의 여러 기기를 구분하는 데도 유용해요.
|
|
1069
|
+
*
|
|
1070
|
+
* @returns {string} 기기의 고유 식별자를 나타내는 문자열이에요.
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ### 기기 고유 식별자 가져오기
|
|
1074
|
+
*
|
|
1075
|
+
* ```tsx
|
|
1076
|
+
* import { getDeviceId } from '@apps-in-toss/framework';
|
|
1077
|
+
* import { Text } from 'react-native';
|
|
1078
|
+
*
|
|
1079
|
+
* function MyPage() {
|
|
1080
|
+
* const id = getDeviceId();
|
|
1081
|
+
*
|
|
1082
|
+
* return (
|
|
1083
|
+
* <Text>사용자의 기기 고유 식별자: {id}</Text>
|
|
1084
|
+
* );
|
|
1085
|
+
* }
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
declare function getDeviceId(): string;
|
|
1089
|
+
|
|
1060
1090
|
/**
|
|
1061
1091
|
* @public
|
|
1062
1092
|
* @category 저장소
|
|
@@ -1190,7 +1220,7 @@ type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
|
1190
1220
|
* @param {Accuracy} [options.accuracy] 위치 정확도를 설정해요. `Accuracy.Lowest`: 오차범위 3KM 이내, `Accuracy.Low`: 오차범위 1KM 이내, `Accuracy.Balanced`: 오차범위 몇 백미터 이내, `Accuracy.High`: 오차범위 10M 이내, `Accuracy.Highest`: 가장 높은 정확도, `Accuracy.BestForNavigation`: 네비게이션을 위한 최고 정확도
|
|
1191
1221
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
1192
1222
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
1193
|
-
* @returns {Location | null} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
1223
|
+
* @returns {Location | null} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
1194
1224
|
*
|
|
1195
1225
|
* @example
|
|
1196
1226
|
* ### 위치 정보 변경 감지하기
|
|
@@ -1226,4 +1256,4 @@ declare const env: {
|
|
|
1226
1256
|
getDeploymentId: () => string | undefined;
|
|
1227
1257
|
};
|
|
1228
1258
|
|
|
1229
|
-
export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getOperationalEnvironment, getTossAppVersion, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
|
1259
|
+
export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getDeviceId, getOperationalEnvironment, getTossAppVersion, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
package/dist/index.js
CHANGED
|
@@ -243,6 +243,11 @@ function getTossAppVersion() {
|
|
|
243
243
|
return AppsInTossModule.tossAppVersion;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
// src/native-modules/getDeviceId.ts
|
|
247
|
+
function getDeviceId() {
|
|
248
|
+
return AppsInTossModule.deviceId;
|
|
249
|
+
}
|
|
250
|
+
|
|
246
251
|
// src/native-modules/storage.ts
|
|
247
252
|
function getItem(key) {
|
|
248
253
|
return AppsInTossModule.getStorageItem({ key });
|
|
@@ -279,7 +284,7 @@ import {
|
|
|
279
284
|
} from "@toss-design-system/react-native";
|
|
280
285
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
281
286
|
import { useMemo } from "react";
|
|
282
|
-
import { getSchemeUri, useBridgeHandler } from "react-native-bedrock";
|
|
287
|
+
import { getSchemeUri, useBridgeHandler, useBedrockEvent } from "react-native-bedrock";
|
|
283
288
|
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
284
289
|
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
285
290
|
|
|
@@ -288,8 +293,9 @@ import {
|
|
|
288
293
|
WebView as PlainWebView
|
|
289
294
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
290
295
|
import { useDialog } from "@toss-design-system/react-native";
|
|
291
|
-
import {
|
|
292
|
-
import {
|
|
296
|
+
import { josa } from "es-hangul";
|
|
297
|
+
import { forwardRef, useCallback, useEffect as useEffect2 } from "react";
|
|
298
|
+
import { BackHandler, Platform as Platform4, View as View3 } from "react-native";
|
|
293
299
|
import { closeView, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
294
300
|
|
|
295
301
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
@@ -375,7 +381,7 @@ function GameNavigationBar({ onClose }) {
|
|
|
375
381
|
hitSlop: { left: 8, right: 8 },
|
|
376
382
|
accessibilityRole: "button",
|
|
377
383
|
accessible: true,
|
|
378
|
-
accessibilityLabel: "\
|
|
384
|
+
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
379
385
|
style: {
|
|
380
386
|
padding: Platform3.OS === "ios" ? 7 : 9
|
|
381
387
|
},
|
|
@@ -393,6 +399,17 @@ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-run
|
|
|
393
399
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
394
400
|
const { openConfirm } = useDialog();
|
|
395
401
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
402
|
+
const handleClose = useCallback(async () => {
|
|
403
|
+
const isConfirmed = await openConfirm({
|
|
404
|
+
title: `${josa(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
405
|
+
leftButton: "\uCDE8\uC18C",
|
|
406
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
407
|
+
closeOnDimmerClick: true
|
|
408
|
+
});
|
|
409
|
+
if (isConfirmed) {
|
|
410
|
+
closeView();
|
|
411
|
+
}
|
|
412
|
+
}, [brandDisplayName, openConfirm]);
|
|
396
413
|
useEffect2(() => {
|
|
397
414
|
if (Platform4.OS === "ios") {
|
|
398
415
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
@@ -402,23 +419,18 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
402
419
|
}
|
|
403
420
|
return;
|
|
404
421
|
}, []);
|
|
422
|
+
useEffect2(() => {
|
|
423
|
+
const backHandler = () => {
|
|
424
|
+
handleClose();
|
|
425
|
+
return true;
|
|
426
|
+
};
|
|
427
|
+
BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
428
|
+
return () => {
|
|
429
|
+
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
430
|
+
};
|
|
431
|
+
}, [handleClose]);
|
|
405
432
|
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
406
|
-
/* @__PURE__ */ jsx4(
|
|
407
|
-
GameNavigationBar,
|
|
408
|
-
{
|
|
409
|
-
onClose: async () => {
|
|
410
|
-
const isConfirmed = await openConfirm({
|
|
411
|
-
title: `${brandDisplayName}\uC744 \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
412
|
-
leftButton: "\uCDE8\uC18C",
|
|
413
|
-
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
414
|
-
closeOnDimmerClick: true
|
|
415
|
-
});
|
|
416
|
-
if (isConfirmed) {
|
|
417
|
-
closeView();
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
),
|
|
433
|
+
/* @__PURE__ */ jsx4(GameNavigationBar, { onClose: handleClose }),
|
|
422
434
|
/* @__PURE__ */ jsx4(View3, { style: { flex: 1 }, children: /* @__PURE__ */ jsx4(PlainWebView, { ref, ...props }) })
|
|
423
435
|
] });
|
|
424
436
|
});
|
|
@@ -440,6 +452,7 @@ __export(async_bridges_exports, {
|
|
|
440
452
|
// src/constant-bridges.ts
|
|
441
453
|
var constant_bridges_exports = {};
|
|
442
454
|
__export(constant_bridges_exports, {
|
|
455
|
+
getDeviceId: () => getDeviceId,
|
|
443
456
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
444
457
|
getTossAppVersion: () => getTossAppVersion
|
|
445
458
|
});
|
|
@@ -490,13 +503,17 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
490
503
|
if (!TYPES.includes(type)) {
|
|
491
504
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
492
505
|
}
|
|
506
|
+
const bedrockEvent = useBedrockEvent();
|
|
493
507
|
const uri = useMemo(() => getWebViewUri(local), [local]);
|
|
494
508
|
const top = useSafeAreaTop2();
|
|
495
509
|
const bottom = useSafeAreaBottom();
|
|
496
510
|
const handler = useBridgeHandler({
|
|
497
511
|
onMessage,
|
|
498
512
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
499
|
-
eventListenerMap:
|
|
513
|
+
eventListenerMap: {
|
|
514
|
+
...event_bridges_exports,
|
|
515
|
+
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options })
|
|
516
|
+
},
|
|
500
517
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
501
518
|
// @ts-expect-error
|
|
502
519
|
constantHandlerMap: {
|
|
@@ -510,7 +527,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
510
527
|
asyncHandlerMap: {
|
|
511
528
|
...bedrockAsyncBridges,
|
|
512
529
|
...async_bridges_exports,
|
|
513
|
-
|
|
530
|
+
/** internal */
|
|
514
531
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
515
532
|
/** Storage */
|
|
516
533
|
getStorageItem: Storage.getItem,
|
|
@@ -621,6 +638,7 @@ export {
|
|
|
621
638
|
fetchContacts,
|
|
622
639
|
getClipboardText,
|
|
623
640
|
getCurrentLocation,
|
|
641
|
+
getDeviceId,
|
|
624
642
|
getOperationalEnvironment,
|
|
625
643
|
getTossAppVersion,
|
|
626
644
|
openCamera,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/framework",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"description": "The framework for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -56,13 +56,14 @@
|
|
|
56
56
|
"ait": "./bin/ait.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@apps-in-toss/cli": "0.0.
|
|
60
|
-
"@apps-in-toss/plugins": "0.0.
|
|
59
|
+
"@apps-in-toss/cli": "0.0.21",
|
|
60
|
+
"@apps-in-toss/plugins": "0.0.21",
|
|
61
|
+
"es-hangul": "^2.3.2"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"@react-native-bedrock/mpack-next": "0.0.
|
|
64
|
-
"@react-native-bedrock/native": "0.0.
|
|
65
|
-
"@toss-design-system/react-native": "^0.
|
|
64
|
+
"@react-native-bedrock/mpack-next": "0.0.20",
|
|
65
|
+
"@react-native-bedrock/native": "0.0.20",
|
|
66
|
+
"@toss-design-system/react-native": "^0.5.0",
|
|
66
67
|
"@types/kill-port": "^2.0.1",
|
|
67
68
|
"@types/react": "18.3.3",
|
|
68
69
|
"@types/yauzl": "^2.10.3",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"kill-port": "^2.0.1",
|
|
73
74
|
"react": "18.2.0",
|
|
74
75
|
"react-native": "0.72.6",
|
|
75
|
-
"react-native-bedrock": "0.0.
|
|
76
|
+
"react-native-bedrock": "0.0.20",
|
|
76
77
|
"tsup": "^8.3.5",
|
|
77
78
|
"typescript": "4.9.5",
|
|
78
79
|
"vitest": "^3.0.3",
|
|
@@ -80,15 +81,15 @@
|
|
|
80
81
|
"yauzl": "^3.2.0"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|
|
83
|
-
"@react-native-bedrock/native": "
|
|
84
|
-
"@toss-design-system/react-native": "
|
|
84
|
+
"@react-native-bedrock/native": ">= 0.0.18",
|
|
85
|
+
"@toss-design-system/react-native": ">= 0.5.0",
|
|
85
86
|
"@types/react": "*",
|
|
86
87
|
"react": "*",
|
|
87
88
|
"react-native": "*",
|
|
88
|
-
"react-native-bedrock": "
|
|
89
|
+
"react-native-bedrock": ">= 0.0.18"
|
|
89
90
|
},
|
|
90
91
|
"publishConfig": {
|
|
91
92
|
"access": "public"
|
|
92
93
|
},
|
|
93
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "9dad7250017dbe59829ccb6a399138c4421ebe93"
|
|
94
95
|
}
|
package/src/constant-bridges.ts
CHANGED