@webitel/ui-sdk 24.8.37 → 24.8.38

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.8.37",
3
+ "version": "24.8.38",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -4,7 +4,7 @@
4
4
  :status="status"
5
5
  :status-duration="statusDuration"
6
6
  @closed="handleClosed"
7
- @change="handleStatusSelectInput"
7
+ @change="handleSelectInput"
8
8
  />
9
9
  <pause-cause-popup
10
10
  v-if="isPauseCausePopup"
@@ -54,6 +54,7 @@ const PauseCauseAPI = PauseCauseAPIFactory(api);
54
54
  const isPauseCausePopup = ref(false);
55
55
  const pauseCauses = ref([]);
56
56
  const error = ref(null);
57
+ const chosenStatus = ref('');
57
58
 
58
59
  function openPauseCausePopup() {
59
60
  isPauseCausePopup.value = true;
@@ -83,21 +84,33 @@ async function changeStatus({ status, pauseCause }) {
83
84
  }
84
85
  }
85
86
 
86
- async function handleStatusSelectInput(status) {
87
- if (status === props.status) return;
88
-
87
+ async function handleStatus(status) {
89
88
  if (status === AgentStatus.PAUSE) {
90
89
  await loadPauseCauses();
91
90
  if (pauseCauses.value.length) {
92
91
  openPauseCausePopup();
92
+ return;
93
93
  }
94
- } else {
95
- await changeStatus({ status });
96
94
  }
95
+ if (status === props.status) return;
96
+ await changeStatus({ status });
97
+ }
98
+
99
+ function handleSelectInput(newStatus) {
100
+ handleStatus(newStatus);
101
+ chosenStatus.value = newStatus;
102
+ // we need to save changes which come from input, because sometimes we want
103
+ // to choose 'pause' repeatedly and have to check the previous status
97
104
  }
98
105
 
99
106
  function handleClosed(event) {
100
- return handleStatusSelectInput(event.value);
107
+ // sometimes we want to choose 'pause' repeatedly
108
+ // but 'change' event from wt-status-select can't give us the same value,
109
+ // in this case we have to use value from 'closed' event to choose 'pause' status
110
+ if ((event.value === chosenStatus.value || !chosenStatus.value) // if closed status the same as chosen, or chosen status is empty
111
+ && event.value === AgentStatus.PAUSE) { // and only for 'pause' status
112
+ handleStatus(event.value);
113
+ }
101
114
  }
102
115
 
103
116
  function handlePauseCauseInput(pauseCause) {