@webitel/ui-sdk 24.10.7 → 24.10.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.10.7",
3
+ "version": "24.10.8",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -1,4 +1,5 @@
1
1
  import { ContactsApiFactory } from 'webitel-sdk';
2
+ import deepCopy from 'deep-copy';
2
3
  import {
3
4
  getDefaultGetListResponse,
4
5
  getDefaultGetParams,
@@ -82,7 +83,7 @@ const getList = async (params) => {
82
83
  searchKey = ContactsSearchMode.VARIABLES;
83
84
  } else if (params[ContactsSearchMode.DESTINATION]) {
84
85
  searchValue = params[ContactsSearchMode.DESTINATION];
85
- searchKey = 'emails,phones';
86
+ searchKey = 'emails,phones,imclients{user{name}}';
86
87
  }
87
88
 
88
89
  // This code needed for adding starToSearch method to applyTransform while searchKey !== SearchMode.VARIABLES because '*' in variables search mode brokes backend logic.
@@ -143,6 +144,7 @@ const get = async ({ itemId: id }) => {
143
144
  const itemResponseHandler = (item) => {
144
145
  return {
145
146
  ...item,
147
+ name: item.name.commonName,
146
148
  labels: item.labels ? [...item.labels.data] : [],
147
149
  managers: item.managers ? [...item.managers.data] : [],
148
150
  timezones: item.timezones ? [...item.timezones.data] : [],
@@ -178,8 +180,17 @@ const sanitizeTimezones = (itemInstance) => {
178
180
  return { ...itemInstance, timezones };
179
181
  };
180
182
 
183
+ const preRequestHandler = (item) => {
184
+ const copy = deepCopy(item);
185
+ copy.name = {
186
+ commonName: copy.name,
187
+ };
188
+ return copy;
189
+ };
190
+
181
191
  const add = async ({ itemInstance }) => {
182
192
  const item = applyTransform(itemInstance, [
193
+ preRequestHandler,
183
194
  sanitizeManagers,
184
195
  sanitizeTimezones,
185
196
  sanitize(fieldsToSend),
@@ -196,6 +207,7 @@ const add = async ({ itemInstance }) => {
196
207
  const update = async ({ itemInstance }) => {
197
208
  const { etag } = itemInstance;
198
209
  const item = applyTransform(itemInstance, [
210
+ preRequestHandler,
199
211
  sanitizeManagers,
200
212
  sanitizeTimezones,
201
213
  sanitize(fieldsToSend),