vue-intergrall-plugins 0.0.154 → 0.0.157

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": "vue-intergrall-plugins",
3
- "version": "0.0.154",
3
+ "version": "0.0.157",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -19,7 +19,6 @@
19
19
  "build:es": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es",
20
20
  "build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife"
21
21
  },
22
- "dependencies": {},
23
22
  "devDependencies": {
24
23
  "@babel/core": "^7.15.5",
25
24
  "@babel/preset-env": "^7.15.6",
@@ -43,14 +42,14 @@
43
42
  "vue-template-compiler": "^2.6.14"
44
43
  },
45
44
  "peerDependencies": {
46
- "vue": "^2.6.14",
47
45
  "@fortawesome/fontawesome-free": "^5.15.4",
48
46
  "@fortawesome/fontawesome-svg-core": "^1.2.36",
49
47
  "@fortawesome/free-solid-svg-icons": "^5.15.4",
50
48
  "@fortawesome/vue-fontawesome": "^2.0.2",
51
- "@popperjs/core": "^2.10.2",
49
+ "@popperjs/core": "^2.11.2",
52
50
  "core-js": "^3.18.1",
53
51
  "postcss": "^8.3.8",
52
+ "vue": "^2.6.14",
54
53
  "vue-clickaway": "^2.2.2",
55
54
  "vue-select": "^3.13.0",
56
55
  "vue-tippy": "^4.12.0",
@@ -59,5 +58,8 @@
59
58
  },
60
59
  "engines": {
61
60
  "node": ">=12"
61
+ },
62
+ "dependencies": {
63
+ "axios": "^0.26.0"
62
64
  }
63
65
  }
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div class="text-footer-actions--btn" @click="$emit('toggle-standard-messages')" :title="dictionary.title_msg_formatada">
3
+ <fa-icon :icon="['fas', 'comment']" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ props: {
10
+ dictionary: {
11
+ type: Object,
12
+ default: {},
13
+ required: false
14
+ }
15
+ }
16
+ }
17
+ </script>
@@ -0,0 +1,208 @@
1
+ <template>
2
+ <div class="text-footer-hsm-container">
3
+ <v-select
4
+ appendToBody
5
+ :calculatePosition="calculateSelectPosition"
6
+ :style="`background-color: ${backgroundColor}`"
7
+ class="text-footer-v-select"
8
+ :options="formatted_messages_1"
9
+ label="value"
10
+ v-model="key_1"
11
+ :reduce="formatted_messages_1 => formatted_messages_1.cod"
12
+ @input="key_1 ? receiveValueFormattedMessage(key_1, 2) : false"
13
+ >
14
+ <div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
15
+ </v-select>
16
+ <v-select
17
+ v-if="formatted_messages_2.length && key_1"
18
+ :style="`background-color: ${backgroundColor}`"
19
+ appendToBody
20
+ :calculatePosition="calculateSelectPosition"
21
+ class="text-footer-v-select"
22
+ :options="formatted_messages_2"
23
+ label="value"
24
+ v-model="key_2"
25
+ :reduce="formatted_messages_2 => formatted_messages_2.cod"
26
+ @input="receiveValueFormattedMessage(key_2, 3)"
27
+ >
28
+ <div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
29
+ </v-select>
30
+ <div class="text-footer-select-03" v-if="formatted_messages_3.length && key_2">
31
+ <v-select
32
+ :style="`background-color: ${backgroundColor}`"
33
+ appendToBody
34
+ :calculatePosition="calculateSelectPosition"
35
+ class="text-footer-v-select"
36
+ :options="formatted_messages_3"
37
+ label="value"
38
+ :clearable="false"
39
+ @input="openMsg()"
40
+ v-model="key_3"
41
+ >
42
+ <div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
43
+ </v-select>
44
+ <template v-if="key_3.cod">
45
+ <span class="text-footer--btn-select-03" v-if="messageType == 1" :title="dictionary.title_btn_preencher_msg_formatada" @click="insertFormattedMessage(key_3)">
46
+ <fa-icon :icon="['fas', 'level-up-alt']" />
47
+ </span>
48
+ <span class="text-footer--btn-select-03" v-else-if="messageType == 2" :title="dictionary.title_btn_abrir_msg_tipo_2" @click="openFormattedMsgType2(key_3)">
49
+ <fa-icon :icon="['fas', 'file-alt']" />
50
+ </span>
51
+ </template>
52
+ </div>
53
+ </div>
54
+ </template>
55
+
56
+ <script>
57
+
58
+ import { createPopper } from "@popperjs/core"
59
+ import { standardMessages } from "../../services/standardMessages"
60
+
61
+ export default {
62
+ mixins: [standardMessages],
63
+ props: {
64
+ dictionary: {
65
+ type: Object,
66
+ default: {},
67
+ required: false
68
+ },
69
+ backgroundColor: {
70
+ type: String,
71
+ default: '#fff',
72
+ required: false
73
+ },
74
+ token_cliente: {
75
+ type: String,
76
+ default: '',
77
+ required: false
78
+ },
79
+ message: {
80
+ type: String,
81
+ default: '',
82
+ required: false
83
+ },
84
+ messageType: {
85
+ type: [Number, String],
86
+ default: 1,
87
+ required: false
88
+ }
89
+ },
90
+ data() {
91
+ return {
92
+ placement: "top",
93
+ firstMount: true,
94
+ formatted_messages_1: [{ cod: "T", value: "Todos" }],
95
+ key_1: "T",
96
+ formatted_messages_2: [],
97
+ key_2: "",
98
+ formatted_messages_3: [],
99
+ key_3: ""
100
+ }
101
+ },
102
+ mounted() {
103
+ this.receiveValueFormattedMessage(this.key_1, 2)
104
+ },
105
+ methods: {
106
+ calculateSelectPosition(dropdownList, component, sizes) {
107
+ dropdownList.style.width = sizes.width
108
+ const popper = createPopper(component.$refs.toggle, dropdownList, {
109
+ placement: this.placement
110
+ })
111
+ return () => popper.destroy()
112
+ },
113
+ receiveValueFormattedMessage(cod, selectionIndex) {
114
+ try {
115
+ if(!this.token_cliente) throw new Error("Informe token_cliente como chave na propriedade formattedMessageSettings que ocorre na chamada componente TextFooter ")
116
+ if(this.firstMount) {
117
+ cod = `${this.key_1}/${cod}`
118
+ this.firstMount = false
119
+ }
120
+ this.getStandardMessages(cod, this.token_cliente).then((data) => {
121
+ if(data && typeof(data) == 'string') return this.$toasted.global.emConstrucao({msg: data})
122
+ if(data) return this.showFormattedMessage(data, selectionIndex)
123
+ this.$toasted.global.defaultError()
124
+ }).catch(e => { console.error("Error in getStandardMessages: ", e) })
125
+ }catch(e) {
126
+ console.error("Error in receiveValueFormattedMessage: ", e)
127
+ }
128
+ },
129
+ showFormattedMessage(messageData, selectionIndex) {
130
+ try {
131
+ let success = false
132
+ if(Array.isArray(messageData)) success = true
133
+ if(!success) this.$toasted.global.emConstrucao({ msg: messageData ? messageData.msg : "Nao foi possível obter mensagens" })
134
+
135
+ switch (selectionIndex) {
136
+ case 2:
137
+ if(!success){
138
+ this.formatted_messages_2.push(messageData)
139
+ this.key_2 = this.formatted_messages_2[0]
140
+ }else{
141
+ this.formatted_messages_2 = messageData
142
+ if(this.formatted_messages_2.length == 1) {
143
+ if(this.formatted_messages_2[0].cod) {
144
+ this.key_2 = this.formatted_messages_2[0].cod
145
+ this.receiveValueFormattedMessage(this.key_2, 3)
146
+ }
147
+ }
148
+ }
149
+ break
150
+ case 3:
151
+ if(!success) {
152
+ this.formatted_messages_3.push(messageData)
153
+ this.$toasted.global.emConstrucao({msg: this.dictionary.msg_erro_sem_msg_formatada})
154
+ this.$emit("close-blocker-standard-message")
155
+ }else{
156
+ if(!messageData.length){
157
+ this.formatted_messages_3.push(this.dictionary.msg_erro_sem_msg_formatada)
158
+ this.key_3 = this.formatted_messages_3[0]
159
+ }else{
160
+ this.formatted_messages_3 = messageData
161
+ if(this.formatted_messages_3.length == 1) {
162
+ if(this.formatted_messages_3[0].cod) {
163
+ this.key_3 = this.formatted_messages_3[0]
164
+ }
165
+ }
166
+ }
167
+ }
168
+ break
169
+ default:
170
+ console.error("Error in showFormattedMessage: selectionIndex not found")
171
+ break
172
+ }
173
+
174
+ }catch(e) {
175
+ console.error("Error in showFormattedMessage: ", e)
176
+ }
177
+ },
178
+ openMsg() {
179
+ try {
180
+ this.messageType == 1 ? this.insertFormattedMessage(this.key_3) : this.openFormattedMsgType2(this.key_3)
181
+ }catch(e) {
182
+ console.error("Error in openMsg: ", e)
183
+ }
184
+ },
185
+ openFormattedMsgType2(key) {
186
+ try {
187
+ if(!key || !this.key_2) return
188
+ this.$emit("open-blocker-standard-message")
189
+ key = key.cod
190
+ this.$emit("set-standard-infos", { category: this.key_2, subject: key })
191
+ }catch(e) {
192
+ console.error("Error in openFormattedMsgType2: ", e)
193
+ }
194
+ },
195
+ insertFormattedMessage(key) {
196
+ try {
197
+ if(!key) return this.$toasted.global.defaultError({msg: 'Selecione uma mensagem'})
198
+ if(!key.cod) throw new Error("Chave informada no parametro nao possue codigo")
199
+ const { value } = key
200
+ const finalMessage = `${this.message}${this.message && !this.message.endsWith(" ") ? ` ${value}` : value}`
201
+ return value ? this.$emit("add-standard-message", finalMessage) : this.$toasted.global.emConstrucao({msg: 'Mensagem vazia'})
202
+ }catch(e) {
203
+ console.error("Erro ao inserir mensagem formatada: ", e)
204
+ }
205
+ }
206
+ }
207
+ }
208
+ </script>
@@ -21,8 +21,8 @@
21
21
  :disabled="textareaSettings.disabled"
22
22
  :placeholder="textareaSettings.placeholderMessage"
23
23
  @input="sendFinalMessage"
24
- @keydown.up="toggleHSM"
25
- @keydown.down="toggleHSM"
24
+ @keydown.up="toggleStandardMessages"
25
+ @keydown.down="toggleStandardMessages"
26
26
  @keydown.esc="closeEmojis"
27
27
  @keydown.enter="sendMessageHandler"
28
28
  @paste="pasteImage"
@@ -50,6 +50,12 @@
50
50
  @set-audio="setAudio"
51
51
  :ref="`${textId}-mic`"
52
52
  />
53
+ <BtnStandardMessages
54
+ v-show="formattedMessageSettings.hasStandardMessages"
55
+ :dictionary="dictionary"
56
+ :ref="`${textId}-standard-messages`"
57
+ @toggle-standard-messages="toggleStandardMessages"
58
+ />
53
59
  <BtnFiles
54
60
  v-show="buttons.hasFiles && !audioFile"
55
61
  :textId="textId"
@@ -64,11 +70,29 @@
64
70
  />
65
71
  <BtnExpand
66
72
  v-show="buttons.hasExpand && !audioFile"
73
+ :ref="`${textId}-expand`"
67
74
  @expand-textarea="$emit('expand-textarea')"
68
75
  :dictionary="dictionary"
69
76
  />
70
77
  </div>
71
78
  </div>
79
+ <transition name="fade">
80
+ <StandardMessages
81
+ v-if="showStandardMessages"
82
+ :class="cssStyle.width ? cssStyle.width: ''"
83
+ :dictionary="dictionary"
84
+ :backgroundColor="cssStyle.backgroundColor"
85
+ :token_cliente="formattedMessageSettings.token_cliente ? formattedMessageSettings.token_cliente : ''"
86
+ :message="message"
87
+ :messageType="messageType"
88
+
89
+ @open-blocker-standard-message="openBlockerStandardMessage"
90
+ @close-blocker-standard-message="closeBlockerStandardMessage"
91
+ @set-message-type="setMessageType"
92
+ @set-standard-infos="setStandardInfos"
93
+ @add-standard-message="addStandardMessage"
94
+ />
95
+ </transition>
72
96
  </div>
73
97
  </template>
74
98
 
@@ -83,9 +107,11 @@ import RemainingCharacters from "./RemainingCharacters"
83
107
  import BtnMic from "./BtnMic"
84
108
  import BtnFiles from "./BtnFiles"
85
109
  import BtnExpand from "./BtnExpand"
110
+ import BtnStandardMessages from "./BtnStandardMessages"
111
+ import StandardMessages from "./StandardMessages"
86
112
 
87
113
  export default {
88
- components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters },
114
+ components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages },
89
115
  mixins: [ clickaway ],
90
116
  props: {
91
117
  buttons: {
@@ -110,7 +136,7 @@ export default {
110
136
  },
111
137
  formattedMessageSettings: {
112
138
  type: Object,
113
- default: () => { return { hasHsm: false, msgType: 0 } },
139
+ default: () => { return { hasStandardMessages: false, msgType: 0, token_cliente: "" } },
114
140
  required: false
115
141
  },
116
142
  fileSettings: {
@@ -151,7 +177,9 @@ export default {
151
177
  isDoc: false,
152
178
  fileFormatError: false,
153
179
  audioFile: "",
154
- audioSource: ""
180
+ audioSource: "",
181
+ showStandardMessages: false,
182
+ messageType: 1
155
183
  }
156
184
  },
157
185
  created() {
@@ -161,7 +189,7 @@ export default {
161
189
  setResizeListeners(this.$el, ".js-autoresize", ".js-parentresize")
162
190
 
163
191
  // this.$root.$on("drop-file", (file, type) => { if(this.buttons.hasFiles) this.fileUpload(file, type, true) })
164
- // this.$root.$on("toggle-msg-formatada", () => { this.toggleHSM() })
192
+ // this.$root.$on("toggle-msg-formatada", () => { this.toggleStandardMessages() })
165
193
  // this.$root.$on("textarea-focus", () => { this.focusTextarea() })
166
194
  // this.$root.$on("resize-footer-template", () => { this.adjustChatHeight() })
167
195
  // this.$root.$on("clear-footer-message", () => { this.message = "" })
@@ -402,6 +430,25 @@ export default {
402
430
  console.error(e)
403
431
  }
404
432
  },
433
+ toggleStandardMessages() {
434
+ this.showStandardMessages = !this.showStandardMessages
435
+ },
436
+ openBlockerStandardMessage() {
437
+ this.$emit("open-blocker-standard-message")
438
+ },
439
+ closeBlockerStandardMessage() {
440
+ this.$emit("close-blocker-standard-message")
441
+ },
442
+ setMessageType(type) {
443
+ this.messageType = type
444
+ },
445
+ setStandardInfos(infos) {
446
+ this.$emit("set-standard-infos", infos)
447
+ },
448
+ addStandardMessage(message) {
449
+ this.message = message
450
+ this.sendFinalMessage()
451
+ },
405
452
  },
406
453
  destroyed() {
407
454
  // this.$root.$off("drop-file")