@tuki-io/tuki-widgets 0.0.205 → 0.0.207
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/esm2020/contact-center/cc-script-editor/components/node-details-sidebar/node-details-sidebar.component.mjs +3 -3
- package/esm2020/user-device-manage/src/device-info/device-info.component.mjs +3 -3
- package/esm2020/user-manage/src/classes/device.mjs +2 -1
- package/esm2020/user-manage/src/device-list/device-row/device-row.component.mjs +3 -3
- package/esm2020/users-list/src/app.constants.mjs +3 -1
- package/esm2020/users-list/src/services/user.service.mjs +14 -6
- package/esm2020/users-list/src/users-list.component.mjs +186 -12
- package/fesm2015/tuki-io-tuki-widgets-contact-center.mjs +2 -2
- package/fesm2015/tuki-io-tuki-widgets-contact-center.mjs.map +1 -1
- package/fesm2015/tuki-io-tuki-widgets-user-device-manage.mjs +2 -2
- package/fesm2015/tuki-io-tuki-widgets-user-device-manage.mjs.map +1 -1
- package/fesm2015/tuki-io-tuki-widgets-user-manage.mjs +10 -9
- package/fesm2015/tuki-io-tuki-widgets-user-manage.mjs.map +1 -1
- package/fesm2015/tuki-io-tuki-widgets-users-list.mjs +201 -15
- package/fesm2015/tuki-io-tuki-widgets-users-list.mjs.map +1 -1
- package/fesm2020/tuki-io-tuki-widgets-contact-center.mjs +2 -2
- package/fesm2020/tuki-io-tuki-widgets-contact-center.mjs.map +1 -1
- package/fesm2020/tuki-io-tuki-widgets-user-device-manage.mjs +2 -2
- package/fesm2020/tuki-io-tuki-widgets-user-device-manage.mjs.map +1 -1
- package/fesm2020/tuki-io-tuki-widgets-user-manage.mjs +10 -9
- package/fesm2020/tuki-io-tuki-widgets-user-manage.mjs.map +1 -1
- package/fesm2020/tuki-io-tuki-widgets-users-list.mjs +199 -15
- package/fesm2020/tuki-io-tuki-widgets-users-list.mjs.map +1 -1
- package/package.json +1 -1
- package/user-manage/src/classes/device.d.ts +1 -0
- package/users-list/src/app.constants.d.ts +2 -0
- package/users-list/src/services/user.service.d.ts +2 -1
- package/users-list/src/users-list.component.d.ts +10 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Component, ViewEncapsulation, Inject, Injectable, EventEmitter, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
3
|
-
import { Subject, of, forkJoin, BehaviorSubject, Observable,
|
|
3
|
+
import { Subject, of, forkJoin, BehaviorSubject, Observable, takeUntil, map as map$1, switchMap, EMPTY, timer, takeWhile } from 'rxjs';
|
|
4
4
|
import * as i11$1 from '@angular/material/table';
|
|
5
5
|
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
6
6
|
import * as i1 from '@angular/material/dialog';
|
|
@@ -75,8 +75,10 @@ const API = {
|
|
|
75
75
|
GET_LOCATIONS: "/api/search/webex/customers/:customerId/locations",
|
|
76
76
|
PREPARE_PERSON_MIGRATION: "/api/migration/webex/preparepersonmigration",
|
|
77
77
|
MIGRATION_FORM: "/api/search/webex/customers/:customerId/migrationforms/:formId",
|
|
78
|
+
MIGRATION_FORM_ENTITIES_MIGRATED: "/api/search/webex/customers/:customerId/migrationformentities/migrated",
|
|
78
79
|
START_MIGRATION: "/api/migration/webex/startpersonmigration",
|
|
79
80
|
TRIGGER_FIRMWARE_MIGRATION: "/api/migration/:migrationType/firmwaremigration/customer/:customerId/migration/:migrationFormId",
|
|
81
|
+
WEBEX_REVERT: "/api/webex/provisioning/customers/:customerId/persons/:personId/revertmigration",
|
|
80
82
|
REVERT: "/api/webex/provisioning/customers/:customerId/persons/:personId/revertmigration",
|
|
81
83
|
SWAP_STATUSES: "/api/cache/user/customer/:customerId/swap-status"
|
|
82
84
|
};
|
|
@@ -461,6 +463,11 @@ class UserService {
|
|
|
461
463
|
.replace(':formId', String(formId));
|
|
462
464
|
return this.apiWebexService.fetch(url);
|
|
463
465
|
}
|
|
466
|
+
getMigratedMigrationFormEntities(customerId, webexUUID, feature = 'PERSON') {
|
|
467
|
+
const url = API.MIGRATION_FORM_ENTITIES_MIGRATED
|
|
468
|
+
.replace(':customerId', String(customerId));
|
|
469
|
+
return this.apiWebexService.fetch(url, { webexUUID, feature });
|
|
470
|
+
}
|
|
464
471
|
getMoveUserBody(customerId, user) {
|
|
465
472
|
return {
|
|
466
473
|
customerId: customerId,
|
|
@@ -536,17 +543,20 @@ class UserService {
|
|
|
536
543
|
}
|
|
537
544
|
}
|
|
538
545
|
triggerFirmwareUpgrade(customerId, migrationFormId, deviceMap, customerType) {
|
|
539
|
-
const migrationType = CUSTOMER_DESTINATION_MIGTATION_TYPE[customerType].toUpperCase();
|
|
546
|
+
// const migrationType = CUSTOMER_DESTINATION_MIGTATION_TYPE[customerType].toUpperCase();
|
|
540
547
|
const url = API.TRIGGER_FIRMWARE_MIGRATION
|
|
541
|
-
.replace(':migrationType',
|
|
548
|
+
.replace(':migrationType', 'webex'.toUpperCase())
|
|
542
549
|
.replace(':customerId', String(customerId))
|
|
543
550
|
.replace(':migrationFormId', String(migrationFormId));
|
|
544
|
-
return this.
|
|
551
|
+
return this.apiWebexService
|
|
545
552
|
.post(url, deviceMap);
|
|
546
553
|
// .pipe(this.handleError(true, true));
|
|
547
554
|
}
|
|
548
555
|
revertMigration(customerId, personId) {
|
|
549
|
-
|
|
556
|
+
const url = API.WEBEX_REVERT
|
|
557
|
+
.replace(':customerId', String(customerId))
|
|
558
|
+
.replace(':personId', personId);
|
|
559
|
+
return this.apiWebexService.post(url, {});
|
|
550
560
|
// .pipe(this.handleError(true, true));
|
|
551
561
|
}
|
|
552
562
|
swapStatuses(customerId, email) {
|
|
@@ -1667,11 +1677,14 @@ class UsersListComponent {
|
|
|
1667
1677
|
}
|
|
1668
1678
|
this.openUser.emit(user);
|
|
1669
1679
|
}
|
|
1670
|
-
moveUserToMT(user
|
|
1680
|
+
moveUserToMT(user) {
|
|
1671
1681
|
if (user && user.siteId && user.userid) {
|
|
1672
1682
|
this.moveUserPending = true;
|
|
1673
1683
|
this.moveInProgressUserId = user.userid;
|
|
1674
|
-
this.
|
|
1684
|
+
const currentIndex = this.getUserIndexById(user.userid);
|
|
1685
|
+
if (currentIndex > -1) {
|
|
1686
|
+
this.setStatusToUser(currentIndex, 'In Progress');
|
|
1687
|
+
}
|
|
1675
1688
|
localStorage.setItem(LOCAL_STORAGE.USER_IN_MIGRATION, user.userid);
|
|
1676
1689
|
const subscription = this.userService
|
|
1677
1690
|
.moveUserToMT(this.customerId, user)
|
|
@@ -1680,14 +1693,14 @@ class UsersListComponent {
|
|
|
1680
1693
|
this.moveUserIndex = null;
|
|
1681
1694
|
if (formId) {
|
|
1682
1695
|
localStorage.setItem(LOCAL_STORAGE.MIGRATION_FORM_ID, String(formId));
|
|
1683
|
-
this.
|
|
1696
|
+
this.pollMigrationFormStatusByUserId(formId, user.userid, () => this.getMigratedUsers());
|
|
1684
1697
|
}
|
|
1685
1698
|
else {
|
|
1686
1699
|
this.getMigratedUsers();
|
|
1687
1700
|
}
|
|
1688
1701
|
}, () => {
|
|
1689
1702
|
this.removeUserInMigrationProgress();
|
|
1690
|
-
this.setStatusToUser(
|
|
1703
|
+
this.setStatusToUser(this.getUserIndexById(user.userid), 'Migration Error');
|
|
1691
1704
|
});
|
|
1692
1705
|
this.subscriptions.push(subscription);
|
|
1693
1706
|
}
|
|
@@ -1842,7 +1855,7 @@ class UsersListComponent {
|
|
|
1842
1855
|
if (result) {
|
|
1843
1856
|
switch (type) {
|
|
1844
1857
|
case 'QuickMove':
|
|
1845
|
-
this.moveUserToMT(user
|
|
1858
|
+
this.moveUserToMT(user);
|
|
1846
1859
|
break;
|
|
1847
1860
|
case 'MT':
|
|
1848
1861
|
this.moveUser = user;
|
|
@@ -1950,6 +1963,128 @@ class UsersListComponent {
|
|
|
1950
1963
|
const value = user === null || user === void 0 ? void 0 : user.webexUUID;
|
|
1951
1964
|
return value !== null && value !== undefined && String(value).trim().length > 0;
|
|
1952
1965
|
}
|
|
1966
|
+
buildFirmwareDeviceMap(entity, user) {
|
|
1967
|
+
const deviceMap = {};
|
|
1968
|
+
const mappedDevices = this.getActivationDevices(entity, user);
|
|
1969
|
+
console.log(mappedDevices);
|
|
1970
|
+
const devices = [];
|
|
1971
|
+
mappedDevices.forEach((rawDevice) => {
|
|
1972
|
+
const device = rawDevice;
|
|
1973
|
+
// @ts-ignore
|
|
1974
|
+
const isEligible = device.isRegistered || device.deviceToUpgrade || device.isEligible;
|
|
1975
|
+
devices.push({
|
|
1976
|
+
userId: user.userid,
|
|
1977
|
+
deviceName: device.name || '',
|
|
1978
|
+
deviceType: device.product || device.model || '',
|
|
1979
|
+
status: isEligible ? 'ELIGIBLE_TO_UPGRADE' : 'UNREGISTERED',
|
|
1980
|
+
errorDescription: '',
|
|
1981
|
+
cucmId: user.cucmId,
|
|
1982
|
+
feature: 'PERSON',
|
|
1983
|
+
selectable: true,
|
|
1984
|
+
disabledReason: false ? 'FIRMWARE_UPGRADE.DEVICE_NOT_MIGRATED' : '',
|
|
1985
|
+
});
|
|
1986
|
+
});
|
|
1987
|
+
if (!Object.keys(deviceMap).length) {
|
|
1988
|
+
console.debug('Firmware activation: no usable devices found to build deviceMap.');
|
|
1989
|
+
}
|
|
1990
|
+
devices.forEach((device) => {
|
|
1991
|
+
if (!deviceMap[device.cucmId]) {
|
|
1992
|
+
deviceMap[device.cucmId] = {};
|
|
1993
|
+
}
|
|
1994
|
+
if (!deviceMap[device.cucmId][device.feature]) {
|
|
1995
|
+
deviceMap[device.cucmId][device.feature] = [];
|
|
1996
|
+
}
|
|
1997
|
+
deviceMap[device.cucmId][device.feature].push(device.deviceName);
|
|
1998
|
+
});
|
|
1999
|
+
console.log("dev map ==> ", deviceMap);
|
|
2000
|
+
return deviceMap;
|
|
2001
|
+
}
|
|
2002
|
+
getActivationDevices(entity, user) {
|
|
2003
|
+
var _a, _b;
|
|
2004
|
+
const migratedEntityDevices = Array.isArray(entity === null || entity === void 0 ? void 0 : entity.devices)
|
|
2005
|
+
? ((_a = entity === null || entity === void 0 ? void 0 : entity.devices) !== null && _a !== void 0 ? _a : [])
|
|
2006
|
+
: [];
|
|
2007
|
+
const entityDevices = Array.isArray(entity === null || entity === void 0 ? void 0 : entity.webexMigrationDevices)
|
|
2008
|
+
? ((_b = entity === null || entity === void 0 ? void 0 : entity.webexMigrationDevices) !== null && _b !== void 0 ? _b : [])
|
|
2009
|
+
: [];
|
|
2010
|
+
const allEntityDevices = [...migratedEntityDevices, ...entityDevices];
|
|
2011
|
+
if (allEntityDevices.length) {
|
|
2012
|
+
return allEntityDevices;
|
|
2013
|
+
}
|
|
2014
|
+
// Fallback for partial responses where only list-user devices are available.
|
|
2015
|
+
return [
|
|
2016
|
+
...(Array.isArray(user === null || user === void 0 ? void 0 : user.devices) ? user.devices : []),
|
|
2017
|
+
...(Array.isArray(user === null || user === void 0 ? void 0 : user.deviceProfiles) ? user.deviceProfiles : []),
|
|
2018
|
+
];
|
|
2019
|
+
}
|
|
2020
|
+
unwrapMigratedDevice(rawDevice) {
|
|
2021
|
+
const candidate = rawDevice;
|
|
2022
|
+
if (candidate === null || candidate === void 0 ? void 0 : candidate.device) {
|
|
2023
|
+
return Object.assign(Object.assign({}, candidate.device), candidate);
|
|
2024
|
+
}
|
|
2025
|
+
return candidate || {};
|
|
2026
|
+
}
|
|
2027
|
+
isMigratedDeviceEligible(device) {
|
|
2028
|
+
const hasEligibilitySignal = (device === null || device === void 0 ? void 0 : device.isRegistered) !== undefined
|
|
2029
|
+
|| (device === null || device === void 0 ? void 0 : device.deviceToUpgrade) !== undefined
|
|
2030
|
+
|| (device === null || device === void 0 ? void 0 : device.isEligible) !== undefined;
|
|
2031
|
+
if (!hasEligibilitySignal) {
|
|
2032
|
+
return true;
|
|
2033
|
+
}
|
|
2034
|
+
return !!((device === null || device === void 0 ? void 0 : device.isRegistered) || (device === null || device === void 0 ? void 0 : device.deviceToUpgrade) || (device === null || device === void 0 ? void 0 : device.isEligible));
|
|
2035
|
+
}
|
|
2036
|
+
extractCucmId(entity, device, user) {
|
|
2037
|
+
const deviceCucmId = Number(device === null || device === void 0 ? void 0 : device.cucmId);
|
|
2038
|
+
if (Number.isFinite(deviceCucmId) && deviceCucmId > 0) {
|
|
2039
|
+
return deviceCucmId;
|
|
2040
|
+
}
|
|
2041
|
+
const userCucmId = Number(user === null || user === void 0 ? void 0 : user.cucmId);
|
|
2042
|
+
if (Number.isFinite(userCucmId)) {
|
|
2043
|
+
return userCucmId;
|
|
2044
|
+
}
|
|
2045
|
+
const entityCucmId = Number(entity === null || entity === void 0 ? void 0 : entity.cucmId);
|
|
2046
|
+
if (Number.isFinite(entityCucmId)) {
|
|
2047
|
+
return entityCucmId;
|
|
2048
|
+
}
|
|
2049
|
+
return null;
|
|
2050
|
+
}
|
|
2051
|
+
resolveMigratedDeviceKey(device) {
|
|
2052
|
+
return String((device === null || device === void 0 ? void 0 : device.name) ||
|
|
2053
|
+
(device === null || device === void 0 ? void 0 : device.mac) ||
|
|
2054
|
+
(device === null || device === void 0 ? void 0 : device.deviceId) ||
|
|
2055
|
+
(device === null || device === void 0 ? void 0 : device.cisUuid) ||
|
|
2056
|
+
(device === null || device === void 0 ? void 0 : device.id) ||
|
|
2057
|
+
'').trim();
|
|
2058
|
+
}
|
|
2059
|
+
extractMigratedDeviceLines(device) {
|
|
2060
|
+
const values = new Set();
|
|
2061
|
+
const lineAssociations = Array.isArray(device === null || device === void 0 ? void 0 : device.lineAssociations) ? device.lineAssociations : [];
|
|
2062
|
+
lineAssociations.forEach((lineAssociation) => {
|
|
2063
|
+
var _a, _b;
|
|
2064
|
+
const directoryNumber = (_a = lineAssociation === null || lineAssociation === void 0 ? void 0 : lineAssociation.directoryNumber) === null || _a === void 0 ? void 0 : _a.directoryNumber;
|
|
2065
|
+
const templateDirectoryNumber = (_b = lineAssociation === null || lineAssociation === void 0 ? void 0 : lineAssociation.directoryNumber) === null || _b === void 0 ? void 0 : _b.templateDirectoryNumber;
|
|
2066
|
+
const e164Mask = lineAssociation === null || lineAssociation === void 0 ? void 0 : lineAssociation.e164Mask;
|
|
2067
|
+
[directoryNumber, templateDirectoryNumber, e164Mask].forEach((value) => {
|
|
2068
|
+
const normalized = String(value || '').trim();
|
|
2069
|
+
if (normalized) {
|
|
2070
|
+
values.add(normalized);
|
|
2071
|
+
}
|
|
2072
|
+
});
|
|
2073
|
+
});
|
|
2074
|
+
const lines = Array.isArray(device === null || device === void 0 ? void 0 : device.lines) ? device.lines : [];
|
|
2075
|
+
lines.forEach((line) => {
|
|
2076
|
+
var _a, _b;
|
|
2077
|
+
const directoryNumber = (_a = line === null || line === void 0 ? void 0 : line.directoryNumber) === null || _a === void 0 ? void 0 : _a.directoryNumber;
|
|
2078
|
+
const templateDirectoryNumber = (_b = line === null || line === void 0 ? void 0 : line.directoryNumber) === null || _b === void 0 ? void 0 : _b.templateDirectoryNumber;
|
|
2079
|
+
[directoryNumber, templateDirectoryNumber].forEach((value) => {
|
|
2080
|
+
const normalized = String(value || '').trim();
|
|
2081
|
+
if (normalized) {
|
|
2082
|
+
values.add(normalized);
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
});
|
|
2086
|
+
return Array.from(values);
|
|
2087
|
+
}
|
|
1953
2088
|
onFirmwareUpgradeClicked(user) {
|
|
1954
2089
|
if (!this.isValidWebexUuid(user) || user.status !== 'Inactive') {
|
|
1955
2090
|
return;
|
|
@@ -1966,9 +2101,22 @@ class UsersListComponent {
|
|
|
1966
2101
|
dialogRef.beforeClosed().subscribe((result) => {
|
|
1967
2102
|
if (result) {
|
|
1968
2103
|
this.setUserPendingStatus(user, 'Pending Activation');
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
.pipe(takeUntil(this.destroy$))
|
|
2104
|
+
this.userService
|
|
2105
|
+
.getMigratedMigrationFormEntities(this.customerId, user.webexUUID || '', 'PERSON')
|
|
2106
|
+
.pipe(takeUntil(this.destroy$), map$1((entities) => {
|
|
2107
|
+
return Array.isArray(entities) ? entities[0] : entities || null;
|
|
2108
|
+
}), switchMap((entity) => {
|
|
2109
|
+
var _a, _b;
|
|
2110
|
+
const formId = (_b = (_a = entity === null || entity === void 0 ? void 0 : entity.migrationFormId) !== null && _a !== void 0 ? _a : entity === null || entity === void 0 ? void 0 : entity.id) !== null && _b !== void 0 ? _b : null;
|
|
2111
|
+
if (!formId) {
|
|
2112
|
+
this.setUserPendingStatus(user, 'Inactive');
|
|
2113
|
+
this.notifications.error('Activation failed. Migration form not found.');
|
|
2114
|
+
return EMPTY;
|
|
2115
|
+
}
|
|
2116
|
+
const deviceMap = this.buildFirmwareDeviceMap(entity, user);
|
|
2117
|
+
console.log('device map ==> ', deviceMap);
|
|
2118
|
+
return this.userService.triggerFirmwareUpgrade(this.customerId, Number(formId), deviceMap);
|
|
2119
|
+
}), switchMap(() => timer(120000)))
|
|
1972
2120
|
.subscribe({
|
|
1973
2121
|
next: () => {
|
|
1974
2122
|
this.setUserPendingStatus(user, 'Active');
|
|
@@ -1986,8 +2134,7 @@ class UsersListComponent {
|
|
|
1986
2134
|
onRevertClicked(user) {
|
|
1987
2135
|
if (user === null || user === void 0 ? void 0 : user.webexUUID) {
|
|
1988
2136
|
this.setUserPendingStatus(user, 'Pending Deactivation');
|
|
1989
|
-
this.userService.
|
|
1990
|
-
// this.userService.revertMigration(this.customerId, user.webexUUID)
|
|
2137
|
+
this.userService.revertMigration(this.customerId, user.webexUUID)
|
|
1991
2138
|
.pipe(takeUntil(this.destroy$), switchMap(() => timer(2000)))
|
|
1992
2139
|
.subscribe({
|
|
1993
2140
|
next: () => {
|
|
@@ -2031,6 +2178,45 @@ class UsersListComponent {
|
|
|
2031
2178
|
});
|
|
2032
2179
|
this.subscriptions.push(subscription);
|
|
2033
2180
|
}
|
|
2181
|
+
pollMigrationFormStatusByUserId(formId, userId, onCompleted) {
|
|
2182
|
+
const subscription = timer(0, 5000)
|
|
2183
|
+
.pipe(switchMap(() => this.userService.getMigrationFormStatus(this.customerId, formId)), takeUntil(this.destroy$), takeWhile((response) => {
|
|
2184
|
+
const status = response === null || response === void 0 ? void 0 : response.status;
|
|
2185
|
+
return !this.isMigrationStatusCompleted(status) && !this.isMigrationStatusFailed(status);
|
|
2186
|
+
}, true))
|
|
2187
|
+
.subscribe({
|
|
2188
|
+
next: (response) => {
|
|
2189
|
+
const status = response === null || response === void 0 ? void 0 : response.status;
|
|
2190
|
+
const index = this.getUserIndexById(userId);
|
|
2191
|
+
if (this.isMigrationStatusFailed(status)) {
|
|
2192
|
+
this.removeUserInMigrationProgress();
|
|
2193
|
+
if (index > -1) {
|
|
2194
|
+
this.setStatusToUser(index, 'Migration Error');
|
|
2195
|
+
}
|
|
2196
|
+
return;
|
|
2197
|
+
}
|
|
2198
|
+
if (this.isMigrationStatusCompleted(status)) {
|
|
2199
|
+
this.removeUserInMigrationProgress();
|
|
2200
|
+
if (index > -1) {
|
|
2201
|
+
this.setStatusToUser(index, 'Active');
|
|
2202
|
+
}
|
|
2203
|
+
onCompleted();
|
|
2204
|
+
}
|
|
2205
|
+
},
|
|
2206
|
+
error: () => {
|
|
2207
|
+
const index = this.getUserIndexById(userId);
|
|
2208
|
+
this.removeUserInMigrationProgress();
|
|
2209
|
+
if (index > -1) {
|
|
2210
|
+
this.setStatusToUser(index, 'Migration Error');
|
|
2211
|
+
}
|
|
2212
|
+
},
|
|
2213
|
+
});
|
|
2214
|
+
this.subscriptions.push(subscription);
|
|
2215
|
+
}
|
|
2216
|
+
getUserIndexById(userId) {
|
|
2217
|
+
var _a, _b;
|
|
2218
|
+
return (_b = (_a = this.users) === null || _a === void 0 ? void 0 : _a.findIndex((user) => user.userid === userId)) !== null && _b !== void 0 ? _b : -1;
|
|
2219
|
+
}
|
|
2034
2220
|
setOriginalUserStatus(email = '', status) {
|
|
2035
2221
|
const originalUser = this.users.find((user) => user.email === email && !user.webexUUID);
|
|
2036
2222
|
if (originalUser) {
|