@developer_tribe/react-native-comnyx 0.13.13 → 0.14.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/android/generated/RCTAppDependencyProvider.h +25 -0
- package/android/generated/RCTAppDependencyProvider.mm +55 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/android/generated/ReactAppDependencyProvider.podspec +34 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNComnyxSpec-generated.cpp +22 -0
- package/android/generated/jni/RNComnyxSpec.h +24 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +19 -0
- package/android/src/main/AndroidManifest.xml +15 -0
- package/android/src/main/AndroidManifestNew.xml +4 -0
- package/android/src/main/java/com/comnyx/ComnyxMediaPickerModule.kt +301 -0
- package/android/src/main/java/com/comnyx/ComnyxPackage.kt +1 -1
- package/android/src/main/java/com/comnyx/VideoPlayerActivity.kt +91 -0
- package/ios/ComnyxMediaPicker.m +23 -0
- package/ios/ComnyxMediaPicker.swift +377 -0
- package/lib/commonjs/NativeComnyxMediaPicker.js +62 -0
- package/lib/commonjs/NativeComnyxMediaPicker.js.map +1 -0
- package/lib/commonjs/api/index.js +19 -0
- package/lib/commonjs/api/index.js.map +1 -1
- package/lib/commonjs/api/media.js +76 -0
- package/lib/commonjs/api/media.js.map +1 -0
- package/lib/commonjs/assets/attachment-01.png +0 -0
- package/lib/commonjs/assets/x-circle.png +0 -0
- package/lib/commonjs/components/ChatList.js +48 -22
- package/lib/commonjs/components/ChatList.js.map +1 -1
- package/lib/commonjs/components/LinkifyText.js +5 -1
- package/lib/commonjs/components/LinkifyText.js.map +1 -1
- package/lib/commonjs/components/MediaMessageItem.js +333 -0
- package/lib/commonjs/components/MediaMessageItem.js.map +1 -0
- package/lib/commonjs/components/MediaPickerButton.js +47 -0
- package/lib/commonjs/components/MediaPickerButton.js.map +1 -0
- package/lib/commonjs/components/MediaViewerModal.js +157 -0
- package/lib/commonjs/components/MediaViewerModal.js.map +1 -0
- package/lib/commonjs/components/MessageInput.js +344 -73
- package/lib/commonjs/components/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageItem.js +17 -7
- package/lib/commonjs/components/MessageItem.js.map +1 -1
- package/lib/commonjs/constants/translations.js +203 -29
- package/lib/commonjs/constants/translations.js.map +1 -1
- package/lib/commonjs/data/fake/media.js +105 -0
- package/lib/commonjs/data/fake/media.js.map +1 -0
- package/lib/commonjs/types/MediaTypes.js +2 -0
- package/lib/commonjs/types/MediaTypes.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/NativeComnyxMediaPicker.js +54 -0
- package/lib/module/NativeComnyxMediaPicker.js.map +1 -0
- package/lib/module/api/index.js +1 -0
- package/lib/module/api/index.js.map +1 -1
- package/lib/module/api/media.js +70 -0
- package/lib/module/api/media.js.map +1 -0
- package/lib/module/assets/attachment-01.png +0 -0
- package/lib/module/assets/x-circle.png +0 -0
- package/lib/module/components/ChatList.js +48 -22
- package/lib/module/components/ChatList.js.map +1 -1
- package/lib/module/components/LinkifyText.js +5 -1
- package/lib/module/components/LinkifyText.js.map +1 -1
- package/lib/module/components/MediaMessageItem.js +330 -0
- package/lib/module/components/MediaMessageItem.js.map +1 -0
- package/lib/module/components/MediaPickerButton.js +43 -0
- package/lib/module/components/MediaPickerButton.js.map +1 -0
- package/lib/module/components/MediaViewerModal.js +153 -0
- package/lib/module/components/MediaViewerModal.js.map +1 -0
- package/lib/module/components/MessageInput.js +347 -75
- package/lib/module/components/MessageInput.js.map +1 -1
- package/lib/module/components/MessageItem.js +17 -7
- package/lib/module/components/MessageItem.js.map +1 -1
- package/lib/module/constants/translations.js +203 -29
- package/lib/module/constants/translations.js.map +1 -1
- package/lib/module/data/fake/media.js +99 -0
- package/lib/module/data/fake/media.js.map +1 -0
- package/lib/module/types/MediaTypes.js +2 -0
- package/lib/module/types/MediaTypes.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/NativeComnyxMediaPicker.d.ts +7 -0
- package/lib/typescript/src/NativeComnyxMediaPicker.d.ts.map +1 -0
- package/lib/typescript/src/api/index.d.ts +1 -0
- package/lib/typescript/src/api/index.d.ts.map +1 -1
- package/lib/typescript/src/api/media.d.ts +7 -0
- package/lib/typescript/src/api/media.d.ts.map +1 -0
- package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
- package/lib/typescript/src/components/LinkifyText.d.ts.map +1 -1
- package/lib/typescript/src/components/MediaMessageItem.d.ts +6 -0
- package/lib/typescript/src/components/MediaMessageItem.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaPickerButton.d.ts +5 -0
- package/lib/typescript/src/components/MediaPickerButton.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts +8 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/MessageInput.d.ts.map +1 -1
- package/lib/typescript/src/components/MessageItem.d.ts.map +1 -1
- package/lib/typescript/src/constants/translations.d.ts.map +1 -1
- package/lib/typescript/src/data/fake/media.d.ts +6 -0
- package/lib/typescript/src/data/fake/media.d.ts.map +1 -0
- package/lib/typescript/src/types/Conversation.d.ts +19 -0
- package/lib/typescript/src/types/Conversation.d.ts.map +1 -1
- package/lib/typescript/src/types/LocalizationKeys.d.ts +6 -0
- package/lib/typescript/src/types/LocalizationKeys.d.ts.map +1 -1
- package/lib/typescript/src/types/MediaTypes.d.ts +26 -0
- package/lib/typescript/src/types/MediaTypes.d.ts.map +1 -0
- package/lib/typescript/src/version.d.ts +1 -1
- package/lib/typescript/src/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeComnyxMediaPicker.ts +62 -0
- package/src/api/index.ts +1 -0
- package/src/api/media.ts +116 -0
- package/src/assets/attachment-01.png +0 -0
- package/src/assets/x-circle.png +0 -0
- package/src/components/ChatList.tsx +81 -24
- package/src/components/CustomerForm.tsx +1 -1
- package/src/components/LinkifyText.tsx +3 -2
- package/src/components/MediaMessageItem.tsx +390 -0
- package/src/components/MediaPickerButton.tsx +48 -0
- package/src/components/MediaViewerModal.tsx +161 -0
- package/src/components/MessageInput.tsx +396 -84
- package/src/components/MessageItem.tsx +19 -4
- package/src/constants/translations.ts +174 -0
- package/src/data/fake/media.ts +110 -0
- package/src/types/Conversation.ts +20 -0
- package/src/types/LocalizationKeys.ts +6 -0
- package/src/types/MediaTypes.ts +27 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function getFakeUploadUrlResponse(fileName) {
|
|
4
|
+
return new Promise(resolve => {
|
|
5
|
+
setTimeout(() => {
|
|
6
|
+
resolve({
|
|
7
|
+
data: {
|
|
8
|
+
path: `temp/${fileName}`,
|
|
9
|
+
url: `https://fake-s3-bucket.s3.amazonaws.com/temp/${fileName}?signed=true`,
|
|
10
|
+
method: 'PUT',
|
|
11
|
+
expires_at: new Date(Date.now() + 1200000).toISOString()
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}, 300);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function fakeUploadToS3(onProgress) {
|
|
18
|
+
return new Promise(resolve => {
|
|
19
|
+
let progress = 0;
|
|
20
|
+
const interval = setInterval(() => {
|
|
21
|
+
progress += Math.random() * 15 + 5;
|
|
22
|
+
if (progress >= 100) {
|
|
23
|
+
progress = 100;
|
|
24
|
+
onProgress?.(100);
|
|
25
|
+
clearInterval(interval);
|
|
26
|
+
setTimeout(resolve, 200);
|
|
27
|
+
} else {
|
|
28
|
+
onProgress?.(Math.round(progress));
|
|
29
|
+
}
|
|
30
|
+
}, 300);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function getFakeMediaMessageResponse(fileUrls, _mediaType) {
|
|
34
|
+
return new Promise(resolve => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
resolve({
|
|
37
|
+
message: {
|
|
38
|
+
conversation_id: 1,
|
|
39
|
+
content: fileUrls.join(','),
|
|
40
|
+
is_note: false,
|
|
41
|
+
updated_at: new Date().toISOString(),
|
|
42
|
+
created_at: new Date().toISOString(),
|
|
43
|
+
id: Math.floor(Math.random() * 10000),
|
|
44
|
+
user: null,
|
|
45
|
+
customer: null,
|
|
46
|
+
bot: null,
|
|
47
|
+
conversation: {
|
|
48
|
+
id: 1,
|
|
49
|
+
project_id: 1,
|
|
50
|
+
customer_id: 1,
|
|
51
|
+
created_at: new Date().toISOString(),
|
|
52
|
+
updated_at: new Date().toISOString(),
|
|
53
|
+
deleted_at: null,
|
|
54
|
+
language: 'en',
|
|
55
|
+
use_ai_answers: 0,
|
|
56
|
+
project: {
|
|
57
|
+
id: 1,
|
|
58
|
+
name: 'Demo Project',
|
|
59
|
+
organization_id: 1,
|
|
60
|
+
created_at: new Date().toISOString(),
|
|
61
|
+
updated_at: new Date().toISOString(),
|
|
62
|
+
deleted_at: null,
|
|
63
|
+
uuid: 'demo-uuid',
|
|
64
|
+
organization: {
|
|
65
|
+
id: 1,
|
|
66
|
+
name: 'Demo Organization',
|
|
67
|
+
created_at: new Date().toISOString(),
|
|
68
|
+
updated_at: new Date().toISOString(),
|
|
69
|
+
deleted_at: null,
|
|
70
|
+
owner: [{
|
|
71
|
+
id: 1,
|
|
72
|
+
name: 'Demo User',
|
|
73
|
+
email: 'demo@example.com',
|
|
74
|
+
email_verified_at: null,
|
|
75
|
+
created_at: new Date().toISOString(),
|
|
76
|
+
updated_at: new Date().toISOString(),
|
|
77
|
+
avatar: null,
|
|
78
|
+
two_factor_secret: null,
|
|
79
|
+
two_factor_recovery_codes: null,
|
|
80
|
+
is_bot: false,
|
|
81
|
+
profile_photo_url: '',
|
|
82
|
+
pivot: {
|
|
83
|
+
organization_id: 1,
|
|
84
|
+
user_id: 1,
|
|
85
|
+
role: 'owner',
|
|
86
|
+
created_at: new Date().toISOString(),
|
|
87
|
+
updated_at: new Date().toISOString()
|
|
88
|
+
}
|
|
89
|
+
}]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
events: []
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}, 500);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getFakeUploadUrlResponse","fileName","Promise","resolve","setTimeout","data","path","url","method","expires_at","Date","now","toISOString","fakeUploadToS3","onProgress","progress","interval","setInterval","Math","random","clearInterval","round","getFakeMediaMessageResponse","fileUrls","_mediaType","message","conversation_id","content","join","is_note","updated_at","created_at","id","floor","user","customer","bot","conversation","project_id","customer_id","deleted_at","language","use_ai_answers","project","name","organization_id","uuid","organization","owner","email","email_verified_at","avatar","two_factor_secret","two_factor_recovery_codes","is_bot","profile_photo_url","pivot","user_id","role","events"],"sourceRoot":"../../../../src","sources":["data/fake/media.ts"],"mappings":";;AAGA,OAAO,SAASA,wBAAwBA,CACtCC,QAAgB,EACY;EAC5B,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9BC,UAAU,CAAC,MAAM;MACfD,OAAO,CAAC;QACNE,IAAI,EAAE;UACJC,IAAI,EAAE,QAAQL,QAAQ,EAAE;UACxBM,GAAG,EAAE,gDAAgDN,QAAQ,cAAc;UAC3EO,MAAM,EAAE,KAAK;UACbC,UAAU,EAAE,IAAIC,IAAI,CAACA,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,CAACC,WAAW,CAAC;QACzD;MACF,CAAC,CAAC;IACJ,CAAC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AE;oBACLX,eAAe,EAAE,CAAC;oBAClBY,OAAO,EAAE,CAAC;oBACVC,IAAI,EAAE,OAAO;oBACb3B,UAAU,EAAE,IAAIrB,IAAI,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC;oBACpCkB,UAAU,EAAE,IAAIpB,IAAI,CAAC,CAAC,CAACE,WAAW,CAAC;kBACrC;gBACF,CAAC;cAEL;YACF;UACF,CAAC;UACD+C,MAAM,EAAE;QACV;MACF,CAAC,CAAC;IACJ,CAAC,EAAE,GAAG,CAAC;EACT,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/MediaTypes.ts"],"mappings":"","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MediaAsset } from './types/MediaTypes';
|
|
2
|
+
export declare function pickMedia(): Promise<MediaAsset[]>;
|
|
3
|
+
export declare function openVideo(uri: string): Promise<void>;
|
|
4
|
+
export declare function generateThumbnail(videoUrl: string): Promise<string | null>;
|
|
5
|
+
export declare function deleteTempFile(uri: string): Promise<void>;
|
|
6
|
+
export declare function cleanupTempFiles(): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=NativeComnyxMediaPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeComnyxMediaPicker.d.ts","sourceRoot":"","sources":["../../../src/NativeComnyxMediaPicker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,wBAAsB,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAwBvD;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM1D;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMxB;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/D;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKtD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { updateCustomer as createCustomer } from './customers';
|
|
2
2
|
export { getCustomerConversation, getNewCustomerConversation, } from './conversations';
|
|
3
3
|
export { sendCustomerMessage } from './messages';
|
|
4
|
+
export { getUploadUrl, uploadFileToS3, sendMediaMessage } from './media';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UploadUrlResponse } from '../types/MediaTypes';
|
|
2
|
+
import type { MessageResponse } from '../types/MessageResponse';
|
|
3
|
+
import type { ApiOptions } from '../types/ApiOptions';
|
|
4
|
+
export declare function getUploadUrl(fileName: string, contentType: string, options: ApiOptions): Promise<UploadUrlResponse>;
|
|
5
|
+
export declare function uploadFileToS3(uploadUrl: string, fileUri: string, contentType: string, onProgress?: (percentage: number) => void, options?: ApiOptions): Promise<void>;
|
|
6
|
+
export declare function sendMediaMessage(externalId: string, fileUrls: string[], mediaType: 'image' | 'video', content: string, options: ApiOptions): Promise<MessageResponse>;
|
|
7
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../../src/api/media.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAQtD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,iBAAiB,CAAC,CAU5B;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,EACzC,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,IAAI,CAAC,CAqDf;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,OAAO,GAAG,OAAO,EAC5B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,eAAe,CAAC,CAqB1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatList.tsx"],"names":[],"mappings":"AAsKA,wBAAgB,QAAQ,CAAC,EACvB,WAAW,EACX,MAAM,GACP,EAAE;IACD,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,2CAskBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkifyText.d.ts","sourceRoot":"","sources":["../../../../src/components/LinkifyText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9D,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC9C;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"LinkifyText.d.ts","sourceRoot":"","sources":["../../../../src/components/LinkifyText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9D,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC9C;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAwDD,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,GAAG,KAAK,EACT,EAAE,KAAK,2CAyBP"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AppConversationMessage } from '../types/Conversation';
|
|
2
|
+
export declare function MediaMessageItem({ item, onShowPopup, }: {
|
|
3
|
+
item: AppConversationMessage;
|
|
4
|
+
onShowPopup: () => void;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=MediaMessageItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaMessageItem.d.ts","sourceRoot":"","sources":["../../../../src/components/MediaMessageItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAsFpE,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,IAAI,EAAE,sBAAsB,CAAC;IAC7B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,2CA2KA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaPickerButton.d.ts","sourceRoot":"","sources":["../../../../src/components/MediaPickerButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,wBAAgB,iBAAiB,CAAC,EAChC,eAAe,GAChB,EAAE;IACD,eAAe,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CACjD,2CAoBA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function MediaViewerModal({ visible, onClose, mediaUri, mediaType, thumbnailUri, }: {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
mediaUri: string;
|
|
5
|
+
mediaType: 'image' | 'video';
|
|
6
|
+
thumbnailUri?: string | null;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=MediaViewerModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaViewerModal.d.ts","sourceRoot":"","sources":["../../../../src/components/MediaViewerModal.tsx"],"names":[],"mappings":"AAcA,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,GACb,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,2CAmEA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageInput.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,YAAY,CAAC,EAC3B,cAAc,GACf,EAAE;IACD,cAAc,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,2CAyWA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageItem.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageItem.d.ts","sourceRoot":"","sources":["../../../../src/components/MessageItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAyBpE,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,IAAI,EAAE,sBAAsB,CAAC;IAC7B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,2CASA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/constants/translations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/constants/translations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAyuD1D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UploadUrlResponse } from '../../types/MediaTypes';
|
|
2
|
+
import type { MessageResponse } from '../../types/MessageResponse';
|
|
3
|
+
export declare function getFakeUploadUrlResponse(fileName: string): Promise<UploadUrlResponse>;
|
|
4
|
+
export declare function fakeUploadToS3(onProgress?: (percentage: number) => void): Promise<void>;
|
|
5
|
+
export declare function getFakeMediaMessageResponse(fileUrls: string[], _mediaType: 'image' | 'video'): Promise<MessageResponse>;
|
|
6
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../../../src/data/fake/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,iBAAiB,CAAC,CAa5B;AAED,wBAAgB,cAAc,CAC5B,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,GACxC,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,OAAO,GAAG,OAAO,GAC5B,OAAO,CAAC,eAAe,CAAC,CAmE1B"}
|
|
@@ -8,13 +8,32 @@ export interface ConversationMessage {
|
|
|
8
8
|
name: string;
|
|
9
9
|
profile_photo_url: null;
|
|
10
10
|
} | null;
|
|
11
|
+
files?: Array<{
|
|
12
|
+
id: number;
|
|
13
|
+
mime_type: string;
|
|
14
|
+
url: string;
|
|
15
|
+
}> | null;
|
|
16
|
+
}
|
|
17
|
+
export interface MediaFile {
|
|
18
|
+
url: string;
|
|
19
|
+
type: 'image' | 'video';
|
|
20
|
+
local_uri?: string;
|
|
21
|
+
thumbnail_uri?: string;
|
|
11
22
|
}
|
|
12
23
|
export interface AppConversationMessage extends Omit<ConversationMessage, 'id' | 'created_at'> {
|
|
13
24
|
id: number | null;
|
|
25
|
+
local_id?: string;
|
|
14
26
|
approved?: boolean;
|
|
15
27
|
created_at: Date;
|
|
16
28
|
error?: boolean;
|
|
17
29
|
resending?: boolean;
|
|
30
|
+
media_url?: string | null;
|
|
31
|
+
media_type?: 'image' | 'video' | null;
|
|
32
|
+
media_local_uri?: string | null;
|
|
33
|
+
media_thumbnail_uri?: string | null;
|
|
34
|
+
media_files?: MediaFile[];
|
|
35
|
+
upload_progress?: number;
|
|
36
|
+
is_uploading?: boolean;
|
|
18
37
|
}
|
|
19
38
|
export interface ConversationPage {
|
|
20
39
|
current_page: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Conversation.d.ts","sourceRoot":"","sources":["../../../../src/types/Conversation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Conversation.d.ts","sourceRoot":"","sources":["../../../../src/types/Conversation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5D,KAAK,CAAC,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC,GAAG,IAAI,CAAC;CACX;AAED,MAAM,WAAW,SAAS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46
46
|
'notifications.optIn.cancel': string;
|
|
47
47
|
'notifications.optIn.openSettings': string;
|
|
48
48
|
'notifications.optIn.copyToClipboard': string;
|
|
49
|
+
'chat.media.uploading': string;
|
|
50
|
+
'chat.media.upload.failed': string;
|
|
51
|
+
'chat.media.pick.title': string;
|
|
52
|
+
'chat.media.pick.photo': string;
|
|
53
|
+
'chat.media.pick.video': string;
|
|
54
|
+
'chat.media.pick.cancel': string;
|
|
49
55
|
};
|
|
50
56
|
//# sourceMappingURL=LocalizationKeys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationKeys.d.ts","sourceRoot":"","sources":["../../../../src/types/LocalizationKeys.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,4BAA4B,EAAE,MAAM,CAAC;IACrC,6BAA6B,EAAE,MAAM,CAAC;IACtC,2BAA2B,EAAE,MAAM,CAAC;IACpC,2BAA2B,EAAE,MAAM,CAAC;IACpC,gCAAgC,EAAE,MAAM,CAAC;IACzC,mCAAmC,EAAE,MAAM,CAAC;IAC5C,iCAAiC,EAAE,MAAM,CAAC;IAC1C,iCAAiC,EAAE,MAAM,CAAC;IAC1C,wCAAwC,EAAE,MAAM,CAAC;IACjD,wCAAwC,EAAE,MAAM,CAAC;IACjD,4CAA4C,EAAE,MAAM,CAAC;IACrD,yCAAyC,EAAE,MAAM,CAAC;IAClD,wCAAwC,EAAE,MAAM,CAAC;IACjD,+BAA+B,EAAE,MAAM,CAAC;IACxC,6BAA6B,EAAE,MAAM,CAAC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM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E,MAAM,CAAC;IAC9C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0BAA0B,EAAE,MAAM,CAAC;IACnC,uBAAuB,EAAE,MAAM,CAAC;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface MediaAsset {
|
|
2
|
+
uri: string;
|
|
3
|
+
type: 'image' | 'video';
|
|
4
|
+
fileName: string;
|
|
5
|
+
fileSize: number;
|
|
6
|
+
mimeType: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
thumbnailUri?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UploadUrlResponse {
|
|
13
|
+
data: {
|
|
14
|
+
path: string;
|
|
15
|
+
url: string;
|
|
16
|
+
method: string;
|
|
17
|
+
expires_at: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface MediaFileDisplay {
|
|
21
|
+
url: string;
|
|
22
|
+
type: 'image' | 'video';
|
|
23
|
+
local_uri?: string;
|
|
24
|
+
thumbnail_uri?: string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=MediaTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaTypes.d.ts","sourceRoot":"","sources":["../../../../src/types/MediaTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.14.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developer_tribe/react-native-comnyx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import type { MediaAsset } from './types/MediaTypes';
|
|
3
|
+
|
|
4
|
+
const { ComnyxMediaPicker } = NativeModules;
|
|
5
|
+
|
|
6
|
+
export async function pickMedia(): Promise<MediaAsset[]> {
|
|
7
|
+
if (!ComnyxMediaPicker) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const results = await ComnyxMediaPicker.pickMedia();
|
|
11
|
+
if (!results || !Array.isArray(results) || results.length === 0) return [];
|
|
12
|
+
|
|
13
|
+
return results.map((result: any) => {
|
|
14
|
+
const isImage =
|
|
15
|
+
result.type === 'image' ||
|
|
16
|
+
(result.mimeType && result.mimeType.startsWith('image'));
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
uri: result.uri,
|
|
20
|
+
type: isImage ? ('image' as const) : ('video' as const),
|
|
21
|
+
fileName: result.fileName,
|
|
22
|
+
fileSize: result.fileSize,
|
|
23
|
+
mimeType: result.mimeType,
|
|
24
|
+
width: isImage ? result.width : undefined,
|
|
25
|
+
height: isImage ? result.height : undefined,
|
|
26
|
+
duration: isImage ? undefined : result.duration,
|
|
27
|
+
thumbnailUri: isImage ? undefined : result.thumbnailUri,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function openVideo(uri: string): Promise<void> {
|
|
33
|
+
if (!ComnyxMediaPicker) {
|
|
34
|
+
console.warn('[Comnyx] ComnyxMediaPicker native module is not available');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
await ComnyxMediaPicker.openVideo(uri);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function generateThumbnail(
|
|
41
|
+
videoUrl: string
|
|
42
|
+
): Promise<string | null> {
|
|
43
|
+
if (!ComnyxMediaPicker) {
|
|
44
|
+
console.warn('[Comnyx] ComnyxMediaPicker native module is not available');
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return ComnyxMediaPicker.generateThumbnail(videoUrl);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function deleteTempFile(uri: string): Promise<void> {
|
|
51
|
+
if (!ComnyxMediaPicker) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return ComnyxMediaPicker.deleteTempFile(uri);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function cleanupTempFiles(): Promise<void> {
|
|
58
|
+
if (!ComnyxMediaPicker) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
return ComnyxMediaPicker.cleanupTempFiles();
|
|
62
|
+
}
|
package/src/api/index.ts
CHANGED
package/src/api/media.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import type { UploadUrlResponse } from '../types/MediaTypes';
|
|
3
|
+
import type { MessageResponse } from '../types/MessageResponse';
|
|
4
|
+
import type { ApiOptions } from '../types/ApiOptions';
|
|
5
|
+
import { axiosInstance } from './api';
|
|
6
|
+
import {
|
|
7
|
+
getFakeUploadUrlResponse,
|
|
8
|
+
fakeUploadToS3,
|
|
9
|
+
getFakeMediaMessageResponse,
|
|
10
|
+
} from '../data/fake/media';
|
|
11
|
+
|
|
12
|
+
export function getUploadUrl(
|
|
13
|
+
fileName: string,
|
|
14
|
+
contentType: string,
|
|
15
|
+
options: ApiOptions
|
|
16
|
+
): Promise<UploadUrlResponse> {
|
|
17
|
+
if (options.fake) {
|
|
18
|
+
return getFakeUploadUrlResponse(fileName);
|
|
19
|
+
}
|
|
20
|
+
return axiosInstance
|
|
21
|
+
.post<UploadUrlResponse>('/api/media/presign', {
|
|
22
|
+
fileName,
|
|
23
|
+
fileType: contentType,
|
|
24
|
+
})
|
|
25
|
+
.then((res) => res.data);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function uploadFileToS3(
|
|
29
|
+
uploadUrl: string,
|
|
30
|
+
fileUri: string,
|
|
31
|
+
contentType: string,
|
|
32
|
+
onProgress?: (percentage: number) => void,
|
|
33
|
+
options?: ApiOptions
|
|
34
|
+
): Promise<void> {
|
|
35
|
+
if (options?.fake) {
|
|
36
|
+
return fakeUploadToS3(onProgress);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const xhr = new XMLHttpRequest();
|
|
41
|
+
|
|
42
|
+
xhr.upload.addEventListener('progress', (event) => {
|
|
43
|
+
if (event.lengthComputable && onProgress) {
|
|
44
|
+
const percentage = Math.min(
|
|
45
|
+
100,
|
|
46
|
+
Math.round((event.loaded / event.total) * 100)
|
|
47
|
+
);
|
|
48
|
+
onProgress(percentage);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
xhr.addEventListener('load', () => {
|
|
53
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
54
|
+
resolve();
|
|
55
|
+
} else {
|
|
56
|
+
console.error('[Comnyx] Upload failed:', xhr.status, xhr.responseText);
|
|
57
|
+
reject(new Error(`Upload failed with status ${xhr.status}`));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
xhr.addEventListener('error', () => {
|
|
62
|
+
console.error(
|
|
63
|
+
'[Comnyx] Upload XHR error, status:',
|
|
64
|
+
xhr.status,
|
|
65
|
+
'response:',
|
|
66
|
+
xhr.responseText
|
|
67
|
+
);
|
|
68
|
+
reject(new Error('Upload failed'));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
xhr.addEventListener('abort', () => {
|
|
72
|
+
reject(new Error('Upload aborted'));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
xhr.open('PUT', uploadUrl);
|
|
76
|
+
xhr.setRequestHeader('Content-Type', contentType);
|
|
77
|
+
|
|
78
|
+
// React Native supports sending file URIs directly via XHR
|
|
79
|
+
const file: any = {
|
|
80
|
+
uri: Platform.OS === 'android' ? fileUri : fileUri.replace('file://', ''),
|
|
81
|
+
type: contentType,
|
|
82
|
+
name: fileUri.split('/').pop() || 'file',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
xhr.send(file);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function sendMediaMessage(
|
|
90
|
+
externalId: string,
|
|
91
|
+
fileUrls: string[],
|
|
92
|
+
mediaType: 'image' | 'video',
|
|
93
|
+
content: string,
|
|
94
|
+
options: ApiOptions
|
|
95
|
+
): Promise<MessageResponse> {
|
|
96
|
+
if (options.fake) {
|
|
97
|
+
return getFakeMediaMessageResponse(fileUrls, mediaType);
|
|
98
|
+
}
|
|
99
|
+
return axiosInstance
|
|
100
|
+
.post<MessageResponse>(
|
|
101
|
+
'/api/customers/message',
|
|
102
|
+
{
|
|
103
|
+
externalId,
|
|
104
|
+
content,
|
|
105
|
+
files: fileUrls,
|
|
106
|
+
media_type: mediaType,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
headers: {
|
|
110
|
+
'Accept': 'application/json',
|
|
111
|
+
'Content-Type': 'application/json',
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
.then((res) => res.data);
|
|
116
|
+
}
|
|
Binary file
|
|
Binary file
|