@amityco/ts-sdk-react-native 6.29.3-fe4e045.0 → 6.30.0
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/.env +26 -26
- package/dist/@types/core/model.d.ts +1 -1
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
- package/dist/fileRepository/api/uploadFile.d.ts.map +1 -1
- package/dist/fileRepository/api/uploadImage.d.ts.map +1 -1
- package/dist/fileRepository/api/uploadVideo.d.ts.map +1 -1
- package/dist/index.cjs.js +17 -34
- package/dist/index.esm.js +17 -33
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
- package/src/@types/core/model.ts +1 -1
- package/src/communityRepository/communityMembership/events/onUserDeleted.ts +1 -1
- package/src/core/model/idResolvers.ts +1 -1
- package/src/fileRepository/api/uploadFile.ts +5 -10
- package/src/fileRepository/api/uploadImage.ts +5 -8
- package/src/fileRepository/api/uploadVideo.ts +7 -9
package/package.json
CHANGED
package/src/@types/core/model.ts
CHANGED
|
@@ -113,7 +113,7 @@ declare global {
|
|
|
113
113
|
advertiser: Pick<Amity.Advertiser, 'advertiserId'>;
|
|
114
114
|
|
|
115
115
|
pinTarget: Pick<Amity.InternalPinTarget, 'targetId'>;
|
|
116
|
-
pin: Pick<Amity.InternalPin, 'referenceId'>;
|
|
116
|
+
pin: Pick<Amity.InternalPin, 'placement' | 'referenceId'>;
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -57,7 +57,7 @@ const idResolvers: Resolvers = {
|
|
|
57
57
|
ad: ({ adId }) => adId,
|
|
58
58
|
advertiser: ({ advertiserId }) => advertiserId,
|
|
59
59
|
|
|
60
|
-
pin: ({ referenceId }) => referenceId
|
|
60
|
+
pin: ({ placement, referenceId }) => `${placement}#${referenceId}`,
|
|
61
61
|
pinTarget: ({ targetId }) => targetId,
|
|
62
62
|
};
|
|
63
63
|
|
|
@@ -2,7 +2,6 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import GlobalFileAccessType from '~/client/utils/GlobalFileAccessType';
|
|
5
|
-
import { rebuildFormDataWithMimeType } from '~/fileRepository/utils/rebuildFormDataWithMimeType';
|
|
6
5
|
|
|
7
6
|
/* begin_public_function
|
|
8
7
|
id: file.upload.file
|
|
@@ -43,16 +42,12 @@ export const uploadFile = async <T extends Amity.FileType = any>(
|
|
|
43
42
|
? (formData as any).getHeaders()
|
|
44
43
|
: { 'content-type': 'multipart/form-data' };
|
|
45
44
|
|
|
46
|
-
const { data } = await client.http.post<Amity.CreateFilePayload<T>>(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
headers,
|
|
51
|
-
onUploadProgress({ loaded, total = 100 }) {
|
|
52
|
-
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
53
|
-
},
|
|
45
|
+
const { data } = await client.http.post<Amity.CreateFilePayload<T>>('/api/v4/files', formData, {
|
|
46
|
+
headers,
|
|
47
|
+
onUploadProgress({ loaded, total = 100 }) {
|
|
48
|
+
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
54
49
|
},
|
|
55
|
-
);
|
|
50
|
+
});
|
|
56
51
|
|
|
57
52
|
// API-FIX: payload should be serialized properly
|
|
58
53
|
// const { files } = data
|
|
@@ -2,7 +2,6 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import GlobalFileAccessType from '~/client/utils/GlobalFileAccessType';
|
|
5
|
-
import { rebuildFormDataWithMimeType } from '../utils/rebuildFormDataWithMimeType';
|
|
6
5
|
|
|
7
6
|
/* begin_public_function
|
|
8
7
|
id: file.upload.image
|
|
@@ -33,21 +32,19 @@ export const uploadImage = async (
|
|
|
33
32
|
|
|
34
33
|
if (!files.length) throw new Error('The formData object must have a `files` key.');
|
|
35
34
|
|
|
36
|
-
const newFormDataWithMimeType = rebuildFormDataWithMimeType(formData);
|
|
37
|
-
|
|
38
35
|
const accessType = GlobalFileAccessType.getInstance().getFileAccessType();
|
|
39
|
-
|
|
36
|
+
formData.append('accessType', accessType);
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
formData.append('preferredFilename', (files[0] as File).name);
|
|
42
39
|
|
|
43
40
|
const headers =
|
|
44
|
-
'getHeaders' in
|
|
45
|
-
? (
|
|
41
|
+
'getHeaders' in formData
|
|
42
|
+
? (formData as any).getHeaders()
|
|
46
43
|
: { 'content-type': 'multipart/form-data' };
|
|
47
44
|
|
|
48
45
|
const { data } = await client.http.post<Amity.CreateFilePayload<'image'>>(
|
|
49
46
|
'/api/v4/images',
|
|
50
|
-
|
|
47
|
+
formData,
|
|
51
48
|
{
|
|
52
49
|
headers,
|
|
53
50
|
onUploadProgress({ loaded, total = 100 }) {
|
|
@@ -2,7 +2,6 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import GlobalFileAccessType from '~/client/utils/GlobalFileAccessType';
|
|
5
|
-
import { rebuildFormDataWithMimeType } from '../utils/rebuildFormDataWithMimeType';
|
|
6
5
|
|
|
7
6
|
/* begin_public_function
|
|
8
7
|
id: file.upload.video, file.upload.audio
|
|
@@ -35,25 +34,23 @@ export const uploadVideo = async (
|
|
|
35
34
|
|
|
36
35
|
if (!files.length) throw new Error('The formData object must have a `files` key.');
|
|
37
36
|
|
|
38
|
-
const newFormDataWithMimeType = rebuildFormDataWithMimeType(formData);
|
|
39
|
-
|
|
40
37
|
const accessType = GlobalFileAccessType.getInstance().getFileAccessType();
|
|
41
|
-
|
|
38
|
+
formData.append('accessType', accessType);
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
formData.append('preferredFilename', (files[0] as File).name);
|
|
44
41
|
|
|
45
42
|
if (feedType) {
|
|
46
|
-
|
|
43
|
+
formData.append('feedType', feedType);
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
const headers =
|
|
50
|
-
'getHeaders' in
|
|
51
|
-
? (
|
|
47
|
+
'getHeaders' in formData
|
|
48
|
+
? (formData as any).getHeaders()
|
|
52
49
|
: { 'content-type': 'multipart/form-data' };
|
|
53
50
|
|
|
54
51
|
const { data } = await client.http.post<Amity.CreateFilePayload<'video'>>(
|
|
55
52
|
'/api/v4/videos',
|
|
56
|
-
|
|
53
|
+
formData,
|
|
57
54
|
{
|
|
58
55
|
headers,
|
|
59
56
|
onUploadProgress({ loaded, total = 100 }) {
|
|
@@ -61,6 +58,7 @@ export const uploadVideo = async (
|
|
|
61
58
|
},
|
|
62
59
|
},
|
|
63
60
|
);
|
|
61
|
+
|
|
64
62
|
// API-FIX: payload should be serialized properly
|
|
65
63
|
// const { files } = data
|
|
66
64
|
|