@apps-in-toss/framework 0.0.0-dev.1741599933429 → 0.0.0-dev.1741859884482
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/LICENSE +674 -202
- package/README.md +4 -5
- package/{bin.js → bin/ait.js} +0 -1
- package/dist/index.cjs +64 -20
- package/dist/index.d.cts +66 -16
- package/dist/index.d.ts +66 -16
- package/dist/index.js +56 -13
- package/dist/jest/index.cjs +24 -0
- package/dist/jest/index.d.cts +1 -0
- package/dist/jest/index.d.ts +1 -0
- package/dist/jest/index.js +4 -0
- package/dist/plugins/index.cjs +271 -66
- package/dist/plugins/index.d.cts +9 -1
- package/dist/plugins/index.d.ts +9 -1
- package/dist/plugins/index.js +268 -65
- package/jest.d.ts +1 -0
- package/package.json +20 -11
package/README.md
CHANGED
|
@@ -4,21 +4,20 @@ Hub package for Apps In Toss
|
|
|
4
4
|
|
|
5
5
|
## License
|
|
6
6
|
|
|
7
|
-
This software is licensed under the [
|
|
7
|
+
This software is licensed under the [GPL, Version 3.0](LICENSE), quoted below.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
Copyright 2025 Viva Republica, Inc
|
|
10
|
+
Copyright 2025 Viva Republica, Inc.
|
|
11
11
|
|
|
12
|
-
Licensed under the
|
|
12
|
+
Licensed under the GPL, Version 3.0 (the "License");
|
|
13
13
|
you may not use this file except in compliance with the License.
|
|
14
14
|
You may obtain a copy of the License at:
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
https://www.gnu.org/licenses/gpl-3.0.html
|
|
17
17
|
|
|
18
18
|
Unless required by applicable law or agreed to in writing, software
|
|
19
19
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
20
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
21
|
See the License for the specific language governing permissions and
|
|
22
22
|
limitations under the License.
|
|
23
|
-
|
|
24
23
|
```
|
package/{bin.js → bin/ait.js}
RENAMED
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
Accuracy: () => Accuracy2,
|
|
34
|
+
AppsInToss: () => AppsInToss,
|
|
34
35
|
WebView: () => WebView,
|
|
35
36
|
appLogin: () => appLogin,
|
|
36
37
|
env: () => env,
|
|
@@ -45,6 +46,32 @@ __export(src_exports, {
|
|
|
45
46
|
});
|
|
46
47
|
module.exports = __toCommonJS(src_exports);
|
|
47
48
|
|
|
49
|
+
// src/core/registerApp.tsx
|
|
50
|
+
var import_react_native_bedrock = require("react-native-bedrock");
|
|
51
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children });
|
|
54
|
+
}
|
|
55
|
+
function registerApp(container, { context }) {
|
|
56
|
+
return import_react_native_bedrock.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
|
|
57
|
+
appName: getAppName(),
|
|
58
|
+
context
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function getAppName() {
|
|
62
|
+
try {
|
|
63
|
+
return global.__bedrock.app.name;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error("unexpected error occurred while getting app name");
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/core/index.ts
|
|
71
|
+
var AppsInToss = {
|
|
72
|
+
registerApp
|
|
73
|
+
};
|
|
74
|
+
|
|
48
75
|
// src/native-event-emitter/index.ts
|
|
49
76
|
var native_event_emitter_exports = {};
|
|
50
77
|
__export(native_event_emitter_exports, {
|
|
@@ -52,10 +79,10 @@ __export(native_event_emitter_exports, {
|
|
|
52
79
|
});
|
|
53
80
|
|
|
54
81
|
// src/native-event-emitter/bedrock-event.ts
|
|
55
|
-
var
|
|
82
|
+
var import_react_native_bedrock3 = require("react-native-bedrock");
|
|
56
83
|
|
|
57
84
|
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
58
|
-
var
|
|
85
|
+
var import_react_native_bedrock2 = require("react-native-bedrock");
|
|
59
86
|
|
|
60
87
|
// src/native-modules/AppsInTossModule.ts
|
|
61
88
|
var import_react_native = require("react-native");
|
|
@@ -89,7 +116,7 @@ var import_react_native2 = require("react-native");
|
|
|
89
116
|
var nativeEventEmitter = new import_react_native2.NativeEventEmitter(AppsInTossModuleInstance);
|
|
90
117
|
|
|
91
118
|
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
92
|
-
var UpdateLocationEvent = class extends
|
|
119
|
+
var UpdateLocationEvent = class extends import_react_native_bedrock2.BedrockEventDefinition {
|
|
93
120
|
name = "updateLocationEvent";
|
|
94
121
|
subscriptionCount = 0;
|
|
95
122
|
ref = {
|
|
@@ -117,7 +144,7 @@ var UpdateLocationEvent = class extends import_react_native_bedrock.BedrockEvent
|
|
|
117
144
|
};
|
|
118
145
|
|
|
119
146
|
// src/native-event-emitter/bedrock-event.ts
|
|
120
|
-
var appsInTossEvent = new
|
|
147
|
+
var appsInTossEvent = new import_react_native_bedrock3.BedrockEvent([new UpdateLocationEvent()]);
|
|
121
148
|
|
|
122
149
|
// src/native-event-emitter/startUpdateLocation.ts
|
|
123
150
|
function startUpdateLocation(eventParams) {
|
|
@@ -189,6 +216,14 @@ async function fetchAlbumPhotos(options) {
|
|
|
189
216
|
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
190
217
|
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
191
218
|
});
|
|
219
|
+
if (options.base64) {
|
|
220
|
+
return albumPhotos.map((photo) => {
|
|
221
|
+
return {
|
|
222
|
+
...photo,
|
|
223
|
+
dataUri: `data:image/jpeg;base64,${photo.dataUri}`
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
}
|
|
192
227
|
return albumPhotos;
|
|
193
228
|
}
|
|
194
229
|
|
|
@@ -220,18 +255,25 @@ async function appLogin() {
|
|
|
220
255
|
// src/components/WebView.tsx
|
|
221
256
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
222
257
|
var import_react = require("react");
|
|
223
|
-
var
|
|
258
|
+
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
224
259
|
var bridges = __toESM(require("react-native-bedrock/bridges"), 1);
|
|
225
260
|
var constantBridges = __toESM(require("react-native-bedrock/constants"), 1);
|
|
226
|
-
|
|
227
|
-
|
|
261
|
+
|
|
262
|
+
// src/env.ts
|
|
263
|
+
var env = {
|
|
264
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// src/components/WebView.tsx
|
|
268
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
269
|
+
function WebView({ local, onMessage, ...props }) {
|
|
228
270
|
const uri = (0, import_react.useMemo)(() => {
|
|
229
271
|
if (__DEV__) {
|
|
230
|
-
return `http
|
|
272
|
+
return `http://${local.host}:${local.port}`;
|
|
231
273
|
}
|
|
232
|
-
return
|
|
233
|
-
}, [
|
|
234
|
-
const handler = (0,
|
|
274
|
+
return `https://${import_react_native_bedrock4.Bedrock.appName}.alpha-apps.tossmini.com`;
|
|
275
|
+
}, [local]);
|
|
276
|
+
const handler = (0, import_react_native_bedrock4.useBridgeHandler)({
|
|
235
277
|
onMessage,
|
|
236
278
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
237
279
|
eventListenerMap: native_event_emitter_exports,
|
|
@@ -245,14 +287,20 @@ function WebView({ localhostPort = 5173, onMessage, ...props }) {
|
|
|
245
287
|
...native_modules_exports
|
|
246
288
|
}
|
|
247
289
|
});
|
|
248
|
-
return /* @__PURE__ */ (0,
|
|
290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
249
291
|
import_react_native_webview.WebView,
|
|
250
292
|
{
|
|
251
293
|
ref: handler.ref,
|
|
252
294
|
...props,
|
|
253
|
-
source: {
|
|
295
|
+
source: {
|
|
296
|
+
uri,
|
|
297
|
+
headers: {
|
|
298
|
+
"x-mini-deployment-id": env.getDeploymentId()
|
|
299
|
+
}
|
|
300
|
+
},
|
|
254
301
|
sharedCookiesEnabled: true,
|
|
255
302
|
thirdPartyCookiesEnabled: true,
|
|
303
|
+
cacheEnabled: false,
|
|
256
304
|
onMessage: handler.onMessage,
|
|
257
305
|
injectedJavaScript: handler.injectedJavaScript,
|
|
258
306
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
@@ -262,9 +310,9 @@ function WebView({ localhostPort = 5173, onMessage, ...props }) {
|
|
|
262
310
|
|
|
263
311
|
// src/hooks/useGeolocation.ts
|
|
264
312
|
var import_react2 = require("react");
|
|
265
|
-
var
|
|
313
|
+
var import_react_native_bedrock5 = require("react-native-bedrock");
|
|
266
314
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
267
|
-
const isVisible = (0,
|
|
315
|
+
const isVisible = (0, import_react_native_bedrock5.useVisibility)();
|
|
268
316
|
const [location, setLocation] = (0, import_react2.useState)(null);
|
|
269
317
|
(0, import_react2.useEffect)(() => {
|
|
270
318
|
if (!isVisible) {
|
|
@@ -283,11 +331,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
283
331
|
return location;
|
|
284
332
|
}
|
|
285
333
|
|
|
286
|
-
// src/env.ts
|
|
287
|
-
var env = {
|
|
288
|
-
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
289
|
-
};
|
|
290
|
-
|
|
291
334
|
// src/types.ts
|
|
292
335
|
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
293
336
|
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
@@ -301,6 +344,7 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
301
344
|
// Annotate the CommonJS export names for ESM import in node:
|
|
302
345
|
0 && (module.exports = {
|
|
303
346
|
Accuracy,
|
|
347
|
+
AppsInToss,
|
|
304
348
|
WebView,
|
|
305
349
|
appLogin,
|
|
306
350
|
env,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
import { ComponentType, PropsWithChildren } from 'react';
|
|
2
|
+
import { InitialProps, BedrockProps } from 'react-native-bedrock';
|
|
1
3
|
import { EmitterSubscription } from 'react-native';
|
|
2
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
5
|
import { WebViewProps as WebViewProps$1 } from '@react-native-bedrock/native/react-native-webview';
|
|
4
6
|
|
|
7
|
+
type AppsInTossProps = Pick<BedrockProps, 'context'>;
|
|
8
|
+
declare function registerApp(container: ComponentType<PropsWithChildren<InitialProps>>, { context }: AppsInTossProps): (initialProps: InitialProps) => JSX.Element;
|
|
9
|
+
|
|
10
|
+
declare const AppsInToss: {
|
|
11
|
+
registerApp: typeof registerApp;
|
|
12
|
+
};
|
|
13
|
+
|
|
5
14
|
interface EventEmitterSchema<K extends string, P extends unknown[]> {
|
|
6
15
|
name: K;
|
|
7
16
|
params: P;
|
|
8
17
|
}
|
|
9
18
|
|
|
10
19
|
/**
|
|
11
|
-
*
|
|
20
|
+
* @public
|
|
21
|
+
* @category Types
|
|
22
|
+
* @name Accuracy
|
|
23
|
+
* @description 위치 정확도 옵션이에요.
|
|
12
24
|
*/
|
|
13
25
|
declare enum Accuracy {
|
|
14
26
|
/**
|
|
@@ -36,6 +48,12 @@ declare enum Accuracy {
|
|
|
36
48
|
*/
|
|
37
49
|
BestForNavigation = 6
|
|
38
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
* @category Types
|
|
54
|
+
* @name Location
|
|
55
|
+
* @description 위치 정보를 나타내는 객체예요.
|
|
56
|
+
*/
|
|
39
57
|
interface Location {
|
|
40
58
|
/**
|
|
41
59
|
* Android에서만 지원하는 옵션이에요.
|
|
@@ -50,14 +68,42 @@ interface Location {
|
|
|
50
68
|
* 위치가 업데이트된 시점의 유닉스 타임스탬프예요.
|
|
51
69
|
*/
|
|
52
70
|
timestamp: number;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
/**
|
|
72
|
+
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/reference/framework/Types/LocationCoords.html)을 참고해주세요.
|
|
73
|
+
*/
|
|
74
|
+
coords: LocationCoords;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @public
|
|
78
|
+
* @category Types
|
|
79
|
+
* @name LocationCoords
|
|
80
|
+
* @description 세부 위치 정보를 나타내는 객체예요.
|
|
81
|
+
*/
|
|
82
|
+
interface LocationCoords {
|
|
83
|
+
/**
|
|
84
|
+
* 위도
|
|
85
|
+
*/
|
|
86
|
+
latitude: number;
|
|
87
|
+
/**
|
|
88
|
+
* 경도
|
|
89
|
+
*/
|
|
90
|
+
longitude: number;
|
|
91
|
+
/**
|
|
92
|
+
* 높이
|
|
93
|
+
*/
|
|
94
|
+
altitude: number;
|
|
95
|
+
/**
|
|
96
|
+
* 위치 정확도
|
|
97
|
+
*/
|
|
98
|
+
accuracy: number;
|
|
99
|
+
/**
|
|
100
|
+
* 고도 정확도
|
|
101
|
+
*/
|
|
102
|
+
altitudeAccuracy: number;
|
|
103
|
+
/**
|
|
104
|
+
* 방향
|
|
105
|
+
*/
|
|
106
|
+
heading: number;
|
|
61
107
|
}
|
|
62
108
|
/**
|
|
63
109
|
* 사진 조회 결과를 나타내는 타입이에요.
|
|
@@ -109,7 +155,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
109
155
|
* @param {number} [options.accuracy] 위치 정확도를 설정해요.
|
|
110
156
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
111
157
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
112
|
-
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요.
|
|
158
|
+
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
113
159
|
*
|
|
114
160
|
* @example
|
|
115
161
|
* ### 위치 정보 변경 감지하기
|
|
@@ -126,7 +172,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
126
172
|
* useEffect(() => {
|
|
127
173
|
* return startUpdateLocation({
|
|
128
174
|
* options: {
|
|
129
|
-
* accuracy: Accuracy.
|
|
175
|
+
* accuracy: Accuracy.Balanced,
|
|
130
176
|
* timeInterval: 3000,
|
|
131
177
|
* distanceInterval: 10,
|
|
132
178
|
* },
|
|
@@ -410,7 +456,7 @@ interface GetCurrentLocationOptions {
|
|
|
410
456
|
*
|
|
411
457
|
* @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
|
|
412
458
|
* @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
|
|
413
|
-
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요.
|
|
459
|
+
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
414
460
|
*
|
|
415
461
|
* @example
|
|
416
462
|
* ### 디바이스의 현재 위치 정보 가져오기
|
|
@@ -543,10 +589,13 @@ declare function appLogin(): Promise<{
|
|
|
543
589
|
authorizationCode: string;
|
|
544
590
|
}>;
|
|
545
591
|
|
|
546
|
-
interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
547
|
-
|
|
592
|
+
interface WebViewProps extends Omit<WebViewProps$1, 'cacheEnabled' | 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
593
|
+
local: {
|
|
594
|
+
port: number;
|
|
595
|
+
host: number;
|
|
596
|
+
};
|
|
548
597
|
}
|
|
549
|
-
declare function WebView({
|
|
598
|
+
declare function WebView({ local, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
|
|
550
599
|
|
|
551
600
|
type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
552
601
|
/**
|
|
@@ -564,6 +613,7 @@ type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
|
564
613
|
* @param {Accuracy} [options.accuracy] 위치 정확도를 설정해요. `Accuracy.Lowest`: 오차범위 3KM 이내, `Accuracy.Low`: 오차범위 1KM 이내, `Accuracy.Balanced`: 오차범위 몇 백미터 이내, `Accuracy.High`: 오차범위 10M 이내, `Accuracy.Highest`: 가장 높은 정확도, `Accuracy.BestForNavigation`: 네비게이션을 위한 최고 정확도
|
|
565
614
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
566
615
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
616
|
+
* @returns {Location | null} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
567
617
|
*
|
|
568
618
|
* @example
|
|
569
619
|
* ### 위치 정보 변경 감지하기
|
|
@@ -599,4 +649,4 @@ declare const env: {
|
|
|
599
649
|
getDeploymentId: () => string | undefined;
|
|
600
650
|
};
|
|
601
651
|
|
|
602
|
-
export { Accuracy, type ContactEntity, type FetchAlbumPhotosOptions, type GetCurrentLocationOptions, type ImageResponse, type Location, type OpenCameraOptions, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
|
652
|
+
export { Accuracy, AppsInToss, type ContactEntity, type FetchAlbumPhotosOptions, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
import { ComponentType, PropsWithChildren } from 'react';
|
|
2
|
+
import { InitialProps, BedrockProps } from 'react-native-bedrock';
|
|
1
3
|
import { EmitterSubscription } from 'react-native';
|
|
2
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
5
|
import { WebViewProps as WebViewProps$1 } from '@react-native-bedrock/native/react-native-webview';
|
|
4
6
|
|
|
7
|
+
type AppsInTossProps = Pick<BedrockProps, 'context'>;
|
|
8
|
+
declare function registerApp(container: ComponentType<PropsWithChildren<InitialProps>>, { context }: AppsInTossProps): (initialProps: InitialProps) => JSX.Element;
|
|
9
|
+
|
|
10
|
+
declare const AppsInToss: {
|
|
11
|
+
registerApp: typeof registerApp;
|
|
12
|
+
};
|
|
13
|
+
|
|
5
14
|
interface EventEmitterSchema<K extends string, P extends unknown[]> {
|
|
6
15
|
name: K;
|
|
7
16
|
params: P;
|
|
8
17
|
}
|
|
9
18
|
|
|
10
19
|
/**
|
|
11
|
-
*
|
|
20
|
+
* @public
|
|
21
|
+
* @category Types
|
|
22
|
+
* @name Accuracy
|
|
23
|
+
* @description 위치 정확도 옵션이에요.
|
|
12
24
|
*/
|
|
13
25
|
declare enum Accuracy {
|
|
14
26
|
/**
|
|
@@ -36,6 +48,12 @@ declare enum Accuracy {
|
|
|
36
48
|
*/
|
|
37
49
|
BestForNavigation = 6
|
|
38
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
* @category Types
|
|
54
|
+
* @name Location
|
|
55
|
+
* @description 위치 정보를 나타내는 객체예요.
|
|
56
|
+
*/
|
|
39
57
|
interface Location {
|
|
40
58
|
/**
|
|
41
59
|
* Android에서만 지원하는 옵션이에요.
|
|
@@ -50,14 +68,42 @@ interface Location {
|
|
|
50
68
|
* 위치가 업데이트된 시점의 유닉스 타임스탬프예요.
|
|
51
69
|
*/
|
|
52
70
|
timestamp: number;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
/**
|
|
72
|
+
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/reference/framework/Types/LocationCoords.html)을 참고해주세요.
|
|
73
|
+
*/
|
|
74
|
+
coords: LocationCoords;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @public
|
|
78
|
+
* @category Types
|
|
79
|
+
* @name LocationCoords
|
|
80
|
+
* @description 세부 위치 정보를 나타내는 객체예요.
|
|
81
|
+
*/
|
|
82
|
+
interface LocationCoords {
|
|
83
|
+
/**
|
|
84
|
+
* 위도
|
|
85
|
+
*/
|
|
86
|
+
latitude: number;
|
|
87
|
+
/**
|
|
88
|
+
* 경도
|
|
89
|
+
*/
|
|
90
|
+
longitude: number;
|
|
91
|
+
/**
|
|
92
|
+
* 높이
|
|
93
|
+
*/
|
|
94
|
+
altitude: number;
|
|
95
|
+
/**
|
|
96
|
+
* 위치 정확도
|
|
97
|
+
*/
|
|
98
|
+
accuracy: number;
|
|
99
|
+
/**
|
|
100
|
+
* 고도 정확도
|
|
101
|
+
*/
|
|
102
|
+
altitudeAccuracy: number;
|
|
103
|
+
/**
|
|
104
|
+
* 방향
|
|
105
|
+
*/
|
|
106
|
+
heading: number;
|
|
61
107
|
}
|
|
62
108
|
/**
|
|
63
109
|
* 사진 조회 결과를 나타내는 타입이에요.
|
|
@@ -109,7 +155,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
109
155
|
* @param {number} [options.accuracy] 위치 정확도를 설정해요.
|
|
110
156
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
111
157
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
112
|
-
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요.
|
|
158
|
+
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
113
159
|
*
|
|
114
160
|
* @example
|
|
115
161
|
* ### 위치 정보 변경 감지하기
|
|
@@ -126,7 +172,7 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
126
172
|
* useEffect(() => {
|
|
127
173
|
* return startUpdateLocation({
|
|
128
174
|
* options: {
|
|
129
|
-
* accuracy: Accuracy.
|
|
175
|
+
* accuracy: Accuracy.Balanced,
|
|
130
176
|
* timeInterval: 3000,
|
|
131
177
|
* distanceInterval: 10,
|
|
132
178
|
* },
|
|
@@ -410,7 +456,7 @@ interface GetCurrentLocationOptions {
|
|
|
410
456
|
*
|
|
411
457
|
* @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
|
|
412
458
|
* @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
|
|
413
|
-
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요.
|
|
459
|
+
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
414
460
|
*
|
|
415
461
|
* @example
|
|
416
462
|
* ### 디바이스의 현재 위치 정보 가져오기
|
|
@@ -543,10 +589,13 @@ declare function appLogin(): Promise<{
|
|
|
543
589
|
authorizationCode: string;
|
|
544
590
|
}>;
|
|
545
591
|
|
|
546
|
-
interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
547
|
-
|
|
592
|
+
interface WebViewProps extends Omit<WebViewProps$1, 'cacheEnabled' | 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
593
|
+
local: {
|
|
594
|
+
port: number;
|
|
595
|
+
host: number;
|
|
596
|
+
};
|
|
548
597
|
}
|
|
549
|
-
declare function WebView({
|
|
598
|
+
declare function WebView({ local, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
|
|
550
599
|
|
|
551
600
|
type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
552
601
|
/**
|
|
@@ -564,6 +613,7 @@ type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
|
564
613
|
* @param {Accuracy} [options.accuracy] 위치 정확도를 설정해요. `Accuracy.Lowest`: 오차범위 3KM 이내, `Accuracy.Low`: 오차범위 1KM 이내, `Accuracy.Balanced`: 오차범위 몇 백미터 이내, `Accuracy.High`: 오차범위 10M 이내, `Accuracy.Highest`: 가장 높은 정확도, `Accuracy.BestForNavigation`: 네비게이션을 위한 최고 정확도
|
|
565
614
|
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
566
615
|
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
616
|
+
* @returns {Location | null} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/reference/framework/Types/Location.html)을 참고해주세요.
|
|
567
617
|
*
|
|
568
618
|
* @example
|
|
569
619
|
* ### 위치 정보 변경 감지하기
|
|
@@ -599,4 +649,4 @@ declare const env: {
|
|
|
599
649
|
getDeploymentId: () => string | undefined;
|
|
600
650
|
};
|
|
601
651
|
|
|
602
|
-
export { Accuracy, type ContactEntity, type FetchAlbumPhotosOptions, type GetCurrentLocationOptions, type ImageResponse, type Location, type OpenCameraOptions, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
|
652
|
+
export { Accuracy, AppsInToss, type ContactEntity, type FetchAlbumPhotosOptions, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,32 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// src/core/registerApp.tsx
|
|
8
|
+
import { Bedrock } from "react-native-bedrock";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Container, { ...initialProps, children });
|
|
12
|
+
}
|
|
13
|
+
function registerApp(container, { context }) {
|
|
14
|
+
return Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
|
|
15
|
+
appName: getAppName(),
|
|
16
|
+
context
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function getAppName() {
|
|
20
|
+
try {
|
|
21
|
+
return global.__bedrock.app.name;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error("unexpected error occurred while getting app name");
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/core/index.ts
|
|
29
|
+
var AppsInToss = {
|
|
30
|
+
registerApp
|
|
31
|
+
};
|
|
32
|
+
|
|
7
33
|
// src/native-event-emitter/index.ts
|
|
8
34
|
var native_event_emitter_exports = {};
|
|
9
35
|
__export(native_event_emitter_exports, {
|
|
@@ -148,6 +174,14 @@ async function fetchAlbumPhotos(options) {
|
|
|
148
174
|
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
149
175
|
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
150
176
|
});
|
|
177
|
+
if (options.base64) {
|
|
178
|
+
return albumPhotos.map((photo) => {
|
|
179
|
+
return {
|
|
180
|
+
...photo,
|
|
181
|
+
dataUri: `data:image/jpeg;base64,${photo.dataUri}`
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
}
|
|
151
185
|
return albumPhotos;
|
|
152
186
|
}
|
|
153
187
|
|
|
@@ -181,17 +215,24 @@ import {
|
|
|
181
215
|
WebView as OriginalWebView
|
|
182
216
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
183
217
|
import { useMemo } from "react";
|
|
184
|
-
import { useBridgeHandler } from "react-native-bedrock";
|
|
218
|
+
import { Bedrock as Bedrock2, useBridgeHandler } from "react-native-bedrock";
|
|
185
219
|
import * as bridges from "react-native-bedrock/bridges";
|
|
186
220
|
import * as constantBridges from "react-native-bedrock/constants";
|
|
187
|
-
|
|
188
|
-
|
|
221
|
+
|
|
222
|
+
// src/env.ts
|
|
223
|
+
var env = {
|
|
224
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// src/components/WebView.tsx
|
|
228
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
229
|
+
function WebView({ local, onMessage, ...props }) {
|
|
189
230
|
const uri = useMemo(() => {
|
|
190
231
|
if (__DEV__) {
|
|
191
|
-
return `http
|
|
232
|
+
return `http://${local.host}:${local.port}`;
|
|
192
233
|
}
|
|
193
|
-
return
|
|
194
|
-
}, [
|
|
234
|
+
return `https://${Bedrock2.appName}.alpha-apps.tossmini.com`;
|
|
235
|
+
}, [local]);
|
|
195
236
|
const handler = useBridgeHandler({
|
|
196
237
|
onMessage,
|
|
197
238
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -206,14 +247,20 @@ function WebView({ localhostPort = 5173, onMessage, ...props }) {
|
|
|
206
247
|
...native_modules_exports
|
|
207
248
|
}
|
|
208
249
|
});
|
|
209
|
-
return /* @__PURE__ */
|
|
250
|
+
return /* @__PURE__ */ jsx2(
|
|
210
251
|
OriginalWebView,
|
|
211
252
|
{
|
|
212
253
|
ref: handler.ref,
|
|
213
254
|
...props,
|
|
214
|
-
source: {
|
|
255
|
+
source: {
|
|
256
|
+
uri,
|
|
257
|
+
headers: {
|
|
258
|
+
"x-mini-deployment-id": env.getDeploymentId()
|
|
259
|
+
}
|
|
260
|
+
},
|
|
215
261
|
sharedCookiesEnabled: true,
|
|
216
262
|
thirdPartyCookiesEnabled: true,
|
|
263
|
+
cacheEnabled: false,
|
|
217
264
|
onMessage: handler.onMessage,
|
|
218
265
|
injectedJavaScript: handler.injectedJavaScript,
|
|
219
266
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
@@ -244,11 +291,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
244
291
|
return location;
|
|
245
292
|
}
|
|
246
293
|
|
|
247
|
-
// src/env.ts
|
|
248
|
-
var env = {
|
|
249
|
-
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
250
|
-
};
|
|
251
|
-
|
|
252
294
|
// src/types.ts
|
|
253
295
|
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
254
296
|
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
@@ -261,6 +303,7 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
261
303
|
})(Accuracy2 || {});
|
|
262
304
|
export {
|
|
263
305
|
Accuracy2 as Accuracy,
|
|
306
|
+
AppsInToss,
|
|
264
307
|
WebView,
|
|
265
308
|
appLogin,
|
|
266
309
|
env,
|
|
@@ -0,0 +1,24 @@
|
|
|
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/jest/index.ts
|
|
18
|
+
var jest_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(jest_exports);
|
|
20
|
+
__reExport(jest_exports, require("react-native-bedrock/jest"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("react-native-bedrock/jest")
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-native-bedrock/jest';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'react-native-bedrock/jest';
|