@apps-in-toss/framework 0.0.10 → 0.0.12
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 +52 -41
- package/dist/index.d.cts +39 -10
- package/dist/index.d.ts +39 -10
- package/dist/index.js +52 -41
- package/package.json +20 -10
- package/src/async-bridges.ts +7 -0
- package/src/constant-bridges.ts +1 -0
- package/src/event-bridges.ts +1 -0
- package/dist/cli-presets.cjs +0 -24
- package/dist/cli-presets.d.cts +0 -1
- package/dist/cli-presets.d.ts +0 -1
- package/dist/cli-presets.js +0 -2
- package/src/bridges.ts +0 -2
package/dist/index.cjs
CHANGED
|
@@ -73,12 +73,6 @@ var AppsInToss = {
|
|
|
73
73
|
registerApp
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
// src/native-event-emitter/index.ts
|
|
77
|
-
var native_event_emitter_exports = {};
|
|
78
|
-
__export(native_event_emitter_exports, {
|
|
79
|
-
startUpdateLocation: () => startUpdateLocation
|
|
80
|
-
});
|
|
81
|
-
|
|
82
76
|
// src/native-event-emitter/bedrock-event.ts
|
|
83
77
|
var import_react_native_bedrock3 = require("react-native-bedrock");
|
|
84
78
|
|
|
@@ -152,19 +146,6 @@ function startUpdateLocation(eventParams) {
|
|
|
152
146
|
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
153
147
|
}
|
|
154
148
|
|
|
155
|
-
// src/native-modules/index.ts
|
|
156
|
-
var native_modules_exports = {};
|
|
157
|
-
__export(native_modules_exports, {
|
|
158
|
-
appLogin: () => appLogin,
|
|
159
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
160
|
-
fetchContacts: () => fetchContacts,
|
|
161
|
-
getClipboardText: () => getClipboardText,
|
|
162
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
163
|
-
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
164
|
-
openCamera: () => openCamera,
|
|
165
|
-
setClipboardText: () => setClipboardText
|
|
166
|
-
});
|
|
167
|
-
|
|
168
149
|
// src/native-modules/setClipboardText.ts
|
|
169
150
|
async function setClipboardText(text) {
|
|
170
151
|
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
@@ -218,14 +199,6 @@ async function fetchAlbumPhotos(options) {
|
|
|
218
199
|
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
219
200
|
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
220
201
|
});
|
|
221
|
-
if (options.base64) {
|
|
222
|
-
return albumPhotos.map((photo) => {
|
|
223
|
-
return {
|
|
224
|
-
...photo,
|
|
225
|
-
dataUri: `data:image/jpeg;base64,${photo.dataUri}`
|
|
226
|
-
};
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
202
|
return albumPhotos;
|
|
230
203
|
}
|
|
231
204
|
|
|
@@ -263,28 +236,67 @@ function getOperationalEnvironment() {
|
|
|
263
236
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
264
237
|
var import_react = require("react");
|
|
265
238
|
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
266
|
-
var
|
|
267
|
-
var
|
|
239
|
+
var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
|
|
240
|
+
var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
|
|
241
|
+
|
|
242
|
+
// src/async-bridges.ts
|
|
243
|
+
var async_bridges_exports = {};
|
|
244
|
+
__export(async_bridges_exports, {
|
|
245
|
+
appLogin: () => appLogin,
|
|
246
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
247
|
+
fetchContacts: () => fetchContacts,
|
|
248
|
+
getClipboardText: () => getClipboardText,
|
|
249
|
+
getCurrentLocation: () => getCurrentLocation,
|
|
250
|
+
openCamera: () => openCamera,
|
|
251
|
+
setClipboardText: () => setClipboardText
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// src/constant-bridges.ts
|
|
255
|
+
var constant_bridges_exports = {};
|
|
256
|
+
__export(constant_bridges_exports, {
|
|
257
|
+
getOperationalEnvironment: () => getOperationalEnvironment
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// src/env.ts
|
|
261
|
+
var env = {
|
|
262
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// src/event-bridges.ts
|
|
266
|
+
var event_bridges_exports = {};
|
|
267
|
+
__export(event_bridges_exports, {
|
|
268
|
+
startUpdateLocation: () => startUpdateLocation
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// src/components/WebView.tsx
|
|
268
272
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
269
273
|
function WebView({ local, onMessage, ...props }) {
|
|
270
274
|
const uri = (0, import_react.useMemo)(() => {
|
|
271
275
|
if (__DEV__) {
|
|
272
276
|
return `http://${local.host}:${local.port}`;
|
|
273
277
|
}
|
|
274
|
-
|
|
278
|
+
const url = new URL(AppsInTossModule.getWebBundleURL({}).url);
|
|
279
|
+
const deploymentId = env.getDeploymentId();
|
|
280
|
+
if (deploymentId) {
|
|
281
|
+
url.searchParams.set("_deploymentId", deploymentId);
|
|
282
|
+
}
|
|
283
|
+
return url.toString();
|
|
275
284
|
}, [local]);
|
|
276
285
|
const handler = (0, import_react_native_bedrock4.useBridgeHandler)({
|
|
277
286
|
onMessage,
|
|
278
287
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
279
|
-
eventListenerMap:
|
|
288
|
+
eventListenerMap: event_bridges_exports,
|
|
280
289
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
281
290
|
// @ts-expect-error
|
|
282
|
-
constantHandlerMap:
|
|
291
|
+
constantHandlerMap: {
|
|
292
|
+
...bedrockConstantBridges,
|
|
293
|
+
...constant_bridges_exports
|
|
294
|
+
},
|
|
283
295
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
284
296
|
// @ts-expect-error
|
|
285
|
-
|
|
286
|
-
...
|
|
287
|
-
...
|
|
297
|
+
asyncHandlerMap: {
|
|
298
|
+
...bedrockAsyncBridges,
|
|
299
|
+
...async_bridges_exports
|
|
288
300
|
}
|
|
289
301
|
});
|
|
290
302
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -292,9 +304,13 @@ function WebView({ local, onMessage, ...props }) {
|
|
|
292
304
|
{
|
|
293
305
|
ref: handler.ref,
|
|
294
306
|
...props,
|
|
295
|
-
source: {
|
|
307
|
+
source: {
|
|
308
|
+
uri
|
|
309
|
+
},
|
|
296
310
|
sharedCookiesEnabled: true,
|
|
297
311
|
thirdPartyCookiesEnabled: true,
|
|
312
|
+
cacheEnabled: false,
|
|
313
|
+
cacheMode: "LOAD_NO_CACHE",
|
|
298
314
|
onMessage: handler.onMessage,
|
|
299
315
|
injectedJavaScript: handler.injectedJavaScript,
|
|
300
316
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
@@ -325,11 +341,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
325
341
|
return location;
|
|
326
342
|
}
|
|
327
343
|
|
|
328
|
-
// src/env.ts
|
|
329
|
-
var env = {
|
|
330
|
-
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
331
|
-
};
|
|
332
|
-
|
|
333
344
|
// src/types.ts
|
|
334
345
|
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
335
346
|
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
package/dist/index.d.cts
CHANGED
|
@@ -300,17 +300,36 @@ interface ContactEntity {
|
|
|
300
300
|
* - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
|
|
301
301
|
* - `done`: 모든 연락처를 다 가져왔는지 여부를 나타내요. 모두 가져왔다면 `true`예요.
|
|
302
302
|
*
|
|
303
|
+
* @signature
|
|
304
|
+
* ```typescript
|
|
305
|
+
* function fetchContacts({ size, offset, query }: {
|
|
306
|
+
* size: number;
|
|
307
|
+
* offset: number;
|
|
308
|
+
* query?: {
|
|
309
|
+
* contains?: string;
|
|
310
|
+
* };
|
|
311
|
+
* }): Promise<{
|
|
312
|
+
* result: ContactEntity[];
|
|
313
|
+
* nextOffset: number | null;
|
|
314
|
+
* done: boolean;
|
|
315
|
+
* }>;
|
|
316
|
+
* ```
|
|
317
|
+
*
|
|
303
318
|
* @example
|
|
304
319
|
* ### 특정 문자열이 포함된 연락처 목록 가져오기
|
|
305
320
|
*
|
|
306
321
|
* ```tsx
|
|
307
322
|
* import React, { useState } from 'react';
|
|
308
323
|
* import { View, Text, Button } from 'react-native';
|
|
309
|
-
* import { fetchContacts } from '@apps-in-toss/framework';
|
|
324
|
+
* import { fetchContacts, ContactEntity } from '@apps-in-toss/framework';
|
|
310
325
|
*
|
|
311
326
|
* // 특정 문자열을 포함한 연락처 목록을 가져와 화면에 표시하는 컴포넌트
|
|
312
327
|
* function ContactsList() {
|
|
313
|
-
* const [contacts, setContacts] = useState
|
|
328
|
+
* const [contacts, setContacts] = useState<{
|
|
329
|
+
* result: ContactEntity[];
|
|
330
|
+
* nextOffset: number | null;
|
|
331
|
+
* done: boolean;
|
|
332
|
+
* }>({
|
|
314
333
|
* result: [],
|
|
315
334
|
* nextOffset: null,
|
|
316
335
|
* done: false,
|
|
@@ -326,7 +345,7 @@ interface ContactEntity {
|
|
|
326
345
|
* const response = await fetchContacts({
|
|
327
346
|
* size: 10,
|
|
328
347
|
* offset: contacts.nextOffset ?? 0,
|
|
329
|
-
* query: { contains: '
|
|
348
|
+
* query: { contains: '김' },
|
|
330
349
|
* });
|
|
331
350
|
* setContacts((prev) => ({
|
|
332
351
|
* result: [...prev.result, ...response.result],
|
|
@@ -399,6 +418,8 @@ interface FetchAlbumPhotosOptions {
|
|
|
399
418
|
* import { View, Image, Button } from 'react-native';
|
|
400
419
|
* import { fetchAlbumPhotos } from '@apps-in-toss/framework';
|
|
401
420
|
*
|
|
421
|
+
* const base64 = true;
|
|
422
|
+
*
|
|
402
423
|
* // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
|
|
403
424
|
* function AlbumPhotoList() {
|
|
404
425
|
* const [albumPhotos, setAlbumPhotos] = useState([]);
|
|
@@ -406,7 +427,7 @@ interface FetchAlbumPhotosOptions {
|
|
|
406
427
|
* const handlePress = async () => {
|
|
407
428
|
* try {
|
|
408
429
|
* const response = await fetchAlbumPhotos({
|
|
409
|
-
* base64
|
|
430
|
+
* base64,
|
|
410
431
|
* maxWidth: 360,
|
|
411
432
|
* });
|
|
412
433
|
* setAlbumPhotos((prev) => ([...prev, ...response]));
|
|
@@ -417,9 +438,12 @@ interface FetchAlbumPhotosOptions {
|
|
|
417
438
|
*
|
|
418
439
|
* return (
|
|
419
440
|
* <View>
|
|
420
|
-
* {albumPhotos.map((image) =>
|
|
421
|
-
*
|
|
422
|
-
*
|
|
441
|
+
* {albumPhotos.map((image) => {
|
|
442
|
+
* // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
|
|
443
|
+
* const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
|
|
444
|
+
*
|
|
445
|
+
* return <Image source={{ uri: imageUri }} key={image.id} />;
|
|
446
|
+
* })}
|
|
423
447
|
* <Button title="앨범 가져오기" onPress={handlePress} />
|
|
424
448
|
* </View>
|
|
425
449
|
* );
|
|
@@ -517,23 +541,28 @@ interface OpenCameraOptions {
|
|
|
517
541
|
* import { View, Text, Button, Image } from 'react-native';
|
|
518
542
|
* import { openCamera } from '@apps-in-toss/framework';
|
|
519
543
|
*
|
|
544
|
+
* const base64 = true;
|
|
545
|
+
*
|
|
520
546
|
* // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
|
|
521
547
|
* function Camera() {
|
|
522
548
|
* const [image, setImage] = useState(null);
|
|
523
549
|
*
|
|
524
550
|
* const handlePress = async () => {
|
|
525
551
|
* try {
|
|
526
|
-
* const response = await openCamera({ base64
|
|
552
|
+
* const response = await openCamera({ base64 });
|
|
527
553
|
* setImage(response);
|
|
528
554
|
* } catch (error) {
|
|
529
555
|
* console.error('사진을 가져오는 데 실패했어요:', error);
|
|
530
556
|
* }
|
|
531
557
|
* };
|
|
532
558
|
*
|
|
559
|
+
* // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
|
|
560
|
+
* const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
|
|
561
|
+
*
|
|
533
562
|
* return (
|
|
534
563
|
* <View>
|
|
535
564
|
* {image ? (
|
|
536
|
-
* <Image source={{ uri:
|
|
565
|
+
* <Image source={{ uri: imageUri }} style={{ width: 200, height: 200 }} />
|
|
537
566
|
* ) : (
|
|
538
567
|
* <Text>사진이 없어요</Text>
|
|
539
568
|
* )}
|
|
@@ -608,7 +637,7 @@ declare function appLogin(): Promise<{
|
|
|
608
637
|
*/
|
|
609
638
|
declare function getOperationalEnvironment(): 'toss' | 'sandbox';
|
|
610
639
|
|
|
611
|
-
interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
640
|
+
interface WebViewProps extends Omit<WebViewProps$1, 'cacheEnabled' | 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
612
641
|
local: {
|
|
613
642
|
port: number;
|
|
614
643
|
host: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -300,17 +300,36 @@ interface ContactEntity {
|
|
|
300
300
|
* - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
|
|
301
301
|
* - `done`: 모든 연락처를 다 가져왔는지 여부를 나타내요. 모두 가져왔다면 `true`예요.
|
|
302
302
|
*
|
|
303
|
+
* @signature
|
|
304
|
+
* ```typescript
|
|
305
|
+
* function fetchContacts({ size, offset, query }: {
|
|
306
|
+
* size: number;
|
|
307
|
+
* offset: number;
|
|
308
|
+
* query?: {
|
|
309
|
+
* contains?: string;
|
|
310
|
+
* };
|
|
311
|
+
* }): Promise<{
|
|
312
|
+
* result: ContactEntity[];
|
|
313
|
+
* nextOffset: number | null;
|
|
314
|
+
* done: boolean;
|
|
315
|
+
* }>;
|
|
316
|
+
* ```
|
|
317
|
+
*
|
|
303
318
|
* @example
|
|
304
319
|
* ### 특정 문자열이 포함된 연락처 목록 가져오기
|
|
305
320
|
*
|
|
306
321
|
* ```tsx
|
|
307
322
|
* import React, { useState } from 'react';
|
|
308
323
|
* import { View, Text, Button } from 'react-native';
|
|
309
|
-
* import { fetchContacts } from '@apps-in-toss/framework';
|
|
324
|
+
* import { fetchContacts, ContactEntity } from '@apps-in-toss/framework';
|
|
310
325
|
*
|
|
311
326
|
* // 특정 문자열을 포함한 연락처 목록을 가져와 화면에 표시하는 컴포넌트
|
|
312
327
|
* function ContactsList() {
|
|
313
|
-
* const [contacts, setContacts] = useState
|
|
328
|
+
* const [contacts, setContacts] = useState<{
|
|
329
|
+
* result: ContactEntity[];
|
|
330
|
+
* nextOffset: number | null;
|
|
331
|
+
* done: boolean;
|
|
332
|
+
* }>({
|
|
314
333
|
* result: [],
|
|
315
334
|
* nextOffset: null,
|
|
316
335
|
* done: false,
|
|
@@ -326,7 +345,7 @@ interface ContactEntity {
|
|
|
326
345
|
* const response = await fetchContacts({
|
|
327
346
|
* size: 10,
|
|
328
347
|
* offset: contacts.nextOffset ?? 0,
|
|
329
|
-
* query: { contains: '
|
|
348
|
+
* query: { contains: '김' },
|
|
330
349
|
* });
|
|
331
350
|
* setContacts((prev) => ({
|
|
332
351
|
* result: [...prev.result, ...response.result],
|
|
@@ -399,6 +418,8 @@ interface FetchAlbumPhotosOptions {
|
|
|
399
418
|
* import { View, Image, Button } from 'react-native';
|
|
400
419
|
* import { fetchAlbumPhotos } from '@apps-in-toss/framework';
|
|
401
420
|
*
|
|
421
|
+
* const base64 = true;
|
|
422
|
+
*
|
|
402
423
|
* // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
|
|
403
424
|
* function AlbumPhotoList() {
|
|
404
425
|
* const [albumPhotos, setAlbumPhotos] = useState([]);
|
|
@@ -406,7 +427,7 @@ interface FetchAlbumPhotosOptions {
|
|
|
406
427
|
* const handlePress = async () => {
|
|
407
428
|
* try {
|
|
408
429
|
* const response = await fetchAlbumPhotos({
|
|
409
|
-
* base64
|
|
430
|
+
* base64,
|
|
410
431
|
* maxWidth: 360,
|
|
411
432
|
* });
|
|
412
433
|
* setAlbumPhotos((prev) => ([...prev, ...response]));
|
|
@@ -417,9 +438,12 @@ interface FetchAlbumPhotosOptions {
|
|
|
417
438
|
*
|
|
418
439
|
* return (
|
|
419
440
|
* <View>
|
|
420
|
-
* {albumPhotos.map((image) =>
|
|
421
|
-
*
|
|
422
|
-
*
|
|
441
|
+
* {albumPhotos.map((image) => {
|
|
442
|
+
* // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
|
|
443
|
+
* const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
|
|
444
|
+
*
|
|
445
|
+
* return <Image source={{ uri: imageUri }} key={image.id} />;
|
|
446
|
+
* })}
|
|
423
447
|
* <Button title="앨범 가져오기" onPress={handlePress} />
|
|
424
448
|
* </View>
|
|
425
449
|
* );
|
|
@@ -517,23 +541,28 @@ interface OpenCameraOptions {
|
|
|
517
541
|
* import { View, Text, Button, Image } from 'react-native';
|
|
518
542
|
* import { openCamera } from '@apps-in-toss/framework';
|
|
519
543
|
*
|
|
544
|
+
* const base64 = true;
|
|
545
|
+
*
|
|
520
546
|
* // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
|
|
521
547
|
* function Camera() {
|
|
522
548
|
* const [image, setImage] = useState(null);
|
|
523
549
|
*
|
|
524
550
|
* const handlePress = async () => {
|
|
525
551
|
* try {
|
|
526
|
-
* const response = await openCamera({ base64
|
|
552
|
+
* const response = await openCamera({ base64 });
|
|
527
553
|
* setImage(response);
|
|
528
554
|
* } catch (error) {
|
|
529
555
|
* console.error('사진을 가져오는 데 실패했어요:', error);
|
|
530
556
|
* }
|
|
531
557
|
* };
|
|
532
558
|
*
|
|
559
|
+
* // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
|
|
560
|
+
* const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
|
|
561
|
+
*
|
|
533
562
|
* return (
|
|
534
563
|
* <View>
|
|
535
564
|
* {image ? (
|
|
536
|
-
* <Image source={{ uri:
|
|
565
|
+
* <Image source={{ uri: imageUri }} style={{ width: 200, height: 200 }} />
|
|
537
566
|
* ) : (
|
|
538
567
|
* <Text>사진이 없어요</Text>
|
|
539
568
|
* )}
|
|
@@ -608,7 +637,7 @@ declare function appLogin(): Promise<{
|
|
|
608
637
|
*/
|
|
609
638
|
declare function getOperationalEnvironment(): 'toss' | 'sandbox';
|
|
610
639
|
|
|
611
|
-
interface WebViewProps extends Omit<WebViewProps$1, 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
640
|
+
interface WebViewProps extends Omit<WebViewProps$1, 'cacheEnabled' | 'source' | 'sharedCookiesEnabled' | 'thirdPartyCookiesEnabled' | 'injectedJavaScriptBeforeContentLoaded'> {
|
|
612
641
|
local: {
|
|
613
642
|
port: number;
|
|
614
643
|
host: number;
|
package/dist/index.js
CHANGED
|
@@ -30,12 +30,6 @@ var AppsInToss = {
|
|
|
30
30
|
registerApp
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
// src/native-event-emitter/index.ts
|
|
34
|
-
var native_event_emitter_exports = {};
|
|
35
|
-
__export(native_event_emitter_exports, {
|
|
36
|
-
startUpdateLocation: () => startUpdateLocation
|
|
37
|
-
});
|
|
38
|
-
|
|
39
33
|
// src/native-event-emitter/bedrock-event.ts
|
|
40
34
|
import { BedrockEvent } from "react-native-bedrock";
|
|
41
35
|
|
|
@@ -109,19 +103,6 @@ function startUpdateLocation(eventParams) {
|
|
|
109
103
|
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
110
104
|
}
|
|
111
105
|
|
|
112
|
-
// src/native-modules/index.ts
|
|
113
|
-
var native_modules_exports = {};
|
|
114
|
-
__export(native_modules_exports, {
|
|
115
|
-
appLogin: () => appLogin,
|
|
116
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
117
|
-
fetchContacts: () => fetchContacts,
|
|
118
|
-
getClipboardText: () => getClipboardText,
|
|
119
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
120
|
-
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
121
|
-
openCamera: () => openCamera,
|
|
122
|
-
setClipboardText: () => setClipboardText
|
|
123
|
-
});
|
|
124
|
-
|
|
125
106
|
// src/native-modules/setClipboardText.ts
|
|
126
107
|
async function setClipboardText(text) {
|
|
127
108
|
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
@@ -175,14 +156,6 @@ async function fetchAlbumPhotos(options) {
|
|
|
175
156
|
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
176
157
|
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
177
158
|
});
|
|
178
|
-
if (options.base64) {
|
|
179
|
-
return albumPhotos.map((photo) => {
|
|
180
|
-
return {
|
|
181
|
-
...photo,
|
|
182
|
-
dataUri: `data:image/jpeg;base64,${photo.dataUri}`
|
|
183
|
-
};
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
159
|
return albumPhotos;
|
|
187
160
|
}
|
|
188
161
|
|
|
@@ -222,28 +195,67 @@ import {
|
|
|
222
195
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
223
196
|
import { useMemo } from "react";
|
|
224
197
|
import { useBridgeHandler } from "react-native-bedrock";
|
|
225
|
-
import * as
|
|
226
|
-
import * as
|
|
198
|
+
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
199
|
+
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
200
|
+
|
|
201
|
+
// src/async-bridges.ts
|
|
202
|
+
var async_bridges_exports = {};
|
|
203
|
+
__export(async_bridges_exports, {
|
|
204
|
+
appLogin: () => appLogin,
|
|
205
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
206
|
+
fetchContacts: () => fetchContacts,
|
|
207
|
+
getClipboardText: () => getClipboardText,
|
|
208
|
+
getCurrentLocation: () => getCurrentLocation,
|
|
209
|
+
openCamera: () => openCamera,
|
|
210
|
+
setClipboardText: () => setClipboardText
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// src/constant-bridges.ts
|
|
214
|
+
var constant_bridges_exports = {};
|
|
215
|
+
__export(constant_bridges_exports, {
|
|
216
|
+
getOperationalEnvironment: () => getOperationalEnvironment
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// src/env.ts
|
|
220
|
+
var env = {
|
|
221
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// src/event-bridges.ts
|
|
225
|
+
var event_bridges_exports = {};
|
|
226
|
+
__export(event_bridges_exports, {
|
|
227
|
+
startUpdateLocation: () => startUpdateLocation
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// src/components/WebView.tsx
|
|
227
231
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
228
232
|
function WebView({ local, onMessage, ...props }) {
|
|
229
233
|
const uri = useMemo(() => {
|
|
230
234
|
if (__DEV__) {
|
|
231
235
|
return `http://${local.host}:${local.port}`;
|
|
232
236
|
}
|
|
233
|
-
|
|
237
|
+
const url = new URL(AppsInTossModule.getWebBundleURL({}).url);
|
|
238
|
+
const deploymentId = env.getDeploymentId();
|
|
239
|
+
if (deploymentId) {
|
|
240
|
+
url.searchParams.set("_deploymentId", deploymentId);
|
|
241
|
+
}
|
|
242
|
+
return url.toString();
|
|
234
243
|
}, [local]);
|
|
235
244
|
const handler = useBridgeHandler({
|
|
236
245
|
onMessage,
|
|
237
246
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
238
|
-
eventListenerMap:
|
|
247
|
+
eventListenerMap: event_bridges_exports,
|
|
239
248
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
240
249
|
// @ts-expect-error
|
|
241
|
-
constantHandlerMap:
|
|
250
|
+
constantHandlerMap: {
|
|
251
|
+
...bedrockConstantBridges,
|
|
252
|
+
...constant_bridges_exports
|
|
253
|
+
},
|
|
242
254
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
243
255
|
// @ts-expect-error
|
|
244
|
-
|
|
245
|
-
...
|
|
246
|
-
...
|
|
256
|
+
asyncHandlerMap: {
|
|
257
|
+
...bedrockAsyncBridges,
|
|
258
|
+
...async_bridges_exports
|
|
247
259
|
}
|
|
248
260
|
});
|
|
249
261
|
return /* @__PURE__ */ jsx2(
|
|
@@ -251,9 +263,13 @@ function WebView({ local, onMessage, ...props }) {
|
|
|
251
263
|
{
|
|
252
264
|
ref: handler.ref,
|
|
253
265
|
...props,
|
|
254
|
-
source: {
|
|
266
|
+
source: {
|
|
267
|
+
uri
|
|
268
|
+
},
|
|
255
269
|
sharedCookiesEnabled: true,
|
|
256
270
|
thirdPartyCookiesEnabled: true,
|
|
271
|
+
cacheEnabled: false,
|
|
272
|
+
cacheMode: "LOAD_NO_CACHE",
|
|
257
273
|
onMessage: handler.onMessage,
|
|
258
274
|
injectedJavaScript: handler.injectedJavaScript,
|
|
259
275
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
@@ -284,11 +300,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
284
300
|
return location;
|
|
285
301
|
}
|
|
286
302
|
|
|
287
|
-
// src/env.ts
|
|
288
|
-
var env = {
|
|
289
|
-
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
290
|
-
};
|
|
291
|
-
|
|
292
303
|
// src/types.ts
|
|
293
304
|
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
294
305
|
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
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.12",
|
|
5
5
|
"description": "The framework for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -23,9 +23,17 @@
|
|
|
23
23
|
"import": "./dist/plugins/index.js",
|
|
24
24
|
"require": "./dist/plugins/index.cjs"
|
|
25
25
|
},
|
|
26
|
-
"./bridges": {
|
|
27
|
-
"types": "./src/bridges.ts",
|
|
28
|
-
"default": "./src/bridges.ts"
|
|
26
|
+
"./async-bridges": {
|
|
27
|
+
"types": "./src/async-bridges.ts",
|
|
28
|
+
"default": "./src/async-bridges.ts"
|
|
29
|
+
},
|
|
30
|
+
"./constant-bridges": {
|
|
31
|
+
"types": "./src/constant-bridges.ts",
|
|
32
|
+
"default": "./src/constant-bridges.ts"
|
|
33
|
+
},
|
|
34
|
+
"./event-bridges": {
|
|
35
|
+
"types": "./src/event-bridges.ts",
|
|
36
|
+
"default": "./src/event-bridges.ts"
|
|
29
37
|
},
|
|
30
38
|
"./jest": {
|
|
31
39
|
"types": "./dist/jest/index.d.ts",
|
|
@@ -36,7 +44,9 @@
|
|
|
36
44
|
},
|
|
37
45
|
"files": [
|
|
38
46
|
"dist/**/*",
|
|
39
|
-
"src/bridges.ts",
|
|
47
|
+
"src/async-bridges.ts",
|
|
48
|
+
"src/constant-bridges.ts",
|
|
49
|
+
"src/event-bridges.ts",
|
|
40
50
|
"hermesc/**/*",
|
|
41
51
|
"plugins.d.ts",
|
|
42
52
|
"jest.d.ts"
|
|
@@ -45,11 +55,11 @@
|
|
|
45
55
|
"ait": "./bin/ait.js"
|
|
46
56
|
},
|
|
47
57
|
"dependencies": {
|
|
48
|
-
"@apps-in-toss/cli": "0.0.
|
|
58
|
+
"@apps-in-toss/cli": "0.0.12"
|
|
49
59
|
},
|
|
50
60
|
"devDependencies": {
|
|
51
|
-
"@react-native-bedrock/mpack-next": "0.0.
|
|
52
|
-
"@react-native-bedrock/native": "0.0.
|
|
61
|
+
"@react-native-bedrock/mpack-next": "0.0.13",
|
|
62
|
+
"@react-native-bedrock/native": "0.0.13",
|
|
53
63
|
"@ryoppippi/unplugin-typia": "^2.0.3",
|
|
54
64
|
"@toss-design-system/react-native": "^0",
|
|
55
65
|
"@types/archiver": "^6.0.3",
|
|
@@ -62,7 +72,7 @@
|
|
|
62
72
|
"picocolors": "^1.1.1",
|
|
63
73
|
"react": "18.2.0",
|
|
64
74
|
"react-native": "0.72.6",
|
|
65
|
-
"react-native-bedrock": "0.0.
|
|
75
|
+
"react-native-bedrock": "0.0.13",
|
|
66
76
|
"tsup": "^8.3.5",
|
|
67
77
|
"typescript": "4.9.5",
|
|
68
78
|
"typia": "^8.0.1",
|
|
@@ -80,5 +90,5 @@
|
|
|
80
90
|
"publishConfig": {
|
|
81
91
|
"access": "public"
|
|
82
92
|
},
|
|
83
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "38b91e6f4a323333a6039119dd523fc44559bcae"
|
|
84
94
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './native-modules/setClipboardText.js';
|
|
2
|
+
export * from './native-modules/getClipboardText.js';
|
|
3
|
+
export * from './native-modules/fetchContacts.js';
|
|
4
|
+
export * from './native-modules/fetchAlbumPhotos.js';
|
|
5
|
+
export * from './native-modules/getCurrentLocation.js';
|
|
6
|
+
export * from './native-modules/openCamera.js';
|
|
7
|
+
export * from './native-modules/appLogin.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './native-modules/getOperationalEnvironment.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './native-event-emitter/startUpdateLocation.js';
|
package/dist/cli-presets.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
|
|
17
|
-
// src/cli-presets.ts
|
|
18
|
-
var cli_presets_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(cli_presets_exports);
|
|
20
|
-
__reExport(cli_presets_exports, require("@apps-in-toss/cli-presets"), module.exports);
|
|
21
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
-
0 && (module.exports = {
|
|
23
|
-
...require("@apps-in-toss/cli-presets")
|
|
24
|
-
});
|
package/dist/cli-presets.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@apps-in-toss/cli-presets';
|
package/dist/cli-presets.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@apps-in-toss/cli-presets';
|
package/dist/cli-presets.js
DELETED
package/src/bridges.ts
DELETED