@@ -14,6 +14,11 @@ const SALES_READ_OPERATION = 'quickbooks_read_sales_transactions'
1414const CUSTOMER_OPERATIONS = [ 'quickbooks_create_customer' , 'quickbooks_update_customer' ] as const
1515const VENDOR_OPERATIONS = [ 'quickbooks_create_vendor' , 'quickbooks_update_vendor' ] as const
1616const ITEM_OPERATIONS = [ 'quickbooks_create_item' , 'quickbooks_update_item' ] as const
17+ const MASTER_DATA_CREATE_OPERATIONS = [
18+ 'quickbooks_create_customer' ,
19+ 'quickbooks_create_item' ,
20+ 'quickbooks_create_vendor' ,
21+ ] as const
1722const SALES_DOCUMENT_CREATE_OPERATIONS = [
1823 'quickbooks_create_estimate' ,
1924 'quickbooks_create_invoice' ,
@@ -40,6 +45,7 @@ const SALES_CREATE_OPERATIONS = [
4045 ...SALES_DOCUMENT_CREATE_OPERATIONS ,
4146 'quickbooks_create_customer_payment' ,
4247] as const
48+ const CREATE_OPERATIONS = [ ...MASTER_DATA_CREATE_OPERATIONS , ...SALES_CREATE_OPERATIONS ] as const
4349const SALES_UPDATE_OPERATIONS = [
4450 ...SALES_DOCUMENT_UPDATE_OPERATIONS ,
4551 'quickbooks_update_customer_payment' ,
@@ -704,7 +710,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
704710 title : 'Request ID' ,
705711 type : 'short-input' ,
706712 placeholder : 'Optional idempotency key (max 50 characters)' ,
707- condition : { field : 'operation' , value : [ ...SALES_CREATE_OPERATIONS ] } ,
713+ condition : { field : 'operation' , value : [ ...CREATE_OPERATIONS ] } ,
708714 mode : 'advanced' ,
709715 } ,
710716 {
@@ -870,6 +876,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
870876 operation === 'quickbooks_create_customer' ||
871877 operation === 'quickbooks_update_customer'
872878 ) {
879+ const isCreate = operation === 'quickbooks_create_customer'
873880 return {
874881 credential : oauthCredentialValue ,
875882 customerId : optionalValue ( params . customerId ) ,
@@ -884,9 +891,11 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
884891 shippingAddress : parseQuickBooksAddress ( params . shippingAddress , 'shippingAddress' ) ,
885892 taxable : parseTriStateBoolean ( params . taxable , 'taxable' ) ,
886893 activeStatus : params . activeStatus ?? 'unchanged' ,
894+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
887895 }
888896 }
889897 if ( operation === 'quickbooks_create_vendor' || operation === 'quickbooks_update_vendor' ) {
898+ const isCreate = operation === 'quickbooks_create_vendor'
890899 return {
891900 credential : oauthCredentialValue ,
892901 vendorId : optionalValue ( params . vendorId ) ,
@@ -902,9 +911,11 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
902911 accountNumber : optionalValue ( params . accountNumber ) ,
903912 vendor1099 : parseTriStateBoolean ( params . vendor1099 , 'vendor1099' ) ,
904913 activeStatus : params . activeStatus ?? 'unchanged' ,
914+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
905915 }
906916 }
907917 if ( operation === 'quickbooks_create_item' || operation === 'quickbooks_update_item' ) {
918+ const isCreate = operation === 'quickbooks_create_item'
908919 return {
909920 credential : oauthCredentialValue ,
910921 itemId : optionalValue ( params . itemId ) ,
@@ -920,6 +931,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
920931 expenseAccountId : optionalValue ( params . expenseAccountId ) ,
921932 taxable : parseTriStateBoolean ( params . taxable , 'taxable' ) ,
922933 activeStatus : params . activeStatus ?? 'unchanged' ,
934+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
923935 }
924936 }
925937 return { credential : oauthCredentialValue }
0 commit comments