vue-intergrall-plugins 0.0.206 → 0.0.209

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.206",
3
+ "version": "0.0.209",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -1,24 +1,24 @@
1
1
  <template>
2
2
  <span class="file-item">
3
3
  <transition-group name="fade" mode="out-in" class="file-item-transition">
4
- <div v-if="loading" :small="true" key="card-file-loader" class="req-loader slow"></div>
4
+ <div v-if="isLoading" :small="true" key="card-file-loader" class="req-loader slow"></div>
5
5
  <template v-else>
6
- <span v-if="imageUrl" class="file-img box-shadow" @click="openFile(imageUrl, true)" key="card-file-img" :title="fileName">
7
- <img :src="`${imageUrl}`" :alt="fileName" />
6
+ <span v-if="imageURL" class="file-img box-shadow" @click="openWindowFromURL(imageURL, true)" key="card-file-img" :title="filename">
7
+ <img :src="`${imageURL}`" :alt="filename" />
8
8
  </span>
9
9
  <span
10
10
  v-else
11
11
  class="file-icon"
12
12
  key="card-file-doc"
13
- :class="[currentClass]"
14
- @click="openFile(docUrl, false)"
15
- :title="fileName"
13
+ :class="[iconClass]"
14
+ @click="openWindowFromURL(docURL, false)"
15
+ :title="filename"
16
16
  target="_blank"
17
17
  rel="noreferrer noopener"
18
18
  >
19
19
  <fa-icon :icon="icon" />
20
20
  </span>
21
- <a :href="imageUrl ? imageUrl : docUrl" :download="`${fileName}`" target="_blank" rel="noreferrer noopener" key="card-file-download-icon" :title="`Download ${fileName}`">
21
+ <a :href="imageURL ? imageURL : docURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener" key="card-file-download-icon" :title="`Download ${filename}`">
22
22
  <fa-icon :icon="['fas', 'download']" />
23
23
  </a>
24
24
  </template>
@@ -36,9 +36,10 @@
36
36
  </style>
37
37
 
38
38
  <script>
39
- import { gerarVariaveisAnexo } from "../../services/formatMessage"
39
+ import { fileHandler } from "../../mixins/fileHandler"
40
40
 
41
41
  export default {
42
+ mixins: [fileHandler],
42
43
  props: {
43
44
  file: {
44
45
  type: Object,
@@ -53,65 +54,8 @@ export default {
53
54
  required: true
54
55
  }
55
56
  },
56
- computed: {
57
- currentClass() {
58
- return this.fileExt === "pdf" ? "pdf" : "doc"
59
- }
60
- },
61
- data() {
62
- return {
63
- loading: true,
64
- isAnexo: false,
65
- imageUrl: "",
66
- fileExt: "",
67
- docUrl: "",
68
- fileName: "",
69
- audio: false,
70
- video: false,
71
- icon: []
72
- }
73
- },
74
- mounted() {
75
- this.setFileVars()
76
- },
77
- methods: {
78
- setFileVars() {
79
- try {
80
- const {
81
- anexo,
82
- imgAnexo,
83
- tipoDoc,
84
- docAnexo,
85
- nomeArquivo,
86
- audio,
87
- video
88
- } = gerarVariaveisAnexo(this.file, { dominio: this.domain });
89
-
90
- this.isAnexo = anexo;
91
- this.imageUrl = imgAnexo;
92
- this.fileExt = tipoDoc;
93
- this.docUrl = docAnexo;
94
- this.fileName = nomeArquivo;
95
- this.audio = audio;
96
- this.video = video;
97
-
98
- this.generateIcon();
99
-
100
- this.loading = false;
101
- }catch(e) {
102
- console.error("Erro ao gerar as variaveis dos anexos")
103
- console.error(e)
104
- }
105
- },
106
- generateIcon() {
107
- this.icon = this.fileExt === "pdf" ? ['fas', 'file-pdf'] : ['fas', 'file-alt']
108
- },
109
- openFile(link, isImg) {
110
- const width = window.innerWidth
111
- const height = window.innerHeight
112
- const options = !isImg ? `width=${width},height=${height}` : "width=auto,height=auto"
113
- window.open(link, "card-file", options)
114
- }
57
+ mounted(){
58
+ this.setFileVars(this.file, { dominio: this.domain })
115
59
  }
116
60
  }
117
61
  </script>
@@ -7,45 +7,46 @@
7
7
  {{dictionary.img_com_erro}}
8
8
  </div>
9
9
  </div>
10
- <Loader v-if="carregando" :small="true" key="anexo-loader" :slow="true" />
10
+ <Loader v-if="isLoading" :small="true" key="anexo-loader" :slow="true" />
11
11
  <div v-else key="anexo-mensagem" class="anexo-mensagem">
12
- <img v-if="imgAnexo" @click="abrirVisualizacaoImg(imgAnexo)" :src="imgAnexo" :alt="dictionary.alt_msg_img">
13
- <div class="anexos-links-container" v-if="imgAnexo">
14
- <a href="#" @click="abrirVisualizacaoImg(imgAnexo)"> {{ dictionary.titulo_visualizar_img }} </a>
15
- <fa-icon :icon="['fas', 'search-plus']" @click="abrirVisualizacaoImg(imgAnexo)" />
12
+ <img v-if="imageURL" @click="showImage(imageURL)" :src="imageURL" :alt="dictionary.alt_msg_img">
13
+ <div class="anexos-links-container" v-if="imageURL">
14
+ <a href="#" @click.prevent="showImage(imageURL)"> {{ dictionary.titulo_visualizar_img }} </a>
15
+ <fa-icon :icon="['fas', 'search-plus']" @click="showImage(imageURL)" />
16
16
  </div>
17
- <div v-else-if="docAnexo" class="anexo-container">
17
+ <div v-else-if="docURL" class="anexo-container">
18
18
  <template v-if="audio || video">
19
- <audio v-if="audio" :src="docAnexo" controls :title="`${tipoDoc} - ${nomeArquivo}`">
20
- <p> {{ dictionary.msg_erro_audio }} <a :href="docAnexo" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_audio }} </a> </p>
19
+ <audio v-if="audio" :src="docURL" controls :title="`${fileType} - ${filename}`">
20
+ <p> {{ dictionary.msg_erro_audio }} <a :href="docURL" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_audio }} </a> </p>
21
21
  </audio>
22
- <video v-if="video" :src="docAnexo" controls :title="`${tipoDoc} - ${nomeArquivo}`">
23
- <p> {{ dictionary.msg_erro_video }} <a v-if="tipoDoc != 'erro'" :href="docAnexo" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_video }} </a> </p>
22
+ <video v-if="video" :src="docURL" controls :title="`${fileType} - ${filename}`">
23
+ <p> {{ dictionary.msg_erro_video }} <a v-if="fileType != 'erro'" :href="docURL" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_video }} </a> </p>
24
24
  </video>
25
25
  </template>
26
26
  <template v-else>
27
- <a v-if="tipoDoc != 'erro'" :href="docAnexo" target="_blank" rel="noreferrer noopener" :title="`${tipoDoc} - ${nomeArquivo}`">
28
- <fa-icon :icon="this.icone" />
29
- <p v-text="nomeArquivo"></p>
27
+ <a v-if="fileType != 'erro'" :href="docURL" target="_blank" rel="noreferrer noopener" :title="`${fileType} - ${filename}`">
28
+ <fa-icon :class="[iconClass]" :icon="icon" />
29
+ <p v-text="filename"></p>
30
30
  </a>
31
- <p v-else :title="`${tipoDoc} - ${nomeArquivo}`" class="arquivo-erro">
31
+ <p v-else :title="`${fileType} - ${filename}`" class="arquivo-erro">
32
32
  <fa-icon :icon="['fas', 'file-alt']" />
33
- {{ nomeArquivo }}
33
+ {{ filename }}
34
34
  </p>
35
35
  </template>
36
36
  </div>
37
- <a v-if="imgAnexo" :href="imgAnexo" :download="`${nomeArquivo}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_img }} <fa-icon :icon="['fas', 'download']" /> </a>
38
- <a v-if="docAnexo" :href="docAnexo" :download="`${nomeArquivo}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_doc }} <fa-icon :icon="['fas', 'download']" /> </a>
37
+ <a v-if="imageURL" :href="imageURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_img }} <fa-icon :icon="['fas', 'download']" /> </a>
38
+ <a v-if="docURL" :href="docURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_doc }} <fa-icon :icon="['fas', 'download']" /> </a>
39
39
  </div>
40
40
  </transition-group>
41
41
  </div>
42
42
  </template>
43
43
 
44
44
  <script>
45
- import { gerarVariaveisAnexo } from "../../services/formatMessage"
45
+ import { fileHandler } from "../../mixins/fileHandler"
46
46
  import Loader from "../Loader/Loader"
47
47
 
48
48
  export default {
49
+ mixins: [fileHandler],
49
50
  components: { Loader },
50
51
  props: {
51
52
  anexo: {
@@ -67,86 +68,37 @@ export default {
67
68
  },
68
69
  data() {
69
70
  return {
70
- carregando: true,
71
- isAnexo: false,
72
- imgAnexo: "",
73
- tipoDoc: "",
74
- docAnexo: "",
75
- nomeArquivo: "",
76
- audio: false,
77
- video: false,
78
- icone: [],
79
71
  imgErro: false,
80
72
  imgMsgErro: '',
81
73
  }
82
74
  },
83
75
  mounted() {
84
76
  if(this.validarAnexo()){
85
- this.setVariaveisAnexo()
77
+ this.setFileVars(this.anexo, { dominio: this.dominio })
86
78
  }
87
79
  },
88
80
  methods: {
89
- abrirVisualizacaoImg(imagem){
90
- this.$emit("abrir-imagem", imagem)
91
- },
92
- setVariaveisAnexo() {
93
- try {
94
- const {
95
- anexo,
96
- imgAnexo,
97
- tipoDoc,
98
- docAnexo,
99
- nomeArquivo,
100
- audio,
101
- video
102
- } = gerarVariaveisAnexo(this.anexo, { dominio: this.dominio });
103
-
104
- this.isAnexo = anexo;
105
- this.imgAnexo = imgAnexo;
106
- this.tipoDoc = tipoDoc;
107
- this.docAnexo = docAnexo;
108
- this.nomeArquivo = nomeArquivo;
109
- this.audio = audio;
110
- this.video = video;
111
-
112
- this.gerarIcone();
113
-
114
- this.carregando = false;
115
- }catch(e) {
116
- console.error("Erro ao gerar as variaveis dos anexos")
117
- console.error(e)
118
- }
119
- },
120
81
  validarAnexo(){
121
- let status = true;
82
+ let status = true
122
83
  //caso for audio ou documento ignorar
123
- if(this.anexo.docAnexo || this.anexo.audio){
124
- return true;
125
- }
84
+ if(this.anexo.docURL || this.anexo.audio) return true
126
85
  if(!this.anexo.name){
127
86
  this.imgMsgErro = this.dictionary.img_com_erro_nome
128
- status = false;
87
+ status = false
129
88
  }
130
89
  if(!this.anexo.nomeGravacao){
131
90
  this.imgMsgErro = this.dictionary.img_com_erro_nome_gravacao
132
- status = false;
91
+ status = false
133
92
  }
134
- // if(!this.anexo.size || this.anexo.size == 0){
135
- // this.imgMsgErro = this.dictionary.img_com_erro_tamanho
136
- // status = false;
137
- // }
138
93
  if(!this.anexo.type){
139
94
  this.imgMsgErro = this.dictionary.img_com_erro_tipo
140
- status = false;
95
+ status = false
141
96
  }
142
97
  if(status == false){
143
- this.imgErro = true;
144
- this.carregando = false;
98
+ this.imgErro = true
99
+ this.isLoading = false
145
100
  }
146
- return status;
147
- },
148
- gerarIcone() {
149
- this.icone = this.tipoDoc === "pdf" ? ['fas', 'file-pdf'] : ['fas', 'file-alt']
101
+ return status
150
102
  }
151
103
  }
152
104
  }
@@ -254,4 +206,12 @@ export default {
254
206
  font-size: 1.025em;
255
207
  margin-right: 2px;
256
208
  }
209
+
210
+ .pdf {
211
+ color: #E74C3C;
212
+ }
213
+
214
+ .doc {
215
+ color: #006bc9
216
+ }
257
217
  </style>
@@ -1,24 +1,24 @@
1
1
  <template>
2
2
  <span class="anexo-item">
3
3
  <transition-group name="fade" mode="out-in" class="transition-anexo-item">
4
- <div v-if="carregando" :small="true" key="ra-loader-anexo" class="req-loader slow"></div>
4
+ <div v-if="isLoading" :small="true" key="ra-loader-anexo" class="req-loader slow"></div>
5
5
  <template v-else>
6
- <span v-if="imgAnexo" class="anexo-img box-shadow" @click="abrirAnexo(imgAnexo, true)" key="ra-img-anexo" :title="nomeArquivo">
7
- <img :src="`${imgAnexo}`" :alt="nomeArquivo" />
6
+ <span v-if="imageURL" class="anexo-img box-shadow" @click="openWindowFromURL(imageURL, true)" key="ra-img-anexo" :title="filename">
7
+ <img :src="`${imageURL}`" :alt="filename" />
8
8
  </span>
9
9
  <span
10
10
  v-else
11
- class="anexo-icone"
11
+ class="anexo-icon"
12
12
  key="ra-doc-anexo"
13
- :class="[iconeClass]"
14
- @click="abrirAnexo(docAnexo, false)"
15
- :title="nomeArquivo"
13
+ :class="[iconClass]"
14
+ @click="openWindowFromURL(docURL, false)"
15
+ :title="filename"
16
16
  target="_blank"
17
17
  rel="noreferrer noopener"
18
18
  >
19
- <fa-icon :icon="icone" />
19
+ <fa-icon :icon="icon" />
20
20
  </span>
21
- <a :href="imgAnexo ? imgAnexo : docAnexo" :download="`${nomeArquivo}`" target="_blank" rel="noreferrer noopener" key="ra-download-icon" :title="`Download ${nomeArquivo}`">
21
+ <a :href="imageURL ? imageURL : docURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener" key="ra-download-icon" :title="`Download ${filename}`">
22
22
  <fa-icon :icon="['fas', 'download']" />
23
23
  </a>
24
24
  </template>
@@ -36,9 +36,10 @@
36
36
  </style>
37
37
 
38
38
  <script>
39
- import { gerarVariaveisAnexo } from "../../services/formatMessage"
39
+ import { fileHandler } from "../../mixins/fileHandler"
40
40
 
41
41
  export default {
42
+ mixins: [fileHandler],
42
43
  props: {
43
44
  anexo: {
44
45
  type: Object,
@@ -53,65 +54,8 @@ export default {
53
54
  required: true
54
55
  }
55
56
  },
56
- computed: {
57
- iconeClass() {
58
- return this.tipoDoc === "pdf" ? "pdf" : "doc"
59
- }
60
- },
61
- data() {
62
- return {
63
- carregando: true,
64
- isAnexo: false,
65
- imgAnexo: "",
66
- tipoDoc: "",
67
- docAnexo: "",
68
- nomeArquivo: "",
69
- audio: false,
70
- video: false,
71
- icone: []
72
- }
73
- },
74
57
  mounted() {
75
- this.setVariaveisAnexo()
76
- },
77
- methods: {
78
- setVariaveisAnexo() {
79
- try {
80
- const {
81
- anexo,
82
- imgAnexo,
83
- tipoDoc,
84
- docAnexo,
85
- nomeArquivo,
86
- audio,
87
- video
88
- } = gerarVariaveisAnexo(this.anexo, { dominio: this.dominio });
89
-
90
- this.isAnexo = anexo;
91
- this.imgAnexo = imgAnexo;
92
- this.tipoDoc = tipoDoc;
93
- this.docAnexo = docAnexo;
94
- this.nomeArquivo = nomeArquivo;
95
- this.audio = audio;
96
- this.video = video;
97
-
98
- this.gerarIcone();
99
-
100
- this.carregando = false;
101
- }catch(e) {
102
- console.error("Erro ao gerar as variaveis dos anexos")
103
- console.error(e)
104
- }
105
- },
106
- gerarIcone() {
107
- this.icone = this.tipoDoc === "pdf" ? ['fas', 'file-pdf'] : ['fas', 'file-alt']
108
- },
109
- abrirAnexo(link, isImg) {
110
- const width = window.innerWidth
111
- const height = window.innerHeight
112
- const options = !isImg ? `width=${width},height=${height}` : "width=auto,height=auto"
113
- window.open(link, "anexo-ra", options)
114
- }
58
+ this.setFileVars(this.anexo, { dominio: this.dominio })
115
59
  }
116
60
  }
117
61
  </script>
@@ -3,6 +3,8 @@
3
3
  <InteratividadeFormulario
4
4
  v-if="interatividade && validateInterativity()"
5
5
  :interatividade="interatividade"
6
+ :dominio="dominio"
7
+ :anexos="anexos"
6
8
  :dictionary="dictionary"
7
9
  />
8
10
  <div v-else class="mensagem" :class="{mapa, 'hist-msg' : histMsg}">
@@ -24,6 +24,17 @@
24
24
  </div>
25
25
  </div>
26
26
  </div>
27
+ <h3 class="m-5 text-bold" v-text="`Anexos`"></h3>
28
+ <div class="d-flex flex-wrap align-items-center">
29
+ <div v-for="({ name, type, mkuDownload, mku }, fileIndex) in anexos" :key="`file-${fileIndex}`" class="mb-5 mx-5 d-flex">
30
+ <img class="box-shadow max-w-75px max-h-75px cursor-pointer" @click="openFile(mku, type)" v-if="!type" :src="`${dominio}/callcenter/docs.php?mku=${mku}`" :alt="name" :title="name" />
31
+ <fa-icon v-else :icon="returnCurrentIcon(type)" @click="openFile(mku, type)" :class="returnCurrentClass(type)" :title="name" />
32
+ <a class="d-flex align-items-end ml-3 text-dark" :href="`${dominio}/callcenter/docs.php?mku=${mkuDownload}`" :download="`${name}`" target="_blank" rel="noreferrer noopener" :title="`Download ${name}`">
33
+ <fa-icon :icon="['fas', 'download']" />
34
+ </a>
35
+ </div>
36
+ </div>
37
+ <p v-if="!anexos.length" class="text-center mb-5" v-text="`Sem anexos`"></p>
27
38
  </div>
28
39
  </template>
29
40
  </div>
@@ -44,9 +55,17 @@ export default {
44
55
  type: Object,
45
56
  required: true
46
57
  },
58
+ dominio: {
59
+ type: String,
60
+ required: true
61
+ },
47
62
  dictionary: {
48
63
  type: Object,
49
64
  required: true
65
+ },
66
+ anexos: {
67
+ type: Array,
68
+ required: false
50
69
  }
51
70
  },
52
71
  mounted(){
@@ -55,6 +74,18 @@ export default {
55
74
  }
56
75
  },
57
76
  methods: {
77
+ returnCurrentClass(isDoc) {
78
+ return `fs-2 cursor-pointer ${isDoc == 'pdf' ? 'text-red' : 'text-blue'}`
79
+ },
80
+ returnCurrentIcon(isDoc) {
81
+ return isDoc == 'pdf' ? ['fas', 'file-pdf'] : ['fas', 'file-alt']
82
+ },
83
+ openFile(url, isImg) {
84
+ const width = window.innerWidth
85
+ const height = window.innerHeight
86
+ const options = !isImg ? `width=${width},height=${height}` : "width=auto,height=auto"
87
+ window.open(`${this.dominio}/callcenter/docs.php?mku=${url}`, "card-file", options)
88
+ },
58
89
  validateInterativity(){
59
90
  try {
60
91
  if(this.interatividade.formulario && this.interatividade.formulario.length){
@@ -68,22 +99,18 @@ export default {
68
99
  try {
69
100
  let { formulario } = this.interatividade
70
101
  formulario = formulario ? formulario : [];
71
- if(!formulario.length){
72
- return;
73
- }
74
- let foundInfosAdd = formulario.filter(f => f.TIPO_TEXTO > 999);
75
- let foundInfos = formulario.filter(f => f.TIPO_TEXTO < 1000);
102
+ if(!formulario.length) return
103
+ const foundInfosAdd = formulario.filter(f => f.TIPO_TEXTO > 999);
104
+ const foundInfos = formulario.filter(f => f.TIPO_TEXTO < 1000);
76
105
  if(foundInfos){
77
106
  this.informacao = foundInfos.map(info => {
78
- if(info.TIPO_TEXTO == 1){
79
- info.TEXTO = info.TEXTO == 'S' ? this.dictionary.msg_sim : this.dictionary.msg_nao
80
- }
81
- return info
82
- })
83
- }
84
- if(foundInfosAdd){
85
- this.informacaoAdicional = foundInfosAdd;
107
+ if(info.TIPO_TEXTO == 1){
108
+ info.TEXTO = info.TEXTO == 'S' ? this.dictionary.msg_sim : this.dictionary.msg_nao
109
+ }
110
+ return info
111
+ })
86
112
  }
113
+ if(foundInfosAdd) this.informacaoAdicional = foundInfosAdd;
87
114
  } catch (e) {
88
115
  console.error("Erro ao pegar o objeto interatividade formulario")
89
116
  console.error(e)
@@ -190,5 +217,54 @@ export default {
190
217
  .interatividade-lista-link:hover {
191
218
  color: rgb(0, 98, 143);
192
219
  }
193
-
220
+ .text-blue {
221
+ color: #294ED3;
222
+ }
223
+ .text-red {
224
+ color: #E74C3C
225
+ }
226
+ .text-dark {
227
+ color: #333;
228
+ }
229
+ .ml-3 {
230
+ margin-left: 3px;
231
+ }
232
+ .fs-2 {
233
+ font-size: 2rem;
234
+ }
235
+ .flex-wrap {
236
+ -ms-flex-wrap: wrap;
237
+ flex-wrap: wrap;
238
+ }
239
+ .align-items-center {
240
+ -webkit-box-align: center;
241
+ -ms-flex-align: center;
242
+ align-items: center;
243
+ }
244
+ .d-flex {
245
+ display: -webkit-box;
246
+ display: -ms-flexbox;
247
+ display: flex;
248
+ }
249
+ .align-items-end {
250
+ -webkit-box-align: end;
251
+ -ms-flex-align: end;
252
+ align-items: flex-end;
253
+ }
254
+ .text-bold {
255
+ font-weight: bold;
256
+ }
257
+ .m-5 {
258
+ margin: 5px;
259
+ }
260
+ .mb-5 {
261
+ margin-bottom: 5px;
262
+ }
263
+ .mx-5 {
264
+ margin-left: 5px;
265
+ margin-right: 5px;
266
+ }
267
+ .cursor-pointer {
268
+ cursor: pointer;
269
+ }
194
270
  </style>
@@ -91,9 +91,11 @@
91
91
  for (let key in template) {
92
92
  if (key === "components" && Array.isArray(template[key])) {
93
93
  template[key].map((component) => {
94
- component.parameters.map((param) => {
95
- fullText += param.text;
96
- });
94
+ if(component && component.parameters && component.parameters.length) {
95
+ component.parameters.map((param) => {
96
+ fullText += param.text;
97
+ });
98
+ }
97
99
  });
98
100
  }
99
101
  }
@@ -162,36 +164,38 @@
162
164
  for(let index in this.selectedTemplate) {
163
165
  if(index === "components" && Array.isArray(this.selectedTemplate[index])) {
164
166
  const arrComponents = this.selectedTemplate[index]
165
- arrComponents.map(component => {
166
- if(component && component.parameters && component.parameters.length) {
167
- component.parameters.map(message => {
168
- message.currentText = message.text
169
- let keyIndex = 0
170
- while(keyIndex < keys.length) {
171
- const varName = `{{${keys[keyIndex]}}}`
172
- if(message.text.indexOf(varName) != -1) {
173
- /**Gerando os obejetos de parametros da notificacao para o component */
174
- if(component.type === "header") {
175
- this.selectedTemplate['parameters'][component.type] = {}
176
- //Header s? pode ter uma vari?vel
177
- this.selectedTemplate['parameters'][component.type] = {
178
- tipo: "text",
179
- text: values[keyIndex]
167
+ if(arrComponents && arrComponents.length) {
168
+ arrComponents.map(component => {
169
+ if(component && component.parameters && component.parameters.length) {
170
+ component.parameters.map(message => {
171
+ message.currentText = message.text
172
+ let keyIndex = 0
173
+ while(keyIndex < keys.length) {
174
+ const varName = `{{${keys[keyIndex]}}}`
175
+ if(message.text.indexOf(varName) != -1) {
176
+ /**Gerando os obejetos de parametros da notificacao para o component */
177
+ if(component.type === "header") {
178
+ this.selectedTemplate['parameters'][component.type] = {}
179
+ //Header s? pode ter uma vari?vel
180
+ this.selectedTemplate['parameters'][component.type] = {
181
+ tipo: "text",
182
+ text: values[keyIndex]
183
+ }
184
+ } else if(!this.selectedTemplate['parameters'][component.type]) {
185
+ this.selectedTemplate['parameters'][component.type] = new Array()
180
186
  }
181
- } else if(!this.selectedTemplate['parameters'][component.type]) {
182
- this.selectedTemplate['parameters'][component.type] = new Array()
183
- }
184
- //Aplicando valores das v?riaveis dentro dos outros componentes com execess?o do header
185
- if(this.selectedTemplate['parameters'][component.type] && component.type !== 'header') {
186
- this.selectedTemplate['parameters'][component.type].push(values[keyIndex])
187
+ //Aplicando valores das v?riaveis dentro dos outros componentes com execess?o do header
188
+ if(this.selectedTemplate['parameters'][component.type] && component.type !== 'header') {
189
+ this.selectedTemplate['parameters'][component.type].push(values[keyIndex])
190
+ }
191
+ message.currentText = message.currentText.replace(varName, values[keyIndex])
187
192
  }
188
- message.currentText = message.currentText.replace(varName, values[keyIndex])
193
+ keyIndex++
189
194
  }
190
- keyIndex++
191
- }
192
- })
193
- }
194
- })
195
+ })
196
+ }
197
+ })
198
+ }
195
199
  }
196
200
  }
197
201