this repo has no description
1import type { GenericPage } from '@jet-app/app-store/api/models';
2import type I18N from '@amp/web-apps-localization';
3import type { SeoData } from '@amp/web-app-components/src/components/MetaTags/types';
4
5import { isAppEventDetailShelf } from '~/components/jet/shelf/AppEventDetailShelf.svelte';
6import { truncateAroundLimit } from '~/utils/string-formatting';
7import { MAX_DESCRIPTION_LENGTH } from '~/utils/seo/common';
8
9export function seoDataForAppEventDetailPage(
10 page: GenericPage,
11 i18n: I18N,
12 language: string,
13): SeoData {
14 const appEventDetailShelf = page.shelves.find(isAppEventDetailShelf);
15
16 const { appEvent } = appEventDetailShelf?.items[0] || {};
17
18 if (!appEvent) {
19 return {};
20 }
21
22 const title = appEvent.title;
23 const description = truncateAroundLimit(
24 appEvent.detail,
25 MAX_DESCRIPTION_LENGTH,
26 language,
27 );
28
29 return {
30 pageTitle: title,
31 socialTitle: title,
32 appleTitle: title,
33 description,
34 socialDescription: description,
35 appleDescription: description,
36 crop: 'fo',
37 twitterCropCode: 'fo',
38 artworkUrl: appEvent?.moduleArtwork?.template,
39 imageAltTitle: i18n.t('ASE.Web.AppStore.Meta.Image.AltText', {
40 title: title,
41 }),
42 };
43}