@subiz/widget-v4 4.0.63 → 4.0.67
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/assets/less/chatbox.less +6 -1
- package/babel.config.js +2 -4
- package/compiled_src/bot.js +7 -1
- package/compiled_src/call/call.js +15 -12
- package/compiled_src/chatbox/ChatButton.js +3 -1
- package/compiled_src/chatbox/DropdownSelect.js +75 -66
- package/compiled_src/chatbox/Event.js +1 -0
- package/compiled_src/chatbox/MessageInput.js +7 -4
- package/compiled_src/chatbox/Order.js +94 -90
- package/compiled_src/chatbox/ProductAttachments.js +40 -4
- package/compiled_src/chatbox/Rating.js +10 -7
- package/compiled_src/chatbox/Typing.js +3 -1
- package/compiled_src/chatbox/Widget.js +27 -23
- package/compiled_src/chatbox/main.js +2 -0
- package/compiled_src/contact/contact.js +9 -6
- package/compiled_src/lib.js +14 -9
- package/compiled_src/notif/notif.js +15 -12
- package/compiled_src/order/address_picker.js +71 -63
- package/compiled_src/order/order.js +330 -316
- package/compiled_src/popup/countdown.js +7 -4
- package/compiled_src/popup/popup.js +12 -9
- package/compiled_src/store/api.js +110 -80
- package/compiled_src/store/api_fake.js +82 -55
- package/compiled_src/store/store.js +194 -135
- package/compiled_src/util/common.js +1 -1
- package/dist/132.js +678 -591
- package/dist/178.js +174 -341
- package/dist/17ff367201e.132.js +1 -0
- package/dist/17ff367201e.178.js +1 -0
- package/dist/17ff367201e.213.js +1 -0
- package/dist/17ff367201e.335.js +1 -0
- package/dist/17ff367201e.362.js +1 -0
- package/dist/17ff367201e.441.js +1 -0
- package/dist/17ff367201e.605.js +1 -0
- package/dist/17ff367201e.678.js +1 -0
- package/dist/17ff367201e.782.js +1 -0
- package/dist/17ff367201e.app.js +1 -0
- package/dist/{17e757ccadd.index.html → 17ff367201e.index.html} +1 -1
- package/dist/{17e757ccadd.library.html → 17ff367201e.library.html} +1 -1
- package/dist/17ff367201e.library.js +1 -0
- package/dist/{17e757ccadd.preview.html → 17ff367201e.preview.html} +1 -1
- package/dist/17ff367201e.preview.js +1 -0
- package/dist/17ff367201e.screenshoot.js +1 -0
- package/dist/213.js +19 -13
- package/dist/335.js +11 -8
- package/dist/362.js +21 -71
- package/dist/441.js +2 -2
- package/dist/605.js +15 -12
- package/dist/678.js +20 -70
- package/dist/782.js +21 -118
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +453 -332
- package/package.json +14 -14
- package/src/bot.js +2 -1
- package/src/chatbox/Buttons.js +8 -8
- package/src/chatbox/ChatButton.js +2 -2
- package/src/chatbox/Event.js +1 -1
- package/src/chatbox/ProductAttachments.js +41 -5
- package/src/chatbox/Typing.js +5 -1
- package/src/chatbox/main.js +4 -1
- package/src/store/store.js +24 -11
- package/src/util/common.js +1 -1
- package/up +1 -1
- package/dist/0b82fa7e5c3b07b40a44.png +0 -1
- package/dist/0f4af006e38ee8b93633.png +0 -1
- package/dist/17e757ccadd.132.js +0 -1
- package/dist/17e757ccadd.178.js +0 -1
- package/dist/17e757ccadd.213.js +0 -1
- package/dist/17e757ccadd.335.js +0 -1
- package/dist/17e757ccadd.362.js +0 -1
- package/dist/17e757ccadd.441.js +0 -1
- package/dist/17e757ccadd.605.js +0 -1
- package/dist/17e757ccadd.678.js +0 -1
- package/dist/17e757ccadd.782.js +0 -1
- package/dist/17e757ccadd.app.js +0 -1
- package/dist/17e757ccadd.library.js +0 -1
- package/dist/17e757ccadd.preview.js +0 -1
- package/dist/17e757ccadd.screenshoot.js +0 -1
- package/dist/1ea1c6cd21d25176810c.png +0 -1
- package/dist/292d42404e1b03398f61.png +0 -1
- package/dist/312d376370831b7bea83.png +0 -1
- package/dist/313d1bfc1cf776d1aefe.png +0 -1
- package/dist/4aa58bb7a66bb44975aa.png +0 -1
- package/dist/56ce063bc6c81adb7322.png +0 -1
- package/dist/6a411166ef5cc79e0714.png +0 -1
- package/dist/6faf403782fefacc1649.png +0 -1
- package/dist/79dca33c68fab79c067f.png +0 -1
- package/dist/82da1578fa84f9debaeb.png +0 -1
- package/dist/8b8e0f0824743974b282.png +0 -1
- package/dist/8d551390d81e39130a3c.png +0 -1
- package/dist/9fc61b9479877ebdb6c7.png +0 -1
- package/dist/a165d31dcb3dc90f1057.png +0 -1
- package/dist/a98d4a5698812c4426b3.png +0 -1
- package/dist/c41606bf9d1b604e46d5.png +0 -1
- package/dist/ce1f7450ce6c1aacd330.png +0 -1
- package/dist/cf8c01e88f4770a6e3e5.png +0 -1
- package/dist/dfbcfeab1d5622a737e2.png +0 -1
- package/dist/e4893ed8c2f7b8329919.png +0 -1
- package/dist/ec2ab4eb4ef73d186186.png +0 -1
|
@@ -15,6 +15,8 @@ var _common = require("../common.js");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
|
|
18
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
21
|
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -22,17 +24,18 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
22
24
|
let popupCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('./css.js'))))();
|
|
23
25
|
|
|
24
26
|
class Popup extends _common.Com {
|
|
25
|
-
state = {
|
|
26
|
-
close: false,
|
|
27
|
-
cssready: false,
|
|
28
|
-
closeAnimation: true,
|
|
29
|
-
pressedSubmit: false,
|
|
30
|
-
imageReady: false,
|
|
31
|
-
fontReady: false
|
|
32
|
-
};
|
|
33
|
-
|
|
34
27
|
constructor(props) {
|
|
35
28
|
super(props);
|
|
29
|
+
|
|
30
|
+
_defineProperty(this, "state", {
|
|
31
|
+
close: false,
|
|
32
|
+
cssready: false,
|
|
33
|
+
closeAnimation: true,
|
|
34
|
+
pressedSubmit: false,
|
|
35
|
+
imageReady: false,
|
|
36
|
+
fontReady: false
|
|
37
|
+
});
|
|
38
|
+
|
|
36
39
|
this._formRef = (0, _preact.createRef)();
|
|
37
40
|
setTimeout(() => this.fillForm(), 1000);
|
|
38
41
|
setTimeout(async () => {
|
|
@@ -9,6 +9,8 @@ var _index = _interopRequireDefault(require("../util/index.js"));
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
|
|
12
14
|
const ajax = require('@subiz/ajax/src/ajax.js');
|
|
13
15
|
|
|
14
16
|
ajax.env.XMLHttpRequest = window.XMLHttpRequest;
|
|
@@ -23,6 +25,114 @@ function jsonifyTextPlain(param, done) {
|
|
|
23
25
|
|
|
24
26
|
class _default {
|
|
25
27
|
constructor(ApiURL, FileURL) {
|
|
28
|
+
_defineProperty(this, "listConversations", _ => this.apireq.addQuery('user_id', this.uid).addQuery('integration_id', `${this.accid}.subizv4.subikon`).get('/conversations'));
|
|
29
|
+
|
|
30
|
+
_defineProperty(this, "listMessages", (cid, limit, start_id) => this.apireq.addQuery('limit', limit).addQuery('start_id', start_id).get(`/conversations/${cid}/messages`));
|
|
31
|
+
|
|
32
|
+
_defineProperty(this, "ajax", ajax);
|
|
33
|
+
|
|
34
|
+
_defineProperty(this, "start", extraData => {
|
|
35
|
+
let data = {
|
|
36
|
+
starter_id: this.uid,
|
|
37
|
+
starter_type: 'user',
|
|
38
|
+
integration_id: `${this.accid}.subizv4.subikon`
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
_index.default.each(extraData, (v, k) => {
|
|
42
|
+
data[k] = v;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return this.apireq.post('/conversations', data);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
_defineProperty(this, "sendConvoEvent", (cid, ev) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/events`, ev));
|
|
49
|
+
|
|
50
|
+
_defineProperty(this, "createPostback", (cid, p) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/postbacks`, p));
|
|
51
|
+
|
|
52
|
+
_defineProperty(this, "markAsReceived", (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/receive`));
|
|
53
|
+
|
|
54
|
+
_defineProperty(this, "markAsSeen", (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/seen`));
|
|
55
|
+
|
|
56
|
+
_defineProperty(this, "getConversation", cid => this.apireq.get(`/conversations/${cid}`));
|
|
57
|
+
|
|
58
|
+
_defineProperty(this, "getLocaleContent", locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`));
|
|
59
|
+
|
|
60
|
+
_defineProperty(this, "sendEvent", data => this.apireq.post(`/users/${this.uid}/events`, data));
|
|
61
|
+
|
|
62
|
+
_defineProperty(this, "sendTyping", cid => this.apireq.post(`/conversations/${cid}/typing`));
|
|
63
|
+
|
|
64
|
+
_defineProperty(this, "uploadToS3", async file => {
|
|
65
|
+
let {
|
|
66
|
+
body: signed,
|
|
67
|
+
error
|
|
68
|
+
} = await this.apireq.post(`/accounts/${this.accid}/files`, {
|
|
69
|
+
account_id: this.accid,
|
|
70
|
+
description: 'upload\n user-client: web-widget',
|
|
71
|
+
name: file.name.replace(/\s+/g, '_'),
|
|
72
|
+
size: file.size,
|
|
73
|
+
type: file.type
|
|
74
|
+
});
|
|
75
|
+
if (error) return {
|
|
76
|
+
error
|
|
77
|
+
};
|
|
78
|
+
let contentType = file.type || 'application/octet-stream';
|
|
79
|
+
({
|
|
80
|
+
error
|
|
81
|
+
} = await ajax.setContentType(contentType).put(signed.signed_url, file));
|
|
82
|
+
if (error) return {
|
|
83
|
+
error
|
|
84
|
+
};
|
|
85
|
+
let body;
|
|
86
|
+
({
|
|
87
|
+
body,
|
|
88
|
+
error
|
|
89
|
+
} = await this.apireq.post(`/accounts/${this.accid}/files/${signed.id}`, {
|
|
90
|
+
account_id: this.accid
|
|
91
|
+
}));
|
|
92
|
+
if (error) return {
|
|
93
|
+
error
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
url: this.FileURL + body.url
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
_defineProperty(this, "getChallenge", accid => this.apireq.post(`/accounts/${accid}/scrypt-challenges`));
|
|
101
|
+
|
|
102
|
+
_defineProperty(this, "time", _ => this.apireq.get('/time'));
|
|
103
|
+
|
|
104
|
+
_defineProperty(this, "updateUser", data => this.apireq.post(`/users/${this.uid}`, data));
|
|
105
|
+
|
|
106
|
+
_defineProperty(this, "getUser", _ => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}`));
|
|
107
|
+
|
|
108
|
+
_defineProperty(this, "getAccountSetting", () => this.apireq.get(`/accounts/${this.accid}/settings`));
|
|
109
|
+
|
|
110
|
+
_defineProperty(this, "getIsOnline", () => this.apireq.get(`/accounts/${this.accid}/is_online`));
|
|
111
|
+
|
|
112
|
+
_defineProperty(this, "sendImpression", impression => this.apireq.post(`/accounts/${this.accid}/campaigns/${impression.campaign_id}/impressions`, impression));
|
|
113
|
+
|
|
114
|
+
_defineProperty(this, "sendConversion", conversion => this.apireq.post(`/accounts/${this.accid}/campaigns/${conversion.campaign_id}/conversions`, conversion));
|
|
115
|
+
|
|
116
|
+
_defineProperty(this, "lookupOrder", key => ajax.setBaseUrl(this.ApiURL).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').addQuery('x-signed-key', key).get(`/orders/123`));
|
|
117
|
+
|
|
118
|
+
_defineProperty(this, "getOrder", id => this.apireq.get(`/accounts/${this.accid}/orders/` + id));
|
|
119
|
+
|
|
120
|
+
_defineProperty(this, "updateOrder", order => this.apireq.post(`/accounts/${this.accid}/orders/` + order.id, order));
|
|
121
|
+
|
|
122
|
+
_defineProperty(this, "fetchShippingAddresses", () => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`));
|
|
123
|
+
|
|
124
|
+
_defineProperty(this, "createShippingAddress", addr => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`, addr));
|
|
125
|
+
|
|
126
|
+
_defineProperty(this, "list_provinces", () => this.apireq.get(`/accounts/${this.accid}/provinces`));
|
|
127
|
+
|
|
128
|
+
_defineProperty(this, "list_districts", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/districts`));
|
|
129
|
+
|
|
130
|
+
_defineProperty(this, "list_wards", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`));
|
|
131
|
+
|
|
132
|
+
_defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
|
|
133
|
+
keyword: keyword
|
|
134
|
+
}).get(`/accounts/${this.accid}/addresses`));
|
|
135
|
+
|
|
26
136
|
this.FileURL = FileURL;
|
|
27
137
|
this.ApiURL = ApiURL;
|
|
28
138
|
this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
|
|
@@ -41,31 +151,6 @@ class _default {
|
|
|
41
151
|
this.uid = obj.uid;
|
|
42
152
|
}
|
|
43
153
|
|
|
44
|
-
listConversations = _ => this.apireq.addQuery('user_id', this.uid).addQuery('integration_id', `${this.accid}.subizv4.subikon`).get('/conversations');
|
|
45
|
-
listMessages = (cid, limit, start_id) => this.apireq.addQuery('limit', limit).addQuery('start_id', start_id).get(`/conversations/${cid}/messages`);
|
|
46
|
-
ajax = ajax;
|
|
47
|
-
start = extraData => {
|
|
48
|
-
let data = {
|
|
49
|
-
starter_id: this.uid,
|
|
50
|
-
starter_type: 'user',
|
|
51
|
-
integration_id: `${this.accid}.subizv4.subikon`
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
_index.default.each(extraData, (v, k) => {
|
|
55
|
-
data[k] = v;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return this.apireq.post('/conversations', data);
|
|
59
|
-
};
|
|
60
|
-
sendConvoEvent = (cid, ev) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/events`, ev);
|
|
61
|
-
createPostback = (cid, p) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/postbacks`, p);
|
|
62
|
-
markAsReceived = (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/receive`);
|
|
63
|
-
markAsSeen = (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/seen`);
|
|
64
|
-
getConversation = cid => this.apireq.get(`/conversations/${cid}`);
|
|
65
|
-
getLocaleContent = locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`);
|
|
66
|
-
sendEvent = data => this.apireq.post(`/users/${this.uid}/events`, data);
|
|
67
|
-
sendTyping = cid => this.apireq.post(`/conversations/${cid}/typing`);
|
|
68
|
-
|
|
69
154
|
sendPresence(device, is_focused) {
|
|
70
155
|
return this.sendEvent({
|
|
71
156
|
by: {
|
|
@@ -99,43 +184,6 @@ class _default {
|
|
|
99
184
|
});
|
|
100
185
|
}
|
|
101
186
|
|
|
102
|
-
uploadToS3 = async file => {
|
|
103
|
-
let {
|
|
104
|
-
body: signed,
|
|
105
|
-
error
|
|
106
|
-
} = await this.apireq.post(`/accounts/${this.accid}/files`, {
|
|
107
|
-
account_id: this.accid,
|
|
108
|
-
description: 'upload\n user-client: web-widget',
|
|
109
|
-
name: file.name.replace(/\s+/g, '_'),
|
|
110
|
-
size: file.size,
|
|
111
|
-
type: file.type
|
|
112
|
-
});
|
|
113
|
-
if (error) return {
|
|
114
|
-
error
|
|
115
|
-
};
|
|
116
|
-
let contentType = file.type || 'application/octet-stream';
|
|
117
|
-
({
|
|
118
|
-
error
|
|
119
|
-
} = await ajax.setContentType(contentType).put(signed.signed_url, file));
|
|
120
|
-
if (error) return {
|
|
121
|
-
error
|
|
122
|
-
};
|
|
123
|
-
let body;
|
|
124
|
-
({
|
|
125
|
-
body,
|
|
126
|
-
error
|
|
127
|
-
} = await this.apireq.post(`/accounts/${this.accid}/files/${signed.id}`, {
|
|
128
|
-
account_id: this.accid
|
|
129
|
-
}));
|
|
130
|
-
if (error) return {
|
|
131
|
-
error
|
|
132
|
-
};
|
|
133
|
-
return {
|
|
134
|
-
url: this.FileURL + body.url
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
getChallenge = accid => this.apireq.post(`/accounts/${accid}/scrypt-challenges`);
|
|
138
|
-
|
|
139
187
|
async createAgentUser(agenttoken) {
|
|
140
188
|
for (var i = 0; i < 10; i++) {
|
|
141
189
|
let {
|
|
@@ -178,24 +226,6 @@ class _default {
|
|
|
178
226
|
}
|
|
179
227
|
}
|
|
180
228
|
|
|
181
|
-
time = _ => this.apireq.get('/time');
|
|
182
|
-
updateUser = data => this.apireq.post(`/users/${this.uid}`, data);
|
|
183
|
-
getUser = _ => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}`);
|
|
184
|
-
getAccountSetting = () => this.apireq.get(`/accounts/${this.accid}/settings`);
|
|
185
|
-
getIsOnline = () => this.apireq.get(`/accounts/${this.accid}/is_online`);
|
|
186
|
-
sendImpression = impression => this.apireq.post(`/accounts/${this.accid}/campaigns/${impression.campaign_id}/impressions`, impression);
|
|
187
|
-
sendConversion = conversion => this.apireq.post(`/accounts/${this.accid}/campaigns/${conversion.campaign_id}/conversions`, conversion);
|
|
188
|
-
lookupOrder = key => ajax.setBaseUrl(this.ApiURL).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').addQuery('x-signed-key', key).get(`/orders/123`);
|
|
189
|
-
getOrder = id => this.apireq.get(`/accounts/${this.accid}/orders/` + id);
|
|
190
|
-
updateOrder = order => this.apireq.post(`/accounts/${this.accid}/orders/` + order.id, order);
|
|
191
|
-
fetchShippingAddresses = () => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`);
|
|
192
|
-
createShippingAddress = addr => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`, addr);
|
|
193
|
-
list_provinces = () => this.apireq.get(`/accounts/${this.accid}/provinces`);
|
|
194
|
-
list_districts = p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/districts`);
|
|
195
|
-
list_wards = p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`);
|
|
196
|
-
suggest_address = keyword => this.apireq.setQuery({
|
|
197
|
-
keyword: keyword
|
|
198
|
-
}).get(`/accounts/${this.accid}/addresses`);
|
|
199
229
|
}
|
|
200
230
|
|
|
201
231
|
exports.default = _default;
|
|
@@ -9,6 +9,8 @@ var _index = _interopRequireDefault(require("../util/index.js"));
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
|
|
12
14
|
const ajax = require('@subiz/ajax/src/ajax.js');
|
|
13
15
|
|
|
14
16
|
ajax.env.XMLHttpRequest = window.XMLHttpRequest;
|
|
@@ -27,6 +29,86 @@ const OK200 = Promise.resolve({
|
|
|
27
29
|
|
|
28
30
|
class _default {
|
|
29
31
|
constructor(ApiURL, FileURL) {
|
|
32
|
+
_defineProperty(this, "listConversations", _ => {
|
|
33
|
+
let convo = makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
34
|
+
return Promise.resolve({
|
|
35
|
+
body: {
|
|
36
|
+
anchor: '',
|
|
37
|
+
conversations: [convo]
|
|
38
|
+
},
|
|
39
|
+
code: 200
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
_defineProperty(this, "listMessages", (cid, limit, start_id) => {
|
|
44
|
+
let messages = makeFakeMessages(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
45
|
+
return Promise.resolve({
|
|
46
|
+
body: messages,
|
|
47
|
+
code: 200
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "ajax", ajax);
|
|
52
|
+
|
|
53
|
+
_defineProperty(this, "start", extraData => OK200);
|
|
54
|
+
|
|
55
|
+
_defineProperty(this, "sendConvoEvent", (cid, ev) => OK200);
|
|
56
|
+
|
|
57
|
+
_defineProperty(this, "createPostback", (cid, p) => OK200);
|
|
58
|
+
|
|
59
|
+
_defineProperty(this, "markAsReceived", (cid, messageId) => OK200);
|
|
60
|
+
|
|
61
|
+
_defineProperty(this, "markAsSeen", (cid, messageId) => OK200);
|
|
62
|
+
|
|
63
|
+
_defineProperty(this, "getConversation", cid => Promise.resolve({
|
|
64
|
+
body: makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid),
|
|
65
|
+
code: 200
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
_defineProperty(this, "getLocaleContent", locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`));
|
|
69
|
+
|
|
70
|
+
_defineProperty(this, "sendEvent", data => OK200);
|
|
71
|
+
|
|
72
|
+
_defineProperty(this, "sendTyping", cid => OK200);
|
|
73
|
+
|
|
74
|
+
_defineProperty(this, "sendPresence", data => OK200);
|
|
75
|
+
|
|
76
|
+
_defineProperty(this, "sendContent", data => OK200);
|
|
77
|
+
|
|
78
|
+
_defineProperty(this, "uploadToS3", async file => OK200);
|
|
79
|
+
|
|
80
|
+
_defineProperty(this, "getChallenge", accid => OK200);
|
|
81
|
+
|
|
82
|
+
_defineProperty(this, "createUser", accid => Promise.resolve({
|
|
83
|
+
account_id: accid,
|
|
84
|
+
id: 'usqzgtgfake',
|
|
85
|
+
mask: 'fakemask'
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
_defineProperty(this, "createAgentUser", agenttoken => Promise.resolve('fakemask'));
|
|
89
|
+
|
|
90
|
+
_defineProperty(this, "time", _ => Promise.resolve({
|
|
91
|
+
code: 200,
|
|
92
|
+
body: new _index.default.Date().toISOString()
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
_defineProperty(this, "updateUser", data => OK200);
|
|
96
|
+
|
|
97
|
+
_defineProperty(this, "getUser", _ => Promise.resolve({
|
|
98
|
+
code: 200,
|
|
99
|
+
body: {
|
|
100
|
+
id: '-'
|
|
101
|
+
}
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
_defineProperty(this, "getAccountSetting", () => this.apireq.get(`/accounts/${this.accid}/settings`));
|
|
105
|
+
|
|
106
|
+
_defineProperty(this, "getIsOnline", () => this.apireq.get(`/accounts/${this.accid}/is_online`));
|
|
107
|
+
|
|
108
|
+
_defineProperty(this, "sendImpression", impression => OK200);
|
|
109
|
+
|
|
110
|
+
_defineProperty(this, "sendConversion", conversion => OK200);
|
|
111
|
+
|
|
30
112
|
this.FileURL = FileURL;
|
|
31
113
|
this.apireq = ajax.setBaseUrl(ApiURL).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json');
|
|
32
114
|
}
|
|
@@ -41,61 +123,6 @@ class _default {
|
|
|
41
123
|
this.uid = obj.uid;
|
|
42
124
|
}
|
|
43
125
|
|
|
44
|
-
listConversations = _ => {
|
|
45
|
-
let convo = makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
46
|
-
return Promise.resolve({
|
|
47
|
-
body: {
|
|
48
|
-
anchor: '',
|
|
49
|
-
conversations: [convo]
|
|
50
|
-
},
|
|
51
|
-
code: 200
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
listMessages = (cid, limit, start_id) => {
|
|
55
|
-
let messages = makeFakeMessages(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
56
|
-
return Promise.resolve({
|
|
57
|
-
body: messages,
|
|
58
|
-
code: 200
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
ajax = ajax;
|
|
62
|
-
start = extraData => OK200;
|
|
63
|
-
sendConvoEvent = (cid, ev) => OK200;
|
|
64
|
-
createPostback = (cid, p) => OK200;
|
|
65
|
-
markAsReceived = (cid, messageId) => OK200;
|
|
66
|
-
markAsSeen = (cid, messageId) => OK200;
|
|
67
|
-
getConversation = cid => Promise.resolve({
|
|
68
|
-
body: makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid),
|
|
69
|
-
code: 200
|
|
70
|
-
});
|
|
71
|
-
getLocaleContent = locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`);
|
|
72
|
-
sendEvent = data => OK200;
|
|
73
|
-
sendTyping = cid => OK200;
|
|
74
|
-
sendPresence = data => OK200;
|
|
75
|
-
sendContent = data => OK200;
|
|
76
|
-
uploadToS3 = async file => OK200;
|
|
77
|
-
getChallenge = accid => OK200;
|
|
78
|
-
createUser = accid => Promise.resolve({
|
|
79
|
-
account_id: accid,
|
|
80
|
-
id: 'usqzgtgfake',
|
|
81
|
-
mask: 'fakemask'
|
|
82
|
-
});
|
|
83
|
-
createAgentUser = agenttoken => Promise.resolve('fakemask');
|
|
84
|
-
time = _ => Promise.resolve({
|
|
85
|
-
code: 200,
|
|
86
|
-
body: new _index.default.Date().toISOString()
|
|
87
|
-
});
|
|
88
|
-
updateUser = data => OK200;
|
|
89
|
-
getUser = _ => Promise.resolve({
|
|
90
|
-
code: 200,
|
|
91
|
-
body: {
|
|
92
|
-
id: '-'
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
getAccountSetting = () => this.apireq.get(`/accounts/${this.accid}/settings`);
|
|
96
|
-
getIsOnline = () => this.apireq.get(`/accounts/${this.accid}/is_online`);
|
|
97
|
-
sendImpression = impression => OK200;
|
|
98
|
-
sendConversion = conversion => OK200;
|
|
99
126
|
}
|
|
100
127
|
|
|
101
128
|
exports.default = _default;
|