@subiz/widget-v4 4.1.215 → 4.1.217
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/README.md +6 -0
- package/api.md +9 -5
- package/assets/img/bubble_default.svg +1 -0
- package/assets/less/message.less +83 -0
- package/assets/less/widget.less +12 -0
- package/compiled_src/chatbox/AudioAttachments.js +5 -0
- package/compiled_src/chatbox/ChatButton.js +19 -17
- package/compiled_src/chatbox/Event.js +9 -2
- package/compiled_src/chatbox/FileAttachments.js +9 -3
- package/compiled_src/chatbox/ImageAttachments.js +16 -6
- package/compiled_src/chatbox/UploadProgress.js +44 -0
- package/compiled_src/chatbox/VideoAttachments.js +5 -0
- package/compiled_src/store/api.js +77 -78
- package/compiled_src/store/api_fake.js +1 -1
- package/compiled_src/store/attachments.js +5 -1
- package/compiled_src/store/store.js +25 -4
- package/dist/{1a12a5ed6a9.278.js → 1a12ed33347.278.js} +1 -1
- package/dist/1a12ed33347.app.js +1 -0
- package/dist/{1a12a5ed6a9.chat.html → 1a12ed33347.chat.html} +1 -1
- package/dist/1a12ed33347.chat.js +1 -0
- package/dist/{1a12a5ed6a9.form.html → 1a12ed33347.form.html} +1 -1
- package/dist/{1a12a5ed6a9.form.js → 1a12ed33347.form.js} +1 -1
- package/dist/{1a12a5ed6a9.index.html → 1a12ed33347.index.html} +1 -1
- package/dist/{1a12a5ed6a9.library.html → 1a12ed33347.library.html} +1 -1
- package/dist/1a12ed33347.library.js +1 -0
- package/dist/{1a12a5ed6a9.preview.html → 1a12ed33347.preview.html} +1 -1
- package/dist/1a12ed33347.preview.js +1 -0
- package/dist/1a12ed33347.webview.js +1 -0
- package/dist/HASH +1 -0
- package/dist/assets/img/{bubble_default.7d5e4ab.svg → bubble_default.6f6eec8.svg} +1 -0
- package/dist/screenshoot.js +25 -20
- package/package.json +11 -10
- package/src/chatbox/AudioAttachments.js +2 -0
- package/src/chatbox/ChatButton.js +22 -20
- package/src/chatbox/Event.js +8 -4
- package/src/chatbox/FileAttachments.js +5 -2
- package/src/chatbox/ImageAttachments.js +6 -2
- package/src/chatbox/UploadProgress.js +21 -0
- package/src/chatbox/VideoAttachments.js +2 -0
- package/src/store/api.js +66 -81
- package/src/store/api_fake.js +1 -1
- package/src/store/attachments.js +5 -1
- package/src/store/store.js +13 -5
- package/up +18 -0
- package/dist/.HASH +0 -1
- package/dist/1a12a5ed6a9.app.js +0 -1
- package/dist/1a12a5ed6a9.chat.js +0 -1
- package/dist/1a12a5ed6a9.library.js +0 -1
- package/dist/1a12a5ed6a9.preview.js +0 -1
- package/dist/1a12a5ed6a9.webview.js +0 -1
- /package/dist/{1a12a5ed6a9.127.js → 1a12ed33347.127.js} +0 -0
- /package/dist/{1a12a5ed6a9.132.js → 1a12ed33347.132.js} +0 -0
- /package/dist/{1a12a5ed6a9.185.js → 1a12ed33347.185.js} +0 -0
- /package/dist/{1a12a5ed6a9.27.js → 1a12ed33347.27.js} +0 -0
- /package/dist/{1a12a5ed6a9.339.js → 1a12ed33347.339.js} +0 -0
- /package/dist/{1a12a5ed6a9.459.js → 1a12ed33347.459.js} +0 -0
- /package/dist/{1a12a5ed6a9.490.js → 1a12ed33347.490.js} +0 -0
|
@@ -885,10 +885,12 @@ class Store {
|
|
|
885
885
|
await this.readyGate.entry();
|
|
886
886
|
const key = websiteFormStorageKey(this.api, formid);
|
|
887
887
|
const kv = this.kv;
|
|
888
|
+
const values = _index.default.cloneDeep(payload.values);
|
|
888
889
|
const result = formResult(await this.api.submitWebsiteForm(formid, payload));
|
|
889
890
|
try {
|
|
890
891
|
kv.put(key, {
|
|
891
892
|
conversation_id: result.conversation_id,
|
|
893
|
+
values,
|
|
892
894
|
expires_at: _index.default.Date.now() + 7 * 24 * 60 * 60 * 1000
|
|
893
895
|
});
|
|
894
896
|
} catch (_) {}
|
|
@@ -919,7 +921,8 @@ class Store {
|
|
|
919
921
|
return {
|
|
920
922
|
submitted: true,
|
|
921
923
|
status: 'found',
|
|
922
|
-
conversation_id: receipt.conversation_id
|
|
924
|
+
conversation_id: receipt.conversation_id,
|
|
925
|
+
values: Array.isArray(receipt.values) ? _index.default.cloneDeep(receipt.values) : []
|
|
923
926
|
};
|
|
924
927
|
} catch (_) {
|
|
925
928
|
return {
|
|
@@ -1365,7 +1368,7 @@ class Store {
|
|
|
1365
1368
|
if (att.type !== 'file') return;
|
|
1366
1369
|
if (!att._file) return;
|
|
1367
1370
|
files.push(att);
|
|
1368
|
-
if (ImageTypes.includes(att._file.type)) {
|
|
1371
|
+
if (!att._upload?.file && ImageTypes.includes(att._file.type)) {
|
|
1369
1372
|
let {
|
|
1370
1373
|
width,
|
|
1371
1374
|
height,
|
|
@@ -1379,15 +1382,33 @@ class Store {
|
|
|
1379
1382
|
}
|
|
1380
1383
|
this.onWs(event);
|
|
1381
1384
|
await this.convoGate.entry();
|
|
1382
|
-
const uploaded = await (0, _attachments.uploadAttachments)(files, file => this.api.
|
|
1385
|
+
const uploaded = await (0, _attachments.uploadAttachments)(files, (file, state) => this.api.uploadAttachment(file, state, () => this.pubsub.publish('events', event)));
|
|
1383
1386
|
event._error = uploaded.error;
|
|
1384
1387
|
if (uploaded.errorMessage) event._error_message = uploaded.errorMessage;
|
|
1385
1388
|
if (event._error) return this.onWs(event);
|
|
1386
1389
|
if (cid && cid.startsWith('cslight')) return;
|
|
1390
|
+
const outgoing = {
|
|
1391
|
+
...event,
|
|
1392
|
+
data: {
|
|
1393
|
+
...event.data
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
if (event.data.message) outgoing.data.message = {
|
|
1397
|
+
...event.data.message,
|
|
1398
|
+
attachments: event.data.message.attachments?.map(att => {
|
|
1399
|
+
const {
|
|
1400
|
+
_file,
|
|
1401
|
+
_upload,
|
|
1402
|
+
...attachment
|
|
1403
|
+
} = att;
|
|
1404
|
+
return attachment;
|
|
1405
|
+
})
|
|
1406
|
+
};
|
|
1387
1407
|
let {
|
|
1388
1408
|
body: ret,
|
|
1389
1409
|
error
|
|
1390
|
-
} = await this.api.sendConvoEvent(cid,
|
|
1410
|
+
} = await this.api.sendConvoEvent(cid, outgoing);
|
|
1411
|
+
error = error || ret?.error;
|
|
1391
1412
|
if (error) {
|
|
1392
1413
|
event._error = error;
|
|
1393
1414
|
this.onWs(event);
|