@connectorx/n8n-nodes-cortex 0.1.25 → 0.1.26
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.
|
@@ -508,7 +508,7 @@ class Cortex {
|
|
|
508
508
|
const label = `${t.name} (${t.language || 'pt_BR'})${varNames ? ' — Vars: ' + varNames : ''}`;
|
|
509
509
|
return {
|
|
510
510
|
name: label,
|
|
511
|
-
value: JSON.stringify({ id: t.id, name: t.name, language: t.language, variables: t.variables }),
|
|
511
|
+
value: JSON.stringify({ id: t.id, name: t.name, language: t.language, variables: t.variables, components: t.components }),
|
|
512
512
|
};
|
|
513
513
|
});
|
|
514
514
|
}
|
|
@@ -525,17 +525,29 @@ class Cortex {
|
|
|
525
525
|
return { fields: [] };
|
|
526
526
|
const templateData = JSON.parse(templateDataStr);
|
|
527
527
|
const vars = (templateData.variables || []);
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
528
|
+
const fields = vars.map((v) => ({
|
|
529
|
+
id: v.name,
|
|
530
|
+
displayName: v.name.toUpperCase(),
|
|
531
|
+
required: true,
|
|
532
|
+
defaultMatch: false,
|
|
533
|
+
display: true,
|
|
534
|
+
type: 'string',
|
|
535
|
+
canBeUsedToMatch: false,
|
|
536
|
+
}));
|
|
537
|
+
const components = (templateData.components || []);
|
|
538
|
+
const headerComp = components.find((c) => c.type === 'HEADER');
|
|
539
|
+
if (headerComp && ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(headerComp.format)) {
|
|
540
|
+
fields.unshift({
|
|
541
|
+
id: 'header_media_url',
|
|
542
|
+
displayName: `HEADER (${headerComp.format}) URL`,
|
|
532
543
|
required: true,
|
|
533
544
|
defaultMatch: false,
|
|
534
545
|
display: true,
|
|
535
546
|
type: 'string',
|
|
536
547
|
canBeUsedToMatch: false,
|
|
537
|
-
})
|
|
538
|
-
}
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
return { fields };
|
|
539
551
|
}
|
|
540
552
|
catch (e) {
|
|
541
553
|
return { fields: [] };
|
|
@@ -631,6 +643,19 @@ class Cortex {
|
|
|
631
643
|
});
|
|
632
644
|
components.push({ type: 'body', parameters: params });
|
|
633
645
|
}
|
|
646
|
+
const headerComp = (templateData.components || []).find((c) => c.type === 'HEADER');
|
|
647
|
+
if (headerComp && ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(headerComp.format)) {
|
|
648
|
+
const mediaUrl = userValues['header_media_url'];
|
|
649
|
+
if (mediaUrl) {
|
|
650
|
+
const mediaType = headerComp.format.toLowerCase();
|
|
651
|
+
const mediaParam = { type: mediaType };
|
|
652
|
+
mediaParam[mediaType] = { link: mediaUrl };
|
|
653
|
+
components.unshift({
|
|
654
|
+
type: 'header',
|
|
655
|
+
parameters: [mediaParam]
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}
|
|
634
659
|
content = {
|
|
635
660
|
name: templateData.name,
|
|
636
661
|
language: templateData.language || 'pt_BR',
|