@apps-in-toss/framework 0.0.18 → 0.0.20
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 +57 -15
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +57 -16
- 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 });
|
|
@@ -319,7 +325,7 @@ var TossPay = {
|
|
|
319
325
|
};
|
|
320
326
|
|
|
321
327
|
// src/components/WebView.tsx
|
|
322
|
-
var
|
|
328
|
+
var import_react_native12 = require("@toss-design-system/react-native");
|
|
323
329
|
var import_private = require("@toss-design-system/react-native/private");
|
|
324
330
|
var import_react3 = require("react");
|
|
325
331
|
var import_react_native_bedrock5 = require("react-native-bedrock");
|
|
@@ -328,8 +334,10 @@ var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-brid
|
|
|
328
334
|
|
|
329
335
|
// src/components/GameWebView.tsx
|
|
330
336
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
337
|
+
var import_react_native10 = require("@toss-design-system/react-native");
|
|
338
|
+
var import_es_hangul = require("es-hangul");
|
|
331
339
|
var import_react2 = require("react");
|
|
332
|
-
var
|
|
340
|
+
var import_react_native11 = require("react-native");
|
|
333
341
|
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
334
342
|
|
|
335
343
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
@@ -413,6 +421,9 @@ function GameNavigationBar({ onClose }) {
|
|
|
413
421
|
import_react_native9.TouchableOpacity,
|
|
414
422
|
{
|
|
415
423
|
hitSlop: { left: 8, right: 8 },
|
|
424
|
+
accessibilityRole: "button",
|
|
425
|
+
accessible: true,
|
|
426
|
+
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
416
427
|
style: {
|
|
417
428
|
padding: import_react_native9.Platform.OS === "ios" ? 7 : 9
|
|
418
429
|
},
|
|
@@ -428,16 +439,41 @@ function GameNavigationBar({ onClose }) {
|
|
|
428
439
|
// src/components/GameWebView.tsx
|
|
429
440
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
430
441
|
var GameWebView = (0, import_react2.forwardRef)(function GameWebView2(props, ref) {
|
|
442
|
+
const { openConfirm } = (0, import_react_native10.useDialog)();
|
|
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]);
|
|
455
|
+
(0, import_react2.useEffect)(() => {
|
|
456
|
+
if (import_react_native11.Platform.OS === "ios") {
|
|
457
|
+
(0, import_react_native_bedrock4.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
458
|
+
return () => {
|
|
459
|
+
(0, import_react_native_bedrock4.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
return;
|
|
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]);
|
|
431
474
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
432
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
433
|
-
|
|
434
|
-
{
|
|
435
|
-
onClose: () => {
|
|
436
|
-
(0, import_react_native_bedrock4.closeView)();
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
),
|
|
440
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native10.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GameNavigationBar, { onClose: handleClose }),
|
|
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 }) })
|
|
441
477
|
] });
|
|
442
478
|
});
|
|
443
479
|
|
|
@@ -458,6 +494,7 @@ __export(async_bridges_exports, {
|
|
|
458
494
|
// src/constant-bridges.ts
|
|
459
495
|
var constant_bridges_exports = {};
|
|
460
496
|
__export(constant_bridges_exports, {
|
|
497
|
+
getDeviceId: () => getDeviceId,
|
|
461
498
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
462
499
|
getTossAppVersion: () => getTossAppVersion
|
|
463
500
|
});
|
|
@@ -478,8 +515,8 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
478
515
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
479
516
|
var TYPES = ["partner", "external", "game"];
|
|
480
517
|
var WEBVIEW_TYPES = {
|
|
481
|
-
partner:
|
|
482
|
-
external:
|
|
518
|
+
partner: import_react_native12.PartnerWebViewScreen,
|
|
519
|
+
external: import_react_native12.ExternalWebViewScreen,
|
|
483
520
|
game: GameWebView
|
|
484
521
|
};
|
|
485
522
|
function mergeSchemeQueryParamsInto(url) {
|
|
@@ -508,13 +545,17 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
508
545
|
if (!TYPES.includes(type)) {
|
|
509
546
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
510
547
|
}
|
|
548
|
+
const bedrockEvent = (0, import_react_native_bedrock5.useBedrockEvent)();
|
|
511
549
|
const uri = (0, import_react3.useMemo)(() => getWebViewUri(local), [local]);
|
|
512
550
|
const top = (0, import_private.useSafeAreaTop)();
|
|
513
551
|
const bottom = (0, import_private.useSafeAreaBottom)();
|
|
514
552
|
const handler = (0, import_react_native_bedrock5.useBridgeHandler)({
|
|
515
553
|
onMessage,
|
|
516
554
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
517
|
-
eventListenerMap:
|
|
555
|
+
eventListenerMap: {
|
|
556
|
+
...event_bridges_exports,
|
|
557
|
+
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options })
|
|
558
|
+
},
|
|
518
559
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
519
560
|
// @ts-expect-error
|
|
520
561
|
constantHandlerMap: {
|
|
@@ -528,7 +569,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
528
569
|
asyncHandlerMap: {
|
|
529
570
|
...bedrockAsyncBridges,
|
|
530
571
|
...async_bridges_exports,
|
|
531
|
-
|
|
572
|
+
/** internal */
|
|
532
573
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
533
574
|
/** Storage */
|
|
534
575
|
getStorageItem: Storage.getItem,
|
|
@@ -640,6 +681,7 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
640
681
|
fetchContacts,
|
|
641
682
|
getClipboardText,
|
|
642
683
|
getCurrentLocation,
|
|
684
|
+
getDeviceId,
|
|
643
685
|
getOperationalEnvironment,
|
|
644
686
|
getTossAppVersion,
|
|
645
687
|
openCamera,
|
package/dist/index.d.cts
CHANGED
|
@@ -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 저장소
|
|
@@ -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
|
@@ -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 저장소
|
|
@@ -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
|
|
|
@@ -287,9 +292,11 @@ import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
|
287
292
|
import {
|
|
288
293
|
WebView as PlainWebView
|
|
289
294
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
290
|
-
import {
|
|
291
|
-
import {
|
|
292
|
-
import {
|
|
295
|
+
import { useDialog } from "@toss-design-system/react-native";
|
|
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";
|
|
299
|
+
import { closeView, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
293
300
|
|
|
294
301
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
295
302
|
import { SvgXml } from "@react-native-bedrock/native/react-native-svg";
|
|
@@ -372,6 +379,9 @@ function GameNavigationBar({ onClose }) {
|
|
|
372
379
|
TouchableOpacity,
|
|
373
380
|
{
|
|
374
381
|
hitSlop: { left: 8, right: 8 },
|
|
382
|
+
accessibilityRole: "button",
|
|
383
|
+
accessible: true,
|
|
384
|
+
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
375
385
|
style: {
|
|
376
386
|
padding: Platform3.OS === "ios" ? 7 : 9
|
|
377
387
|
},
|
|
@@ -387,15 +397,40 @@ function GameNavigationBar({ onClose }) {
|
|
|
387
397
|
// src/components/GameWebView.tsx
|
|
388
398
|
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
389
399
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
400
|
+
const { openConfirm } = useDialog();
|
|
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]);
|
|
413
|
+
useEffect2(() => {
|
|
414
|
+
if (Platform4.OS === "ios") {
|
|
415
|
+
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
416
|
+
return () => {
|
|
417
|
+
setIosSwipeGestureEnabled({ isEnabled: true });
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
return;
|
|
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]);
|
|
390
432
|
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
391
|
-
/* @__PURE__ */ jsx4(
|
|
392
|
-
GameNavigationBar,
|
|
393
|
-
{
|
|
394
|
-
onClose: () => {
|
|
395
|
-
closeView();
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
),
|
|
433
|
+
/* @__PURE__ */ jsx4(GameNavigationBar, { onClose: handleClose }),
|
|
399
434
|
/* @__PURE__ */ jsx4(View3, { style: { flex: 1 }, children: /* @__PURE__ */ jsx4(PlainWebView, { ref, ...props }) })
|
|
400
435
|
] });
|
|
401
436
|
});
|
|
@@ -417,6 +452,7 @@ __export(async_bridges_exports, {
|
|
|
417
452
|
// src/constant-bridges.ts
|
|
418
453
|
var constant_bridges_exports = {};
|
|
419
454
|
__export(constant_bridges_exports, {
|
|
455
|
+
getDeviceId: () => getDeviceId,
|
|
420
456
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
421
457
|
getTossAppVersion: () => getTossAppVersion
|
|
422
458
|
});
|
|
@@ -467,13 +503,17 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
467
503
|
if (!TYPES.includes(type)) {
|
|
468
504
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
469
505
|
}
|
|
506
|
+
const bedrockEvent = useBedrockEvent();
|
|
470
507
|
const uri = useMemo(() => getWebViewUri(local), [local]);
|
|
471
508
|
const top = useSafeAreaTop2();
|
|
472
509
|
const bottom = useSafeAreaBottom();
|
|
473
510
|
const handler = useBridgeHandler({
|
|
474
511
|
onMessage,
|
|
475
512
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
476
|
-
eventListenerMap:
|
|
513
|
+
eventListenerMap: {
|
|
514
|
+
...event_bridges_exports,
|
|
515
|
+
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options })
|
|
516
|
+
},
|
|
477
517
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
478
518
|
// @ts-expect-error
|
|
479
519
|
constantHandlerMap: {
|
|
@@ -487,7 +527,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
487
527
|
asyncHandlerMap: {
|
|
488
528
|
...bedrockAsyncBridges,
|
|
489
529
|
...async_bridges_exports,
|
|
490
|
-
|
|
530
|
+
/** internal */
|
|
491
531
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
492
532
|
/** Storage */
|
|
493
533
|
getStorageItem: Storage.getItem,
|
|
@@ -554,12 +594,12 @@ function ensureValue(value, name) {
|
|
|
554
594
|
}
|
|
555
595
|
|
|
556
596
|
// src/hooks/useGeolocation.ts
|
|
557
|
-
import { useState, useEffect as
|
|
597
|
+
import { useState, useEffect as useEffect3 } from "react";
|
|
558
598
|
import { useVisibility } from "react-native-bedrock";
|
|
559
599
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
560
600
|
const isVisible = useVisibility();
|
|
561
601
|
const [location, setLocation] = useState(null);
|
|
562
|
-
|
|
602
|
+
useEffect3(() => {
|
|
563
603
|
if (!isVisible) {
|
|
564
604
|
return;
|
|
565
605
|
}
|
|
@@ -598,6 +638,7 @@ export {
|
|
|
598
638
|
fetchContacts,
|
|
599
639
|
getClipboardText,
|
|
600
640
|
getCurrentLocation,
|
|
641
|
+
getDeviceId,
|
|
601
642
|
getOperationalEnvironment,
|
|
602
643
|
getTossAppVersion,
|
|
603
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.20",
|
|
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.20",
|
|
60
|
+
"@apps-in-toss/plugins": "0.0.20",
|
|
61
|
+
"es-hangul": "^2.3.2"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"@react-native-bedrock/mpack-next": "
|
|
64
|
-
"@react-native-bedrock/native": "0.0.
|
|
65
|
-
"@toss-design-system/react-native": "^0.
|
|
64
|
+
"@react-native-bedrock/mpack-next": "0.0.19",
|
|
65
|
+
"@react-native-bedrock/native": "0.0.19",
|
|
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": "
|
|
76
|
+
"react-native-bedrock": "0.0.19",
|
|
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": "5c967237d66e19465d53f6ed842fe9c4f39b768f"
|
|
94
95
|
}
|
package/src/constant-bridges.ts
CHANGED