@snugdesk/core 0.2.5 → 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.
@@ -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,87 @@ var ModelSortDirection;
1117
1116
  ModelSortDirection["DESC"] = "DESC";
1118
1117
  })(ModelSortDirection || (ModelSortDirection = {}));
1119
1118
 
1120
- const FIELDS_ENTITY_CONVERSATION = `
1121
- id
1122
- tenantId
1123
- entityId
1124
- entityAddress
1125
- interactionChannel
1126
- interactionProvider
1127
- isCampaignEngaged
1128
- campaignId
1129
- lastCampaignFlowNodeId
1130
- lastInteractionMessageId
1131
- metadata
1132
- lastActivityAt
1133
- lastMessageAt
1134
- archivedAt
1135
- blockedAt
1136
- createdAt
1137
- updatedAt
1138
- deletedAt
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
1139
1146
  `;
1140
- const FIELDS_ENTITY_CONVERSATION_EXPANDED = `
1147
+ const FIELDS_ENTITY = `
1141
1148
  id
1149
+ externalId
1142
1150
  tenantId
1143
- entityId
1144
- entity {
1145
- id
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;
1151
+ entityTypeId
1152
+ entityType {
1153
+ ${FIELDS_ENTITY_TYPE}
1303
1154
  }
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;
1155
+ parentId
1156
+ name
1157
+ image {
1158
+ location
1338
1159
  }
1339
- async ListEntityConversationsByTenantIdAndArchivedAt(tenantId, archivedAt, sortDirection, filter, limit, nextToken) {
1340
- const statement = `query ListEntityConversationsByTenantIdAndArchivedAt($tenantId: ID!, $archivedAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityConversationFilterInput, $limit: Int, $nextToken: String) {
1341
- listEntityConversationsByTenantIdAndArchivedAt(
1342
- tenantId: $tenantId
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;
1160
+ email
1161
+ phoneNumber {
1162
+ countryCode
1163
+ dialCode
1164
+ e164Number
1165
+ internationalNumber
1166
+ nationalNumber
1167
+ number
1373
1168
  }
1374
- async ListEntityConversationsByTenantIdAndLastMessageAt(tenantId, lastMessageAt, sortDirection, filter, limit, nextToken) {
1375
- const statement = `query ListEntityConversationsByTenantIdAndLastMessageAt($tenantId: ID!, $lastMessageAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelEntityConversationFilterInput, $limit: Int, $nextToken: String) {
1376
- listEntityConversationsByTenantIdAndLastMessageAt(
1377
- tenantId: $tenantId
1378
- lastMessageAt: $lastMessageAt
1379
- sortDirection: $sortDirection
1380
- filter: $filter
1381
- limit: $limit
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;
1169
+ phoneNumberE164
1170
+ isOrganization
1171
+ customFields
1172
+ metadata
1173
+ notes
1174
+ preferences {
1175
+ timezoneName
1176
+ language {
1177
+ code
1178
+ nameEn
1179
+ nameLocal
1180
+ }
1408
1181
  }
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'>>> */
1182
+ contactPreferences {
1183
+ allowCall
1184
+ allowEmail
1185
+ allowSMS
1186
+ allowWhatsApp
1418
1187
  }
1419
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityConversationService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
1420
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityConversationService, providedIn: 'root' });
1421
- }
1422
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityConversationService, decorators: [{
1423
- type: Injectable,
1424
- args: [{
1425
- providedIn: 'root',
1426
- }]
1427
- }], ctorParameters: () => [{ type: AppSyncHelperService }] });
1428
-
1429
- const ENTITY_SELECTION = /* GraphQL */ `
1188
+ createdAt
1189
+ updatedAt
1190
+ blockedAt
1191
+ deletedAt
1192
+ `;
1193
+ const FIELDS_ENTITY_EXPANDED = `
1430
1194
  id
1431
1195
  externalId
1432
1196
  tenantId
1433
1197
  entityTypeId
1434
1198
  entityType {
1435
- id
1436
- externalId
1437
- tenantId
1438
- name
1439
- description
1440
- image {
1441
- location
1442
- }
1443
- createdAt
1444
- updatedAt
1445
- deletedAt
1199
+ ${FIELDS_ENTITY_TYPE}
1446
1200
  }
1447
1201
  parentId
1448
1202
  parent {
@@ -1485,6 +1239,9 @@ const ENTITY_SELECTION = /* GraphQL */ `
1485
1239
  number
1486
1240
  }
1487
1241
  phoneNumberE164
1242
+ customFields
1243
+ metadata
1244
+ notes
1488
1245
  preferences {
1489
1246
  timezoneName
1490
1247
  language {
@@ -1504,10 +1261,11 @@ const ENTITY_SELECTION = /* GraphQL */ `
1504
1261
  blockedAt
1505
1262
  deletedAt
1506
1263
  `;
1507
- const ENTITY_SELECTION_MINIMAL = /* GraphQL */ `
1264
+ const FIELDS_ENTITY_MINIMAL = `
1508
1265
  id
1509
1266
  externalId
1510
1267
  tenantId
1268
+ metadata
1511
1269
  name
1512
1270
  image {
1513
1271
  location
@@ -1550,7 +1308,7 @@ class EntityService {
1550
1308
  const statement = /* GraphQL */ `
1551
1309
  query GetEntity($id: ID!) {
1552
1310
  getEntity(id: $id) {
1553
- ${ENTITY_SELECTION_MINIMAL}
1311
+ ${FIELDS_ENTITY_EXPANDED}
1554
1312
  }
1555
1313
  }
1556
1314
  `;
@@ -1561,7 +1319,7 @@ class EntityService {
1561
1319
  const statement = /* GraphQL */ `
1562
1320
  mutation CreateEntity($input: CreateEntityInput!, $condition: ModelEntityConditionInput) {
1563
1321
  createEntity(input: $input, condition: $condition) {
1564
- ${ENTITY_SELECTION_MINIMAL}
1322
+ ${FIELDS_ENTITY}
1565
1323
  }
1566
1324
  }
1567
1325
  `;
@@ -1576,7 +1334,7 @@ class EntityService {
1576
1334
  const statement = /* GraphQL */ `
1577
1335
  mutation UpdateEntity($input: UpdateEntityInput!, $condition: ModelEntityConditionInput) {
1578
1336
  updateEntity(input: $input, condition: $condition) {
1579
- ${ENTITY_SELECTION_MINIMAL}
1337
+ ${FIELDS_ENTITY}
1580
1338
  }
1581
1339
  }
1582
1340
  `;
@@ -1598,7 +1356,7 @@ class EntityService {
1598
1356
  nextToken: $nextToken
1599
1357
  ) {
1600
1358
  items {
1601
- ${ENTITY_SELECTION_MINIMAL}
1359
+ ${FIELDS_ENTITY}
1602
1360
  }
1603
1361
  nextToken
1604
1362
  }
@@ -1635,7 +1393,7 @@ class EntityService {
1635
1393
  nextToken: $nextToken
1636
1394
  ) {
1637
1395
  items {
1638
- ${ENTITY_SELECTION_MINIMAL}
1396
+ ${FIELDS_ENTITY}
1639
1397
  }
1640
1398
  nextToken
1641
1399
  }
@@ -1661,6 +1419,36 @@ class EntityService {
1661
1419
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
1662
1420
  return response.data.listEntitiesByTenantIdAndPhoneNumberE164;
1663
1421
  }
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) {
1425
+ items {
1426
+ ${FIELDS_ENTITY_TYPE}
1427
+ }
1428
+ nextToken
1429
+ }
1430
+ }`;
1431
+ const gqlAPIServiceArguments = {
1432
+ tenantId,
1433
+ };
1434
+ if (name) {
1435
+ gqlAPIServiceArguments.name = name;
1436
+ }
1437
+ if (sortDirection) {
1438
+ gqlAPIServiceArguments.sortDirection = sortDirection;
1439
+ }
1440
+ if (filter) {
1441
+ gqlAPIServiceArguments.filter = filter;
1442
+ }
1443
+ if (limit) {
1444
+ gqlAPIServiceArguments.limit = limit;
1445
+ }
1446
+ if (nextToken) {
1447
+ gqlAPIServiceArguments.nextToken = nextToken;
1448
+ }
1449
+ const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
1450
+ return response.data.listEntityTypesByTenantId;
1451
+ }
1664
1452
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
1665
1453
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityService, providedIn: 'root' });
1666
1454
  }
@@ -1671,6 +1459,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
1671
1459
  }]
1672
1460
  }], ctorParameters: () => [{ type: AppSyncHelperService }] });
1673
1461
 
1462
+ const FIELDS_INTERACTION_ENDPOINT = `
1463
+ id
1464
+ externalId
1465
+ tenantId
1466
+ widgetId
1467
+ address
1468
+ configuration
1469
+ createdAt
1470
+ updatedAt
1471
+ deletedAt
1472
+ `;
1674
1473
  class InteractionEndpointService {
1675
1474
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionEndpointService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1676
1475
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionEndpointService, providedIn: 'root' });
@@ -1704,40 +1503,256 @@ const FIELDS_INTERACTION_WIDGET = `
1704
1503
  updatedAt
1705
1504
  deletedAt
1706
1505
  `;
1707
- class InteractionWidgetService {
1506
+ const FIELDS_INTERACTION_WIDGET_USER_SETTING = `
1507
+ id
1508
+ widgetId
1509
+ userId
1510
+ configuration
1511
+ allowOverride
1512
+ createdAt
1513
+ updatedAt
1514
+ deletedAt
1515
+ updatedByUserId
1516
+ updatedByUserSessionId
1517
+ `;
1518
+ class InteractionWidgetService {
1519
+ appSyncService;
1520
+ constructor(appSyncService) {
1521
+ this.appSyncService = appSyncService;
1522
+ }
1523
+ async GetInteractionWidget(id) {
1524
+ const statement = `query GetInteractionWidget($id: ID!) {
1525
+ getInteractionWidget(id: $id) {
1526
+ ${FIELDS_INTERACTION_WIDGET}
1527
+ }
1528
+ }`;
1529
+ const gqlAPIServiceArguments = { id };
1530
+ const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
1531
+ return response.data.getInteractionWidget;
1532
+ }
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(
1536
+ tenantId: $tenantId
1537
+ name: $name
1538
+ sortDirection: $sortDirection
1539
+ filter: $filter
1540
+ limit: $limit
1541
+ nextToken: $nextToken
1542
+ ) {
1543
+ items {
1544
+ ${FIELDS_INTERACTION_WIDGET}
1545
+ }
1546
+ nextToken
1547
+ }
1548
+ }`;
1549
+ const gqlAPIServiceArguments = { tenantId };
1550
+ if (name) {
1551
+ gqlAPIServiceArguments.name = name;
1552
+ }
1553
+ if (sortDirection) {
1554
+ gqlAPIServiceArguments.sortDirection = sortDirection;
1555
+ }
1556
+ if (filter) {
1557
+ gqlAPIServiceArguments.filter = filter;
1558
+ }
1559
+ if (limit) {
1560
+ gqlAPIServiceArguments.limit = limit;
1561
+ }
1562
+ if (nextToken) {
1563
+ gqlAPIServiceArguments.nextToken = nextToken;
1564
+ }
1565
+ const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
1566
+ return response.data.listInteractionWidgetsByTenantId;
1567
+ }
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
1573
+ sortDirection: $sortDirection
1574
+ filter: $filter
1575
+ limit: $limit
1576
+ nextToken: $nextToken
1577
+ ) {
1578
+ items {
1579
+ ${FIELDS_INTERACTION_WIDGET_USER_SETTING}
1580
+ }
1581
+ nextToken
1582
+ }
1583
+ }`;
1584
+ const gqlAPIServiceArguments = { userId };
1585
+ if (createdAt) {
1586
+ gqlAPIServiceArguments.createdAt = createdAt;
1587
+ }
1588
+ if (sortDirection) {
1589
+ gqlAPIServiceArguments.sortDirection = sortDirection;
1590
+ }
1591
+ if (filter) {
1592
+ gqlAPIServiceArguments.filter = filter;
1593
+ }
1594
+ if (limit) {
1595
+ gqlAPIServiceArguments.limit = limit;
1596
+ }
1597
+ if (nextToken) {
1598
+ gqlAPIServiceArguments.nextToken = nextToken;
1599
+ }
1600
+ const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
1601
+ return response.data.listInteractionWidgetUserSettingsByUserId;
1602
+ }
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' });
1605
+ }
1606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionWidgetService, decorators: [{
1607
+ type: Injectable,
1608
+ args: [{
1609
+ providedIn: 'root',
1610
+ }]
1611
+ }], ctorParameters: () => [{ type: AppSyncHelperService }] });
1612
+
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' });
1680
+ }
1681
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, decorators: [{
1682
+ type: Injectable,
1683
+ args: [{
1684
+ providedIn: 'root',
1685
+ }]
1686
+ }], ctorParameters: () => [{ type: AppSyncHelperService }] });
1687
+
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
1702
+ `;
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 GetInteractionWidget(id) {
1713
- const statement = `query GetInteractionWidget($id: ID!) {
1714
- getInteractionWidget(id: $id) {
1715
- ${FIELDS_INTERACTION_WIDGET}
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 = { id };
1729
+ const gqlAPIServiceArguments = {
1730
+ id,
1731
+ };
1719
1732
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
1720
- return response.data.getInteractionWidget;
1733
+ return response.data.getTeam;
1721
1734
  }
1722
- async ListInteractionWidgetsByTenantId(tenantId, name, sortDirection, filter, limit, nextToken) {
1723
- const statement = `query ListInteractionWidgetsByTenantId($tenantId: ID!, $name: ModelStringKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionWidgetFilterInput, $limit: Int, $nextToken: String) {
1724
- listInteractionWidgetsByTenantId(
1725
- tenantId: $tenantId
1726
- name: $name
1727
- sortDirection: $sortDirection
1728
- filter: $filter
1729
- limit: $limit
1730
- nextToken: $nextToken
1731
- ) {
1732
- items {
1733
- ${FIELDS_INTERACTION_WIDGET}
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
- nextToken
1736
- }
1737
- }`;
1738
- const gqlAPIServiceArguments = { tenantId };
1739
- if (name) {
1740
- gqlAPIServiceArguments.name = name;
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,67 +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.listInteractionWidgetsByTenantId;
1770
+ return response.data.listTeamMembershipsByUserId;
1756
1771
  }
1757
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionWidgetService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
1758
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InteractionWidgetService, providedIn: 'root' });
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: InteractionWidgetService, decorators: [{
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
- var InteractionChannel;
1768
- (function (InteractionChannel) {
1769
- InteractionChannel["EMAIL"] = "EMAIL";
1770
- InteractionChannel["PHONE"] = "PHONE";
1771
- InteractionChannel["SMS"] = "SMS";
1772
- InteractionChannel["WEB_CHAT"] = "WEB_CHAT";
1773
- InteractionChannel["SOCIAL_CHAT"] = "SOCIAL_CHAT";
1774
- })(InteractionChannel || (InteractionChannel = {}));
1775
- var InteractionContext;
1776
- (function (InteractionContext) {
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 = {}));
1782
+ const FIELDS_INTERACTION_HOST = `
1783
+ id
1784
+ interactionId
1785
+ entityId
1786
+ teamId
1787
+ userId
1788
+ createdAt
1789
+ updatedAt
1790
+ deletedAt
1791
+ `;
1816
1792
  const FIELDS_INTERACTION = `
1817
1793
  id
1818
1794
  tenantId
@@ -1822,6 +1798,9 @@ const FIELDS_INTERACTION = `
1822
1798
  entityId
1823
1799
  teamId
1824
1800
  hostId
1801
+ host {
1802
+ ${FIELDS_INTERACTION_HOST}
1803
+ }
1825
1804
  providerInteractionId
1826
1805
  channel
1827
1806
  provider
@@ -1849,115 +1828,27 @@ const FIELDS_INTERACTION_EXPANDED = `
1849
1828
  tenantId
1850
1829
  widgetId
1851
1830
  widget {
1852
- id
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
1831
+ ${FIELDS_INTERACTION_WIDGET}
1867
1832
  }
1868
1833
  endpointId
1869
1834
  endpoint {
1870
- id
1871
- externalId
1872
- tenantId
1873
- widgetId
1874
- address
1875
- configuration
1876
- createdAt
1877
- updatedAt
1878
- deletedAt
1835
+ ${FIELDS_INTERACTION_ENDPOINT}
1879
1836
  }
1880
1837
  entityConversationId
1881
1838
  entityConversation {
1882
- id
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
1839
+ ${FIELDS_ENTITY_CONVERSATION}
1900
1840
  }
1901
1841
  entityId
1902
1842
  entity {
1903
- id
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
1843
+ ${FIELDS_ENTITY}
1940
1844
  }
1941
1845
  teamId
1942
1846
  team {
1943
- id
1944
- tenantId
1945
- name
1946
- description
1947
- createdAt
1948
- updatedAt
1949
- deletedAt
1847
+ ${FIELDS_TEAM}
1950
1848
  }
1951
1849
  hostId
1952
1850
  host {
1953
- id
1954
- interactionId
1955
- entityId
1956
- teamId
1957
- userId
1958
- createdAt
1959
- updatedAt
1960
- deletedAt
1851
+ ${FIELDS_INTERACTION_HOST}
1961
1852
  }
1962
1853
  providerInteractionId
1963
1854
  channel
@@ -1983,125 +1874,32 @@ const FIELDS_INTERACTION_EXPANDED = `
1983
1874
  updatedAt
1984
1875
  deletedAt
1985
1876
  `;
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
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
2003
1895
  `;
2004
- const FIELDS_INTERACTION_ATTENDEE_EXPANDED = `
1896
+ const FIELDS_INTERACTION_ATTENDEE = `
2005
1897
  id
2006
1898
  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
- }
1899
+ entityId
1900
+ interactionWidgetSessionId
1901
+ teamId
1902
+ userId
2105
1903
  userSessionId
2106
1904
  name
2107
1905
  metadata
@@ -2113,60 +1911,32 @@ const FIELDS_INTERACTION_ATTENDEE_EXPANDED = `
2113
1911
  updatedAt
2114
1912
  deletedAt
2115
1913
  `;
2116
- const FIELDS_INTERACTION_INVITEE = `
2117
- id
2118
- interactionId
2119
- interaction {
2120
- ${FIELDS_INTERACTION}
2121
- }
2122
- entityId
2123
- entity {
1914
+ const FIELDS_INTERACTION_ATTENDEE_EXPANDED = `
2124
1915
  id
2125
- externalId
2126
- tenantId
2127
- entityTypeId
2128
- entityType {
2129
- id
2130
- externalId
2131
- name
2132
- description
2133
- createdAt
2134
- updatedAt
2135
- deletedAt
1916
+ interactionId
1917
+ entityId
1918
+ entity {
1919
+ ${FIELDS_ENTITY_EXPANDED}
2136
1920
  }
2137
- parentId
2138
- name
2139
- image {
2140
- key
2141
- bucket
2142
- location
1921
+ interactionWidgetSessionId
1922
+ teamId
1923
+ team {
1924
+ ${FIELDS_TEAM}
2143
1925
  }
2144
- email
2145
- phoneNumber {
2146
- countryCode
2147
- dialCode
2148
- e164Number
2149
- internationalNumber
2150
- nationalNumber
2151
- number
1926
+ userId
1927
+ user {
1928
+ ${FIELDS_USER}
2152
1929
  }
2153
- phoneNumberE164
2154
- isOrganization
2155
- notes
1930
+ userSessionId
1931
+ name
1932
+ metadata
2156
1933
  customFields
1934
+ isAdministrator
1935
+ joinedAt
1936
+ exitedAt
2157
1937
  createdAt
2158
1938
  updatedAt
2159
- blockedAt
2160
1939
  deletedAt
2161
- }
2162
- teamId
2163
- userId
2164
- isAdministrator
2165
- temp_expiringAt
2166
- expiredAt
2167
- createdAt
2168
- updatedAt
2169
- deletedAt
2170
1940
  `;
2171
1941
  const FIELDS_INTERACTION_MESSAGE_ATTACHMENT = `
2172
1942
  id
@@ -2189,40 +1959,11 @@ const FIELDS_INTERACTION_MESSAGE = `
2189
1959
  id
2190
1960
  externalId
2191
1961
  endpointId
2192
- endpoint {
2193
- id
2194
- externalId
2195
- tenantId
2196
- widgetId
2197
- address
2198
- configuration
2199
- createdAt
2200
- updatedAt
2201
- deletedAt
2202
- }
2203
1962
  campaignId
2204
1963
  campaignFlowNodeId
2205
1964
  entityConversationId
2206
1965
  interactionId
2207
1966
  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
1967
  body
2227
1968
  metadata
2228
1969
  referenceMessageId
@@ -2236,15 +1977,21 @@ const FIELDS_INTERACTION_MESSAGE = `
2236
1977
  nextToken
2237
1978
  }
2238
1979
  `;
2239
- const FIELDS_INTERACTION_MESSAGE_MINIMAL = `
1980
+ const FIELDS_INTERACTION_MESSAGE_EXPANDED = `
2240
1981
  id
2241
1982
  externalId
2242
1983
  endpointId
1984
+ endpoint {
1985
+ ${FIELDS_INTERACTION_ENDPOINT}
1986
+ }
2243
1987
  campaignId
2244
1988
  campaignFlowNodeId
2245
1989
  entityConversationId
2246
1990
  interactionId
2247
1991
  interactionAttendeeId
1992
+ interactionAttendee {
1993
+ ${FIELDS_INTERACTION_ATTENDEE}
1994
+ }
2248
1995
  body
2249
1996
  metadata
2250
1997
  referenceMessageId
@@ -2287,7 +2034,7 @@ class InteractionService {
2287
2034
  async GetInteractionMessage(id) {
2288
2035
  const statement = `query GetInteractionMessage($id: ID!) {
2289
2036
  getInteractionMessage(id: $id) {
2290
- ${FIELDS_INTERACTION_MESSAGE}
2037
+ ${FIELDS_INTERACTION_MESSAGE_EXPANDED}
2291
2038
  }
2292
2039
  }`;
2293
2040
  const gqlAPIServiceArguments = {
@@ -2338,7 +2085,7 @@ class InteractionService {
2338
2085
  async CreateInteractionMessage(input, condition) {
2339
2086
  const statement = `mutation CreateInteractionMessage($input: CreateInteractionMessageInput!, $condition: ModelInteractionMessageConditionInput) {
2340
2087
  createInteractionMessage(input: $input, condition: $condition) {
2341
- ${FIELDS_INTERACTION_MESSAGE_MINIMAL}
2088
+ ${FIELDS_INTERACTION_MESSAGE}
2342
2089
  }
2343
2090
  }`;
2344
2091
  const gqlAPIServiceArguments = { input };
@@ -2361,6 +2108,41 @@ class InteractionService {
2361
2108
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2362
2109
  return response.data.createInteractionMessageAttachment;
2363
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
+ }
2364
2146
  async ListInteractionInviteesByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
2365
2147
  const statement = `query ListInteractionInviteesByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelInteractionInviteeFilterInput, $limit: Int, $nextToken: String) {
2366
2148
  listInteractionInviteesByUserId(
@@ -2477,7 +2259,7 @@ class InteractionService {
2477
2259
  nextToken: $nextToken
2478
2260
  ) {
2479
2261
  items {
2480
- ${FIELDS_INTERACTION_MESSAGE}
2262
+ ${FIELDS_INTERACTION_MESSAGE_EXPANDED}
2481
2263
  }
2482
2264
  nextToken
2483
2265
  }
@@ -2512,7 +2294,7 @@ class InteractionService {
2512
2294
  nextToken: $nextToken
2513
2295
  ) {
2514
2296
  items {
2515
- ${FIELDS_INTERACTION_MESSAGE}
2297
+ ${FIELDS_INTERACTION_MESSAGE_EXPANDED}
2516
2298
  }
2517
2299
  nextToken
2518
2300
  }
@@ -2547,7 +2329,7 @@ class InteractionService {
2547
2329
  nextToken: $nextToken
2548
2330
  ) {
2549
2331
  items {
2550
- ${FIELDS_INTERACTION_MESSAGE}
2332
+ ${FIELDS_INTERACTION_MESSAGE_EXPANDED}
2551
2333
  }
2552
2334
  nextToken
2553
2335
  }
@@ -2623,7 +2405,7 @@ class InteractionService {
2623
2405
  OnInteractionMessageByEntityConversationId(
2624
2406
  entityConversationId: $entityConversationId
2625
2407
  ) {
2626
- ${FIELDS_INTERACTION_MESSAGE}
2408
+ ${FIELDS_INTERACTION_MESSAGE_EXPANDED}
2627
2409
  }
2628
2410
  }`;
2629
2411
  const gqlAPIServiceArguments = { entityConversationId };
@@ -2640,188 +2422,228 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
2640
2422
  }]
2641
2423
  }], ctorParameters: () => [{ type: AppSyncHelperService }] });
2642
2424
 
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
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
2668
2478
  }
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
2479
  `;
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 {
2480
+ class EntityConversationService {
2698
2481
  appSyncService;
2699
2482
  constructor(appSyncService) {
2700
2483
  this.appSyncService = appSyncService;
2701
2484
  }
2702
- async getUserById(id) {
2703
- if (!id || !uuid.validate(id)) {
2704
- throw { code: 400, message: `Invalid id: ${id}` };
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;
2504
+ }
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}
2512
+ }
2513
+ }`;
2514
+ const gqlAPIServiceArguments = { input };
2515
+ if (condition) {
2516
+ gqlAPIServiceArguments.condition = condition;
2517
+ }
2518
+ const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2519
+ return response.data.updateEntityConversation;
2520
+ }
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
2525
+ createdAt: $createdAt
2526
+ sortDirection: $sortDirection
2527
+ filter: $filter
2528
+ limit: $limit
2529
+ nextToken: $nextToken
2530
+ ) {
2531
+ items {
2532
+ ${FIELDS_ENTITY_CONVERSATION_EXPANDED}
2533
+ }
2534
+ nextToken
2705
2535
  }
2706
- const user = await this.GetUser(id);
2707
- if (!user || !!user.deletedAt) {
2708
- throw { code: 400, message: `User not found` };
2536
+ }`;
2537
+ const gqlAPIServiceArguments = {
2538
+ entityId,
2539
+ };
2540
+ if (createdAt) {
2541
+ gqlAPIServiceArguments.createdAt = createdAt;
2709
2542
  }
2710
- if (!user.activatedAt) {
2711
- throw { code: 403, message: `User not activated.` };
2543
+ if (sortDirection) {
2544
+ gqlAPIServiceArguments.sortDirection = sortDirection;
2712
2545
  }
2713
- if (!!user.blockedAt) {
2714
- throw { code: 403, message: `User has been blocked.` };
2546
+ if (filter) {
2547
+ gqlAPIServiceArguments.filter = filter;
2715
2548
  }
2716
- return user;
2717
- }
2718
- async GetUser(id) {
2719
- const statement = `query GetUser($id: ID!) {
2720
- getUser(id: $id) {
2721
- ${FIELDS_USER}
2549
+ if (limit) {
2550
+ gqlAPIServiceArguments.limit = limit;
2551
+ }
2552
+ if (nextToken) {
2553
+ gqlAPIServiceArguments.nextToken = nextToken;
2722
2554
  }
2723
- }`;
2724
- const gqlAPIServiceArguments = { id };
2725
2555
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2726
- return response.data.getUser;
2556
+ return response.data.listEntityConversationsByEntityId;
2727
2557
  }
2728
- OnUserByIdListener(id) {
2729
- const statement = `subscription OnUserById($id: ID!) {
2730
- OnUserById(id: $id) {
2731
- ${FIELDS_USER}
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
2563
+ sortDirection: $sortDirection
2564
+ filter: $filter
2565
+ limit: $limit
2566
+ nextToken: $nextToken
2567
+ ) {
2568
+ items {
2569
+ ${FIELDS_ENTITY_CONVERSATION_EXPANDED}
2570
+ }
2571
+ nextToken
2732
2572
  }
2733
2573
  }`;
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;
2574
+ const gqlAPIServiceArguments = { tenantId };
2575
+ if (entityAddress) {
2576
+ gqlAPIServiceArguments.entityAddress = entityAddress;
2577
+ }
2578
+ if (sortDirection) {
2579
+ gqlAPIServiceArguments.sortDirection = sortDirection;
2580
+ }
2581
+ if (filter) {
2582
+ gqlAPIServiceArguments.filter = filter;
2583
+ }
2584
+ if (limit) {
2585
+ gqlAPIServiceArguments.limit = limit;
2586
+ }
2587
+ if (nextToken) {
2588
+ gqlAPIServiceArguments.nextToken = nextToken;
2589
+ }
2590
+ const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2591
+ return response.data.listEntityConversationsByTenantIdAndEntityAddress;
2782
2592
  }
2783
- async GetTeam(id) {
2784
- const statement = `query GetTeam($id: ID!) {
2785
- getTeam(id: $id) {
2786
- ${FIELDS_TEAM}
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
2598
+ sortDirection: $sortDirection
2599
+ filter: $filter
2600
+ limit: $limit
2601
+ nextToken: $nextToken
2602
+ ) {
2603
+ items {
2604
+ ${FIELDS_ENTITY_CONVERSATION_EXPANDED}
2605
+ }
2606
+ nextToken
2787
2607
  }
2788
2608
  }`;
2789
- const gqlAPIServiceArguments = {
2790
- id,
2791
- };
2609
+ const gqlAPIServiceArguments = { tenantId };
2610
+ if (archivedAt) {
2611
+ gqlAPIServiceArguments.archivedAt = archivedAt;
2612
+ }
2613
+ if (sortDirection) {
2614
+ gqlAPIServiceArguments.sortDirection = sortDirection;
2615
+ }
2616
+ if (filter) {
2617
+ gqlAPIServiceArguments.filter = filter;
2618
+ }
2619
+ if (limit) {
2620
+ gqlAPIServiceArguments.limit = limit;
2621
+ }
2622
+ if (nextToken) {
2623
+ gqlAPIServiceArguments.nextToken = nextToken;
2624
+ }
2792
2625
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2793
- return response.data.getTeam;
2626
+ return response.data.listEntityConversationsByTenantIdAndArchivedAt;
2794
2627
  }
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
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
2633
+ sortDirection: $sortDirection
2634
+ filter: $filter
2635
+ limit: $limit
2636
+ nextToken: $nextToken
2637
+ ) {
2638
+ items {
2639
+ ${FIELDS_ENTITY_CONVERSATION_EXPANDED}
2818
2640
  }
2819
- }`;
2820
- const gqlAPIServiceArguments = {
2821
- userId,
2822
- };
2823
- if (createdAt) {
2824
- gqlAPIServiceArguments.createdAt = createdAt;
2641
+ nextToken
2642
+ }
2643
+ }`;
2644
+ const gqlAPIServiceArguments = { tenantId };
2645
+ if (lastMessageAt) {
2646
+ gqlAPIServiceArguments.lastMessageAt = lastMessageAt;
2825
2647
  }
2826
2648
  if (sortDirection) {
2827
2649
  gqlAPIServiceArguments.sortDirection = sortDirection;
@@ -2836,19 +2658,29 @@ class TeamService {
2836
2658
  gqlAPIServiceArguments.nextToken = nextToken;
2837
2659
  }
2838
2660
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2839
- return response.data.listTeamMembershipsByUserId;
2661
+ return response.data.listEntityConversationsByTenantIdAndLastMessageAt;
2840
2662
  }
2841
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, deps: [{ token: AppSyncHelperService }], target: i0.ɵɵFactoryTarget.Injectable });
2842
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, providedIn: 'root' });
2663
+ OnEntityConversationByTenantIdListener(tenantId) {
2664
+ const statement = `subscription OnEntityConversationByTenantId($tenantId: ID!) {
2665
+ OnEntityConversationByTenantId(tenantId: $tenantId) {
2666
+ ${FIELDS_ENTITY_CONVERSATION_EXPANDED}
2667
+ }
2668
+ }`;
2669
+ const gqlAPIServiceArguments = { tenantId };
2670
+ return this.appSyncService.subscribe(statement, gqlAPIServiceArguments);
2671
+ /* as Observable<SubscriptionResponse<Pick<__SubscriptionContainer, 'OnEntityConversationByTenantId'>>> */
2672
+ }
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' });
2843
2675
  }
2844
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TeamService, decorators: [{
2676
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: EntityConversationService, decorators: [{
2845
2677
  type: Injectable,
2846
2678
  args: [{
2847
2679
  providedIn: 'root',
2848
2680
  }]
2849
2681
  }], ctorParameters: () => [{ type: AppSyncHelperService }] });
2850
2682
 
2851
- const FIELDS_TENANT_EXPANDED = `
2683
+ const FIELDS_TENANT = `
2852
2684
  id
2853
2685
  externalId
2854
2686
  tenantDomain
@@ -2886,23 +2718,10 @@ class TenantService {
2886
2718
  constructor(appSyncService) {
2887
2719
  this.appSyncService = appSyncService;
2888
2720
  }
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
2721
  async GetTenant(id) {
2903
2722
  const statement = `query GetTenant($id: ID!) {
2904
2723
  getTenant(id: $id) {
2905
- ${FIELDS_TENANT_EXPANDED}
2724
+ ${FIELDS_TENANT}
2906
2725
  }
2907
2726
  }`;
2908
2727
  const gqlAPIServiceArguments = { id };
@@ -2912,7 +2731,7 @@ class TenantService {
2912
2731
  OnTenantByIdListener(id) {
2913
2732
  const statement = `subscription OnTenantById($id: ID!) {
2914
2733
  OnTenantById(id: $id) {
2915
- ${FIELDS_TENANT_EXPANDED}
2734
+ ${FIELDS_TENANT}
2916
2735
  }
2917
2736
  }`;
2918
2737
  const gqlAPIServiceArguments = { id };
@@ -2929,7 +2748,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
2929
2748
  }]
2930
2749
  }], ctorParameters: () => [{ type: AppSyncHelperService }] });
2931
2750
 
2932
- const USER_SESSION_FIELDS = `
2751
+ const FIELDS_USER_SESSION = `
2933
2752
  id
2934
2753
  tenantId
2935
2754
  userId
@@ -2949,27 +2768,36 @@ class UserSessionService {
2949
2768
  constructor(appSyncService) {
2950
2769
  this.appSyncService = appSyncService;
2951
2770
  }
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
2771
  async GetUserSession(id) {
2959
2772
  const statement = `query GetUserSession($id: ID!) {
2960
2773
  getUserSession(id: $id) {
2961
- ${USER_SESSION_FIELDS}
2774
+ ${FIELDS_USER_SESSION}
2962
2775
  }
2963
2776
  }`;
2964
2777
  const gqlAPIServiceArguments = { id };
2965
2778
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2966
2779
  return response.data.getUserSession;
2967
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
+ }
2968
2796
  async ListUserSessionsByUserId(userId, createdAt, sortDirection, filter, limit, nextToken) {
2969
2797
  const statement = `query ListUserSessionsByUserId($userId: ID!, $createdAt: ModelIntKeyConditionInput, $sortDirection: ModelSortDirection, $filter: ModelUserSessionFilterInput, $limit: Int, $nextToken: String) {
2970
2798
  listUserSessionsByUserId(userId: $userId, createdAt: $createdAt, sortDirection: $sortDirection, filter: $filter, limit: $limit, nextToken: $nextToken) {
2971
2799
  items {
2972
- ${USER_SESSION_FIELDS}
2800
+ ${FIELDS_USER_SESSION}
2973
2801
  }
2974
2802
  nextToken
2975
2803
  }
@@ -2995,25 +2823,10 @@ class UserSessionService {
2995
2823
  const response = await this.appSyncService.query(statement, gqlAPIServiceArguments);
2996
2824
  return response.data.listUserSessionsByUserId;
2997
2825
  }
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
2826
  OnUserSessionByIdListener(id) {
3014
2827
  const statement = `subscription OnUserSessionById($id: ID!) {
3015
2828
  OnUserSessionById(id: $id) {
3016
- ${USER_SESSION_FIELDS}
2829
+ ${FIELDS_USER_SESSION}
3017
2830
  }
3018
2831
  }`;
3019
2832
  const gqlAPIServiceArguments = { id };
@@ -3133,5 +2946,5 @@ class CleanDeep {
3133
2946
  * Generated bundle index. Do not edit.
3134
2947
  */
3135
2948
 
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 };
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 };
3137
2950
  //# sourceMappingURL=snugdesk-core.mjs.map