From d0f69334c9be7ec2e7cae3c66dc1626b8ebdee09 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Dec 2024 16:37:25 +0000 Subject: [PATCH 01/11] generate link to action network api page settings from group slug and only show api key field once this link has been generated --- .../connect/[externalDataSourceType]/page.tsx | 66 ++++++++++--------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx index e4c183ac2..17a0d3206 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx @@ -982,8 +982,13 @@ export default function Page({ ) } - if (externalDataSourceType === 'actionnetwork') { + const groupSlug = form.watch('actionnetwork.groupSlug') + const actionNetworkApiUrl = groupSlug + ? `${groupSlug.replace(/\/manage$/, '')}/apis` + : '' + const showApiKeyField = !!groupSlug + return (
@@ -992,7 +997,7 @@ export default function Page({

In order to send data across to your Action Network instance, we - {"'"}ll need a few details that gives us permission to make updates + {"'"}ll need a few details that give us permission to make updates to your members.

@@ -1024,33 +1029,35 @@ export default function Page({ )} /> - ( - - Action Network API key - - {/* @ts-ignore */} - - - - Your API keys and sync features can be managed from the{' '} - {'"'}API & Sync{'"'} link available in the {'"'}Start - Organizing{'"'} menu. - - Read more. - - - - - )} - /> - + {groupSlug && ( +

+ Use the following link to access your API key settings: + + {actionNetworkApiUrl} + +

+ )} + {showApiKeyField && ( + ( + + Action Network API key + + {/* @ts-ignore */} + + + + + )} + /> + )}
diff --git a/nextjs/src/components/UpdateMappingForm.tsx b/nextjs/src/components/UpdateMappingForm.tsx index 91cbdab4c..3f5064097 100644 --- a/nextjs/src/components/UpdateMappingForm.tsx +++ b/nextjs/src/components/UpdateMappingForm.tsx @@ -33,6 +33,7 @@ import { } from '@/components/ui/select' import { locationTypeOptions } from '@/lib/location' import { currentOrganisationIdAtom } from '@/lib/organisation' +import { capitalizeWords } from '@/lib/utils' import { DataSourceFieldLabel } from './DataSourceIcon' @@ -329,8 +330,8 @@ export function UpdateMappingForm({ size="sm" className="my-2" > - Add data to another field in your - CRM + Add data to another field in your{' '} + {capitalizeWords(crmType || 'CRM')}{' '} )} From ebae1a43ffd19513ce6f11c501e0dfce2895383b Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Dec 2024 18:42:31 +0000 Subject: [PATCH 04/11] two more instances of update CRM to specific data source name when we have it --- .../create/connect/[externalDataSourceType]/page.tsx | 6 ++++-- .../[externalDataSourceId]/InspectExternalDataSource.tsx | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx index 17a0d3206..12bf3cf3a 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx @@ -47,6 +47,7 @@ import { import { locationTypeOptions } from '@/lib/location' import { currentOrganisationIdAtom } from '@/lib/organisation' import { toastPromise } from '@/lib/toast' +import { capitalizeWords } from '@/lib/utils' import { CreateAutoUpdateFormContext } from '../../NewExternalDataSourceWrapper' @@ -734,8 +735,9 @@ export default function Page({

Testing connection...

- Please wait whilst we try to connect to your CRM using the information - you provided + Please wait whilst we try to connect to your{' '} + {capitalizeWords(externalDataSourceType || 'CRM')} using the + information you provided

diff --git a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx index 948381d34..f29b7cceb 100644 --- a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx @@ -49,6 +49,7 @@ import { externalDataSourceOptions } from '@/lib/data' import { UPDATE_EXTERNAL_DATA_SOURCE } from '@/lib/graphql/mutations' import { contentEditableMutation } from '@/lib/html' import { currentOrganisationIdAtom } from '@/lib/organisation' +import { capitalizeWords } from '@/lib/utils' import { ManageSourceSharing } from './ManageSourceSharing' import importData from './importData' @@ -334,7 +335,8 @@ export default function InspectExternalDataSource({

Turn this switch on once you have added the above - Webhook URL to your CRM: + Webhook URL to your{' '} + {capitalizeWords(source.crmType || 'CRM')}

Date: Wed, 4 Dec 2024 16:25:48 +0000 Subject: [PATCH 05/11] update capitalise words function with format CRM function - using switch statement to account for CRM names that are one word strings --- .../configure/[externalDataSourceId]/page.tsx | 4 ++-- .../connect/[externalDataSourceType]/page.tsx | 4 ++-- .../review/[externalDataSourceId]/page.tsx | 4 ++-- .../InspectExternalDataSource.tsx | 4 ++-- nextjs/src/components/UpdateMappingForm.tsx | 4 ++-- nextjs/src/lib/utils.ts | 21 +++++++++++++------ 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx index af9c295f7..aeb37123c 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx @@ -17,7 +17,7 @@ import { Button } from '@/components/ui/button' import { LoadingIcon } from '@/components/ui/loadingIcon' import { UPDATE_EXTERNAL_DATA_SOURCE } from '@/lib/graphql/mutations' import { triggerAnalyticsEvent } from '@/lib/posthogutils' -import { capitalizeWords } from '@/lib/utils' +import { formatCrmNames } from '@/lib/utils' import { CreateAutoUpdateFormContext } from '../../NewExternalDataSourceWrapper' @@ -137,7 +137,7 @@ export default function Page({

Choose from the following data sources to enhance your{' '} - {capitalizeWords( + {formatCrmNames( externalDataSource.data?.externalDataSource.crmType || 'CRM' )}{' '} with data that empowers your organisation. For geographic data, we diff --git a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx index 12bf3cf3a..398444087 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx @@ -47,7 +47,7 @@ import { import { locationTypeOptions } from '@/lib/location' import { currentOrganisationIdAtom } from '@/lib/organisation' import { toastPromise } from '@/lib/toast' -import { capitalizeWords } from '@/lib/utils' +import { formatCrmNames } from '@/lib/utils' import { CreateAutoUpdateFormContext } from '../../NewExternalDataSourceWrapper' @@ -736,7 +736,7 @@ export default function Page({

Testing connection...

Please wait whilst we try to connect to your{' '} - {capitalizeWords(externalDataSourceType || 'CRM')} using the + {formatCrmNames(externalDataSourceType || 'CRM')} using the information you provided

diff --git a/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx index 92811d2ed..d5a4076e4 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx @@ -16,7 +16,7 @@ import { } from '@/components/ExternalDataSourceCard' import { Button } from '@/components/ui/button' import { LoadingIcon } from '@/components/ui/loadingIcon' -import { capitalizeWords } from '@/lib/utils' +import { formatCrmNames } from '@/lib/utils' import { CreateAutoUpdateFormContext } from '../../NewExternalDataSourceWrapper' @@ -111,7 +111,7 @@ export default function Page({

Turn the below switches on once you have added the above Webhook URL to your{' '} - {capitalizeWords( + {formatCrmNames( pageQuery.data?.externalDataSource.crmType || 'CRM' )}{' '} and enabled it. diff --git a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx index f29b7cceb..eaaaaef0f 100644 --- a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx @@ -49,7 +49,7 @@ import { externalDataSourceOptions } from '@/lib/data' import { UPDATE_EXTERNAL_DATA_SOURCE } from '@/lib/graphql/mutations' import { contentEditableMutation } from '@/lib/html' import { currentOrganisationIdAtom } from '@/lib/organisation' -import { capitalizeWords } from '@/lib/utils' +import { formatCrmNames } from '@/lib/utils' import { ManageSourceSharing } from './ManageSourceSharing' import importData from './importData' @@ -336,7 +336,7 @@ export default function InspectExternalDataSource({

Turn this switch on once you have added the above Webhook URL to your{' '} - {capitalizeWords(source.crmType || 'CRM')} + {formatCrmNames(source.crmType || 'CRM')}

Add data to another field in your{' '} - {capitalizeWords(crmType || 'CRM')}{' '} + {formatCrmNames(crmType || 'CRM')}{' '} )} diff --git a/nextjs/src/lib/utils.ts b/nextjs/src/lib/utils.ts index a1eea3c74..6fc92d691 100644 --- a/nextjs/src/lib/utils.ts +++ b/nextjs/src/lib/utils.ts @@ -4,10 +4,19 @@ import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } - -export function capitalizeWords(input: string): string { - return input - .split(' ') - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(' ') +export function formatCrmNames(input: string): string { + switch (input.toLowerCase()) { + case 'actionnetwork': + return 'Action Network' + case 'editablegooglesheets': + return 'Editable Google Sheets' + case 'tickettailor': + return 'Ticket Tailor' + case 'airtable': + return 'Airtable' + case 'mailchimp': + return 'Mailchimp' + default: + return 'CRM' + } } From ed63da991be58506f8654e3c841c73cd196cd5c6 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 4 Dec 2024 16:44:45 +0000 Subject: [PATCH 06/11] correct the actionNetworkApiUrl link --- .../create/connect/[externalDataSourceType]/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx index 398444087..23b63b3ab 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/connect/[externalDataSourceType]/page.tsx @@ -987,7 +987,7 @@ export default function Page({ if (externalDataSourceType === 'actionnetwork') { const groupSlug = form.watch('actionnetwork.groupSlug') const actionNetworkApiUrl = groupSlug - ? `${groupSlug.replace(/\/manage$/, '')}/apis` + ? `https://actionnetwork.org/groups/${groupSlug}/apis` : '' const showApiKeyField = !!groupSlug From 042e7181c08d67150ecaf3e3989e5ae3b0b026dd Mon Sep 17 00:00:00 2001 From: root Date: Wed, 4 Dec 2024 16:53:43 +0000 Subject: [PATCH 07/11] change data layers to data sources in new external data onboarding --- .../data-sources/create/NewExternalDataSourceWrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextjs/src/app/(logged-in)/data-sources/create/NewExternalDataSourceWrapper.tsx b/nextjs/src/app/(logged-in)/data-sources/create/NewExternalDataSourceWrapper.tsx index 8d5fa8195..e1f95782e 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/NewExternalDataSourceWrapper.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/NewExternalDataSourceWrapper.tsx @@ -54,7 +54,7 @@ export default function NewExternalDataSourceWrapper({ step > 3 ? 'completed' : step === 3 ? 'active' : 'disabled' } > - Select data layers + Select data sources Activate sync From b435c784b2d3aeb24aa31856979ac258a50d5ec8 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 4 Dec 2024 17:12:41 +0000 Subject: [PATCH 08/11] put specific CRM name into trigger update button --- .../InspectExternalDataSource.tsx | 11 +++++++---- nextjs/src/components/ExternalDataSourceCard.tsx | 8 ++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx index eaaaaef0f..52a5b3313 100644 --- a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx @@ -436,7 +436,10 @@ export default function InspectExternalDataSource({

{!source.isUpdateScheduled ? ( - + ) : ( <> Date: Mon, 9 Dec 2024 11:48:13 +0000 Subject: [PATCH 11/11] update default text from CRM to database --- .../create/configure/[externalDataSourceId]/page.tsx | 2 +- .../create/review/[externalDataSourceId]/page.tsx | 2 +- .../[externalDataSourceId]/InspectExternalDataSource.tsx | 8 ++++---- nextjs/src/components/ExternalDataSourceCard.tsx | 4 ++-- nextjs/src/components/SelectSourceData.tsx | 2 +- nextjs/src/components/UpdateMappingForm.tsx | 2 +- nextjs/src/lib/utils.ts | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx index aeb37123c..4363735c4 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/configure/[externalDataSourceId]/page.tsx @@ -138,7 +138,7 @@ export default function Page({

Choose from the following data sources to enhance your{' '} {formatCrmNames( - externalDataSource.data?.externalDataSource.crmType || 'CRM' + externalDataSource.data?.externalDataSource.crmType || 'database' )}{' '} with data that empowers your organisation. For geographic data, we need to know which field has the postcode so we can make sure you are diff --git a/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx b/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx index d5a4076e4..4d0c74481 100644 --- a/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/create/review/[externalDataSourceId]/page.tsx @@ -112,7 +112,7 @@ export default function Page({ Turn the below switches on once you have added the above Webhook URL to your{' '} {formatCrmNames( - pageQuery.data?.externalDataSource.crmType || 'CRM' + pageQuery.data?.externalDataSource.crmType || 'database' )}{' '} and enabled it.

diff --git a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx index a88d9cee5..fbc7ea36c 100644 --- a/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx +++ b/nextjs/src/app/(logged-in)/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx @@ -337,7 +337,7 @@ export default function InspectExternalDataSource({

Turn this switch on once you have added the above Webhook URL to your{' '} - {formatCrmNames(source.crmType || 'CRM')} + {formatCrmNames(source.crmType || 'database')}

Enrich your original data

- Pull Mapped data into your{' '} - {crmInfo?.name || 'data source'} based on each record + Pull Mapped data into your {crmInfo?.name || 'database'}{' '} + based on each record {"'"}s

Turn this switch on once you have added the above - Webhook URL to your CRM: + Webhook URL to your database:

Trigger a full update This will update all records in the{' '} - {formatCrmNames(crmType || 'CRM')}. Depending on your{' '} - {formatCrmNames(crmType || 'CRM')} this may take a while. + {formatCrmNames(crmType || 'database')}. Depending on your{' '} + {formatCrmNames(crmType || 'database')} this may take a while. diff --git a/nextjs/src/components/SelectSourceData.tsx b/nextjs/src/components/SelectSourceData.tsx index 3a0d9c2c8..00cd18500 100644 --- a/nextjs/src/components/SelectSourceData.tsx +++ b/nextjs/src/components/SelectSourceData.tsx @@ -105,7 +105,7 @@ export function SourcePathSelector({ Data sources Pick a data source and a field to import to your{' '} - {formatCrmNames(crmType || 'CRM')} + {formatCrmNames(crmType || 'database')} {loading ? ( diff --git a/nextjs/src/components/UpdateMappingForm.tsx b/nextjs/src/components/UpdateMappingForm.tsx index 9579a1a60..fbbaee7e3 100644 --- a/nextjs/src/components/UpdateMappingForm.tsx +++ b/nextjs/src/components/UpdateMappingForm.tsx @@ -332,7 +332,7 @@ export function UpdateMappingForm({ className="my-2" > Add data to another field in your{' '} - {formatCrmNames(crmType || 'CRM')}{' '} + {formatCrmNames(crmType || 'database')}{' '} )} diff --git a/nextjs/src/lib/utils.ts b/nextjs/src/lib/utils.ts index 6fc92d691..a4af4ceba 100644 --- a/nextjs/src/lib/utils.ts +++ b/nextjs/src/lib/utils.ts @@ -17,6 +17,6 @@ export function formatCrmNames(input: string): string { case 'mailchimp': return 'Mailchimp' default: - return 'CRM' + return 'database' } }