@uptrademedia/site-kit 1.0.28 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/{chunk-FRSN2JKU.js → chunk-6NTMCSHP.js} +15 -18
  2. package/dist/chunk-6NTMCSHP.js.map +1 -0
  3. package/dist/{chunk-WMOA3332.js → chunk-FOBATMSH.js} +70 -55
  4. package/dist/chunk-FOBATMSH.js.map +1 -0
  5. package/dist/{chunk-K2PERQLP.mjs → chunk-MLY7AWHG.mjs} +70 -55
  6. package/dist/chunk-MLY7AWHG.mjs.map +1 -0
  7. package/dist/{chunk-HHAJAANV.mjs → chunk-QY7CDW6P.mjs} +189 -34
  8. package/dist/chunk-QY7CDW6P.mjs.map +1 -0
  9. package/dist/{chunk-JOAULVQB.mjs → chunk-WG2SI2UN.mjs} +15 -18
  10. package/dist/chunk-WG2SI2UN.mjs.map +1 -0
  11. package/dist/{chunk-RM4XFDE6.js → chunk-ZGT5ZYQ5.js} +189 -34
  12. package/dist/chunk-ZGT5ZYQ5.js.map +1 -0
  13. package/dist/commerce/index.d.mts +1 -1
  14. package/dist/commerce/index.d.ts +1 -1
  15. package/dist/commerce/index.js +39 -39
  16. package/dist/commerce/index.mjs +1 -1
  17. package/dist/index.d.mts +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +39 -35
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +15 -11
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/{routing-D6bSzuw-.d.ts → routing-CHmSC8p0.d.ts} +1 -1
  24. package/dist/{routing-nObgWX16.d.mts → routing-Cy9vtQq8.d.mts} +1 -1
  25. package/dist/seo/index.d.mts +28 -28
  26. package/dist/seo/index.d.ts +28 -28
  27. package/dist/seo/index.js +96 -245
  28. package/dist/seo/index.js.map +1 -1
  29. package/dist/seo/index.mjs +25 -224
  30. package/dist/seo/index.mjs.map +1 -1
  31. package/dist/seo/register-sitemap-cli.js +3 -3
  32. package/dist/seo/register-sitemap-cli.mjs +2 -2
  33. package/dist/seo/server.d.mts +2 -2
  34. package/dist/seo/server.d.ts +2 -2
  35. package/dist/seo/server.js +185 -44
  36. package/dist/seo/server.js.map +1 -1
  37. package/dist/seo/server.mjs +183 -2
  38. package/dist/seo/server.mjs.map +1 -1
  39. package/dist/{api-EXKDAYGB.mjs → server-api-3HJLLZB7.mjs} +3 -3
  40. package/dist/server-api-3HJLLZB7.mjs.map +1 -0
  41. package/dist/{api-HBENRDUH.js → server-api-RM25RPFH.js} +20 -20
  42. package/dist/server-api-RM25RPFH.js.map +1 -0
  43. package/dist/{types-Cb9d3lkc.d.mts → types-CwyWiHtq.d.mts} +22 -11
  44. package/dist/{types-Cb9d3lkc.d.ts → types-CwyWiHtq.d.ts} +22 -11
  45. package/package.json +1 -1
  46. package/dist/api-EXKDAYGB.mjs.map +0 -1
  47. package/dist/api-HBENRDUH.js.map +0 -1
  48. package/dist/chunk-FRSN2JKU.js.map +0 -1
  49. package/dist/chunk-HHAJAANV.mjs.map +0 -1
  50. package/dist/chunk-JOAULVQB.mjs.map +0 -1
  51. package/dist/chunk-K2PERQLP.mjs.map +0 -1
  52. package/dist/chunk-RM4XFDE6.js.map +0 -1
  53. package/dist/chunk-WMOA3332.js.map +0 -1
@@ -1,207 +1,15 @@
1
1
  export { SitemapSync } from '../chunk-WPSRS352.mjs';
2
- export { generateSitemap, getRedirect, getRobotsDirective, isIndexable } from '../chunk-JOAULVQB.mjs';
3
- import { getSchemaMarkups, getSEOPageData, getEntityEnhancedSchema, getFAQData, getInternalLinks, getContentBlock, getEntities, getManagedScripts } from '../chunk-K2PERQLP.mjs';
2
+ export { generateSitemap, getRedirect, getRobotsDirective, isIndexable } from '../chunk-WG2SI2UN.mjs';
3
+ import { getSEOPageData, getABTest, recordABImpression, getSchemaMarkups, getEntityEnhancedSchema, getFAQData, getInternalLinks, getContentBlock, getEntities, getManagedScripts } from '../chunk-MLY7AWHG.mjs';
4
+ export { getABTest, getContentBlock, getEntities, getEntityEnhancedSchema, getFAQData, getInternalLinks, getManagedScripts, getPrimaryEntity, getRedirectData, getRobotsData, getSEOPageData, getSchemaMarkups, getSitemapEntries, getVisibilityScore, getVisibilitySummary, recordABImpression, registerSitemap } from '../chunk-MLY7AWHG.mjs';
4
5
  import '../chunk-4XPGGLVP.mjs';
5
- import { cache } from 'react';
6
- import 'server-only';
7
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
-
9
- function getSecureApiConfig() {
10
- const apiUrl = process.env.UPTRADE_API_URL || process.env.NEXT_PUBLIC_UPTRADE_API_URL || "https://api.uptrademedia.com";
11
- const apiKey = process.env.UPTRADE_API_KEY || process.env.NEXT_PUBLIC_UPTRADE_API_KEY || "";
12
- const projectId = process.env.UPTRADE_PROJECT_ID || process.env.NEXT_PUBLIC_UPTRADE_PROJECT_ID || "";
13
- if (!apiKey) {
14
- throw new Error("@uptrade/seo: UPTRADE_API_KEY or NEXT_PUBLIC_UPTRADE_API_KEY environment variable is required for server-side SEO functions");
15
- }
16
- return { apiUrl, apiKey, projectId };
17
- }
18
- async function secureApiPost(endpoint, body = {}) {
19
- const { apiUrl, apiKey } = getSecureApiConfig();
20
- try {
21
- const response = await fetch(`${apiUrl}${endpoint}`, {
22
- method: "POST",
23
- headers: {
24
- "Content-Type": "application/json",
25
- "x-api-key": apiKey
26
- },
27
- body: JSON.stringify(body),
28
- next: { revalidate: 60 }
29
- // Cache for 60 seconds
30
- });
31
- if (!response.ok) {
32
- console.error(`@uptrade/seo: API error ${response.status}: ${response.statusText}`);
33
- return null;
34
- }
35
- return await response.json();
36
- } catch (error) {
37
- console.error("@uptrade/seo: Network error:", error);
38
- return null;
39
- }
40
- }
41
- var getSEOPageData2 = cache(async (projectId, path) => {
42
- const result = await secureApiPost("/api/public/seo/page", {
43
- projectId,
44
- path
45
- });
46
- return {
47
- page: result?.page || null,
48
- project: result?.project || null
49
- };
50
- });
51
- var getSchemaMarkups2 = cache(async (projectId, path, options) => {
52
- const result = await secureApiPost("/api/public/seo/schemas", {
53
- projectId,
54
- path,
55
- includeTypes: options?.includeTypes,
56
- excludeTypes: options?.excludeTypes
57
- });
58
- return result?.schemas || [];
59
- });
60
- var getFAQData2 = cache(async (projectId, path) => {
61
- const result = await secureApiPost("/api/public/seo/faq", {
62
- projectId,
63
- path
64
- });
65
- return result?.faq || null;
66
- });
67
- var getInternalLinks2 = cache(async (projectId, sourcePath, options) => {
68
- const result = await secureApiPost("/api/public/seo/internal-links", {
69
- projectId,
70
- sourcePath,
71
- position: options?.position,
72
- limit: options?.limit
73
- });
74
- return result?.links || [];
75
- });
76
- var getContentBlock2 = cache(async (projectId, path, section) => {
77
- const result = await secureApiPost("/api/public/seo/content", {
78
- projectId,
79
- path,
80
- section
81
- });
82
- return result?.content || null;
83
- });
84
- var getABTest = cache(async (projectId, path, field) => {
85
- const result = await secureApiPost("/api/public/seo/ab-test", {
86
- projectId,
87
- path,
88
- field
89
- });
90
- return result?.test || null;
91
- });
92
- async function recordABImpression(testId, variant, sessionId) {
93
- await secureApiPost("/api/public/seo/ab-impression", { testId, variant, sessionId });
94
- }
95
- var getRedirectData = cache(async (projectId, path) => {
96
- const result = await secureApiPost("/api/public/seo/redirect", {
97
- projectId,
98
- path
99
- });
100
- return result?.redirect || null;
101
- });
102
- var getManagedScripts2 = cache(async (projectId, position, currentPath) => {
103
- const result = await secureApiPost("/api/public/seo/scripts", {
104
- projectId,
105
- position,
106
- currentPath
107
- });
108
- return result?.scripts || [];
109
- });
110
- var getRobotsData = cache(async (projectId, path) => {
111
- const result = await secureApiPost("/api/public/seo/page", {
112
- projectId,
113
- path
114
- });
115
- return result?.page?.managed_robots || null;
116
- });
117
- var getSitemapEntries = cache(async (projectId, options) => {
118
- const result = await secureApiPost("/api/public/seo/sitemap", {
119
- projectId,
120
- publishedOnly: options?.publishedOnly
121
- });
122
- return result?.entries || [];
123
- });
124
- async function registerSitemap(entries) {
125
- const { apiUrl, apiKey, projectId } = getSecureApiConfig();
126
- try {
127
- const response = await fetch(`${apiUrl}/api/public/seo/register-sitemap`, {
128
- method: "POST",
129
- headers: {
130
- "Content-Type": "application/json",
131
- "x-api-key": apiKey
132
- },
133
- body: JSON.stringify({ projectId, entries })
134
- });
135
- if (!response.ok) {
136
- console.error(`@uptrade/seo: Sitemap registration failed: ${response.statusText}`);
137
- return { success: false, created: 0, updated: 0 };
138
- }
139
- return await response.json();
140
- } catch (error) {
141
- console.error("@uptrade/seo: Sitemap registration error:", error);
142
- return { success: false, created: 0, updated: 0 };
143
- }
144
- }
145
- function getSignalApiConfig() {
146
- const apiUrl = process.env.SIGNAL_API_URL || process.env.NEXT_PUBLIC_SIGNAL_API_URL || "https://signal.uptrademedia.com";
147
- const apiKey = process.env.UPTRADE_API_KEY || "";
148
- return { apiUrl, apiKey };
149
- }
150
- async function signalApiGet(endpoint) {
151
- const { apiUrl, apiKey } = getSignalApiConfig();
152
- if (!apiKey) {
153
- return null;
154
- }
155
- try {
156
- const response = await fetch(`${apiUrl}${endpoint}`, {
157
- method: "GET",
158
- headers: {
159
- "Content-Type": "application/json",
160
- "x-api-key": apiKey
161
- },
162
- next: { revalidate: 300 }
163
- // Cache for 5 minutes
164
- });
165
- if (!response.ok) {
166
- return null;
167
- }
168
- const result = await response.json();
169
- return result?.data || result;
170
- } catch (error) {
171
- console.error("@uptrade/seo: Signal API error:", error);
172
- return null;
173
- }
174
- }
175
- var getEntities2 = cache(async (projectId, options) => {
176
- let endpoint = `/skills/seo/entities/${projectId}`;
177
- if (options?.type) {
178
- endpoint += `?type=${options.type}`;
179
- }
180
- const result = await signalApiGet(endpoint);
181
- return result || [];
182
- });
183
- var getPrimaryEntity = cache(async (projectId) => {
184
- return signalApiGet(`/skills/seo/entities/${projectId}/primary`);
185
- });
186
- var getEntityEnhancedSchema2 = cache(async (projectId, pagePath) => {
187
- const result = await signalApiGet(
188
- `/skills/seo/schema/${projectId}/entity-enhanced?pagePath=${encodeURIComponent(pagePath)}`
189
- );
190
- return result?.schemas || [];
191
- });
192
- var getVisibilityScore = cache(async (projectId, pagePath) => {
193
- const result = await signalApiGet(`/skills/seo/visibility/${projectId}`);
194
- if (!result) return null;
195
- return result.find((s) => s.page_path === pagePath) || null;
196
- });
197
- var getVisibilitySummary = cache(async (projectId) => {
198
- return signalApiGet(`/skills/seo/visibility/${projectId}/summary`);
199
- });
7
+ import { cache } from 'react';
200
8
 
201
9
  // src/seo/getManagedMetadata.ts
202
10
  async function getManagedMetadata(options) {
203
- const { projectId, path, fallback = {}, overrides = {} } = options;
204
- const result = await getSEOPageData2(projectId, path);
11
+ const { path, fallback = {}, overrides = {} } = options;
12
+ const result = await getSEOPageData(path);
205
13
  const pageData = result?.page;
206
14
  const projectData = result?.project;
207
15
  if (!pageData) {
@@ -279,8 +87,8 @@ async function getManagedMetadata(options) {
279
87
  };
280
88
  }
281
89
  async function getABVariant(options) {
282
- const { projectId, path, field, sessionId } = options;
283
- const test = await getABTest(projectId, path, field);
90
+ const { path, field, sessionId } = options;
91
+ const test = await getABTest(path, field);
284
92
  if (!test) {
285
93
  return null;
286
94
  }
@@ -305,7 +113,6 @@ async function getManagedMetadataWithAB(options) {
305
113
  const { sessionId, ...metadataOptions } = options;
306
114
  const metadata = await getManagedMetadata(metadataOptions);
307
115
  const titleTest = await getABVariant({
308
- projectId: options.projectId,
309
116
  path: options.path,
310
117
  field: "title",
311
118
  sessionId
@@ -314,7 +121,6 @@ async function getManagedMetadataWithAB(options) {
314
121
  metadata.title = titleTest.value;
315
122
  }
316
123
  const descTest = await getABVariant({
317
- projectId: options.projectId,
318
124
  path: options.path,
319
125
  field: "description",
320
126
  sessionId
@@ -332,7 +138,6 @@ var DEFAULT_SPEAKABLE_SELECTORS = [
332
138
  '.aeo-block[data-speakable="true"]'
333
139
  ];
334
140
  async function ManagedSchema({
335
- projectId,
336
141
  path,
337
142
  additionalSchemas = [],
338
143
  includeTypes,
@@ -343,20 +148,21 @@ async function ManagedSchema({
343
148
  pageUrl,
344
149
  includeEntityGraph = false
345
150
  }) {
346
- const schemas = await getSchemaMarkups(projectId, path, {
151
+ const schemas = await getSchemaMarkups(path, {
347
152
  includeTypes,
348
153
  excludeTypes
349
154
  });
350
- const pageData = await getSEOPageData(projectId, path);
155
+ const pageData = await getSEOPageData(path);
351
156
  let entitySchemas = [];
352
157
  if (includeEntityGraph) {
353
- entitySchemas = await getEntityEnhancedSchema(projectId, path);
158
+ entitySchemas = await getEntityEnhancedSchema(path);
354
159
  }
160
+ const page = pageData?.page;
355
161
  const allSchemas = [
356
162
  ...entitySchemas,
357
163
  ...schemas.map((s) => s.schema_json),
358
164
  // Include auto-generated schema from Signal meta optimization
359
- ...pageData?.managed_schema ? [pageData.managed_schema] : [],
165
+ ...page?.managed_schema ? [page.managed_schema] : [],
360
166
  ...additionalSchemas
361
167
  ];
362
168
  if (speakable && pageName && pageUrl) {
@@ -390,10 +196,9 @@ async function ManagedSchema({
390
196
  );
391
197
  }
392
198
  async function LLMSchema({
393
- projectId,
394
199
  path
395
200
  }) {
396
- const pageData = await getSEOPageData(projectId, path);
201
+ const { page: pageData } = await getSEOPageData(path);
397
202
  if (!pageData?.managed_llm_schema) {
398
203
  return null;
399
204
  }
@@ -593,14 +398,13 @@ function generateFAQSchema(items) {
593
398
  });
594
399
  }
595
400
  async function ManagedFAQ({
596
- projectId,
597
401
  path,
598
402
  className,
599
403
  renderItem,
600
404
  includeSchema = true,
601
405
  showTitle = true
602
406
  }) {
603
- const faqData = await getFAQData(projectId, path);
407
+ const faqData = await getFAQData(path);
604
408
  if (!faqData || !faqData.items?.length) {
605
409
  return null;
606
410
  }
@@ -643,14 +447,13 @@ function DefaultLinkRenderer({ link }) {
643
447
  );
644
448
  }
645
449
  async function ManagedInternalLinks({
646
- projectId,
647
450
  path,
648
451
  position = "bottom",
649
452
  limit = 5,
650
453
  className,
651
454
  renderLink
652
455
  }) {
653
- const links = await getInternalLinks(projectId, path, { position, limit });
456
+ const links = await getInternalLinks(path, { position, limit });
654
457
  if (!links.length) {
655
458
  return null;
656
459
  }
@@ -716,7 +519,6 @@ function getSchemaTypeForEntity(entityType) {
716
519
  return typeMap[entityType] || "Thing";
717
520
  }
718
521
  async function ManagedContent({
719
- projectId,
720
522
  path,
721
523
  section,
722
524
  fallback,
@@ -724,7 +526,7 @@ async function ManagedContent({
724
526
  components = {},
725
527
  injectEntityAnnotations: shouldInjectEntities = false
726
528
  }) {
727
- const block = await getContentBlock(projectId, path, section);
529
+ const block = await getContentBlock(path, section);
728
530
  if (!block) {
729
531
  if (fallback) {
730
532
  return /* @__PURE__ */ jsx(Fragment, { children: fallback });
@@ -734,7 +536,7 @@ async function ManagedContent({
734
536
  let entities = [];
735
537
  if (shouldInjectEntities) {
736
538
  try {
737
- entities = await getEntities(projectId);
539
+ entities = await getEntities();
738
540
  } catch (err) {
739
541
  console.warn("@uptrade/seo: Failed to fetch entities for annotation:", err);
740
542
  }
@@ -794,15 +596,14 @@ async function ManagedContent({
794
596
  return fallback ? /* @__PURE__ */ jsx(Fragment, { children: fallback }) : null;
795
597
  }
796
598
  }
797
- async function getManagedContentData(projectId, path, section) {
798
- return getContentBlock(projectId, path, section);
599
+ async function getManagedContentData(path, section) {
600
+ return getContentBlock(path, section);
799
601
  }
800
602
  async function ManagedScripts({
801
- projectId,
802
603
  position,
803
604
  path
804
605
  }) {
805
- const scripts = await getManagedScripts(projectId, position, path);
606
+ const scripts = await getManagedScripts(position, path);
806
607
  if (!scripts.length) {
807
608
  return null;
808
609
  }
@@ -811,7 +612,7 @@ async function ManagedScripts({
811
612
  const attrs = {
812
613
  key: script.id,
813
614
  src: script.src,
814
- ...script.async && { async: true },
615
+ async: true,
815
616
  ...script.defer && { defer: true },
816
617
  ...script.attributes
817
618
  };
@@ -820,6 +621,7 @@ async function ManagedScripts({
820
621
  return /* @__PURE__ */ jsx(
821
622
  "script",
822
623
  {
624
+ async: true,
823
625
  dangerouslySetInnerHTML: { __html: script.content || "" },
824
626
  ...script.attributes
825
627
  },
@@ -828,10 +630,9 @@ async function ManagedScripts({
828
630
  }) });
829
631
  }
830
632
  async function ManagedNoScripts({
831
- projectId,
832
633
  path
833
634
  }) {
834
- const scripts = await getManagedScripts(projectId, "body-start", path);
635
+ const scripts = await getManagedScripts("body-start", path);
835
636
  const noscriptContent = scripts.filter((s) => s.attributes?.noscript).map((s) => s.attributes?.noscript).join("");
836
637
  if (!noscriptContent) {
837
638
  return null;
@@ -946,6 +747,6 @@ async function LocationPageContent({
946
747
  }
947
748
  }
948
749
 
949
- export { LLMSchema, LocationPageContent, ManagedContent, ManagedFAQ, ManagedInternalLinks, ManagedNoScripts, ManagedSchema, ManagedScripts, createBreadcrumbSchema, createSchema, ManagedSchema as default, getABTest, getABVariant, getContentBlock2 as getContentBlock, getEntities2 as getEntities, getEntityEnhancedSchema2 as getEntityEnhancedSchema, getFAQData2 as getFAQData, getInternalLinks2 as getInternalLinks, getLocationSection, getManagedContentData, getManagedMetadata, getManagedMetadataWithAB, getManagedScripts2 as getManagedScripts, getPrimaryEntity, getRedirectData, getRobotsData, getSEOPageData2 as getSEOPageData, getSchemaMarkups2 as getSchemaMarkups, getSitemapEntries, getVisibilityScore, getVisibilitySummary, recordABImpression, registerSitemap };
750
+ export { LLMSchema, LocationPageContent, ManagedContent, ManagedFAQ, ManagedInternalLinks, ManagedNoScripts, ManagedSchema, ManagedScripts, createBreadcrumbSchema, createSchema, ManagedSchema as default, getABVariant, getLocationSection, getManagedContentData, getManagedMetadata, getManagedMetadataWithAB };
950
751
  //# sourceMappingURL=index.mjs.map
951
752
  //# sourceMappingURL=index.mjs.map