@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk-react-native",
3
- "version": "6.29.3-fe4e045.0",
3
+ "version": "6.30.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -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
  }
@@ -7,7 +7,7 @@ import { getResolver } from '~/core/model';
7
7
 
8
8
  /**
9
9
  * ```js
10
- * import { onUserDeleted } from '@amityco/ts-sdk'
10
+ * import { onUserDeleted } from '@amityco/ts-sdk-react-native'
11
11
  * const dispose = onUserDeleted((community, member) => {
12
12
  * // ...
13
13
  * })
@@ -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
- '/api/v4/files',
48
- rebuildFormDataWithMimeType(formData),
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
- newFormDataWithMimeType.append('accessType', accessType);
36
+ formData.append('accessType', accessType);
40
37
 
41
- newFormDataWithMimeType.append('preferredFilename', (files[0] as File).name);
38
+ formData.append('preferredFilename', (files[0] as File).name);
42
39
 
43
40
  const headers =
44
- 'getHeaders' in newFormDataWithMimeType
45
- ? (newFormDataWithMimeType as any).getHeaders()
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
- newFormDataWithMimeType,
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
- newFormDataWithMimeType.append('accessType', accessType);
38
+ formData.append('accessType', accessType);
42
39
 
43
- newFormDataWithMimeType.append('preferredFilename', (files[0] as File).name);
40
+ formData.append('preferredFilename', (files[0] as File).name);
44
41
 
45
42
  if (feedType) {
46
- newFormDataWithMimeType.append('feedType', feedType);
43
+ formData.append('feedType', feedType);
47
44
  }
48
45
 
49
46
  const headers =
50
- 'getHeaders' in newFormDataWithMimeType
51
- ? (newFormDataWithMimeType as any).getHeaders()
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
- newFormDataWithMimeType,
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