@opens/gateways 1.16.8 → 1.16.10
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/dist/customer-service/contracts/index.d.mts +304 -9
- package/dist/customer-service/contracts/index.d.ts +304 -9
- package/dist/customer-service/contracts/index.js.map +1 -1
- package/dist/index.d.mts +17 -64
- package/dist/index.d.ts +17 -64
- package/dist/index.js +29 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/notifications/contracts/index.d.mts +0 -160
- package/dist/notifications/contracts/index.d.ts +0 -160
- package/dist/notifications/contracts/index.js +0 -19
- package/dist/notifications/contracts/index.js.map +0 -1
- package/dist/notifications/contracts/index.mjs +0 -1
- package/dist/notifications/contracts/index.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -350,6 +350,32 @@ var CustomerServiceGateway = class {
|
|
|
350
350
|
});
|
|
351
351
|
return data;
|
|
352
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Submits one response to a survey announcement.
|
|
355
|
+
* @param announcementId - The unique identifier of the survey announcement.
|
|
356
|
+
* @param payload - The subject identifier and validated survey answers.
|
|
357
|
+
* @returns The persisted survey response.
|
|
358
|
+
*/
|
|
359
|
+
async submitSurveyResponse(announcementId, payload) {
|
|
360
|
+
const { data } = await this.httpClient.post(
|
|
361
|
+
`${this.baseUrl}/announcements/${announcementId}/responses`,
|
|
362
|
+
payload
|
|
363
|
+
);
|
|
364
|
+
return data;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Retrieves paginated responses for a survey announcement.
|
|
368
|
+
* @param announcementId - The unique identifier of the survey announcement.
|
|
369
|
+
* @param query - Pagination options for the administrative list.
|
|
370
|
+
* @returns Paginated survey responses.
|
|
371
|
+
*/
|
|
372
|
+
async findSurveyResponses(announcementId, query) {
|
|
373
|
+
const { data } = await this.httpClient.get(
|
|
374
|
+
`${this.baseUrl}/announcements/admin/${announcementId}/responses`,
|
|
375
|
+
{ params: query }
|
|
376
|
+
);
|
|
377
|
+
return data;
|
|
378
|
+
}
|
|
353
379
|
};
|
|
354
380
|
|
|
355
381
|
// src/chat-config/index.ts
|
|
@@ -1383,88 +1409,6 @@ var AccessHubGateway = class {
|
|
|
1383
1409
|
}
|
|
1384
1410
|
};
|
|
1385
1411
|
|
|
1386
|
-
// src/notifications/index.ts
|
|
1387
|
-
var NotificationsGateway = class {
|
|
1388
|
-
constructor(httpClient, baseUrl) {
|
|
1389
|
-
this.httpClient = httpClient;
|
|
1390
|
-
this.baseUrl = baseUrl;
|
|
1391
|
-
}
|
|
1392
|
-
httpClient;
|
|
1393
|
-
baseUrl;
|
|
1394
|
-
/**
|
|
1395
|
-
* Returns the catalog of available system notifications with their types and metadata.
|
|
1396
|
-
* @param params - Optional filters by type slug or type ID.
|
|
1397
|
-
* @returns A list of system notifications and the total count.
|
|
1398
|
-
*/
|
|
1399
|
-
async getSystemNotifications(params) {
|
|
1400
|
-
const { data } = await this.httpClient.get(
|
|
1401
|
-
`${this.baseUrl}/notification/system-notifications`,
|
|
1402
|
-
{ params }
|
|
1403
|
-
);
|
|
1404
|
-
return data;
|
|
1405
|
-
}
|
|
1406
|
-
/**
|
|
1407
|
-
* Lists push notification devices registered for the authenticated user.
|
|
1408
|
-
* @param params - Optional filters, pagination and service-token context.
|
|
1409
|
-
* @returns A list of user devices and the total count.
|
|
1410
|
-
*/
|
|
1411
|
-
async getUserDevices(params) {
|
|
1412
|
-
const { data } = await this.httpClient.get(`${this.baseUrl}/user/devices`, { params });
|
|
1413
|
-
return data;
|
|
1414
|
-
}
|
|
1415
|
-
/**
|
|
1416
|
-
* Registers or updates a push notification token for a user device.
|
|
1417
|
-
* Idempotent via findOrCreate on deviceToken.
|
|
1418
|
-
* @param payload - Device token and either deviceSlug or deviceId.
|
|
1419
|
-
* @returns The registered device summary.
|
|
1420
|
-
*/
|
|
1421
|
-
async registerUserDevice(payload) {
|
|
1422
|
-
const { data } = await this.httpClient.post(`${this.baseUrl}/user/devices`, payload);
|
|
1423
|
-
return data;
|
|
1424
|
-
}
|
|
1425
|
-
/**
|
|
1426
|
-
* Deletes a registered user device and its notification token.
|
|
1427
|
-
* @param id - UUID of the user device record.
|
|
1428
|
-
* @returns Confirmation of deletion.
|
|
1429
|
-
*/
|
|
1430
|
-
async deleteUserDevice(id) {
|
|
1431
|
-
const { data } = await this.httpClient.delete(`${this.baseUrl}/user/devices/${id}`);
|
|
1432
|
-
return data;
|
|
1433
|
-
}
|
|
1434
|
-
/**
|
|
1435
|
-
* Lists active notification preferences for the user, optionally filtered by device.
|
|
1436
|
-
* @param params - Optional filters and service-token context.
|
|
1437
|
-
* @returns A list of user preferences.
|
|
1438
|
-
*/
|
|
1439
|
-
async getUserPreferences(params) {
|
|
1440
|
-
const { data } = await this.httpClient.get(`${this.baseUrl}/user/preferences`, { params });
|
|
1441
|
-
return data;
|
|
1442
|
-
}
|
|
1443
|
-
/**
|
|
1444
|
-
* Creates or activates a notification preference for a user device.
|
|
1445
|
-
* Idempotent via findOrCreate on the user/device/notification combination.
|
|
1446
|
-
* @param payload - Device ID and either systemNotificationSlug or systemNotificationId.
|
|
1447
|
-
* @returns The created or existing preference.
|
|
1448
|
-
*/
|
|
1449
|
-
async createUserPreference(payload) {
|
|
1450
|
-
const { data } = await this.httpClient.post(`${this.baseUrl}/user/preferences`, payload);
|
|
1451
|
-
return data;
|
|
1452
|
-
}
|
|
1453
|
-
/**
|
|
1454
|
-
* Deletes a notification preference by its ID.
|
|
1455
|
-
* @param id - UUID of the preference in `user_notification_preferences`.
|
|
1456
|
-
* @param params - Optional companyId/userId for Service Token context.
|
|
1457
|
-
* @returns Confirmation of deletion.
|
|
1458
|
-
*/
|
|
1459
|
-
async deleteUserPreference(id, params) {
|
|
1460
|
-
const { data } = await this.httpClient.delete(
|
|
1461
|
-
`${this.baseUrl}/user/preferences/${id}`,
|
|
1462
|
-
{ params }
|
|
1463
|
-
);
|
|
1464
|
-
return data;
|
|
1465
|
-
}
|
|
1466
|
-
};
|
|
1467
|
-
|
|
1468
1412
|
// src/@common/client.ts
|
|
1469
1413
|
import axios from "axios";
|
|
1470
1414
|
var SDKGateways = class {
|
|
@@ -1481,8 +1425,7 @@ var SDKGateways = class {
|
|
|
1481
1425
|
cases;
|
|
1482
1426
|
rh;
|
|
1483
1427
|
accessHub;
|
|
1484
|
-
|
|
1485
|
-
constructor(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations, chatWebservice, callReport, calls, cases, rh, accessHub, notifications) {
|
|
1428
|
+
constructor(customerService, chatConfig, campaigns, chatAdapter, assets, contactList, integrations, chatWebservice, callReport, calls, cases, rh, accessHub) {
|
|
1486
1429
|
this.customerService = customerService;
|
|
1487
1430
|
this.chatConfig = chatConfig;
|
|
1488
1431
|
this.campaigns = campaigns;
|
|
@@ -1496,7 +1439,6 @@ var SDKGateways = class {
|
|
|
1496
1439
|
this.cases = cases;
|
|
1497
1440
|
this.rh = rh;
|
|
1498
1441
|
this.accessHub = accessHub;
|
|
1499
|
-
this.notifications = notifications;
|
|
1500
1442
|
}
|
|
1501
1443
|
};
|
|
1502
1444
|
function createClient(params) {
|
|
@@ -1518,7 +1460,6 @@ function createClient(params) {
|
|
|
1518
1460
|
const cases = params.services.cases ? new CasesGateway(httpClient, params.services.cases.baseUrl) : null;
|
|
1519
1461
|
const rh = params.services.rh ? new RhGateway(httpClient, params.services.rh.baseUrl) : null;
|
|
1520
1462
|
const accessHub = params.services.accessHub ? new AccessHubGateway(httpClient, params.services.accessHub.baseUrl) : null;
|
|
1521
|
-
const notifications = params.services.notifications ? new NotificationsGateway(httpClient, params.services.notifications.baseUrl) : null;
|
|
1522
1463
|
return new SDKGateways(
|
|
1523
1464
|
customerService,
|
|
1524
1465
|
chatConfig,
|
|
@@ -1532,8 +1473,7 @@ function createClient(params) {
|
|
|
1532
1473
|
calls,
|
|
1533
1474
|
cases,
|
|
1534
1475
|
rh,
|
|
1535
|
-
accessHub
|
|
1536
|
-
notifications
|
|
1476
|
+
accessHub
|
|
1537
1477
|
);
|
|
1538
1478
|
}
|
|
1539
1479
|
|
|
@@ -1551,8 +1491,7 @@ var SERVICE_GATEWAYS = {
|
|
|
1551
1491
|
CALLS: "calls",
|
|
1552
1492
|
CASES: "cases",
|
|
1553
1493
|
RH: "rh",
|
|
1554
|
-
ACCESS_HUB: "access-hub"
|
|
1555
|
-
NOTIFICATIONS: "notifications"
|
|
1494
|
+
ACCESS_HUB: "access-hub"
|
|
1556
1495
|
};
|
|
1557
1496
|
|
|
1558
1497
|
// src/index.ts
|
|
@@ -1621,10 +1560,6 @@ function gateway(service) {
|
|
|
1621
1560
|
if (!sdk.client.accessHub)
|
|
1622
1561
|
throw new Error(`Service 'access-hub' is not configured. Provide its baseUrl in configure().`);
|
|
1623
1562
|
return sdk.client.accessHub;
|
|
1624
|
-
case SERVICE_GATEWAYS.NOTIFICATIONS:
|
|
1625
|
-
if (!sdk.client.notifications)
|
|
1626
|
-
throw new Error(`Service 'notifications' is not configured. Provide its baseUrl in configure().`);
|
|
1627
|
-
return sdk.client.notifications;
|
|
1628
1563
|
default:
|
|
1629
1564
|
throw new Error(`Unknown service gateway: ${service}`);
|
|
1630
1565
|
}
|