@tuki-io/tuki-widgets 0.0.219-dev.5 → 0.0.219-dev.7

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.
@@ -1970,9 +1970,15 @@ class UserManageWidgetComponent {
1970
1970
  return;
1971
1971
  }
1972
1972
  this.dataPending = true;
1973
- if (this.user.devices[0].lineAssociations[0] && !this.user.devices[0].lineAssociations[0].equals(this.userService.originUser.devices[0].lineAssociations[0])
1974
- || (this.user.lines && this.userService.originUser.lines && this.user.lines[0].mappedDids[0] !== this.userService.originUser.lines[0].mappedDids[0])) {
1975
- const subscription = this.userService.editTranslationPattern(this.user.cucmId, this.userService.originUser.lines && this.userService.originUser.lines[0].mappedDids[0] || '', this.user.lines && this.user.lines[0].mappedDids[0], this.userService.user.devices[0].lineAssociations[0].directoryNumber.directoryNumber, this.userService.originUser.devices[0].lineAssociations[0].directoryNumber.routePartitionName, this.userService.originUser.lines && this.userService.originUser.lines[0].didPatterns[0].description || '').subscribe(() => {
1973
+ const currentLineAssociation = this.user?.devices?.[0]?.lineAssociations?.[0];
1974
+ const originLineAssociation = this.userService.originUser?.devices?.[0]?.lineAssociations?.[0];
1975
+ const currentMappedDid = this.user?.lines?.[0]?.mappedDids?.[0] || '';
1976
+ const originMappedDid = this.userService.originUser?.lines?.[0]?.mappedDids?.[0] || '';
1977
+ const didPatternDescription = this.userService.originUser?.lines?.[0]?.didPatterns?.[0]?.description || '';
1978
+ const lineAssociationChanged = currentLineAssociation && originLineAssociation && !currentLineAssociation.equals(originLineAssociation);
1979
+ const mappedDidChanged = currentMappedDid !== originMappedDid;
1980
+ if ((lineAssociationChanged || mappedDidChanged) && currentLineAssociation && originLineAssociation) {
1981
+ const subscription = this.userService.editTranslationPattern(this.user.cucmId, originMappedDid, currentMappedDid, currentLineAssociation.directoryNumber.directoryNumber, originLineAssociation.directoryNumber.routePartitionName, didPatternDescription).subscribe(() => {
1976
1982
  this.dataPending = false;
1977
1983
  this.onSave.next("user has been saved successfully..");
1978
1984
  subscription.unsubscribe();