11import type { INodeProperties } from 'n8n-workflow' ;
22
3- // Resource, Post's Operation field, core post fields (channel/text/scheduling), and both
4- // schedulingType field variants (see the comment on the field below for why there are two).
5- export const postCoreProperties : INodeProperties [ ] = [
6- // ----------------------------------
7- // Resources
8- // ----------------------------------
3+ // The Resource selector, kept as its own export so it can be placed first in the concatenated
4+ // properties array (see descriptions/index.ts) — it must come before the Idea/Post-specific
5+ // fields it controls, otherwise those fields render above it once "Idea" (the default) is
6+ // selected, pushing the selector out of its expected position in the n8n UI.
7+ export const resourceProperty : INodeProperties [ ] = [
98 {
109 displayName : 'Resource' ,
1110 name : 'resource' ,
@@ -23,6 +22,11 @@ export const postCoreProperties: INodeProperties[] = [
2322 ] ,
2423 default : 'idea' ,
2524 } ,
25+ ] ;
26+
27+ // Post's Operation field, core post fields (channel/text/scheduling), and both schedulingType
28+ // field variants (see the comment on the field below for why there are two).
29+ export const postCoreProperties : INodeProperties [ ] = [
2630 // ----------------------------------
2731 // Operations
2832 // ----------------------------------
@@ -236,30 +240,20 @@ export const postCoreProperties: INodeProperties[] = [
236240 } ,
237241] ;
238242
239- // The four attachmentType field variants: generic (hidden for YouTube/Google Business/Pinterest),
240- // YouTube-only (forces 'video'), Google Business-only (no video option), and Pinterest-only
241- // (forces 'image').
243+ // The four attachmentType field variants: YouTube-only (forces 'video'), Google Business-only
244+ // (no video option), Pinterest-only (forces 'image'), and generic (hidden for those three
245+ // channels). The generic variant is deliberately listed LAST: n8n resolves a duplicate-named
246+ // field's initial default (before an org/channel has been selected, so channelService is empty
247+ // and no displayOptions match yet) from the LAST matching property definition in the array,
248+ // not by evaluating displayOptions. Listing the generic 'none' variant last ensures a freshly
249+ // added node defaults to "No Attachment" instead of whichever network-specific variant happens
250+ // to be last.
242251export const postAttachmentProperties : INodeProperties [ ] = [
243252 {
244- // YouTube posts are always videos, Google Business does not support video, and
245- // Pinterest posts are always images, so this field is hidden for those channels and
246- // replaced with the network-specific fields below (see the Scheduling Mode fields
247- // above for why this uses field-level displayOptions rather than per-option
248- // displayOptions).
249253 displayName : 'Attachment Type' ,
250254 name : 'attachmentType' ,
251255 type : 'options' ,
252256 options : [
253- {
254- name : 'No Attachment' ,
255- value : 'none' ,
256- description : 'Create a text-only post' ,
257- } ,
258- {
259- name : 'Image' ,
260- value : 'image' ,
261- description : 'Create a post with an image' ,
262- } ,
263257 {
264258 name : 'Video' ,
265259 value : 'video' ,
@@ -270,49 +264,43 @@ export const postAttachmentProperties: INodeProperties[] = [
270264 show : {
271265 resource : [ 'post' ] ,
272266 operation : [ 'create' ] ,
273- } ,
274- hide : {
275- channelService : [
276- 'youtube' , 'YouTube' , 'YOUTUBE' ,
277- 'google' , 'Google' , 'GOOGLE' , 'googlebusiness' , 'GoogleBusiness' , 'GOOGLEBUSINESS' , 'google_business' , 'Google_Business' , 'GOOGLE_BUSINESS' ,
278- 'pinterest' , 'Pinterest' , 'PINTEREST' ,
279- ] ,
267+ channelService : [ 'youtube' , 'YouTube' , 'YOUTUBE' ] ,
280268 } ,
281269 } ,
282- default : 'none ' ,
283- description : 'Type of attachment to add to the post ' ,
270+ default : 'video ' ,
271+ description : 'YouTube posts only support video attachments ' ,
284272 } ,
285273 {
286274 displayName : 'Attachment Type' ,
287275 name : 'attachmentType' ,
288276 type : 'options' ,
289277 options : [
290278 {
291- name : 'Video' ,
292- value : 'video' ,
293- description : 'Create a post with a video' ,
279+ name : 'No Attachment' ,
280+ value : 'none' ,
281+ description : 'Create a text-only post' ,
282+ } ,
283+ {
284+ name : 'Image' ,
285+ value : 'image' ,
286+ description : 'Create a post with an image' ,
294287 } ,
295288 ] ,
296289 displayOptions : {
297290 show : {
298291 resource : [ 'post' ] ,
299292 operation : [ 'create' ] ,
300- channelService : [ 'youtube ' , 'YouTube ' , 'YOUTUBE ' ] ,
293+ channelService : [ 'google ' , 'Google ' , 'GOOGLE' , 'googlebusiness' , 'GoogleBusiness' , 'GOOGLEBUSINESS' , 'google_business' , 'Google_Business' , 'GOOGLE_BUSINESS '] ,
301294 } ,
302295 } ,
303- default : 'video ' ,
304- description : 'YouTube posts only support video attachments' ,
296+ default : 'none ' ,
297+ description : 'Google Business posts do not support video attachments' ,
305298 } ,
306299 {
307300 displayName : 'Attachment Type' ,
308301 name : 'attachmentType' ,
309302 type : 'options' ,
310303 options : [
311- {
312- name : 'No Attachment' ,
313- value : 'none' ,
314- description : 'Create a text-only post' ,
315- } ,
316304 {
317305 name : 'Image' ,
318306 value : 'image' ,
@@ -323,32 +311,53 @@ export const postAttachmentProperties: INodeProperties[] = [
323311 show : {
324312 resource : [ 'post' ] ,
325313 operation : [ 'create' ] ,
326- channelService : [ 'google ' , 'Google ' , 'GOOGLE' , 'googlebusiness' , 'GoogleBusiness' , 'GOOGLEBUSINESS' , 'google_business' , 'Google_Business' , 'GOOGLE_BUSINESS '] ,
314+ channelService : [ 'pinterest ' , 'Pinterest ' , 'PINTEREST ' ] ,
327315 } ,
328316 } ,
329- default : 'none ' ,
330- description : 'Google Business posts do not support video attachments ' ,
317+ default : 'image ' ,
318+ description : 'Pinterest posts always require an image attachment ' ,
331319 } ,
332320 {
321+ // YouTube posts are always videos, Google Business does not support video, and
322+ // Pinterest posts are always images, so this field is hidden for those channels and
323+ // replaced with the network-specific fields above (see the Scheduling Mode fields
324+ // above for why this uses field-level displayOptions rather than per-option
325+ // displayOptions).
333326 displayName : 'Attachment Type' ,
334327 name : 'attachmentType' ,
335328 type : 'options' ,
336329 options : [
330+ {
331+ name : 'No Attachment' ,
332+ value : 'none' ,
333+ description : 'Create a text-only post' ,
334+ } ,
337335 {
338336 name : 'Image' ,
339337 value : 'image' ,
340338 description : 'Create a post with an image' ,
341339 } ,
340+ {
341+ name : 'Video' ,
342+ value : 'video' ,
343+ description : 'Create a post with a video' ,
344+ } ,
342345 ] ,
343346 displayOptions : {
344347 show : {
345348 resource : [ 'post' ] ,
346349 operation : [ 'create' ] ,
347- channelService : [ 'pinterest' , 'Pinterest' , 'PINTEREST' ] ,
350+ } ,
351+ hide : {
352+ channelService : [
353+ 'youtube' , 'YouTube' , 'YOUTUBE' ,
354+ 'google' , 'Google' , 'GOOGLE' , 'googlebusiness' , 'GoogleBusiness' , 'GOOGLEBUSINESS' , 'google_business' , 'Google_Business' , 'GOOGLE_BUSINESS' ,
355+ 'pinterest' , 'Pinterest' , 'PINTEREST' ,
356+ ] ,
348357 } ,
349358 } ,
350- default : 'image ' ,
351- description : 'Pinterest posts always require an image attachment ' ,
359+ default : 'none ' ,
360+ description : 'Type of attachment to add to the post ' ,
352361 } ,
353362] ;
354363
0 commit comments