Skip to content

Commit

Permalink
fix(integration-templates): show the link only for the future upgrade…
Browse files Browse the repository at this point in the history
… not the current integration template (NangoHQ#2512)

## Describe your changes
- The link to the template should show for the upgrade template, not the
current one
- Improve validation error for create-invoice

## Issue ticket number and link
NAN-1428

## Checklist before requesting a review (skip if just adding/editing
APIs & templates)
- [ ] I added tests, otherwise the reason is: 
- [ ] I added observability, otherwise the reason is:
- [ ] I added analytics, otherwise the reason is:
  • Loading branch information
khaliqgant authored Jul 15, 2024
1 parent 19b584c commit 7cf49c4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 160 deletions.
5 changes: 5 additions & 0 deletions integration-templates/xero/actions/create-invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export default async function runAction(nango: NangoAction, input: CreateInvoice
const tenant_id = await getTenantId(nango);

// Validate the invoices:
if (!input || !input.length) {
throw new nango.ActionError<ActionErrorResponse>({
message: `You must pass an array of invoices! Received: ${JSON.stringify(input)}`
});
}

// 1) Contact is required
const invalidInvoices = input.filter((x: any) => !x.external_contact_id || x.fees.length === 0);
Expand Down
1 change: 1 addition & 0 deletions integration-templates/xero/nango.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ integrations:
scopes: accounting.transactions
output: InvoiceActionResponse
endpoint: POST /xero/invoices
version: 0.0.2
update-invoice:
description: |
Updates one or more invoices in Xero. To delete an invoice
Expand Down
151 changes: 0 additions & 151 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/shared/flows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3549,6 +3549,7 @@ integrations:
scopes: accounting.transactions
output: InvoiceActionResponse
endpoint: POST /xero/invoices
version: 0.0.2
update-invoice:
description: |
Updates one or more invoices in Xero. To delete an invoice
Expand Down
31 changes: 22 additions & 9 deletions packages/webapp/src/pages/Integration/FlowPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,19 +430,32 @@ export default function FlowPage(props: FlowPageProps) {
<div className="flex items-center">
<span className="ml-2 text-white">
Template version:{' '}
<a
className="underline"
rel="noreferrer"
href={`${githubIntegrationTemplates}/${integration.provider}/${flow.type}s/${flow.name}.ts`}
target="_blank"
>
v{flow.version || '0.0.1'}
</a>
{flow.upgrade_version ? (
<span>v{flow.version || '0.0.1'}</span>
) : (
<a
className="underline"
rel="noreferrer"
href={`${githubIntegrationTemplates}/${integration.provider}/${flow.type}s/${flow.name}.ts`}
target="_blank"
>
v{flow.version || '0.0.1'}
</a>
)}
</span>
{flow.upgrade_version ? (
<span className="flex items-center text-white mx-1">
{' '}
(latest: <span className="underline ml-1">v{flow.upgrade_version}</span>)
(latest:{' '}
<a
target="_blank"
href={`${githubIntegrationTemplates}/${integration.provider}/${flow.type}s/${flow.name}.ts`}
rel="noreferrer"
className="underline ml-1"
>
v{flow.upgrade_version}
</a>
)
<Button
variant="black"
onClick={() => onScriptUprade(flow)}
Expand Down

0 comments on commit 7cf49c4

Please sign in to comment.