@apps-in-toss/web-framework 0.0.11 → 0.0.13

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.
@@ -2,13 +2,13 @@
2
2
  {
3
3
  "platform": "ios",
4
4
  "totalModuleCount": 360,
5
- "duration": 406.73562500000025,
6
- "size": 130489
5
+ "duration": 407.6906250000002,
6
+ "size": 130797
7
7
  },
8
8
  {
9
9
  "platform": "android",
10
10
  "totalModuleCount": 360,
11
- "duration": 407.8052090000001,
12
- "size": 130235
11
+ "duration": 406.40241600000013,
12
+ "size": 130533
13
13
  }
14
14
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/web-framework",
3
3
  "type": "module",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "description": "Web Framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -50,7 +50,7 @@
50
50
  "config.d.ts"
51
51
  ],
52
52
  "devDependencies": {
53
- "@apps-in-toss/framework": "0.0.11",
53
+ "@apps-in-toss/framework": "0.0.13",
54
54
  "@babel/plugin-proposal-class-properties": "^7.16.7",
55
55
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
56
56
  "@babel/plugin-proposal-numeric-separator": "^7.16.7",
@@ -95,11 +95,11 @@
95
95
  "zod": "^3.24.1"
96
96
  },
97
97
  "dependencies": {
98
- "@apps-in-toss/cli": "0.0.11",
98
+ "@apps-in-toss/cli": "0.0.13",
99
99
  "@babel/core": "7.23.9"
100
100
  },
101
101
  "publishConfig": {
102
102
  "access": "public"
103
103
  },
104
- "gitHead": "d0dfa84af3118a71ea3705c440e639fb5b1a010b"
104
+ "gitHead": "c5fa235b136ffaefc7687b35b473de5f6a1dca6f"
105
105
  }
@@ -41,6 +41,8 @@ export interface FetchAlbumPhotosOptions {
41
41
  *
42
42
  * import { fetchAlbumPhotos } from '@apps-in-toss/web-framework';
43
43
  *
44
+ * const base64 = true;
45
+ *
44
46
  * // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
45
47
  * function AlbumPhotoList() {
46
48
  * const [albumPhotos, setAlbumPhotos] = useState([]);
@@ -48,7 +50,7 @@ export interface FetchAlbumPhotosOptions {
48
50
  * const handlePress = async () => {
49
51
  * try {
50
52
  * const response = await fetchAlbumPhotos({
51
- * base64: true,
53
+ * base64,
52
54
  * maxWidth: 360,
53
55
  * });
54
56
  * setAlbumPhotos((prev) => ([...prev, ...response]));
@@ -59,9 +61,12 @@ export interface FetchAlbumPhotosOptions {
59
61
  *
60
62
  * return (
61
63
  * <div>
62
- * {albumPhotos.map((image) => (
63
- * <img src={`data:image/jpeg;base64,${image.dataUri}`} key={image.id} />
64
- * ))}
64
+ * {albumPhotos.map((image) => {
65
+ * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
66
+ * const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
67
+ *
68
+ * return <Image source={{ uri: imageUri }} key={image.id} />;
69
+ * })}
65
70
  * <input type="button" value="앨범 가져오기" onClick={handlePress} />
66
71
  * </div>
67
72
  * );
@@ -22,17 +22,36 @@ export interface ContactEntity {
22
22
  * - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
23
23
  * - `done`: 모든 연락처를 다 가져왔는지 여부를 나타내요. 모두 가져왔다면 `true`예요.
24
24
  *
25
+ * @signature
26
+ * ```typescript
27
+ * function fetchContacts({ size, offset, query }: {
28
+ * size: number;
29
+ * offset: number;
30
+ * query?: {
31
+ * contains?: string;
32
+ * };
33
+ * }): Promise<{
34
+ * result: ContactEntity[];
35
+ * nextOffset: number | null;
36
+ * done: boolean;
37
+ * }>;
38
+ * ```
39
+ *
25
40
  * @example
26
41
  * ### 특정 문자열이 포함된 연락처 목록 가져오기
27
42
  *
28
43
  * ```tsx
29
44
  * import React, { useState } from 'react';
30
45
  *
31
- * import { fetchContacts } from '@apps-in-toss/web-framework';
46
+ * import { fetchContacts, ContactEntity } from '@apps-in-toss/web-framework';
32
47
  *
33
48
  * // 특정 문자열을 포함한 연락처 목록을 가져와 화면에 표시하는 컴포넌트
34
49
  * function ContactsList() {
35
- * const [contacts, setContacts] = useState({
50
+ * const [contacts, setContacts] = useState<{
51
+ * result: ContactEntity[];
52
+ * nextOffset: number | null;
53
+ * done: boolean;
54
+ * }>({
36
55
  * result: [],
37
56
  * nextOffset: null,
38
57
  * done: false,
@@ -48,7 +67,7 @@ export interface ContactEntity {
48
67
  * const response = await fetchContacts({
49
68
  * size: 10,
50
69
  * offset: contacts.nextOffset ?? 0,
51
- * query: { contains: '홍길동' },
70
+ * query: { contains: '' },
52
71
  * });
53
72
  * setContacts((prev) => ({
54
73
  * result: [...prev.result, ...response.result],
@@ -42,23 +42,28 @@ export interface OpenCameraOptions {
42
42
  *
43
43
  * import { openCamera } from '@apps-in-toss/web-framework';
44
44
  *
45
+ * const base64 = true;
46
+ *
45
47
  * // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
46
48
  * function Camera() {
47
49
  * const [image, setImage] = useState(null);
48
50
  *
49
51
  * const handlePress = async () => {
50
52
  * try {
51
- * const response = await openCamera({ base64: true });
53
+ * const response = await openCamera({ base64 });
52
54
  * setImage(response);
53
55
  * } catch (error) {
54
56
  * console.error('사진을 가져오는 데 실패했어요:', error);
55
57
  * }
56
58
  * };
57
59
  *
60
+ * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
61
+ * const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
62
+ *
58
63
  * return (
59
64
  * <div>
60
65
  * {image ? (
61
- * <img src={`data:image/jpeg;base64,${image.dataUri}`} style={{ width: 200, height: 200 }} />
66
+ * <Image source={{ uri: imageUri }} style={{ width: 200, height: 200 }} />
62
67
  * ) : (
63
68
  * <span>사진이 없어요</span>
64
69
  * )}