@flamingo-stack/openframe-frontend-core 0.0.239 → 0.0.240
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.
- package/dist/{chunk-36G2QXYZ.cjs → chunk-3TDLFCCS.cjs} +37 -23
- package/dist/chunk-3TDLFCCS.cjs.map +1 -0
- package/dist/{chunk-ORJREQ2W.js → chunk-4XLJWX2N.js} +4 -4
- package/dist/{chunk-SZ3BBI6H.cjs → chunk-5JTDFOYB.cjs} +12 -12
- package/dist/{chunk-SZ3BBI6H.cjs.map → chunk-5JTDFOYB.cjs.map} +1 -1
- package/dist/{chunk-G6YZ7O27.js → chunk-7BWJF43J.js} +6 -6
- package/dist/{chunk-7LLS3TWN.js → chunk-B3NI3KT4.js} +5 -5
- package/dist/{chunk-MTROCWO4.cjs → chunk-CDLMGHSB.cjs} +7 -7
- package/dist/{chunk-MTROCWO4.cjs.map → chunk-CDLMGHSB.cjs.map} +1 -1
- package/dist/{chunk-JDQY7JCV.js → chunk-MKVKVJQQ.js} +36 -22
- package/dist/chunk-MKVKVJQQ.js.map +1 -0
- package/dist/{chunk-5VU66BD2.cjs → chunk-NE2DYD6K.cjs} +494 -461
- package/dist/chunk-NE2DYD6K.cjs.map +1 -0
- package/dist/chunk-POZHDJSK.js +276 -0
- package/dist/chunk-POZHDJSK.js.map +1 -0
- package/dist/{chunk-FSS2MIEA.cjs → chunk-SGJBUL2Y.cjs} +20 -3
- package/dist/chunk-SGJBUL2Y.cjs.map +1 -0
- package/dist/{chunk-IJOJWBME.cjs → chunk-SI4LEFLR.cjs} +27 -27
- package/dist/{chunk-IJOJWBME.cjs.map → chunk-SI4LEFLR.cjs.map} +1 -1
- package/dist/chunk-TE6LSK2X.cjs +276 -0
- package/dist/chunk-TE6LSK2X.cjs.map +1 -0
- package/dist/{chunk-LJGBFD52.js → chunk-VAUI3CND.js} +18 -1
- package/dist/chunk-VAUI3CND.js.map +1 -0
- package/dist/{chunk-OB45JHDY.cjs → chunk-VFKQMAUF.cjs} +3 -3
- package/dist/{chunk-OB45JHDY.cjs.map → chunk-VFKQMAUF.cjs.map} +1 -1
- package/dist/{chunk-Y6463TD6.js → chunk-XWUA273B.js} +2 -2
- package/dist/{chunk-Y7DCQUNL.js → chunk-YH6KPNIH.js} +87 -54
- package/dist/chunk-YH6KPNIH.js.map +1 -0
- package/dist/{chunk-ELMYRGWG.cjs → chunk-YY6S4T67.cjs} +12 -12
- package/dist/{chunk-ELMYRGWG.cjs.map → chunk-YY6S4T67.cjs.map} +1 -1
- package/dist/{chunk-PN64LWNT.js → chunk-ZYPOIFBS.js} +8 -8
- package/dist/components/chat/hooks/use-chat-card-item.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +6 -6
- package/dist/components/chat/index.js +5 -5
- package/dist/components/chat/types/entities/content-ref.d.ts +5 -20
- package/dist/components/chat/types/entities/content-ref.d.ts.map +1 -1
- package/dist/components/chevron-button.d.ts +3 -1
- package/dist/components/chevron-button.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +7 -7
- package/dist/components/contact/index.js +6 -6
- package/dist/components/faq/faq-section.d.ts +8 -2
- package/dist/components/faq/faq-section.d.ts.map +1 -1
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/faq/json-ld.cjs +1 -1
- package/dist/components/faq/json-ld.cjs.map +1 -1
- package/dist/components/faq/{faq-json-ld.d.ts → json-ld.d.ts} +1 -1
- package/dist/components/faq/json-ld.d.ts.map +1 -0
- package/dist/components/faq/json-ld.js +1 -1
- package/dist/components/faq/json-ld.js.map +1 -1
- package/dist/components/faq-accordion.d.ts.map +1 -1
- package/dist/components/features/index.cjs +6 -6
- package/dist/components/features/index.js +5 -5
- package/dist/components/index.cjs +89 -85
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +31 -27
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +6 -6
- package/dist/components/navigation/index.js +5 -5
- package/dist/components/onboarding-guides/index.cjs +30 -30
- package/dist/components/onboarding-guides/index.cjs.map +1 -1
- package/dist/components/onboarding-guides/index.js +11 -11
- package/dist/components/related-content/index.cjs +26 -0
- package/dist/components/related-content/index.cjs.map +1 -0
- package/dist/components/related-content/index.d.ts +2 -0
- package/dist/components/related-content/index.d.ts.map +1 -0
- package/dist/components/related-content/index.js +26 -0
- package/dist/components/related-content/index.js.map +1 -0
- package/dist/components/related-content/related-content-section.d.ts +135 -0
- package/dist/components/related-content/related-content-section.d.ts.map +1 -0
- package/dist/components/tickets/index.cjs +73 -73
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.js +15 -15
- package/dist/components/ui/index.cjs +11 -11
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +13 -13
- package/dist/embed-shims/index.cjs +3 -3
- package/dist/embed-shims/index.cjs.map +1 -1
- package/dist/embed-shims/index.js +5 -5
- package/dist/index.cjs +25 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -39
- package/dist/types/content-ref.d.ts +35 -0
- package/dist/types/content-ref.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/content-ref-groups.d.ts +58 -0
- package/dist/utils/content-ref-groups.d.ts.map +1 -0
- package/dist/utils/extract-items.d.ts +18 -0
- package/dist/utils/extract-items.d.ts.map +1 -0
- package/dist/utils/index.cjs +77 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +71 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/suggestion-url.d.ts +26 -0
- package/dist/utils/suggestion-url.d.ts.map +1 -0
- package/package.json +7 -1
- package/src/components/chat/hooks/use-chat-card-item.ts +3 -38
- package/src/components/chat/types/entities/content-ref.ts +5 -21
- package/src/components/chevron-button.tsx +5 -1
- package/src/components/faq/faq-section.tsx +71 -26
- package/src/components/faq-accordion.tsx +2 -1
- package/src/components/index.ts +1 -0
- package/src/components/related-content/index.ts +9 -0
- package/src/components/related-content/related-content-section.tsx +585 -0
- package/src/types/content-ref.ts +34 -0
- package/src/types/index.ts +1 -0
- package/src/utils/content-ref-groups.ts +89 -0
- package/src/utils/extract-items.ts +48 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/suggestion-url.ts +39 -0
- package/dist/chunk-36G2QXYZ.cjs.map +0 -1
- package/dist/chunk-5VU66BD2.cjs.map +0 -1
- package/dist/chunk-FSS2MIEA.cjs.map +0 -1
- package/dist/chunk-JDQY7JCV.js.map +0 -1
- package/dist/chunk-LJGBFD52.js.map +0 -1
- package/dist/chunk-Y7DCQUNL.js.map +0 -1
- package/dist/components/faq/faq-json-ld.d.ts.map +0 -1
- /package/dist/{chunk-ORJREQ2W.js.map → chunk-4XLJWX2N.js.map} +0 -0
- /package/dist/{chunk-G6YZ7O27.js.map → chunk-7BWJF43J.js.map} +0 -0
- /package/dist/{chunk-7LLS3TWN.js.map → chunk-B3NI3KT4.js.map} +0 -0
- /package/dist/{chunk-Y6463TD6.js.map → chunk-XWUA273B.js.map} +0 -0
- /package/dist/{chunk-PN64LWNT.js.map → chunk-ZYPOIFBS.js.map} +0 -0
- /package/src/components/faq/{faq-json-ld.ts → json-ld.ts} +0 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useSelfFetch
|
|
4
|
+
} from "./chunk-L4LAAA5Q.js";
|
|
5
|
+
import {
|
|
6
|
+
BlogCard,
|
|
7
|
+
BlogCardSkeleton,
|
|
8
|
+
CONTENT_REF_GROUPS,
|
|
9
|
+
CaseStudyCard,
|
|
10
|
+
CaseStudyCardSkeleton,
|
|
11
|
+
CustomerInterviewCard,
|
|
12
|
+
CustomerInterviewCardSkeleton,
|
|
13
|
+
InvestorUpdateCard,
|
|
14
|
+
InvestorUpdateCardSkeleton,
|
|
15
|
+
OnboardingGuideCard,
|
|
16
|
+
OnboardingGuideCardSkeleton,
|
|
17
|
+
ProductReleaseCard,
|
|
18
|
+
ProductReleaseCardSkeleton,
|
|
19
|
+
ProgramCard,
|
|
20
|
+
ProgramCardSkeleton,
|
|
21
|
+
RoadmapCard,
|
|
22
|
+
RoadmapCardSkeleton,
|
|
23
|
+
buildListUrl,
|
|
24
|
+
buildProductReleaseCardProps,
|
|
25
|
+
decideNewTab,
|
|
26
|
+
extractItems,
|
|
27
|
+
getContentRefLabelOrTitleCase,
|
|
28
|
+
orderContentRefTypes
|
|
29
|
+
} from "./chunk-YH6KPNIH.js";
|
|
30
|
+
import {
|
|
31
|
+
buildSuggestionUrl
|
|
32
|
+
} from "./chunk-VAUI3CND.js";
|
|
33
|
+
|
|
34
|
+
// src/components/related-content/related-content-section.tsx
|
|
35
|
+
import { useMemo } from "react";
|
|
36
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
+
function DefaultLinkPropsProvider({ href, targetPlatform, children }) {
|
|
38
|
+
if (!href) return children(null);
|
|
39
|
+
const newTab = decideNewTab({ href, targetPlatform, currentSource: "" });
|
|
40
|
+
return children(
|
|
41
|
+
newTab ? { href, target: "_blank", rel: "noopener noreferrer" } : { href }
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
function defaultResolveHref(ref) {
|
|
45
|
+
return { href: ref.url || null, targetPlatform: ref.targetPlatform ?? null };
|
|
46
|
+
}
|
|
47
|
+
function renderSkeletonForType(type, size, adminCampaignCard) {
|
|
48
|
+
const legacySize = size === "sm" ? "sm" : "default";
|
|
49
|
+
switch (type) {
|
|
50
|
+
case "blog_post_existing":
|
|
51
|
+
return /* @__PURE__ */ jsx(BlogCardSkeleton, { size: legacySize });
|
|
52
|
+
case "case_study":
|
|
53
|
+
return /* @__PURE__ */ jsx(CaseStudyCardSkeleton, { size: legacySize });
|
|
54
|
+
case "customer_interview":
|
|
55
|
+
return /* @__PURE__ */ jsx(CustomerInterviewCardSkeleton, { size: legacySize });
|
|
56
|
+
case "product_release":
|
|
57
|
+
return /* @__PURE__ */ jsx(ProductReleaseCardSkeleton, { size: size === "sm" ? "sm" : "lg" });
|
|
58
|
+
case "podcast":
|
|
59
|
+
case "webinar":
|
|
60
|
+
case "event":
|
|
61
|
+
return /* @__PURE__ */ jsx(ProgramCardSkeleton, { size: legacySize });
|
|
62
|
+
case "investor_update":
|
|
63
|
+
return /* @__PURE__ */ jsx(InvestorUpdateCardSkeleton, { size: legacySize });
|
|
64
|
+
case "onboarding_guide":
|
|
65
|
+
return /* @__PURE__ */ jsx(OnboardingGuideCardSkeleton, { size: legacySize });
|
|
66
|
+
case "marketing_campaign":
|
|
67
|
+
return adminCampaignCard ? /* @__PURE__ */ jsx(adminCampaignCard.Skeleton, { size: legacySize }) : null;
|
|
68
|
+
case "roadmap_item":
|
|
69
|
+
case "delivery_item":
|
|
70
|
+
case "internal_task":
|
|
71
|
+
return /* @__PURE__ */ jsx(RoadmapCardSkeleton, { size: legacySize });
|
|
72
|
+
default:
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function CardForType({
|
|
77
|
+
type,
|
|
78
|
+
item,
|
|
79
|
+
size,
|
|
80
|
+
href,
|
|
81
|
+
targetPlatform,
|
|
82
|
+
linkProps,
|
|
83
|
+
extras,
|
|
84
|
+
adminCampaignCard
|
|
85
|
+
}) {
|
|
86
|
+
const legacySize = size === "sm" ? "sm" : "default";
|
|
87
|
+
const placeholderUrl = extras?.buildOgPlaceholderUrl?.(item?.title ?? "") ?? void 0;
|
|
88
|
+
const anchorAttrs = linkProps ? { target: linkProps.target, rel: linkProps.rel } : {};
|
|
89
|
+
switch (type) {
|
|
90
|
+
case "blog_post_existing":
|
|
91
|
+
return /* @__PURE__ */ jsx(BlogCard, { post: item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs });
|
|
92
|
+
case "case_study":
|
|
93
|
+
return /* @__PURE__ */ jsx(CaseStudyCard, { study: item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs });
|
|
94
|
+
case "customer_interview":
|
|
95
|
+
return /* @__PURE__ */ jsx(CustomerInterviewCard, { interview: item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs });
|
|
96
|
+
case "product_release": {
|
|
97
|
+
const releaseSize = size === "sm" ? "sm" : "lg";
|
|
98
|
+
const buildReleaseProps = extras?.buildProductReleaseCardProps ?? buildProductReleaseCardProps;
|
|
99
|
+
const releaseProps = buildReleaseProps(item);
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
ProductReleaseCard,
|
|
102
|
+
{
|
|
103
|
+
size: releaseSize,
|
|
104
|
+
title: item.title,
|
|
105
|
+
summary: item.summary,
|
|
106
|
+
version: item.version,
|
|
107
|
+
...releaseProps,
|
|
108
|
+
anchorProps: linkProps ?? void 0
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
case "podcast":
|
|
113
|
+
return extras?.programConfigs?.podcast ? /* @__PURE__ */ jsx(ProgramCard, { config: extras.programConfigs.podcast, item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs }) : null;
|
|
114
|
+
case "webinar":
|
|
115
|
+
return extras?.programConfigs?.webinar ? /* @__PURE__ */ jsx(ProgramCard, { config: extras.programConfigs.webinar, item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs }) : null;
|
|
116
|
+
case "event":
|
|
117
|
+
return extras?.programConfigs?.event ? /* @__PURE__ */ jsx(ProgramCard, { config: extras.programConfigs.event, item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs }) : null;
|
|
118
|
+
case "investor_update":
|
|
119
|
+
return /* @__PURE__ */ jsx(InvestorUpdateCard, { update: item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs });
|
|
120
|
+
case "onboarding_guide":
|
|
121
|
+
return /* @__PURE__ */ jsx(OnboardingGuideCard, { guide: item, size: legacySize, href, targetPlatform, placeholderUrl, ...anchorAttrs });
|
|
122
|
+
case "marketing_campaign":
|
|
123
|
+
return adminCampaignCard ? /* @__PURE__ */ jsx(adminCampaignCard.Card, { campaign: item }) : null;
|
|
124
|
+
case "roadmap_item":
|
|
125
|
+
case "delivery_item":
|
|
126
|
+
case "internal_task":
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
RoadmapCard,
|
|
129
|
+
{
|
|
130
|
+
item,
|
|
131
|
+
href: href ?? "",
|
|
132
|
+
targetPlatform,
|
|
133
|
+
userVote: null,
|
|
134
|
+
onVote: () => {
|
|
135
|
+
},
|
|
136
|
+
size: legacySize,
|
|
137
|
+
cardType: type,
|
|
138
|
+
...anchorAttrs
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
default:
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function useGroupItems(type, refs, buildUrl) {
|
|
146
|
+
const ids = refs.map((r) => r.id);
|
|
147
|
+
const url = ids.length > 0 ? buildUrl(type, ids) : null;
|
|
148
|
+
const { data, isLoading } = useSelfFetch(url);
|
|
149
|
+
const items = data != null ? extractItems(data) : null;
|
|
150
|
+
return { items, isLoading };
|
|
151
|
+
}
|
|
152
|
+
function gridClassFor(columns) {
|
|
153
|
+
return columns === 3 ? "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6" : "grid grid-cols-1 sm:grid-cols-2 gap-6";
|
|
154
|
+
}
|
|
155
|
+
function resolveGroupConfig(type) {
|
|
156
|
+
return CONTENT_REF_GROUPS[type] ?? {
|
|
157
|
+
label: type,
|
|
158
|
+
order: 999,
|
|
159
|
+
layout: "grid",
|
|
160
|
+
gridSize: "default"
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function ContentGroup({
|
|
164
|
+
type,
|
|
165
|
+
refs,
|
|
166
|
+
columns,
|
|
167
|
+
buildUrl,
|
|
168
|
+
resolveHref,
|
|
169
|
+
LinkProvider,
|
|
170
|
+
extras,
|
|
171
|
+
adminCampaignCard
|
|
172
|
+
}) {
|
|
173
|
+
const { items, isLoading } = useGroupItems(type, refs, buildUrl);
|
|
174
|
+
const config = resolveGroupConfig(type);
|
|
175
|
+
const isListLayout = config.layout === "list";
|
|
176
|
+
const cardSize = config.gridSize;
|
|
177
|
+
if (isLoading && !items) {
|
|
178
|
+
const skeletons = refs.map((r) => /* @__PURE__ */ jsx("div", { children: renderSkeletonForType(type, cardSize, adminCampaignCard) }, r.id));
|
|
179
|
+
return isListLayout ? /* @__PURE__ */ jsx("div", { className: "space-y-4", children: skeletons }) : /* @__PURE__ */ jsx("div", { className: gridClassFor(columns), children: skeletons });
|
|
180
|
+
}
|
|
181
|
+
if (!items || items.length === 0) return null;
|
|
182
|
+
const refMap = new Map(refs.map((r) => [String(r.id), r]));
|
|
183
|
+
const cards = items.map((item) => {
|
|
184
|
+
const itemId = String(item.id);
|
|
185
|
+
const contentRef = refMap.get(itemId);
|
|
186
|
+
if (!contentRef) return null;
|
|
187
|
+
const resolved = resolveHref(contentRef);
|
|
188
|
+
const href = resolved.href ?? "";
|
|
189
|
+
const targetPlatform = resolved.targetPlatform ?? contentRef.targetPlatform ?? null;
|
|
190
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(LinkProvider, { href: href || null, targetPlatform, children: (linkProps) => /* @__PURE__ */ jsx(
|
|
191
|
+
CardForType,
|
|
192
|
+
{
|
|
193
|
+
type,
|
|
194
|
+
item,
|
|
195
|
+
contentRef,
|
|
196
|
+
size: cardSize,
|
|
197
|
+
href,
|
|
198
|
+
targetPlatform,
|
|
199
|
+
linkProps,
|
|
200
|
+
extras,
|
|
201
|
+
adminCampaignCard
|
|
202
|
+
}
|
|
203
|
+
) }) }, itemId);
|
|
204
|
+
}).filter(Boolean);
|
|
205
|
+
if (cards.length === 0) return null;
|
|
206
|
+
return isListLayout ? /* @__PURE__ */ jsx("div", { className: "space-y-4", children: cards }) : /* @__PURE__ */ jsx("div", { className: gridClassFor(columns), children: cards });
|
|
207
|
+
}
|
|
208
|
+
function RelatedContentSection({
|
|
209
|
+
contentRefs,
|
|
210
|
+
entityType,
|
|
211
|
+
entityId,
|
|
212
|
+
minResults,
|
|
213
|
+
initialItems,
|
|
214
|
+
title = "Related Content",
|
|
215
|
+
columns = 2,
|
|
216
|
+
excludeTypes,
|
|
217
|
+
apiBaseUrl = "",
|
|
218
|
+
extras,
|
|
219
|
+
resolveHref = defaultResolveHref,
|
|
220
|
+
buildListUrl: buildListUrl2,
|
|
221
|
+
LinkProvider = DefaultLinkPropsProvider,
|
|
222
|
+
adminCampaignCard
|
|
223
|
+
}) {
|
|
224
|
+
const suggestUrl = contentRefs === void 0 && entityType && entityId !== void 0 && entityId !== null && entityId !== "" ? buildSuggestionUrl("/api/related-content", {
|
|
225
|
+
apiBaseUrl,
|
|
226
|
+
entityType,
|
|
227
|
+
entityId,
|
|
228
|
+
count: minResults,
|
|
229
|
+
extraParams: {
|
|
230
|
+
excludeTypes: excludeTypes && excludeTypes.length > 0 ? excludeTypes.join(",") : void 0
|
|
231
|
+
}
|
|
232
|
+
}) : null;
|
|
233
|
+
const initialData = useMemo(
|
|
234
|
+
() => initialItems ? { refs: initialItems } : void 0,
|
|
235
|
+
[initialItems]
|
|
236
|
+
);
|
|
237
|
+
const { data } = useSelfFetch(suggestUrl, { initialData });
|
|
238
|
+
const effectiveBuildListUrl = useMemo(
|
|
239
|
+
() => buildListUrl2 ?? ((type, ids) => buildListUrl(type, ids, apiBaseUrl)),
|
|
240
|
+
[buildListUrl2, apiBaseUrl]
|
|
241
|
+
);
|
|
242
|
+
const refs = contentRefs ?? data?.refs ?? [];
|
|
243
|
+
const exclude = new Set(excludeTypes || []);
|
|
244
|
+
const visibleRefs = exclude.size > 0 ? refs.filter((r) => !exclude.has(r.type)) : refs;
|
|
245
|
+
if (!visibleRefs.length) return null;
|
|
246
|
+
const grouped = {};
|
|
247
|
+
for (const ref of visibleRefs) {
|
|
248
|
+
if (!grouped[ref.type]) grouped[ref.type] = [];
|
|
249
|
+
grouped[ref.type].push(ref);
|
|
250
|
+
}
|
|
251
|
+
const orderedTypes = orderContentRefTypes(Object.keys(grouped));
|
|
252
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
253
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-ods-text-primary", children: title }),
|
|
254
|
+
orderedTypes.map((type) => /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
255
|
+
/* @__PURE__ */ jsx("h3", { className: "font-['Azeret_Mono'] text-[14px] font-semibold uppercase text-ods-text-secondary tracking-wider", children: getContentRefLabelOrTitleCase(type) }),
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
ContentGroup,
|
|
258
|
+
{
|
|
259
|
+
type,
|
|
260
|
+
refs: grouped[type],
|
|
261
|
+
columns,
|
|
262
|
+
buildUrl: effectiveBuildListUrl,
|
|
263
|
+
resolveHref,
|
|
264
|
+
LinkProvider,
|
|
265
|
+
extras,
|
|
266
|
+
adminCampaignCard
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] }, type))
|
|
270
|
+
] });
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export {
|
|
274
|
+
RelatedContentSection
|
|
275
|
+
};
|
|
276
|
+
//# sourceMappingURL=chunk-POZHDJSK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/related-content/related-content-section.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * RelatedContentSection\n *\n * Renders content references grouped by type using the canonical card\n * components. MOVED from the hub (`components/shared/related-content-card.tsx`)\n * so any consuming app can embed it; the hub keeps a thin wrapper that\n * pre-binds its host-specific injections (nav hook, URL recomposition,\n * program configs, admin campaign card).\n *\n * THREE data modes (precedence top-down):\n * 1. CONTROLLED — `contentRefs` provided (even `[]`): render exactly those\n * refs, no suggestion fetch (the original investor-update behavior).\n * 2. SUGGESTION — `entityType` + `entityId` provided: self-fetch\n * `GET {apiBaseUrl}/api/related-content?entityType&entityId[&count][&excludeTypes]`\n * (the generic 5-tier engine's second web service). `minResults` maps to\n * `count`; absent → param not sent (server default applies). Each ref\n * carries a `reason` (data-only — never rendered, matching the\n * FaqSection/FaqWithReason precedent).\n * 3. SSR-HYDRATED suggestion — also pass `initialItems` (the server page\n * called the engine directly); the first client fetch is skipped per the\n * `useSelfFetch` initialData contract.\n *\n * Group layout (list vs grid) + card size (lg vs default) come from\n * `CONTENT_REF_GROUPS` in `../../utils/content-ref-groups` — single source of\n * truth, no per-type logic in this file. Skeletons come from\n * `renderSkeletonForType` so the placeholder height matches the loaded card\n * exactly (zero layout shift on resolve).\n *\n * One API call per content type via the shared list-URL builder\n * (`buildListUrl` — injectable; defaults to the lib's byte-parity-tested\n * builder prefixed with `apiBaseUrl`). Fetching uses `useSelfFetch` (plain\n * fetch, NO react-query) so third-party embedders need no QueryClientProvider;\n * cards are imported via DEEP module paths (not the chat barrel) so this\n * chunk never reaches `@tanstack/react-query`.\n *\n * LOCKSTEP NOTE: this file's per-type card/skeleton dispatch is the SIZED\n * sibling of the chat-side `CHAT_CARD_REGISTRY` (`../chat/entity-cards/\n * dispatch.tsx`), which renders compact `size='sm'` cards wired to the chat\n * runtime. Two dispatchers by design — when registering a new fetch-mode\n * content type, add it BOTH there and here (cards + skeleton + list URL).\n */\n\nimport React, { useMemo } from 'react';\nimport {\n CONTENT_REF_GROUPS,\n getContentRefLabelOrTitleCase,\n orderContentRefTypes,\n type ContentRefGroupConfig,\n} from '../../utils/content-ref-groups';\nimport type { ContentRef, ContentRefWithReason } from '../../types/content-ref';\nimport { useSelfFetch } from '../../hooks/use-self-fetch';\nimport { extractItems } from '../../utils/extract-items';\nimport { buildListUrl as libBuildListUrl } from '../../utils/list-url';\nimport { buildSuggestionUrl } from '../../utils/suggestion-url';\nimport { decideNewTab } from '../chat/utils/decide-new-tab';\n// DEEP card imports — NOT the `../chat` barrel (the barrel statically reaches\n// @tanstack/react-query via embeddable-chat + its hooks). Deep paths keep this\n// component's SOURCE graph react-query-free. Note: tsup's shared-chunk\n// splitting may still colocate the cards with chat hooks in one dist chunk\n// (react-query is a required peerDep, so resolution always succeeds) — the\n// guarantee that matters here is the RUNTIME one: nothing on this path ever\n// instantiates a QueryClient, so embedders need NO QueryClientProvider.\nimport { BlogCard, BlogCardSkeleton } from '../chat/entity-cards/blog-card';\nimport { CaseStudyCard, CaseStudyCardSkeleton } from '../chat/entity-cards/case-study-card';\nimport { CustomerInterviewCard, CustomerInterviewCardSkeleton } from '../chat/entity-cards/customer-interview-card';\nimport { ProductReleaseCard, ProductReleaseCardSkeleton } from '../chat/entity-cards/product-release-card';\nimport { buildProductReleaseCardProps } from '../chat/entity-cards/product-release-card-defaults';\nimport { ProgramCard, ProgramCardSkeleton } from '../chat/entity-cards/program-card';\nimport { InvestorUpdateCard, InvestorUpdateCardSkeleton } from '../chat/entity-cards/investor-update-card';\nimport { OnboardingGuideCard, OnboardingGuideCardSkeleton } from '../chat/entity-cards/onboarding-guide-card';\nimport { RoadmapCard, RoadmapCardSkeleton } from '../chat/entity-cards/roadmap-card';\n// Type-only — erased at build, no runtime dependency on the dispatch module.\nimport type { ChatCardDispatchExtras } from '../chat/entity-cards/dispatch';\n\ntype CardSize = 'lg' | 'default' | 'sm';\n\n/** Anchor prop bundle the per-card link surface receives — same shape the\n * hub's `useNavLink` returns and the chat dispatcher's anchor builders\n * produce. `null` = non-anchor mode (no URL). */\nexport interface CardLinkAnchorProps {\n href: string;\n target?: '_blank';\n rel?: 'noopener noreferrer';\n onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;\n}\n\n/** Render-prop component injection for the navigation decision — keeps hook\n * calls legal (hooks live INSIDE the injected component; `CardForType`\n * itself calls zero hooks). The hub injects a `useNavLink`-backed provider;\n * the default is hook-free (pure `decideNewTab`). MUST be defined at module\n * scope by hosts — an inline arrow would remount every card each render. */\nexport interface CardLinkProviderProps {\n href: string | null;\n targetPlatform: string | null;\n children: (linkProps: CardLinkAnchorProps | null) => React.ReactElement | null;\n}\nexport type CardLinkProvider = React.ComponentType<CardLinkProviderProps>;\n\n/** Default link provider for standalone embeds: relative/-same-origin hrefs\n * stay same-tab, cross-origin pops a new tab (pure `decideNewTab` with no\n * platform context — `currentSource: ''` falls through to the origin\n * check). No router integration, no hooks. */\nfunction DefaultLinkPropsProvider({ href, targetPlatform, children }: CardLinkProviderProps): React.ReactElement | null {\n if (!href) return children(null);\n const newTab = decideNewTab({ href, targetPlatform, currentSource: '' });\n return children(\n newTab\n ? { href, target: '_blank', rel: 'noopener noreferrer' }\n : { href },\n );\n}\n\n/** Default href resolution: trust the ref's stored url/targetPlatform as the\n * API composed them. The hub overrides this with its `buildContentURL`\n * re-composition so dev gets localhost and prod gets platform domains. */\nfunction defaultResolveHref(ref: ContentRef): { href: string | null; targetPlatform: string | null } {\n return { href: ref.url || null, targetPlatform: ref.targetPlatform ?? null };\n}\n\n/** Host-injected renderer pair for the admin-only `marketing_campaign` type.\n * Absent (every non-hub embed) → the type renders nothing (its list URL\n * hits `/api/admin`, unreachable outside the hub anyway). */\nexport interface AdminCampaignCardSlot {\n Card: React.ComponentType<{ campaign: any }>;\n Skeleton: React.ComponentType<{ size?: 'default' | 'sm' }>;\n}\n\n/**\n * Per-type skeleton dispatch — returns the SAME colocated skeleton the\n * resolved card renders, sized to match (zero layout shift on resolve).\n * The chat-side `CHAT_CARD_REGISTRY` already does this via\n * `entry.skeleton()`; this surface exposes the same discipline to the\n * related-content rail.\n */\nfunction renderSkeletonForType(\n type: string,\n size: CardSize,\n adminCampaignCard?: AdminCampaignCardSlot,\n): React.ReactNode {\n // Most card skeletons accept only `{default, sm}`. `'lg'` collapses to\n // `'default'`. ProductReleaseCardSkeleton uses lg/sm pair.\n const legacySize: 'default' | 'sm' = size === 'sm' ? 'sm' : 'default';\n switch (type) {\n case 'blog_post_existing':\n return <BlogCardSkeleton size={legacySize} />;\n case 'case_study':\n return <CaseStudyCardSkeleton size={legacySize} />;\n case 'customer_interview':\n return <CustomerInterviewCardSkeleton size={legacySize} />;\n case 'product_release':\n return <ProductReleaseCardSkeleton size={size === 'sm' ? 'sm' : 'lg'} />;\n case 'podcast':\n case 'webinar':\n case 'event':\n return <ProgramCardSkeleton size={legacySize} />;\n case 'investor_update':\n return <InvestorUpdateCardSkeleton size={legacySize} />;\n case 'onboarding_guide':\n return <OnboardingGuideCardSkeleton size={legacySize} />;\n case 'marketing_campaign':\n return adminCampaignCard ? <adminCampaignCard.Skeleton size={legacySize} /> : null;\n case 'roadmap_item':\n case 'delivery_item':\n case 'internal_task':\n return <RoadmapCardSkeleton size={legacySize} />;\n default:\n return null;\n }\n}\n\n/**\n * Per-type card dispatch — renders the right card with the right size.\n * Sized cards (`'lg'` / `'default'`) are unique to this rail — the chat\n * dispatcher only renders `'sm'`, so we go directly through the per-type\n * cards here.\n *\n * PURE FUNCTION COMPONENT WITH ZERO HOOK CALLS: the placeholder comes from a\n * plain `extras.buildOgPlaceholderUrl` call (the chat `dispatch.tsx`\n * pattern) and the anchor-prop bundle arrives via the `LinkProvider`\n * render-prop from the parent — so per-card hook legality is owned by the\n * injected provider component, not by this switch.\n *\n * `href` comes from the host's `resolveHref(ref)` (hub: live\n * `buildContentURL` recomposition; default: the ref's stored url).\n */\nfunction CardForType({\n type,\n item,\n size,\n href,\n targetPlatform,\n linkProps,\n extras,\n adminCampaignCard,\n}: {\n type: string;\n item: any;\n contentRef: ContentRef;\n size: CardSize;\n href: string;\n targetPlatform: string | null;\n linkProps: CardLinkAnchorProps | null;\n extras?: ChatCardDispatchExtras;\n adminCampaignCard?: AdminCampaignCardSlot;\n}): React.ReactNode {\n // Most card variants accept only `{default, sm}`. `'lg'` collapses to\n // `'default'` for those. ProductReleaseCard uses its own lg/sm pair.\n const legacySize: 'default' | 'sm' = size === 'sm' ? 'sm' : 'default';\n // OG placeholder URL — injected into the pure-presentation cards so they\n // render a branded fallback when the row's featured image is null. Plain\n // function call (NOT a hook). Title is the universal field across all card\n // item shapes used here.\n const placeholderUrl =\n extras?.buildOgPlaceholderUrl?.((item?.title as string | undefined) ?? '') ?? undefined;\n\n // Top-level target/rel for cards that take them as separate props\n // (BlogCard, CaseStudyCard, …). ProductReleaseCard takes the bundle as a\n // single `anchorProps={...}` and uses `linkProps` directly. When the host\n // didn't surface a URL, `linkProps` is null and the card stays in\n // non-anchor mode.\n const anchorAttrs: Pick<CardLinkAnchorProps, 'target' | 'rel'> = linkProps\n ? { target: linkProps.target, rel: linkProps.rel }\n : {};\n\n switch (type) {\n case 'blog_post_existing':\n return <BlogCard post={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />;\n case 'case_study':\n return <CaseStudyCard study={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />;\n case 'customer_interview':\n return <CustomerInterviewCard interview={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />;\n case 'product_release': {\n // Anchor-prop pattern: build product-release lg-variant props from the\n // shared `buildProductReleaseCardProps` so this rail and the /releases\n // catalog page render byte-identically. The card wraps in\n // `<a {...anchorProps}>` ONLY when `anchorProps.href` is set — pass\n // `undefined` (not an empty object) when href is empty so the card\n // stays in non-anchor mode without rendering a dead <a> tag.\n const releaseSize = size === 'sm' ? 'sm' : 'lg';\n const buildReleaseProps = extras?.buildProductReleaseCardProps ?? buildProductReleaseCardProps;\n const releaseProps = buildReleaseProps(item);\n return (\n <ProductReleaseCard\n size={releaseSize}\n title={item.title}\n summary={item.summary}\n version={item.version}\n {...releaseProps}\n anchorProps={linkProps ?? undefined}\n />\n );\n }\n case 'podcast':\n return extras?.programConfigs?.podcast\n ? <ProgramCard config={extras.programConfigs.podcast} item={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />\n : null;\n case 'webinar':\n return extras?.programConfigs?.webinar\n ? <ProgramCard config={extras.programConfigs.webinar} item={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />\n : null;\n case 'event':\n return extras?.programConfigs?.event\n ? <ProgramCard config={extras.programConfigs.event} item={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />\n : null;\n case 'investor_update':\n return <InvestorUpdateCard update={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />;\n case 'onboarding_guide':\n return <OnboardingGuideCard guide={item} size={legacySize} href={href} targetPlatform={targetPlatform} placeholderUrl={placeholderUrl} {...anchorAttrs} />;\n case 'marketing_campaign':\n return adminCampaignCard ? <adminCampaignCard.Card campaign={item} /> : null;\n case 'roadmap_item':\n case 'delivery_item':\n case 'internal_task':\n return (\n <RoadmapCard\n item={item}\n href={href ?? ''}\n targetPlatform={targetPlatform}\n userVote={null}\n onVote={() => {}}\n size={legacySize}\n cardType={type as 'roadmap_item' | 'delivery_item' | 'internal_task'}\n {...anchorAttrs}\n />\n );\n default:\n return null;\n }\n}\n\n// =============================================================================\n// Fetch all items for a type in ONE server-sorted call, via the injectable\n// list-URL builder. `useSelfFetch` (URL = cache key) replaces the hub's old\n// react-query usage: `enabled` ≙ `url === null`, `!res.ok`/network error ≙\n// `error → items null → group renders nothing`. Accepted deltas vs\n// react-query: no retry/backoff, no focus refetch, no cross-mount cache.\n// =============================================================================\n\nfunction useGroupItems(\n type: string,\n refs: ContentRef[],\n buildUrl: (type: string, ids: string[]) => string | null,\n) {\n const ids = refs.map((r) => r.id);\n const url = ids.length > 0 ? buildUrl(type, ids) : null;\n const { data, isLoading } = useSelfFetch<unknown>(url);\n const items = data != null ? extractItems(data) : null;\n return { items, isLoading };\n}\n\n// =============================================================================\n// Per-group renderer — one API call, server-sorted, then render cards via the\n// dispatcher with per-type skeletons + per-type layout from CONTENT_REF_GROUPS.\n// =============================================================================\n\n/** Map columns prop → tailwind grid class. Only consulted for grid-layout\n * groups; list-layout groups stack vertically. */\nfunction gridClassFor(columns: 2 | 3): string {\n return columns === 3\n ? 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6'\n : 'grid grid-cols-1 sm:grid-cols-2 gap-6';\n}\n\n/** Resolve the group config for a type, falling back to a grid layout with\n * the default card size for unregistered types so the section still renders\n * rather than silently dropping them. The `label` field on the fallback is\n * intentionally a placeholder — the section heading goes through\n * `getContentRefLabelOrTitleCase(type)` instead so cross-surface labels\n * stay consistent between this rail and the investor-email builder. */\nfunction resolveGroupConfig(type: string): ContentRefGroupConfig {\n return CONTENT_REF_GROUPS[type] ?? {\n label: type,\n order: 999,\n layout: 'grid',\n gridSize: 'default',\n };\n}\n\nfunction ContentGroup({\n type,\n refs,\n columns,\n buildUrl,\n resolveHref,\n LinkProvider,\n extras,\n adminCampaignCard,\n}: {\n type: string;\n refs: ContentRef[];\n columns: 2 | 3;\n buildUrl: (type: string, ids: string[]) => string | null;\n resolveHref: (ref: ContentRef) => { href: string | null; targetPlatform: string | null };\n LinkProvider: CardLinkProvider;\n extras?: ChatCardDispatchExtras;\n adminCampaignCard?: AdminCampaignCardSlot;\n}) {\n const { items, isLoading } = useGroupItems(type, refs, buildUrl);\n const config = resolveGroupConfig(type);\n const isListLayout = config.layout === 'list';\n const cardSize = config.gridSize;\n\n // Skeleton gate: `isLoading && !items` — SSR HTML and the client's first\n // paint render identical skeletons (useSelfFetch starts isLoading=true on\n // both sides), and once items exist they are never replaced by skeletons.\n if (isLoading && !items) {\n const skeletons = refs.map((r) => (\n <div key={r.id}>{renderSkeletonForType(type, cardSize, adminCampaignCard)}</div>\n ));\n return isListLayout ? (\n <div className=\"space-y-4\">{skeletons}</div>\n ) : (\n <div className={gridClassFor(columns)}>{skeletons}</div>\n );\n }\n\n if (!items || items.length === 0) return null;\n\n // Match fetched items to refs (for url/visibility data).\n const refMap = new Map(refs.map((r) => [String(r.id), r]));\n\n // Items come back server-sorted (date descending). Render in that order.\n const cards = items\n .map((item: any) => {\n const itemId = String(item.id);\n const contentRef = refMap.get(itemId);\n if (!contentRef) return null;\n // Re-compose the URL via the host's resolver (hub: buildContentURL so\n // dev gets localhost and prod the right platform domain; default: the\n // ref's stored url as the API composed it).\n const resolved = resolveHref(contentRef);\n const href = resolved.href ?? '';\n const targetPlatform = resolved.targetPlatform ?? contentRef.targetPlatform ?? null;\n return (\n <div key={itemId}>\n <LinkProvider href={href || null} targetPlatform={targetPlatform}>\n {(linkProps) => (\n <CardForType\n type={type}\n item={item}\n contentRef={contentRef}\n size={cardSize}\n href={href}\n targetPlatform={targetPlatform}\n linkProps={linkProps}\n extras={extras}\n adminCampaignCard={adminCampaignCard}\n />\n )}\n </LinkProvider>\n </div>\n );\n })\n .filter(Boolean);\n\n if (cards.length === 0) return null;\n\n return isListLayout ? (\n <div className=\"space-y-4\">{cards}</div>\n ) : (\n <div className={gridClassFor(columns)}>{cards}</div>\n );\n}\n\n// =============================================================================\n// Main component\n// =============================================================================\n\ninterface RelatedContentResponse {\n refs: ContentRefWithReason[];\n}\n\nexport interface RelatedContentSectionProps {\n /** CONTROLLED mode (the original behavior). When defined — even `[]` — no\n * suggestion fetch runs and exactly these refs render. */\n contentRefs?: ContentRef[];\n /** SUGGESTION mode (with `entityId`): self-fetch suggestions for this host\n * entity from `{apiBaseUrl}/api/related-content`. Ignored when\n * `contentRefs` is provided. */\n entityType?: string;\n entityId?: number | string;\n /** Maps to the suggestion API's `count` param. Absent → param not sent\n * (server default applies). */\n minResults?: number;\n /** SSR hydrate for suggestion mode — the server page ran the engine and\n * drills the refs here; the first client fetch is skipped (useSelfFetch\n * initialData contract). */\n initialItems?: ContentRefWithReason[];\n /** Section title (default: \"Related Content\") */\n title?: string;\n /**\n * Grid columns at desktop. 2 = denser cards / wider summary (original\n * investor-update layout); 3 = more cards per row for dashboards.\n * Only consulted for grid-layout groups. Default: 2.\n */\n columns?: 2 | 3;\n /**\n * ContentRef.type values to exclude. Honored in ALL modes — controlled\n * mode post-filters (original behavior); suggestion mode ALSO forwards the\n * list verbatim as the API's `excludeTypes=` param so excluded types never\n * consume engine fill slots (`minResults` stays honored). The subtraction\n * happens SERVER-side — this component never mirrors the hub's candidate\n * list.\n */\n excludeTypes?: string[];\n /** Fetch-URL prefix for third-party embeds / reverse proxies\n * ('' = same-origin). Applied to BOTH the suggestion fetch and the\n * default per-group list fetches. */\n apiBaseUrl?: string;\n /** Host injection bundle — REUSES the chat dispatcher's\n * `ChatCardDispatchExtras` (programConfigs, buildOgPlaceholderUrl,\n * buildProductReleaseCardProps override). Program groups render nothing\n * when their config is absent. */\n extras?: ChatCardDispatchExtras;\n /** Hub injects its `buildContentURL` recomposition; default uses the\n * ref's stored `url`/`targetPlatform` as the API composed them. */\n resolveHref?: (ref: ContentRef) => { href: string | null; targetPlatform: string | null };\n /** Hub injects its registry-driven entity-list-api builder; default = the\n * lib's `buildListUrl(type, ids, apiBaseUrl)`. */\n buildListUrl?: (type: string, ids: string[]) => string | null;\n /** Hub injects a `useNavLink`-backed render-prop provider; default = pure\n * anchor via `decideNewTab`. MUST be a module-scope component. */\n LinkProvider?: CardLinkProvider;\n /** Renderer pair for the admin-only `marketing_campaign` type. Absent →\n * the type renders nothing. */\n adminCampaignCard?: AdminCampaignCardSlot;\n}\n\nexport function RelatedContentSection({\n contentRefs,\n entityType,\n entityId,\n minResults,\n initialItems,\n title = 'Related Content',\n columns = 2,\n excludeTypes,\n apiBaseUrl = '',\n extras,\n resolveHref = defaultResolveHref,\n buildListUrl,\n LinkProvider = DefaultLinkPropsProvider,\n adminCampaignCard,\n}: RelatedContentSectionProps) {\n // ── Hooks above EVERY early return (the original `if (!contentRefs.length)\n // return null` guard moved below them). ──\n\n // Suggestion-mode fetch URL — null in controlled mode (contentRefs defined,\n // even []) or when the entity scope is incomplete.\n const suggestUrl =\n contentRefs === undefined && entityType && entityId !== undefined && entityId !== null && entityId !== ''\n ? buildSuggestionUrl('/api/related-content', {\n apiBaseUrl,\n entityType,\n entityId,\n count: minResults,\n extraParams: {\n excludeTypes: excludeTypes && excludeTypes.length > 0 ? excludeTypes.join(',') : undefined,\n },\n })\n : null;\n // Memoize the initialData wrapper — useSelfFetch re-syncs on [initialData],\n // and a fresh per-render object would loop setState under re-rendering\n // parents (the latent FaqSection bug, fixed there in the same change).\n const initialData = useMemo<RelatedContentResponse | undefined>(\n () => (initialItems ? { refs: initialItems } : undefined),\n [initialItems],\n );\n const { data } = useSelfFetch<RelatedContentResponse>(suggestUrl, { initialData });\n\n // Default group fetcher: the lib's byte-parity-tested builder, prefixed for\n // embeds. Memoized so group-fetch URLs stay value-stable across renders.\n const effectiveBuildListUrl = useMemo(\n () => buildListUrl ?? ((type: string, ids: string[]) => libBuildListUrl(type, ids, apiBaseUrl)),\n [buildListUrl, apiBaseUrl],\n );\n\n const refs: ContentRef[] = contentRefs ?? data?.refs ?? [];\n\n // Per-consumer type gating — drops refs whose `type` is in the exclude\n // list. In suggestion mode the server already subtracted these (the param\n // is forwarded above); the client filter stays as an idempotent guard and\n // IS the mechanism in controlled mode (original behavior).\n const exclude = new Set(excludeTypes || []);\n const visibleRefs = exclude.size > 0 ? refs.filter((r) => !exclude.has(r.type)) : refs;\n // Zero refs (still loading in suggestion mode, or genuinely empty) → no\n // empty shell.\n if (!visibleRefs.length) return null;\n\n const grouped: Record<string, ContentRef[]> = {};\n for (const ref of visibleRefs) {\n if (!grouped[ref.type]) grouped[ref.type] = [];\n grouped[ref.type].push(ref);\n }\n\n // Registered types in CONTENT_REF_GROUPS order, then any unregistered\n // types appended (same shape the investor-email builder uses — both\n // consume `orderContentRefTypes` so cross-surface ordering matches).\n const orderedTypes = orderContentRefTypes(Object.keys(grouped));\n\n return (\n <div className=\"space-y-8\">\n <h2 className=\"text-2xl font-bold text-ods-text-primary\">{title}</h2>\n {orderedTypes.map((type) => (\n <div key={type} className=\"space-y-4\">\n <h3 className=\"font-['Azeret_Mono'] text-[14px] font-semibold uppercase text-ods-text-secondary tracking-wider\">\n {getContentRefLabelOrTitleCase(type)}\n </h3>\n <ContentGroup\n type={type}\n refs={grouped[type]}\n columns={columns}\n buildUrl={effectiveBuildListUrl}\n resolveHref={resolveHref}\n LinkProvider={LinkProvider}\n extras={extras}\n adminCampaignCard={adminCampaignCard}\n />\n </div>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAgB,eAAe;AAsGlB,cAoaL,YApaK;AA1Cb,SAAS,yBAAyB,EAAE,MAAM,gBAAgB,SAAS,GAAqD;AACtH,MAAI,CAAC,KAAM,QAAO,SAAS,IAAI;AAC/B,QAAM,SAAS,aAAa,EAAE,MAAM,gBAAgB,eAAe,GAAG,CAAC;AACvE,SAAO;AAAA,IACL,SACI,EAAE,MAAM,QAAQ,UAAU,KAAK,sBAAsB,IACrD,EAAE,KAAK;AAAA,EACb;AACF;AAKA,SAAS,mBAAmB,KAAyE;AACnG,SAAO,EAAE,MAAM,IAAI,OAAO,MAAM,gBAAgB,IAAI,kBAAkB,KAAK;AAC7E;AAiBA,SAAS,sBACP,MACA,MACA,mBACiB;AAGjB,QAAM,aAA+B,SAAS,OAAO,OAAO;AAC5D,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO,oBAAC,oBAAiB,MAAM,YAAY;AAAA,IAC7C,KAAK;AACH,aAAO,oBAAC,yBAAsB,MAAM,YAAY;AAAA,IAClD,KAAK;AACH,aAAO,oBAAC,iCAA8B,MAAM,YAAY;AAAA,IAC1D,KAAK;AACH,aAAO,oBAAC,8BAA2B,MAAM,SAAS,OAAO,OAAO,MAAM;AAAA,IACxE,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,oBAAC,uBAAoB,MAAM,YAAY;AAAA,IAChD,KAAK;AACH,aAAO,oBAAC,8BAA2B,MAAM,YAAY;AAAA,IACvD,KAAK;AACH,aAAO,oBAAC,+BAA4B,MAAM,YAAY;AAAA,IAC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,cAAc,QAAQ,OAAO,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,IAAI,CAAC,IAAI;AAGlF,MAAI,CAAC,YAAY,OAAQ,QAAO;AAEhC,QAAM,UAAwC,CAAC;AAC/C,aAAW,OAAO,aAAa;AAC7B,QAAI,CAAC,QAAQ,IAAI,IAAI,EAAG,SAAQ,IAAI,IAAI,IAAI,CAAC;AAC7C,YAAQ,IAAI,IAAI,EAAE,KAAK,GAAG;AAAA,EAC5B;AAKA,QAAM,eAAe,qBAAqB,OAAO,KAAK,OAAO,CAAC;AAE9D,SACE,qBAAC,SAAI,WAAU,aACb;AAAA,wBAAC,QAAG,WAAU,4CAA4C,iBAAM;AAAA,IAC/D,aAAa,IAAI,CAAC,SACjB,qBAAC,SAAe,WAAU,aACxB;AAAA,0BAAC,QAAG,WAAU,mGACX,wCAA8B,IAAI,GACrC;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,MAAM,QAAQ,IAAI;AAAA,UAClB;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,SAbQ,IAcV,CACD;AAAA,KACH;AAEJ;","names":["buildListUrl"]}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
var _chunkFIG2RKZFcjs = require('./chunk-FIG2RKZF.cjs');
|
|
6
6
|
|
|
7
|
+
// src/utils/suggestion-url.ts
|
|
8
|
+
function buildSuggestionUrl(path, opts = {}) {
|
|
9
|
+
const qs = new URLSearchParams();
|
|
10
|
+
const { entityType, entityId } = opts;
|
|
11
|
+
if (entityType && entityId !== void 0 && entityId !== null && entityId !== "") {
|
|
12
|
+
qs.set("entityType", entityType);
|
|
13
|
+
qs.set("entityId", String(entityId));
|
|
14
|
+
}
|
|
15
|
+
if (opts.count !== void 0) qs.set("count", String(opts.count));
|
|
16
|
+
for (const [key, value] of Object.entries(_nullishCoalesce(opts.extraParams, () => ( {})))) {
|
|
17
|
+
if (value !== void 0 && value !== "") qs.set(key, value);
|
|
18
|
+
}
|
|
19
|
+
const query = qs.toString();
|
|
20
|
+
return `${_nullishCoalesce(opts.apiBaseUrl, () => ( ""))}${path}${query ? `?${query}` : ""}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
// src/components/ui/chevron-button.tsx
|
|
8
24
|
_chunkFIG2RKZFcjs.init_cn.call(void 0, );
|
|
9
25
|
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
@@ -40,5 +56,6 @@ ChevronButton.displayName = "ChevronButton";
|
|
|
40
56
|
|
|
41
57
|
|
|
42
58
|
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
|
|
60
|
+
exports.buildSuggestionUrl = buildSuggestionUrl; exports.ChevronButton = ChevronButton;
|
|
61
|
+
//# sourceMappingURL=chunk-SGJBUL2Y.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-SGJBUL2Y.cjs","../src/utils/suggestion-url.ts","../src/components/ui/chevron-button.tsx"],"names":[],"mappings":"AAAA,2cAAY;AACZ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;AACE,UAAA;AACA,UAAA;AACF,QAAA;AACA,QAAA;AACC,QAAA;AAED,QAAA;AAAoC,MAAA;AACtC,IAAA;AAEJ,EAAA;AACF;AACA;AFaU;AACA;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-SGJBUL2Y.cjs","sourcesContent":[null,"/**\n * Shared fetch-URL composer for the two suggestion sections (FaqSection +\n * RelatedContentSection) — ONE owner of the entityType/entityId/count query\n * shape so the sections can never drift. Pure + server-safe.\n *\n * Byte-parity contract with the original `buildFaqsUrl`: when only\n * entityType/entityId are set, the param order is `entityType`, `entityId`;\n * with nothing set, the bare `path` is returned (no `?`).\n */\nexport interface SuggestionUrlOptions {\n /** Fetch-URL prefix for third-party embeds / reverse proxies\n * ('' = same-origin relative). */\n apiBaseUrl?: string\n /** Both required together for entity scope; partial → bare path. */\n entityType?: string\n entityId?: number | string\n /** Maps to the server's `count` param. Undefined → param not sent\n * (server default applies). */\n count?: number\n /** Extra query params appended after the shared trio (e.g. the\n * related-content `excludeTypes` deny-list). Empty/undefined values\n * are skipped. */\n extraParams?: Record<string, string | undefined>\n}\n\nexport function buildSuggestionUrl(path: string, opts: SuggestionUrlOptions = {}): string {\n const qs = new URLSearchParams()\n const { entityType, entityId } = opts\n if (entityType && entityId !== undefined && entityId !== null && entityId !== '') {\n qs.set('entityType', entityType)\n qs.set('entityId', String(entityId))\n }\n if (opts.count !== undefined) qs.set('count', String(opts.count))\n for (const [key, value] of Object.entries(opts.extraParams ?? {})) {\n if (value !== undefined && value !== '') qs.set(key, value)\n }\n const query = qs.toString()\n return `${opts.apiBaseUrl ?? ''}${path}${query ? `?${query}` : ''}`\n}\n","\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronUp, ChevronDown } from \"lucide-react\"\nimport { cn } from \"../../utils/cn\"\n\ninterface ChevronButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n direction?: 'up' | 'down';\n size?: 'sm' | 'md' | 'lg';\n isExpanded?: boolean;\n backgroundColor?: string;\n borderColor?: string;\n}\n\nconst ChevronButton = React.forwardRef<HTMLButtonElement, ChevronButtonProps>(\n ({ className, direction = 'down', size = 'md', isExpanded, backgroundColor, borderColor, ...props }, ref) => {\n const Icon = (isExpanded ? ChevronUp : ChevronDown) || (direction === 'up' ? ChevronUp : ChevronDown);\n const sizeClasses = {\n sm: 'h-4 w-4',\n md: 'h-5 w-5', \n lg: 'h-6 w-6'\n };\n\n return (\n <button\n className={cn(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n \"h-10 px-4 py-2\",\n className\n )}\n style={{\n backgroundColor: backgroundColor,\n borderColor: borderColor\n }}\n ref={ref}\n {...props}\n >\n <Icon className={sizeClasses[size]} />\n </button>\n )\n }\n)\nChevronButton.displayName = \"ChevronButton\"\n\nexport { ChevronButton }"]}
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkNE2DYD6Kcjs = require('./chunk-NE2DYD6K.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk27VVOBDBcjs = require('./chunk-27VVOBDB.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkGRTZ23GLcjs = require('./chunk-GRTZ23GL.cjs');
|
|
23
23
|
|
|
24
24
|
// src/components/contact/contact-form.tsx
|
|
25
25
|
var _react = require('react');
|
|
@@ -108,7 +108,7 @@ function ContactForm({
|
|
|
108
108
|
successRedirectUrl = "/blog#community",
|
|
109
109
|
successToastMessage = "Redirecting you to join our community..."
|
|
110
110
|
} = {}) {
|
|
111
|
-
const attachments =
|
|
111
|
+
const attachments = _chunkNE2DYD6Kcjs.useChatAttachments.call(void 0, );
|
|
112
112
|
const builtInSubmission = _chunk27VVOBDBcjs.useContactSubmission.call(void 0, {
|
|
113
113
|
userId,
|
|
114
114
|
successRedirectUrl,
|
|
@@ -190,11 +190,11 @@ function ContactForm({
|
|
|
190
190
|
!showEmail && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { type: "hidden", ...register("email") }),
|
|
191
191
|
!showHelpCategory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { type: "hidden", ...register("helpCategory") }),
|
|
192
192
|
!showMessage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { type: "hidden", ...register("message") }),
|
|
193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
193
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.HoneypotField, { ...honeypotInputProps }),
|
|
194
194
|
extraTopField,
|
|
195
195
|
showNameEmailRow && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6", children: [
|
|
196
196
|
showName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
197
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
197
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNE2DYD6Kcjs.Label, { htmlFor: "name", children: [
|
|
198
198
|
"Your Name",
|
|
199
199
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-ods-accent", children: "*" })
|
|
200
200
|
] }),
|
|
@@ -213,7 +213,7 @@ function ContactForm({
|
|
|
213
213
|
errors.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id: "name-error", className: "text-ods-error text-xs font-['DM_Sans'] mt-1", children: errors.name.message })
|
|
214
214
|
] }),
|
|
215
215
|
showEmail && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
216
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
216
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNE2DYD6Kcjs.Label, { htmlFor: "email", children: [
|
|
217
217
|
"Email",
|
|
218
218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-ods-accent", children: "*" })
|
|
219
219
|
] }),
|
|
@@ -234,46 +234,46 @@ function ContactForm({
|
|
|
234
234
|
] }),
|
|
235
235
|
(showCompanySize || showReferralSource) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6", children: [
|
|
236
236
|
showCompanySize && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.Label, { htmlFor: "companySize", children: "Company Size" }),
|
|
238
238
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
239
239
|
_reacthookform.Controller,
|
|
240
240
|
{
|
|
241
241
|
control,
|
|
242
242
|
name: "companySize",
|
|
243
|
-
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
243
|
+
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNE2DYD6Kcjs.Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
|
|
244
244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
245
|
-
|
|
245
|
+
_chunkNE2DYD6Kcjs.SelectTrigger,
|
|
246
246
|
{
|
|
247
247
|
id: "companySize",
|
|
248
248
|
"aria-label": "Company Size",
|
|
249
249
|
className: "bg-ods-card border-ods-border text-ods-text-primary h-12 px-3",
|
|
250
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
250
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectValue, { placeholder: "Select company size" })
|
|
251
251
|
}
|
|
252
252
|
),
|
|
253
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
253
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectContent, { children: companySizeOptions.map((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectItem, { value: opt, children: opt }, opt)) })
|
|
254
254
|
] })
|
|
255
255
|
}
|
|
256
256
|
),
|
|
257
257
|
errors.companySize && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id: "companySize-error", className: "text-ods-error text-xs font-['DM_Sans'] mt-1", children: errors.companySize.message })
|
|
258
258
|
] }),
|
|
259
259
|
showReferralSource && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
260
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
260
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.Label, { htmlFor: "referralSource", children: "How did you hear about us?" }),
|
|
261
261
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
262
262
|
_reacthookform.Controller,
|
|
263
263
|
{
|
|
264
264
|
control,
|
|
265
265
|
name: "referralSource",
|
|
266
|
-
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
266
|
+
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNE2DYD6Kcjs.Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
|
|
267
267
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
|
-
|
|
268
|
+
_chunkNE2DYD6Kcjs.SelectTrigger,
|
|
269
269
|
{
|
|
270
270
|
id: "referralSource",
|
|
271
271
|
"aria-label": "Referral Source",
|
|
272
272
|
className: "bg-ods-card border-ods-border text-ods-text-primary h-12 px-3",
|
|
273
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
273
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectValue, { placeholder: "Select an option" })
|
|
274
274
|
}
|
|
275
275
|
),
|
|
276
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectContent, { children: referralSourceOptions.map((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectItem, { value: opt, children: opt }, opt)) })
|
|
277
277
|
] })
|
|
278
278
|
}
|
|
279
279
|
),
|
|
@@ -281,7 +281,7 @@ function ContactForm({
|
|
|
281
281
|
] })
|
|
282
282
|
] }),
|
|
283
283
|
showHelpCategory && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
284
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
284
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNE2DYD6Kcjs.Label, { htmlFor: "helpCategory", children: [
|
|
285
285
|
"Choose your main interest",
|
|
286
286
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-ods-accent", children: "*" })
|
|
287
287
|
] }),
|
|
@@ -290,29 +290,29 @@ function ContactForm({
|
|
|
290
290
|
{
|
|
291
291
|
control,
|
|
292
292
|
name: "helpCategory",
|
|
293
|
-
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
293
|
+
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNE2DYD6Kcjs.Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
|
|
294
294
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
295
|
-
|
|
295
|
+
_chunkNE2DYD6Kcjs.SelectTrigger,
|
|
296
296
|
{
|
|
297
297
|
id: "helpCategory",
|
|
298
298
|
"aria-label": "Help Category",
|
|
299
299
|
className: "bg-ods-card border-ods-border text-ods-text-primary h-12 px-3",
|
|
300
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
300
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectValue, { placeholder: "Choose your main interest" })
|
|
301
301
|
}
|
|
302
302
|
),
|
|
303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectContent, { children: helpCategoryOptions.map((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNE2DYD6Kcjs.SelectItem, { value: opt, children: opt }, opt)) })
|
|
304
304
|
] })
|
|
305
305
|
}
|
|
306
306
|
),
|
|
307
307
|
errors.helpCategory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id: "helpCategory-error", className: "text-ods-error text-xs font-['DM_Sans'] mt-1", children: errors.helpCategory.message })
|
|
308
308
|
] }),
|
|
309
309
|
showMessage && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col flex-grow", children: [
|
|
310
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
310
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNE2DYD6Kcjs.Label, { htmlFor: "message", children: [
|
|
311
311
|
"Your Message",
|
|
312
312
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-ods-accent", children: "*" })
|
|
313
313
|
] }),
|
|
314
314
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
315
|
-
|
|
315
|
+
_chunkNE2DYD6Kcjs.Textarea,
|
|
316
316
|
{
|
|
317
317
|
id: "message",
|
|
318
318
|
...register("message"),
|
|
@@ -326,7 +326,7 @@ function ContactForm({
|
|
|
326
326
|
] }),
|
|
327
327
|
attachmentsEnabled && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2", children: [
|
|
328
328
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
329
|
-
|
|
329
|
+
_chunkNE2DYD6Kcjs.ChatAttachmentChipStrip,
|
|
330
330
|
{
|
|
331
331
|
attachments: attachments.attachments,
|
|
332
332
|
onRemove: attachments.removeAttachment,
|
|
@@ -335,7 +335,7 @@ function ContactForm({
|
|
|
335
335
|
),
|
|
336
336
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
337
337
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
338
|
-
|
|
338
|
+
_chunkNE2DYD6Kcjs.ChatAttachmentAddButton,
|
|
339
339
|
{
|
|
340
340
|
attachmentsEnabled: true,
|
|
341
341
|
attachmentsCount: attachments.attachments.length,
|
|
@@ -371,4 +371,4 @@ function ContactForm({
|
|
|
371
371
|
|
|
372
372
|
|
|
373
373
|
exports.ContactForm = ContactForm;
|
|
374
|
-
//# sourceMappingURL=chunk-
|
|
374
|
+
//# sourceMappingURL=chunk-SI4LEFLR.cjs.map
|