@uptrademedia/site-kit 1.0.3 → 1.0.4

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 (77) hide show
  1. package/dist/SetupWizard-Cki06kB0.d.mts +12 -0
  2. package/dist/SetupWizard-Cki06kB0.d.ts +12 -0
  3. package/dist/analytics/index.d.mts +87 -0
  4. package/dist/analytics/index.d.ts +87 -0
  5. package/dist/blog/index.d.mts +24 -0
  6. package/dist/blog/index.d.ts +24 -0
  7. package/dist/{chunk-6EXHT7PS.mjs → chunk-2IHTEKHU.mjs} +5 -3
  8. package/dist/chunk-2IHTEKHU.mjs.map +1 -0
  9. package/dist/{chunk-63JNO4QN.mjs → chunk-DOHML47I.mjs} +2 -2
  10. package/dist/chunk-DOHML47I.mjs.map +1 -0
  11. package/dist/{chunk-YKMCG3DS.js → chunk-GAJLEDRD.js} +5 -3
  12. package/dist/chunk-GAJLEDRD.js.map +1 -0
  13. package/dist/{chunk-PYYEPAHL.js → chunk-K2HWVOEO.js} +2 -2
  14. package/dist/chunk-K2HWVOEO.js.map +1 -0
  15. package/dist/{chunk-JG2K4S2I.js → chunk-O2OHHBUD.js} +9 -9
  16. package/dist/chunk-O2OHHBUD.js.map +1 -0
  17. package/dist/{chunk-P7LGOKGI.mjs → chunk-XQJX252G.mjs} +9 -9
  18. package/dist/chunk-XQJX252G.mjs.map +1 -0
  19. package/dist/commerce/index.d.mts +168 -0
  20. package/dist/commerce/index.d.ts +168 -0
  21. package/dist/commerce/index.js +38 -38
  22. package/dist/commerce/index.mjs +1 -1
  23. package/dist/commerce/server.d.mts +98 -0
  24. package/dist/commerce/server.d.ts +98 -0
  25. package/dist/engage/index.d.mts +27 -0
  26. package/dist/engage/index.d.ts +27 -0
  27. package/dist/forms/index.d.mts +437 -0
  28. package/dist/forms/index.d.ts +437 -0
  29. package/dist/images/index.d.mts +133 -0
  30. package/dist/images/index.d.ts +133 -0
  31. package/dist/images/index.js +8 -8
  32. package/dist/images/index.mjs +1 -1
  33. package/dist/index.d.mts +649 -0
  34. package/dist/index.d.ts +649 -0
  35. package/dist/index.js +46 -46
  36. package/dist/index.mjs +3 -3
  37. package/dist/redirects/index.d.mts +72 -0
  38. package/dist/redirects/index.d.ts +72 -0
  39. package/dist/routing-BWjUF7lp.d.ts +105 -0
  40. package/dist/routing-CgmRi9tD.d.mts +105 -0
  41. package/dist/seo/index.d.mts +273 -0
  42. package/dist/seo/index.d.ts +273 -0
  43. package/dist/seo/server.d.mts +89 -0
  44. package/dist/seo/server.d.ts +89 -0
  45. package/dist/setup/client.d.mts +60 -0
  46. package/dist/setup/client.d.ts +60 -0
  47. package/dist/setup/index.d.mts +5 -0
  48. package/dist/setup/index.d.ts +5 -0
  49. package/dist/setup/index.js +2 -2
  50. package/dist/setup/index.mjs +1 -1
  51. package/dist/setup/server.d.mts +14 -0
  52. package/dist/setup/server.d.ts +14 -0
  53. package/dist/setup/server.js +2 -2
  54. package/dist/setup/server.mjs +1 -1
  55. package/dist/sitemap/index.d.mts +78 -0
  56. package/dist/sitemap/index.d.ts +78 -0
  57. package/dist/types-BDojCvvL.d.mts +156 -0
  58. package/dist/types-BDojCvvL.d.ts +156 -0
  59. package/dist/types-BmzutFwy.d.mts +227 -0
  60. package/dist/types-BmzutFwy.d.ts +227 -0
  61. package/dist/types-C0pJGfbH.d.mts +155 -0
  62. package/dist/types-C0pJGfbH.d.ts +155 -0
  63. package/dist/types-DA_Kocle.d.mts +127 -0
  64. package/dist/types-DA_Kocle.d.ts +127 -0
  65. package/dist/types-lFLKKn0G.d.mts +163 -0
  66. package/dist/types-lFLKKn0G.d.ts +163 -0
  67. package/dist/types-nB206tPK.d.mts +309 -0
  68. package/dist/types-nB206tPK.d.ts +309 -0
  69. package/dist/useEventModal-6U1pF3_g.d.mts +209 -0
  70. package/dist/useEventModal-BA8g-1-P.d.ts +209 -0
  71. package/package.json +1 -1
  72. package/dist/chunk-63JNO4QN.mjs.map +0 -1
  73. package/dist/chunk-6EXHT7PS.mjs.map +0 -1
  74. package/dist/chunk-JG2K4S2I.js.map +0 -1
  75. package/dist/chunk-P7LGOKGI.mjs.map +0 -1
  76. package/dist/chunk-PYYEPAHL.js.map +0 -1
  77. package/dist/chunk-YKMCG3DS.js.map +0 -1
package/dist/index.js CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  var chunk5R4R3WDP_js = require('./chunk-5R4R3WDP.js');
4
4
  var chunkBZBJVG5Y_js = require('./chunk-BZBJVG5Y.js');
5
- var chunkJG2K4S2I_js = require('./chunk-JG2K4S2I.js');
5
+ var chunkO2OHHBUD_js = require('./chunk-O2OHHBUD.js');
6
6
  require('./chunk-HCFPU7TU.js');
7
7
  require('./chunk-V3F5J6CV.js');
8
8
  require('./chunk-QAYJV4KK.js');
9
9
  require('./chunk-ADHVEFWD.js');
10
- var chunkPYYEPAHL_js = require('./chunk-PYYEPAHL.js');
10
+ var chunkK2HWVOEO_js = require('./chunk-K2HWVOEO.js');
11
11
  require('./chunk-EQCVQC35.js');
12
12
  var React = require('react');
13
13
  var jsxRuntime = require('react/jsx-runtime');
@@ -163,8 +163,8 @@ function SignalExperiment({
163
163
  trackImpression = true,
164
164
  children
165
165
  }) {
166
- const { assignment, variant, isControl } = chunkJG2K4S2I_js.useSignalExperiment(experimentId);
167
- const trackEvent = chunkJG2K4S2I_js.useSignalEvent();
166
+ const { assignment, variant, isControl } = chunkO2OHHBUD_js.useSignalExperiment(experimentId);
167
+ const trackEvent = chunkO2OHHBUD_js.useSignalEvent();
168
168
  React.useEffect(() => {
169
169
  if (trackImpression && variant) {
170
170
  trackEvent({
@@ -191,7 +191,7 @@ function SignalExperiment({
191
191
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: variants.control || null });
192
192
  }
193
193
  function useExperimentVariant(experimentId) {
194
- return chunkJG2K4S2I_js.useSignalExperiment(experimentId);
194
+ return chunkO2OHHBUD_js.useSignalExperiment(experimentId);
195
195
  }
196
196
  function ExperimentConversion({
197
197
  experimentId,
@@ -199,8 +199,8 @@ function ExperimentConversion({
199
199
  value,
200
200
  children
201
201
  }) {
202
- const trackEvent = chunkJG2K4S2I_js.useSignalEvent();
203
- const { variant } = chunkJG2K4S2I_js.useSignalExperiment(experimentId);
202
+ const trackEvent = chunkO2OHHBUD_js.useSignalEvent();
203
+ const { variant } = chunkO2OHHBUD_js.useSignalExperiment(experimentId);
204
204
  const handleInteraction = () => {
205
205
  trackEvent({
206
206
  event_type: "experiment",
@@ -1410,159 +1410,159 @@ Object.defineProperty(exports, "handleManagedRedirects", {
1410
1410
  });
1411
1411
  Object.defineProperty(exports, "ManagedImage", {
1412
1412
  enumerable: true,
1413
- get: function () { return chunkJG2K4S2I_js.ManagedImage; }
1413
+ get: function () { return chunkO2OHHBUD_js.ManagedImage; }
1414
1414
  });
1415
1415
  Object.defineProperty(exports, "SignalBridge", {
1416
1416
  enumerable: true,
1417
- get: function () { return chunkJG2K4S2I_js.SignalBridge; }
1417
+ get: function () { return chunkO2OHHBUD_js.SignalBridge; }
1418
1418
  });
1419
1419
  Object.defineProperty(exports, "SiteKitProvider", {
1420
1420
  enumerable: true,
1421
- get: function () { return chunkJG2K4S2I_js.SiteKitProvider; }
1421
+ get: function () { return chunkO2OHHBUD_js.SiteKitProvider; }
1422
1422
  });
1423
1423
  Object.defineProperty(exports, "assignImageToSlot", {
1424
1424
  enumerable: true,
1425
- get: function () { return chunkJG2K4S2I_js.assignImageToSlot; }
1425
+ get: function () { return chunkO2OHHBUD_js.assignImageToSlot; }
1426
1426
  });
1427
1427
  Object.defineProperty(exports, "clearImageSlot", {
1428
1428
  enumerable: true,
1429
- get: function () { return chunkJG2K4S2I_js.clearImageSlot; }
1429
+ get: function () { return chunkO2OHHBUD_js.clearImageSlot; }
1430
1430
  });
1431
1431
  Object.defineProperty(exports, "fetchManagedImage", {
1432
1432
  enumerable: true,
1433
- get: function () { return chunkJG2K4S2I_js.fetchManagedImage; }
1433
+ get: function () { return chunkO2OHHBUD_js.fetchManagedImage; }
1434
1434
  });
1435
1435
  Object.defineProperty(exports, "fetchManagedImages", {
1436
1436
  enumerable: true,
1437
- get: function () { return chunkJG2K4S2I_js.fetchManagedImages; }
1437
+ get: function () { return chunkO2OHHBUD_js.fetchManagedImages; }
1438
1438
  });
1439
1439
  Object.defineProperty(exports, "listImageFiles", {
1440
1440
  enumerable: true,
1441
- get: function () { return chunkJG2K4S2I_js.listImageFiles; }
1441
+ get: function () { return chunkO2OHHBUD_js.listImageFiles; }
1442
1442
  });
1443
1443
  Object.defineProperty(exports, "uploadImage", {
1444
1444
  enumerable: true,
1445
- get: function () { return chunkJG2K4S2I_js.uploadImage; }
1445
+ get: function () { return chunkO2OHHBUD_js.uploadImage; }
1446
1446
  });
1447
1447
  Object.defineProperty(exports, "useSignal", {
1448
1448
  enumerable: true,
1449
- get: function () { return chunkJG2K4S2I_js.useSignal; }
1449
+ get: function () { return chunkO2OHHBUD_js.useSignal; }
1450
1450
  });
1451
1451
  Object.defineProperty(exports, "useSignalConfig", {
1452
1452
  enumerable: true,
1453
- get: function () { return chunkJG2K4S2I_js.useSignalConfig; }
1453
+ get: function () { return chunkO2OHHBUD_js.useSignalConfig; }
1454
1454
  });
1455
1455
  Object.defineProperty(exports, "useSignalEvent", {
1456
1456
  enumerable: true,
1457
- get: function () { return chunkJG2K4S2I_js.useSignalEvent; }
1457
+ get: function () { return chunkO2OHHBUD_js.useSignalEvent; }
1458
1458
  });
1459
1459
  Object.defineProperty(exports, "useSignalExperiment", {
1460
1460
  enumerable: true,
1461
- get: function () { return chunkJG2K4S2I_js.useSignalExperiment; }
1461
+ get: function () { return chunkO2OHHBUD_js.useSignalExperiment; }
1462
1462
  });
1463
1463
  Object.defineProperty(exports, "useSignalOutcome", {
1464
1464
  enumerable: true,
1465
- get: function () { return chunkJG2K4S2I_js.useSignalOutcome; }
1465
+ get: function () { return chunkO2OHHBUD_js.useSignalOutcome; }
1466
1466
  });
1467
1467
  Object.defineProperty(exports, "useSiteKit", {
1468
1468
  enumerable: true,
1469
- get: function () { return chunkJG2K4S2I_js.useSiteKit; }
1469
+ get: function () { return chunkO2OHHBUD_js.useSiteKit; }
1470
1470
  });
1471
1471
  Object.defineProperty(exports, "CalendarView", {
1472
1472
  enumerable: true,
1473
- get: function () { return chunkPYYEPAHL_js.CalendarView; }
1473
+ get: function () { return chunkK2HWVOEO_js.CalendarView; }
1474
1474
  });
1475
1475
  Object.defineProperty(exports, "CheckoutForm", {
1476
1476
  enumerable: true,
1477
- get: function () { return chunkPYYEPAHL_js.CheckoutForm; }
1477
+ get: function () { return chunkK2HWVOEO_js.CheckoutForm; }
1478
1478
  });
1479
1479
  Object.defineProperty(exports, "EventCalendar", {
1480
1480
  enumerable: true,
1481
- get: function () { return chunkPYYEPAHL_js.EventCalendar; }
1481
+ get: function () { return chunkK2HWVOEO_js.EventCalendar; }
1482
1482
  });
1483
1483
  Object.defineProperty(exports, "EventEmbed", {
1484
1484
  enumerable: true,
1485
- get: function () { return chunkPYYEPAHL_js.EventEmbed; }
1485
+ get: function () { return chunkK2HWVOEO_js.EventEmbed; }
1486
1486
  });
1487
1487
  Object.defineProperty(exports, "EventModal", {
1488
1488
  enumerable: true,
1489
- get: function () { return chunkPYYEPAHL_js.EventModal; }
1489
+ get: function () { return chunkK2HWVOEO_js.EventModal; }
1490
1490
  });
1491
1491
  Object.defineProperty(exports, "EventTile", {
1492
1492
  enumerable: true,
1493
- get: function () { return chunkPYYEPAHL_js.EventTile; }
1493
+ get: function () { return chunkK2HWVOEO_js.EventTile; }
1494
1494
  });
1495
1495
  Object.defineProperty(exports, "OfferingCard", {
1496
1496
  enumerable: true,
1497
- get: function () { return chunkPYYEPAHL_js.OfferingCard; }
1497
+ get: function () { return chunkK2HWVOEO_js.OfferingCard; }
1498
1498
  });
1499
1499
  Object.defineProperty(exports, "OfferingList", {
1500
1500
  enumerable: true,
1501
- get: function () { return chunkPYYEPAHL_js.OfferingList; }
1501
+ get: function () { return chunkK2HWVOEO_js.OfferingList; }
1502
1502
  });
1503
1503
  Object.defineProperty(exports, "ProductEmbed", {
1504
1504
  enumerable: true,
1505
- get: function () { return chunkPYYEPAHL_js.ProductEmbed; }
1505
+ get: function () { return chunkK2HWVOEO_js.ProductEmbed; }
1506
1506
  });
1507
1507
  Object.defineProperty(exports, "RegistrationForm", {
1508
1508
  enumerable: true,
1509
- get: function () { return chunkPYYEPAHL_js.RegistrationForm; }
1509
+ get: function () { return chunkK2HWVOEO_js.RegistrationForm; }
1510
1510
  });
1511
1511
  Object.defineProperty(exports, "UpcomingEvents", {
1512
1512
  enumerable: true,
1513
- get: function () { return chunkPYYEPAHL_js.UpcomingEvents; }
1513
+ get: function () { return chunkK2HWVOEO_js.UpcomingEvents; }
1514
1514
  });
1515
1515
  Object.defineProperty(exports, "createCheckoutSession", {
1516
1516
  enumerable: true,
1517
- get: function () { return chunkPYYEPAHL_js.createCheckoutSession; }
1517
+ get: function () { return chunkK2HWVOEO_js.createCheckoutSession; }
1518
1518
  });
1519
1519
  Object.defineProperty(exports, "fetchNextEvent", {
1520
1520
  enumerable: true,
1521
- get: function () { return chunkPYYEPAHL_js.fetchNextEvent; }
1521
+ get: function () { return chunkK2HWVOEO_js.fetchNextEvent; }
1522
1522
  });
1523
1523
  Object.defineProperty(exports, "fetchOffering", {
1524
1524
  enumerable: true,
1525
- get: function () { return chunkPYYEPAHL_js.fetchOffering; }
1525
+ get: function () { return chunkK2HWVOEO_js.fetchOffering; }
1526
1526
  });
1527
1527
  Object.defineProperty(exports, "fetchOfferings", {
1528
1528
  enumerable: true,
1529
- get: function () { return chunkPYYEPAHL_js.fetchOfferings; }
1529
+ get: function () { return chunkK2HWVOEO_js.fetchOfferings; }
1530
1530
  });
1531
1531
  Object.defineProperty(exports, "fetchProducts", {
1532
1532
  enumerable: true,
1533
- get: function () { return chunkPYYEPAHL_js.fetchProducts; }
1533
+ get: function () { return chunkK2HWVOEO_js.fetchProducts; }
1534
1534
  });
1535
1535
  Object.defineProperty(exports, "fetchServices", {
1536
1536
  enumerable: true,
1537
- get: function () { return chunkPYYEPAHL_js.fetchServices; }
1537
+ get: function () { return chunkK2HWVOEO_js.fetchServices; }
1538
1538
  });
1539
1539
  Object.defineProperty(exports, "fetchUpcomingEvents", {
1540
1540
  enumerable: true,
1541
- get: function () { return chunkPYYEPAHL_js.fetchUpcomingEvents; }
1541
+ get: function () { return chunkK2HWVOEO_js.fetchUpcomingEvents; }
1542
1542
  });
1543
1543
  Object.defineProperty(exports, "formatDate", {
1544
1544
  enumerable: true,
1545
- get: function () { return chunkPYYEPAHL_js.formatDate; }
1545
+ get: function () { return chunkK2HWVOEO_js.formatDate; }
1546
1546
  });
1547
1547
  Object.defineProperty(exports, "formatDateTime", {
1548
1548
  enumerable: true,
1549
- get: function () { return chunkPYYEPAHL_js.formatDateTime; }
1549
+ get: function () { return chunkK2HWVOEO_js.formatDateTime; }
1550
1550
  });
1551
1551
  Object.defineProperty(exports, "formatPrice", {
1552
1552
  enumerable: true,
1553
- get: function () { return chunkPYYEPAHL_js.formatPrice; }
1553
+ get: function () { return chunkK2HWVOEO_js.formatPrice; }
1554
1554
  });
1555
1555
  Object.defineProperty(exports, "getOfferingUrl", {
1556
1556
  enumerable: true,
1557
- get: function () { return chunkPYYEPAHL_js.getOfferingUrl; }
1557
+ get: function () { return chunkK2HWVOEO_js.getOfferingUrl; }
1558
1558
  });
1559
1559
  Object.defineProperty(exports, "registerForEvent", {
1560
1560
  enumerable: true,
1561
- get: function () { return chunkPYYEPAHL_js.registerForEvent; }
1561
+ get: function () { return chunkK2HWVOEO_js.registerForEvent; }
1562
1562
  });
1563
1563
  Object.defineProperty(exports, "useEventModal", {
1564
1564
  enumerable: true,
1565
- get: function () { return chunkPYYEPAHL_js.useEventModal; }
1565
+ get: function () { return chunkK2HWVOEO_js.useEventModal; }
1566
1566
  });
1567
1567
  exports.AffiliateCard = AffiliateCard;
1568
1568
  exports.AffiliatesWidget = AffiliatesWidget;
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  export { SetupWizard } from './chunk-XFRPT5ZX.mjs';
2
2
  export { clearRedirectCache, fetchRedirectRules, generateNextRedirects, handleManagedRedirects } from './chunk-VDMZZL2O.mjs';
3
- import { useSignalExperiment, useSignalEvent } from './chunk-P7LGOKGI.mjs';
4
- export { ManagedImage, SignalBridge, SiteKitProvider, assignImageToSlot, clearImageSlot, fetchManagedImage, fetchManagedImages, listImageFiles, uploadImage, useSignal, useSignalConfig, useSignalEvent, useSignalExperiment, useSignalOutcome, useSiteKit } from './chunk-P7LGOKGI.mjs';
3
+ import { useSignalExperiment, useSignalEvent } from './chunk-XQJX252G.mjs';
4
+ export { ManagedImage, SignalBridge, SiteKitProvider, assignImageToSlot, clearImageSlot, fetchManagedImage, fetchManagedImages, listImageFiles, uploadImage, useSignal, useSignalConfig, useSignalEvent, useSignalExperiment, useSignalOutcome, useSiteKit } from './chunk-XQJX252G.mjs';
5
5
  import './chunk-WPSRS352.mjs';
6
6
  import './chunk-FKVJOT2F.mjs';
7
7
  import './chunk-BGJLOJ7T.mjs';
8
8
  import './chunk-SMUFNQLM.mjs';
9
- export { CalendarView, CheckoutForm, EventCalendar, EventEmbed, EventModal, EventTile, OfferingCard, OfferingList, ProductEmbed, RegistrationForm, UpcomingEvents, createCheckoutSession, fetchNextEvent, fetchOffering, fetchOfferings, fetchProducts, fetchServices, fetchUpcomingEvents, formatDate, formatDateTime, formatPrice, getOfferingUrl, registerForEvent, useEventModal } from './chunk-63JNO4QN.mjs';
9
+ export { CalendarView, CheckoutForm, EventCalendar, EventEmbed, EventModal, EventTile, OfferingCard, OfferingList, ProductEmbed, RegistrationForm, UpcomingEvents, createCheckoutSession, fetchNextEvent, fetchOffering, fetchOfferings, fetchProducts, fetchServices, fetchUpcomingEvents, formatDate, formatDateTime, formatPrice, getOfferingUrl, registerForEvent, useEventModal } from './chunk-DOHML47I.mjs';
10
10
  import './chunk-NYKRE2FL.mjs';
11
11
  import React, { useState, useEffect, useRef, useCallback } from 'react';
12
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -0,0 +1,72 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ /**
4
+ * Managed Redirects - Next.js Middleware Helper
5
+ *
6
+ * Fetches redirect rules from Uptrade Portal and applies them.
7
+ * Can be used in middleware.ts for server-side redirects.
8
+ *
9
+ * Usage in middleware.ts:
10
+ *
11
+ * import { handleManagedRedirects } from '@uptrade/site-kit/redirects'
12
+ *
13
+ * export async function middleware(request: NextRequest) {
14
+ * const redirect = await handleManagedRedirects(request, {
15
+ * domain: 'example.com', // Your site's domain (without https://)
16
+ * portalApiUrl: process.env.PORTAL_API_URL || 'https://api.uptrademedia.com',
17
+ * })
18
+ *
19
+ * if (redirect) return redirect
20
+ *
21
+ * return NextResponse.next()
22
+ * }
23
+ */
24
+
25
+ interface RedirectRule {
26
+ from_path: string;
27
+ to_path: string;
28
+ redirect_type: '301' | '302' | '307' | '308';
29
+ is_enabled: boolean;
30
+ }
31
+ interface RedirectConfig {
32
+ domain: string;
33
+ portalApiUrl?: string;
34
+ cacheSeconds?: number;
35
+ }
36
+ /**
37
+ * Fetch redirect rules from Portal API
38
+ */
39
+ declare function fetchRedirectRules(config: RedirectConfig): Promise<RedirectRule[]>;
40
+ /**
41
+ * Handle managed redirects in middleware
42
+ * Returns a NextResponse.redirect if a match is found, otherwise undefined
43
+ */
44
+ declare function handleManagedRedirects(request: NextRequest, config: RedirectConfig): Promise<NextResponse | undefined>;
45
+ /**
46
+ * Generate Next.js redirects config from Portal
47
+ * Use this in next.config.js for build-time redirects
48
+ *
49
+ * Usage in next.config.js:
50
+ *
51
+ * const { generateNextRedirects } = require('@uptrade/site-kit/redirects')
52
+ *
53
+ * module.exports = {
54
+ * async redirects() {
55
+ * return generateNextRedirects({
56
+ * domain: 'example.com',
57
+ * portalApiUrl: process.env.PORTAL_API_URL,
58
+ * })
59
+ * }
60
+ * }
61
+ */
62
+ declare function generateNextRedirects(config: RedirectConfig): Promise<Array<{
63
+ source: string;
64
+ destination: string;
65
+ permanent: boolean;
66
+ }>>;
67
+ /**
68
+ * Clear redirect cache (useful for development)
69
+ */
70
+ declare function clearRedirectCache(): void;
71
+
72
+ export { type RedirectConfig, type RedirectRule, clearRedirectCache, fetchRedirectRules, generateNextRedirects, handleManagedRedirects };
@@ -0,0 +1,72 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+
3
+ /**
4
+ * Managed Redirects - Next.js Middleware Helper
5
+ *
6
+ * Fetches redirect rules from Uptrade Portal and applies them.
7
+ * Can be used in middleware.ts for server-side redirects.
8
+ *
9
+ * Usage in middleware.ts:
10
+ *
11
+ * import { handleManagedRedirects } from '@uptrade/site-kit/redirects'
12
+ *
13
+ * export async function middleware(request: NextRequest) {
14
+ * const redirect = await handleManagedRedirects(request, {
15
+ * domain: 'example.com', // Your site's domain (without https://)
16
+ * portalApiUrl: process.env.PORTAL_API_URL || 'https://api.uptrademedia.com',
17
+ * })
18
+ *
19
+ * if (redirect) return redirect
20
+ *
21
+ * return NextResponse.next()
22
+ * }
23
+ */
24
+
25
+ interface RedirectRule {
26
+ from_path: string;
27
+ to_path: string;
28
+ redirect_type: '301' | '302' | '307' | '308';
29
+ is_enabled: boolean;
30
+ }
31
+ interface RedirectConfig {
32
+ domain: string;
33
+ portalApiUrl?: string;
34
+ cacheSeconds?: number;
35
+ }
36
+ /**
37
+ * Fetch redirect rules from Portal API
38
+ */
39
+ declare function fetchRedirectRules(config: RedirectConfig): Promise<RedirectRule[]>;
40
+ /**
41
+ * Handle managed redirects in middleware
42
+ * Returns a NextResponse.redirect if a match is found, otherwise undefined
43
+ */
44
+ declare function handleManagedRedirects(request: NextRequest, config: RedirectConfig): Promise<NextResponse | undefined>;
45
+ /**
46
+ * Generate Next.js redirects config from Portal
47
+ * Use this in next.config.js for build-time redirects
48
+ *
49
+ * Usage in next.config.js:
50
+ *
51
+ * const { generateNextRedirects } = require('@uptrade/site-kit/redirects')
52
+ *
53
+ * module.exports = {
54
+ * async redirects() {
55
+ * return generateNextRedirects({
56
+ * domain: 'example.com',
57
+ * portalApiUrl: process.env.PORTAL_API_URL,
58
+ * })
59
+ * }
60
+ * }
61
+ */
62
+ declare function generateNextRedirects(config: RedirectConfig): Promise<Array<{
63
+ source: string;
64
+ destination: string;
65
+ permanent: boolean;
66
+ }>>;
67
+ /**
68
+ * Clear redirect cache (useful for development)
69
+ */
70
+ declare function clearRedirectCache(): void;
71
+
72
+ export { type RedirectConfig, type RedirectRule, clearRedirectCache, fetchRedirectRules, generateNextRedirects, handleManagedRedirects };
@@ -0,0 +1,105 @@
1
+ import { l as GetRedirectOptions, R as RedirectResult, p as GetRobotsOptions, o as RobotsDirective, r as GetSitemapEntriesOptions, q as SitemapEntry } from './types-BmzutFwy.js';
2
+
3
+ /**
4
+ * Get redirect for a path if one exists
5
+ *
6
+ * Use in Next.js middleware to handle managed redirects
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * // middleware.ts
11
+ * import { getRedirect } from '@uptrade/seo'
12
+ *
13
+ * export async function middleware(request) {
14
+ * const redirect = await getRedirect({
15
+ * projectId: process.env.UPTRADE_PROJECT_ID!,
16
+ * path: request.nextUrl.pathname
17
+ * })
18
+ *
19
+ * if (redirect) {
20
+ * return NextResponse.redirect(redirect.destination, redirect.statusCode)
21
+ * }
22
+ * }
23
+ * ```
24
+ */
25
+ declare function getRedirect(options: GetRedirectOptions): Promise<RedirectResult | null>;
26
+ /**
27
+ * Get robots directive for a page
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * const robots = await getRobotsDirective({
32
+ * projectId: process.env.UPTRADE_PROJECT_ID!,
33
+ * path: '/private-page'
34
+ * })
35
+ *
36
+ * if (!robots.index) {
37
+ * // Page should not be indexed
38
+ * }
39
+ * ```
40
+ */
41
+ declare function getRobotsDirective(options: GetRobotsOptions): Promise<RobotsDirective>;
42
+ /**
43
+ * Get sitemap entries for a project
44
+ *
45
+ * Use in sitemap.ts to generate dynamic sitemap
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // app/sitemap.ts
50
+ * import { generateSitemap } from '@uptrade/seo'
51
+ *
52
+ * export default async function sitemap() {
53
+ * return generateSitemap({
54
+ * projectId: process.env.UPTRADE_PROJECT_ID!,
55
+ * baseUrl: 'https://example.com',
56
+ * publishedOnly: true
57
+ * })
58
+ * }
59
+ * ```
60
+ */
61
+ declare function generateSitemap(options: GetSitemapEntriesOptions): Promise<SitemapEntry[]>;
62
+ /**
63
+ * Register local sitemap entries with Uptrade Portal
64
+ *
65
+ * Call this at build time to sync your local routes to seo_pages.
66
+ * This ensures analytics only tracks real pages.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * // scripts/register-sitemap.ts
71
+ * import { registerLocalSitemap } from '@uptrade/seo'
72
+ *
73
+ * // Option 1: Provide entries directly
74
+ * await registerLocalSitemap({
75
+ * entries: [
76
+ * { path: '/', title: 'Home', priority: 1.0 },
77
+ * { path: '/about', title: 'About Us', priority: 0.8 },
78
+ * ]
79
+ * })
80
+ *
81
+ * // Option 2: Auto-discover from Next.js app directory
82
+ * await registerLocalSitemap({ autoDiscover: true })
83
+ * ```
84
+ */
85
+ declare function registerLocalSitemap(options: {
86
+ entries?: Array<{
87
+ path: string;
88
+ title?: string;
89
+ priority?: number;
90
+ changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
91
+ }>;
92
+ autoDiscover?: boolean;
93
+ }): Promise<{
94
+ success: boolean;
95
+ created: number;
96
+ updated: number;
97
+ }>;
98
+ /**
99
+ * Check if a path should be indexed
100
+ *
101
+ * Quick helper to check indexability without full directive parsing
102
+ */
103
+ declare function isIndexable(projectId: string, path: string): Promise<boolean>;
104
+
105
+ export { getRedirect as a, getRobotsDirective as b, generateSitemap as g, isIndexable as i, registerLocalSitemap as r };
@@ -0,0 +1,105 @@
1
+ import { l as GetRedirectOptions, R as RedirectResult, p as GetRobotsOptions, o as RobotsDirective, r as GetSitemapEntriesOptions, q as SitemapEntry } from './types-BmzutFwy.mjs';
2
+
3
+ /**
4
+ * Get redirect for a path if one exists
5
+ *
6
+ * Use in Next.js middleware to handle managed redirects
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * // middleware.ts
11
+ * import { getRedirect } from '@uptrade/seo'
12
+ *
13
+ * export async function middleware(request) {
14
+ * const redirect = await getRedirect({
15
+ * projectId: process.env.UPTRADE_PROJECT_ID!,
16
+ * path: request.nextUrl.pathname
17
+ * })
18
+ *
19
+ * if (redirect) {
20
+ * return NextResponse.redirect(redirect.destination, redirect.statusCode)
21
+ * }
22
+ * }
23
+ * ```
24
+ */
25
+ declare function getRedirect(options: GetRedirectOptions): Promise<RedirectResult | null>;
26
+ /**
27
+ * Get robots directive for a page
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * const robots = await getRobotsDirective({
32
+ * projectId: process.env.UPTRADE_PROJECT_ID!,
33
+ * path: '/private-page'
34
+ * })
35
+ *
36
+ * if (!robots.index) {
37
+ * // Page should not be indexed
38
+ * }
39
+ * ```
40
+ */
41
+ declare function getRobotsDirective(options: GetRobotsOptions): Promise<RobotsDirective>;
42
+ /**
43
+ * Get sitemap entries for a project
44
+ *
45
+ * Use in sitemap.ts to generate dynamic sitemap
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // app/sitemap.ts
50
+ * import { generateSitemap } from '@uptrade/seo'
51
+ *
52
+ * export default async function sitemap() {
53
+ * return generateSitemap({
54
+ * projectId: process.env.UPTRADE_PROJECT_ID!,
55
+ * baseUrl: 'https://example.com',
56
+ * publishedOnly: true
57
+ * })
58
+ * }
59
+ * ```
60
+ */
61
+ declare function generateSitemap(options: GetSitemapEntriesOptions): Promise<SitemapEntry[]>;
62
+ /**
63
+ * Register local sitemap entries with Uptrade Portal
64
+ *
65
+ * Call this at build time to sync your local routes to seo_pages.
66
+ * This ensures analytics only tracks real pages.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * // scripts/register-sitemap.ts
71
+ * import { registerLocalSitemap } from '@uptrade/seo'
72
+ *
73
+ * // Option 1: Provide entries directly
74
+ * await registerLocalSitemap({
75
+ * entries: [
76
+ * { path: '/', title: 'Home', priority: 1.0 },
77
+ * { path: '/about', title: 'About Us', priority: 0.8 },
78
+ * ]
79
+ * })
80
+ *
81
+ * // Option 2: Auto-discover from Next.js app directory
82
+ * await registerLocalSitemap({ autoDiscover: true })
83
+ * ```
84
+ */
85
+ declare function registerLocalSitemap(options: {
86
+ entries?: Array<{
87
+ path: string;
88
+ title?: string;
89
+ priority?: number;
90
+ changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
91
+ }>;
92
+ autoDiscover?: boolean;
93
+ }): Promise<{
94
+ success: boolean;
95
+ created: number;
96
+ updated: number;
97
+ }>;
98
+ /**
99
+ * Check if a path should be indexed
100
+ *
101
+ * Quick helper to check indexability without full directive parsing
102
+ */
103
+ declare function isIndexable(projectId: string, path: string): Promise<boolean>;
104
+
105
+ export { getRedirect as a, getRobotsDirective as b, generateSitemap as g, isIndexable as i, registerLocalSitemap as r };