@sonordev/site-kit 2.7.3 → 2.8.1
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/SitemapSync-4RV7BJJF.js +13 -0
- package/dist/{SitemapSync-4Y65CMUK.js.map → SitemapSync-4RV7BJJF.js.map} +1 -1
- package/dist/SitemapSync-ZCK4GWTJ.mjs +4 -0
- package/dist/{SitemapSync-3ISOAVDT.mjs.map → SitemapSync-ZCK4GWTJ.mjs.map} +1 -1
- package/dist/{chunk-PMVEDBWP.mjs → chunk-5QLM6LZ2.mjs} +3 -3
- package/dist/{chunk-PMVEDBWP.mjs.map → chunk-5QLM6LZ2.mjs.map} +1 -1
- package/dist/{chunk-EATGSR46.js → chunk-EHJANA5C.js} +4 -80
- package/dist/chunk-EHJANA5C.js.map +1 -0
- package/dist/{chunk-ZUCVEQZB.mjs → chunk-GGOHMLL5.mjs} +14 -9
- package/dist/chunk-GGOHMLL5.mjs.map +1 -0
- package/dist/chunk-GSRT66PA.js +80 -0
- package/dist/chunk-GSRT66PA.js.map +1 -0
- package/dist/{chunk-7NC3UQEE.js → chunk-HANRPNKG.js} +3 -3
- package/dist/{chunk-7NC3UQEE.js.map → chunk-HANRPNKG.js.map} +1 -1
- package/dist/{chunk-JNXQX2R6.js → chunk-LFGJIGLN.js} +14 -9
- package/dist/chunk-LFGJIGLN.js.map +1 -0
- package/dist/chunk-MU7DTEUF.mjs +77 -0
- package/dist/chunk-MU7DTEUF.mjs.map +1 -0
- package/dist/{chunk-UUDE46TZ.mjs → chunk-VIGRGMWR.mjs} +4 -78
- package/dist/chunk-VIGRGMWR.mjs.map +1 -0
- package/dist/forms/index.d.mts +8 -0
- package/dist/forms/index.d.ts +8 -0
- package/dist/forms/index.js +3 -0
- package/dist/forms/index.js.map +1 -1
- package/dist/forms/index.mjs +3 -0
- package/dist/forms/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/layout/client.js +2 -2
- package/dist/layout/client.mjs +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/layout/index.mjs +1 -1
- package/dist/reputation/index.d.mts +3 -55
- package/dist/reputation/index.d.ts +3 -55
- package/dist/reputation/index.js +5 -4
- package/dist/reputation/index.mjs +2 -1
- package/dist/reputation/server.d.mts +55 -0
- package/dist/reputation/server.d.ts +55 -0
- package/dist/reputation/server.js +17 -0
- package/dist/reputation/server.js.map +1 -0
- package/dist/reputation/server.mjs +4 -0
- package/dist/reputation/server.mjs.map +1 -0
- package/dist/seo/client.js +2 -2
- package/dist/seo/client.mjs +1 -1
- package/dist/seo/index.js +2 -2
- package/dist/seo/index.mjs +1 -1
- package/package.json +6 -1
- package/dist/SitemapSync-3ISOAVDT.mjs +0 -4
- package/dist/SitemapSync-4Y65CMUK.js +0 -13
- package/dist/chunk-EATGSR46.js.map +0 -1
- package/dist/chunk-JNXQX2R6.js.map +0 -1
- package/dist/chunk-UUDE46TZ.mjs.map +0 -1
- package/dist/chunk-ZUCVEQZB.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,8 @@ import React__default from 'react';
|
|
|
10
10
|
export { RedirectConfig, RedirectRule, clearRedirectCache, fetchRedirectRules, generateNextRedirects, handleManagedRedirects } from './redirects/index.mjs';
|
|
11
11
|
export { g as ImageApiConfig, I as ImageFile, M as ManagedImage, b as ManagedImageData, a as ManagedImageProps, d as assignImageToSlot, e as clearImageSlot, f as fetchManagedImage, c as fetchManagedImages, l as listImageFiles, u as uploadImage } from './api-DTKSHh_w.mjs';
|
|
12
12
|
export { EngageOverride, ExperimentAssignment, ExperimentConfig, ExperimentConversion, ExperimentVariant, MetaOverride, PriceOverride, SignalBridge, SignalBridgeProps, SignalConfig, SignalContextValue, SignalEvent, SignalExperiment, SignalOutcome, useExperimentVariant, useSignal, useSignalConfig, useSignalEvent, useSignalExperiment, useSignalOutcome } from './signal/index.mjs';
|
|
13
|
-
export {
|
|
13
|
+
export { TestimonialSection } from './reputation/index.mjs';
|
|
14
|
+
export { Review, ReviewStats, TestimonialSectionProps, fetchReviewStats, fetchReviews } from './reputation/server.mjs';
|
|
14
15
|
import 'next';
|
|
15
16
|
import 'next/server';
|
|
16
17
|
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ import React__default from 'react';
|
|
|
10
10
|
export { RedirectConfig, RedirectRule, clearRedirectCache, fetchRedirectRules, generateNextRedirects, handleManagedRedirects } from './redirects/index.js';
|
|
11
11
|
export { g as ImageApiConfig, I as ImageFile, M as ManagedImage, b as ManagedImageData, a as ManagedImageProps, d as assignImageToSlot, e as clearImageSlot, f as fetchManagedImage, c as fetchManagedImages, l as listImageFiles, u as uploadImage } from './api-DTKSHh_w.js';
|
|
12
12
|
export { EngageOverride, ExperimentAssignment, ExperimentConfig, ExperimentConversion, ExperimentVariant, MetaOverride, PriceOverride, SignalBridge, SignalBridgeProps, SignalConfig, SignalContextValue, SignalEvent, SignalExperiment, SignalOutcome, useExperimentVariant, useSignal, useSignalConfig, useSignalEvent, useSignalExperiment, useSignalOutcome } from './signal/index.js';
|
|
13
|
-
export {
|
|
13
|
+
export { TestimonialSection } from './reputation/index.js';
|
|
14
|
+
export { Review, ReviewStats, TestimonialSectionProps, fetchReviewStats, fetchReviews } from './reputation/server.js';
|
|
14
15
|
import 'next';
|
|
15
16
|
import 'next/server';
|
|
16
17
|
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkW6K7MQCC_js = require('./chunk-W6K7MQCC.js');
|
|
4
|
+
require('./chunk-JP5WGL75.js');
|
|
4
5
|
var chunkIFVMZFNT_js = require('./chunk-IFVMZFNT.js');
|
|
5
6
|
require('./chunk-GCPPXUAI.js');
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
7
|
+
var chunkEHJANA5C_js = require('./chunk-EHJANA5C.js');
|
|
8
|
+
var chunkGSRT66PA_js = require('./chunk-GSRT66PA.js');
|
|
8
9
|
var chunk4LC4KETS_js = require('./chunk-4LC4KETS.js');
|
|
9
10
|
var chunkZQINTH5K_js = require('./chunk-ZQINTH5K.js');
|
|
10
11
|
require('./chunk-LPSWITNZ.js');
|
|
@@ -202,15 +203,15 @@ Object.defineProperty(exports, "uploadImage", {
|
|
|
202
203
|
});
|
|
203
204
|
Object.defineProperty(exports, "TestimonialSection", {
|
|
204
205
|
enumerable: true,
|
|
205
|
-
get: function () { return
|
|
206
|
+
get: function () { return chunkEHJANA5C_js.TestimonialSection; }
|
|
206
207
|
});
|
|
207
208
|
Object.defineProperty(exports, "fetchReviewStats", {
|
|
208
209
|
enumerable: true,
|
|
209
|
-
get: function () { return
|
|
210
|
+
get: function () { return chunkGSRT66PA_js.fetchReviewStats; }
|
|
210
211
|
});
|
|
211
212
|
Object.defineProperty(exports, "fetchReviews", {
|
|
212
213
|
enumerable: true,
|
|
213
|
-
get: function () { return
|
|
214
|
+
get: function () { return chunkGSRT66PA_js.fetchReviews; }
|
|
214
215
|
});
|
|
215
216
|
Object.defineProperty(exports, "CalendarView", {
|
|
216
217
|
enumerable: true,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/affiliates/api.ts","../src/affiliates/useAffiliates.ts","../src/affiliates/AffiliatesWidget.tsx"],"names":["useState","useEffect","getTrackingUrl","jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,SAAS,YAAA,GAAe;AACtB,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,sBAAA,GACxC,sBAAA;AACJ,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,EAAA,GACxC,EAAA;AACJ,EAAA,OAAO,EAAE,QAAQ,MAAA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CAAA;AAEJ;AAsCO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,SAAA,GAAY,EAAA;AAAA,EACZ,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA,GAAa,KAAA;AAAA,EACb,eAAA;AAAA,EACA;AACF,CAAA,EAA0B;AACxB,EAAA,MAAM,EAAE,UAAA,EAAY,SAAA,EAAW,OAAO,cAAA,EAAAA,eAAAA,KAAmB,aAAA,EAAc;AAEvE,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,gBAAA,oBAAoBC,cAAA,CAAC,KAAA,EAAA,EAAI,yBAAA,EAAuB,MAAC,QAAA,EAAA,uBAAA,EAAqB,CAAA;AAAA,EAC/E;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,cAAA,oBAAkBA,cAAA,CAAC,KAAA,EAAA,EAAI,uBAAA,EAAqB,MAAE,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,EAC7D;AAEA,EAAA,MAAM,oBAAoB,KAAA,GAAQ,UAAA,CAAW,KAAA,CAAM,CAAA,EAAG,KAAK,CAAA,GAAI,UAAA;AAE/D,EAAA,IAAI,iBAAA,CAAkB,WAAW,CAAA,EAAG;AAClC,IAAA,OAAO,cAAA,IAAkB,IAAA;AAAA,EAC3B;AAEA,EAAA,uBACEA,cAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,wBAAA,EAAsB,MAC9C,QAAA,EAAA,iBAAA,CAAkB,GAAA;AAAA,IAAI,CAAA,SAAA,KACrB,eAAA,GACI,eAAA,CAAgB,SAAS,CAAA,mBACzBA,cAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAFK,SAAA,CAAU;AAAA;AAGjB,GACN,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * @sonordev/site-kit/affiliates - Affiliates API\n * \n * API functions for fetching affiliate data for client sites.\n * All data goes through Portal API with API key auth - never Supabase directly.\n */\n\nimport type { Affiliate, AffiliateWithOffers, FetchAffiliatesOptions } from './types'\n\n// ============================================\n// API Config Helpers\n// ============================================\n\nfunction getApiConfig() {\n const apiUrl = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_URL__ || 'https://api.sonor.io'\n : 'https://api.sonor.io'\n const apiKey = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_KEY__ || ''\n : ''\n return { apiUrl, apiKey }\n}\n\nasync function apiGet<T>(endpoint: string): Promise<T | null> {\n const { apiUrl, apiKey } = getApiConfig()\n \n if (!apiKey) {\n console.error('[Affiliates] No API key configured')\n return null\n }\n \n try {\n const response = await fetch(`${apiUrl}${endpoint}`, {\n method: 'GET',\n headers: {\n 'x-api-key': apiKey,\n },\n })\n \n if (!response.ok) {\n console.error(`[Affiliates] API error: ${response.statusText}`)\n return null\n }\n \n return await response.json()\n } catch (error) {\n console.error('[Affiliates] Network error:', error)\n return null\n }\n}\n\n// ============================================\n// Fetch Affiliates\n// ============================================\n\n/**\n * Fetch all active affiliates for the project\n * \n * @example\n * ```ts\n * const affiliates = await fetchAffiliates()\n * ```\n */\nexport async function fetchAffiliates(\n options: FetchAffiliatesOptions = {}\n): Promise<AffiliateWithOffers[]> {\n const result = await apiGet<{ affiliates: AffiliateWithOffers[] }>(\n '/api/public/affiliates'\n )\n \n return result?.affiliates || []\n}\n\n/**\n * Build a tracking URL for an affiliate offer\n * When clicked, this redirects through our tracking endpoint and then to the destination\n * \n * @example\n * ```ts\n * const trackingUrl = getTrackingUrl(affiliate.id, offer.id)\n * // Returns: https://api.sonor.io/a/{affiliateId}/{offerId}\n * ```\n */\nexport function getTrackingUrl(affiliateId: string, offerId: string): string {\n const { apiUrl } = getApiConfig()\n return `${apiUrl}/a/${affiliateId}/${offerId}`\n}\n","/**\n * @sonordev/site-kit/affiliates - useAffiliates Hook\n * \n * React hook for fetching and displaying affiliates on client sites.\n */\n\n'use client'\n\nimport { useState, useEffect } from 'react'\nimport type { AffiliateWithOffers } from './types'\nimport { fetchAffiliates, getTrackingUrl } from './api'\n\nexport interface UseAffiliatesResult {\n affiliates: AffiliateWithOffers[]\n isLoading: boolean\n error: string | null\n getTrackingUrl: (affiliateId: string, offerId: string) => string\n}\n\n/**\n * Hook to fetch affiliates for display on client sites\n * \n * @example\n * ```tsx\n * function AffiliatesSection() {\n * const { affiliates, isLoading } = useAffiliates()\n * \n * if (isLoading) return <div>Loading...</div>\n * \n * return (\n * <div className=\"grid grid-cols-3 gap-4\">\n * {affiliates.map(affiliate => (\n * <AffiliateCard key={affiliate.id} affiliate={affiliate} />\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useAffiliates(): UseAffiliatesResult {\n const [affiliates, setAffiliates] = useState<AffiliateWithOffers[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n async function load() {\n try {\n setIsLoading(true)\n setError(null)\n const data = await fetchAffiliates()\n setAffiliates(data)\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load affiliates')\n } finally {\n setIsLoading(false)\n }\n }\n \n load()\n }, [])\n\n return {\n affiliates,\n isLoading,\n error,\n getTrackingUrl,\n }\n}\n","/**\n * @sonordev/site-kit/affiliates - AffiliatesWidget Component\n * \n * Unstyled, headless component for displaying affiliates.\n * Client sites can wrap this or use it directly with their own styling.\n */\n\n'use client'\n\nimport React from 'react'\nimport { useAffiliates } from './useAffiliates'\nimport type { AffiliateWithOffers, AffiliateOffer } from './types'\n\n// ============================================\n// Affiliate Card (Unstyled)\n// ============================================\n\nexport interface AffiliateCardProps {\n affiliate: AffiliateWithOffers\n className?: string\n /** Optional custom render for the logo */\n renderLogo?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Show offers as links below the card */\n showOffers?: boolean\n}\n\n/**\n * Single affiliate card - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * <AffiliateCard \n * affiliate={affiliate}\n * className=\"p-4 bg-white rounded-lg shadow\"\n * showOffers\n * />\n * ```\n */\nexport function AffiliateCard({\n affiliate,\n className = '',\n renderLogo,\n showOffers = false,\n}: AffiliateCardProps) {\n const { getTrackingUrl } = useAffiliates()\n \n const defaultLogo = (\n <div data-affiliate-logo className=\"affiliate-logo\">\n {affiliate.logo_url ? (\n <img \n src={affiliate.logo_url} \n alt={affiliate.name}\n loading=\"lazy\"\n />\n ) : (\n <span>{affiliate.name.charAt(0)}</span>\n )}\n </div>\n )\n\n return (\n <div className={className} data-affiliate-card data-affiliate-id={affiliate.id}>\n {/* Logo */}\n {renderLogo ? renderLogo(affiliate) : defaultLogo}\n \n {/* Name */}\n <div data-affiliate-name className=\"affiliate-name\">\n {affiliate.name}\n </div>\n \n {/* Website link */}\n {affiliate.website_url && (\n <a \n href={affiliate.website_url}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-website\n className=\"affiliate-website\"\n >\n Visit Website\n </a>\n )}\n \n {/* Offers */}\n {showOffers && affiliate.offers && affiliate.offers.length > 0 && (\n <div data-affiliate-offers className=\"affiliate-offers\">\n {affiliate.offers.map(offer => (\n <a\n key={offer.id}\n href={getTrackingUrl(affiliate.id, offer.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-offer\n data-offer-id={offer.id}\n className=\"affiliate-offer\"\n >\n {offer.name}\n </a>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================\n// Affiliates Grid (Unstyled)\n// ============================================\n\nexport interface AffiliatesWidgetProps {\n className?: string\n /** Custom loading component */\n loadingComponent?: React.ReactNode\n /** Custom empty state component */\n emptyComponent?: React.ReactNode\n /** Custom error component */\n errorComponent?: React.ReactNode\n /** Show offers on each card */\n showOffers?: boolean\n /** Custom render function for each affiliate */\n renderAffiliate?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Maximum number to display */\n limit?: number\n}\n\n/**\n * Display a grid of affiliates - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * // Basic usage\n * <AffiliatesWidget className=\"grid grid-cols-3 gap-4\" />\n * \n * // With custom rendering\n * <AffiliatesWidget\n * renderAffiliate={(affiliate) => (\n * <MyCustomCard key={affiliate.id} data={affiliate} />\n * )}\n * />\n * ```\n */\nexport function AffiliatesWidget({\n className = '',\n loadingComponent,\n emptyComponent,\n errorComponent,\n showOffers = false,\n renderAffiliate,\n limit,\n}: AffiliatesWidgetProps) {\n const { affiliates, isLoading, error, getTrackingUrl } = useAffiliates()\n \n if (isLoading) {\n return loadingComponent || <div data-affiliates-loading>Loading affiliates...</div>\n }\n \n if (error) {\n return errorComponent || <div data-affiliates-error>{error}</div>\n }\n \n const displayAffiliates = limit ? affiliates.slice(0, limit) : affiliates\n \n if (displayAffiliates.length === 0) {\n return emptyComponent || null\n }\n \n return (\n <div className={className} data-affiliates-widget>\n {displayAffiliates.map(affiliate => \n renderAffiliate \n ? renderAffiliate(affiliate)\n : <AffiliateCard \n key={affiliate.id} \n affiliate={affiliate} \n showOffers={showOffers}\n />\n )}\n </div>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/affiliates/api.ts","../src/affiliates/useAffiliates.ts","../src/affiliates/AffiliatesWidget.tsx"],"names":["useState","useEffect","getTrackingUrl","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,SAAS,YAAA,GAAe;AACtB,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,sBAAA,GACxC,sBAAA;AACJ,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,EAAA,GACxC,EAAA;AACJ,EAAA,OAAO,EAAE,QAAQ,MAAA,EAAO;AAC1B;AAEA,eAAe,OAAU,QAAA,EAAqC;AAC5D,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAA,EAAO,GAAI,YAAA,EAAa;AAExC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAA,CAAQ,MA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ACA;AACF,CAAA,EAA0B;AACxB,EAAA,MAAM,EAAE,UAAA,EAAY,SAAA,EAAW,OAAO,cAAA,EAAAA,eAAAA,KAAmB,aAAA,EAAc;AAEvE,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAO,gBAAA,oBAAoBC,cAAA,CAAC,KAAA,EAAA,EAAI,yBAAA,EAAuB,MAAC,QAAA,EAAA,uBAAA,EAAqB,CAAA;AAAA,EAC/E;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,cAAA,oBAAkBA,cAAA,CAAC,KAAA,EAAA,EAAI,uBAAA,EAAqB,MAAE,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,EAC7D;AAEA,EAAA,MAAM,oBAAoB,KAAA,GAAQ,UAAA,CAAW,KAAA,CAAM,CAAA,EAAG,KAAK,CAAA,GAAI,UAAA;AAE/D,EAAA,IAAI,iBAAA,CAAkB,WAAW,CAAA,EAAG;AAClC,IAAA,OAAO,cAAA,IAAkB,IAAA;AAAA,EAC3B;AAEA,EAAA,uBACEA,cAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,wBAAA,EAAsB,MAC9C,QAAA,EAAA,iBAAA,CAAkB,GAAA;AAAA,IAAI,CAAA,SAAA,KACrB,eAAA,GACI,eAAA,CAAgB,SAAS,CAAA,mBACzBA,cAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAFK,SAAA,CAAU;AAAA;AAGjB,GACN,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * @sonordev/site-kit/affiliates - Affiliates API\n * \n * API functions for fetching affiliate data for client sites.\n * All data goes through Portal API with API key auth - never Supabase directly.\n */\n\nimport type { Affiliate, AffiliateWithOffers, FetchAffiliatesOptions } from './types'\n\n// ============================================\n// API Config Helpers\n// ============================================\n\nfunction getApiConfig() {\n const apiUrl = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_URL__ || 'https://api.sonor.io'\n : 'https://api.sonor.io'\n const apiKey = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_KEY__ || ''\n : ''\n return { apiUrl, apiKey }\n}\n\nasync function apiGet<T>(endpoint: string): Promise<T | null> {\n const { apiUrl, apiKey } = getApiConfig()\n \n if (!apiKey) {\n console.error('[Affiliates] No API key configured')\n return null\n }\n \n try {\n const response = await fetch(`${apiUrl}${endpoint}`, {\n method: 'GET',\n headers: {\n 'x-api-key': apiKey,\n },\n })\n \n if (!response.ok) {\n console.error(`[Affiliates] API error: ${response.statusText}`)\n return null\n }\n \n return await response.json()\n } catch (error) {\n console.error('[Affiliates] Network error:', error)\n return null\n }\n}\n\n// ============================================\n// Fetch Affiliates\n// ============================================\n\n/**\n * Fetch all active affiliates for the project\n * \n * @example\n * ```ts\n * const affiliates = await fetchAffiliates()\n * ```\n */\nexport async function fetchAffiliates(\n options: FetchAffiliatesOptions = {}\n): Promise<AffiliateWithOffers[]> {\n const result = await apiGet<{ affiliates: AffiliateWithOffers[] }>(\n '/api/public/affiliates'\n )\n \n return result?.affiliates || []\n}\n\n/**\n * Build a tracking URL for an affiliate offer\n * When clicked, this redirects through our tracking endpoint and then to the destination\n * \n * @example\n * ```ts\n * const trackingUrl = getTrackingUrl(affiliate.id, offer.id)\n * // Returns: https://api.sonor.io/a/{affiliateId}/{offerId}\n * ```\n */\nexport function getTrackingUrl(affiliateId: string, offerId: string): string {\n const { apiUrl } = getApiConfig()\n return `${apiUrl}/a/${affiliateId}/${offerId}`\n}\n","/**\n * @sonordev/site-kit/affiliates - useAffiliates Hook\n * \n * React hook for fetching and displaying affiliates on client sites.\n */\n\n'use client'\n\nimport { useState, useEffect } from 'react'\nimport type { AffiliateWithOffers } from './types'\nimport { fetchAffiliates, getTrackingUrl } from './api'\n\nexport interface UseAffiliatesResult {\n affiliates: AffiliateWithOffers[]\n isLoading: boolean\n error: string | null\n getTrackingUrl: (affiliateId: string, offerId: string) => string\n}\n\n/**\n * Hook to fetch affiliates for display on client sites\n * \n * @example\n * ```tsx\n * function AffiliatesSection() {\n * const { affiliates, isLoading } = useAffiliates()\n * \n * if (isLoading) return <div>Loading...</div>\n * \n * return (\n * <div className=\"grid grid-cols-3 gap-4\">\n * {affiliates.map(affiliate => (\n * <AffiliateCard key={affiliate.id} affiliate={affiliate} />\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useAffiliates(): UseAffiliatesResult {\n const [affiliates, setAffiliates] = useState<AffiliateWithOffers[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n async function load() {\n try {\n setIsLoading(true)\n setError(null)\n const data = await fetchAffiliates()\n setAffiliates(data)\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load affiliates')\n } finally {\n setIsLoading(false)\n }\n }\n \n load()\n }, [])\n\n return {\n affiliates,\n isLoading,\n error,\n getTrackingUrl,\n }\n}\n","/**\n * @sonordev/site-kit/affiliates - AffiliatesWidget Component\n * \n * Unstyled, headless component for displaying affiliates.\n * Client sites can wrap this or use it directly with their own styling.\n */\n\n'use client'\n\nimport React from 'react'\nimport { useAffiliates } from './useAffiliates'\nimport type { AffiliateWithOffers, AffiliateOffer } from './types'\n\n// ============================================\n// Affiliate Card (Unstyled)\n// ============================================\n\nexport interface AffiliateCardProps {\n affiliate: AffiliateWithOffers\n className?: string\n /** Optional custom render for the logo */\n renderLogo?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Show offers as links below the card */\n showOffers?: boolean\n}\n\n/**\n * Single affiliate card - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * <AffiliateCard \n * affiliate={affiliate}\n * className=\"p-4 bg-white rounded-lg shadow\"\n * showOffers\n * />\n * ```\n */\nexport function AffiliateCard({\n affiliate,\n className = '',\n renderLogo,\n showOffers = false,\n}: AffiliateCardProps) {\n const { getTrackingUrl } = useAffiliates()\n \n const defaultLogo = (\n <div data-affiliate-logo className=\"affiliate-logo\">\n {affiliate.logo_url ? (\n <img \n src={affiliate.logo_url} \n alt={affiliate.name}\n loading=\"lazy\"\n />\n ) : (\n <span>{affiliate.name.charAt(0)}</span>\n )}\n </div>\n )\n\n return (\n <div className={className} data-affiliate-card data-affiliate-id={affiliate.id}>\n {/* Logo */}\n {renderLogo ? renderLogo(affiliate) : defaultLogo}\n \n {/* Name */}\n <div data-affiliate-name className=\"affiliate-name\">\n {affiliate.name}\n </div>\n \n {/* Website link */}\n {affiliate.website_url && (\n <a \n href={affiliate.website_url}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-website\n className=\"affiliate-website\"\n >\n Visit Website\n </a>\n )}\n \n {/* Offers */}\n {showOffers && affiliate.offers && affiliate.offers.length > 0 && (\n <div data-affiliate-offers className=\"affiliate-offers\">\n {affiliate.offers.map(offer => (\n <a\n key={offer.id}\n href={getTrackingUrl(affiliate.id, offer.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-offer\n data-offer-id={offer.id}\n className=\"affiliate-offer\"\n >\n {offer.name}\n </a>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================\n// Affiliates Grid (Unstyled)\n// ============================================\n\nexport interface AffiliatesWidgetProps {\n className?: string\n /** Custom loading component */\n loadingComponent?: React.ReactNode\n /** Custom empty state component */\n emptyComponent?: React.ReactNode\n /** Custom error component */\n errorComponent?: React.ReactNode\n /** Show offers on each card */\n showOffers?: boolean\n /** Custom render function for each affiliate */\n renderAffiliate?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Maximum number to display */\n limit?: number\n}\n\n/**\n * Display a grid of affiliates - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * // Basic usage\n * <AffiliatesWidget className=\"grid grid-cols-3 gap-4\" />\n * \n * // With custom rendering\n * <AffiliatesWidget\n * renderAffiliate={(affiliate) => (\n * <MyCustomCard key={affiliate.id} data={affiliate} />\n * )}\n * />\n * ```\n */\nexport function AffiliatesWidget({\n className = '',\n loadingComponent,\n emptyComponent,\n errorComponent,\n showOffers = false,\n renderAffiliate,\n limit,\n}: AffiliatesWidgetProps) {\n const { affiliates, isLoading, error, getTrackingUrl } = useAffiliates()\n \n if (isLoading) {\n return loadingComponent || <div data-affiliates-loading>Loading affiliates...</div>\n }\n \n if (error) {\n return errorComponent || <div data-affiliates-error>{error}</div>\n }\n \n const displayAffiliates = limit ? affiliates.slice(0, limit) : affiliates\n \n if (displayAffiliates.length === 0) {\n return emptyComponent || null\n }\n \n return (\n <div className={className} data-affiliates-widget>\n {displayAffiliates.map(affiliate => \n renderAffiliate \n ? renderAffiliate(affiliate)\n : <AffiliateCard \n key={affiliate.id} \n affiliate={affiliate} \n showOffers={showOffers}\n />\n )}\n </div>\n )\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { clearRedirectCache, fetchRedirectRules, generateNextRedirects, handleManagedRedirects } from './chunk-7LAOWIWE.mjs';
|
|
2
|
+
import './chunk-B22WSN4L.mjs';
|
|
2
3
|
export { ManagedImage, assignImageToSlot, clearImageSlot, fetchManagedImage, fetchManagedImages, listImageFiles, uploadImage } from './chunk-3YQCPLGP.mjs';
|
|
3
4
|
import './chunk-CU6OGBKK.mjs';
|
|
4
|
-
export { TestimonialSection
|
|
5
|
-
|
|
5
|
+
export { TestimonialSection } from './chunk-VIGRGMWR.mjs';
|
|
6
|
+
export { fetchReviewStats, fetchReviews } from './chunk-MU7DTEUF.mjs';
|
|
6
7
|
export { CalendarView, CheckoutForm, EventCalendar, EventCheckout, EventEmbed, EventModal, EventTile, OfferingCard, OfferingList, ProductEmbed, RegistrationForm, UpcomingEvents, createCheckoutSession, fetchNextEvent, fetchOffering, fetchOfferings, fetchProducts, fetchServices, fetchUpcomingEvents, formatDate, formatDateTime, formatPrice, getOfferingUrl, registerForEvent, useEventModal } from './chunk-RSUNHEBH.mjs';
|
|
7
8
|
export { BookingWidget, createBooking, createSlotHold, detectTimezone, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate as formatBookingDate, formatTime as formatBookingTime, formatDuration, releaseSlotHold } from './chunk-AT2ZF3TL.mjs';
|
|
8
9
|
import './chunk-FO5EUANA.mjs';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/affiliates/api.ts","../src/affiliates/useAffiliates.ts","../src/affiliates/AffiliatesWidget.tsx"],"names":["getTrackingUrl"],"mappings":";;;;;;;;;;;;;;;;AAaA,SAAS,YAAA,GAAe;AACtB,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,sBAAA,GACxC,sBAAA;AACJ,EAAA,MAAM,SAAS,OAAO,MAAA,KAAW,WAAA,GAC5B,MAAA,CAAe,wBAAwB,EAAA,GACxC,EAAA;AACJ,EAAA,OAAO,EAAE,QAAQ,MAAA,EAAO;AAC1B;AAEA,eAAe,OAAU,QAAA,EAAqC;AAC5D,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAA,EAAO,GAAI,YAAA,EAAa;AAExC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,OAAA,CAAQ,MAAM,oCAAoC,CAAA;AAClD,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,WAAW,MAAM,KAAA,CAAM,GAAG,MAAM,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI;AAAA,MACnD,MAAA,EAAQ,KAAA;AAAA,MACR,OAAA,EAAS;AAAA,QACP,WAAA,EAAa;AAAA;AACf,KACD,CAAA;AAED,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,wBAAA,EAA2B,QAAA,CAAS,UAAU,CAAA,CAAE,CAAA;AAC9D,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,OAAO,MAAM,SAAS,IAAA,EAAK;A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AAA,CAAM,CAAA,EAAG,KAAK,CAAA,GAAI,UAAA;AAE/D,EAAA,IAAI,iBAAA,CAAkB,WAAW,CAAA,EAAG;AAClC,IAAA,OAAO,cAAA,IAAkB,IAAA;AAAA,EAC3B;AAEA,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAsB,wBAAA,EAAsB,MAC9C,QAAA,EAAA,iBAAA,CAAkB,GAAA;AAAA,IAAI,CAAA,SAAA,KACrB,eAAA,GACI,eAAA,CAAgB,SAAS,CAAA,mBACzB,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAFK,SAAA,CAAU;AAAA;AAGjB,GACN,EACF,CAAA;AAEJ","file":"index.mjs","sourcesContent":["/**\n * @sonordev/site-kit/affiliates - Affiliates API\n * \n * API functions for fetching affiliate data for client sites.\n * All data goes through Portal API with API key auth - never Supabase directly.\n */\n\nimport type { Affiliate, AffiliateWithOffers, FetchAffiliatesOptions } from './types'\n\n// ============================================\n// API Config Helpers\n// ============================================\n\nfunction getApiConfig() {\n const apiUrl = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_URL__ || 'https://api.sonor.io'\n : 'https://api.sonor.io'\n const apiKey = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_KEY__ || ''\n : ''\n return { apiUrl, apiKey }\n}\n\nasync function apiGet<T>(endpoint: string): Promise<T | null> {\n const { apiUrl, apiKey } = getApiConfig()\n \n if (!apiKey) {\n console.error('[Affiliates] No API key configured')\n return null\n }\n \n try {\n const response = await fetch(`${apiUrl}${endpoint}`, {\n method: 'GET',\n headers: {\n 'x-api-key': apiKey,\n },\n })\n \n if (!response.ok) {\n console.error(`[Affiliates] API error: ${response.statusText}`)\n return null\n }\n \n return await response.json()\n } catch (error) {\n console.error('[Affiliates] Network error:', error)\n return null\n }\n}\n\n// ============================================\n// Fetch Affiliates\n// ============================================\n\n/**\n * Fetch all active affiliates for the project\n * \n * @example\n * ```ts\n * const affiliates = await fetchAffiliates()\n * ```\n */\nexport async function fetchAffiliates(\n options: FetchAffiliatesOptions = {}\n): Promise<AffiliateWithOffers[]> {\n const result = await apiGet<{ affiliates: AffiliateWithOffers[] }>(\n '/api/public/affiliates'\n )\n \n return result?.affiliates || []\n}\n\n/**\n * Build a tracking URL for an affiliate offer\n * When clicked, this redirects through our tracking endpoint and then to the destination\n * \n * @example\n * ```ts\n * const trackingUrl = getTrackingUrl(affiliate.id, offer.id)\n * // Returns: https://api.sonor.io/a/{affiliateId}/{offerId}\n * ```\n */\nexport function getTrackingUrl(affiliateId: string, offerId: string): string {\n const { apiUrl } = getApiConfig()\n return `${apiUrl}/a/${affiliateId}/${offerId}`\n}\n","/**\n * @sonordev/site-kit/affiliates - useAffiliates Hook\n * \n * React hook for fetching and displaying affiliates on client sites.\n */\n\n'use client'\n\nimport { useState, useEffect } from 'react'\nimport type { AffiliateWithOffers } from './types'\nimport { fetchAffiliates, getTrackingUrl } from './api'\n\nexport interface UseAffiliatesResult {\n affiliates: AffiliateWithOffers[]\n isLoading: boolean\n error: string | null\n getTrackingUrl: (affiliateId: string, offerId: string) => string\n}\n\n/**\n * Hook to fetch affiliates for display on client sites\n * \n * @example\n * ```tsx\n * function AffiliatesSection() {\n * const { affiliates, isLoading } = useAffiliates()\n * \n * if (isLoading) return <div>Loading...</div>\n * \n * return (\n * <div className=\"grid grid-cols-3 gap-4\">\n * {affiliates.map(affiliate => (\n * <AffiliateCard key={affiliate.id} affiliate={affiliate} />\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useAffiliates(): UseAffiliatesResult {\n const [affiliates, setAffiliates] = useState<AffiliateWithOffers[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n async function load() {\n try {\n setIsLoading(true)\n setError(null)\n const data = await fetchAffiliates()\n setAffiliates(data)\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load affiliates')\n } finally {\n setIsLoading(false)\n }\n }\n \n load()\n }, [])\n\n return {\n affiliates,\n isLoading,\n error,\n getTrackingUrl,\n }\n}\n","/**\n * @sonordev/site-kit/affiliates - AffiliatesWidget Component\n * \n * Unstyled, headless component for displaying affiliates.\n * Client sites can wrap this or use it directly with their own styling.\n */\n\n'use client'\n\nimport React from 'react'\nimport { useAffiliates } from './useAffiliates'\nimport type { AffiliateWithOffers, AffiliateOffer } from './types'\n\n// ============================================\n// Affiliate Card (Unstyled)\n// ============================================\n\nexport interface AffiliateCardProps {\n affiliate: AffiliateWithOffers\n className?: string\n /** Optional custom render for the logo */\n renderLogo?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Show offers as links below the card */\n showOffers?: boolean\n}\n\n/**\n * Single affiliate card - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * <AffiliateCard \n * affiliate={affiliate}\n * className=\"p-4 bg-white rounded-lg shadow\"\n * showOffers\n * />\n * ```\n */\nexport function AffiliateCard({\n affiliate,\n className = '',\n renderLogo,\n showOffers = false,\n}: AffiliateCardProps) {\n const { getTrackingUrl } = useAffiliates()\n \n const defaultLogo = (\n <div data-affiliate-logo className=\"affiliate-logo\">\n {affiliate.logo_url ? (\n <img \n src={affiliate.logo_url} \n alt={affiliate.name}\n loading=\"lazy\"\n />\n ) : (\n <span>{affiliate.name.charAt(0)}</span>\n )}\n </div>\n )\n\n return (\n <div className={className} data-affiliate-card data-affiliate-id={affiliate.id}>\n {/* Logo */}\n {renderLogo ? renderLogo(affiliate) : defaultLogo}\n \n {/* Name */}\n <div data-affiliate-name className=\"affiliate-name\">\n {affiliate.name}\n </div>\n \n {/* Website link */}\n {affiliate.website_url && (\n <a \n href={affiliate.website_url}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-website\n className=\"affiliate-website\"\n >\n Visit Website\n </a>\n )}\n \n {/* Offers */}\n {showOffers && affiliate.offers && affiliate.offers.length > 0 && (\n <div data-affiliate-offers className=\"affiliate-offers\">\n {affiliate.offers.map(offer => (\n <a\n key={offer.id}\n href={getTrackingUrl(affiliate.id, offer.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-offer\n data-offer-id={offer.id}\n className=\"affiliate-offer\"\n >\n {offer.name}\n </a>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================\n// Affiliates Grid (Unstyled)\n// ============================================\n\nexport interface AffiliatesWidgetProps {\n className?: string\n /** Custom loading component */\n loadingComponent?: React.ReactNode\n /** Custom empty state component */\n emptyComponent?: React.ReactNode\n /** Custom error component */\n errorComponent?: React.ReactNode\n /** Show offers on each card */\n showOffers?: boolean\n /** Custom render function for each affiliate */\n renderAffiliate?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Maximum number to display */\n limit?: number\n}\n\n/**\n * Display a grid of affiliates - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * // Basic usage\n * <AffiliatesWidget className=\"grid grid-cols-3 gap-4\" />\n * \n * // With custom rendering\n * <AffiliatesWidget\n * renderAffiliate={(affiliate) => (\n * <MyCustomCard key={affiliate.id} data={affiliate} />\n * )}\n * />\n * ```\n */\nexport function AffiliatesWidget({\n className = '',\n loadingComponent,\n emptyComponent,\n errorComponent,\n showOffers = false,\n renderAffiliate,\n limit,\n}: AffiliatesWidgetProps) {\n const { affiliates, isLoading, error, getTrackingUrl } = useAffiliates()\n \n if (isLoading) {\n return loadingComponent || <div data-affiliates-loading>Loading affiliates...</div>\n }\n \n if (error) {\n return errorComponent || <div data-affiliates-error>{error}</div>\n }\n \n const displayAffiliates = limit ? affiliates.slice(0, limit) : affiliates\n \n if (displayAffiliates.length === 0) {\n return emptyComponent || null\n }\n \n return (\n <div className={className} data-affiliates-widget>\n {displayAffiliates.map(affiliate => \n renderAffiliate \n ? renderAffiliate(affiliate)\n : <AffiliateCard \n key={affiliate.id} \n affiliate={affiliate} \n showOffers={showOffers}\n />\n )}\n </div>\n )\n}\n"]}
|
|
1
|
+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sB,wBAAA,EAAsB,MAC9C,QAAA,EAAA,iBAAA,CAAkB,GAAA;AAAA,IAAI,CAAA,SAAA,KACrB,eAAA,GACI,eAAA,CAAgB,SAAS,CAAA,mBACzB,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QAEC,SAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAFK,SAAA,CAAU;AAAA;AAGjB,GACN,EACF,CAAA;AAEJ","file":"index.mjs","sourcesContent":["/**\n * @sonordev/site-kit/affiliates - Affiliates API\n * \n * API functions for fetching affiliate data for client sites.\n * All data goes through Portal API with API key auth - never Supabase directly.\n */\n\nimport type { Affiliate, AffiliateWithOffers, FetchAffiliatesOptions } from './types'\n\n// ============================================\n// API Config Helpers\n// ============================================\n\nfunction getApiConfig() {\n const apiUrl = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_URL__ || 'https://api.sonor.io'\n : 'https://api.sonor.io'\n const apiKey = typeof window !== 'undefined' \n ? (window as any).__SITE_KIT_API_KEY__ || ''\n : ''\n return { apiUrl, apiKey }\n}\n\nasync function apiGet<T>(endpoint: string): Promise<T | null> {\n const { apiUrl, apiKey } = getApiConfig()\n \n if (!apiKey) {\n console.error('[Affiliates] No API key configured')\n return null\n }\n \n try {\n const response = await fetch(`${apiUrl}${endpoint}`, {\n method: 'GET',\n headers: {\n 'x-api-key': apiKey,\n },\n })\n \n if (!response.ok) {\n console.error(`[Affiliates] API error: ${response.statusText}`)\n return null\n }\n \n return await response.json()\n } catch (error) {\n console.error('[Affiliates] Network error:', error)\n return null\n }\n}\n\n// ============================================\n// Fetch Affiliates\n// ============================================\n\n/**\n * Fetch all active affiliates for the project\n * \n * @example\n * ```ts\n * const affiliates = await fetchAffiliates()\n * ```\n */\nexport async function fetchAffiliates(\n options: FetchAffiliatesOptions = {}\n): Promise<AffiliateWithOffers[]> {\n const result = await apiGet<{ affiliates: AffiliateWithOffers[] }>(\n '/api/public/affiliates'\n )\n \n return result?.affiliates || []\n}\n\n/**\n * Build a tracking URL for an affiliate offer\n * When clicked, this redirects through our tracking endpoint and then to the destination\n * \n * @example\n * ```ts\n * const trackingUrl = getTrackingUrl(affiliate.id, offer.id)\n * // Returns: https://api.sonor.io/a/{affiliateId}/{offerId}\n * ```\n */\nexport function getTrackingUrl(affiliateId: string, offerId: string): string {\n const { apiUrl } = getApiConfig()\n return `${apiUrl}/a/${affiliateId}/${offerId}`\n}\n","/**\n * @sonordev/site-kit/affiliates - useAffiliates Hook\n * \n * React hook for fetching and displaying affiliates on client sites.\n */\n\n'use client'\n\nimport { useState, useEffect } from 'react'\nimport type { AffiliateWithOffers } from './types'\nimport { fetchAffiliates, getTrackingUrl } from './api'\n\nexport interface UseAffiliatesResult {\n affiliates: AffiliateWithOffers[]\n isLoading: boolean\n error: string | null\n getTrackingUrl: (affiliateId: string, offerId: string) => string\n}\n\n/**\n * Hook to fetch affiliates for display on client sites\n * \n * @example\n * ```tsx\n * function AffiliatesSection() {\n * const { affiliates, isLoading } = useAffiliates()\n * \n * if (isLoading) return <div>Loading...</div>\n * \n * return (\n * <div className=\"grid grid-cols-3 gap-4\">\n * {affiliates.map(affiliate => (\n * <AffiliateCard key={affiliate.id} affiliate={affiliate} />\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useAffiliates(): UseAffiliatesResult {\n const [affiliates, setAffiliates] = useState<AffiliateWithOffers[]>([])\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n async function load() {\n try {\n setIsLoading(true)\n setError(null)\n const data = await fetchAffiliates()\n setAffiliates(data)\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load affiliates')\n } finally {\n setIsLoading(false)\n }\n }\n \n load()\n }, [])\n\n return {\n affiliates,\n isLoading,\n error,\n getTrackingUrl,\n }\n}\n","/**\n * @sonordev/site-kit/affiliates - AffiliatesWidget Component\n * \n * Unstyled, headless component for displaying affiliates.\n * Client sites can wrap this or use it directly with their own styling.\n */\n\n'use client'\n\nimport React from 'react'\nimport { useAffiliates } from './useAffiliates'\nimport type { AffiliateWithOffers, AffiliateOffer } from './types'\n\n// ============================================\n// Affiliate Card (Unstyled)\n// ============================================\n\nexport interface AffiliateCardProps {\n affiliate: AffiliateWithOffers\n className?: string\n /** Optional custom render for the logo */\n renderLogo?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Show offers as links below the card */\n showOffers?: boolean\n}\n\n/**\n * Single affiliate card - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * <AffiliateCard \n * affiliate={affiliate}\n * className=\"p-4 bg-white rounded-lg shadow\"\n * showOffers\n * />\n * ```\n */\nexport function AffiliateCard({\n affiliate,\n className = '',\n renderLogo,\n showOffers = false,\n}: AffiliateCardProps) {\n const { getTrackingUrl } = useAffiliates()\n \n const defaultLogo = (\n <div data-affiliate-logo className=\"affiliate-logo\">\n {affiliate.logo_url ? (\n <img \n src={affiliate.logo_url} \n alt={affiliate.name}\n loading=\"lazy\"\n />\n ) : (\n <span>{affiliate.name.charAt(0)}</span>\n )}\n </div>\n )\n\n return (\n <div className={className} data-affiliate-card data-affiliate-id={affiliate.id}>\n {/* Logo */}\n {renderLogo ? renderLogo(affiliate) : defaultLogo}\n \n {/* Name */}\n <div data-affiliate-name className=\"affiliate-name\">\n {affiliate.name}\n </div>\n \n {/* Website link */}\n {affiliate.website_url && (\n <a \n href={affiliate.website_url}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-website\n className=\"affiliate-website\"\n >\n Visit Website\n </a>\n )}\n \n {/* Offers */}\n {showOffers && affiliate.offers && affiliate.offers.length > 0 && (\n <div data-affiliate-offers className=\"affiliate-offers\">\n {affiliate.offers.map(offer => (\n <a\n key={offer.id}\n href={getTrackingUrl(affiliate.id, offer.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer sponsored\"\n data-affiliate-offer\n data-offer-id={offer.id}\n className=\"affiliate-offer\"\n >\n {offer.name}\n </a>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n// ============================================\n// Affiliates Grid (Unstyled)\n// ============================================\n\nexport interface AffiliatesWidgetProps {\n className?: string\n /** Custom loading component */\n loadingComponent?: React.ReactNode\n /** Custom empty state component */\n emptyComponent?: React.ReactNode\n /** Custom error component */\n errorComponent?: React.ReactNode\n /** Show offers on each card */\n showOffers?: boolean\n /** Custom render function for each affiliate */\n renderAffiliate?: (affiliate: AffiliateWithOffers) => React.ReactNode\n /** Maximum number to display */\n limit?: number\n}\n\n/**\n * Display a grid of affiliates - unstyled, bring your own CSS\n * \n * @example\n * ```tsx\n * // Basic usage\n * <AffiliatesWidget className=\"grid grid-cols-3 gap-4\" />\n * \n * // With custom rendering\n * <AffiliatesWidget\n * renderAffiliate={(affiliate) => (\n * <MyCustomCard key={affiliate.id} data={affiliate} />\n * )}\n * />\n * ```\n */\nexport function AffiliatesWidget({\n className = '',\n loadingComponent,\n emptyComponent,\n errorComponent,\n showOffers = false,\n renderAffiliate,\n limit,\n}: AffiliatesWidgetProps) {\n const { affiliates, isLoading, error, getTrackingUrl } = useAffiliates()\n \n if (isLoading) {\n return loadingComponent || <div data-affiliates-loading>Loading affiliates...</div>\n }\n \n if (error) {\n return errorComponent || <div data-affiliates-error>{error}</div>\n }\n \n const displayAffiliates = limit ? affiliates.slice(0, limit) : affiliates\n \n if (displayAffiliates.length === 0) {\n return emptyComponent || null\n }\n \n return (\n <div className={className} data-affiliates-widget>\n {displayAffiliates.map(affiliate => \n renderAffiliate \n ? renderAffiliate(affiliate)\n : <AffiliateCard \n key={affiliate.id} \n affiliate={affiliate} \n showOffers={showOffers}\n />\n )}\n </div>\n )\n}\n"]}
|
package/dist/layout/client.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkHANRPNKG_js = require('../chunk-HANRPNKG.js');
|
|
5
5
|
require('../chunk-ZSMWDLMK.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "SiteKitClientProviders", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkHANRPNKG_js.SiteKitClientProviders; }
|
|
12
12
|
});
|
|
13
13
|
//# sourceMappingURL=client.js.map
|
|
14
14
|
//# sourceMappingURL=client.js.map
|
package/dist/layout/client.mjs
CHANGED
package/dist/layout/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHANRPNKG_js = require('../chunk-HANRPNKG.js');
|
|
4
4
|
var chunkGCPPXUAI_js = require('../chunk-GCPPXUAI.js');
|
|
5
5
|
var chunkPKUTYMN7_js = require('../chunk-PKUTYMN7.js');
|
|
6
6
|
require('../chunk-VU4GL5ZG.js');
|
|
@@ -42,7 +42,7 @@ async function SiteKitLayout({
|
|
|
42
42
|
favicon && /* @__PURE__ */ jsxRuntime.jsx(chunkGCPPXUAI_js.ManagedFavicon, { apiKey: resolvedApiKey, apiUrl: resolvedApiUrl }),
|
|
43
43
|
managedScripts && /* @__PURE__ */ jsxRuntime.jsx(chunkPKUTYMN7_js.ManagedScripts, { position: "head" }),
|
|
44
44
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
45
|
-
|
|
45
|
+
chunkHANRPNKG_js.SiteKitClientProviders,
|
|
46
46
|
{
|
|
47
47
|
apiKey: resolvedApiKey,
|
|
48
48
|
apiUrl: resolvedApiUrl,
|
package/dist/layout/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SiteKitClientProviders } from '../chunk-
|
|
1
|
+
import { SiteKitClientProviders } from '../chunk-5QLM6LZ2.mjs';
|
|
2
2
|
import { ManagedFavicon } from '../chunk-CU6OGBKK.mjs';
|
|
3
3
|
import { ManagedScripts } from '../chunk-L7XPPFSS.mjs';
|
|
4
4
|
import '../chunk-TUFP3FGI.mjs';
|
|
@@ -1,59 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @sonordev/site-kit/reputation - Type Definitions
|
|
5
|
-
*/
|
|
6
|
-
interface Review {
|
|
7
|
-
id: string;
|
|
8
|
-
quote: string;
|
|
9
|
-
name: string;
|
|
10
|
-
role?: string;
|
|
11
|
-
rating: number;
|
|
12
|
-
image?: string;
|
|
13
|
-
date?: string;
|
|
14
|
-
platform?: string;
|
|
15
|
-
isFeatured?: boolean;
|
|
16
|
-
serviceTags?: string[];
|
|
17
|
-
}
|
|
18
|
-
interface ReviewStats {
|
|
19
|
-
total_reviews: number;
|
|
20
|
-
average_rating: number;
|
|
21
|
-
distribution: {
|
|
22
|
-
1: number;
|
|
23
|
-
2: number;
|
|
24
|
-
3: number;
|
|
25
|
-
4: number;
|
|
26
|
-
5: number;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
interface TestimonialSectionProps {
|
|
30
|
-
title?: string;
|
|
31
|
-
subtitle?: string;
|
|
32
|
-
autoplay?: boolean;
|
|
33
|
-
autoplayInterval?: number;
|
|
34
|
-
showRating?: boolean;
|
|
35
|
-
maxReviews?: number;
|
|
36
|
-
featuredOnly?: boolean;
|
|
37
|
-
service?: string;
|
|
38
|
-
className?: string;
|
|
39
|
-
}
|
|
2
|
+
import { TestimonialSectionProps } from './server.mjs';
|
|
3
|
+
export { Review, ReviewStats, fetchReviewStats, fetchReviews } from './server.mjs';
|
|
40
4
|
|
|
41
5
|
declare function TestimonialSection({ title, subtitle, autoplay, autoplayInterval, showRating, maxReviews, featuredOnly, service, className, }: TestimonialSectionProps): react_jsx_runtime.JSX.Element | null;
|
|
42
6
|
|
|
43
|
-
|
|
44
|
-
* @sonordev/site-kit/reputation - API Functions
|
|
45
|
-
*
|
|
46
|
-
* Fetch reviews and stats from Portal API public endpoint.
|
|
47
|
-
* Uses API key authentication (x-api-key header) - project is resolved server-side.
|
|
48
|
-
* Includes retry with backoff for rate limiting (429).
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
interface FetchReviewsOptions {
|
|
52
|
-
service?: string;
|
|
53
|
-
limit?: number;
|
|
54
|
-
featured?: boolean;
|
|
55
|
-
}
|
|
56
|
-
declare function fetchReviews(options?: FetchReviewsOptions): Promise<Review[]>;
|
|
57
|
-
declare function fetchReviewStats(): Promise<ReviewStats | null>;
|
|
58
|
-
|
|
59
|
-
export { type Review, type ReviewStats, TestimonialSection, type TestimonialSectionProps, fetchReviewStats, fetchReviews };
|
|
7
|
+
export { TestimonialSection, TestimonialSectionProps };
|
|
@@ -1,59 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @sonordev/site-kit/reputation - Type Definitions
|
|
5
|
-
*/
|
|
6
|
-
interface Review {
|
|
7
|
-
id: string;
|
|
8
|
-
quote: string;
|
|
9
|
-
name: string;
|
|
10
|
-
role?: string;
|
|
11
|
-
rating: number;
|
|
12
|
-
image?: string;
|
|
13
|
-
date?: string;
|
|
14
|
-
platform?: string;
|
|
15
|
-
isFeatured?: boolean;
|
|
16
|
-
serviceTags?: string[];
|
|
17
|
-
}
|
|
18
|
-
interface ReviewStats {
|
|
19
|
-
total_reviews: number;
|
|
20
|
-
average_rating: number;
|
|
21
|
-
distribution: {
|
|
22
|
-
1: number;
|
|
23
|
-
2: number;
|
|
24
|
-
3: number;
|
|
25
|
-
4: number;
|
|
26
|
-
5: number;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
interface TestimonialSectionProps {
|
|
30
|
-
title?: string;
|
|
31
|
-
subtitle?: string;
|
|
32
|
-
autoplay?: boolean;
|
|
33
|
-
autoplayInterval?: number;
|
|
34
|
-
showRating?: boolean;
|
|
35
|
-
maxReviews?: number;
|
|
36
|
-
featuredOnly?: boolean;
|
|
37
|
-
service?: string;
|
|
38
|
-
className?: string;
|
|
39
|
-
}
|
|
2
|
+
import { TestimonialSectionProps } from './server.js';
|
|
3
|
+
export { Review, ReviewStats, fetchReviewStats, fetchReviews } from './server.js';
|
|
40
4
|
|
|
41
5
|
declare function TestimonialSection({ title, subtitle, autoplay, autoplayInterval, showRating, maxReviews, featuredOnly, service, className, }: TestimonialSectionProps): react_jsx_runtime.JSX.Element | null;
|
|
42
6
|
|
|
43
|
-
|
|
44
|
-
* @sonordev/site-kit/reputation - API Functions
|
|
45
|
-
*
|
|
46
|
-
* Fetch reviews and stats from Portal API public endpoint.
|
|
47
|
-
* Uses API key authentication (x-api-key header) - project is resolved server-side.
|
|
48
|
-
* Includes retry with backoff for rate limiting (429).
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
interface FetchReviewsOptions {
|
|
52
|
-
service?: string;
|
|
53
|
-
limit?: number;
|
|
54
|
-
featured?: boolean;
|
|
55
|
-
}
|
|
56
|
-
declare function fetchReviews(options?: FetchReviewsOptions): Promise<Review[]>;
|
|
57
|
-
declare function fetchReviewStats(): Promise<ReviewStats | null>;
|
|
58
|
-
|
|
59
|
-
export { type Review, type ReviewStats, TestimonialSection, type TestimonialSectionProps, fetchReviewStats, fetchReviews };
|
|
7
|
+
export { TestimonialSection, TestimonialSectionProps };
|
package/dist/reputation/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEHJANA5C_js = require('../chunk-EHJANA5C.js');
|
|
4
|
+
var chunkGSRT66PA_js = require('../chunk-GSRT66PA.js');
|
|
4
5
|
require('../chunk-ZSMWDLMK.js');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
Object.defineProperty(exports, "TestimonialSection", {
|
|
9
10
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkEHJANA5C_js.TestimonialSection; }
|
|
11
12
|
});
|
|
12
13
|
Object.defineProperty(exports, "fetchReviewStats", {
|
|
13
14
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkGSRT66PA_js.fetchReviewStats; }
|
|
15
16
|
});
|
|
16
17
|
Object.defineProperty(exports, "fetchReviews", {
|
|
17
18
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkGSRT66PA_js.fetchReviews; }
|
|
19
20
|
});
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { TestimonialSection
|
|
1
|
+
export { TestimonialSection } from '../chunk-VIGRGMWR.mjs';
|
|
2
|
+
export { fetchReviewStats, fetchReviews } from '../chunk-MU7DTEUF.mjs';
|
|
2
3
|
import '../chunk-4XPGGLVP.mjs';
|
|
3
4
|
//# sourceMappingURL=index.mjs.map
|
|
4
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonordev/site-kit/reputation - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
interface Review {
|
|
5
|
+
id: string;
|
|
6
|
+
quote: string;
|
|
7
|
+
name: string;
|
|
8
|
+
role?: string;
|
|
9
|
+
rating: number;
|
|
10
|
+
image?: string;
|
|
11
|
+
date?: string;
|
|
12
|
+
platform?: string;
|
|
13
|
+
isFeatured?: boolean;
|
|
14
|
+
serviceTags?: string[];
|
|
15
|
+
}
|
|
16
|
+
interface ReviewStats {
|
|
17
|
+
total_reviews: number;
|
|
18
|
+
average_rating: number;
|
|
19
|
+
distribution: {
|
|
20
|
+
1: number;
|
|
21
|
+
2: number;
|
|
22
|
+
3: number;
|
|
23
|
+
4: number;
|
|
24
|
+
5: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface TestimonialSectionProps {
|
|
28
|
+
title?: string;
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
autoplay?: boolean;
|
|
31
|
+
autoplayInterval?: number;
|
|
32
|
+
showRating?: boolean;
|
|
33
|
+
maxReviews?: number;
|
|
34
|
+
featuredOnly?: boolean;
|
|
35
|
+
service?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @sonordev/site-kit/reputation - API Functions
|
|
41
|
+
*
|
|
42
|
+
* Fetch reviews and stats from Portal API public endpoint.
|
|
43
|
+
* Uses API key authentication (x-api-key header) - project is resolved server-side.
|
|
44
|
+
* Includes retry with backoff for rate limiting (429).
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
interface FetchReviewsOptions {
|
|
48
|
+
service?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
featured?: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare function fetchReviews(options?: FetchReviewsOptions): Promise<Review[]>;
|
|
53
|
+
declare function fetchReviewStats(): Promise<ReviewStats | null>;
|
|
54
|
+
|
|
55
|
+
export { type Review, type ReviewStats, type TestimonialSectionProps, fetchReviewStats, fetchReviews };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonordev/site-kit/reputation - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
interface Review {
|
|
5
|
+
id: string;
|
|
6
|
+
quote: string;
|
|
7
|
+
name: string;
|
|
8
|
+
role?: string;
|
|
9
|
+
rating: number;
|
|
10
|
+
image?: string;
|
|
11
|
+
date?: string;
|
|
12
|
+
platform?: string;
|
|
13
|
+
isFeatured?: boolean;
|
|
14
|
+
serviceTags?: string[];
|
|
15
|
+
}
|
|
16
|
+
interface ReviewStats {
|
|
17
|
+
total_reviews: number;
|
|
18
|
+
average_rating: number;
|
|
19
|
+
distribution: {
|
|
20
|
+
1: number;
|
|
21
|
+
2: number;
|
|
22
|
+
3: number;
|
|
23
|
+
4: number;
|
|
24
|
+
5: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface TestimonialSectionProps {
|
|
28
|
+
title?: string;
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
autoplay?: boolean;
|
|
31
|
+
autoplayInterval?: number;
|
|
32
|
+
showRating?: boolean;
|
|
33
|
+
maxReviews?: number;
|
|
34
|
+
featuredOnly?: boolean;
|
|
35
|
+
service?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @sonordev/site-kit/reputation - API Functions
|
|
41
|
+
*
|
|
42
|
+
* Fetch reviews and stats from Portal API public endpoint.
|
|
43
|
+
* Uses API key authentication (x-api-key header) - project is resolved server-side.
|
|
44
|
+
* Includes retry with backoff for rate limiting (429).
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
interface FetchReviewsOptions {
|
|
48
|
+
service?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
featured?: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare function fetchReviews(options?: FetchReviewsOptions): Promise<Review[]>;
|
|
53
|
+
declare function fetchReviewStats(): Promise<ReviewStats | null>;
|
|
54
|
+
|
|
55
|
+
export { type Review, type ReviewStats, type TestimonialSectionProps, fetchReviewStats, fetchReviews };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkGSRT66PA_js = require('../chunk-GSRT66PA.js');
|
|
4
|
+
require('../chunk-ZSMWDLMK.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "fetchReviewStats", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkGSRT66PA_js.fetchReviewStats; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "fetchReviews", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkGSRT66PA_js.fetchReviews; }
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=server.js.map
|
|
17
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"server.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"server.mjs"}
|
package/dist/seo/client.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkLFGJIGLN_js = require('../chunk-LFGJIGLN.js');
|
|
5
5
|
require('../chunk-ZSMWDLMK.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "SitemapSync", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkLFGJIGLN_js.SitemapSync; }
|
|
12
12
|
});
|
|
13
13
|
//# sourceMappingURL=client.js.map
|
|
14
14
|
//# sourceMappingURL=client.js.map
|
package/dist/seo/client.mjs
CHANGED
package/dist/seo/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkPKUTYMN7_js = require('../chunk-PKUTYMN7.js');
|
|
4
4
|
var chunkATG4FJY6_js = require('../chunk-ATG4FJY6.js');
|
|
5
|
-
var
|
|
5
|
+
var chunkLFGJIGLN_js = require('../chunk-LFGJIGLN.js');
|
|
6
6
|
var chunkPAF5IGGF_js = require('../chunk-PAF5IGGF.js');
|
|
7
7
|
var chunkVU4GL5ZG_js = require('../chunk-VU4GL5ZG.js');
|
|
8
8
|
require('../chunk-ZSMWDLMK.js');
|
|
@@ -681,7 +681,7 @@ Object.defineProperty(exports, "ManagedScripts", {
|
|
|
681
681
|
});
|
|
682
682
|
Object.defineProperty(exports, "SitemapSync", {
|
|
683
683
|
enumerable: true,
|
|
684
|
-
get: function () { return
|
|
684
|
+
get: function () { return chunkLFGJIGLN_js.SitemapSync; }
|
|
685
685
|
});
|
|
686
686
|
Object.defineProperty(exports, "generateSitemap", {
|
|
687
687
|
enumerable: true,
|
package/dist/seo/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ManagedNoScripts, ManagedScripts } from '../chunk-L7XPPFSS.mjs';
|
|
2
2
|
import { pickManagedLlmSchemaForJsonLd } from '../chunk-H23ZT2I2.mjs';
|
|
3
|
-
export { SitemapSync } from '../chunk-
|
|
3
|
+
export { SitemapSync } from '../chunk-GGOHMLL5.mjs';
|
|
4
4
|
import { getManagedMetadata } from '../chunk-5SQ4NRPH.mjs';
|
|
5
5
|
export { generateSitemap, getABVariant, getManagedMetadata, getManagedMetadataWithAB, getRedirect, getRobotsDirective, isIndexable } from '../chunk-5SQ4NRPH.mjs';
|
|
6
6
|
import { getContentBlock, getSchemaMarkups, getSEOPageData, getEntityEnhancedSchema, getFAQData, getInternalLinks, getEntities } from '../chunk-TUFP3FGI.mjs';
|