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