@antlur/backstage 1.12.16 → 1.13.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.
Files changed (67) hide show
  1. package/dist/cli/actions/sync-blocks.d.ts.map +1 -1
  2. package/dist/cli/actions/sync-blocks.js +1 -0
  3. package/dist/cli/cli.js +0 -0
  4. package/dist/client.d.ts +6 -0
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/client.js +9 -0
  7. package/dist/endpoints/blocks.d.ts +5 -3
  8. package/dist/endpoints/blocks.d.ts.map +1 -1
  9. package/dist/endpoints/frontstage.d.ts +9 -0
  10. package/dist/endpoints/frontstage.d.ts.map +1 -0
  11. package/dist/endpoints/frontstage.js +32 -0
  12. package/dist/endpoints/layouts.d.ts +5 -3
  13. package/dist/endpoints/layouts.d.ts.map +1 -1
  14. package/dist/endpoints/modules.d.ts +7 -0
  15. package/dist/endpoints/modules.d.ts.map +1 -0
  16. package/dist/endpoints/modules.js +11 -0
  17. package/dist/endpoints/reviews.d.ts +18 -0
  18. package/dist/endpoints/reviews.d.ts.map +1 -0
  19. package/dist/endpoints/reviews.js +30 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +3 -0
  23. package/dist/studio/define-block.d.ts +2 -0
  24. package/dist/studio/define-block.d.ts.map +1 -1
  25. package/dist/studio/types/block.d.ts +9 -0
  26. package/dist/studio/types/block.d.ts.map +1 -1
  27. package/dist/types/account-block.d.ts +17 -1
  28. package/dist/types/account-block.d.ts.map +1 -1
  29. package/dist/types/account-layout.d.ts +29 -9
  30. package/dist/types/account-layout.d.ts.map +1 -1
  31. package/dist/types/account-module.d.ts +26 -0
  32. package/dist/types/account-module.d.ts.map +1 -0
  33. package/dist/types/account-module.js +12 -0
  34. package/dist/types/frontstage.d.ts +213 -0
  35. package/dist/types/frontstage.d.ts.map +1 -0
  36. package/dist/types/frontstage.js +1 -0
  37. package/dist/types/index.d.ts +4 -0
  38. package/dist/types/index.d.ts.map +1 -1
  39. package/dist/types/index.js +1 -1
  40. package/dist/types/location.d.ts +1 -0
  41. package/dist/types/location.d.ts.map +1 -1
  42. package/dist/types/review.d.ts +17 -0
  43. package/dist/types/review.d.ts.map +1 -0
  44. package/dist/types/review.js +1 -0
  45. package/dist/util/special-hours.d.ts +1 -1
  46. package/dist/util/special-hours.d.ts.map +1 -1
  47. package/dist/util/special-hours.js +8 -7
  48. package/package.json +1 -1
  49. package/readme.md +14 -0
  50. package/src/cli/actions/sync-blocks.ts +1 -0
  51. package/src/client.ts +9 -0
  52. package/src/endpoints/blocks.ts +5 -3
  53. package/src/endpoints/frontstage.ts +50 -0
  54. package/src/endpoints/layouts.ts +5 -3
  55. package/src/endpoints/modules.ts +14 -0
  56. package/src/endpoints/reviews.ts +57 -0
  57. package/src/index.ts +3 -0
  58. package/src/studio/define-block.ts +2 -0
  59. package/src/studio/types/block.ts +10 -0
  60. package/src/types/account-block.ts +22 -1
  61. package/src/types/account-layout.ts +32 -9
  62. package/src/types/account-module.ts +38 -0
  63. package/src/types/frontstage.ts +254 -0
  64. package/src/types/index.ts +4 -0
  65. package/src/types/location.ts +1 -0
  66. package/src/types/review.ts +16 -0
  67. package/src/util/special-hours.ts +10 -6
@@ -0,0 +1,213 @@
1
+ export type FrontstageContractVersion = "2026-05-frontstage-v1";
2
+ export interface FrontstageImage {
3
+ url: string;
4
+ alt?: string;
5
+ width?: number;
6
+ height?: number;
7
+ }
8
+ export interface FrontstageNavItem {
9
+ label: string;
10
+ href: string;
11
+ variant?: "link" | "button";
12
+ }
13
+ export type FrontstageThemePreset = "classic-restaurant" | "premium-hospitality" | "fast-casual" | (string & {});
14
+ export type FrontstageAlertType = "banner" | "popup";
15
+ export type FrontstageAlertPosition = "top" | "bottom" | "center" | "bottom-right";
16
+ export interface FrontstageHourRow {
17
+ label: string;
18
+ value: string;
19
+ }
20
+ export interface FrontstageSpecialHour {
21
+ id?: string;
22
+ date: string;
23
+ label: string;
24
+ title?: string;
25
+ value?: string;
26
+ notes?: string;
27
+ }
28
+ export interface FrontstageAlert {
29
+ id: string;
30
+ title: string;
31
+ type: FrontstageAlertType;
32
+ position?: FrontstageAlertPosition;
33
+ dismissible: boolean;
34
+ content?: string;
35
+ media?: FrontstageImage;
36
+ cta?: {
37
+ label: string;
38
+ href: string;
39
+ };
40
+ analytics?: {
41
+ name?: string;
42
+ category?: string;
43
+ label?: string;
44
+ };
45
+ }
46
+ export interface FrontstageBlock<TProps = Record<string, unknown>> {
47
+ id: string;
48
+ type: FrontstageStandardBlockType | string;
49
+ variant?: string;
50
+ props: TProps;
51
+ }
52
+ export type FrontstageStandardBlockType = "hero" | "content" | "feature-grid" | "gallery" | "media-feature" | "menu-preview" | "menu-section" | "locations" | "hours" | "ordering" | "cta" | "events" | "event-spotlight" | "private-events" | "contact-form" | "testimonials" | "press" | "awards" | "reviews" | "newsletter" | "faq" | "html-embed";
53
+ export type FrontstageStandardBlockVariant = "default" | "full-bleed-image" | "background-video" | "image-collage" | "masonry" | "carousel" | "editorial-strip" | "mixed-media" | "full-width" | "inline";
54
+ export interface FrontstageTheme {
55
+ preset?: FrontstageThemePreset;
56
+ colors: {
57
+ background: string;
58
+ foreground: string;
59
+ primary: string;
60
+ primaryForeground: string;
61
+ muted: string;
62
+ mutedForeground: string;
63
+ border: string;
64
+ secondary?: string;
65
+ secondaryForeground?: string;
66
+ accent?: string;
67
+ accentForeground?: string;
68
+ topbar?: string;
69
+ topbarForeground?: string;
70
+ };
71
+ fonts: {
72
+ heading: FrontstageFont;
73
+ body: FrontstageFont;
74
+ };
75
+ radius: string;
76
+ layout: {
77
+ container: "narrow" | "default" | "wide" | "full";
78
+ header: "default" | "centered-logo" | "split-nav" | "minimal";
79
+ footer: "simple" | "multi-column" | "location-heavy";
80
+ };
81
+ }
82
+ export interface FrontstageFont {
83
+ source: "system" | "google" | "custom";
84
+ name: string;
85
+ family: string;
86
+ }
87
+ export interface FrontstageSiteResponse {
88
+ contractVersion: FrontstageContractVersion;
89
+ site: {
90
+ id: string;
91
+ accountId: string;
92
+ name: string;
93
+ baseUrl: string;
94
+ locale: string;
95
+ timezone: string;
96
+ description?: string | null;
97
+ status: "draft" | "published" | "archived";
98
+ };
99
+ brand: {
100
+ logo?: FrontstageImage;
101
+ favicon?: {
102
+ url: string;
103
+ };
104
+ social?: Record<string, string>;
105
+ };
106
+ contact?: {
107
+ address?: string;
108
+ mapUrl?: string;
109
+ phone?: string;
110
+ email?: string;
111
+ neighborhood?: string;
112
+ hours?: FrontstageHourRow[];
113
+ specialHours?: FrontstageSpecialHour[];
114
+ };
115
+ theme: FrontstageTheme;
116
+ navigation: {
117
+ primary: FrontstageNavItem[];
118
+ footer: FrontstageNavItem[];
119
+ };
120
+ alerts?: FrontstageAlert[];
121
+ integrations?: {
122
+ analytics?: {
123
+ gtmId?: string;
124
+ };
125
+ ordering?: {
126
+ provider?: string;
127
+ url?: string;
128
+ };
129
+ reservations?: {
130
+ provider?: string;
131
+ url?: string;
132
+ };
133
+ };
134
+ }
135
+ export interface FrontstageResolvedLayout {
136
+ id: string | null;
137
+ name: string | null;
138
+ slug: string | null;
139
+ source?: "page" | "site" | "fallback" | "preview" | "override" | null;
140
+ theme?: Partial<FrontstageTheme["layout"]>;
141
+ navigation?: {
142
+ primary?: FrontstageNavItem[];
143
+ footer?: FrontstageNavItem[];
144
+ };
145
+ regions?: {
146
+ beforeHeader?: FrontstageBlock[];
147
+ afterHeader?: FrontstageBlock[];
148
+ beforeMain?: FrontstageBlock[];
149
+ afterMain?: FrontstageBlock[];
150
+ beforeFooter?: FrontstageBlock[];
151
+ footer?: FrontstageBlock[];
152
+ afterFooter?: FrontstageBlock[];
153
+ };
154
+ }
155
+ export interface FrontstageSeo {
156
+ title: string;
157
+ description?: string;
158
+ canonical?: string;
159
+ noindex?: boolean;
160
+ image?: FrontstageImage;
161
+ }
162
+ export interface FrontstagePageResponse {
163
+ contractVersion: FrontstageContractVersion;
164
+ page: {
165
+ id: string;
166
+ title: string;
167
+ slug: string;
168
+ status: "draft" | "published" | "archived";
169
+ seo: FrontstageSeo;
170
+ blocks: FrontstageBlock[];
171
+ layout?: FrontstageResolvedLayout;
172
+ alerts?: FrontstageAlert[];
173
+ };
174
+ }
175
+ export interface FrontstageRoute {
176
+ id?: string | null;
177
+ path: string;
178
+ slug?: string;
179
+ type?: string | null;
180
+ model?: string | null;
181
+ modelId?: string | null;
182
+ title?: string | null;
183
+ lastModified?: string | null;
184
+ changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
185
+ priority?: number;
186
+ }
187
+ export interface FrontstageRoutesResponse {
188
+ routes: FrontstageRoute[];
189
+ }
190
+ export interface FrontstageBlockDefinition {
191
+ id: string;
192
+ name: string;
193
+ type: FrontstageStandardBlockType | string;
194
+ category: string;
195
+ description: string;
196
+ variants: FrontstageStandardBlockVariant[] | string[];
197
+ fields: unknown[];
198
+ frontstage?: {
199
+ enabled: boolean;
200
+ type: FrontstageStandardBlockType | string;
201
+ defaultVariant?: FrontstageStandardBlockVariant | string;
202
+ variants: FrontstageStandardBlockVariant[] | string[];
203
+ category: string;
204
+ };
205
+ }
206
+ export interface FrontstageBlocksResponse {
207
+ blocks: FrontstageBlockDefinition[];
208
+ }
209
+ export interface FrontstagePreviewParams {
210
+ preview?: boolean;
211
+ previewId?: string;
212
+ }
213
+ //# sourceMappingURL=frontstage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontstage.d.ts","sourceRoot":"","sources":["../../src/types/frontstage.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,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wBAAwB;IACvC,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,2BAA2B,GAAG,MAAM,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,8BAA8B,EAAE,GAAG,MAAM,EAAE,CAAC;IACtD,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE,2BAA2B,GAAG,MAAM,CAAC;QAC3C,cAAc,CAAC,EAAE,8BAA8B,GAAG,MAAM,CAAC;QACzD,QAAQ,EAAE,8BAA8B,EAAE,GAAG,MAAM,EAAE,CAAC;QACtD,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,yBAAyB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -5,6 +5,7 @@ export type * from "./api";
5
5
  export type * from "./blueprint";
6
6
  export type * from "./entry";
7
7
  export type * from "./event";
8
+ export type * from "./frontstage";
8
9
  export type * from "./instagram";
9
10
  export type * from "./location";
10
11
  export type * from "./media-item";
@@ -12,10 +13,13 @@ export type * from "./menu-category-item";
12
13
  export type * from "./menu-category";
13
14
  export type * from "./menu-item";
14
15
  export type * from "./menu";
16
+ export { AccountModules } from "./account-module";
17
+ export type * from "./account-module";
15
18
  export type * from "./navigation";
16
19
  export type * from "./page";
17
20
  export type * from "./press";
18
21
  export type * from "./redirect";
22
+ export type * from "./review";
19
23
  export type * from "./route";
20
24
  export type * from "./website";
21
25
  export type * from "../studio/types/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,OAAO,CAAC;AAC3B,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,WAAW,CAAC;AAE/B,mBAAmB,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,OAAO,CAAC;AAC3B,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,sBAAsB,CAAC;AAC1C,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,QAAQ,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,QAAQ,CAAC;AAC5B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,WAAW,CAAC;AAE/B,mBAAmB,0BAA0B,CAAC"}
@@ -1 +1 @@
1
- export {};
1
+ export { AccountModules } from "./account-module";
@@ -34,6 +34,7 @@ export interface Location {
34
34
  date: string;
35
35
  openTime: string;
36
36
  closeTime: string;
37
+ title?: string | null;
37
38
  open24Hours: boolean;
38
39
  closed24Hours: boolean;
39
40
  notes: string;
@@ -1 +1 @@
1
- {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../src/types/location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,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: number;
3
+ account_id: string;
4
+ location_id: string | null;
5
+ external_id: string;
6
+ source: string;
7
+ author_name: string;
8
+ author_avatar: string | null;
9
+ rating: number;
10
+ text: string | null;
11
+ url: string | null;
12
+ responded_at: string | null;
13
+ published_at: string | null;
14
+ created_at: string;
15
+ updated_at: string;
16
+ }
17
+ //# sourceMappingURL=review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/types/review.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,3 @@
1
1
  import type { Location } from "../types";
2
- export declare function getSpecialHoursFromLocation(location: Location): any[];
2
+ export declare function getSpecialHoursFromLocation(location: Location, noticeDays?: number): any[];
3
3
  //# sourceMappingURL=special-hours.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"special-hours.d.ts","sourceRoot":"","sources":["../../src/util/special-hours.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,EAAE,CAoBrE"}
1
+ {"version":3,"file":"special-hours.d.ts","sourceRoot":"","sources":["../../src/util/special-hours.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,CAwB1F"}
@@ -1,14 +1,15 @@
1
1
  import { DateTime } from "luxon";
2
- export function getSpecialHoursFromLocation(location) {
2
+ export function getSpecialHoursFromLocation(location, noticeDays) {
3
3
  if (!location.special_hours)
4
4
  return [];
5
- // filter out any special hours that are before today
6
- const now = DateTime.now().startOf("day");
7
- if (location.timezone)
8
- now.setZone(location.timezone);
5
+ const now = (location.timezone ? DateTime.now().setZone(location.timezone) : DateTime.now()).startOf("day");
6
+ const lastVisibleDate = typeof noticeDays === "number" ? now.plus({ days: Math.max(0, noticeDays) }) : null;
9
7
  const specialHours = location.special_hours.filter((specialHour) => {
10
- const specialHourDate = DateTime.fromISO(specialHour.date);
11
- return specialHourDate >= now;
8
+ const specialHourDate = DateTime.fromISO(specialHour.date, { zone: location.timezone || undefined }).startOf("day");
9
+ if (specialHourDate < now) {
10
+ return false;
11
+ }
12
+ return lastVisibleDate ? specialHourDate <= lastVisibleDate : true;
12
13
  });
13
14
  // sort by date
14
15
  specialHours.sort((a, b) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antlur/backstage",
3
3
  "author": "Anthony Holmes",
4
- "version": "1.12.16",
4
+ "version": "1.13.0",
5
5
  "description": "A simple client for Backstage CMS",
6
6
  "license": "MIT",
7
7
  "repository": {
package/readme.md CHANGED
@@ -8,6 +8,7 @@ A TypeScript client library for [Backstage CMS](https://bckstg.app) with type-sa
8
8
  - 🧱 Define custom blocks with full TypeScript support
9
9
  - 📐 Define custom layouts with schema validation
10
10
  - � Define custom blueprints (content types) with field schemas
11
+ - 🧩 Inspect account modules such as Site Builder, Custom Blocks, Events, and Press
11
12
  - 🔄 CLI tools for syncing blocks, blueprints, and layouts
12
13
  - ⚛️ React components for page metadata and structured data
13
14
  - 🎨 Framework-agnostic design (works with Next.js, React, etc.)
@@ -75,6 +76,9 @@ const event = await client.events.getEventBySlug("summer-festival");
75
76
 
76
77
  // Fetch menus
77
78
  const menu = await client.menus.getMenu("main-menu");
79
+
80
+ // Check account modules before using premium authoring APIs
81
+ const customBlocksEnabled = await client.modules.isEnabled("cms.custom_blocks");
78
82
  ```
79
83
 
80
84
  ## Defining Custom Blocks
@@ -161,10 +165,20 @@ export const heroBlock = defineBlock({
161
165
  slug: "hero",
162
166
  description: "A hero section with title, subtitle, and background image",
163
167
  schema,
168
+ // Optional: map this custom block onto a Frontstage renderer.
169
+ // Requires the account's Custom Blocks module in Backstage.
170
+ frontstage: {
171
+ enabled: true,
172
+ type: "hero",
173
+ defaultVariant: "full-bleed-image",
174
+ variants: ["full-bleed-image"],
175
+ },
164
176
  component: Hero,
165
177
  });
166
178
  ```
167
179
 
180
+ Custom block and custom layout authoring are advanced Backstage modules. The SDK can sync them when the account has `cms.custom_blocks` or `cms.custom_layouts` enabled; standard templated Frontstage sites can still use system-defined blocks and layouts without those modules.
181
+
168
182
  ## Defining Custom Blueprints
169
183
 
170
184
  Create content types (blueprints) with custom field schemas:
@@ -15,6 +15,7 @@ export async function syncBlocks(config: BackstageUserConfig) {
15
15
  slug: block.slug,
16
16
  description: block?.description,
17
17
  schema: block.schema,
18
+ frontstage: block.frontstage,
18
19
  };
19
20
 
20
21
  try {
package/src/client.ts CHANGED
@@ -6,15 +6,18 @@ import { BlueprintsService } from "./endpoints/blueprints.js";
6
6
  import { EntryService } from "./endpoints/entries.js";
7
7
  import { EventService } from "./endpoints/events.js";
8
8
  import { FormService } from "./endpoints/forms.js";
9
+ import { FrontstageService } from "./endpoints/frontstage.js";
9
10
  import { InstagramService } from "./endpoints/instagram.js";
10
11
  import { LayoutService } from "./endpoints/layouts.js";
11
12
  import { LocationService } from "./endpoints/locations.js";
12
13
  import { MenuService } from "./endpoints/menus.js";
13
14
  import { MenuItemService } from "./endpoints/menu-items.js";
15
+ import { ModulesService } from "./endpoints/modules.js";
14
16
  import { NavigationService } from "./endpoints/navigation.js";
15
17
  import { PageService } from "./endpoints/pages.js";
16
18
  import { PressService } from "./endpoints/press.js";
17
19
  import { RedirectService } from "./endpoints/redirects.js";
20
+ import { ReviewService } from "./endpoints/reviews.js";
18
21
  import { RouteService } from "./endpoints/routes.js";
19
22
  import { WebsiteService } from "./endpoints/website.js";
20
23
  import { MediaService } from "./endpoints/media.js";
@@ -33,16 +36,19 @@ export class BackstageClient {
33
36
  public readonly entries: EntryService;
34
37
  public readonly events: EventService;
35
38
  public readonly forms: FormService;
39
+ public readonly frontstage: FrontstageService;
36
40
  public readonly instagram: InstagramService;
37
41
  public readonly layouts: LayoutService;
38
42
  public readonly locations: LocationService;
39
43
  public readonly media: MediaService;
40
44
  public readonly menus: MenuService;
41
45
  public readonly menuItems: MenuItemService;
46
+ public readonly modules: ModulesService;
42
47
  public readonly navigation: NavigationService;
43
48
  public readonly pages: PageService;
44
49
  public readonly press: PressService;
45
50
  public readonly redirects: RedirectService;
51
+ public readonly reviews: ReviewService;
46
52
  public readonly routes: RouteService;
47
53
  public readonly website: WebsiteService;
48
54
 
@@ -77,16 +83,19 @@ export class BackstageClient {
77
83
  this.entries = new EntryService(this);
78
84
  this.events = new EventService(this);
79
85
  this.forms = new FormService(this);
86
+ this.frontstage = new FrontstageService(this);
80
87
  this.instagram = new InstagramService(this);
81
88
  this.layouts = new LayoutService(this);
82
89
  this.locations = new LocationService(this);
83
90
  this.media = new MediaService(this);
84
91
  this.menus = new MenuService(this);
85
92
  this.menuItems = new MenuItemService(this);
93
+ this.modules = new ModulesService(this);
86
94
  this.navigation = new NavigationService(this);
87
95
  this.pages = new PageService(this);
88
96
  this.press = new PressService(this);
89
97
  this.redirects = new RedirectService(this);
98
+ this.reviews = new ReviewService(this);
90
99
  this.routes = new RouteService(this);
91
100
  this.website = new WebsiteService(this);
92
101
  }
@@ -1,18 +1,20 @@
1
- import type { ApiCollectionResponse, ApiSingleResponse, AccountBlock } from "../types/index";
1
+ import type { AccountBlock, AccountBlockFrontstageConfig, AccountBlockSchema, ApiCollectionResponse, ApiSingleResponse } from "../types/index";
2
2
  import { BaseService } from "./base.js";
3
3
 
4
4
  export interface CreateBlockParams {
5
5
  name: string;
6
6
  slug: string;
7
- schema: any;
7
+ schema: AccountBlockSchema;
8
8
  description?: string;
9
+ frontstage?: AccountBlockFrontstageConfig | null;
9
10
  }
10
11
 
11
12
  export interface UpdateBlockParams {
12
13
  name?: string;
13
14
  slug?: string;
14
- schema?: any;
15
+ schema?: AccountBlockSchema;
15
16
  description?: string;
17
+ frontstage?: AccountBlockFrontstageConfig | null;
16
18
  }
17
19
 
18
20
  export class BlocksService extends BaseService {
@@ -0,0 +1,50 @@
1
+ import type {
2
+ FrontstageBlocksResponse,
3
+ FrontstagePageResponse,
4
+ FrontstagePreviewParams,
5
+ FrontstageRoutesResponse,
6
+ FrontstageSiteResponse,
7
+ } from "../types/index.js";
8
+ import { BaseService } from "./base.js";
9
+
10
+ function frontstageQuery(params?: FrontstagePreviewParams): string {
11
+ const query = new URLSearchParams();
12
+
13
+ if (params?.preview) {
14
+ query.set("preview", "true");
15
+ }
16
+
17
+ if (params?.previewId) {
18
+ query.set("previewId", params.previewId);
19
+ }
20
+
21
+ const serialized = query.toString();
22
+
23
+ return serialized ? `?${serialized}` : "";
24
+ }
25
+
26
+ function pagePath(slug?: string): string {
27
+ if (!slug || slug === "/") {
28
+ return "/frontstage/pages";
29
+ }
30
+
31
+ return `/frontstage/pages/${slug.replace(/^\/+/, "")}`;
32
+ }
33
+
34
+ export class FrontstageService extends BaseService {
35
+ async site(options?: RequestInit): Promise<FrontstageSiteResponse> {
36
+ return this.client.get<FrontstageSiteResponse>("/frontstage/site", options);
37
+ }
38
+
39
+ async page(slug?: string, params?: FrontstagePreviewParams, options?: RequestInit): Promise<FrontstagePageResponse> {
40
+ return this.client.get<FrontstagePageResponse>(`${pagePath(slug)}${frontstageQuery(params)}`, options);
41
+ }
42
+
43
+ async routes(options?: RequestInit): Promise<FrontstageRoutesResponse> {
44
+ return this.client.get<FrontstageRoutesResponse>("/frontstage/routes", options);
45
+ }
46
+
47
+ async blocks(options?: RequestInit): Promise<FrontstageBlocksResponse> {
48
+ return this.client.get<FrontstageBlocksResponse>("/frontstage/blocks", options);
49
+ }
50
+ }
@@ -1,16 +1,18 @@
1
- import type { ApiCollectionResponse, ApiSingleResponse, AccountLayout } from "../types/index";
1
+ import type { AccountLayout, AccountLayoutSchema, AccountLayoutValues, ApiCollectionResponse, ApiSingleResponse } from "../types/index";
2
2
  import { BaseService } from "./base.js";
3
3
 
4
4
  export interface CreateLayoutParams {
5
5
  name: string;
6
6
  slug: string;
7
- schema: any;
7
+ schema: AccountLayoutSchema;
8
+ values?: AccountLayoutValues;
8
9
  }
9
10
 
10
11
  export interface UpdateLayoutParams {
11
12
  name?: string;
12
13
  slug?: string;
13
- schema?: any;
14
+ schema?: AccountLayoutSchema;
15
+ values?: AccountLayoutValues;
14
16
  }
15
17
 
16
18
  export class LayoutService extends BaseService {
@@ -0,0 +1,14 @@
1
+ import type { AccountModule, AccountModuleKey, ApiCollectionResponse } from "../types/index";
2
+ import { BaseService } from "./base.js";
3
+
4
+ export class ModulesService extends BaseService {
5
+ async list(options?: RequestInit): Promise<AccountModule[]> {
6
+ const { data } = await this.client.get<ApiCollectionResponse<AccountModule>>("/modules", options);
7
+ return data;
8
+ }
9
+
10
+ async isEnabled(moduleKey: AccountModuleKey, options?: RequestInit): Promise<boolean> {
11
+ const modules = await this.list(options);
12
+ return modules.some((module) => module.key === moduleKey && module.enabled);
13
+ }
14
+ }
@@ -0,0 +1,57 @@
1
+ import type {
2
+ ApiCollectionResponse,
3
+ ApiSingleResponse,
4
+ Review,
5
+ } from "../types/index";
6
+ import { BaseService } from "./base.js";
7
+
8
+ export interface CreateReviewParams {
9
+ response_text: string;
10
+ }
11
+
12
+ export interface ReviewFilters {
13
+ source?: string;
14
+ location_id?: string;
15
+ }
16
+
17
+ export class ReviewService extends BaseService {
18
+ async getReviews(filters?: ReviewFilters, options?: RequestInit): Promise<Review[]> {
19
+ const query = new URLSearchParams();
20
+ if (filters?.source) query.append("source", filters.source);
21
+ if (filters?.location_id) query.append("location_id", filters.location_id);
22
+
23
+ const queryString = query.toString();
24
+ const url = queryString ? `/reviews?${queryString}` : "/reviews";
25
+
26
+ const { data } = await this.client.get<ApiCollectionResponse<Review>>(
27
+ url,
28
+ options
29
+ );
30
+ return data;
31
+ }
32
+
33
+ async getReview(id: string, options?: RequestInit): Promise<Review | null> {
34
+ try {
35
+ const { data } = await this.client.get<ApiSingleResponse<Review>>(
36
+ `/reviews/${id}`,
37
+ options
38
+ );
39
+ return data;
40
+ } catch {
41
+ return null;
42
+ }
43
+ }
44
+
45
+ async updateReview(id: string, params: CreateReviewParams, options?: RequestInit): Promise<Review> {
46
+ const { data } = await this.client.put<ApiSingleResponse<Review>>(
47
+ `/reviews/${id}`,
48
+ params,
49
+ options
50
+ );
51
+ return data;
52
+ }
53
+
54
+ async pullReviews(options?: RequestInit): Promise<{ message: string }> {
55
+ return this.client.post<{ message: string }>("/reviews/pull", {}, options);
56
+ }
57
+ }
package/src/index.ts CHANGED
@@ -12,16 +12,19 @@ export * from "./endpoints/blueprints.js";
12
12
  export * from "./endpoints/entries.js";
13
13
  export * from "./endpoints/events.js";
14
14
  export * from "./endpoints/forms.js";
15
+ export * from "./endpoints/frontstage.js";
15
16
  export * from "./endpoints/instagram.js";
16
17
  export * from "./endpoints/layouts.js";
17
18
  export * from "./endpoints/locations.js";
18
19
  export * from "./endpoints/media.js";
19
20
  export * from "./endpoints/menus.js";
20
21
  export * from "./endpoints/menu-items.js";
22
+ export * from "./endpoints/modules.js";
21
23
  export * from "./endpoints/navigation.js";
22
24
  export * from "./endpoints/pages.js";
23
25
  export * from "./endpoints/press.js";
24
26
  export * from "./endpoints/redirects.js";
27
+ export * from "./endpoints/reviews.js";
25
28
  export * from "./endpoints/routes.js";
26
29
  export * from "./endpoints/website.js";
27
30