From 0160d187743011031fb381d272d022f7942b3d90 Mon Sep 17 00:00:00 2001 From: devcshort <13677134+devcshort@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:53:26 -0700 Subject: [PATCH] fix: Update handling of twilio sendgrid config --- bin/createAppFromStrapi.js | 4 +++- src/shared/components/share-button.tsx | 5 +++-- src/shared/components/sms-button.tsx | 2 +- src/shared/context/app-config-context.ts | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/createAppFromStrapi.js b/bin/createAppFromStrapi.js index 36426ec9..2495d28a 100644 --- a/bin/createAppFromStrapi.js +++ b/bin/createAppFromStrapi.js @@ -35,6 +35,7 @@ const query = qs.stringify({ 'dataProviders', 'dataProviders.logo', 'radiusSelectValues', + 'sms', 'localizations', 'localizations.logo', 'localizations.favicon', @@ -138,7 +139,7 @@ module.exports = function createFromStrapi(dir) { zoom: 7, }, alert: appConfig?.alert, - theme: appConfig?.theme ?? null, + theme: appConfig?.theme, hideAttribution: appConfig?.hideAttribution ?? true, pages: {}, menus: { @@ -152,6 +153,7 @@ module.exports = function createFromStrapi(dir) { }, categories: [], suggestions: [], + sms: appConfig?.sms, }; translationFile['en']['search.hero_title'] = appConfig.search.homePageTitle; diff --git a/src/shared/components/share-button.tsx b/src/shared/components/share-button.tsx index 2d6d6935..3cab99d1 100644 --- a/src/shared/components/share-button.tsx +++ b/src/shared/components/share-button.tsx @@ -34,11 +34,12 @@ export function ShareButton({ componentToPrintRef, title, body }) { content: () => componentToPrintRef.current, }); const [shortUrl, setShortUrl] = useState(''); - const appConfig = useAppConfig(); useEffect(() => { async function getShortUrl() { - const { url } = await ShortUrlService.getOrCreateShortUrl(window.location.href); + const { url } = await ShortUrlService.getOrCreateShortUrl( + window.location.href, + ); setShortUrl(url); } diff --git a/src/shared/components/sms-button.tsx b/src/shared/components/sms-button.tsx index 5dd9f9a9..06a49270 100644 --- a/src/shared/components/sms-button.tsx +++ b/src/shared/components/sms-button.tsx @@ -38,7 +38,7 @@ export function SmsButton({ title, body, shortUrl }) { }; const handleClick = () => { - if (!('sms' in appConfig.features)) { + if (!('sms' in appConfig)) { const { userAgent } = navigator; const isIOS = /iPhone|iPad|iPod|Macintosh/i.test(userAgent); let smsLink = ''; diff --git a/src/shared/context/app-config-context.ts b/src/shared/context/app-config-context.ts index 5ef07812..182883a1 100644 --- a/src/shared/context/app-config-context.ts +++ b/src/shared/context/app-config-context.ts @@ -58,8 +58,8 @@ type AppConfig = { href?: string; logo?: string; }[]; - features?: { - sms: any; + sms?: { + provider: 'Twilio'; }[]; };