@getvitops/astro 6.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,154 +1,10 @@
1
1
  ---
2
- export interface OpeningHoursSpecification {
3
- dayOfWeek: ('Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday')[];
4
- opens: string;
5
- closes: string;
6
- validFrom?: string;
7
- validThrough?: string;
8
- }
2
+ import { localBusinessGraph } from '@getvitops/utils/schema';
3
+ import type { LocalBusinessGraphOptions } from '@getvitops/utils/schema';
9
4
 
10
- export interface Props {
11
- type?: 'LocalBusiness' | 'Restaurant' | 'Store' | 'MedicalBusiness' | 'FinancialService' | 'FoodEstablishment' | 'HealthAndBeautyBusiness' | 'HomeAndConstructionBusiness' | 'LegalService' | 'LodgingBusiness' | 'ProfessionalService' | 'SportsActivityLocation';
12
- name: string;
13
- description?: string;
14
- url?: string;
15
- telephone?: string;
16
- email?: string;
17
- image?: string | string[];
18
- priceRange?: string;
19
- address: {
20
- streetAddress: string;
21
- addressLocality: string;
22
- addressRegion?: string;
23
- postalCode: string;
24
- addressCountry: string;
25
- };
26
- geo?: {
27
- latitude: number;
28
- longitude: number;
29
- };
30
- openingHoursSpecification?: OpeningHoursSpecification[];
31
- aggregateRating?: {
32
- ratingValue: number;
33
- reviewCount?: number;
34
- ratingCount?: number;
35
- bestRating?: number;
36
- worstRating?: number;
37
- };
38
- review?: {
39
- author: string;
40
- datePublished: string;
41
- reviewBody: string;
42
- reviewRating?: {
43
- ratingValue: number;
44
- bestRating?: number;
45
- worstRating?: number;
46
- };
47
- }[];
48
- servesCuisine?: string[];
49
- menu?: string;
50
- acceptsReservations?: boolean;
51
- hasMenu?: string;
52
- paymentAccepted?: string[];
53
- currenciesAccepted?: string;
54
- areaServed?: string[];
55
- sameAs?: string[];
56
- }
5
+ export type Props = LocalBusinessGraphOptions;
57
6
 
58
- const {
59
- type = 'LocalBusiness',
60
- name,
61
- description,
62
- url,
63
- telephone,
64
- email,
65
- image,
66
- priceRange,
67
- address,
68
- geo,
69
- openingHoursSpecification,
70
- aggregateRating,
71
- review,
72
- servesCuisine,
73
- menu,
74
- acceptsReservations,
75
- hasMenu,
76
- paymentAccepted,
77
- currenciesAccepted,
78
- areaServed,
79
- sameAs,
80
- } = Astro.props;
81
-
82
- const jsonLd = {
83
- '@context': 'https://schema.org',
84
- '@type': type,
85
- name,
86
- ...(description && { description }),
87
- ...(url && { url }),
88
- ...(telephone && { telephone }),
89
- ...(email && { email }),
90
- ...(image && { image: Array.isArray(image) ? image : [image] }),
91
- ...(priceRange && { priceRange }),
92
- address: {
93
- '@type': 'PostalAddress',
94
- streetAddress: address.streetAddress,
95
- addressLocality: address.addressLocality,
96
- ...(address.addressRegion && { addressRegion: address.addressRegion }),
97
- postalCode: address.postalCode,
98
- addressCountry: address.addressCountry,
99
- },
100
- ...(geo?.latitude != null && geo?.longitude != null && {
101
- geo: {
102
- '@type': 'GeoCoordinates',
103
- latitude: geo.latitude,
104
- longitude: geo.longitude,
105
- },
106
- }),
107
- ...(openingHoursSpecification && {
108
- openingHoursSpecification: openingHoursSpecification.map(spec => ({
109
- '@type': 'OpeningHoursSpecification',
110
- dayOfWeek: spec.dayOfWeek,
111
- opens: spec.opens,
112
- closes: spec.closes,
113
- ...(spec.validFrom && { validFrom: spec.validFrom }),
114
- ...(spec.validThrough && { validThrough: spec.validThrough }),
115
- })),
116
- }),
117
- ...(aggregateRating && {
118
- aggregateRating: {
119
- '@type': 'AggregateRating',
120
- ratingValue: aggregateRating.ratingValue,
121
- ...(aggregateRating.reviewCount && { reviewCount: aggregateRating.reviewCount }),
122
- ...(aggregateRating.ratingCount && { ratingCount: aggregateRating.ratingCount }),
123
- bestRating: aggregateRating.bestRating ?? 5,
124
- worstRating: aggregateRating.worstRating ?? 1,
125
- },
126
- }),
127
- ...(review && {
128
- review: review.map(r => ({
129
- '@type': 'Review',
130
- author: { '@type': 'Person', name: r.author },
131
- datePublished: r.datePublished,
132
- reviewBody: r.reviewBody,
133
- ...(r.reviewRating && {
134
- reviewRating: {
135
- '@type': 'Rating',
136
- ratingValue: r.reviewRating.ratingValue,
137
- bestRating: r.reviewRating.bestRating ?? 5,
138
- worstRating: r.reviewRating.worstRating ?? 1,
139
- },
140
- }),
141
- })),
142
- }),
143
- ...(servesCuisine && { servesCuisine }),
144
- ...(menu && { menu }),
145
- ...(acceptsReservations !== undefined && { acceptsReservations }),
146
- ...(hasMenu && { hasMenu }),
147
- ...(paymentAccepted && { paymentAccepted }),
148
- ...(currenciesAccepted && { currenciesAccepted }),
149
- ...(areaServed && { areaServed }),
150
- ...(sameAs && { sameAs }),
151
- };
7
+ const jsonLd = localBusinessGraph(Astro.props);
152
8
  ---
153
9
 
154
10
  <script is:inline type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
@@ -1,6 +1,6 @@
1
1
  ---
2
- import { organizationGraph } from '@getvitops/utils';
3
- import type { OrganizationGraphOptions } from '@getvitops/utils';
2
+ import { organizationGraph } from '@getvitops/utils/schema';
3
+ import type { OrganizationGraphOptions } from '@getvitops/utils/schema';
4
4
 
5
5
  export type Props = OrganizationGraphOptions;
6
6
 
@@ -1,5 +1,8 @@
1
1
  // Ad conversion tracking: capture click IDs from the landing URL, track tel:
2
- // clicks. Form enhancement is in form-enhance.ts.
2
+ // clicks. Form submission itself goes through `createConversionRoute()`
3
+ // (`@getvitops/astro/routes`), which handles both the no-JS `<form
4
+ // method="post">` path and a fetch-based one — there is no separate
5
+ // form-enhancement script here.
3
6
  //
4
7
  // Runs early and ungated on purpose. Reading the query string is not storage and
5
8
  // needs nobody's permission; *keeping* it does. So the capture is synchronous —
@@ -100,7 +103,6 @@ function persist(): void {
100
103
  ts: existing?.['ts'] ?? Date.now(),
101
104
  };
102
105
 
103
- // Remove undefined values before serializing
104
106
  const clean = Object.fromEntries(Object.entries(merged).filter(([, v]) => v !== undefined));
105
107
 
106
108
  const expires = new Date(Date.now() + COOKIE_DAYS * 864e5).toUTCString();
package/virtual.d.ts CHANGED
@@ -1,14 +1,3 @@
1
- /**
2
- * Astro generates the real types for `astro:env/*` into a consumer's
3
- * `.astro/` on `astro sync`, which never runs for this package — so the
4
- * import typechecks nowhere but a consumer project. Declared here at the
5
- * shape `plan-features.ts` actually uses; the runtime value comes from
6
- * Astro's env schema, and this file cannot import it.
7
- */
8
- declare module 'astro:env/server' {
9
- export const SITE_PLAN: string | undefined;
10
- }
11
-
12
1
  /** Types for the virtual module the getvitops() integration provides to <Head />. */
13
2
  declare module 'virtual:getvitops/head' {
14
3
  interface FaviconLink {