Skip to content

Commit

Permalink
fix: Update handling of twilio sendgrid config
Browse files Browse the repository at this point in the history
  • Loading branch information
devcshort committed Oct 7, 2024
1 parent 8736782 commit 0160d18
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion bin/createAppFromStrapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const query = qs.stringify({
'dataProviders',
'dataProviders.logo',
'radiusSelectValues',
'sms',
'localizations',
'localizations.logo',
'localizations.favicon',
Expand Down Expand Up @@ -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: {
Expand All @@ -152,6 +153,7 @@ module.exports = function createFromStrapi(dir) {
},
categories: [],
suggestions: [],
sms: appConfig?.sms,
};

translationFile['en']['search.hero_title'] = appConfig.search.homePageTitle;
Expand Down
5 changes: 3 additions & 2 deletions src/shared/components/share-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/sms-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
4 changes: 2 additions & 2 deletions src/shared/context/app-config-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ type AppConfig = {
href?: string;
logo?: string;
}[];
features?: {
sms: any;
sms?: {
provider: 'Twilio';
}[];
};

Expand Down

0 comments on commit 0160d18

Please sign in to comment.