@tuki-io/tuki-widgets 0.0.205 → 0.0.206
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 +2 -1
- package/esm2020/users-list/src/services/user.service.mjs +10 -5
- package/esm2020/users-list/src/users-list.component.mjs +185 -10
- 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 +195 -12
- 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 +193 -12
- 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 +1 -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,6 +75,7 @@ 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",
|
|
80
81
|
REVERT: "/api/webex/provisioning/customers/:customerId/persons/:personId/revertmigration",
|
|
@@ -461,6 +462,11 @@ class UserService {
|
|
|
461
462
|
.replace(':formId', String(formId));
|
|
462
463
|
return this.apiWebexService.fetch(url);
|
|
463
464
|
}
|
|
465
|
+
getMigratedMigrationFormEntities(customerId, webexUUID, feature = 'PERSON') {
|
|
466
|
+
const url = API.MIGRATION_FORM_ENTITIES_MIGRATED
|
|
467
|
+
.replace(':customerId', String(customerId));
|
|
468
|
+
return this.apiWebexService.fetch(url, { webexUUID, feature });
|
|
469
|
+
}
|
|
464
470
|
getMoveUserBody(customerId, user) {
|
|
465
471
|
return {
|
|
466
472
|
customerId: customerId,
|
|
@@ -536,12 +542,12 @@ class UserService {
|
|
|
536
542
|
}
|
|
537
543
|
}
|
|
538
544
|
triggerFirmwareUpgrade(customerId, migrationFormId, deviceMap, customerType) {
|
|
539
|
-
const migrationType = CUSTOMER_DESTINATION_MIGTATION_TYPE[customerType].toUpperCase();
|
|
545
|
+
// const migrationType = CUSTOMER_DESTINATION_MIGTATION_TYPE[customerType].toUpperCase();
|
|
540
546
|
const url = API.TRIGGER_FIRMWARE_MIGRATION
|
|
541
|
-
.replace(':migrationType',
|
|
547
|
+
.replace(':migrationType', 'webex'.toUpperCase())
|
|
542
548
|
.replace(':customerId', String(customerId))
|
|
543
549
|
.replace(':migrationFormId', String(migrationFormId));
|
|
544
|
-
return this.
|
|
550
|
+
return this.apiWebexService
|
|
545
551
|
.post(url, deviceMap);
|
|
546
552
|
// .pipe(this.handleError(true, true));
|
|
547
553
|
}
|
|
@@ -1667,11 +1673,14 @@ class UsersListComponent {
|
|
|
1667
1673
|
}
|
|
1668
1674
|
this.openUser.emit(user);
|
|
1669
1675
|
}
|
|
1670
|
-
moveUserToMT(user
|
|
1676
|
+
moveUserToMT(user) {
|
|
1671
1677
|
if (user && user.siteId && user.userid) {
|
|
1672
1678
|
this.moveUserPending = true;
|
|
1673
1679
|
this.moveInProgressUserId = user.userid;
|
|
1674
|
-
this.
|
|
1680
|
+
const currentIndex = this.getUserIndexById(user.userid);
|
|
1681
|
+
if (currentIndex > -1) {
|
|
1682
|
+
this.setStatusToUser(currentIndex, 'In Progress');
|
|
1683
|
+
}
|
|
1675
1684
|
localStorage.setItem(LOCAL_STORAGE.USER_IN_MIGRATION, user.userid);
|
|
1676
1685
|
const subscription = this.userService
|
|
1677
1686
|
.moveUserToMT(this.customerId, user)
|
|
@@ -1680,14 +1689,14 @@ class UsersListComponent {
|
|
|
1680
1689
|
this.moveUserIndex = null;
|
|
1681
1690
|
if (formId) {
|
|
1682
1691
|
localStorage.setItem(LOCAL_STORAGE.MIGRATION_FORM_ID, String(formId));
|
|
1683
|
-
this.
|
|
1692
|
+
this.pollMigrationFormStatusByUserId(formId, user.userid, () => this.getMigratedUsers());
|
|
1684
1693
|
}
|
|
1685
1694
|
else {
|
|
1686
1695
|
this.getMigratedUsers();
|
|
1687
1696
|
}
|
|
1688
1697
|
}, () => {
|
|
1689
1698
|
this.removeUserInMigrationProgress();
|
|
1690
|
-
this.setStatusToUser(
|
|
1699
|
+
this.setStatusToUser(this.getUserIndexById(user.userid), 'Migration Error');
|
|
1691
1700
|
});
|
|
1692
1701
|
this.subscriptions.push(subscription);
|
|
1693
1702
|
}
|
|
@@ -1842,7 +1851,7 @@ class UsersListComponent {
|
|
|
1842
1851
|
if (result) {
|
|
1843
1852
|
switch (type) {
|
|
1844
1853
|
case 'QuickMove':
|
|
1845
|
-
this.moveUserToMT(user
|
|
1854
|
+
this.moveUserToMT(user);
|
|
1846
1855
|
break;
|
|
1847
1856
|
case 'MT':
|
|
1848
1857
|
this.moveUser = user;
|
|
@@ -1950,6 +1959,128 @@ class UsersListComponent {
|
|
|
1950
1959
|
const value = user === null || user === void 0 ? void 0 : user.webexUUID;
|
|
1951
1960
|
return value !== null && value !== undefined && String(value).trim().length > 0;
|
|
1952
1961
|
}
|
|
1962
|
+
buildFirmwareDeviceMap(entity, user) {
|
|
1963
|
+
const deviceMap = {};
|
|
1964
|
+
const mappedDevices = this.getActivationDevices(entity, user);
|
|
1965
|
+
console.log(mappedDevices);
|
|
1966
|
+
const devices = [];
|
|
1967
|
+
mappedDevices.forEach((rawDevice) => {
|
|
1968
|
+
const device = rawDevice;
|
|
1969
|
+
// @ts-ignore
|
|
1970
|
+
const isEligible = device.isRegistered || device.deviceToUpgrade || device.isEligible;
|
|
1971
|
+
devices.push({
|
|
1972
|
+
userId: user.userid,
|
|
1973
|
+
deviceName: device.name || '',
|
|
1974
|
+
deviceType: device.product || device.model || '',
|
|
1975
|
+
status: isEligible ? 'ELIGIBLE_TO_UPGRADE' : 'UNREGISTERED',
|
|
1976
|
+
errorDescription: '',
|
|
1977
|
+
cucmId: user.cucmId,
|
|
1978
|
+
feature: 'PERSON',
|
|
1979
|
+
selectable: true,
|
|
1980
|
+
disabledReason: false ? 'FIRMWARE_UPGRADE.DEVICE_NOT_MIGRATED' : '',
|
|
1981
|
+
});
|
|
1982
|
+
});
|
|
1983
|
+
if (!Object.keys(deviceMap).length) {
|
|
1984
|
+
console.debug('Firmware activation: no usable devices found to build deviceMap.');
|
|
1985
|
+
}
|
|
1986
|
+
devices.forEach((device) => {
|
|
1987
|
+
if (!deviceMap[device.cucmId]) {
|
|
1988
|
+
deviceMap[device.cucmId] = {};
|
|
1989
|
+
}
|
|
1990
|
+
if (!deviceMap[device.cucmId][device.feature]) {
|
|
1991
|
+
deviceMap[device.cucmId][device.feature] = [];
|
|
1992
|
+
}
|
|
1993
|
+
deviceMap[device.cucmId][device.feature].push(device.deviceName);
|
|
1994
|
+
});
|
|
1995
|
+
console.log("dev map ==> ", deviceMap);
|
|
1996
|
+
return deviceMap;
|
|
1997
|
+
}
|
|
1998
|
+
getActivationDevices(entity, user) {
|
|
1999
|
+
var _a, _b;
|
|
2000
|
+
const migratedEntityDevices = Array.isArray(entity === null || entity === void 0 ? void 0 : entity.devices)
|
|
2001
|
+
? ((_a = entity === null || entity === void 0 ? void 0 : entity.devices) !== null && _a !== void 0 ? _a : [])
|
|
2002
|
+
: [];
|
|
2003
|
+
const entityDevices = Array.isArray(entity === null || entity === void 0 ? void 0 : entity.webexMigrationDevices)
|
|
2004
|
+
? ((_b = entity === null || entity === void 0 ? void 0 : entity.webexMigrationDevices) !== null && _b !== void 0 ? _b : [])
|
|
2005
|
+
: [];
|
|
2006
|
+
const allEntityDevices = [...migratedEntityDevices, ...entityDevices];
|
|
2007
|
+
if (allEntityDevices.length) {
|
|
2008
|
+
return allEntityDevices;
|
|
2009
|
+
}
|
|
2010
|
+
// Fallback for partial responses where only list-user devices are available.
|
|
2011
|
+
return [
|
|
2012
|
+
...(Array.isArray(user === null || user === void 0 ? void 0 : user.devices) ? user.devices : []),
|
|
2013
|
+
...(Array.isArray(user === null || user === void 0 ? void 0 : user.deviceProfiles) ? user.deviceProfiles : []),
|
|
2014
|
+
];
|
|
2015
|
+
}
|
|
2016
|
+
unwrapMigratedDevice(rawDevice) {
|
|
2017
|
+
const candidate = rawDevice;
|
|
2018
|
+
if (candidate === null || candidate === void 0 ? void 0 : candidate.device) {
|
|
2019
|
+
return Object.assign(Object.assign({}, candidate.device), candidate);
|
|
2020
|
+
}
|
|
2021
|
+
return candidate || {};
|
|
2022
|
+
}
|
|
2023
|
+
isMigratedDeviceEligible(device) {
|
|
2024
|
+
const hasEligibilitySignal = (device === null || device === void 0 ? void 0 : device.isRegistered) !== undefined
|
|
2025
|
+
|| (device === null || device === void 0 ? void 0 : device.deviceToUpgrade) !== undefined
|
|
2026
|
+
|| (device === null || device === void 0 ? void 0 : device.isEligible) !== undefined;
|
|
2027
|
+
if (!hasEligibilitySignal) {
|
|
2028
|
+
return true;
|
|
2029
|
+
}
|
|
2030
|
+
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));
|
|
2031
|
+
}
|
|
2032
|
+
extractCucmId(entity, device, user) {
|
|
2033
|
+
const deviceCucmId = Number(device === null || device === void 0 ? void 0 : device.cucmId);
|
|
2034
|
+
if (Number.isFinite(deviceCucmId) && deviceCucmId > 0) {
|
|
2035
|
+
return deviceCucmId;
|
|
2036
|
+
}
|
|
2037
|
+
const userCucmId = Number(user === null || user === void 0 ? void 0 : user.cucmId);
|
|
2038
|
+
if (Number.isFinite(userCucmId)) {
|
|
2039
|
+
return userCucmId;
|
|
2040
|
+
}
|
|
2041
|
+
const entityCucmId = Number(entity === null || entity === void 0 ? void 0 : entity.cucmId);
|
|
2042
|
+
if (Number.isFinite(entityCucmId)) {
|
|
2043
|
+
return entityCucmId;
|
|
2044
|
+
}
|
|
2045
|
+
return null;
|
|
2046
|
+
}
|
|
2047
|
+
resolveMigratedDeviceKey(device) {
|
|
2048
|
+
return String((device === null || device === void 0 ? void 0 : device.name) ||
|
|
2049
|
+
(device === null || device === void 0 ? void 0 : device.mac) ||
|
|
2050
|
+
(device === null || device === void 0 ? void 0 : device.deviceId) ||
|
|
2051
|
+
(device === null || device === void 0 ? void 0 : device.cisUuid) ||
|
|
2052
|
+
(device === null || device === void 0 ? void 0 : device.id) ||
|
|
2053
|
+
'').trim();
|
|
2054
|
+
}
|
|
2055
|
+
extractMigratedDeviceLines(device) {
|
|
2056
|
+
const values = new Set();
|
|
2057
|
+
const lineAssociations = Array.isArray(device === null || device === void 0 ? void 0 : device.lineAssociations) ? device.lineAssociations : [];
|
|
2058
|
+
lineAssociations.forEach((lineAssociation) => {
|
|
2059
|
+
var _a, _b;
|
|
2060
|
+
const directoryNumber = (_a = lineAssociation === null || lineAssociation === void 0 ? void 0 : lineAssociation.directoryNumber) === null || _a === void 0 ? void 0 : _a.directoryNumber;
|
|
2061
|
+
const templateDirectoryNumber = (_b = lineAssociation === null || lineAssociation === void 0 ? void 0 : lineAssociation.directoryNumber) === null || _b === void 0 ? void 0 : _b.templateDirectoryNumber;
|
|
2062
|
+
const e164Mask = lineAssociation === null || lineAssociation === void 0 ? void 0 : lineAssociation.e164Mask;
|
|
2063
|
+
[directoryNumber, templateDirectoryNumber, e164Mask].forEach((value) => {
|
|
2064
|
+
const normalized = String(value || '').trim();
|
|
2065
|
+
if (normalized) {
|
|
2066
|
+
values.add(normalized);
|
|
2067
|
+
}
|
|
2068
|
+
});
|
|
2069
|
+
});
|
|
2070
|
+
const lines = Array.isArray(device === null || device === void 0 ? void 0 : device.lines) ? device.lines : [];
|
|
2071
|
+
lines.forEach((line) => {
|
|
2072
|
+
var _a, _b;
|
|
2073
|
+
const directoryNumber = (_a = line === null || line === void 0 ? void 0 : line.directoryNumber) === null || _a === void 0 ? void 0 : _a.directoryNumber;
|
|
2074
|
+
const templateDirectoryNumber = (_b = line === null || line === void 0 ? void 0 : line.directoryNumber) === null || _b === void 0 ? void 0 : _b.templateDirectoryNumber;
|
|
2075
|
+
[directoryNumber, templateDirectoryNumber].forEach((value) => {
|
|
2076
|
+
const normalized = String(value || '').trim();
|
|
2077
|
+
if (normalized) {
|
|
2078
|
+
values.add(normalized);
|
|
2079
|
+
}
|
|
2080
|
+
});
|
|
2081
|
+
});
|
|
2082
|
+
return Array.from(values);
|
|
2083
|
+
}
|
|
1953
2084
|
onFirmwareUpgradeClicked(user) {
|
|
1954
2085
|
if (!this.isValidWebexUuid(user) || user.status !== 'Inactive') {
|
|
1955
2086
|
return;
|
|
@@ -1966,9 +2097,22 @@ class UsersListComponent {
|
|
|
1966
2097
|
dialogRef.beforeClosed().subscribe((result) => {
|
|
1967
2098
|
if (result) {
|
|
1968
2099
|
this.setUserPendingStatus(user, 'Pending Activation');
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
.pipe(takeUntil(this.destroy$))
|
|
2100
|
+
this.userService
|
|
2101
|
+
.getMigratedMigrationFormEntities(this.customerId, user.webexUUID || '', 'PERSON')
|
|
2102
|
+
.pipe(takeUntil(this.destroy$), map$1((entities) => {
|
|
2103
|
+
return Array.isArray(entities) ? entities[0] : entities || null;
|
|
2104
|
+
}), switchMap((entity) => {
|
|
2105
|
+
var _a, _b;
|
|
2106
|
+
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;
|
|
2107
|
+
if (!formId) {
|
|
2108
|
+
this.setUserPendingStatus(user, 'Inactive');
|
|
2109
|
+
this.notifications.error('Activation failed. Migration form not found.');
|
|
2110
|
+
return EMPTY;
|
|
2111
|
+
}
|
|
2112
|
+
const deviceMap = this.buildFirmwareDeviceMap(entity, user);
|
|
2113
|
+
console.log('device map ==> ', deviceMap);
|
|
2114
|
+
return this.userService.triggerFirmwareUpgrade(this.customerId, Number(formId), deviceMap);
|
|
2115
|
+
}), switchMap(() => timer(120000)))
|
|
1972
2116
|
.subscribe({
|
|
1973
2117
|
next: () => {
|
|
1974
2118
|
this.setUserPendingStatus(user, 'Active');
|
|
@@ -2031,6 +2175,45 @@ class UsersListComponent {
|
|
|
2031
2175
|
});
|
|
2032
2176
|
this.subscriptions.push(subscription);
|
|
2033
2177
|
}
|
|
2178
|
+
pollMigrationFormStatusByUserId(formId, userId, onCompleted) {
|
|
2179
|
+
const subscription = timer(0, 5000)
|
|
2180
|
+
.pipe(switchMap(() => this.userService.getMigrationFormStatus(this.customerId, formId)), takeUntil(this.destroy$), takeWhile((response) => {
|
|
2181
|
+
const status = response === null || response === void 0 ? void 0 : response.status;
|
|
2182
|
+
return !this.isMigrationStatusCompleted(status) && !this.isMigrationStatusFailed(status);
|
|
2183
|
+
}, true))
|
|
2184
|
+
.subscribe({
|
|
2185
|
+
next: (response) => {
|
|
2186
|
+
const status = response === null || response === void 0 ? void 0 : response.status;
|
|
2187
|
+
const index = this.getUserIndexById(userId);
|
|
2188
|
+
if (this.isMigrationStatusFailed(status)) {
|
|
2189
|
+
this.removeUserInMigrationProgress();
|
|
2190
|
+
if (index > -1) {
|
|
2191
|
+
this.setStatusToUser(index, 'Migration Error');
|
|
2192
|
+
}
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
if (this.isMigrationStatusCompleted(status)) {
|
|
2196
|
+
this.removeUserInMigrationProgress();
|
|
2197
|
+
if (index > -1) {
|
|
2198
|
+
this.setStatusToUser(index, 'Active');
|
|
2199
|
+
}
|
|
2200
|
+
onCompleted();
|
|
2201
|
+
}
|
|
2202
|
+
},
|
|
2203
|
+
error: () => {
|
|
2204
|
+
const index = this.getUserIndexById(userId);
|
|
2205
|
+
this.removeUserInMigrationProgress();
|
|
2206
|
+
if (index > -1) {
|
|
2207
|
+
this.setStatusToUser(index, 'Migration Error');
|
|
2208
|
+
}
|
|
2209
|
+
},
|
|
2210
|
+
});
|
|
2211
|
+
this.subscriptions.push(subscription);
|
|
2212
|
+
}
|
|
2213
|
+
getUserIndexById(userId) {
|
|
2214
|
+
var _a, _b;
|
|
2215
|
+
return (_b = (_a = this.users) === null || _a === void 0 ? void 0 : _a.findIndex((user) => user.userid === userId)) !== null && _b !== void 0 ? _b : -1;
|
|
2216
|
+
}
|
|
2034
2217
|
setOriginalUserStatus(email = '', status) {
|
|
2035
2218
|
const originalUser = this.users.find((user) => user.email === email && !user.webexUUID);
|
|
2036
2219
|
if (originalUser) {
|