@snugdesk/core 0.2.5 → 0.2.7
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/fesm2022/snugdesk-core.mjs +1111 -1079
- package/fesm2022/snugdesk-core.mjs.map +1 -1
- package/index.d.ts +725 -195
- package/package.json +1 -5
- package/fesm2022/snugdesk-core-src-lib-models-dynamodb.mjs +0 -25
- package/fesm2022/snugdesk-core-src-lib-models-dynamodb.mjs.map +0 -1
- package/src/lib/models/dynamodb/index.d.ts +0 -176
|
@@ -12,7 +12,6 @@ import { JwtHelperService } from '@auth0/angular-jwt';
|
|
|
12
12
|
import * as i1$2 from '@angular/common/http';
|
|
13
13
|
import { HttpHeaders } from '@angular/common/http';
|
|
14
14
|
import * as CryptoJS from 'crypto-js';
|
|
15
|
-
import * as uuid from 'uuid';
|
|
16
15
|
|
|
17
16
|
const SnugdeskAppConfig = {
|
|
18
17
|
appDomain: 'snugdesk.com',
|
|
@@ -1117,332 +1116,143 @@ var ModelSortDirection;
|
|
|
1117
1116
|
ModelSortDirection["DESC"] = "DESC";
|
|
1118
1117
|
})(ModelSortDirection || (ModelSortDirection = {}));
|
|
1119
1118
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1119
|
+
var InteractionChannel;
|
|
1120
|
+
(function (InteractionChannel) {
|
|
1121
|
+
InteractionChannel["EMAIL"] = "EMAIL";
|
|
1122
|
+
InteractionChannel["PHONE"] = "PHONE";
|
|
1123
|
+
InteractionChannel["SMS"] = "SMS";
|
|
1124
|
+
InteractionChannel["WEB_CHAT"] = "WEB_CHAT";
|
|
1125
|
+
InteractionChannel["SOCIAL_CHAT"] = "SOCIAL_CHAT";
|
|
1126
|
+
})(InteractionChannel || (InteractionChannel = {}));
|
|
1127
|
+
var InteractionContext;
|
|
1128
|
+
(function (InteractionContext) {
|
|
1129
|
+
InteractionContext["INTERNAL"] = "INTERNAL";
|
|
1130
|
+
InteractionContext["EXTERNAL"] = "EXTERNAL";
|
|
1131
|
+
})(InteractionContext || (InteractionContext = {}));
|
|
1132
|
+
var InteractionDirection;
|
|
1133
|
+
(function (InteractionDirection) {
|
|
1134
|
+
InteractionDirection["IN"] = "IN";
|
|
1135
|
+
InteractionDirection["OUT"] = "OUT";
|
|
1136
|
+
})(InteractionDirection || (InteractionDirection = {}));
|
|
1137
|
+
var InteractionStatus;
|
|
1138
|
+
(function (InteractionStatus) {
|
|
1139
|
+
InteractionStatus["INITIATED"] = "INITIATED";
|
|
1140
|
+
InteractionStatus["QUEUED"] = "QUEUED";
|
|
1141
|
+
InteractionStatus["RINGING"] = "RINGING";
|
|
1142
|
+
InteractionStatus["CONNECTED_TO_AGENT"] = "CONNECTED_TO_AGENT";
|
|
1143
|
+
InteractionStatus["CONNECTED_TO_BOT"] = "CONNECTED_TO_BOT";
|
|
1144
|
+
InteractionStatus["HELD"] = "HELD";
|
|
1145
|
+
InteractionStatus["DISCONNECTED"] = "DISCONNECTED";
|
|
1146
|
+
InteractionStatus["CANCELLED"] = "CANCELLED";
|
|
1147
|
+
InteractionStatus["REJECTED"] = "REJECTED";
|
|
1148
|
+
InteractionStatus["NO_ANSWER"] = "NO_ANSWER";
|
|
1149
|
+
InteractionStatus["MISSED"] = "MISSED";
|
|
1150
|
+
InteractionStatus["FAILED"] = "FAILED";
|
|
1151
|
+
})(InteractionStatus || (InteractionStatus = {}));
|
|
1152
|
+
var InteractionProvider;
|
|
1153
|
+
(function (InteractionProvider) {
|
|
1154
|
+
InteractionProvider["AVAYA_IPO"] = "AVAYA_IPO";
|
|
1155
|
+
InteractionProvider["FACEBOOK"] = "FACEBOOK";
|
|
1156
|
+
InteractionProvider["INSTAGRAM"] = "INSTAGRAM";
|
|
1157
|
+
InteractionProvider["OZONETEL"] = "OZONETEL";
|
|
1158
|
+
InteractionProvider["SNUGDESK"] = "SNUGDESK";
|
|
1159
|
+
InteractionProvider["TELEGRAM"] = "TELEGRAM";
|
|
1160
|
+
InteractionProvider["TELNYX"] = "TELNYX";
|
|
1161
|
+
InteractionProvider["WHATSAPP"] = "WHATSAPP";
|
|
1162
|
+
})(InteractionProvider || (InteractionProvider = {}));
|
|
1163
|
+
var InteractionRouteLogic;
|
|
1164
|
+
(function (InteractionRouteLogic) {
|
|
1165
|
+
InteractionRouteLogic["MOST_IDLE_AGENT"] = "MOST_IDLE_AGENT";
|
|
1166
|
+
InteractionRouteLogic["PARALLEL"] = "PARALLEL";
|
|
1167
|
+
})(InteractionRouteLogic || (InteractionRouteLogic = {}));
|
|
1168
|
+
|
|
1169
|
+
var TenantSSOConfigurationProtocol;
|
|
1170
|
+
(function (TenantSSOConfigurationProtocol) {
|
|
1171
|
+
TenantSSOConfigurationProtocol["SAML"] = "SAML";
|
|
1172
|
+
TenantSSOConfigurationProtocol["OIDC"] = "OIDC";
|
|
1173
|
+
})(TenantSSOConfigurationProtocol || (TenantSSOConfigurationProtocol = {}));
|
|
1174
|
+
|
|
1175
|
+
var UserStatus;
|
|
1176
|
+
(function (UserStatus) {
|
|
1177
|
+
UserStatus["READY"] = "READY";
|
|
1178
|
+
UserStatus["NOT_READY"] = "NOT_READY";
|
|
1179
|
+
UserStatus["INVITED"] = "INVITED";
|
|
1180
|
+
UserStatus["BUSY"] = "BUSY";
|
|
1181
|
+
UserStatus["AFTER_CALL_WORK"] = "AFTER_CALL_WORK";
|
|
1182
|
+
})(UserStatus || (UserStatus = {}));
|
|
1183
|
+
var UserType;
|
|
1184
|
+
(function (UserType) {
|
|
1185
|
+
UserType["AGENT"] = "AGENT";
|
|
1186
|
+
UserType["SUPERVISOR"] = "SUPERVISOR";
|
|
1187
|
+
UserType["ADMINISTRATOR"] = "ADMINISTRATOR";
|
|
1188
|
+
})(UserType || (UserType = {}));
|
|
1189
|
+
|
|
1190
|
+
const FIELDS_ENTITY_TYPE = `
|
|
1191
|
+
id
|
|
1192
|
+
externalId
|
|
1193
|
+
tenantId
|
|
1194
|
+
name
|
|
1195
|
+
description
|
|
1196
|
+
image {
|
|
1197
|
+
location
|
|
1198
|
+
}
|
|
1199
|
+
createdAt
|
|
1200
|
+
updatedAt
|
|
1201
|
+
deletedAt
|
|
1139
1202
|
`;
|
|
1140
|
-
const
|
|
1203
|
+
const FIELDS_ENTITY = `
|
|
1141
1204
|
id
|
|
1205
|
+
externalId
|
|
1142
1206
|
tenantId
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
externalId
|
|
1147
|
-
tenantId
|
|
1148
|
-
entityTypeId
|
|
1149
|
-
parentId
|
|
1150
|
-
name
|
|
1151
|
-
image {
|
|
1152
|
-
key
|
|
1153
|
-
bucket
|
|
1154
|
-
location
|
|
1155
|
-
}
|
|
1156
|
-
isOrganization
|
|
1157
|
-
email
|
|
1158
|
-
phoneNumber {
|
|
1159
|
-
countryCode
|
|
1160
|
-
dialCode
|
|
1161
|
-
e164Number
|
|
1162
|
-
internationalNumber
|
|
1163
|
-
nationalNumber
|
|
1164
|
-
number
|
|
1165
|
-
}
|
|
1166
|
-
notes
|
|
1167
|
-
customFields
|
|
1168
|
-
preferences {
|
|
1169
|
-
timezoneName
|
|
1170
|
-
language {
|
|
1171
|
-
code
|
|
1172
|
-
nameEn
|
|
1173
|
-
nameLocal
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
contactPreferences {
|
|
1177
|
-
allowCall
|
|
1178
|
-
allowEmail
|
|
1179
|
-
allowSMS
|
|
1180
|
-
allowWhatsApp
|
|
1181
|
-
}
|
|
1182
|
-
createdAt
|
|
1183
|
-
updatedAt
|
|
1184
|
-
blockedAt
|
|
1185
|
-
deletedAt
|
|
1186
|
-
}
|
|
1187
|
-
entityAddress
|
|
1188
|
-
interactionChannel
|
|
1189
|
-
interactionProvider
|
|
1190
|
-
isCampaignEngaged
|
|
1191
|
-
campaignId
|
|
1192
|
-
lastCampaignFlowNodeId
|
|
1193
|
-
lastInteractionMessageId
|
|
1194
|
-
metadata
|
|
1195
|
-
lastActivityAt
|
|
1196
|
-
lastMessageAt
|
|
1197
|
-
archivedAt
|
|
1198
|
-
blockedAt
|
|
1199
|
-
createdAt
|
|
1200
|
-
updatedAt
|
|
1201
|
-
deletedAt
|
|
1202
|
-
interactions (limit: 1, sortDirection: ${ModelSortDirection.DESC}) {
|
|
1203
|
-
items {
|
|
1204
|
-
id
|
|
1205
|
-
tenantId
|
|
1206
|
-
entityId
|
|
1207
|
-
entityConversationId
|
|
1208
|
-
teamId
|
|
1209
|
-
widgetId
|
|
1210
|
-
metadata
|
|
1211
|
-
subject
|
|
1212
|
-
direction
|
|
1213
|
-
status
|
|
1214
|
-
last_status
|
|
1215
|
-
hostId
|
|
1216
|
-
startedAt
|
|
1217
|
-
completedAt
|
|
1218
|
-
createdAt
|
|
1219
|
-
updatedAt
|
|
1220
|
-
deletedAt
|
|
1221
|
-
}
|
|
1222
|
-
nextToken
|
|
1223
|
-
}
|
|
1224
|
-
messages (limit: 1, sortDirection: ${ModelSortDirection.DESC}) {
|
|
1225
|
-
items {
|
|
1226
|
-
id
|
|
1227
|
-
externalId
|
|
1228
|
-
endpointId
|
|
1229
|
-
entityConversationId
|
|
1230
|
-
interactionId
|
|
1231
|
-
interactionAttendeeId
|
|
1232
|
-
referenceMessageId
|
|
1233
|
-
body
|
|
1234
|
-
metadata
|
|
1235
|
-
createdAt
|
|
1236
|
-
updatedAt
|
|
1237
|
-
deletedAt
|
|
1238
|
-
messageAttachments {
|
|
1239
|
-
items {
|
|
1240
|
-
id
|
|
1241
|
-
externalId
|
|
1242
|
-
interactionId
|
|
1243
|
-
interactionMessageId
|
|
1244
|
-
interactionId
|
|
1245
|
-
name
|
|
1246
|
-
size
|
|
1247
|
-
type
|
|
1248
|
-
file {
|
|
1249
|
-
key
|
|
1250
|
-
bucket
|
|
1251
|
-
location
|
|
1252
|
-
}
|
|
1253
|
-
createdAt
|
|
1254
|
-
updatedAt
|
|
1255
|
-
deletedAt
|
|
1256
|
-
}
|
|
1257
|
-
nextToken
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
nextToken
|
|
1261
|
-
}
|
|
1262
|
-
`;
|
|
1263
|
-
class EntityConversationService {
|
|
1264
|
-
appSyncService;
|
|
1265
|
-
constructor(appSyncService) {
|
|
1266
|
-
this.appSyncService = appSyncService;
|
|
1267
|
-
}
|
|
1268
|
-
async GetEntityConversation(id) {
|
|
1269
|
-
const statement = `query GetEntityConversation($id: ID!) {
|
|
1270
|
-
getEntityConversation(id: $id) {
|
|
1271
|
-
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
1272
|
-
}
|
|
1273
|
-
}`;
|
|
1274
|
-
const gqlAPIServiceArguments = { id };
|
|
1275
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1276
|
-
return response.data.getEntityConversation;
|
|
1277
|
-
}
|
|
1278
|
-
async CreateEntityConversation(input, condition) {
|
|
1279
|
-
const statement = `mutation CreateEntityConversation($input: CreateEntityConversationInput!, $condition: ModelEntityConversationConditionInput) {
|
|
1280
|
-
createEntityConversation(input: $input, condition: $condition) {
|
|
1281
|
-
${FIELDS_ENTITY_CONVERSATION}
|
|
1282
|
-
}
|
|
1283
|
-
}`;
|
|
1284
|
-
const gqlAPIServiceArguments = { input };
|
|
1285
|
-
if (condition) {
|
|
1286
|
-
gqlAPIServiceArguments.condition = condition;
|
|
1287
|
-
}
|
|
1288
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1289
|
-
return response.data.createEntityConversation;
|
|
1290
|
-
}
|
|
1291
|
-
async UpdateEntityConversation(input, condition) {
|
|
1292
|
-
const statement = `mutation UpdateEntityConversation($input: UpdateEntityConversationInput!, $condition: ModelEntityConversationConditionInput) {
|
|
1293
|
-
updateEntityConversation(input: $input, condition: $condition) {
|
|
1294
|
-
${FIELDS_ENTITY_CONVERSATION}
|
|
1295
|
-
}
|
|
1296
|
-
}`;
|
|
1297
|
-
const gqlAPIServiceArguments = { input };
|
|
1298
|
-
if (condition) {
|
|
1299
|
-
gqlAPIServiceArguments.condition = condition;
|
|
1300
|
-
}
|
|
1301
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1302
|
-
return response.data.updateEntityConversation;
|
|
1303
|
-
}
|
|
1304
|
-
async ListEntityConversationsByTenantIdAndEntityAddress(tenantId, entityAddress, sortDirection, filter, limit, nextToken) {
|
|
1305
|
-
const statement = `query ListEntityConversationsByTenantIdAndEntityAddress($tenantId: ID!, $entityAddress: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityConversationFilterInput, $limit: Int, $nextToken: String) {
|
|
1306
|
-
listEntityConversationsByTenantIdAndEntityAddress(
|
|
1307
|
-
tenantId: $tenantId
|
|
1308
|
-
entityAddress: $entityAddress
|
|
1309
|
-
sortDirection: $sortDirection
|
|
1310
|
-
filter: $filter
|
|
1311
|
-
limit: $limit
|
|
1312
|
-
nextToken: $nextToken
|
|
1313
|
-
) {
|
|
1314
|
-
items {
|
|
1315
|
-
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
1316
|
-
}
|
|
1317
|
-
nextToken
|
|
1318
|
-
}
|
|
1319
|
-
}`;
|
|
1320
|
-
const gqlAPIServiceArguments = { tenantId };
|
|
1321
|
-
if (entityAddress) {
|
|
1322
|
-
gqlAPIServiceArguments.entityAddress = entityAddress;
|
|
1323
|
-
}
|
|
1324
|
-
if (sortDirection) {
|
|
1325
|
-
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
1326
|
-
}
|
|
1327
|
-
if (filter) {
|
|
1328
|
-
gqlAPIServiceArguments.filter = filter;
|
|
1329
|
-
}
|
|
1330
|
-
if (limit) {
|
|
1331
|
-
gqlAPIServiceArguments.limit = limit;
|
|
1332
|
-
}
|
|
1333
|
-
if (nextToken) {
|
|
1334
|
-
gqlAPIServiceArguments.nextToken = nextToken;
|
|
1335
|
-
}
|
|
1336
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1337
|
-
return response.data.listEntityConversationsByTenantIdAndEntityAddress;
|
|
1207
|
+
entityTypeId
|
|
1208
|
+
entityType {
|
|
1209
|
+
${FIELDS_ENTITY_TYPE}
|
|
1338
1210
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
archivedAt: $archivedAt
|
|
1344
|
-
sortDirection: $sortDirection
|
|
1345
|
-
filter: $filter
|
|
1346
|
-
limit: $limit
|
|
1347
|
-
nextToken: $nextToken
|
|
1348
|
-
) {
|
|
1349
|
-
items {
|
|
1350
|
-
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
1351
|
-
}
|
|
1352
|
-
nextToken
|
|
1353
|
-
}
|
|
1354
|
-
}`;
|
|
1355
|
-
const gqlAPIServiceArguments = { tenantId };
|
|
1356
|
-
if (archivedAt) {
|
|
1357
|
-
gqlAPIServiceArguments.archivedAt = archivedAt;
|
|
1358
|
-
}
|
|
1359
|
-
if (sortDirection) {
|
|
1360
|
-
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
1361
|
-
}
|
|
1362
|
-
if (filter) {
|
|
1363
|
-
gqlAPIServiceArguments.filter = filter;
|
|
1364
|
-
}
|
|
1365
|
-
if (limit) {
|
|
1366
|
-
gqlAPIServiceArguments.limit = limit;
|
|
1367
|
-
}
|
|
1368
|
-
if (nextToken) {
|
|
1369
|
-
gqlAPIServiceArguments.nextToken = nextToken;
|
|
1370
|
-
}
|
|
1371
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1372
|
-
return response.data.listEntityConversationsByTenantIdAndArchivedAt;
|
|
1211
|
+
parentId
|
|
1212
|
+
name
|
|
1213
|
+
image {
|
|
1214
|
+
location
|
|
1373
1215
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
nextToken: $nextToken
|
|
1383
|
-
) {
|
|
1384
|
-
items {
|
|
1385
|
-
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
1386
|
-
}
|
|
1387
|
-
nextToken
|
|
1388
|
-
}
|
|
1389
|
-
}`;
|
|
1390
|
-
const gqlAPIServiceArguments = { tenantId };
|
|
1391
|
-
if (lastMessageAt) {
|
|
1392
|
-
gqlAPIServiceArguments.lastMessageAt = lastMessageAt;
|
|
1393
|
-
}
|
|
1394
|
-
if (sortDirection) {
|
|
1395
|
-
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
1396
|
-
}
|
|
1397
|
-
if (filter) {
|
|
1398
|
-
gqlAPIServiceArguments.filter = filter;
|
|
1399
|
-
}
|
|
1400
|
-
if (limit) {
|
|
1401
|
-
gqlAPIServiceArguments.limit = limit;
|
|
1402
|
-
}
|
|
1403
|
-
if (nextToken) {
|
|
1404
|
-
gqlAPIServiceArguments.nextToken = nextToken;
|
|
1405
|
-
}
|
|
1406
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1407
|
-
return response.data.listEntityConversationsByTenantIdAndLastMessageAt;
|
|
1216
|
+
email
|
|
1217
|
+
phoneNumber {
|
|
1218
|
+
countryCode
|
|
1219
|
+
dialCode
|
|
1220
|
+
e164Number
|
|
1221
|
+
internationalNumber
|
|
1222
|
+
nationalNumber
|
|
1223
|
+
number
|
|
1408
1224
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1225
|
+
phoneNumberE164
|
|
1226
|
+
isOrganization
|
|
1227
|
+
customFields
|
|
1228
|
+
metadata
|
|
1229
|
+
notes
|
|
1230
|
+
preferences {
|
|
1231
|
+
timezoneName
|
|
1232
|
+
language {
|
|
1233
|
+
code
|
|
1234
|
+
nameEn
|
|
1235
|
+
nameLocal
|
|
1236
|
+
}
|
|
1418
1237
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1238
|
+
contactPreferences {
|
|
1239
|
+
allowCall
|
|
1240
|
+
allowEmail
|
|
1241
|
+
allowSMS
|
|
1242
|
+
allowWhatsApp
|
|
1243
|
+
}
|
|
1244
|
+
createdAt
|
|
1245
|
+
updatedAt
|
|
1246
|
+
blockedAt
|
|
1247
|
+
deletedAt
|
|
1248
|
+
`;
|
|
1249
|
+
const FIELDS_ENTITY_EXPANDED = `
|
|
1430
1250
|
id
|
|
1431
1251
|
externalId
|
|
1432
1252
|
tenantId
|
|
1433
1253
|
entityTypeId
|
|
1434
1254
|
entityType {
|
|
1435
|
-
|
|
1436
|
-
externalId
|
|
1437
|
-
tenantId
|
|
1438
|
-
name
|
|
1439
|
-
description
|
|
1440
|
-
image {
|
|
1441
|
-
location
|
|
1442
|
-
}
|
|
1443
|
-
createdAt
|
|
1444
|
-
updatedAt
|
|
1445
|
-
deletedAt
|
|
1255
|
+
${FIELDS_ENTITY_TYPE}
|
|
1446
1256
|
}
|
|
1447
1257
|
parentId
|
|
1448
1258
|
parent {
|
|
@@ -1485,6 +1295,9 @@ const ENTITY_SELECTION = /* GraphQL */ `
|
|
|
1485
1295
|
number
|
|
1486
1296
|
}
|
|
1487
1297
|
phoneNumberE164
|
|
1298
|
+
customFields
|
|
1299
|
+
metadata
|
|
1300
|
+
notes
|
|
1488
1301
|
preferences {
|
|
1489
1302
|
timezoneName
|
|
1490
1303
|
language {
|
|
@@ -1504,10 +1317,11 @@ const ENTITY_SELECTION = /* GraphQL */ `
|
|
|
1504
1317
|
blockedAt
|
|
1505
1318
|
deletedAt
|
|
1506
1319
|
`;
|
|
1507
|
-
const
|
|
1320
|
+
const FIELDS_ENTITY_MINIMAL = `
|
|
1508
1321
|
id
|
|
1509
1322
|
externalId
|
|
1510
1323
|
tenantId
|
|
1324
|
+
metadata
|
|
1511
1325
|
name
|
|
1512
1326
|
image {
|
|
1513
1327
|
location
|
|
@@ -1550,7 +1364,7 @@ class EntityService {
|
|
|
1550
1364
|
const statement = /* GraphQL */ `
|
|
1551
1365
|
query GetEntity($id: ID!) {
|
|
1552
1366
|
getEntity(id: $id) {
|
|
1553
|
-
${
|
|
1367
|
+
${FIELDS_ENTITY_EXPANDED}
|
|
1554
1368
|
}
|
|
1555
1369
|
}
|
|
1556
1370
|
`;
|
|
@@ -1561,7 +1375,7 @@ class EntityService {
|
|
|
1561
1375
|
const statement = /* GraphQL */ `
|
|
1562
1376
|
mutation CreateEntity($input: CreateEntityInput!, $condition: ModelEntityConditionInput) {
|
|
1563
1377
|
createEntity(input: $input, condition: $condition) {
|
|
1564
|
-
${
|
|
1378
|
+
${FIELDS_ENTITY}
|
|
1565
1379
|
}
|
|
1566
1380
|
}
|
|
1567
1381
|
`;
|
|
@@ -1576,7 +1390,7 @@ class EntityService {
|
|
|
1576
1390
|
const statement = /* GraphQL */ `
|
|
1577
1391
|
mutation UpdateEntity($input: UpdateEntityInput!, $condition: ModelEntityConditionInput) {
|
|
1578
1392
|
updateEntity(input: $input, condition: $condition) {
|
|
1579
|
-
${
|
|
1393
|
+
${FIELDS_ENTITY}
|
|
1580
1394
|
}
|
|
1581
1395
|
}
|
|
1582
1396
|
`;
|
|
@@ -1598,7 +1412,7 @@ class EntityService {
|
|
|
1598
1412
|
nextToken: $nextToken
|
|
1599
1413
|
) {
|
|
1600
1414
|
items {
|
|
1601
|
-
${
|
|
1415
|
+
${FIELDS_ENTITY}
|
|
1602
1416
|
}
|
|
1603
1417
|
nextToken
|
|
1604
1418
|
}
|
|
@@ -1635,7 +1449,7 @@ class EntityService {
|
|
|
1635
1449
|
nextToken: $nextToken
|
|
1636
1450
|
) {
|
|
1637
1451
|
items {
|
|
1638
|
-
${
|
|
1452
|
+
${FIELDS_ENTITY}
|
|
1639
1453
|
}
|
|
1640
1454
|
nextToken
|
|
1641
1455
|
}
|
|
@@ -1661,6 +1475,36 @@ class EntityService {
|
|
|
1661
1475
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1662
1476
|
return response.data.listEntitiesByTenantIdAndPhoneNumberE164;
|
|
1663
1477
|
}
|
|
1478
|
+
async ListEntityTypesByTenantId(tenantId, name, sortDirection, filter, limit, nextToken) {
|
|
1479
|
+
const statement = `query ListEntityTypesByTenantId($tenantId: ID!, $name: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityTypeFilterInput, $limit: Int, $nextToken: String) {
|
|
1480
|
+
listEntityTypesByTenantId(tenantId: $tenantId, name: $name, sortDirection: $sortDirection, filter: $filter, limit: $limit, nextToken: $nextToken) {
|
|
1481
|
+
items {
|
|
1482
|
+
${FIELDS_ENTITY_TYPE}
|
|
1483
|
+
}
|
|
1484
|
+
nextToken
|
|
1485
|
+
}
|
|
1486
|
+
}`;
|
|
1487
|
+
const gqlAPIServiceArguments = {
|
|
1488
|
+
tenantId,
|
|
1489
|
+
};
|
|
1490
|
+
if (name) {
|
|
1491
|
+
gqlAPIServiceArguments.name = name;
|
|
1492
|
+
}
|
|
1493
|
+
if (sortDirection) {
|
|
1494
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
1495
|
+
}
|
|
1496
|
+
if (filter) {
|
|
1497
|
+
gqlAPIServiceArguments.filter = filter;
|
|
1498
|
+
}
|
|
1499
|
+
if (limit) {
|
|
1500
|
+
gqlAPIServiceArguments.limit = limit;
|
|
1501
|
+
}
|
|
1502
|
+
if (nextToken) {
|
|
1503
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
1504
|
+
}
|
|
1505
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1506
|
+
return response.data.listEntityTypesByTenantId;
|
|
1507
|
+
}
|
|
1664
1508
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1665
1509
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, providedIn: 'root' });
|
|
1666
1510
|
}
|
|
@@ -1671,6 +1515,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1671
1515
|
}]
|
|
1672
1516
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
1673
1517
|
|
|
1518
|
+
const FIELDS_INTERACTION_ENDPOINT = `
|
|
1519
|
+
id
|
|
1520
|
+
externalId
|
|
1521
|
+
tenantId
|
|
1522
|
+
widgetId
|
|
1523
|
+
address
|
|
1524
|
+
configuration
|
|
1525
|
+
createdAt
|
|
1526
|
+
updatedAt
|
|
1527
|
+
deletedAt
|
|
1528
|
+
`;
|
|
1674
1529
|
class InteractionEndpointService {
|
|
1675
1530
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionEndpointService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1676
1531
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionEndpointService, providedIn: 'root' });
|
|
@@ -1704,6 +1559,18 @@ const FIELDS_INTERACTION_WIDGET = `
|
|
|
1704
1559
|
updatedAt
|
|
1705
1560
|
deletedAt
|
|
1706
1561
|
`;
|
|
1562
|
+
const FIELDS_INTERACTION_WIDGET_USER_SETTING = `
|
|
1563
|
+
id
|
|
1564
|
+
widgetId
|
|
1565
|
+
userId
|
|
1566
|
+
configuration
|
|
1567
|
+
allowOverride
|
|
1568
|
+
createdAt
|
|
1569
|
+
updatedAt
|
|
1570
|
+
deletedAt
|
|
1571
|
+
updatedByUserId
|
|
1572
|
+
updatedByUserSessionId
|
|
1573
|
+
`;
|
|
1707
1574
|
class InteractionWidgetService {
|
|
1708
1575
|
appSyncService;
|
|
1709
1576
|
constructor(appSyncService) {
|
|
@@ -1754,65 +1621,230 @@ class InteractionWidgetService {
|
|
|
1754
1621
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1755
1622
|
return response.data.listInteractionWidgetsByTenantId;
|
|
1756
1623
|
}
|
|
1624
|
+
async ListInteractionWidgetUserSettingsByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
1625
|
+
const statement = `query ListInteractionWidgetUserSettingsByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionWidgetUserSettingFilterInput, $limit: Int, $nextToken: String) {
|
|
1626
|
+
listInteractionWidgetUserSettingsByUserId(
|
|
1627
|
+
userId: $userId
|
|
1628
|
+
createdAt: $createdAt
|
|
1629
|
+
sortDirection: $sortDirection
|
|
1630
|
+
filter: $filter
|
|
1631
|
+
limit: $limit
|
|
1632
|
+
nextToken: $nextToken
|
|
1633
|
+
) {
|
|
1634
|
+
items {
|
|
1635
|
+
${FIELDS_INTERACTION_WIDGET_USER_SETTING}
|
|
1636
|
+
}
|
|
1637
|
+
nextToken
|
|
1638
|
+
}
|
|
1639
|
+
}`;
|
|
1640
|
+
const gqlAPIServiceArguments = { userId };
|
|
1641
|
+
if (createdAt) {
|
|
1642
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
1643
|
+
}
|
|
1644
|
+
if (sortDirection) {
|
|
1645
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
1646
|
+
}
|
|
1647
|
+
if (filter) {
|
|
1648
|
+
gqlAPIServiceArguments.filter = filter;
|
|
1649
|
+
}
|
|
1650
|
+
if (limit) {
|
|
1651
|
+
gqlAPIServiceArguments.limit = limit;
|
|
1652
|
+
}
|
|
1653
|
+
if (nextToken) {
|
|
1654
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
1655
|
+
}
|
|
1656
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1657
|
+
return response.data.listInteractionWidgetUserSettingsByUserId;
|
|
1658
|
+
}
|
|
1757
1659
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionWidgetService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1758
1660
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionWidgetService, providedIn: 'root' });
|
|
1759
1661
|
}
|
|
1760
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionWidgetService, decorators: [{
|
|
1662
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionWidgetService, decorators: [{
|
|
1663
|
+
type: Injectable,
|
|
1664
|
+
args: [{
|
|
1665
|
+
providedIn: 'root',
|
|
1666
|
+
}]
|
|
1667
|
+
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
1668
|
+
|
|
1669
|
+
const FIELDS_USER = `
|
|
1670
|
+
id
|
|
1671
|
+
externalId
|
|
1672
|
+
tenantId
|
|
1673
|
+
email
|
|
1674
|
+
name
|
|
1675
|
+
image {
|
|
1676
|
+
key
|
|
1677
|
+
bucket
|
|
1678
|
+
location
|
|
1679
|
+
}
|
|
1680
|
+
phoneNumber {
|
|
1681
|
+
countryCode
|
|
1682
|
+
dialCode
|
|
1683
|
+
e164Number
|
|
1684
|
+
internationalNumber
|
|
1685
|
+
nationalNumber
|
|
1686
|
+
number
|
|
1687
|
+
}
|
|
1688
|
+
preferences {
|
|
1689
|
+
timezoneName
|
|
1690
|
+
language {
|
|
1691
|
+
code
|
|
1692
|
+
nameEn
|
|
1693
|
+
nameLocal
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
notificationSettings {
|
|
1697
|
+
allowPush
|
|
1698
|
+
allowEmail
|
|
1699
|
+
allowSMS
|
|
1700
|
+
allowWhatsApp
|
|
1701
|
+
}
|
|
1702
|
+
type
|
|
1703
|
+
activatedAt
|
|
1704
|
+
blockedAt
|
|
1705
|
+
createdAt
|
|
1706
|
+
updatedAt
|
|
1707
|
+
deletedAt
|
|
1708
|
+
`;
|
|
1709
|
+
class UserService {
|
|
1710
|
+
appSyncService;
|
|
1711
|
+
constructor(appSyncService) {
|
|
1712
|
+
this.appSyncService = appSyncService;
|
|
1713
|
+
}
|
|
1714
|
+
async GetUser(id) {
|
|
1715
|
+
const statement = `query GetUser($id: ID!) {
|
|
1716
|
+
getUser(id: $id) {
|
|
1717
|
+
${FIELDS_USER}
|
|
1718
|
+
}
|
|
1719
|
+
}`;
|
|
1720
|
+
const gqlAPIServiceArguments = { id };
|
|
1721
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1722
|
+
return response.data.getUser;
|
|
1723
|
+
}
|
|
1724
|
+
OnUserByIdListener(id) {
|
|
1725
|
+
const statement = `subscription OnUserById($id: ID!) {
|
|
1726
|
+
OnUserById(id: $id) {
|
|
1727
|
+
${FIELDS_USER}
|
|
1728
|
+
}
|
|
1729
|
+
}`;
|
|
1730
|
+
const gqlAPIServiceArguments = { id };
|
|
1731
|
+
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
1732
|
+
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnUserById">>>; */
|
|
1733
|
+
}
|
|
1734
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1735
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
1736
|
+
}
|
|
1737
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, decorators: [{
|
|
1738
|
+
type: Injectable,
|
|
1739
|
+
args: [{
|
|
1740
|
+
providedIn: 'root',
|
|
1741
|
+
}]
|
|
1742
|
+
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
1743
|
+
|
|
1744
|
+
const FIELDS_TEAM = `
|
|
1745
|
+
id
|
|
1746
|
+
tenantId
|
|
1747
|
+
name
|
|
1748
|
+
description
|
|
1749
|
+
image {
|
|
1750
|
+
key
|
|
1751
|
+
bucket
|
|
1752
|
+
location
|
|
1753
|
+
}
|
|
1754
|
+
ticketFields
|
|
1755
|
+
createdAt
|
|
1756
|
+
updatedAt
|
|
1757
|
+
deletedAt
|
|
1758
|
+
`;
|
|
1759
|
+
const FIELDS_TEAM_MEMBER = `
|
|
1760
|
+
id
|
|
1761
|
+
teamId
|
|
1762
|
+
team {
|
|
1763
|
+
${FIELDS_TEAM}
|
|
1764
|
+
}
|
|
1765
|
+
userId
|
|
1766
|
+
user {
|
|
1767
|
+
${FIELDS_USER}
|
|
1768
|
+
}
|
|
1769
|
+
isManager
|
|
1770
|
+
createdAt
|
|
1771
|
+
updatedAt
|
|
1772
|
+
deletedAt
|
|
1773
|
+
`;
|
|
1774
|
+
class TeamService {
|
|
1775
|
+
appSyncService;
|
|
1776
|
+
constructor(appSyncService) {
|
|
1777
|
+
this.appSyncService = appSyncService;
|
|
1778
|
+
}
|
|
1779
|
+
async GetTeam(id) {
|
|
1780
|
+
const statement = `query GetTeam($id: ID!) {
|
|
1781
|
+
getTeam(id: $id) {
|
|
1782
|
+
${FIELDS_TEAM}
|
|
1783
|
+
}
|
|
1784
|
+
}`;
|
|
1785
|
+
const gqlAPIServiceArguments = {
|
|
1786
|
+
id,
|
|
1787
|
+
};
|
|
1788
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1789
|
+
return response.data.getTeam;
|
|
1790
|
+
}
|
|
1791
|
+
async ListTeamMembershipsByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
1792
|
+
const statement = `query ListTeamMembershipsByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelTeamMemberFilterInput, $limit: Int, $nextToken: String) {
|
|
1793
|
+
listTeamMembershipsByUserId(
|
|
1794
|
+
userId: $userId
|
|
1795
|
+
createdAt: $createdAt
|
|
1796
|
+
sortDirection: $sortDirection
|
|
1797
|
+
filter: $filter
|
|
1798
|
+
limit: $limit
|
|
1799
|
+
nextToken: $nextToken
|
|
1800
|
+
) {
|
|
1801
|
+
items {
|
|
1802
|
+
${FIELDS_TEAM_MEMBER}
|
|
1803
|
+
}
|
|
1804
|
+
nextToken
|
|
1805
|
+
}
|
|
1806
|
+
}`;
|
|
1807
|
+
const gqlAPIServiceArguments = {
|
|
1808
|
+
userId,
|
|
1809
|
+
};
|
|
1810
|
+
if (createdAt) {
|
|
1811
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
1812
|
+
}
|
|
1813
|
+
if (sortDirection) {
|
|
1814
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
1815
|
+
}
|
|
1816
|
+
if (filter) {
|
|
1817
|
+
gqlAPIServiceArguments.filter = filter;
|
|
1818
|
+
}
|
|
1819
|
+
if (limit) {
|
|
1820
|
+
gqlAPIServiceArguments.limit = limit;
|
|
1821
|
+
}
|
|
1822
|
+
if (nextToken) {
|
|
1823
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
1824
|
+
}
|
|
1825
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
1826
|
+
return response.data.listTeamMembershipsByUserId;
|
|
1827
|
+
}
|
|
1828
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1829
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, providedIn: 'root' });
|
|
1830
|
+
}
|
|
1831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, decorators: [{
|
|
1761
1832
|
type: Injectable,
|
|
1762
1833
|
args: [{
|
|
1763
1834
|
providedIn: 'root',
|
|
1764
1835
|
}]
|
|
1765
1836
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
1766
1837
|
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
InteractionContext["INTERNAL"] = "INTERNAL";
|
|
1778
|
-
InteractionContext["EXTERNAL"] = "EXTERNAL";
|
|
1779
|
-
})(InteractionContext || (InteractionContext = {}));
|
|
1780
|
-
var InteractionDirection;
|
|
1781
|
-
(function (InteractionDirection) {
|
|
1782
|
-
InteractionDirection["IN"] = "IN";
|
|
1783
|
-
InteractionDirection["OUT"] = "OUT";
|
|
1784
|
-
})(InteractionDirection || (InteractionDirection = {}));
|
|
1785
|
-
var InteractionStatus;
|
|
1786
|
-
(function (InteractionStatus) {
|
|
1787
|
-
InteractionStatus["INITIATED"] = "INITIATED";
|
|
1788
|
-
InteractionStatus["QUEUED"] = "QUEUED";
|
|
1789
|
-
InteractionStatus["RINGING"] = "RINGING";
|
|
1790
|
-
InteractionStatus["CONNECTED_TO_AGENT"] = "CONNECTED_TO_AGENT";
|
|
1791
|
-
InteractionStatus["CONNECTED_TO_BOT"] = "CONNECTED_TO_BOT";
|
|
1792
|
-
InteractionStatus["HELD"] = "HELD";
|
|
1793
|
-
InteractionStatus["DISCONNECTED"] = "DISCONNECTED";
|
|
1794
|
-
InteractionStatus["CANCELLED"] = "CANCELLED";
|
|
1795
|
-
InteractionStatus["REJECTED"] = "REJECTED";
|
|
1796
|
-
InteractionStatus["NO_ANSWER"] = "NO_ANSWER";
|
|
1797
|
-
InteractionStatus["MISSED"] = "MISSED";
|
|
1798
|
-
InteractionStatus["FAILED"] = "FAILED";
|
|
1799
|
-
})(InteractionStatus || (InteractionStatus = {}));
|
|
1800
|
-
var InteractionProvider;
|
|
1801
|
-
(function (InteractionProvider) {
|
|
1802
|
-
InteractionProvider["AVAYA_IPO"] = "AVAYA_IPO";
|
|
1803
|
-
InteractionProvider["FACEBOOK"] = "FACEBOOK";
|
|
1804
|
-
InteractionProvider["INSTAGRAM"] = "INSTAGRAM";
|
|
1805
|
-
InteractionProvider["OZONETEL"] = "OZONETEL";
|
|
1806
|
-
InteractionProvider["SNUGDESK"] = "SNUGDESK";
|
|
1807
|
-
InteractionProvider["TELEGRAM"] = "TELEGRAM";
|
|
1808
|
-
InteractionProvider["TELNYX"] = "TELNYX";
|
|
1809
|
-
InteractionProvider["WHATSAPP"] = "WHATSAPP";
|
|
1810
|
-
})(InteractionProvider || (InteractionProvider = {}));
|
|
1811
|
-
var InteractionRouteLogic;
|
|
1812
|
-
(function (InteractionRouteLogic) {
|
|
1813
|
-
InteractionRouteLogic["MOST_IDLE_AGENT"] = "MOST_IDLE_AGENT";
|
|
1814
|
-
InteractionRouteLogic["PARALLEL"] = "PARALLEL";
|
|
1815
|
-
})(InteractionRouteLogic || (InteractionRouteLogic = {}));
|
|
1838
|
+
const FIELDS_INTERACTION_HOST = `
|
|
1839
|
+
id
|
|
1840
|
+
interactionId
|
|
1841
|
+
entityId
|
|
1842
|
+
teamId
|
|
1843
|
+
userId
|
|
1844
|
+
createdAt
|
|
1845
|
+
updatedAt
|
|
1846
|
+
deletedAt
|
|
1847
|
+
`;
|
|
1816
1848
|
const FIELDS_INTERACTION = `
|
|
1817
1849
|
id
|
|
1818
1850
|
tenantId
|
|
@@ -1822,6 +1854,9 @@ const FIELDS_INTERACTION = `
|
|
|
1822
1854
|
entityId
|
|
1823
1855
|
teamId
|
|
1824
1856
|
hostId
|
|
1857
|
+
host {
|
|
1858
|
+
${FIELDS_INTERACTION_HOST}
|
|
1859
|
+
}
|
|
1825
1860
|
providerInteractionId
|
|
1826
1861
|
channel
|
|
1827
1862
|
provider
|
|
@@ -1849,115 +1884,27 @@ const FIELDS_INTERACTION_EXPANDED = `
|
|
|
1849
1884
|
tenantId
|
|
1850
1885
|
widgetId
|
|
1851
1886
|
widget {
|
|
1852
|
-
|
|
1853
|
-
tenantId
|
|
1854
|
-
channel
|
|
1855
|
-
provider
|
|
1856
|
-
providerAccountId
|
|
1857
|
-
name
|
|
1858
|
-
description
|
|
1859
|
-
configuration
|
|
1860
|
-
isRecordingEnabledByDefault
|
|
1861
|
-
isRecordingEnabledOnDemand
|
|
1862
|
-
isTranscriptionEnabledByDefault
|
|
1863
|
-
isTranscriptionEnabledOnDemand
|
|
1864
|
-
createdAt
|
|
1865
|
-
updatedAt
|
|
1866
|
-
deletedAt
|
|
1887
|
+
${FIELDS_INTERACTION_WIDGET}
|
|
1867
1888
|
}
|
|
1868
1889
|
endpointId
|
|
1869
1890
|
endpoint {
|
|
1870
|
-
|
|
1871
|
-
externalId
|
|
1872
|
-
tenantId
|
|
1873
|
-
widgetId
|
|
1874
|
-
address
|
|
1875
|
-
configuration
|
|
1876
|
-
createdAt
|
|
1877
|
-
updatedAt
|
|
1878
|
-
deletedAt
|
|
1891
|
+
${FIELDS_INTERACTION_ENDPOINT}
|
|
1879
1892
|
}
|
|
1880
1893
|
entityConversationId
|
|
1881
1894
|
entityConversation {
|
|
1882
|
-
|
|
1883
|
-
tenantId
|
|
1884
|
-
entityId
|
|
1885
|
-
entityAddress
|
|
1886
|
-
interactionChannel
|
|
1887
|
-
interactionProvider
|
|
1888
|
-
isCampaignEngaged
|
|
1889
|
-
campaignId
|
|
1890
|
-
lastCampaignFlowNodeId
|
|
1891
|
-
lastInteractionMessageId
|
|
1892
|
-
metadata
|
|
1893
|
-
lastActivityAt
|
|
1894
|
-
lastMessageAt
|
|
1895
|
-
archivedAt
|
|
1896
|
-
blockedAt
|
|
1897
|
-
createdAt
|
|
1898
|
-
updatedAt
|
|
1899
|
-
deletedAt
|
|
1895
|
+
${FIELDS_ENTITY_CONVERSATION}
|
|
1900
1896
|
}
|
|
1901
1897
|
entityId
|
|
1902
1898
|
entity {
|
|
1903
|
-
|
|
1904
|
-
externalId
|
|
1905
|
-
tenantId
|
|
1906
|
-
entityTypeId
|
|
1907
|
-
entityType {
|
|
1908
|
-
id
|
|
1909
|
-
externalId
|
|
1910
|
-
name
|
|
1911
|
-
description
|
|
1912
|
-
createdAt
|
|
1913
|
-
updatedAt
|
|
1914
|
-
deletedAt
|
|
1915
|
-
}
|
|
1916
|
-
parentId
|
|
1917
|
-
name
|
|
1918
|
-
image {
|
|
1919
|
-
key
|
|
1920
|
-
bucket
|
|
1921
|
-
location
|
|
1922
|
-
}
|
|
1923
|
-
email
|
|
1924
|
-
phoneNumber {
|
|
1925
|
-
countryCode
|
|
1926
|
-
dialCode
|
|
1927
|
-
e164Number
|
|
1928
|
-
internationalNumber
|
|
1929
|
-
nationalNumber
|
|
1930
|
-
number
|
|
1931
|
-
}
|
|
1932
|
-
phoneNumberE164
|
|
1933
|
-
isOrganization
|
|
1934
|
-
notes
|
|
1935
|
-
customFields
|
|
1936
|
-
createdAt
|
|
1937
|
-
updatedAt
|
|
1938
|
-
blockedAt
|
|
1939
|
-
deletedAt
|
|
1899
|
+
${FIELDS_ENTITY}
|
|
1940
1900
|
}
|
|
1941
1901
|
teamId
|
|
1942
1902
|
team {
|
|
1943
|
-
|
|
1944
|
-
tenantId
|
|
1945
|
-
name
|
|
1946
|
-
description
|
|
1947
|
-
createdAt
|
|
1948
|
-
updatedAt
|
|
1949
|
-
deletedAt
|
|
1903
|
+
${FIELDS_TEAM}
|
|
1950
1904
|
}
|
|
1951
1905
|
hostId
|
|
1952
1906
|
host {
|
|
1953
|
-
|
|
1954
|
-
interactionId
|
|
1955
|
-
entityId
|
|
1956
|
-
teamId
|
|
1957
|
-
userId
|
|
1958
|
-
createdAt
|
|
1959
|
-
updatedAt
|
|
1960
|
-
deletedAt
|
|
1907
|
+
${FIELDS_INTERACTION_HOST}
|
|
1961
1908
|
}
|
|
1962
1909
|
providerInteractionId
|
|
1963
1910
|
channel
|
|
@@ -1983,181 +1930,15 @@ const FIELDS_INTERACTION_EXPANDED = `
|
|
|
1983
1930
|
updatedAt
|
|
1984
1931
|
deletedAt
|
|
1985
1932
|
`;
|
|
1986
|
-
const FIELDS_INTERACTION_ATTENDEE = `
|
|
1987
|
-
id
|
|
1988
|
-
interactionId
|
|
1989
|
-
entityId
|
|
1990
|
-
interactionWidgetSessionId
|
|
1991
|
-
teamId
|
|
1992
|
-
userId
|
|
1993
|
-
userSessionId
|
|
1994
|
-
name
|
|
1995
|
-
metadata
|
|
1996
|
-
customFields
|
|
1997
|
-
isAdministrator
|
|
1998
|
-
joinedAt
|
|
1999
|
-
exitedAt
|
|
2000
|
-
createdAt
|
|
2001
|
-
updatedAt
|
|
2002
|
-
deletedAt
|
|
2003
|
-
`;
|
|
2004
|
-
const FIELDS_INTERACTION_ATTENDEE_EXPANDED = `
|
|
2005
|
-
id
|
|
2006
|
-
interactionId
|
|
2007
|
-
entityId
|
|
2008
|
-
entity {
|
|
2009
|
-
id
|
|
2010
|
-
externalId
|
|
2011
|
-
tenantId
|
|
2012
|
-
entityTypeId
|
|
2013
|
-
entityType {
|
|
2014
|
-
id
|
|
2015
|
-
externalId
|
|
2016
|
-
name
|
|
2017
|
-
description
|
|
2018
|
-
createdAt
|
|
2019
|
-
updatedAt
|
|
2020
|
-
deletedAt
|
|
2021
|
-
}
|
|
2022
|
-
parentId
|
|
2023
|
-
name
|
|
2024
|
-
image {
|
|
2025
|
-
key
|
|
2026
|
-
bucket
|
|
2027
|
-
location
|
|
2028
|
-
}
|
|
2029
|
-
email
|
|
2030
|
-
phoneNumber {
|
|
2031
|
-
countryCode
|
|
2032
|
-
dialCode
|
|
2033
|
-
e164Number
|
|
2034
|
-
internationalNumber
|
|
2035
|
-
nationalNumber
|
|
2036
|
-
number
|
|
2037
|
-
}
|
|
2038
|
-
phoneNumberE164
|
|
2039
|
-
isOrganization
|
|
2040
|
-
notes
|
|
2041
|
-
customFields
|
|
2042
|
-
createdAt
|
|
2043
|
-
updatedAt
|
|
2044
|
-
blockedAt
|
|
2045
|
-
deletedAt
|
|
2046
|
-
}
|
|
2047
|
-
interactionWidgetSessionId
|
|
2048
|
-
teamId
|
|
2049
|
-
team {
|
|
2050
|
-
id
|
|
2051
|
-
tenantId
|
|
2052
|
-
name
|
|
2053
|
-
description
|
|
2054
|
-
image {
|
|
2055
|
-
key
|
|
2056
|
-
bucket
|
|
2057
|
-
location
|
|
2058
|
-
}
|
|
2059
|
-
createdAt
|
|
2060
|
-
updatedAt
|
|
2061
|
-
deletedAt
|
|
2062
|
-
ticketFields
|
|
2063
|
-
}
|
|
2064
|
-
userId
|
|
2065
|
-
user {
|
|
2066
|
-
id
|
|
2067
|
-
externalId
|
|
2068
|
-
tenantId
|
|
2069
|
-
name
|
|
2070
|
-
image {
|
|
2071
|
-
key
|
|
2072
|
-
bucket
|
|
2073
|
-
location
|
|
2074
|
-
}
|
|
2075
|
-
email
|
|
2076
|
-
phoneNumber {
|
|
2077
|
-
countryCode
|
|
2078
|
-
dialCode
|
|
2079
|
-
e164Number
|
|
2080
|
-
internationalNumber
|
|
2081
|
-
nationalNumber
|
|
2082
|
-
number
|
|
2083
|
-
}
|
|
2084
|
-
type
|
|
2085
|
-
preferences {
|
|
2086
|
-
timezoneName
|
|
2087
|
-
language {
|
|
2088
|
-
code
|
|
2089
|
-
nameEn
|
|
2090
|
-
nameLocal
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
notificationSettings {
|
|
2094
|
-
allowPush
|
|
2095
|
-
allowEmail
|
|
2096
|
-
allowSMS
|
|
2097
|
-
allowWhatsApp
|
|
2098
|
-
}
|
|
2099
|
-
activatedAt
|
|
2100
|
-
blockedAt
|
|
2101
|
-
createdAt
|
|
2102
|
-
updatedAt
|
|
2103
|
-
deletedAt
|
|
2104
|
-
}
|
|
2105
|
-
userSessionId
|
|
2106
|
-
name
|
|
2107
|
-
metadata
|
|
2108
|
-
customFields
|
|
2109
|
-
isAdministrator
|
|
2110
|
-
joinedAt
|
|
2111
|
-
exitedAt
|
|
2112
|
-
createdAt
|
|
2113
|
-
updatedAt
|
|
2114
|
-
deletedAt
|
|
2115
|
-
`;
|
|
2116
1933
|
const FIELDS_INTERACTION_INVITEE = `
|
|
2117
|
-
id
|
|
2118
|
-
interactionId
|
|
2119
|
-
interaction {
|
|
2120
|
-
${FIELDS_INTERACTION}
|
|
2121
|
-
}
|
|
2122
|
-
entityId
|
|
2123
|
-
entity {
|
|
2124
|
-
|
|
2125
|
-
externalId
|
|
2126
|
-
tenantId
|
|
2127
|
-
entityTypeId
|
|
2128
|
-
entityType {
|
|
2129
|
-
id
|
|
2130
|
-
externalId
|
|
2131
|
-
name
|
|
2132
|
-
description
|
|
2133
|
-
createdAt
|
|
2134
|
-
updatedAt
|
|
2135
|
-
deletedAt
|
|
2136
|
-
}
|
|
2137
|
-
parentId
|
|
2138
|
-
name
|
|
2139
|
-
image {
|
|
2140
|
-
key
|
|
2141
|
-
bucket
|
|
2142
|
-
location
|
|
2143
|
-
}
|
|
2144
|
-
email
|
|
2145
|
-
phoneNumber {
|
|
2146
|
-
countryCode
|
|
2147
|
-
dialCode
|
|
2148
|
-
e164Number
|
|
2149
|
-
internationalNumber
|
|
2150
|
-
nationalNumber
|
|
2151
|
-
number
|
|
2152
|
-
}
|
|
2153
|
-
phoneNumberE164
|
|
2154
|
-
isOrganization
|
|
2155
|
-
notes
|
|
2156
|
-
customFields
|
|
2157
|
-
createdAt
|
|
2158
|
-
updatedAt
|
|
2159
|
-
blockedAt
|
|
2160
|
-
deletedAt
|
|
1934
|
+
id
|
|
1935
|
+
interactionId
|
|
1936
|
+
interaction {
|
|
1937
|
+
${FIELDS_INTERACTION}
|
|
1938
|
+
}
|
|
1939
|
+
entityId
|
|
1940
|
+
entity {
|
|
1941
|
+
${FIELDS_ENTITY_EXPANDED}
|
|
2161
1942
|
}
|
|
2162
1943
|
teamId
|
|
2163
1944
|
userId
|
|
@@ -2168,6 +1949,51 @@ const FIELDS_INTERACTION_INVITEE = `
|
|
|
2168
1949
|
updatedAt
|
|
2169
1950
|
deletedAt
|
|
2170
1951
|
`;
|
|
1952
|
+
const FIELDS_INTERACTION_ATTENDEE = `
|
|
1953
|
+
id
|
|
1954
|
+
interactionId
|
|
1955
|
+
entityId
|
|
1956
|
+
interactionWidgetSessionId
|
|
1957
|
+
teamId
|
|
1958
|
+
userId
|
|
1959
|
+
userSessionId
|
|
1960
|
+
name
|
|
1961
|
+
metadata
|
|
1962
|
+
customFields
|
|
1963
|
+
isAdministrator
|
|
1964
|
+
joinedAt
|
|
1965
|
+
exitedAt
|
|
1966
|
+
createdAt
|
|
1967
|
+
updatedAt
|
|
1968
|
+
deletedAt
|
|
1969
|
+
`;
|
|
1970
|
+
const FIELDS_INTERACTION_ATTENDEE_EXPANDED = `
|
|
1971
|
+
id
|
|
1972
|
+
interactionId
|
|
1973
|
+
entityId
|
|
1974
|
+
entity {
|
|
1975
|
+
${FIELDS_ENTITY_EXPANDED}
|
|
1976
|
+
}
|
|
1977
|
+
interactionWidgetSessionId
|
|
1978
|
+
teamId
|
|
1979
|
+
team {
|
|
1980
|
+
${FIELDS_TEAM}
|
|
1981
|
+
}
|
|
1982
|
+
userId
|
|
1983
|
+
user {
|
|
1984
|
+
${FIELDS_USER}
|
|
1985
|
+
}
|
|
1986
|
+
userSessionId
|
|
1987
|
+
name
|
|
1988
|
+
metadata
|
|
1989
|
+
customFields
|
|
1990
|
+
isAdministrator
|
|
1991
|
+
joinedAt
|
|
1992
|
+
exitedAt
|
|
1993
|
+
createdAt
|
|
1994
|
+
updatedAt
|
|
1995
|
+
deletedAt
|
|
1996
|
+
`;
|
|
2171
1997
|
const FIELDS_INTERACTION_MESSAGE_ATTACHMENT = `
|
|
2172
1998
|
id
|
|
2173
1999
|
externalId
|
|
@@ -2189,40 +2015,11 @@ const FIELDS_INTERACTION_MESSAGE = `
|
|
|
2189
2015
|
id
|
|
2190
2016
|
externalId
|
|
2191
2017
|
endpointId
|
|
2192
|
-
endpoint {
|
|
2193
|
-
id
|
|
2194
|
-
externalId
|
|
2195
|
-
tenantId
|
|
2196
|
-
widgetId
|
|
2197
|
-
address
|
|
2198
|
-
configuration
|
|
2199
|
-
createdAt
|
|
2200
|
-
updatedAt
|
|
2201
|
-
deletedAt
|
|
2202
|
-
}
|
|
2203
2018
|
campaignId
|
|
2204
2019
|
campaignFlowNodeId
|
|
2205
2020
|
entityConversationId
|
|
2206
2021
|
interactionId
|
|
2207
2022
|
interactionAttendeeId
|
|
2208
|
-
interactionAttendee {
|
|
2209
|
-
id
|
|
2210
|
-
interactionId
|
|
2211
|
-
entityId
|
|
2212
|
-
interactionWidgetSessionId
|
|
2213
|
-
teamId
|
|
2214
|
-
userId
|
|
2215
|
-
userSessionId
|
|
2216
|
-
name
|
|
2217
|
-
metadata
|
|
2218
|
-
customFields
|
|
2219
|
-
isAdministrator
|
|
2220
|
-
joinedAt
|
|
2221
|
-
exitedAt
|
|
2222
|
-
createdAt
|
|
2223
|
-
updatedAt
|
|
2224
|
-
deletedAt
|
|
2225
|
-
}
|
|
2226
2023
|
body
|
|
2227
2024
|
metadata
|
|
2228
2025
|
referenceMessageId
|
|
@@ -2236,15 +2033,21 @@ const FIELDS_INTERACTION_MESSAGE = `
|
|
|
2236
2033
|
nextToken
|
|
2237
2034
|
}
|
|
2238
2035
|
`;
|
|
2239
|
-
const
|
|
2036
|
+
const FIELDS_INTERACTION_MESSAGE_EXPANDED = `
|
|
2240
2037
|
id
|
|
2241
2038
|
externalId
|
|
2242
2039
|
endpointId
|
|
2040
|
+
endpoint {
|
|
2041
|
+
${FIELDS_INTERACTION_ENDPOINT}
|
|
2042
|
+
}
|
|
2243
2043
|
campaignId
|
|
2244
2044
|
campaignFlowNodeId
|
|
2245
2045
|
entityConversationId
|
|
2246
2046
|
interactionId
|
|
2247
2047
|
interactionAttendeeId
|
|
2048
|
+
interactionAttendee {
|
|
2049
|
+
${FIELDS_INTERACTION_ATTENDEE}
|
|
2050
|
+
}
|
|
2248
2051
|
body
|
|
2249
2052
|
metadata
|
|
2250
2053
|
referenceMessageId
|
|
@@ -2287,7 +2090,7 @@ class InteractionService {
|
|
|
2287
2090
|
async GetInteractionMessage(id) {
|
|
2288
2091
|
const statement = `query GetInteractionMessage($id: ID!) {
|
|
2289
2092
|
getInteractionMessage(id: $id) {
|
|
2290
|
-
${
|
|
2093
|
+
${FIELDS_INTERACTION_MESSAGE_EXPANDED}
|
|
2291
2094
|
}
|
|
2292
2095
|
}`;
|
|
2293
2096
|
const gqlAPIServiceArguments = {
|
|
@@ -2302,69 +2105,244 @@ class InteractionService {
|
|
|
2302
2105
|
${FIELDS_INTERACTION}
|
|
2303
2106
|
}
|
|
2304
2107
|
}`;
|
|
2305
|
-
const gqlAPIServiceArguments = { input };
|
|
2306
|
-
if (condition) {
|
|
2307
|
-
gqlAPIServiceArguments.condition = condition;
|
|
2108
|
+
const gqlAPIServiceArguments = { input };
|
|
2109
|
+
if (condition) {
|
|
2110
|
+
gqlAPIServiceArguments.condition = condition;
|
|
2111
|
+
}
|
|
2112
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2113
|
+
return response.data.createInteraction;
|
|
2114
|
+
}
|
|
2115
|
+
async UpdateInteraction(input, condition) {
|
|
2116
|
+
const statement = `mutation UpdateInteraction($input: UpdateInteractionInput!, $condition: ModelInteractionConditionInput) {
|
|
2117
|
+
updateInteraction(input: $input, condition: $condition) {
|
|
2118
|
+
${FIELDS_INTERACTION}
|
|
2119
|
+
}
|
|
2120
|
+
}`;
|
|
2121
|
+
const gqlAPIServiceArguments = { input };
|
|
2122
|
+
if (condition) {
|
|
2123
|
+
gqlAPIServiceArguments.condition = condition;
|
|
2124
|
+
}
|
|
2125
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2126
|
+
return response.data.updateInteraction;
|
|
2127
|
+
}
|
|
2128
|
+
async CreateInteractionAttendee(input, condition) {
|
|
2129
|
+
const statement = `mutation CreateInteractionAttendee($input: CreateInteractionAttendeeInput!, $condition: ModelInteractionAttendeeConditionInput) {
|
|
2130
|
+
createInteractionAttendee(input: $input, condition: $condition) {
|
|
2131
|
+
${FIELDS_INTERACTION_ATTENDEE}
|
|
2132
|
+
}
|
|
2133
|
+
}`;
|
|
2134
|
+
const gqlAPIServiceArguments = { input };
|
|
2135
|
+
if (condition) {
|
|
2136
|
+
gqlAPIServiceArguments.condition = condition;
|
|
2137
|
+
}
|
|
2138
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2139
|
+
return response.data.createInteractionAttendee;
|
|
2140
|
+
}
|
|
2141
|
+
async CreateInteractionMessage(input, condition) {
|
|
2142
|
+
const statement = `mutation CreateInteractionMessage($input: CreateInteractionMessageInput!, $condition: ModelInteractionMessageConditionInput) {
|
|
2143
|
+
createInteractionMessage(input: $input, condition: $condition) {
|
|
2144
|
+
${FIELDS_INTERACTION_MESSAGE}
|
|
2145
|
+
}
|
|
2146
|
+
}`;
|
|
2147
|
+
const gqlAPIServiceArguments = { input };
|
|
2148
|
+
if (condition) {
|
|
2149
|
+
gqlAPIServiceArguments.condition = condition;
|
|
2150
|
+
}
|
|
2151
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2152
|
+
return response.data.createInteractionMessage;
|
|
2153
|
+
}
|
|
2154
|
+
async CreateInteractionMessageAttachment(input, condition) {
|
|
2155
|
+
const statement = `mutation CreateInteractionMessageAttachment($input: CreateInteractionMessageAttachmentInput!, $condition: ModelInteractionMessageAttachmentConditionInput) {
|
|
2156
|
+
createInteractionMessageAttachment(input: $input, condition: $condition) {
|
|
2157
|
+
${FIELDS_INTERACTION_MESSAGE_ATTACHMENT}
|
|
2158
|
+
}
|
|
2159
|
+
}`;
|
|
2160
|
+
const gqlAPIServiceArguments = { input };
|
|
2161
|
+
if (condition) {
|
|
2162
|
+
gqlAPIServiceArguments.condition = condition;
|
|
2163
|
+
}
|
|
2164
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2165
|
+
return response.data.createInteractionMessageAttachment;
|
|
2166
|
+
}
|
|
2167
|
+
async ListInteractionsByTenantId(tenantId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2168
|
+
const statement = `query ListInteractionsByTenantId($tenantId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionFilterInput, $limit: Int, $nextToken: String) {
|
|
2169
|
+
listInteractionsByTenantId(
|
|
2170
|
+
tenantId: $tenantId
|
|
2171
|
+
createdAt: $createdAt
|
|
2172
|
+
sortDirection: $sortDirection
|
|
2173
|
+
filter: $filter
|
|
2174
|
+
limit: $limit
|
|
2175
|
+
nextToken: $nextToken
|
|
2176
|
+
) {
|
|
2177
|
+
items {
|
|
2178
|
+
${FIELDS_INTERACTION}
|
|
2179
|
+
}
|
|
2180
|
+
nextToken
|
|
2181
|
+
}
|
|
2182
|
+
}`;
|
|
2183
|
+
const gqlAPIServiceArguments = { tenantId };
|
|
2184
|
+
if (createdAt) {
|
|
2185
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2186
|
+
}
|
|
2187
|
+
if (sortDirection) {
|
|
2188
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2189
|
+
}
|
|
2190
|
+
if (filter) {
|
|
2191
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2192
|
+
}
|
|
2193
|
+
if (limit) {
|
|
2194
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2195
|
+
}
|
|
2196
|
+
if (nextToken) {
|
|
2197
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2198
|
+
}
|
|
2199
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2200
|
+
return response.data.listInteractionsByTenantId;
|
|
2201
|
+
}
|
|
2202
|
+
async ListInteractionInviteesByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2203
|
+
const statement = `query ListInteractionInviteesByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionInviteeFilterInput, $limit: Int, $nextToken: String) {
|
|
2204
|
+
listInteractionInviteesByUserId(
|
|
2205
|
+
userId: $userId
|
|
2206
|
+
createdAt: $createdAt
|
|
2207
|
+
sortDirection: $sortDirection
|
|
2208
|
+
filter: $filter
|
|
2209
|
+
limit: $limit
|
|
2210
|
+
nextToken: $nextToken
|
|
2211
|
+
) {
|
|
2212
|
+
items {
|
|
2213
|
+
${FIELDS_INTERACTION_INVITEE}
|
|
2214
|
+
}
|
|
2215
|
+
nextToken
|
|
2216
|
+
}
|
|
2217
|
+
}`;
|
|
2218
|
+
const gqlAPIServiceArguments = { userId };
|
|
2219
|
+
if (createdAt) {
|
|
2220
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2221
|
+
}
|
|
2222
|
+
if (sortDirection) {
|
|
2223
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2224
|
+
}
|
|
2225
|
+
if (filter) {
|
|
2226
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2227
|
+
}
|
|
2228
|
+
if (limit) {
|
|
2229
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2230
|
+
}
|
|
2231
|
+
if (nextToken) {
|
|
2232
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2233
|
+
}
|
|
2234
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2235
|
+
return response.data.listInteractionInviteesByUserId;
|
|
2236
|
+
}
|
|
2237
|
+
async ListInteractionAttendeesByInteractionIdAndEntityId(interactionId, entityId, sortDirection, filter, limit, nextToken) {
|
|
2238
|
+
const statement = `query ListInteractionAttendeesByInteractionIdAndEntityId($interactionId: ID!, $entityId: ModelIDKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionAttendeeFilterInput, $limit: Int, $nextToken: String) {
|
|
2239
|
+
listInteractionAttendeesByInteractionIdAndEntityId(
|
|
2240
|
+
interactionId: $interactionId
|
|
2241
|
+
entityId: $entityId
|
|
2242
|
+
sortDirection: $sortDirection
|
|
2243
|
+
filter: $filter
|
|
2244
|
+
limit: $limit
|
|
2245
|
+
nextToken: $nextToken
|
|
2246
|
+
) {
|
|
2247
|
+
items {
|
|
2248
|
+
${FIELDS_INTERACTION_ATTENDEE}
|
|
2249
|
+
}
|
|
2250
|
+
nextToken
|
|
2251
|
+
}
|
|
2252
|
+
}`;
|
|
2253
|
+
const gqlAPIServiceArguments = { interactionId };
|
|
2254
|
+
if (entityId) {
|
|
2255
|
+
gqlAPIServiceArguments.entityId = entityId;
|
|
2256
|
+
}
|
|
2257
|
+
if (sortDirection) {
|
|
2258
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2259
|
+
}
|
|
2260
|
+
if (filter) {
|
|
2261
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2262
|
+
}
|
|
2263
|
+
if (limit) {
|
|
2264
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2265
|
+
}
|
|
2266
|
+
if (nextToken) {
|
|
2267
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2268
|
+
}
|
|
2269
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2270
|
+
return response.data.listInteractionAttendeesByInteractionIdAndEntityId;
|
|
2271
|
+
}
|
|
2272
|
+
async ListInteractionAttendeesByInteractionIdAndUserId(interactionId, userId, sortDirection, filter, limit, nextToken) {
|
|
2273
|
+
const statement = `query ListInteractionAttendeesByInteractionIdAndUserId($interactionId: ID!, $userId: ModelIDKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionAttendeeFilterInput, $limit: Int, $nextToken: String) {
|
|
2274
|
+
listInteractionAttendeesByInteractionIdAndUserId(
|
|
2275
|
+
interactionId: $interactionId
|
|
2276
|
+
userId: $userId
|
|
2277
|
+
sortDirection: $sortDirection
|
|
2278
|
+
filter: $filter
|
|
2279
|
+
limit: $limit
|
|
2280
|
+
nextToken: $nextToken
|
|
2281
|
+
) {
|
|
2282
|
+
items {
|
|
2283
|
+
${FIELDS_INTERACTION_ATTENDEE}
|
|
2284
|
+
}
|
|
2285
|
+
nextToken
|
|
2286
|
+
}
|
|
2287
|
+
}`;
|
|
2288
|
+
const gqlAPIServiceArguments = { interactionId };
|
|
2289
|
+
if (userId) {
|
|
2290
|
+
gqlAPIServiceArguments.userId = userId;
|
|
2308
2291
|
}
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
}
|
|
2312
|
-
async UpdateInteraction(input, condition) {
|
|
2313
|
-
const statement = `mutation UpdateInteraction($input: UpdateInteractionInput!, $condition: ModelInteractionConditionInput) {
|
|
2314
|
-
updateInteraction(input: $input, condition: $condition) {
|
|
2315
|
-
${FIELDS_INTERACTION}
|
|
2292
|
+
if (sortDirection) {
|
|
2293
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2316
2294
|
}
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
if (condition) {
|
|
2320
|
-
gqlAPIServiceArguments.condition = condition;
|
|
2295
|
+
if (filter) {
|
|
2296
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2321
2297
|
}
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
}
|
|
2325
|
-
async CreateInteractionAttendee(input, condition) {
|
|
2326
|
-
const statement = `mutation CreateInteractionAttendee($input: CreateInteractionAttendeeInput!, $condition: ModelInteractionAttendeeConditionInput) {
|
|
2327
|
-
createInteractionAttendee(input: $input, condition: $condition) {
|
|
2328
|
-
${FIELDS_INTERACTION_ATTENDEE}
|
|
2298
|
+
if (limit) {
|
|
2299
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2329
2300
|
}
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
if (condition) {
|
|
2333
|
-
gqlAPIServiceArguments.condition = condition;
|
|
2301
|
+
if (nextToken) {
|
|
2302
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2334
2303
|
}
|
|
2335
2304
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2336
|
-
return response.data.
|
|
2305
|
+
return response.data.listInteractionAttendeesByInteractionIdAndUserId;
|
|
2337
2306
|
}
|
|
2338
|
-
async
|
|
2339
|
-
const statement = `
|
|
2340
|
-
|
|
2341
|
-
$
|
|
2307
|
+
async ListInteractionMessagesByEntityConversationId(entityConversationId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2308
|
+
const statement = `query ListInteractionMessagesByEntityConversationId($entityConversationId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionMessageFilterInput, $limit: Int, $nextToken: String) {
|
|
2309
|
+
listInteractionMessagesByEntityConversationId(
|
|
2310
|
+
entityConversationId: $entityConversationId
|
|
2311
|
+
createdAt: $createdAt
|
|
2312
|
+
sortDirection: $sortDirection
|
|
2313
|
+
filter: $filter
|
|
2314
|
+
limit: $limit
|
|
2315
|
+
nextToken: $nextToken
|
|
2316
|
+
) {
|
|
2317
|
+
items {
|
|
2318
|
+
${FIELDS_INTERACTION_MESSAGE_EXPANDED}
|
|
2319
|
+
}
|
|
2320
|
+
nextToken
|
|
2342
2321
|
}
|
|
2343
2322
|
}`;
|
|
2344
|
-
const gqlAPIServiceArguments = {
|
|
2345
|
-
if (
|
|
2346
|
-
gqlAPIServiceArguments.
|
|
2323
|
+
const gqlAPIServiceArguments = { entityConversationId };
|
|
2324
|
+
if (createdAt) {
|
|
2325
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2347
2326
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
}
|
|
2351
|
-
async CreateInteractionMessageAttachment(input, condition) {
|
|
2352
|
-
const statement = `mutation CreateInteractionMessageAttachment($input: CreateInteractionMessageAttachmentInput!, $condition: ModelInteractionMessageAttachmentConditionInput) {
|
|
2353
|
-
createInteractionMessageAttachment(input: $input, condition: $condition) {
|
|
2354
|
-
${FIELDS_INTERACTION_MESSAGE_ATTACHMENT}
|
|
2327
|
+
if (sortDirection) {
|
|
2328
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2355
2329
|
}
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2330
|
+
if (filter) {
|
|
2331
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2332
|
+
}
|
|
2333
|
+
if (limit) {
|
|
2334
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2335
|
+
}
|
|
2336
|
+
if (nextToken) {
|
|
2337
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2360
2338
|
}
|
|
2361
2339
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2362
|
-
return response.data.
|
|
2340
|
+
return response.data.listInteractionMessagesByEntityConversationId;
|
|
2363
2341
|
}
|
|
2364
|
-
async
|
|
2365
|
-
const statement = `query
|
|
2366
|
-
|
|
2367
|
-
|
|
2342
|
+
async ListInteractionMessagesByExternalMessageId(externalMessageId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2343
|
+
const statement = `query ListInteractionMessagesByExternalMessageId($externalMessageId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionMessageFilterInput, $limit: Int, $nextToken: String) {
|
|
2344
|
+
listInteractionMessagesByExternalMessageId(
|
|
2345
|
+
externalMessageId: $externalMessageId
|
|
2368
2346
|
createdAt: $createdAt
|
|
2369
2347
|
sortDirection: $sortDirection
|
|
2370
2348
|
filter: $filter
|
|
@@ -2372,12 +2350,12 @@ class InteractionService {
|
|
|
2372
2350
|
nextToken: $nextToken
|
|
2373
2351
|
) {
|
|
2374
2352
|
items {
|
|
2375
|
-
${
|
|
2353
|
+
${FIELDS_INTERACTION_MESSAGE_EXPANDED}
|
|
2376
2354
|
}
|
|
2377
2355
|
nextToken
|
|
2378
2356
|
}
|
|
2379
2357
|
}`;
|
|
2380
|
-
const gqlAPIServiceArguments = {
|
|
2358
|
+
const gqlAPIServiceArguments = { externalMessageId };
|
|
2381
2359
|
if (createdAt) {
|
|
2382
2360
|
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2383
2361
|
}
|
|
@@ -2394,27 +2372,27 @@ class InteractionService {
|
|
|
2394
2372
|
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2395
2373
|
}
|
|
2396
2374
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2397
|
-
return response.data.
|
|
2375
|
+
return response.data.listInteractionMessagesByExternalMessageId;
|
|
2398
2376
|
}
|
|
2399
|
-
async
|
|
2400
|
-
const statement = `query
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2377
|
+
async ListInteractionMessagesByInteractionAttendeeId(interactionAttendeeId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2378
|
+
const statement = `query ListInteractionMessagesByInteractionAttendeeId($interactionAttendeeId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionMessageFilterInput, $limit: Int, $nextToken: String) {
|
|
2379
|
+
listInteractionMessagesByInteractionAttendeeId(
|
|
2380
|
+
interactionAttendeeId: $interactionAttendeeId
|
|
2381
|
+
createdAt: $createdAt
|
|
2404
2382
|
sortDirection: $sortDirection
|
|
2405
2383
|
filter: $filter
|
|
2406
2384
|
limit: $limit
|
|
2407
2385
|
nextToken: $nextToken
|
|
2408
2386
|
) {
|
|
2409
2387
|
items {
|
|
2410
|
-
${
|
|
2388
|
+
${FIELDS_INTERACTION_MESSAGE_EXPANDED}
|
|
2411
2389
|
}
|
|
2412
2390
|
nextToken
|
|
2413
2391
|
}
|
|
2414
2392
|
}`;
|
|
2415
|
-
const gqlAPIServiceArguments = {
|
|
2416
|
-
if (
|
|
2417
|
-
gqlAPIServiceArguments.
|
|
2393
|
+
const gqlAPIServiceArguments = { interactionAttendeeId };
|
|
2394
|
+
if (createdAt) {
|
|
2395
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2418
2396
|
}
|
|
2419
2397
|
if (sortDirection) {
|
|
2420
2398
|
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
@@ -2429,27 +2407,29 @@ class InteractionService {
|
|
|
2429
2407
|
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2430
2408
|
}
|
|
2431
2409
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2432
|
-
return response.data.
|
|
2410
|
+
return response.data.listInteractionMessagesByInteractionAttendeeId;
|
|
2433
2411
|
}
|
|
2434
|
-
async
|
|
2435
|
-
const statement = `query
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2412
|
+
async ListInteractionMessageAttachmentsByInteractionMessageId(interactionMessageId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2413
|
+
const statement = `query ListInteractionMessageAttachmentsByInteractionMessageId($interactionMessageId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionMessageAttachmentFilterInput, $limit: Int, $nextToken: String) {
|
|
2414
|
+
listInteractionMessageAttachmentsByInteractionMessageId(
|
|
2415
|
+
interactionMessageId: $interactionMessageId
|
|
2416
|
+
createdAt: $createdAt
|
|
2439
2417
|
sortDirection: $sortDirection
|
|
2440
2418
|
filter: $filter
|
|
2441
2419
|
limit: $limit
|
|
2442
2420
|
nextToken: $nextToken
|
|
2443
2421
|
) {
|
|
2444
2422
|
items {
|
|
2445
|
-
${
|
|
2423
|
+
${FIELDS_INTERACTION_MESSAGE_ATTACHMENT}
|
|
2446
2424
|
}
|
|
2447
2425
|
nextToken
|
|
2448
2426
|
}
|
|
2449
2427
|
}`;
|
|
2450
|
-
const gqlAPIServiceArguments = {
|
|
2451
|
-
|
|
2452
|
-
|
|
2428
|
+
const gqlAPIServiceArguments = {
|
|
2429
|
+
interactionMessageId,
|
|
2430
|
+
};
|
|
2431
|
+
if (createdAt) {
|
|
2432
|
+
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2453
2433
|
}
|
|
2454
2434
|
if (sortDirection) {
|
|
2455
2435
|
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
@@ -2464,12 +2444,140 @@ class InteractionService {
|
|
|
2464
2444
|
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2465
2445
|
}
|
|
2466
2446
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2467
|
-
return response.data.
|
|
2447
|
+
return response.data.listInteractionMessageAttachmentsByInteractionMessageId;
|
|
2448
|
+
}
|
|
2449
|
+
OnInteractionInviteeByUserIdListener(userId) {
|
|
2450
|
+
const statement = `subscription OnInteractionInviteeByUserId($userId: ID!) {
|
|
2451
|
+
OnInteractionInviteeByUserId(userId: $userId) {
|
|
2452
|
+
${FIELDS_INTERACTION_INVITEE}
|
|
2453
|
+
}
|
|
2454
|
+
}`;
|
|
2455
|
+
const gqlAPIServiceArguments = { userId };
|
|
2456
|
+
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2457
|
+
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnInteractionInviteeByUserId">>>; */
|
|
2458
|
+
}
|
|
2459
|
+
OnInteractionMessageByEntityConversationIdListener(entityConversationId) {
|
|
2460
|
+
const statement = `subscription OnInteractionMessageByEntityConversationId($entityConversationId: ID!) {
|
|
2461
|
+
OnInteractionMessageByEntityConversationId(
|
|
2462
|
+
entityConversationId: $entityConversationId
|
|
2463
|
+
) {
|
|
2464
|
+
${FIELDS_INTERACTION_MESSAGE_EXPANDED}
|
|
2465
|
+
}
|
|
2466
|
+
}`;
|
|
2467
|
+
const gqlAPIServiceArguments = { entityConversationId };
|
|
2468
|
+
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2469
|
+
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, 'OnInteractionMessageByEntityConversationId'>>>; */
|
|
2470
|
+
}
|
|
2471
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2472
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionService, providedIn: 'root' });
|
|
2473
|
+
}
|
|
2474
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionService, decorators: [{
|
|
2475
|
+
type: Injectable,
|
|
2476
|
+
args: [{
|
|
2477
|
+
providedIn: 'root',
|
|
2478
|
+
}]
|
|
2479
|
+
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2480
|
+
|
|
2481
|
+
const FIELDS_ENTITY_CONVERSATION = `
|
|
2482
|
+
id
|
|
2483
|
+
tenantId
|
|
2484
|
+
entityId
|
|
2485
|
+
entityAddress
|
|
2486
|
+
interactionChannel
|
|
2487
|
+
interactionProvider
|
|
2488
|
+
isCampaignEngaged
|
|
2489
|
+
campaignId
|
|
2490
|
+
lastCampaignFlowNodeId
|
|
2491
|
+
lastInteractionMessageId
|
|
2492
|
+
metadata
|
|
2493
|
+
lastActivityAt
|
|
2494
|
+
lastMessageAt
|
|
2495
|
+
archivedAt
|
|
2496
|
+
blockedAt
|
|
2497
|
+
createdAt
|
|
2498
|
+
updatedAt
|
|
2499
|
+
deletedAt
|
|
2500
|
+
`;
|
|
2501
|
+
const FIELDS_ENTITY_CONVERSATION_EXPANDED = `
|
|
2502
|
+
id
|
|
2503
|
+
tenantId
|
|
2504
|
+
entityId
|
|
2505
|
+
entity {
|
|
2506
|
+
${FIELDS_ENTITY}
|
|
2507
|
+
}
|
|
2508
|
+
entityAddress
|
|
2509
|
+
interactionChannel
|
|
2510
|
+
interactionProvider
|
|
2511
|
+
isCampaignEngaged
|
|
2512
|
+
campaignId
|
|
2513
|
+
lastCampaignFlowNodeId
|
|
2514
|
+
lastInteractionMessageId
|
|
2515
|
+
metadata
|
|
2516
|
+
lastActivityAt
|
|
2517
|
+
lastMessageAt
|
|
2518
|
+
archivedAt
|
|
2519
|
+
blockedAt
|
|
2520
|
+
createdAt
|
|
2521
|
+
updatedAt
|
|
2522
|
+
deletedAt
|
|
2523
|
+
interactions (limit: 1, sortDirection: ${ModelSortDirection.DESC}) {
|
|
2524
|
+
items {
|
|
2525
|
+
${FIELDS_INTERACTION}
|
|
2526
|
+
}
|
|
2527
|
+
nextToken
|
|
2528
|
+
}
|
|
2529
|
+
messages (limit: 1, sortDirection: ${ModelSortDirection.DESC}) {
|
|
2530
|
+
items {
|
|
2531
|
+
${FIELDS_INTERACTION_MESSAGE}
|
|
2532
|
+
}
|
|
2533
|
+
nextToken
|
|
2534
|
+
}
|
|
2535
|
+
`;
|
|
2536
|
+
class EntityConversationService {
|
|
2537
|
+
appSyncService;
|
|
2538
|
+
constructor(appSyncService) {
|
|
2539
|
+
this.appSyncService = appSyncService;
|
|
2540
|
+
}
|
|
2541
|
+
async GetEntityConversation(id) {
|
|
2542
|
+
const statement = `query GetEntityConversation($id: ID!) {
|
|
2543
|
+
getEntityConversation(id: $id) {
|
|
2544
|
+
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
2545
|
+
}
|
|
2546
|
+
}`;
|
|
2547
|
+
const gqlAPIServiceArguments = { id };
|
|
2548
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2549
|
+
return response.data.getEntityConversation;
|
|
2550
|
+
}
|
|
2551
|
+
async CreateEntityConversation(input, condition) {
|
|
2552
|
+
const statement = `mutation CreateEntityConversation($input: CreateEntityConversationInput!, $condition: ModelEntityConversationConditionInput) {
|
|
2553
|
+
createEntityConversation(input: $input, condition: $condition) {
|
|
2554
|
+
${FIELDS_ENTITY_CONVERSATION}
|
|
2555
|
+
}
|
|
2556
|
+
}`;
|
|
2557
|
+
const gqlAPIServiceArguments = { input };
|
|
2558
|
+
if (condition) {
|
|
2559
|
+
gqlAPIServiceArguments.condition = condition;
|
|
2560
|
+
}
|
|
2561
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2562
|
+
return response.data.createEntityConversation;
|
|
2563
|
+
}
|
|
2564
|
+
async UpdateEntityConversation(input, condition) {
|
|
2565
|
+
const statement = `mutation UpdateEntityConversation($input: UpdateEntityConversationInput!, $condition: ModelEntityConversationConditionInput) {
|
|
2566
|
+
updateEntityConversation(input: $input, condition: $condition) {
|
|
2567
|
+
${FIELDS_ENTITY_CONVERSATION}
|
|
2568
|
+
}
|
|
2569
|
+
}`;
|
|
2570
|
+
const gqlAPIServiceArguments = { input };
|
|
2571
|
+
if (condition) {
|
|
2572
|
+
gqlAPIServiceArguments.condition = condition;
|
|
2573
|
+
}
|
|
2574
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2575
|
+
return response.data.updateEntityConversation;
|
|
2468
2576
|
}
|
|
2469
|
-
async
|
|
2470
|
-
const statement = `query
|
|
2471
|
-
|
|
2472
|
-
|
|
2577
|
+
async ListEntityConversationsByEntityId(entityId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2578
|
+
const statement = `query ListEntityConversationsByEntityId($entityId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityConversationFilterInput, $limit: Int, $nextToken: String) {
|
|
2579
|
+
listEntityConversationsByEntityId(
|
|
2580
|
+
entityId: $entityId
|
|
2473
2581
|
createdAt: $createdAt
|
|
2474
2582
|
sortDirection: $sortDirection
|
|
2475
2583
|
filter: $filter
|
|
@@ -2477,12 +2585,14 @@ class InteractionService {
|
|
|
2477
2585
|
nextToken: $nextToken
|
|
2478
2586
|
) {
|
|
2479
2587
|
items {
|
|
2480
|
-
${
|
|
2588
|
+
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
2481
2589
|
}
|
|
2482
2590
|
nextToken
|
|
2483
2591
|
}
|
|
2484
2592
|
}`;
|
|
2485
|
-
const gqlAPIServiceArguments = {
|
|
2593
|
+
const gqlAPIServiceArguments = {
|
|
2594
|
+
entityId,
|
|
2595
|
+
};
|
|
2486
2596
|
if (createdAt) {
|
|
2487
2597
|
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2488
2598
|
}
|
|
@@ -2499,27 +2609,27 @@ class InteractionService {
|
|
|
2499
2609
|
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2500
2610
|
}
|
|
2501
2611
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2502
|
-
return response.data.
|
|
2612
|
+
return response.data.listEntityConversationsByEntityId;
|
|
2503
2613
|
}
|
|
2504
|
-
async
|
|
2505
|
-
const statement = `query
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2614
|
+
async ListEntityConversationsByTenantIdAndEntityAddress(tenantId, entityAddress, sortDirection, filter, limit, nextToken) {
|
|
2615
|
+
const statement = `query ListEntityConversationsByTenantIdAndEntityAddress($tenantId: ID!, $entityAddress: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityConversationFilterInput, $limit: Int, $nextToken: String) {
|
|
2616
|
+
listEntityConversationsByTenantIdAndEntityAddress(
|
|
2617
|
+
tenantId: $tenantId
|
|
2618
|
+
entityAddress: $entityAddress
|
|
2509
2619
|
sortDirection: $sortDirection
|
|
2510
2620
|
filter: $filter
|
|
2511
2621
|
limit: $limit
|
|
2512
2622
|
nextToken: $nextToken
|
|
2513
2623
|
) {
|
|
2514
2624
|
items {
|
|
2515
|
-
${
|
|
2625
|
+
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
2516
2626
|
}
|
|
2517
2627
|
nextToken
|
|
2518
2628
|
}
|
|
2519
2629
|
}`;
|
|
2520
|
-
const gqlAPIServiceArguments = {
|
|
2521
|
-
if (
|
|
2522
|
-
gqlAPIServiceArguments.
|
|
2630
|
+
const gqlAPIServiceArguments = { tenantId };
|
|
2631
|
+
if (entityAddress) {
|
|
2632
|
+
gqlAPIServiceArguments.entityAddress = entityAddress;
|
|
2523
2633
|
}
|
|
2524
2634
|
if (sortDirection) {
|
|
2525
2635
|
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
@@ -2534,27 +2644,27 @@ class InteractionService {
|
|
|
2534
2644
|
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2535
2645
|
}
|
|
2536
2646
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2537
|
-
return response.data.
|
|
2647
|
+
return response.data.listEntityConversationsByTenantIdAndEntityAddress;
|
|
2538
2648
|
}
|
|
2539
|
-
async
|
|
2540
|
-
const statement = `query
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2649
|
+
async ListEntityConversationsByTenantIdAndArchivedAt(tenantId, archivedAt, sortDirection, filter, limit, nextToken) {
|
|
2650
|
+
const statement = `query ListEntityConversationsByTenantIdAndArchivedAt($tenantId: ID!, $archivedAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityConversationFilterInput, $limit: Int, $nextToken: String) {
|
|
2651
|
+
listEntityConversationsByTenantIdAndArchivedAt(
|
|
2652
|
+
tenantId: $tenantId
|
|
2653
|
+
archivedAt: $archivedAt
|
|
2544
2654
|
sortDirection: $sortDirection
|
|
2545
2655
|
filter: $filter
|
|
2546
2656
|
limit: $limit
|
|
2547
2657
|
nextToken: $nextToken
|
|
2548
2658
|
) {
|
|
2549
2659
|
items {
|
|
2550
|
-
${
|
|
2660
|
+
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
2551
2661
|
}
|
|
2552
2662
|
nextToken
|
|
2553
2663
|
}
|
|
2554
2664
|
}`;
|
|
2555
|
-
const gqlAPIServiceArguments = {
|
|
2556
|
-
if (
|
|
2557
|
-
gqlAPIServiceArguments.
|
|
2665
|
+
const gqlAPIServiceArguments = { tenantId };
|
|
2666
|
+
if (archivedAt) {
|
|
2667
|
+
gqlAPIServiceArguments.archivedAt = archivedAt;
|
|
2558
2668
|
}
|
|
2559
2669
|
if (sortDirection) {
|
|
2560
2670
|
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
@@ -2569,259 +2679,27 @@ class InteractionService {
|
|
|
2569
2679
|
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2570
2680
|
}
|
|
2571
2681
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2572
|
-
return response.data.
|
|
2682
|
+
return response.data.listEntityConversationsByTenantIdAndArchivedAt;
|
|
2573
2683
|
}
|
|
2574
|
-
async
|
|
2575
|
-
const statement = `query
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2684
|
+
async ListEntityConversationsByTenantIdAndLastMessageAt(tenantId, lastMessageAt, sortDirection, filter, limit, nextToken) {
|
|
2685
|
+
const statement = `query ListEntityConversationsByTenantIdAndLastMessageAt($tenantId: ID!, $lastMessageAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityConversationFilterInput, $limit: Int, $nextToken: String) {
|
|
2686
|
+
listEntityConversationsByTenantIdAndLastMessageAt(
|
|
2687
|
+
tenantId: $tenantId
|
|
2688
|
+
lastMessageAt: $lastMessageAt
|
|
2579
2689
|
sortDirection: $sortDirection
|
|
2580
2690
|
filter: $filter
|
|
2581
2691
|
limit: $limit
|
|
2582
2692
|
nextToken: $nextToken
|
|
2583
2693
|
) {
|
|
2584
2694
|
items {
|
|
2585
|
-
${
|
|
2586
|
-
}
|
|
2587
|
-
nextToken
|
|
2588
|
-
}
|
|
2589
|
-
}`;
|
|
2590
|
-
const gqlAPIServiceArguments = {
|
|
2591
|
-
interactionMessageId,
|
|
2592
|
-
};
|
|
2593
|
-
if (createdAt) {
|
|
2594
|
-
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2595
|
-
}
|
|
2596
|
-
if (sortDirection) {
|
|
2597
|
-
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2598
|
-
}
|
|
2599
|
-
if (filter) {
|
|
2600
|
-
gqlAPIServiceArguments.filter = filter;
|
|
2601
|
-
}
|
|
2602
|
-
if (limit) {
|
|
2603
|
-
gqlAPIServiceArguments.limit = limit;
|
|
2604
|
-
}
|
|
2605
|
-
if (nextToken) {
|
|
2606
|
-
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2607
|
-
}
|
|
2608
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2609
|
-
return response.data.listInteractionMessageAttachmentsByInteractionMessageId;
|
|
2610
|
-
}
|
|
2611
|
-
OnInteractionInviteeByUserIdListener(userId) {
|
|
2612
|
-
const statement = `subscription OnInteractionInviteeByUserId($userId: ID!) {
|
|
2613
|
-
OnInteractionInviteeByUserId(userId: $userId) {
|
|
2614
|
-
${FIELDS_INTERACTION_INVITEE}
|
|
2615
|
-
}
|
|
2616
|
-
}`;
|
|
2617
|
-
const gqlAPIServiceArguments = { userId };
|
|
2618
|
-
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2619
|
-
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnInteractionInviteeByUserId">>>; */
|
|
2620
|
-
}
|
|
2621
|
-
OnInteractionMessageByEntityConversationIdListener(entityConversationId) {
|
|
2622
|
-
const statement = `subscription OnInteractionMessageByEntityConversationId($entityConversationId: ID!) {
|
|
2623
|
-
OnInteractionMessageByEntityConversationId(
|
|
2624
|
-
entityConversationId: $entityConversationId
|
|
2625
|
-
) {
|
|
2626
|
-
${FIELDS_INTERACTION_MESSAGE}
|
|
2627
|
-
}
|
|
2628
|
-
}`;
|
|
2629
|
-
const gqlAPIServiceArguments = { entityConversationId };
|
|
2630
|
-
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2631
|
-
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, 'OnInteractionMessageByEntityConversationId'>>>; */
|
|
2632
|
-
}
|
|
2633
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2634
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionService, providedIn: 'root' });
|
|
2635
|
-
}
|
|
2636
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionService, decorators: [{
|
|
2637
|
-
type: Injectable,
|
|
2638
|
-
args: [{
|
|
2639
|
-
providedIn: 'root',
|
|
2640
|
-
}]
|
|
2641
|
-
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2642
|
-
|
|
2643
|
-
const FIELDS_USER = `
|
|
2644
|
-
id
|
|
2645
|
-
externalId
|
|
2646
|
-
tenantId
|
|
2647
|
-
email
|
|
2648
|
-
name
|
|
2649
|
-
image {
|
|
2650
|
-
key
|
|
2651
|
-
bucket
|
|
2652
|
-
location
|
|
2653
|
-
}
|
|
2654
|
-
phoneNumber {
|
|
2655
|
-
countryCode
|
|
2656
|
-
dialCode
|
|
2657
|
-
e164Number
|
|
2658
|
-
internationalNumber
|
|
2659
|
-
nationalNumber
|
|
2660
|
-
number
|
|
2661
|
-
}
|
|
2662
|
-
preferences {
|
|
2663
|
-
timezoneName
|
|
2664
|
-
language {
|
|
2665
|
-
code
|
|
2666
|
-
nameEn
|
|
2667
|
-
nameLocal
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
notificationSettings {
|
|
2671
|
-
allowPush
|
|
2672
|
-
allowEmail
|
|
2673
|
-
allowSMS
|
|
2674
|
-
allowWhatsApp
|
|
2675
|
-
}
|
|
2676
|
-
type
|
|
2677
|
-
activatedAt
|
|
2678
|
-
blockedAt
|
|
2679
|
-
createdAt
|
|
2680
|
-
updatedAt
|
|
2681
|
-
deletedAt
|
|
2682
|
-
`;
|
|
2683
|
-
var UserStatus;
|
|
2684
|
-
(function (UserStatus) {
|
|
2685
|
-
UserStatus["READY"] = "READY";
|
|
2686
|
-
UserStatus["NOT_READY"] = "NOT_READY";
|
|
2687
|
-
UserStatus["INVITED"] = "INVITED";
|
|
2688
|
-
UserStatus["BUSY"] = "BUSY";
|
|
2689
|
-
UserStatus["AFTER_CALL_WORK"] = "AFTER_CALL_WORK";
|
|
2690
|
-
})(UserStatus || (UserStatus = {}));
|
|
2691
|
-
var UserType;
|
|
2692
|
-
(function (UserType) {
|
|
2693
|
-
UserType["AGENT"] = "AGENT";
|
|
2694
|
-
UserType["SUPERVISOR"] = "SUPERVISOR";
|
|
2695
|
-
UserType["ADMINISTRATOR"] = "ADMINISTRATOR";
|
|
2696
|
-
})(UserType || (UserType = {}));
|
|
2697
|
-
class UserService {
|
|
2698
|
-
appSyncService;
|
|
2699
|
-
constructor(appSyncService) {
|
|
2700
|
-
this.appSyncService = appSyncService;
|
|
2701
|
-
}
|
|
2702
|
-
async getUserById(id) {
|
|
2703
|
-
if (!id || !uuid.validate(id)) {
|
|
2704
|
-
throw { code: 400, message: `Invalid id: ${id}` };
|
|
2705
|
-
}
|
|
2706
|
-
const user = await this.GetUser(id);
|
|
2707
|
-
if (!user || !!user.deletedAt) {
|
|
2708
|
-
throw { code: 400, message: `User not found` };
|
|
2709
|
-
}
|
|
2710
|
-
if (!user.activatedAt) {
|
|
2711
|
-
throw { code: 403, message: `User not activated.` };
|
|
2712
|
-
}
|
|
2713
|
-
if (!!user.blockedAt) {
|
|
2714
|
-
throw { code: 403, message: `User has been blocked.` };
|
|
2715
|
-
}
|
|
2716
|
-
return user;
|
|
2717
|
-
}
|
|
2718
|
-
async GetUser(id) {
|
|
2719
|
-
const statement = `query GetUser($id: ID!) {
|
|
2720
|
-
getUser(id: $id) {
|
|
2721
|
-
${FIELDS_USER}
|
|
2722
|
-
}
|
|
2723
|
-
}`;
|
|
2724
|
-
const gqlAPIServiceArguments = { id };
|
|
2725
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2726
|
-
return response.data.getUser;
|
|
2727
|
-
}
|
|
2728
|
-
OnUserByIdListener(id) {
|
|
2729
|
-
const statement = `subscription OnUserById($id: ID!) {
|
|
2730
|
-
OnUserById(id: $id) {
|
|
2731
|
-
${FIELDS_USER}
|
|
2732
|
-
}
|
|
2733
|
-
}`;
|
|
2734
|
-
const gqlAPIServiceArguments = { id };
|
|
2735
|
-
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2736
|
-
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, "OnUserById">>>; */
|
|
2737
|
-
}
|
|
2738
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2739
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, providedIn: 'root' });
|
|
2740
|
-
}
|
|
2741
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, decorators: [{
|
|
2742
|
-
type: Injectable,
|
|
2743
|
-
args: [{
|
|
2744
|
-
providedIn: 'root',
|
|
2745
|
-
}]
|
|
2746
|
-
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2747
|
-
|
|
2748
|
-
const FIELDS_TEAM = `
|
|
2749
|
-
id
|
|
2750
|
-
tenantId
|
|
2751
|
-
name
|
|
2752
|
-
description
|
|
2753
|
-
image {
|
|
2754
|
-
key
|
|
2755
|
-
bucket
|
|
2756
|
-
location
|
|
2757
|
-
}
|
|
2758
|
-
ticketFields
|
|
2759
|
-
createdAt
|
|
2760
|
-
updatedAt
|
|
2761
|
-
deletedAt
|
|
2762
|
-
`;
|
|
2763
|
-
const FIELDS_TEAM_MEMBER = `
|
|
2764
|
-
id
|
|
2765
|
-
teamId
|
|
2766
|
-
team {
|
|
2767
|
-
${FIELDS_TEAM}
|
|
2768
|
-
}
|
|
2769
|
-
userId
|
|
2770
|
-
user {
|
|
2771
|
-
${FIELDS_USER}
|
|
2772
|
-
}
|
|
2773
|
-
isManager
|
|
2774
|
-
createdAt
|
|
2775
|
-
updatedAt
|
|
2776
|
-
deletedAt
|
|
2777
|
-
`;
|
|
2778
|
-
class TeamService {
|
|
2779
|
-
appSyncService;
|
|
2780
|
-
constructor(appSyncService) {
|
|
2781
|
-
this.appSyncService = appSyncService;
|
|
2782
|
-
}
|
|
2783
|
-
async GetTeam(id) {
|
|
2784
|
-
const statement = `query GetTeam($id: ID!) {
|
|
2785
|
-
getTeam(id: $id) {
|
|
2786
|
-
${FIELDS_TEAM}
|
|
2695
|
+
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
2696
|
+
}
|
|
2697
|
+
nextToken
|
|
2787
2698
|
}
|
|
2788
2699
|
}`;
|
|
2789
|
-
const gqlAPIServiceArguments = {
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2793
|
-
return response.data.getTeam;
|
|
2794
|
-
}
|
|
2795
|
-
async ListTeamMembershipsByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2796
|
-
const statement = `query ListTeamMembershipsByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelTeamMemberFilterInput, $limit: Int, $nextToken: String) {
|
|
2797
|
-
listTeamMembershipsByUserId(
|
|
2798
|
-
userId: $userId
|
|
2799
|
-
createdAt: $createdAt
|
|
2800
|
-
sortDirection: $sortDirection
|
|
2801
|
-
filter: $filter
|
|
2802
|
-
limit: $limit
|
|
2803
|
-
nextToken: $nextToken
|
|
2804
|
-
) {
|
|
2805
|
-
items {
|
|
2806
|
-
id
|
|
2807
|
-
teamId
|
|
2808
|
-
team {
|
|
2809
|
-
${FIELDS_TEAM}
|
|
2810
|
-
}
|
|
2811
|
-
userId
|
|
2812
|
-
isManager
|
|
2813
|
-
createdAt
|
|
2814
|
-
updatedAt
|
|
2815
|
-
deletedAt
|
|
2816
|
-
}
|
|
2817
|
-
nextToken
|
|
2818
|
-
}
|
|
2819
|
-
}`;
|
|
2820
|
-
const gqlAPIServiceArguments = {
|
|
2821
|
-
userId,
|
|
2822
|
-
};
|
|
2823
|
-
if (createdAt) {
|
|
2824
|
-
gqlAPIServiceArguments.createdAt = createdAt;
|
|
2700
|
+
const gqlAPIServiceArguments = { tenantId };
|
|
2701
|
+
if (lastMessageAt) {
|
|
2702
|
+
gqlAPIServiceArguments.lastMessageAt = lastMessageAt;
|
|
2825
2703
|
}
|
|
2826
2704
|
if (sortDirection) {
|
|
2827
2705
|
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
@@ -2836,19 +2714,29 @@ class TeamService {
|
|
|
2836
2714
|
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2837
2715
|
}
|
|
2838
2716
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2839
|
-
return response.data.
|
|
2717
|
+
return response.data.listEntityConversationsByTenantIdAndLastMessageAt;
|
|
2840
2718
|
}
|
|
2841
|
-
|
|
2842
|
-
|
|
2719
|
+
OnEntityConversationByTenantIdListener(tenantId) {
|
|
2720
|
+
const statement = `subscription OnEntityConversationByTenantId($tenantId: ID!) {
|
|
2721
|
+
OnEntityConversationByTenantId(tenantId: $tenantId) {
|
|
2722
|
+
${FIELDS_ENTITY_CONVERSATION_EXPANDED}
|
|
2723
|
+
}
|
|
2724
|
+
}`;
|
|
2725
|
+
const gqlAPIServiceArguments = { tenantId };
|
|
2726
|
+
return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
|
|
2727
|
+
/* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, 'OnEntityConversationByTenantId'>>> */
|
|
2728
|
+
}
|
|
2729
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityConversationService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2730
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityConversationService, providedIn: 'root' });
|
|
2843
2731
|
}
|
|
2844
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type:
|
|
2732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityConversationService, decorators: [{
|
|
2845
2733
|
type: Injectable,
|
|
2846
2734
|
args: [{
|
|
2847
2735
|
providedIn: 'root',
|
|
2848
2736
|
}]
|
|
2849
2737
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2850
2738
|
|
|
2851
|
-
const
|
|
2739
|
+
const FIELDS_TENANT = `
|
|
2852
2740
|
id
|
|
2853
2741
|
externalId
|
|
2854
2742
|
tenantDomain
|
|
@@ -2886,23 +2774,10 @@ class TenantService {
|
|
|
2886
2774
|
constructor(appSyncService) {
|
|
2887
2775
|
this.appSyncService = appSyncService;
|
|
2888
2776
|
}
|
|
2889
|
-
async getTenantById(id) {
|
|
2890
|
-
if (!id || !uuid.validate(id)) {
|
|
2891
|
-
throw { code: 400, message: `Invalid id: ${id}` };
|
|
2892
|
-
}
|
|
2893
|
-
const tenant = await this.GetTenant(id);
|
|
2894
|
-
if (!tenant || !!tenant.deletedAt) {
|
|
2895
|
-
throw { code: 400, message: `Tenant not found` };
|
|
2896
|
-
}
|
|
2897
|
-
if (!tenant.activatedAt || !!tenant.blockedAt) {
|
|
2898
|
-
throw { code: 403, message: `Tenant not activated or subscription has lapsed.` };
|
|
2899
|
-
}
|
|
2900
|
-
return tenant;
|
|
2901
|
-
}
|
|
2902
2777
|
async GetTenant(id) {
|
|
2903
2778
|
const statement = `query GetTenant($id: ID!) {
|
|
2904
2779
|
getTenant(id: $id) {
|
|
2905
|
-
${
|
|
2780
|
+
${FIELDS_TENANT}
|
|
2906
2781
|
}
|
|
2907
2782
|
}`;
|
|
2908
2783
|
const gqlAPIServiceArguments = { id };
|
|
@@ -2912,7 +2787,7 @@ class TenantService {
|
|
|
2912
2787
|
OnTenantByIdListener(id) {
|
|
2913
2788
|
const statement = `subscription OnTenantById($id: ID!) {
|
|
2914
2789
|
OnTenantById(id: $id) {
|
|
2915
|
-
${
|
|
2790
|
+
${FIELDS_TENANT}
|
|
2916
2791
|
}
|
|
2917
2792
|
}`;
|
|
2918
2793
|
const gqlAPIServiceArguments = { id };
|
|
@@ -2929,7 +2804,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
2929
2804
|
}]
|
|
2930
2805
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2931
2806
|
|
|
2932
|
-
const
|
|
2807
|
+
const FIELDS_TICKET_PRIORITY = `
|
|
2808
|
+
id
|
|
2809
|
+
externalId
|
|
2810
|
+
tenantId
|
|
2811
|
+
teamId
|
|
2812
|
+
name
|
|
2813
|
+
description
|
|
2814
|
+
colorCode
|
|
2815
|
+
createdAt
|
|
2816
|
+
updatedAt
|
|
2817
|
+
deletedAt
|
|
2818
|
+
`;
|
|
2819
|
+
const FIELDS_TICKET_STATUS = `
|
|
2820
|
+
id
|
|
2821
|
+
externalId
|
|
2822
|
+
tenantId
|
|
2823
|
+
teamId
|
|
2824
|
+
name
|
|
2825
|
+
description
|
|
2826
|
+
percent
|
|
2827
|
+
colorCode
|
|
2828
|
+
createdAt
|
|
2829
|
+
updatedAt
|
|
2830
|
+
deletedAt
|
|
2831
|
+
`;
|
|
2832
|
+
const FIELDS_TICKET_TYPE = `
|
|
2833
|
+
id
|
|
2834
|
+
externalId
|
|
2835
|
+
tenantId
|
|
2836
|
+
teamId
|
|
2837
|
+
name
|
|
2838
|
+
description
|
|
2839
|
+
colorCode
|
|
2840
|
+
createdAt
|
|
2841
|
+
updatedAt
|
|
2842
|
+
deletedAt
|
|
2843
|
+
`;
|
|
2844
|
+
class TicketService {
|
|
2845
|
+
appSyncService;
|
|
2846
|
+
constructor(appSyncService) {
|
|
2847
|
+
this.appSyncService = appSyncService;
|
|
2848
|
+
}
|
|
2849
|
+
async ListTicketPrioritiesByTenantId(tenantId, name, sortDirection, filter, limit, nextToken) {
|
|
2850
|
+
const statement = `query ListTicketPrioritiesByTenantId($tenantId: ID!, $name: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelTicketPriorityFilterInput, $limit: Int, $nextToken: String) {
|
|
2851
|
+
listTicketPrioritiesByTenantId(
|
|
2852
|
+
tenantId: $tenantId
|
|
2853
|
+
name: $name
|
|
2854
|
+
sortDirection: $sortDirection
|
|
2855
|
+
filter: $filter
|
|
2856
|
+
limit: $limit
|
|
2857
|
+
nextToken: $nextToken
|
|
2858
|
+
) {
|
|
2859
|
+
items {
|
|
2860
|
+
${FIELDS_TICKET_PRIORITY}
|
|
2861
|
+
}
|
|
2862
|
+
nextToken
|
|
2863
|
+
}
|
|
2864
|
+
}`;
|
|
2865
|
+
const gqlAPIServiceArguments = {
|
|
2866
|
+
tenantId,
|
|
2867
|
+
};
|
|
2868
|
+
if (name) {
|
|
2869
|
+
gqlAPIServiceArguments.name = name;
|
|
2870
|
+
}
|
|
2871
|
+
if (sortDirection) {
|
|
2872
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2873
|
+
}
|
|
2874
|
+
if (filter) {
|
|
2875
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2876
|
+
}
|
|
2877
|
+
if (limit) {
|
|
2878
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2879
|
+
}
|
|
2880
|
+
if (nextToken) {
|
|
2881
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2882
|
+
}
|
|
2883
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2884
|
+
return response.data.listTicketPrioritiesByTenantId;
|
|
2885
|
+
}
|
|
2886
|
+
async ListTicketStatusesByTenantId(tenantId, name, sortDirection, filter, limit, nextToken) {
|
|
2887
|
+
const statement = `query ListTicketStatusesByTenantId($tenantId: ID!, $name: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelTicketStatusFilterInput, $limit: Int, $nextToken: String) {
|
|
2888
|
+
listTicketStatusesByTenantId(
|
|
2889
|
+
tenantId: $tenantId
|
|
2890
|
+
name: $name
|
|
2891
|
+
sortDirection: $sortDirection
|
|
2892
|
+
filter: $filter
|
|
2893
|
+
limit: $limit
|
|
2894
|
+
nextToken: $nextToken
|
|
2895
|
+
) {
|
|
2896
|
+
items {
|
|
2897
|
+
${FIELDS_TICKET_STATUS}
|
|
2898
|
+
}
|
|
2899
|
+
nextToken
|
|
2900
|
+
}
|
|
2901
|
+
}`;
|
|
2902
|
+
const gqlAPIServiceArguments = {
|
|
2903
|
+
tenantId,
|
|
2904
|
+
};
|
|
2905
|
+
if (name) {
|
|
2906
|
+
gqlAPIServiceArguments.name = name;
|
|
2907
|
+
}
|
|
2908
|
+
if (sortDirection) {
|
|
2909
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2910
|
+
}
|
|
2911
|
+
if (filter) {
|
|
2912
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2913
|
+
}
|
|
2914
|
+
if (limit) {
|
|
2915
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2916
|
+
}
|
|
2917
|
+
if (nextToken) {
|
|
2918
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2919
|
+
}
|
|
2920
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2921
|
+
return response.data.listTicketStatusesByTenantId;
|
|
2922
|
+
}
|
|
2923
|
+
async ListTicketTypesByTenantId(tenantId, name, sortDirection, filter, limit, nextToken) {
|
|
2924
|
+
const statement = `query ListTicketTypesByTenantId($tenantId: ID!, $name: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelTicketTypeFilterInput, $limit: Int, $nextToken: String) {
|
|
2925
|
+
listTicketTypesByTenantId(
|
|
2926
|
+
tenantId: $tenantId
|
|
2927
|
+
name: $name
|
|
2928
|
+
sortDirection: $sortDirection
|
|
2929
|
+
filter: $filter
|
|
2930
|
+
limit: $limit
|
|
2931
|
+
nextToken: $nextToken
|
|
2932
|
+
) {
|
|
2933
|
+
items {
|
|
2934
|
+
${FIELDS_TICKET_TYPE}
|
|
2935
|
+
}
|
|
2936
|
+
nextToken
|
|
2937
|
+
}
|
|
2938
|
+
}`;
|
|
2939
|
+
const gqlAPIServiceArguments = {
|
|
2940
|
+
tenantId,
|
|
2941
|
+
};
|
|
2942
|
+
if (name) {
|
|
2943
|
+
gqlAPIServiceArguments.name = name;
|
|
2944
|
+
}
|
|
2945
|
+
if (sortDirection) {
|
|
2946
|
+
gqlAPIServiceArguments.sortDirection = sortDirection;
|
|
2947
|
+
}
|
|
2948
|
+
if (filter) {
|
|
2949
|
+
gqlAPIServiceArguments.filter = filter;
|
|
2950
|
+
}
|
|
2951
|
+
if (limit) {
|
|
2952
|
+
gqlAPIServiceArguments.limit = limit;
|
|
2953
|
+
}
|
|
2954
|
+
if (nextToken) {
|
|
2955
|
+
gqlAPIServiceArguments.nextToken = nextToken;
|
|
2956
|
+
}
|
|
2957
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2958
|
+
return response.data.listTicketTypesByTenantId;
|
|
2959
|
+
}
|
|
2960
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TicketService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2961
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TicketService, providedIn: 'root' });
|
|
2962
|
+
}
|
|
2963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TicketService, decorators: [{
|
|
2964
|
+
type: Injectable,
|
|
2965
|
+
args: [{
|
|
2966
|
+
providedIn: 'root',
|
|
2967
|
+
}]
|
|
2968
|
+
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
2969
|
+
|
|
2970
|
+
const FIELDS_USER_SESSION = `
|
|
2933
2971
|
id
|
|
2934
2972
|
tenantId
|
|
2935
2973
|
userId
|
|
@@ -2949,27 +2987,36 @@ class UserSessionService {
|
|
|
2949
2987
|
constructor(appSyncService) {
|
|
2950
2988
|
this.appSyncService = appSyncService;
|
|
2951
2989
|
}
|
|
2952
|
-
async getUserSessionById(id) {
|
|
2953
|
-
if (!id || !uuid.validate(id)) {
|
|
2954
|
-
throw { code: 400, message: `Invalid id: ${id}` };
|
|
2955
|
-
}
|
|
2956
|
-
return await this.GetUserSession(id);
|
|
2957
|
-
}
|
|
2958
2990
|
async GetUserSession(id) {
|
|
2959
2991
|
const statement = `query GetUserSession($id: ID!) {
|
|
2960
2992
|
getUserSession(id: $id) {
|
|
2961
|
-
${
|
|
2993
|
+
${FIELDS_USER_SESSION}
|
|
2962
2994
|
}
|
|
2963
2995
|
}`;
|
|
2964
2996
|
const gqlAPIServiceArguments = { id };
|
|
2965
2997
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2966
2998
|
return response.data.getUserSession;
|
|
2967
2999
|
}
|
|
3000
|
+
async UpdateUserSession(input, condition) {
|
|
3001
|
+
const statement = `mutation UpdateUserSession($input: UpdateUserSessionInput!, $condition: ModelUserSessionConditionInput) {
|
|
3002
|
+
updateUserSession(input: $input, condition: $condition) {
|
|
3003
|
+
${FIELDS_USER_SESSION}
|
|
3004
|
+
}
|
|
3005
|
+
}`;
|
|
3006
|
+
const gqlAPIServiceArguments = {
|
|
3007
|
+
input,
|
|
3008
|
+
};
|
|
3009
|
+
if (condition) {
|
|
3010
|
+
gqlAPIServiceArguments.condition = condition;
|
|
3011
|
+
}
|
|
3012
|
+
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
3013
|
+
return response.data.updateUserSession;
|
|
3014
|
+
}
|
|
2968
3015
|
async ListUserSessionsByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
|
|
2969
3016
|
const statement = `query ListUserSessionsByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelUserSessionFilterInput, $limit: Int, $nextToken: String) {
|
|
2970
3017
|
listUserSessionsByUserId(userId: $userId, createdAt: $createdAt, sortDirection: $sortDirection, filter: $filter, limit: $limit, nextToken: $nextToken) {
|
|
2971
3018
|
items {
|
|
2972
|
-
${
|
|
3019
|
+
${FIELDS_USER_SESSION}
|
|
2973
3020
|
}
|
|
2974
3021
|
nextToken
|
|
2975
3022
|
}
|
|
@@ -2995,25 +3042,10 @@ class UserSessionService {
|
|
|
2995
3042
|
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
2996
3043
|
return response.data.listUserSessionsByUserId;
|
|
2997
3044
|
}
|
|
2998
|
-
async UpdateUserSession(input, condition) {
|
|
2999
|
-
const statement = `mutation UpdateUserSession($input: UpdateUserSessionInput!, $condition: ModelUserSessionConditionInput) {
|
|
3000
|
-
updateUserSession(input: $input, condition: $condition) {
|
|
3001
|
-
${USER_SESSION_FIELDS}
|
|
3002
|
-
}
|
|
3003
|
-
}`;
|
|
3004
|
-
const gqlAPIServiceArguments = {
|
|
3005
|
-
input,
|
|
3006
|
-
};
|
|
3007
|
-
if (condition) {
|
|
3008
|
-
gqlAPIServiceArguments.condition = condition;
|
|
3009
|
-
}
|
|
3010
|
-
const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
|
|
3011
|
-
return response.data.updateUserSession;
|
|
3012
|
-
}
|
|
3013
3045
|
OnUserSessionByIdListener(id) {
|
|
3014
3046
|
const statement = `subscription OnUserSessionById($id: ID!) {
|
|
3015
3047
|
OnUserSessionById(id: $id) {
|
|
3016
|
-
${
|
|
3048
|
+
${FIELDS_USER_SESSION}
|
|
3017
3049
|
}
|
|
3018
3050
|
}`;
|
|
3019
3051
|
const gqlAPIServiceArguments = { id };
|
|
@@ -3030,6 +3062,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
3030
3062
|
}]
|
|
3031
3063
|
}], ctorParameters: () => [{ type: AppSyncHelperService }] });
|
|
3032
3064
|
|
|
3065
|
+
class CleanDeep {
|
|
3066
|
+
static clean(obj) {
|
|
3067
|
+
Object.keys(obj).forEach((key) => {
|
|
3068
|
+
if (obj[key] === undefined || obj[key] === null) {
|
|
3069
|
+
delete obj[key];
|
|
3070
|
+
// obj[key] = null;
|
|
3071
|
+
}
|
|
3072
|
+
else if (typeof obj[key] === 'string') {
|
|
3073
|
+
if (String(obj[key]).trim().length === 0) {
|
|
3074
|
+
delete obj[key];
|
|
3075
|
+
// obj[key] = null;
|
|
3076
|
+
}
|
|
3077
|
+
else {
|
|
3078
|
+
obj[key] = String(obj[key]).trim();
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
});
|
|
3082
|
+
return obj;
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3033
3086
|
class CustomValidators {
|
|
3034
3087
|
/**
|
|
3035
3088
|
* Validator that checks for whitespace-only input.
|
|
@@ -3104,27 +3157,6 @@ class CustomValidators {
|
|
|
3104
3157
|
}
|
|
3105
3158
|
}
|
|
3106
3159
|
|
|
3107
|
-
class CleanDeep {
|
|
3108
|
-
static clean(obj) {
|
|
3109
|
-
Object.keys(obj).forEach((key) => {
|
|
3110
|
-
if (obj[key] === undefined || obj[key] === null) {
|
|
3111
|
-
delete obj[key];
|
|
3112
|
-
// obj[key] = null;
|
|
3113
|
-
}
|
|
3114
|
-
else if (typeof obj[key] === 'string') {
|
|
3115
|
-
if (String(obj[key]).trim().length === 0) {
|
|
3116
|
-
delete obj[key];
|
|
3117
|
-
// obj[key] = null;
|
|
3118
|
-
}
|
|
3119
|
-
else {
|
|
3120
|
-
obj[key] = String(obj[key]).trim();
|
|
3121
|
-
}
|
|
3122
|
-
}
|
|
3123
|
-
});
|
|
3124
|
-
return obj;
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
|
|
3128
3160
|
/*
|
|
3129
3161
|
* Public API Surface of core
|
|
3130
3162
|
*/
|
|
@@ -3133,5 +3165,5 @@ class CleanDeep {
|
|
|
3133
3165
|
* Generated bundle index. Do not edit.
|
|
3134
3166
|
*/
|
|
3135
3167
|
|
|
3136
|
-
export { AMPLIFY_CONFIG, AppSyncHelperService, CleanDeep, CustomPipesModule, CustomValidators, DomainNamePipe, EntityConversationService, EntityService, ErrorComponent, FIELDS_ENTITY_CONVERSATION, FIELDS_ENTITY_CONVERSATION_EXPANDED, FIELDS_INTERACTION_WIDGET, FIELDS_USER, FooterComponent, FormatEpochTimestampPipe, InteractionChannel, InteractionContext, InteractionDirection, InteractionEndpointService, InteractionProvider, InteractionRouteLogic, InteractionService, InteractionStatus, InteractionWidgetService, LoaderComponent, OpenSearchHelperService, S3HelperService, SafeHtmlPipe, SearchInnerFieldPipe, SearchPipe, SingularizePipe, SnugdeskAuthenticationService, SnugdeskCoreModule, SnugdeskIPRegistryService, TeamService, TenantService, UserService, UserSessionService, UserStatus, UserType, provideAmplifyConfig };
|
|
3168
|
+
export { AMPLIFY_CONFIG, AppSyncHelperService, CleanDeep, CustomPipesModule, CustomValidators, DomainNamePipe, EntityConversationService, EntityService, ErrorComponent, FIELDS_ENTITY, FIELDS_ENTITY_CONVERSATION, FIELDS_ENTITY_CONVERSATION_EXPANDED, FIELDS_ENTITY_EXPANDED, FIELDS_ENTITY_MINIMAL, FIELDS_ENTITY_TYPE, FIELDS_INTERACTION, FIELDS_INTERACTION_ATTENDEE, FIELDS_INTERACTION_ATTENDEE_EXPANDED, FIELDS_INTERACTION_ENDPOINT, FIELDS_INTERACTION_EXPANDED, FIELDS_INTERACTION_HOST, FIELDS_INTERACTION_INVITEE, FIELDS_INTERACTION_MESSAGE, FIELDS_INTERACTION_MESSAGE_ATTACHMENT, FIELDS_INTERACTION_MESSAGE_EXPANDED, FIELDS_INTERACTION_WIDGET, FIELDS_INTERACTION_WIDGET_USER_SETTING, FIELDS_TEAM, FIELDS_TEAM_MEMBER, FIELDS_TICKET_PRIORITY, FIELDS_TICKET_STATUS, FIELDS_TICKET_TYPE, FIELDS_USER, FooterComponent, FormatEpochTimestampPipe, InteractionChannel, InteractionContext, InteractionDirection, InteractionEndpointService, InteractionProvider, InteractionRouteLogic, InteractionService, InteractionStatus, InteractionWidgetService, LoaderComponent, ModelAttributeTypes, ModelSortDirection, OpenSearchHelperService, S3HelperService, SafeHtmlPipe, SearchInnerFieldPipe, SearchPipe, SingularizePipe, SnugdeskAuthenticationService, SnugdeskCoreModule, SnugdeskIPRegistryService, TeamService, TenantSSOConfigurationProtocol, TenantService, TicketService, UserService, UserSessionService, UserStatus, UserType, provideAmplifyConfig };
|
|
3137
3169
|
//# sourceMappingURL=snugdesk-core.mjs.map
|