@contractspec/bundle.marketing 3.8.7 → 3.8.9

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 (76) hide show
  1. package/.turbo/turbo-build.log +64 -32
  2. package/CHANGELOG.md +63 -0
  3. package/dist/browser/components/templates/TemplateCard.js +83 -0
  4. package/dist/browser/components/templates/TemplateCommandDialog.js +110 -0
  5. package/dist/browser/components/templates/TemplatePreviewContent.js +96 -0
  6. package/dist/browser/components/templates/TemplatesBrowseControls.js +115 -0
  7. package/dist/browser/components/templates/TemplatesCatalogSection.js +284 -0
  8. package/dist/browser/components/templates/TemplatesClientPage.js +840 -917
  9. package/dist/browser/components/templates/TemplatesHeroSection.js +87 -0
  10. package/dist/browser/components/templates/TemplatesNextStepsSection.js +126 -0
  11. package/dist/browser/components/templates/TemplatesPreviewModal.js +136 -126
  12. package/dist/browser/components/templates/index.js +873 -950
  13. package/dist/browser/components/templates/template-catalog.js +81 -0
  14. package/dist/browser/components/templates/template-new.js +23 -0
  15. package/dist/browser/components/templates/template-preview.js +43 -0
  16. package/dist/browser/components/templates/template-source.js +19 -0
  17. package/dist/browser/index.js +873 -950
  18. package/dist/components/templates/TemplateCard.d.ts +12 -0
  19. package/dist/components/templates/TemplateCard.js +78 -0
  20. package/dist/components/templates/TemplateCommandDialog.d.ts +6 -0
  21. package/dist/components/templates/TemplateCommandDialog.js +105 -0
  22. package/dist/components/templates/TemplatePreviewContent.d.ts +5 -0
  23. package/dist/components/templates/TemplatePreviewContent.js +91 -0
  24. package/dist/components/templates/TemplatesBrowseControls.d.ts +13 -0
  25. package/dist/components/templates/TemplatesBrowseControls.js +110 -0
  26. package/dist/components/templates/TemplatesCatalogSection.d.ts +14 -0
  27. package/dist/components/templates/TemplatesCatalogSection.js +279 -0
  28. package/dist/components/templates/TemplatesClientPage.js +840 -917
  29. package/dist/components/templates/TemplatesHeroSection.d.ts +5 -0
  30. package/dist/components/templates/TemplatesHeroSection.js +82 -0
  31. package/dist/components/templates/TemplatesNextStepsSection.d.ts +1 -0
  32. package/dist/components/templates/TemplatesNextStepsSection.js +121 -0
  33. package/dist/components/templates/TemplatesPreviewModal.d.ts +3 -4
  34. package/dist/components/templates/TemplatesPreviewModal.js +136 -126
  35. package/dist/components/templates/index.js +873 -950
  36. package/dist/components/templates/template-catalog.d.ts +27 -0
  37. package/dist/components/templates/template-catalog.js +76 -0
  38. package/dist/components/templates/template-catalog.test.d.ts +1 -0
  39. package/dist/components/templates/template-new.d.ts +2 -0
  40. package/dist/components/templates/template-new.js +18 -0
  41. package/dist/components/templates/template-preview.d.ts +18 -0
  42. package/dist/components/templates/template-preview.js +38 -0
  43. package/dist/components/templates/template-source.d.ts +3 -0
  44. package/dist/components/templates/template-source.js +14 -0
  45. package/dist/index.js +873 -950
  46. package/dist/node/components/templates/TemplateCard.js +78 -0
  47. package/dist/node/components/templates/TemplateCommandDialog.js +105 -0
  48. package/dist/node/components/templates/TemplatePreviewContent.js +91 -0
  49. package/dist/node/components/templates/TemplatesBrowseControls.js +110 -0
  50. package/dist/node/components/templates/TemplatesCatalogSection.js +279 -0
  51. package/dist/node/components/templates/TemplatesClientPage.js +840 -917
  52. package/dist/node/components/templates/TemplatesHeroSection.js +82 -0
  53. package/dist/node/components/templates/TemplatesNextStepsSection.js +121 -0
  54. package/dist/node/components/templates/TemplatesPreviewModal.js +136 -126
  55. package/dist/node/components/templates/index.js +873 -950
  56. package/dist/node/components/templates/template-catalog.js +76 -0
  57. package/dist/node/components/templates/template-new.js +18 -0
  58. package/dist/node/components/templates/template-preview.js +38 -0
  59. package/dist/node/components/templates/template-source.js +14 -0
  60. package/dist/node/index.js +873 -950
  61. package/package.json +185 -30
  62. package/src/components/templates/TemplateCard.tsx +74 -0
  63. package/src/components/templates/TemplateCommandDialog.tsx +92 -0
  64. package/src/components/templates/TemplatePreviewContent.tsx +182 -0
  65. package/src/components/templates/TemplatesBrowseControls.tsx +120 -0
  66. package/src/components/templates/TemplatesCatalogSection.tsx +166 -0
  67. package/src/components/templates/TemplatesClientPage.tsx +109 -741
  68. package/src/components/templates/TemplatesHeroSection.tsx +41 -0
  69. package/src/components/templates/TemplatesNextStepsSection.tsx +80 -0
  70. package/src/components/templates/TemplatesPreviewModal.tsx +19 -294
  71. package/src/components/templates/template-catalog.test.ts +66 -0
  72. package/src/components/templates/template-catalog.ts +132 -0
  73. package/src/components/templates/template-new.ts +12 -0
  74. package/src/components/templates/template-preview.ts +57 -0
  75. package/src/components/templates/template-source.ts +13 -0
  76. package/.turbo/turbo-prebuild.log +0 -1
@@ -0,0 +1,284 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // src/components/templates/TemplateCard.tsx
10
+ import { jsxDEV } from "react/jsx-dev-runtime";
11
+ "use client";
12
+ function TemplateCard({
13
+ title,
14
+ description,
15
+ metaBadges,
16
+ tags,
17
+ featureList = [],
18
+ isNew = false,
19
+ previewAction,
20
+ useAction
21
+ }) {
22
+ return /* @__PURE__ */ jsxDEV("div", {
23
+ className: "editorial-panel relative flex flex-col space-y-4 transition-colors hover:border-[color:rgb(162_79_42_/_0.55)]",
24
+ children: [
25
+ isNew ? /* @__PURE__ */ jsxDEV("span", {
26
+ className: "absolute top-4 right-4 rounded-full bg-[color:var(--success)] px-2.5 py-1 font-medium text-[11px] text-white uppercase",
27
+ children: "New"
28
+ }, undefined, false, undefined, this) : null,
29
+ /* @__PURE__ */ jsxDEV("div", {
30
+ children: [
31
+ /* @__PURE__ */ jsxDEV("h3", {
32
+ className: "font-serif text-2xl tracking-[-0.03em]",
33
+ children: title
34
+ }, undefined, false, undefined, this),
35
+ /* @__PURE__ */ jsxDEV("p", {
36
+ className: "mt-1 text-muted-foreground text-sm",
37
+ children: description
38
+ }, undefined, false, undefined, this)
39
+ ]
40
+ }, undefined, true, undefined, this),
41
+ /* @__PURE__ */ jsxDEV("div", {
42
+ className: "flex-1 space-y-3",
43
+ children: [
44
+ /* @__PURE__ */ jsxDEV("div", {
45
+ className: "flex flex-wrap gap-2",
46
+ children: metaBadges.map((badge) => /* @__PURE__ */ jsxDEV("span", {
47
+ className: "rounded-full border border-border bg-background px-3 py-1 text-[11px] text-foreground",
48
+ children: badge
49
+ }, badge, false, undefined, this))
50
+ }, undefined, false, undefined, this),
51
+ featureList.length > 0 ? /* @__PURE__ */ jsxDEV("p", {
52
+ className: "text-muted-foreground text-xs",
53
+ children: [
54
+ /* @__PURE__ */ jsxDEV("span", {
55
+ className: "font-medium text-foreground",
56
+ children: "Features:"
57
+ }, undefined, false, undefined, this),
58
+ " ",
59
+ featureList.join(", ")
60
+ ]
61
+ }, undefined, true, undefined, this) : null,
62
+ /* @__PURE__ */ jsxDEV("div", {
63
+ className: "flex flex-wrap gap-1",
64
+ children: tags.map((tag) => /* @__PURE__ */ jsxDEV("span", {
65
+ className: "rounded-full border border-border bg-muted px-3 py-1 text-[11px] text-muted-foreground",
66
+ children: tag
67
+ }, tag, false, undefined, this))
68
+ }, undefined, false, undefined, this)
69
+ ]
70
+ }, undefined, true, undefined, this),
71
+ /* @__PURE__ */ jsxDEV("div", {
72
+ className: "flex gap-2 pt-4",
73
+ children: [
74
+ previewAction,
75
+ useAction
76
+ ]
77
+ }, undefined, true, undefined, this)
78
+ ]
79
+ }, undefined, true, undefined, this);
80
+ }
81
+
82
+ // src/components/templates/template-new.ts
83
+ var NEW_TEMPLATE_IDS = [
84
+ "minimal",
85
+ "messaging-agent-actions",
86
+ "policy-safe-knowledge-assistant",
87
+ "visualization-showcase"
88
+ ];
89
+ var NEW_TEMPLATE_ID_SET = new Set(NEW_TEMPLATE_IDS);
90
+ function isNewTemplateId(templateId) {
91
+ return NEW_TEMPLATE_ID_SET.has(templateId);
92
+ }
93
+
94
+ // src/components/templates/template-catalog.ts
95
+ import { listExamples, listTemplates } from "@contractspec/module.examples";
96
+ var NEW_TEMPLATE_INDEX = new Map(NEW_TEMPLATE_IDS.map((templateId, index) => [templateId, index]));
97
+ function buildLocalTemplateCatalog(examples = listExamples(), templates = listTemplates()) {
98
+ const templatesById = new Map(templates.map((template) => [template.id, template]));
99
+ return examples.filter((example) => example.meta.visibility === "public" && example.surfaces.templates).map((example) => {
100
+ const template = templatesById.get(example.meta.key);
101
+ const tags = Array.from(new Set(example.meta.tags.map((tag) => tag.trim()).filter(Boolean))).sort((left, right) => left.localeCompare(right));
102
+ return {
103
+ id: example.meta.key,
104
+ title: example.meta.title ?? template?.name ?? example.meta.key,
105
+ description: example.meta.summary ?? example.meta.description,
106
+ tags,
107
+ kind: example.meta.kind,
108
+ stability: example.meta.stability,
109
+ previewUrl: template?.preview?.demoUrl ?? `/sandbox?template=${encodeURIComponent(example.meta.key)}`,
110
+ featureList: [...template?.features ?? []],
111
+ sandboxModes: example.surfaces.sandbox.modes,
112
+ renderTargets: [...template?.renderTargets ?? []],
113
+ isNew: isNewTemplateId(example.meta.key),
114
+ packageName: example.entrypoints.packageName
115
+ };
116
+ }).sort(compareLocalTemplateCatalogItems);
117
+ }
118
+ function matchesTemplateFilters(template, search, selectedTag) {
119
+ const haystack = [
120
+ template.title,
121
+ template.description,
122
+ template.tags.join(" ")
123
+ ].join(" ").toLowerCase();
124
+ const searchTokens = search.trim().toLowerCase().split(/\s+/).filter(Boolean);
125
+ const matchesSearch = searchTokens.length === 0 || searchTokens.every((token) => haystack.includes(token));
126
+ const matchesTag = selectedTag === null || template.tags.includes(selectedTag);
127
+ return matchesSearch && matchesTag;
128
+ }
129
+ function formatExampleKindLabel(kind) {
130
+ return kind.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
131
+ }
132
+ function formatStabilityLabel(stability) {
133
+ return stability.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
134
+ }
135
+ function compareLocalTemplateCatalogItems(left, right) {
136
+ const leftNewIndex = NEW_TEMPLATE_INDEX.get(left.id);
137
+ const rightNewIndex = NEW_TEMPLATE_INDEX.get(right.id);
138
+ if (leftNewIndex !== undefined || rightNewIndex !== undefined) {
139
+ if (leftNewIndex === undefined) {
140
+ return 1;
141
+ }
142
+ if (rightNewIndex === undefined) {
143
+ return -1;
144
+ }
145
+ return leftNewIndex - rightNewIndex;
146
+ }
147
+ return left.title.localeCompare(right.title);
148
+ }
149
+
150
+ // src/components/templates/template-preview.ts
151
+ var INLINE_TEMPLATE_PREVIEW_IDS = [
152
+ "agent-console",
153
+ "ai-chat-assistant",
154
+ "analytics-dashboard",
155
+ "crm-pipeline",
156
+ "data-grid-showcase",
157
+ "integration-hub",
158
+ "marketplace",
159
+ "saas-boilerplate",
160
+ "visualization-showcase",
161
+ "workflow-system"
162
+ ];
163
+ var INLINE_TEMPLATE_PREVIEW_SET = new Set(INLINE_TEMPLATE_PREVIEW_IDS);
164
+ function supportsInlineTemplatePreview(templateId) {
165
+ return INLINE_TEMPLATE_PREVIEW_SET.has(templateId);
166
+ }
167
+ function getLocalTemplatePreviewAction(template) {
168
+ if (supportsInlineTemplatePreview(template.id)) {
169
+ return { kind: "modal", templateId: template.id };
170
+ }
171
+ return { kind: "sandbox", href: template.previewUrl };
172
+ }
173
+ function getRegistryTemplatePreviewAction(template, localTemplate) {
174
+ if (!localTemplate) {
175
+ return { kind: "disabled" };
176
+ }
177
+ return getLocalTemplatePreviewAction(localTemplate);
178
+ }
179
+
180
+ // src/components/templates/TemplatesCatalogSection.tsx
181
+ import Link from "next/link";
182
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
183
+ "use client";
184
+ function TemplatesCatalogSection({
185
+ source,
186
+ registryConfigured,
187
+ registryLoading,
188
+ localTemplates,
189
+ registryTemplates,
190
+ localTemplateById,
191
+ onPreview,
192
+ onUseTemplate
193
+ }) {
194
+ const showRegistry = source === "registry" && registryConfigured;
195
+ return /* @__PURE__ */ jsxDEV2("section", {
196
+ className: "section-padding",
197
+ children: /* @__PURE__ */ jsxDEV2("div", {
198
+ className: "editorial-shell",
199
+ children: showRegistry ? registryLoading ? /* @__PURE__ */ jsxDEV2("div", {
200
+ className: "py-12 text-center",
201
+ children: /* @__PURE__ */ jsxDEV2("p", {
202
+ className: "text-muted-foreground",
203
+ children: "Loading community templates…"
204
+ }, undefined, false, undefined, this)
205
+ }, undefined, false, undefined, this) : registryTemplates.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
206
+ className: "py-12 text-center",
207
+ children: /* @__PURE__ */ jsxDEV2("p", {
208
+ className: "text-muted-foreground",
209
+ children: "No community templates found."
210
+ }, undefined, false, undefined, this)
211
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("div", {
212
+ className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3",
213
+ children: registryTemplates.map((template) => {
214
+ const localTemplate = localTemplateById.get(template.id);
215
+ const previewAction = getRegistryTemplatePreviewAction(template, localTemplate);
216
+ return /* @__PURE__ */ jsxDEV2(TemplateCard, {
217
+ title: template.name,
218
+ description: template.description,
219
+ metaBadges: ["Community"],
220
+ tags: template.tags,
221
+ previewAction: previewAction.kind === "modal" ? /* @__PURE__ */ jsxDEV2("button", {
222
+ className: "btn-ghost flex-1 text-center text-xs",
223
+ onClick: () => onPreview(template.id),
224
+ children: "Preview"
225
+ }, undefined, false, undefined, this) : previewAction.kind === "sandbox" ? /* @__PURE__ */ jsxDEV2(Link, {
226
+ href: previewAction.href,
227
+ className: "btn-ghost flex-1 text-center text-xs",
228
+ children: "Open Sandbox"
229
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("button", {
230
+ className: "btn-ghost flex-1 cursor-not-allowed text-center text-xs opacity-60",
231
+ type: "button",
232
+ disabled: true,
233
+ children: "Preview Unavailable"
234
+ }, undefined, false, undefined, this),
235
+ useAction: /* @__PURE__ */ jsxDEV2("button", {
236
+ className: "btn-primary flex-1 text-center text-xs",
237
+ onClick: () => onUseTemplate(template.id, "registry"),
238
+ children: "Use Template"
239
+ }, undefined, false, undefined, this)
240
+ }, template.id, false, undefined, this);
241
+ })
242
+ }, undefined, false, undefined, this) : localTemplates.length === 0 ? /* @__PURE__ */ jsxDEV2("div", {
243
+ className: "py-12 text-center",
244
+ children: /* @__PURE__ */ jsxDEV2("p", {
245
+ className: "text-muted-foreground",
246
+ children: "No templates match your filters. Try a different search."
247
+ }, undefined, false, undefined, this)
248
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2("div", {
249
+ className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3",
250
+ children: localTemplates.map((template) => {
251
+ const previewAction = getLocalTemplatePreviewAction(template);
252
+ return /* @__PURE__ */ jsxDEV2(TemplateCard, {
253
+ title: template.title,
254
+ description: template.description,
255
+ isNew: template.isNew,
256
+ metaBadges: [
257
+ formatExampleKindLabel(template.kind),
258
+ formatStabilityLabel(template.stability)
259
+ ],
260
+ tags: template.tags,
261
+ featureList: template.featureList,
262
+ previewAction: previewAction.kind === "modal" ? /* @__PURE__ */ jsxDEV2("button", {
263
+ className: "btn-ghost flex-1 text-center text-xs",
264
+ onClick: () => onPreview(template.id),
265
+ children: "Preview"
266
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV2(Link, {
267
+ href: previewAction.href,
268
+ className: "btn-ghost flex-1 text-center text-xs",
269
+ children: "Open Sandbox"
270
+ }, undefined, false, undefined, this),
271
+ useAction: /* @__PURE__ */ jsxDEV2("button", {
272
+ className: "btn-primary flex-1 text-center text-xs",
273
+ onClick: () => onUseTemplate(template.id, "local"),
274
+ children: "Use Template"
275
+ }, undefined, false, undefined, this)
276
+ }, template.id, false, undefined, this);
277
+ })
278
+ }, undefined, false, undefined, this)
279
+ }, undefined, false, undefined, this)
280
+ }, undefined, false, undefined, this);
281
+ }
282
+ export {
283
+ TemplatesCatalogSection
284
+ };