feat(Telegram Node): New operation sendAndWait (#12771)

This commit is contained in:
Michael Kret
2025-01-24 13:44:05 +02:00
committed by GitHub
parent 5b760e7f7f
commit 2c58d47f8e
8 changed files with 269 additions and 124 deletions

View File

@@ -137,6 +137,11 @@ export function getSendAndWaitProperties(
targetProperties: INodeProperties[],
resource: string = 'message',
additionalProperties: INodeProperties[] = [],
options?: {
noButtonStyle?: boolean;
defaultApproveLabel?: string;
defaultDisapproveLabel?: string;
},
) {
const buttonStyle: INodeProperties = {
displayName: 'Button Style',
@@ -154,6 +159,77 @@ export function getSendAndWaitProperties(
},
],
};
const approvalOptionsValues = [
{
displayName: 'Type of Approval',
name: 'approvalType',
type: 'options',
placeholder: 'Add option',
default: 'single',
options: [
{
name: 'Approve Only',
value: 'single',
},
{
name: 'Approve and Disapprove',
value: 'double',
},
],
},
{
displayName: 'Approve Button Label',
name: 'approveLabel',
type: 'string',
default: options?.defaultApproveLabel || 'Approve',
displayOptions: {
show: {
approvalType: ['single', 'double'],
},
},
},
...[
options?.noButtonStyle
? ({} as INodeProperties)
: {
...buttonStyle,
displayName: 'Approve Button Style',
name: 'buttonApprovalStyle',
displayOptions: {
show: {
approvalType: ['single', 'double'],
},
},
},
],
{
displayName: 'Disapprove Button Label',
name: 'disapproveLabel',
type: 'string',
default: options?.defaultDisapproveLabel || 'Decline',
displayOptions: {
show: {
approvalType: ['double'],
},
},
},
...[
options?.noButtonStyle
? ({} as INodeProperties)
: {
...buttonStyle,
displayName: 'Disapprove Button Style',
name: 'buttonDisapprovalStyle',
default: 'secondary',
displayOptions: {
show: {
approvalType: ['double'],
},
},
},
],
].filter((p) => Object.keys(p).length) as INodeProperties[];
const sendAndWait: INodeProperties[] = [
...targetProperties,
{
@@ -216,68 +292,7 @@ export function getSendAndWaitProperties(
{
displayName: 'Values',
name: 'values',
values: [
{
displayName: 'Type of Approval',
name: 'approvalType',
type: 'options',
placeholder: 'Add option',
default: 'single',
options: [
{
name: 'Approve Only',
value: 'single',
},
{
name: 'Approve and Disapprove',
value: 'double',
},
],
},
{
displayName: 'Approve Button Label',
name: 'approveLabel',
type: 'string',
default: 'Approve',
displayOptions: {
show: {
approvalType: ['single', 'double'],
},
},
},
{
...buttonStyle,
displayName: 'Approve Button Style',
name: 'buttonApprovalStyle',
displayOptions: {
show: {
approvalType: ['single', 'double'],
},
},
},
{
displayName: 'Disapprove Button Label',
name: 'disapproveLabel',
type: 'string',
default: 'Decline',
displayOptions: {
show: {
approvalType: ['double'],
},
},
},
{
...buttonStyle,
displayName: 'Disapprove Button Style',
name: 'buttonDisapprovalStyle',
default: 'secondary',
displayOptions: {
show: {
approvalType: ['double'],
},
},
},
],
values: approvalOptionsValues,
},
],
displayOptions: {