@apps-in-toss/framework 0.0.5 → 0.0.7
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/bin.js +4 -0
- package/dist/config/index.cjs +33172 -0
- package/dist/config/index.d.cts +37 -0
- package/dist/config/index.d.ts +37 -0
- package/dist/config/index.js +33177 -0
- package/dist/index.cjs +135 -94
- package/dist/index.d.cts +27 -20
- package/dist/index.d.ts +27 -20
- package/dist/index.js +129 -93
- 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 +33154 -0
- package/dist/plugins/index.d.cts +36 -0
- package/dist/plugins/index.d.ts +36 -0
- package/dist/plugins/index.js +33159 -0
- package/package.json +27 -12
- package/plugins.d.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,13 +17,22 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var src_exports = {};
|
|
22
32
|
__export(src_exports, {
|
|
23
|
-
Accuracy: () =>
|
|
33
|
+
Accuracy: () => Accuracy2,
|
|
24
34
|
WebView: () => WebView,
|
|
35
|
+
env: () => env,
|
|
25
36
|
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
26
37
|
fetchContacts: () => fetchContacts,
|
|
27
38
|
getClipboardText: () => getClipboardText,
|
|
@@ -33,17 +44,23 @@ __export(src_exports, {
|
|
|
33
44
|
});
|
|
34
45
|
module.exports = __toCommonJS(src_exports);
|
|
35
46
|
|
|
36
|
-
// src/native-event-emitter/
|
|
37
|
-
var
|
|
47
|
+
// src/native-event-emitter/index.ts
|
|
48
|
+
var native_event_emitter_exports = {};
|
|
49
|
+
__export(native_event_emitter_exports, {
|
|
50
|
+
startUpdateLocation: () => startUpdateLocation
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// src/native-event-emitter/bedrock-event.ts
|
|
54
|
+
var import_react_native_bedrock2 = require("react-native-bedrock");
|
|
55
|
+
|
|
56
|
+
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
57
|
+
var import_react_native_bedrock = require("react-native-bedrock");
|
|
38
58
|
|
|
39
59
|
// src/native-modules/AppsInTossModule.ts
|
|
40
60
|
var import_react_native = require("react-native");
|
|
41
61
|
var AppsInTossModuleInstance = import_react_native.NativeModules.AppsInTossModule;
|
|
42
62
|
var AppsInTossModule = AppsInTossModuleInstance;
|
|
43
63
|
|
|
44
|
-
// src/native-event-emitter/nativeEventEmitter.ts
|
|
45
|
-
var nativeEventEmitter = new import_react_native2.NativeEventEmitter(AppsInTossModuleInstance);
|
|
46
|
-
|
|
47
64
|
// src/native-modules/getPermission.ts
|
|
48
65
|
function getPermission(permission) {
|
|
49
66
|
return AppsInTossModule.getPermission(permission);
|
|
@@ -66,32 +83,56 @@ async function requestPermission(permission) {
|
|
|
66
83
|
}
|
|
67
84
|
}
|
|
68
85
|
|
|
69
|
-
// src/native-event-emitter/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
86
|
+
// src/native-event-emitter/nativeEventEmitter.ts
|
|
87
|
+
var import_react_native2 = require("react-native");
|
|
88
|
+
var nativeEventEmitter = new import_react_native2.NativeEventEmitter(AppsInTossModuleInstance);
|
|
89
|
+
|
|
90
|
+
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
91
|
+
var UpdateLocationEvent = class extends import_react_native_bedrock.BedrockEventDefinition {
|
|
92
|
+
name = "updateLocationEvent";
|
|
93
|
+
subscriptionCount = 0;
|
|
94
|
+
ref = {
|
|
95
|
+
remove: () => {
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
remove() {
|
|
99
|
+
--this.subscriptionCount === 0 && AppsInTossModuleInstance.stopUpdateLocation({});
|
|
100
|
+
this.ref.remove();
|
|
75
101
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const result = Reflect.get(target, key, receiver);
|
|
82
|
-
if (key === "remove") {
|
|
83
|
-
return async () => {
|
|
84
|
-
await (--subscriptionCount === 0 && AppsInTossModuleInstance.stopUpdateLocation({}));
|
|
85
|
-
const remove = result;
|
|
86
|
-
remove();
|
|
87
|
-
};
|
|
102
|
+
listener(options, onEvent, onError) {
|
|
103
|
+
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
104
|
+
if (permissionStatus === "denied") {
|
|
105
|
+
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
106
|
+
return;
|
|
88
107
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
108
|
+
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
109
|
+
const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
|
|
110
|
+
this.ref = {
|
|
111
|
+
remove: () => subscription?.remove()
|
|
112
|
+
};
|
|
113
|
+
this.subscriptionCount++;
|
|
114
|
+
}).catch(onError);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// src/native-event-emitter/bedrock-event.ts
|
|
119
|
+
var appsInTossEvent = new import_react_native_bedrock2.BedrockEvent([new UpdateLocationEvent()]);
|
|
120
|
+
|
|
121
|
+
// src/native-event-emitter/startUpdateLocation.ts
|
|
122
|
+
function startUpdateLocation(eventParams) {
|
|
123
|
+
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
93
124
|
}
|
|
94
|
-
|
|
125
|
+
|
|
126
|
+
// src/native-modules/index.ts
|
|
127
|
+
var native_modules_exports = {};
|
|
128
|
+
__export(native_modules_exports, {
|
|
129
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
130
|
+
fetchContacts: () => fetchContacts,
|
|
131
|
+
getClipboardText: () => getClipboardText,
|
|
132
|
+
getCurrentLocation: () => getCurrentLocation,
|
|
133
|
+
openCamera: () => openCamera,
|
|
134
|
+
setClipboardText: () => setClipboardText
|
|
135
|
+
});
|
|
95
136
|
|
|
96
137
|
// src/native-modules/setClipboardText.ts
|
|
97
138
|
async function setClipboardText(text) {
|
|
@@ -172,89 +213,89 @@ async function openCamera(options) {
|
|
|
172
213
|
// src/components/WebView.tsx
|
|
173
214
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
174
215
|
var import_react = require("react");
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
function getAppsInTossWebViewUrl({
|
|
179
|
-
appName,
|
|
180
|
-
groupId,
|
|
181
|
-
localhostPort,
|
|
182
|
-
env
|
|
183
|
-
}) {
|
|
184
|
-
if (env === "local") {
|
|
185
|
-
return `http://localhost:${localhostPort}`;
|
|
186
|
-
}
|
|
187
|
-
const subdomain = env === "alpha" ? "alpha-apps" : "apps";
|
|
188
|
-
return `https://${appName}--${groupId}.${subdomain}.tossmini.com`;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// src/components/WebView.tsx
|
|
216
|
+
var import_react_native_bedrock3 = require("react-native-bedrock");
|
|
217
|
+
var bridges = __toESM(require("react-native-bedrock/bridges"), 1);
|
|
218
|
+
var constantBridges = __toESM(require("react-native-bedrock/constants"), 1);
|
|
192
219
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
193
|
-
function WebView({
|
|
220
|
+
function WebView({ localhostPort = 5173, onMessage, ...props }) {
|
|
194
221
|
const uri = (0, import_react.useMemo)(() => {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
222
|
+
if (__DEV__) {
|
|
223
|
+
return `http://localhost:${localhostPort}`;
|
|
224
|
+
}
|
|
225
|
+
return AppsInTossModule.getWebBundleURL({}).url;
|
|
226
|
+
}, [localhostPort]);
|
|
227
|
+
const handler = (0, import_react_native_bedrock3.useBridgeHandler)({
|
|
228
|
+
onMessage,
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
230
|
+
eventListenerMap: native_event_emitter_exports,
|
|
231
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
232
|
+
// @ts-expect-error
|
|
233
|
+
constantHandlerMap: constantBridges,
|
|
234
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
235
|
+
// @ts-expect-error
|
|
236
|
+
handlerMap: {
|
|
237
|
+
...bridges,
|
|
238
|
+
...native_modules_exports
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
|
+
import_react_native_webview.WebView,
|
|
243
|
+
{
|
|
244
|
+
ref: handler.ref,
|
|
245
|
+
...props,
|
|
246
|
+
source: { uri },
|
|
247
|
+
sharedCookiesEnabled: true,
|
|
248
|
+
thirdPartyCookiesEnabled: true,
|
|
249
|
+
onMessage: handler.onMessage,
|
|
250
|
+
injectedJavaScript: handler.injectedJavaScript,
|
|
251
|
+
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
252
|
+
}
|
|
253
|
+
);
|
|
204
254
|
}
|
|
205
255
|
|
|
206
256
|
// src/hooks/useGeolocation.ts
|
|
207
257
|
var import_react2 = require("react");
|
|
208
|
-
var
|
|
258
|
+
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
209
259
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
210
|
-
const isVisible = (0,
|
|
211
|
-
const subscriptionRef = (0, import_react2.useRef)();
|
|
260
|
+
const isVisible = (0, import_react_native_bedrock4.useVisibility)();
|
|
212
261
|
const [location, setLocation] = (0, import_react2.useState)(null);
|
|
213
|
-
const subscribe = (0, import_react2.useCallback)(async () => {
|
|
214
|
-
try {
|
|
215
|
-
const subscription = await startUpdateLocation({
|
|
216
|
-
accuracy,
|
|
217
|
-
distanceInterval,
|
|
218
|
-
timeInterval,
|
|
219
|
-
callback: setLocation
|
|
220
|
-
});
|
|
221
|
-
subscriptionRef.current = subscription;
|
|
222
|
-
} catch (error) {
|
|
223
|
-
console.error("failed to subscribe location", error);
|
|
224
|
-
}
|
|
225
|
-
}, [accuracy, distanceInterval, timeInterval]);
|
|
226
|
-
const cleanup = (0, import_react2.useCallback)(async () => {
|
|
227
|
-
try {
|
|
228
|
-
const prevSubscription = subscriptionRef.current;
|
|
229
|
-
subscriptionRef.current = void 0;
|
|
230
|
-
await prevSubscription?.remove();
|
|
231
|
-
} catch (error) {
|
|
232
|
-
console.error("failed to cleanup location subscription", error);
|
|
233
|
-
}
|
|
234
|
-
}, []);
|
|
235
262
|
(0, import_react2.useEffect)(() => {
|
|
236
|
-
if (
|
|
237
|
-
|
|
263
|
+
if (!isVisible) {
|
|
264
|
+
return;
|
|
238
265
|
}
|
|
239
|
-
return (
|
|
240
|
-
|
|
266
|
+
return startUpdateLocation({
|
|
267
|
+
options: {
|
|
268
|
+
accuracy,
|
|
269
|
+
distanceInterval,
|
|
270
|
+
timeInterval
|
|
271
|
+
},
|
|
272
|
+
onEvent: setLocation,
|
|
273
|
+
onError: console.error
|
|
274
|
+
});
|
|
275
|
+
}, [accuracy, distanceInterval, timeInterval, isVisible]);
|
|
241
276
|
return location;
|
|
242
277
|
}
|
|
243
278
|
|
|
279
|
+
// src/env.ts
|
|
280
|
+
var env = {
|
|
281
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
282
|
+
};
|
|
283
|
+
|
|
244
284
|
// src/types.ts
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return
|
|
253
|
-
})(
|
|
285
|
+
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
286
|
+
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
287
|
+
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
288
|
+
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
289
|
+
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
290
|
+
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
291
|
+
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
292
|
+
return Accuracy3;
|
|
293
|
+
})(Accuracy2 || {});
|
|
254
294
|
// Annotate the CommonJS export names for ESM import in node:
|
|
255
295
|
0 && (module.exports = {
|
|
256
296
|
Accuracy,
|
|
257
297
|
WebView,
|
|
298
|
+
env,
|
|
258
299
|
fetchAlbumPhotos,
|
|
259
300
|
fetchContacts,
|
|
260
301
|
getClipboardText,
|
package/dist/index.d.cts
CHANGED
|
@@ -82,10 +82,6 @@ interface StartUpdateLocationOptions {
|
|
|
82
82
|
* 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
83
83
|
*/
|
|
84
84
|
distanceInterval: number;
|
|
85
|
-
/**
|
|
86
|
-
* 위치 정보가 변경될 때 호출되는 콜백 함수예요.
|
|
87
|
-
*/
|
|
88
|
-
callback: (location: Location) => void;
|
|
89
85
|
}
|
|
90
86
|
interface StartUpdateLocationSubscription extends EmitterSubscription {
|
|
91
87
|
remove: () => Promise<void>;
|
|
@@ -128,16 +124,19 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
128
124
|
* const [location, setLocation] = useState(null);
|
|
129
125
|
*
|
|
130
126
|
* useEffect(() => {
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
127
|
+
* return startUpdateLocation({
|
|
128
|
+
* options: {
|
|
129
|
+
* accuracy: Accuracy.Default,
|
|
130
|
+
* timeInterval: 3000,
|
|
131
|
+
* distanceInterval: 10,
|
|
132
|
+
* },
|
|
133
|
+
* onEvent: (location) => {
|
|
136
134
|
* setLocation(location);
|
|
137
135
|
* },
|
|
136
|
+
* onError: (error) => {
|
|
137
|
+
* console.error('위치 정보를 가져오는데 실패했어요:', error);
|
|
138
|
+
* },
|
|
138
139
|
* });
|
|
139
|
-
*
|
|
140
|
-
* return () => subscription.remove();
|
|
141
140
|
* }, []);
|
|
142
141
|
*
|
|
143
142
|
* if (location == null) {
|
|
@@ -157,7 +156,11 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
157
156
|
* }
|
|
158
157
|
* ```
|
|
159
158
|
*/
|
|
160
|
-
declare function startUpdateLocation(
|
|
159
|
+
declare function startUpdateLocation(eventParams: {
|
|
160
|
+
onEvent: (response: Location) => void;
|
|
161
|
+
onError: (error: unknown) => void;
|
|
162
|
+
options: StartUpdateLocationOptions;
|
|
163
|
+
}): () => void;
|
|
161
164
|
|
|
162
165
|
/**
|
|
163
166
|
* @public
|
|
@@ -357,7 +360,7 @@ interface FetchAlbumPhotosOptions {
|
|
|
357
360
|
*
|
|
358
361
|
* ```tsx
|
|
359
362
|
* import React, { useState } from 'react';
|
|
360
|
-
* import { View,
|
|
363
|
+
* import { View, Image, Button } from 'react-native';
|
|
361
364
|
* import { fetchAlbumPhotos } from '@apps-in-toss/framework';
|
|
362
365
|
*
|
|
363
366
|
* // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
|
|
@@ -367,6 +370,7 @@ interface FetchAlbumPhotosOptions {
|
|
|
367
370
|
* const handlePress = async () => {
|
|
368
371
|
* try {
|
|
369
372
|
* const response = await fetchAlbumPhotos({
|
|
373
|
+
* base64: true,
|
|
370
374
|
* maxWidth: 360,
|
|
371
375
|
* });
|
|
372
376
|
* setAlbumPhotos((prev) => ([...prev, ...response]));
|
|
@@ -377,8 +381,8 @@ interface FetchAlbumPhotosOptions {
|
|
|
377
381
|
*
|
|
378
382
|
* return (
|
|
379
383
|
* <View>
|
|
380
|
-
* {albumPhotos.map((
|
|
381
|
-
* <
|
|
384
|
+
* {albumPhotos.map((image) => (
|
|
385
|
+
* <Image source={{ uri: image.dataUri }} key={image.id} />
|
|
382
386
|
* ))}
|
|
383
387
|
* <Button title="앨범 가져오기" onPress={handlePress} />
|
|
384
388
|
* </View>
|
|
@@ -467,7 +471,7 @@ interface OpenCameraOptions {
|
|
|
467
471
|
* @description 카메라를 실행해서 촬영된 이미지를 반환하는 함수예요.
|
|
468
472
|
* @param {OpenCameraOptions} options - 카메라 실행 시 사용되는 옵션 객체예요.
|
|
469
473
|
* @param {boolean} [options.base64=false] - 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요. 기본값은 `false`예요. `true`로 설정하면 `dataUri` 대신 Base64 인코딩된 문자열을 반환해요.
|
|
470
|
-
* @param {
|
|
474
|
+
* @param {number} [options.maxWidth=1024] - 이미지의 최대 너비를 나타내는 숫자 값이에요. 기본값은 `1024`예요.
|
|
471
475
|
* @returns {Promise<ImageResponse>}
|
|
472
476
|
* 촬영된 이미지 정보를 포함한 객체를 반환해요. 반환 객체의 구성은 다음과 같아요:
|
|
473
477
|
* - `id`: 이미지의 고유 식별자예요.
|
|
@@ -509,11 +513,10 @@ interface OpenCameraOptions {
|
|
|
509
513
|
*/
|
|
510
514
|
declare function openCamera(options?: OpenCameraOptions): Promise<ImageResponse>;
|
|
511
515
|
|
|
512
|
-
interface WebViewProps extends Omit<WebViewProps$1, 'source'> {
|
|
513
|
-
env?: 'production' | 'alpha' | 'local';
|
|
516
|
+
interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
514
517
|
localhostPort?: number;
|
|
515
518
|
}
|
|
516
|
-
declare function WebView({
|
|
519
|
+
declare function WebView({ localhostPort, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
|
|
517
520
|
|
|
518
521
|
type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
519
522
|
/**
|
|
@@ -562,4 +565,8 @@ type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
|
562
565
|
*/
|
|
563
566
|
declare function useGeolocation({ accuracy, distanceInterval, timeInterval }: UseGeolocationOptions): Location | null;
|
|
564
567
|
|
|
565
|
-
|
|
568
|
+
declare const env: {
|
|
569
|
+
getDeploymentId: () => string | undefined;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
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, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|
package/dist/index.d.ts
CHANGED
|
@@ -82,10 +82,6 @@ interface StartUpdateLocationOptions {
|
|
|
82
82
|
* 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
83
83
|
*/
|
|
84
84
|
distanceInterval: number;
|
|
85
|
-
/**
|
|
86
|
-
* 위치 정보가 변경될 때 호출되는 콜백 함수예요.
|
|
87
|
-
*/
|
|
88
|
-
callback: (location: Location) => void;
|
|
89
85
|
}
|
|
90
86
|
interface StartUpdateLocationSubscription extends EmitterSubscription {
|
|
91
87
|
remove: () => Promise<void>;
|
|
@@ -128,16 +124,19 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
128
124
|
* const [location, setLocation] = useState(null);
|
|
129
125
|
*
|
|
130
126
|
* useEffect(() => {
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
127
|
+
* return startUpdateLocation({
|
|
128
|
+
* options: {
|
|
129
|
+
* accuracy: Accuracy.Default,
|
|
130
|
+
* timeInterval: 3000,
|
|
131
|
+
* distanceInterval: 10,
|
|
132
|
+
* },
|
|
133
|
+
* onEvent: (location) => {
|
|
136
134
|
* setLocation(location);
|
|
137
135
|
* },
|
|
136
|
+
* onError: (error) => {
|
|
137
|
+
* console.error('위치 정보를 가져오는데 실패했어요:', error);
|
|
138
|
+
* },
|
|
138
139
|
* });
|
|
139
|
-
*
|
|
140
|
-
* return () => subscription.remove();
|
|
141
140
|
* }, []);
|
|
142
141
|
*
|
|
143
142
|
* if (location == null) {
|
|
@@ -157,7 +156,11 @@ interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation'
|
|
|
157
156
|
* }
|
|
158
157
|
* ```
|
|
159
158
|
*/
|
|
160
|
-
declare function startUpdateLocation(
|
|
159
|
+
declare function startUpdateLocation(eventParams: {
|
|
160
|
+
onEvent: (response: Location) => void;
|
|
161
|
+
onError: (error: unknown) => void;
|
|
162
|
+
options: StartUpdateLocationOptions;
|
|
163
|
+
}): () => void;
|
|
161
164
|
|
|
162
165
|
/**
|
|
163
166
|
* @public
|
|
@@ -357,7 +360,7 @@ interface FetchAlbumPhotosOptions {
|
|
|
357
360
|
*
|
|
358
361
|
* ```tsx
|
|
359
362
|
* import React, { useState } from 'react';
|
|
360
|
-
* import { View,
|
|
363
|
+
* import { View, Image, Button } from 'react-native';
|
|
361
364
|
* import { fetchAlbumPhotos } from '@apps-in-toss/framework';
|
|
362
365
|
*
|
|
363
366
|
* // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
|
|
@@ -367,6 +370,7 @@ interface FetchAlbumPhotosOptions {
|
|
|
367
370
|
* const handlePress = async () => {
|
|
368
371
|
* try {
|
|
369
372
|
* const response = await fetchAlbumPhotos({
|
|
373
|
+
* base64: true,
|
|
370
374
|
* maxWidth: 360,
|
|
371
375
|
* });
|
|
372
376
|
* setAlbumPhotos((prev) => ([...prev, ...response]));
|
|
@@ -377,8 +381,8 @@ interface FetchAlbumPhotosOptions {
|
|
|
377
381
|
*
|
|
378
382
|
* return (
|
|
379
383
|
* <View>
|
|
380
|
-
* {albumPhotos.map((
|
|
381
|
-
* <
|
|
384
|
+
* {albumPhotos.map((image) => (
|
|
385
|
+
* <Image source={{ uri: image.dataUri }} key={image.id} />
|
|
382
386
|
* ))}
|
|
383
387
|
* <Button title="앨범 가져오기" onPress={handlePress} />
|
|
384
388
|
* </View>
|
|
@@ -467,7 +471,7 @@ interface OpenCameraOptions {
|
|
|
467
471
|
* @description 카메라를 실행해서 촬영된 이미지를 반환하는 함수예요.
|
|
468
472
|
* @param {OpenCameraOptions} options - 카메라 실행 시 사용되는 옵션 객체예요.
|
|
469
473
|
* @param {boolean} [options.base64=false] - 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요. 기본값은 `false`예요. `true`로 설정하면 `dataUri` 대신 Base64 인코딩된 문자열을 반환해요.
|
|
470
|
-
* @param {
|
|
474
|
+
* @param {number} [options.maxWidth=1024] - 이미지의 최대 너비를 나타내는 숫자 값이에요. 기본값은 `1024`예요.
|
|
471
475
|
* @returns {Promise<ImageResponse>}
|
|
472
476
|
* 촬영된 이미지 정보를 포함한 객체를 반환해요. 반환 객체의 구성은 다음과 같아요:
|
|
473
477
|
* - `id`: 이미지의 고유 식별자예요.
|
|
@@ -509,11 +513,10 @@ interface OpenCameraOptions {
|
|
|
509
513
|
*/
|
|
510
514
|
declare function openCamera(options?: OpenCameraOptions): Promise<ImageResponse>;
|
|
511
515
|
|
|
512
|
-
interface WebViewProps extends Omit<WebViewProps$1, 'source'> {
|
|
513
|
-
env?: 'production' | 'alpha' | 'local';
|
|
516
|
+
interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
514
517
|
localhostPort?: number;
|
|
515
518
|
}
|
|
516
|
-
declare function WebView({
|
|
519
|
+
declare function WebView({ localhostPort, onMessage, ...props }: WebViewProps): react_jsx_runtime.JSX.Element;
|
|
517
520
|
|
|
518
521
|
type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
519
522
|
/**
|
|
@@ -562,4 +565,8 @@ type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
|
562
565
|
*/
|
|
563
566
|
declare function useGeolocation({ accuracy, distanceInterval, timeInterval }: UseGeolocationOptions): Location | null;
|
|
564
567
|
|
|
565
|
-
|
|
568
|
+
declare const env: {
|
|
569
|
+
getDeploymentId: () => string | undefined;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
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, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
|