@cavuno/board 1.26.0 → 1.28.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.
package/dist/seo.mjs ADDED
@@ -0,0 +1,1079 @@
1
+ // src/seo/blog.ts
2
+ function createBlogArticleJsonLd({
3
+ post,
4
+ boardName,
5
+ permalink,
6
+ ogImageUrl
7
+ }) {
8
+ const article = {
9
+ "@context": "https://schema.org",
10
+ "@type": "Article",
11
+ headline: post.title,
12
+ url: permalink,
13
+ mainEntityOfPage: { "@type": "WebPage", "@id": permalink },
14
+ publisher: { "@type": "Organization", name: boardName }
15
+ };
16
+ if (post.customExcerpt) article.description = post.customExcerpt;
17
+ if (post.publishedAt) article.datePublished = post.publishedAt;
18
+ const image = post.coverUrl ?? ogImageUrl;
19
+ if (image) article.image = image;
20
+ const author = post.authors[0];
21
+ if (author) {
22
+ article.author = {
23
+ "@type": "Person",
24
+ name: author.name,
25
+ ...author.websiteUrl ? { url: author.websiteUrl } : {}
26
+ };
27
+ }
28
+ return article;
29
+ }
30
+ function createAuthorProfileJsonLd({
31
+ author,
32
+ canonical,
33
+ description,
34
+ origin,
35
+ posts,
36
+ totalPosts
37
+ }) {
38
+ if (!author.name) {
39
+ return null;
40
+ }
41
+ const normalizedDescription = description.trim();
42
+ const sameAs = [
43
+ normalizeUrl(author.websiteUrl),
44
+ normalizeUrl(author.twitterUrl),
45
+ normalizeUrl(author.linkedinUrl),
46
+ normalizeUrl(author.githubUrl)
47
+ ].filter((value) => Boolean(value));
48
+ const authorId = `${canonical}#profile`;
49
+ const hasPart = posts.slice(0, 5).map((post) => {
50
+ const postUrl = buildAbsoluteUrl(origin, `/blog/${post.slug}`);
51
+ if (!postUrl) {
52
+ return null;
53
+ }
54
+ return {
55
+ "@type": "Article",
56
+ headline: post.title,
57
+ url: postUrl,
58
+ datePublished: post.publishedAt,
59
+ author: { "@id": authorId }
60
+ };
61
+ }).filter((value) => value !== null);
62
+ const agentInteractionStatistic = totalPosts > 0 ? {
63
+ "@type": "InteractionCounter",
64
+ interactionType: "https://schema.org/WriteAction",
65
+ userInteractionCount: totalPosts
66
+ } : void 0;
67
+ const profilePage = {
68
+ "@context": "https://schema.org",
69
+ "@type": "ProfilePage",
70
+ url: canonical,
71
+ mainEntity: {
72
+ "@type": "Person",
73
+ "@id": authorId,
74
+ name: author.name,
75
+ alternateName: author.slug ?? void 0,
76
+ identifier: author.id ?? void 0,
77
+ description: normalizedDescription || void 0,
78
+ image: author.avatarUrl ?? void 0,
79
+ sameAs: sameAs.length > 0 ? sameAs : void 0,
80
+ url: canonical,
81
+ mainEntityOfPage: canonical,
82
+ agentInteractionStatistic
83
+ }
84
+ };
85
+ if (hasPart.length > 0) {
86
+ profilePage.hasPart = hasPart;
87
+ }
88
+ return profilePage;
89
+ }
90
+ function normalizeUrl(value) {
91
+ if (!value) {
92
+ return null;
93
+ }
94
+ const trimmed = value.trim();
95
+ if (!trimmed) {
96
+ return null;
97
+ }
98
+ try {
99
+ const candidate = trimmed.startsWith("http://") || trimmed.startsWith("https://") ? trimmed : `https://${trimmed}`;
100
+ return new URL(candidate).toString();
101
+ } catch {
102
+ return null;
103
+ }
104
+ }
105
+ function buildAbsoluteUrl(origin, path) {
106
+ if (!origin || !path) {
107
+ return null;
108
+ }
109
+ try {
110
+ return new URL(path, origin).toString();
111
+ } catch {
112
+ return null;
113
+ }
114
+ }
115
+
116
+ // src/seo/breadcrumbs.ts
117
+ function createBreadcrumbJsonLd(items, options = {}) {
118
+ const normalizedItems = items.map((item) => {
119
+ const name = item.label?.trim();
120
+ return name ? {
121
+ name,
122
+ href: item.href?.trim() ?? null
123
+ } : null;
124
+ }).filter((item) => !!item);
125
+ if (normalizedItems.length < 2) {
126
+ return null;
127
+ }
128
+ const listItems = normalizedItems.map((item, index) => {
129
+ const resolvedHref = item.href ? resolveBreadcrumbHref(item.href, options.origin ?? null) : null;
130
+ const listItem = {
131
+ "@type": "ListItem",
132
+ position: index + 1,
133
+ name: item.name
134
+ };
135
+ if (resolvedHref) {
136
+ listItem.item = resolvedHref;
137
+ }
138
+ return listItem;
139
+ });
140
+ return {
141
+ "@context": "https://schema.org",
142
+ "@type": "BreadcrumbList",
143
+ itemListElement: listItems
144
+ };
145
+ }
146
+ function resolveBreadcrumbHref(href, origin) {
147
+ if (isAbsoluteUrl(href)) {
148
+ return href;
149
+ }
150
+ if (!origin) {
151
+ return null;
152
+ }
153
+ const normalizedPath = href.startsWith("/") ? href : `/${href}`;
154
+ return `${origin}${normalizedPath}`;
155
+ }
156
+ function isAbsoluteUrl(href) {
157
+ return /^https?:\/\//i.test(href);
158
+ }
159
+
160
+ // src/seo/job-posting.ts
161
+ var EDUCATION_TO_CREDENTIAL = {
162
+ high_school: "high school",
163
+ associate_degree: "associate degree",
164
+ bachelor_degree: "bachelor degree",
165
+ professional_certificate: "professional certificate",
166
+ postgraduate_degree: "postgraduate degree"
167
+ };
168
+ var EMPLOYMENT_TYPE_TO_GOOGLE = {
169
+ full_time: "FULL_TIME",
170
+ part_time: "PART_TIME",
171
+ contract: "CONTRACTOR",
172
+ internship: "INTERN",
173
+ temporary: "TEMPORARY",
174
+ volunteer: "VOLUNTEER",
175
+ other: "OTHER"
176
+ };
177
+ var SALARY_TIMEFRAME_TO_UNIT = {
178
+ per_year: "YEAR",
179
+ per_month: "MONTH",
180
+ per_week: "WEEK",
181
+ per_day: "DAY",
182
+ per_hour: "HOUR"
183
+ };
184
+ var ALL_COUNTRY_CODES = [
185
+ "AF",
186
+ "AX",
187
+ "AL",
188
+ "DZ",
189
+ "AS",
190
+ "AD",
191
+ "AO",
192
+ "AI",
193
+ "AQ",
194
+ "AG",
195
+ "AR",
196
+ "AM",
197
+ "AW",
198
+ "AU",
199
+ "AT",
200
+ "AZ",
201
+ "BS",
202
+ "BH",
203
+ "BD",
204
+ "BB",
205
+ "BY",
206
+ "BE",
207
+ "BZ",
208
+ "BJ",
209
+ "BM",
210
+ "BT",
211
+ "BO",
212
+ "BA",
213
+ "BW",
214
+ "BV",
215
+ "BR",
216
+ "IO",
217
+ "VG",
218
+ "BN",
219
+ "BG",
220
+ "BF",
221
+ "BI",
222
+ "KH",
223
+ "CM",
224
+ "CA",
225
+ "CV",
226
+ "BQ",
227
+ "KY",
228
+ "CF",
229
+ "TD",
230
+ "CL",
231
+ "CN",
232
+ "CX",
233
+ "CC",
234
+ "CO",
235
+ "KM",
236
+ "CK",
237
+ "CR",
238
+ "HR",
239
+ "CU",
240
+ "CW",
241
+ "CY",
242
+ "CZ",
243
+ "DK",
244
+ "DJ",
245
+ "DM",
246
+ "DO",
247
+ "CD",
248
+ "EC",
249
+ "EG",
250
+ "SV",
251
+ "GQ",
252
+ "ER",
253
+ "EE",
254
+ "SZ",
255
+ "ET",
256
+ "FK",
257
+ "FO",
258
+ "FJ",
259
+ "FI",
260
+ "FR",
261
+ "GF",
262
+ "PF",
263
+ "TF",
264
+ "GA",
265
+ "GM",
266
+ "GE",
267
+ "DE",
268
+ "GH",
269
+ "GI",
270
+ "GR",
271
+ "GL",
272
+ "GD",
273
+ "GP",
274
+ "GU",
275
+ "GT",
276
+ "GG",
277
+ "GN",
278
+ "GW",
279
+ "GY",
280
+ "HT",
281
+ "HM",
282
+ "HN",
283
+ "HK",
284
+ "HU",
285
+ "IS",
286
+ "IN",
287
+ "ID",
288
+ "IR",
289
+ "IQ",
290
+ "IE",
291
+ "IM",
292
+ "IL",
293
+ "IT",
294
+ "CI",
295
+ "JM",
296
+ "JP",
297
+ "JE",
298
+ "JO",
299
+ "KZ",
300
+ "KE",
301
+ "KI",
302
+ "XK",
303
+ "KW",
304
+ "KG",
305
+ "LA",
306
+ "LV",
307
+ "LB",
308
+ "LS",
309
+ "LR",
310
+ "LY",
311
+ "LI",
312
+ "LT",
313
+ "LU",
314
+ "MO",
315
+ "MG",
316
+ "MW",
317
+ "MY",
318
+ "MV",
319
+ "ML",
320
+ "MT",
321
+ "MH",
322
+ "MQ",
323
+ "MR",
324
+ "MU",
325
+ "YT",
326
+ "MX",
327
+ "FM",
328
+ "MD",
329
+ "MC",
330
+ "MN",
331
+ "ME",
332
+ "MS",
333
+ "MA",
334
+ "MZ",
335
+ "MM",
336
+ "NA",
337
+ "NR",
338
+ "NP",
339
+ "NL",
340
+ "NC",
341
+ "NZ",
342
+ "NI",
343
+ "NE",
344
+ "NG",
345
+ "NU",
346
+ "NF",
347
+ "MK",
348
+ "MP",
349
+ "NO",
350
+ "OM",
351
+ "PK",
352
+ "PW",
353
+ "PS",
354
+ "PA",
355
+ "PG",
356
+ "PY",
357
+ "PE",
358
+ "PH",
359
+ "PN",
360
+ "PL",
361
+ "PT",
362
+ "PR",
363
+ "QA",
364
+ "CG",
365
+ "RE",
366
+ "RO",
367
+ "RU",
368
+ "RW",
369
+ "BL",
370
+ "SH",
371
+ "KN",
372
+ "LC",
373
+ "MF",
374
+ "PM",
375
+ "VC",
376
+ "WS",
377
+ "SM",
378
+ "ST",
379
+ "SA",
380
+ "SN",
381
+ "RS",
382
+ "SC",
383
+ "SL",
384
+ "SG",
385
+ "SX",
386
+ "SK",
387
+ "SI",
388
+ "SB",
389
+ "SO",
390
+ "ZA",
391
+ "GS",
392
+ "KR",
393
+ "SS",
394
+ "ES",
395
+ "LK",
396
+ "SD",
397
+ "SR",
398
+ "SJ",
399
+ "SE",
400
+ "CH",
401
+ "SY",
402
+ "TW",
403
+ "TJ",
404
+ "TZ",
405
+ "TH",
406
+ "TL",
407
+ "TG",
408
+ "TK",
409
+ "TO",
410
+ "TT",
411
+ "TN",
412
+ "TR",
413
+ "TM",
414
+ "TC",
415
+ "TV",
416
+ "UG",
417
+ "UA",
418
+ "AE",
419
+ "GB",
420
+ "US",
421
+ "UM",
422
+ "VI",
423
+ "UY",
424
+ "UZ",
425
+ "VU",
426
+ "VA",
427
+ "VE",
428
+ "VN",
429
+ "WF",
430
+ "EH",
431
+ "YE",
432
+ "ZM",
433
+ "ZW"
434
+ ];
435
+ function createJobPostingJsonLd({
436
+ job,
437
+ board,
438
+ shareUrl
439
+ }) {
440
+ const educationRequirements = createEducationRequirements(job);
441
+ const experienceRequirements = createExperienceRequirements(job);
442
+ const jsonLd = pruneJsonLd({
443
+ "@context": "https://schema.org/",
444
+ "@type": "JobPosting",
445
+ title: job.title,
446
+ description: job.description ?? "",
447
+ identifier: createIdentifier(job, board),
448
+ datePosted: toIsoDate(job.publishedAt),
449
+ validThrough: toIsoDate(job.expiresAt),
450
+ employmentType: job.employmentType ? EMPLOYMENT_TYPE_TO_GOOGLE[job.employmentType] ?? "OTHER" : "OTHER",
451
+ hiringOrganization: createHiringOrganization(job, board),
452
+ jobLocation: createJobLocation(job),
453
+ jobLocationType: job.remoteOption === "remote" ? "TELECOMMUTE" : void 0,
454
+ applicantLocationRequirements: job.remoteOption === "remote" ? createApplicantLocationRequirements(job) : null,
455
+ baseSalary: createBaseSalary(job),
456
+ educationRequirements,
457
+ experienceRequirements,
458
+ experienceInPlaceOfEducation: job.experienceInPlaceOfEducation === true && educationRequirements && experienceRequirements ? true : void 0,
459
+ url: shareUrl
460
+ });
461
+ if (!jsonLd || Array.isArray(jsonLd) || Object.keys(jsonLd).length === 0) {
462
+ return null;
463
+ }
464
+ return jsonLd;
465
+ }
466
+ function createIdentifier(job, board) {
467
+ const organizationName = job.company?.name ?? board.name ?? null;
468
+ const identifier = { "@type": "PropertyValue", value: job.id };
469
+ if (organizationName) identifier.name = organizationName;
470
+ return identifier;
471
+ }
472
+ function createHiringOrganization(job, board) {
473
+ const name = job.company?.name ?? board.name ?? null;
474
+ if (!name) return null;
475
+ const organization = { "@type": "Organization", name };
476
+ const website = job.company?.website ?? null;
477
+ const normalizedWebsite = website ? normalizeWebsiteUrl(website) : null;
478
+ if (normalizedWebsite) organization.sameAs = normalizedWebsite;
479
+ const logo = job.company?.logoUrl ?? board.logoUrl ?? null;
480
+ if (logo) organization.logo = logo;
481
+ return organization;
482
+ }
483
+ function normalizeWebsiteUrl(website) {
484
+ const trimmed = website.trim();
485
+ if (!trimmed) return null;
486
+ return /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
487
+ }
488
+ function createBaseSalary(job) {
489
+ const currency = job.salaryCurrency?.trim();
490
+ const hasMin = typeof job.salaryMin === "number";
491
+ const hasMax = typeof job.salaryMax === "number";
492
+ if (!currency || !hasMin && !hasMax) return null;
493
+ const value = { "@type": "QuantitativeValue" };
494
+ if (hasMin) value.minValue = job.salaryMin;
495
+ if (hasMax) value.maxValue = job.salaryMax;
496
+ const unitText = job.salaryTimeframe ? SALARY_TIMEFRAME_TO_UNIT[job.salaryTimeframe] : void 0;
497
+ if (unitText) value.unitText = unitText;
498
+ if (!hasMin && hasMax && typeof job.salaryMax === "number") {
499
+ value.value = job.salaryMax;
500
+ value.minValue = job.salaryMax;
501
+ } else if (!hasMax && hasMin && typeof job.salaryMin === "number") {
502
+ value.value = job.salaryMin;
503
+ value.maxValue = job.salaryMin;
504
+ }
505
+ return { "@type": "MonetaryAmount", currency: currency.toUpperCase(), value };
506
+ }
507
+ function createJobLocation(job) {
508
+ const places = job.officeLocations.map(
509
+ (office) => createPlaceJsonLd({
510
+ countryCode: office.countryCode,
511
+ region: office.region,
512
+ locality: office.city ?? office.locality,
513
+ postalCode: office.postalCode,
514
+ name: office.displayName
515
+ })
516
+ ).filter((place) => place !== null);
517
+ if (places.length === 0) return null;
518
+ return places.length === 1 ? places[0] : places;
519
+ }
520
+ function createPlaceJsonLd({
521
+ countryCode,
522
+ region,
523
+ locality,
524
+ postalCode,
525
+ name
526
+ }) {
527
+ const address = { "@type": "PostalAddress" };
528
+ const country = countryCode?.trim();
529
+ const reg = region?.trim();
530
+ const loc = locality?.trim();
531
+ const postal = postalCode?.trim();
532
+ const placeName = name?.trim();
533
+ if (country) address.addressCountry = country.toUpperCase();
534
+ if (reg) address.addressRegion = reg;
535
+ if (loc) address.addressLocality = loc;
536
+ if (postal) address.postalCode = postal;
537
+ const hasAddressDetails = Object.keys(address).length > 1;
538
+ if (!hasAddressDetails && !placeName) return null;
539
+ const place = { "@type": "Place" };
540
+ if (placeName) place.name = placeName;
541
+ if (hasAddressDetails) place.address = address;
542
+ return place;
543
+ }
544
+ function createApplicantLocationRequirements(job) {
545
+ if (job.remoteWorldwide) {
546
+ return ALL_COUNTRY_CODES.map((code) => ({
547
+ "@type": "Country",
548
+ name: code
549
+ }));
550
+ }
551
+ const entries = [];
552
+ const seen = /* @__PURE__ */ new Set();
553
+ for (const code of job.remoteWorkPermitCountryCodes ?? []) {
554
+ const normalized = code?.trim().toUpperCase();
555
+ if (!normalized || seen.has(normalized)) continue;
556
+ seen.add(normalized);
557
+ entries.push({ "@type": "Country", name: normalized });
558
+ }
559
+ for (const subdivision of job.remoteWorkPermitSubdivisionCodes ?? []) {
560
+ const countryCode = subdivision?.split("-")[0]?.trim().toUpperCase();
561
+ if (!countryCode || seen.has(countryCode)) continue;
562
+ seen.add(countryCode);
563
+ entries.push({ "@type": "Country", name: countryCode });
564
+ }
565
+ if (entries.length === 0) return null;
566
+ return entries.length === 1 ? entries[0] : entries;
567
+ }
568
+ function createEducationRequirements(job) {
569
+ const requirements = job.educationRequirements;
570
+ if (!requirements || requirements.length === 0) return null;
571
+ if (requirements.includes("no_requirements")) return "no requirements";
572
+ const credentials = requirements.filter((value) => value in EDUCATION_TO_CREDENTIAL).map((value) => ({
573
+ "@type": "EducationalOccupationalCredential",
574
+ credentialCategory: EDUCATION_TO_CREDENTIAL[value]
575
+ }));
576
+ return credentials.length > 0 ? credentials : null;
577
+ }
578
+ function createExperienceRequirements(job) {
579
+ const months = job.experienceMonths;
580
+ if (typeof months !== "number") return null;
581
+ if (months === 0) return "no requirements";
582
+ return {
583
+ "@type": "OccupationalExperienceRequirements",
584
+ monthsOfExperience: months
585
+ };
586
+ }
587
+ function toIsoDate(value) {
588
+ if (!value) return null;
589
+ const date = new Date(value);
590
+ if (Number.isNaN(date.getTime())) return null;
591
+ return date.toISOString();
592
+ }
593
+ function pruneJsonLd(value) {
594
+ const keep = (entry) => {
595
+ if (entry == null) return false;
596
+ if (Array.isArray(entry)) return entry.length > 0;
597
+ if (typeof entry === "object")
598
+ return Object.keys(entry).length > 0;
599
+ return true;
600
+ };
601
+ if (Array.isArray(value)) {
602
+ return value.map((entry) => pruneJsonLd(entry)).filter(keep);
603
+ }
604
+ if (value && typeof value === "object") {
605
+ const entries = Object.entries(value).map(([key, entry]) => [key, pruneJsonLd(entry)]).filter(([, entry]) => keep(entry));
606
+ return Object.fromEntries(entries);
607
+ }
608
+ return value;
609
+ }
610
+
611
+ // src/seo/listing.ts
612
+ function listingHead(options) {
613
+ const countPrefix = typeof options.count === "number" ? `${options.count} ` : "";
614
+ const title = `${countPrefix}${options.heading} | ${options.boardName}`;
615
+ const description = `Browse ${countPrefix}${options.heading.toLowerCase()} on ${options.boardName}.`;
616
+ const url = `${options.origin}${options.path}`;
617
+ return {
618
+ meta: [
619
+ { title },
620
+ { name: "description", content: description },
621
+ { property: "og:title", content: title },
622
+ { property: "og:description", content: description },
623
+ { property: "og:type", content: "website" },
624
+ { property: "og:url", content: url }
625
+ ],
626
+ links: [{ rel: "canonical", href: url }]
627
+ };
628
+ }
629
+ function listingJsonLd(options) {
630
+ const jobUrl = (job) => job.company ? `${options.origin}/companies/${job.company.slug}/jobs/${job.slug}` : `${options.origin}/jobs/${job.slug}`;
631
+ const objects = [
632
+ {
633
+ "@context": "https://schema.org",
634
+ // Deliberately NOT createBreadcrumbJsonLd (breadcrumbs.ts): listing trails
635
+ // are code-constructed (never user copy), so the hosted listing page skips
636
+ // the trim/drop-blank/min-2 gate that module transcribes. Same schema.org
637
+ // fragment, different (intentional) semantics — do not unify blindly.
638
+ "@type": "BreadcrumbList",
639
+ itemListElement: options.breadcrumbs.map((crumb, index) => ({
640
+ "@type": "ListItem",
641
+ position: index + 1,
642
+ name: crumb.name,
643
+ ...crumb.path ? { item: `${options.origin}${crumb.path}` } : {}
644
+ }))
645
+ }
646
+ ];
647
+ if (options.jobs && options.jobs.length > 0) {
648
+ objects.push({
649
+ "@context": "https://schema.org",
650
+ "@type": "ItemList",
651
+ itemListElement: options.jobs.map((job, index) => ({
652
+ "@type": "ListItem",
653
+ position: index + 1,
654
+ url: jobUrl(job)
655
+ }))
656
+ });
657
+ }
658
+ return objects;
659
+ }
660
+
661
+ // src/format/salary-lexicon.ts
662
+ var EN = {
663
+ timeframe: {
664
+ per_year: "Yearly",
665
+ per_month: "Monthly",
666
+ per_week: "Weekly",
667
+ per_day: "Daily",
668
+ per_hour: "Hourly"
669
+ },
670
+ rangePrefix: { from: "From", upTo: "Up to" },
671
+ seniority: {
672
+ entry_level: "Entry level",
673
+ associate: "Associate",
674
+ mid_level: "Mid-level",
675
+ senior: "Senior",
676
+ lead: "Lead",
677
+ principal: "Principal",
678
+ director: "Director",
679
+ executive: "Executive"
680
+ },
681
+ frames: {
682
+ entitySalariesTitle: ({ entity, range }) => `${entity} Salaries (${range}/yr)`,
683
+ salariesInPlaceTitle: ({ place, range }) => `Salaries in ${place} (${range}/yr)`,
684
+ salariesInPlaceTitleNoRange: ({ place }) => `Salaries in ${place}`,
685
+ entitySalariesInPlaceTitle: ({ entity, place, range }) => `${entity} Salaries in ${place} (${range}/yr)`,
686
+ companySalariesTitle: ({ company, range }) => `${company} Salaries${range ? ` (${range}/yr)` : ""}`,
687
+ companyCategorySalariesTitle: ({ company, category, range }) => `${company} ${category} Salaries${range ? ` (${range}/yr)` : ""}`,
688
+ professionalsEarn: ({ entity, range, count }) => `${entity} professionals earn ${range}/yr on average across ${count} job postings.`,
689
+ rolesPay: ({ entity, range, count }) => `${entity} roles pay ${range}/yr on average across ${count} job postings.`,
690
+ professionalsInLocationEarn: ({ entity, place, range, count }) => `${entity} professionals in ${place} earn ${range}/yr on average across ${count} job postings.`,
691
+ seniorityRange: ({ lowLabel, lowAmount, highLabel, highAmount }) => `${lowLabel} roles start at ${lowAmount}, ${highLabel} roles reach ${highAmount}.`,
692
+ seniorityRangeWhile: ({ lowLabel, lowAmount, highLabel, highAmount }) => `${lowLabel} salaries start at ${lowAmount}, while ${highLabel} roles reach ${highAmount}.`,
693
+ compareAcrossTopPaying: ({ count }) => `Compare across ${count} top-paying ${count === 1 ? "company" : "companies"}.`,
694
+ compareAcrossTop: ({ count }) => `Compare across ${count} top ${count === 1 ? "company" : "companies"}.`,
695
+ boardWideAverage: ({ entity, range }) => `Board-wide ${entity} average: ${range}/yr.`,
696
+ averageSalaryInCity: ({ place, range, count }) => `Average salary in ${place} is ${range}/yr across ${count} jobs. Browse salary data by title and skill.`,
697
+ browseLocationsInRegion: ({ count, place }) => `Browse salary data across ${count} locations in ${place}. Compare salaries by title, skill, and company.`,
698
+ companyPays: ({ company, range, count }) => `${company} pays ${range}/yr on average across ${count} job postings.`,
699
+ breakdownAcrossCategories: ({ count }) => `Breakdown across ${count} job ${count === 1 ? "category" : "categories"}.`,
700
+ compareWithSimilar: ({ count }) => `Compare with ${count} similar ${count === 1 ? "company" : "companies"}.`,
701
+ salaryInfoFor: ({ company, board }) => `Salary information for ${company} on ${board}.`,
702
+ categoryRolesAtCompanyPay: ({ category, company, range, count }) => `${category} roles at ${company} pay ${range}/yr based on ${count} job postings.`,
703
+ categorySalaryDataFor: ({ category, company, board }) => `${category} salary data for ${company} on ${board}.`
704
+ }
705
+ };
706
+ var DE = {
707
+ timeframe: {
708
+ per_year: "pro Jahr",
709
+ per_month: "pro Monat",
710
+ per_week: "pro Woche",
711
+ per_day: "pro Tag",
712
+ per_hour: "pro Stunde"
713
+ },
714
+ rangePrefix: { from: "ab", upTo: "bis zu" },
715
+ seniority: {
716
+ entry_level: "Entry-Level",
717
+ associate: "Associate",
718
+ mid_level: "Mid-Level",
719
+ senior: "Senior",
720
+ lead: "Lead",
721
+ principal: "Principal",
722
+ director: "Director",
723
+ executive: "F\xFChrungskraft"
724
+ },
725
+ frames: {
726
+ entitySalariesTitle: ({ entity, range }) => `${entity} Geh\xE4lter (${range}/Jahr)`,
727
+ salariesInPlaceTitle: ({ place, range }) => `Geh\xE4lter in ${place} (${range}/Jahr)`,
728
+ salariesInPlaceTitleNoRange: ({ place }) => `Geh\xE4lter in ${place}`,
729
+ entitySalariesInPlaceTitle: ({ entity, place, range }) => `${entity} Geh\xE4lter in ${place} (${range}/Jahr)`,
730
+ companySalariesTitle: ({ company, range }) => `${company} Geh\xE4lter${range ? ` (${range}/Jahr)` : ""}`,
731
+ companyCategorySalariesTitle: ({ company, category, range }) => `${company} ${category} Geh\xE4lter${range ? ` (${range}/Jahr)` : ""}`,
732
+ professionalsEarn: ({ entity, range, count }) => `${entity}-Fachkr\xE4fte verdienen durchschnittlich ${range}/Jahr, basierend auf ${count} Stellenanzeigen.`,
733
+ rolesPay: ({ entity, range, count }) => `${entity}-Positionen werden mit durchschnittlich ${range}/Jahr verg\xFCtet, basierend auf ${count} Stellenanzeigen.`,
734
+ professionalsInLocationEarn: ({ entity, place, range, count }) => `${entity}-Fachkr\xE4fte in ${place} verdienen durchschnittlich ${range}/Jahr, basierend auf ${count} Stellenanzeigen.`,
735
+ seniorityRange: ({ lowLabel, lowAmount, highLabel, highAmount }) => `${lowLabel}-Positionen beginnen bei ${lowAmount}, ${highLabel}-Positionen erreichen ${highAmount}.`,
736
+ seniorityRangeWhile: ({ lowLabel, lowAmount, highLabel, highAmount }) => `${lowLabel}-Geh\xE4lter beginnen bei ${lowAmount}, w\xE4hrend ${highLabel}-Positionen ${highAmount} erreichen.`,
737
+ compareAcrossTopPaying: ({ count }) => `Vergleichen Sie ${count} ${count === 1 ? "bestzahlendes" : "bestzahlende"} Unternehmen.`,
738
+ compareAcrossTop: ({ count }) => `Vergleichen Sie ${count} Top-Unternehmen.`,
739
+ boardWideAverage: ({ entity, range }) => `Gesamtdurchschnitt ${entity}: ${range}/Jahr.`,
740
+ averageSalaryInCity: ({ place, range, count }) => `Das Durchschnittsgehalt in ${place} betr\xE4gt ${range}/Jahr, basierend auf ${count} Stellen. Gehaltsdaten nach Titel und F\xE4higkeiten durchsuchen.`,
741
+ browseLocationsInRegion: ({ count, place }) => `Gehaltsdaten f\xFCr ${count} Standorte in ${place} durchsuchen. Geh\xE4lter nach Titel, F\xE4higkeiten und Unternehmen vergleichen.`,
742
+ companyPays: ({ company, range, count }) => `${company} zahlt durchschnittlich ${range}/Jahr, basierend auf ${count} Stellenanzeigen.`,
743
+ breakdownAcrossCategories: ({ count }) => `Aufschl\xFCsselung \xFCber ${count} Job-${count === 1 ? "Kategorie" : "Kategorien"}.`,
744
+ compareWithSimilar: ({ count }) => `Vergleichen Sie mit ${count} \xE4hnlichen Unternehmen.`,
745
+ salaryInfoFor: ({ company, board }) => `Gehaltsinformationen f\xFCr ${company} auf ${board}.`,
746
+ categoryRolesAtCompanyPay: ({ category, company, range, count }) => `${category}-Positionen bei ${company} werden mit ${range}/Jahr verg\xFCtet, basierend auf ${count} Stellenanzeigen.`,
747
+ categorySalaryDataFor: ({ category, company, board }) => `${category}-Gehaltsdaten f\xFCr ${company} auf ${board}.`
748
+ }
749
+ };
750
+ var LEXICONS = { en: EN, de: DE };
751
+ function getSalaryLexicon(locale) {
752
+ return locale && LEXICONS[locale] || EN;
753
+ }
754
+
755
+ // src/seo/salary.ts
756
+ var compactCurrencyCache = /* @__PURE__ */ new Map();
757
+ function getCompactCurrencyFormatter(language) {
758
+ const cached = compactCurrencyCache.get(language);
759
+ if (cached) return cached;
760
+ const formatter = new Intl.NumberFormat(language, {
761
+ style: "currency",
762
+ currency: "USD",
763
+ notation: "compact",
764
+ compactDisplay: "short",
765
+ minimumFractionDigits: 0,
766
+ maximumFractionDigits: 1
767
+ });
768
+ compactCurrencyCache.set(language, formatter);
769
+ return formatter;
770
+ }
771
+ function formatUsd(locale, value) {
772
+ try {
773
+ return getCompactCurrencyFormatter(locale).format(value);
774
+ } catch {
775
+ if (value >= 1e6) {
776
+ const millions = value / 1e6;
777
+ return `$${millions % 1 === 0 ? millions : millions.toFixed(1)}M`;
778
+ }
779
+ if (value >= 1e3) {
780
+ const thousands = value / 1e3;
781
+ return `$${thousands % 1 === 0 ? thousands : thousands.toFixed(1)}k`;
782
+ }
783
+ return `$${value}`;
784
+ }
785
+ }
786
+ function formatRange(locale, min, max) {
787
+ return `${formatUsd(locale, min)} \u2013 ${formatUsd(locale, max)}`;
788
+ }
789
+ function formatSeniority(locale, value, overrides) {
790
+ if (overrides?.[value]) {
791
+ return overrides[value];
792
+ }
793
+ const lexiconLabel = getSalaryLexicon(locale).seniority[value];
794
+ if (lexiconLabel) {
795
+ return lexiconLabel;
796
+ }
797
+ return value.replace(/_/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
798
+ }
799
+ var SENIORITY_ORDER = [
800
+ "entry_level",
801
+ "associate",
802
+ "mid_level",
803
+ "senior",
804
+ "lead",
805
+ "principal",
806
+ "director",
807
+ "executive"
808
+ ];
809
+ function sortBySeniority(items) {
810
+ return [...items].sort((a, b) => {
811
+ const aIdx = SENIORITY_ORDER.indexOf(
812
+ a.seniority
813
+ );
814
+ const bIdx = SENIORITY_ORDER.indexOf(
815
+ b.seniority
816
+ );
817
+ return (aIdx === -1 ? 999 : aIdx) - (bIdx === -1 ? 999 : bIdx);
818
+ });
819
+ }
820
+ var yearly = {
821
+ unitText: "YEAR",
822
+ duration: "P1Y"
823
+ };
824
+ function distribution(name, currency, minValue, maxValue, stats = {}) {
825
+ return {
826
+ "@type": "MonetaryAmountDistribution",
827
+ name,
828
+ currency,
829
+ minValue,
830
+ maxValue,
831
+ ...stats,
832
+ ...yearly
833
+ };
834
+ }
835
+ function seniorityDistributions(locale, rows, currency, nameFor) {
836
+ return rows.map(
837
+ (row) => distribution(
838
+ nameFor(formatSeniority(locale, row.seniority)),
839
+ currency,
840
+ row.avgSalaryMin,
841
+ row.avgSalaryMax
842
+ )
843
+ );
844
+ }
845
+ function salaryEnvelope(type, name, extra, estimatedSalary) {
846
+ return {
847
+ "@context": "https://schema.org",
848
+ "@type": type,
849
+ name,
850
+ ...extra,
851
+ estimatedSalary
852
+ };
853
+ }
854
+ function buildSalaryFaq(locale, label, overall) {
855
+ if (!overall) return [];
856
+ const range = formatRange(locale, overall.avgMin, overall.avgMax);
857
+ return [
858
+ {
859
+ q: `What is the average salary for ${label}?`,
860
+ a: `The average salary for ${label} is ${range} per year, based on ${overall.jobCount} job ${overall.jobCount === 1 ? "posting" : "postings"} on this board that disclose pay.`
861
+ },
862
+ {
863
+ q: `How is the salary figure for ${label} calculated?`,
864
+ a: `These figures are aggregated from current and recent job postings on this board that disclose pay, then averaged across roles. They are estimates, not guarantees of compensation.`
865
+ }
866
+ ];
867
+ }
868
+ function itemListJsonLd(items) {
869
+ if (items.length === 0) return null;
870
+ return {
871
+ "@context": "https://schema.org",
872
+ "@type": "ItemList",
873
+ numberOfItems: items.length,
874
+ itemListElement: items.map((it, i) => ({
875
+ "@type": "ListItem",
876
+ position: i + 1,
877
+ name: it.name,
878
+ url: it.url
879
+ }))
880
+ };
881
+ }
882
+ function faqJsonLd(faqs) {
883
+ if (faqs.length === 0) return null;
884
+ return {
885
+ "@context": "https://schema.org",
886
+ "@type": "FAQPage",
887
+ mainEntity: faqs.map((f) => ({
888
+ "@type": "Question",
889
+ name: f.q,
890
+ acceptedAnswer: { "@type": "Answer", text: f.a }
891
+ }))
892
+ };
893
+ }
894
+ function titleSalaryJsonLd(locale, d) {
895
+ if (!d.overallSalary) return null;
896
+ return salaryEnvelope("Occupation", d.categoryName, {}, [
897
+ distribution(
898
+ `${d.categoryName} salary (all levels)`,
899
+ d.currency,
900
+ d.overallSalary.avgMin,
901
+ d.overallSalary.avgMax,
902
+ {
903
+ ...d.boardP25Min ? { percentile25: d.boardP25Min } : {},
904
+ ...d.boardP75Max ? { percentile75: d.boardP75Max } : {}
905
+ }
906
+ ),
907
+ ...seniorityDistributions(
908
+ locale,
909
+ d.bySeniority,
910
+ d.currency,
911
+ (label) => `${label} ${d.categoryName}`
912
+ )
913
+ ]);
914
+ }
915
+ function skillSalaryJsonLd(d) {
916
+ if (!d.overallSalary) return null;
917
+ return salaryEnvelope("Occupation", d.skillName, {}, [
918
+ distribution(
919
+ `${d.skillName} salary (all levels)`,
920
+ d.currency,
921
+ d.overallSalary.avgMin,
922
+ d.overallSalary.avgMax,
923
+ {
924
+ median: Math.round(
925
+ (d.overallSalary.medianMin + d.overallSalary.medianMax) / 2
926
+ )
927
+ }
928
+ )
929
+ ]);
930
+ }
931
+ function locationSalaryJsonLd(d) {
932
+ const isCity = d.adminLevel === "city" || d.adminLevel === "locality";
933
+ if (!isCity || !d.overallSalary) return null;
934
+ return salaryEnvelope(
935
+ "Occupation",
936
+ `Average Salary in ${d.placeName}`,
937
+ {
938
+ occupationLocation: {
939
+ "@type": "City",
940
+ name: d.placeName,
941
+ address: { "@type": "PostalAddress", addressCountry: d.countryCode }
942
+ }
943
+ },
944
+ [
945
+ distribution(
946
+ `Average salary in ${d.placeName}`,
947
+ d.currency,
948
+ d.overallSalary.avgMin,
949
+ d.overallSalary.avgMax,
950
+ {
951
+ median: Math.round(
952
+ (d.overallSalary.medianMin + d.overallSalary.medianMax) / 2
953
+ ),
954
+ // Hosted includes these unconditionally, nulls and all.
955
+ percentile25: d.overallSalary.p25Min,
956
+ percentile75: d.overallSalary.p75Max
957
+ }
958
+ )
959
+ ]
960
+ );
961
+ }
962
+ function crossAxisSalaryJsonLd(locale, args) {
963
+ if (!args.overall) return null;
964
+ return salaryEnvelope(
965
+ "Occupation",
966
+ `${args.name} salary in ${args.placeName}`,
967
+ {
968
+ occupationLocation: {
969
+ "@type": "AdministrativeArea",
970
+ name: args.placeName,
971
+ address: {
972
+ "@type": "PostalAddress",
973
+ addressCountry: args.countryCode
974
+ }
975
+ }
976
+ },
977
+ [
978
+ distribution(
979
+ `${args.name} salary in ${args.placeName} (all levels)`,
980
+ args.currency,
981
+ args.overall.avgMin,
982
+ args.overall.avgMax,
983
+ {
984
+ ...args.overall.p25Min ? { percentile25: args.overall.p25Min } : {},
985
+ ...args.overall.p75Max ? { percentile75: args.overall.p75Max } : {}
986
+ }
987
+ ),
988
+ ...seniorityDistributions(
989
+ locale,
990
+ args.bySeniority,
991
+ args.currency,
992
+ (label) => `${label} ${args.name} in ${args.placeName}`
993
+ )
994
+ ]
995
+ );
996
+ }
997
+ function companySalaryJsonLd(locale, d) {
998
+ if (!d.overallSalary) return null;
999
+ return salaryEnvelope(
1000
+ "OccupationAggregationByEmployer",
1001
+ `Jobs at ${d.companyName}`,
1002
+ {
1003
+ sampleSize: d.overallSalary.jobCount,
1004
+ hiringOrganization: { "@type": "Organization", name: d.companyName }
1005
+ },
1006
+ [
1007
+ distribution(
1008
+ "base",
1009
+ d.currency,
1010
+ d.overallSalary.avgMin,
1011
+ d.overallSalary.avgMax,
1012
+ {
1013
+ ...d.boardMedianMin && d.boardMedianMax ? { median: Math.round((d.boardMedianMin + d.boardMedianMax) / 2) } : {},
1014
+ ...d.boardP25Min ? { percentile25: d.boardP25Min } : {},
1015
+ ...d.boardP75Max ? { percentile75: d.boardP75Max } : {}
1016
+ }
1017
+ ),
1018
+ ...seniorityDistributions(
1019
+ locale,
1020
+ d.bySeniority,
1021
+ d.currency,
1022
+ (label) => `${label} salary`
1023
+ )
1024
+ ]
1025
+ );
1026
+ }
1027
+ function companyCategorySalaryJsonLd(locale, d) {
1028
+ if (!d.overallSalary) return null;
1029
+ return salaryEnvelope(
1030
+ "Occupation",
1031
+ `${d.categoryName} at ${d.companyName}`,
1032
+ {
1033
+ occupationalCategory: d.categoryName,
1034
+ hiringOrganization: { "@type": "Organization", name: d.companyName }
1035
+ },
1036
+ [
1037
+ distribution(
1038
+ `${d.categoryName} salary (all levels)`,
1039
+ d.currency,
1040
+ d.overallSalary.avgMin,
1041
+ d.overallSalary.avgMax,
1042
+ {
1043
+ ...d.boardCategoryP25Min ? { percentile25: d.boardCategoryP25Min } : {},
1044
+ ...d.boardCategoryP75Max ? { percentile75: d.boardCategoryP75Max } : {}
1045
+ }
1046
+ ),
1047
+ ...seniorityDistributions(
1048
+ locale,
1049
+ d.bySeniority,
1050
+ d.currency,
1051
+ (label) => `${label} ${d.categoryName}`
1052
+ )
1053
+ ]
1054
+ );
1055
+ }
1056
+ export {
1057
+ ALL_COUNTRY_CODES,
1058
+ SENIORITY_ORDER,
1059
+ buildSalaryFaq,
1060
+ companyCategorySalaryJsonLd,
1061
+ companySalaryJsonLd,
1062
+ createAuthorProfileJsonLd,
1063
+ createBlogArticleJsonLd,
1064
+ createBreadcrumbJsonLd,
1065
+ createJobPostingJsonLd,
1066
+ crossAxisSalaryJsonLd,
1067
+ faqJsonLd,
1068
+ formatRange,
1069
+ formatSeniority,
1070
+ formatUsd,
1071
+ itemListJsonLd,
1072
+ listingHead,
1073
+ listingJsonLd,
1074
+ locationSalaryJsonLd,
1075
+ normalizeWebsiteUrl,
1076
+ skillSalaryJsonLd,
1077
+ sortBySeniority,
1078
+ titleSalaryJsonLd
1079
+ };