@@ -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' ,
@@ -705,7 +711,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
705711 title : 'Request ID' ,
706712 type : 'short-input' ,
707713 placeholder : 'Optional idempotency key (max 50 characters)' ,
708- condition : { field : 'operation' , value : [ ...SALES_CREATE_OPERATIONS ] } ,
714+ condition : { field : 'operation' , value : [ ...CREATE_OPERATIONS ] } ,
709715 mode : 'advanced' ,
710716 } ,
711717 {
@@ -871,6 +877,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
871877 operation === 'quickbooks_create_customer' ||
872878 operation === 'quickbooks_update_customer'
873879 ) {
880+ const isCreate = operation === 'quickbooks_create_customer'
874881 return {
875882 credential : oauthCredentialValue ,
876883 customerId : optionalValue ( params . customerId ) ,
@@ -885,9 +892,11 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
885892 shippingAddress : parseQuickBooksAddress ( params . shippingAddress , 'shippingAddress' ) ,
886893 taxable : parseTriStateBoolean ( params . taxable , 'taxable' ) ,
887894 activeStatus : params . activeStatus ?? 'unchanged' ,
895+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
888896 }
889897 }
890898 if ( operation === 'quickbooks_create_vendor' || operation === 'quickbooks_update_vendor' ) {
899+ const isCreate = operation === 'quickbooks_create_vendor'
891900 return {
892901 credential : oauthCredentialValue ,
893902 vendorId : optionalValue ( params . vendorId ) ,
@@ -903,9 +912,11 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
903912 accountNumber : optionalValue ( params . accountNumber ) ,
904913 vendor1099 : parseTriStateBoolean ( params . vendor1099 , 'vendor1099' ) ,
905914 activeStatus : params . activeStatus ?? 'unchanged' ,
915+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
906916 }
907917 }
908918 if ( operation === 'quickbooks_create_item' || operation === 'quickbooks_update_item' ) {
919+ const isCreate = operation === 'quickbooks_create_item'
909920 return {
910921 credential : oauthCredentialValue ,
911922 itemId : optionalValue ( params . itemId ) ,
@@ -921,6 +932,7 @@ export const QuickBooksBlock: BlockConfig<QuickBooksResponse> = {
921932 expenseAccountId : optionalValue ( params . expenseAccountId ) ,
922933 taxable : parseTriStateBoolean ( params . taxable , 'taxable' ) ,
923934 activeStatus : params . activeStatus ?? 'unchanged' ,
935+ requestId : isCreate ? optionalValue ( params . requestId ) : undefined ,
924936 }
925937 }
926938 return { credential : oauthCredentialValue }
0 commit comments