@sonordev/site-kit 3.0.3 → 3.0.5
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/AnalyticsProvider-MLT26JRP.mjs +6 -0
- package/dist/{AnalyticsProvider-UKF7ESSP.mjs.map → AnalyticsProvider-MLT26JRP.mjs.map} +1 -1
- package/dist/AnalyticsProvider-WTOGN7LV.js +27 -0
- package/dist/{AnalyticsProvider-N3RNQXTK.js.map → AnalyticsProvider-WTOGN7LV.js.map} +1 -1
- package/dist/analytics/index.d.mts +1 -0
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.js +18 -9
- package/dist/analytics/index.mjs +3 -2
- package/dist/chunk-3DPXOZAU.mjs +26 -0
- package/dist/chunk-3DPXOZAU.mjs.map +1 -0
- package/dist/{chunk-7DW4SXNG.js → chunk-3GCEFS73.js} +5 -5
- package/dist/{chunk-7DW4SXNG.js.map → chunk-3GCEFS73.js.map} +1 -1
- package/dist/{chunk-ZDLBI3XX.mjs → chunk-65SMJBHW.mjs} +7 -2
- package/dist/chunk-65SMJBHW.mjs.map +1 -0
- package/dist/{chunk-ZM2ALSBM.js → chunk-7TX5BKVA.js} +18 -7
- package/dist/chunk-7TX5BKVA.js.map +1 -0
- package/dist/{chunk-S34XAPW2.mjs → chunk-AN4ATCYQ.mjs} +8 -8
- package/dist/chunk-AN4ATCYQ.mjs.map +1 -0
- package/dist/{chunk-XIGNKCHQ.js → chunk-EBJ4S5DU.js} +8 -8
- package/dist/chunk-EBJ4S5DU.js.map +1 -0
- package/dist/chunk-HMFFAUCD.js +30 -0
- package/dist/chunk-HMFFAUCD.js.map +1 -0
- package/dist/{chunk-FLD5R2PT.js → chunk-IBDVZ6BF.js} +7 -2
- package/dist/{chunk-FLD5R2PT.js.map → chunk-IBDVZ6BF.js.map} +1 -1
- package/dist/{chunk-UZ63S7FE.mjs → chunk-KMZ527EM.mjs} +3 -3
- package/dist/{chunk-UZ63S7FE.mjs.map → chunk-KMZ527EM.mjs.map} +1 -1
- package/dist/{chunk-GBZHL2IT.js → chunk-NNZDHLXN.js} +3 -3
- package/dist/{chunk-GBZHL2IT.js.map → chunk-NNZDHLXN.js.map} +1 -1
- package/dist/{chunk-PAYGGILT.mjs → chunk-T4QBSRA4.mjs} +3 -3
- package/dist/{chunk-PAYGGILT.mjs.map → chunk-T4QBSRA4.mjs.map} +1 -1
- package/dist/{chunk-6FWQMKVO.mjs → chunk-WN5A3KSY.mjs} +18 -7
- package/dist/chunk-WN5A3KSY.mjs.map +1 -0
- package/dist/client/index.d.mts +2 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +9 -0
- package/dist/client/index.mjs +1 -0
- package/dist/commerce/index.js +49 -48
- package/dist/commerce/index.mjs +4 -3
- package/dist/dispatch-Cto83LLT.d.mts +28 -0
- package/dist/dispatch-DRQGcM8K.d.ts +28 -0
- package/dist/index.js +29 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -3
- 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/llms/index.d.mts +4 -0
- package/dist/llms/index.d.ts +4 -0
- package/dist/llms/index.js +12 -12
- package/dist/llms/index.mjs +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/sitemap/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/AnalyticsProvider-N3RNQXTK.js +0 -26
- package/dist/AnalyticsProvider-UKF7ESSP.mjs +0 -5
- package/dist/chunk-6FWQMKVO.mjs.map +0 -1
- package/dist/chunk-S34XAPW2.mjs.map +0 -1
- package/dist/chunk-XIGNKCHQ.js.map +0 -1
- package/dist/chunk-ZDLBI3XX.mjs.map +0 -1
- package/dist/chunk-ZM2ALSBM.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -8,10 +8,11 @@ var chunkEHJANA5C_js = require('./chunk-EHJANA5C.js');
|
|
|
8
8
|
var chunkGSRT66PA_js = require('./chunk-GSRT66PA.js');
|
|
9
9
|
var chunkDGHPOWLU_js = require('./chunk-DGHPOWLU.js');
|
|
10
10
|
var chunkO7E6QVK3_js = require('./chunk-O7E6QVK3.js');
|
|
11
|
-
var
|
|
11
|
+
var chunk3GCEFS73_js = require('./chunk-3GCEFS73.js');
|
|
12
12
|
var chunkI2GTT2DG_js = require('./chunk-I2GTT2DG.js');
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-EBJ4S5DU.js');
|
|
14
|
+
require('./chunk-IBDVZ6BF.js');
|
|
15
|
+
require('./chunk-HMFFAUCD.js');
|
|
15
16
|
require('./chunk-3BNFUMLL.js');
|
|
16
17
|
require('./chunk-ZSMWDLMK.js');
|
|
17
18
|
var react = require('react');
|
|
@@ -252,103 +253,103 @@ Object.defineProperty(exports, "useSignalOutcome", {
|
|
|
252
253
|
});
|
|
253
254
|
Object.defineProperty(exports, "CalendarView", {
|
|
254
255
|
enumerable: true,
|
|
255
|
-
get: function () { return
|
|
256
|
+
get: function () { return chunk3GCEFS73_js.CalendarView; }
|
|
256
257
|
});
|
|
257
258
|
Object.defineProperty(exports, "CheckoutForm", {
|
|
258
259
|
enumerable: true,
|
|
259
|
-
get: function () { return
|
|
260
|
+
get: function () { return chunk3GCEFS73_js.CheckoutForm; }
|
|
260
261
|
});
|
|
261
262
|
Object.defineProperty(exports, "EventCalendar", {
|
|
262
263
|
enumerable: true,
|
|
263
|
-
get: function () { return
|
|
264
|
+
get: function () { return chunk3GCEFS73_js.EventCalendar; }
|
|
264
265
|
});
|
|
265
266
|
Object.defineProperty(exports, "EventCheckout", {
|
|
266
267
|
enumerable: true,
|
|
267
|
-
get: function () { return
|
|
268
|
+
get: function () { return chunk3GCEFS73_js.EventCheckout; }
|
|
268
269
|
});
|
|
269
270
|
Object.defineProperty(exports, "EventEmbed", {
|
|
270
271
|
enumerable: true,
|
|
271
|
-
get: function () { return
|
|
272
|
+
get: function () { return chunk3GCEFS73_js.EventEmbed; }
|
|
272
273
|
});
|
|
273
274
|
Object.defineProperty(exports, "EventModal", {
|
|
274
275
|
enumerable: true,
|
|
275
|
-
get: function () { return
|
|
276
|
+
get: function () { return chunk3GCEFS73_js.EventModal; }
|
|
276
277
|
});
|
|
277
278
|
Object.defineProperty(exports, "EventTile", {
|
|
278
279
|
enumerable: true,
|
|
279
|
-
get: function () { return
|
|
280
|
+
get: function () { return chunk3GCEFS73_js.EventTile; }
|
|
280
281
|
});
|
|
281
282
|
Object.defineProperty(exports, "OfferingCard", {
|
|
282
283
|
enumerable: true,
|
|
283
|
-
get: function () { return
|
|
284
|
+
get: function () { return chunk3GCEFS73_js.OfferingCard; }
|
|
284
285
|
});
|
|
285
286
|
Object.defineProperty(exports, "OfferingList", {
|
|
286
287
|
enumerable: true,
|
|
287
|
-
get: function () { return
|
|
288
|
+
get: function () { return chunk3GCEFS73_js.OfferingList; }
|
|
288
289
|
});
|
|
289
290
|
Object.defineProperty(exports, "ProductEmbed", {
|
|
290
291
|
enumerable: true,
|
|
291
|
-
get: function () { return
|
|
292
|
+
get: function () { return chunk3GCEFS73_js.ProductEmbed; }
|
|
292
293
|
});
|
|
293
294
|
Object.defineProperty(exports, "RegistrationForm", {
|
|
294
295
|
enumerable: true,
|
|
295
|
-
get: function () { return
|
|
296
|
+
get: function () { return chunk3GCEFS73_js.RegistrationForm; }
|
|
296
297
|
});
|
|
297
298
|
Object.defineProperty(exports, "UpcomingEvents", {
|
|
298
299
|
enumerable: true,
|
|
299
|
-
get: function () { return
|
|
300
|
+
get: function () { return chunk3GCEFS73_js.UpcomingEvents; }
|
|
300
301
|
});
|
|
301
302
|
Object.defineProperty(exports, "createCheckoutSession", {
|
|
302
303
|
enumerable: true,
|
|
303
|
-
get: function () { return
|
|
304
|
+
get: function () { return chunk3GCEFS73_js.createCheckoutSession; }
|
|
304
305
|
});
|
|
305
306
|
Object.defineProperty(exports, "fetchNextEvent", {
|
|
306
307
|
enumerable: true,
|
|
307
|
-
get: function () { return
|
|
308
|
+
get: function () { return chunk3GCEFS73_js.fetchNextEvent; }
|
|
308
309
|
});
|
|
309
310
|
Object.defineProperty(exports, "fetchOffering", {
|
|
310
311
|
enumerable: true,
|
|
311
|
-
get: function () { return
|
|
312
|
+
get: function () { return chunk3GCEFS73_js.fetchOffering; }
|
|
312
313
|
});
|
|
313
314
|
Object.defineProperty(exports, "fetchOfferings", {
|
|
314
315
|
enumerable: true,
|
|
315
|
-
get: function () { return
|
|
316
|
+
get: function () { return chunk3GCEFS73_js.fetchOfferings; }
|
|
316
317
|
});
|
|
317
318
|
Object.defineProperty(exports, "fetchProducts", {
|
|
318
319
|
enumerable: true,
|
|
319
|
-
get: function () { return
|
|
320
|
+
get: function () { return chunk3GCEFS73_js.fetchProducts; }
|
|
320
321
|
});
|
|
321
322
|
Object.defineProperty(exports, "fetchServices", {
|
|
322
323
|
enumerable: true,
|
|
323
|
-
get: function () { return
|
|
324
|
+
get: function () { return chunk3GCEFS73_js.fetchServices; }
|
|
324
325
|
});
|
|
325
326
|
Object.defineProperty(exports, "fetchUpcomingEvents", {
|
|
326
327
|
enumerable: true,
|
|
327
|
-
get: function () { return
|
|
328
|
+
get: function () { return chunk3GCEFS73_js.fetchUpcomingEvents; }
|
|
328
329
|
});
|
|
329
330
|
Object.defineProperty(exports, "formatDate", {
|
|
330
331
|
enumerable: true,
|
|
331
|
-
get: function () { return
|
|
332
|
+
get: function () { return chunk3GCEFS73_js.formatDate; }
|
|
332
333
|
});
|
|
333
334
|
Object.defineProperty(exports, "formatDateTime", {
|
|
334
335
|
enumerable: true,
|
|
335
|
-
get: function () { return
|
|
336
|
+
get: function () { return chunk3GCEFS73_js.formatDateTime; }
|
|
336
337
|
});
|
|
337
338
|
Object.defineProperty(exports, "formatPrice", {
|
|
338
339
|
enumerable: true,
|
|
339
|
-
get: function () { return
|
|
340
|
+
get: function () { return chunk3GCEFS73_js.formatPrice; }
|
|
340
341
|
});
|
|
341
342
|
Object.defineProperty(exports, "getOfferingUrl", {
|
|
342
343
|
enumerable: true,
|
|
343
|
-
get: function () { return
|
|
344
|
+
get: function () { return chunk3GCEFS73_js.getOfferingUrl; }
|
|
344
345
|
});
|
|
345
346
|
Object.defineProperty(exports, "registerForEvent", {
|
|
346
347
|
enumerable: true,
|
|
347
|
-
get: function () { return
|
|
348
|
+
get: function () { return chunk3GCEFS73_js.registerForEvent; }
|
|
348
349
|
});
|
|
349
350
|
Object.defineProperty(exports, "useEventModal", {
|
|
350
351
|
enumerable: true,
|
|
351
|
-
get: function () { return
|
|
352
|
+
get: function () { return chunk3GCEFS73_js.useEventModal; }
|
|
352
353
|
});
|
|
353
354
|
Object.defineProperty(exports, "BookingWidget", {
|
|
354
355
|
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,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,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AAA,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,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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,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
|
@@ -6,10 +6,11 @@ export { TestimonialSection } from './chunk-VIGRGMWR.mjs';
|
|
|
6
6
|
export { fetchReviewStats, fetchReviews } from './chunk-MU7DTEUF.mjs';
|
|
7
7
|
export { ExperimentConversion, SignalExperiment, useExperimentVariant } from './chunk-EUDTPXUI.mjs';
|
|
8
8
|
export { SignalBridge, useSignal, useSignalConfig, useSignalEvent, useSignalExperiment, useSignalOutcome } from './chunk-YFGKIKXA.mjs';
|
|
9
|
-
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-
|
|
9
|
+
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-T4QBSRA4.mjs';
|
|
10
10
|
export { BookingWidget, createBooking, createSlotHold, detectTimezone, fetchAvailability, fetchAvailableDates, fetchBookingTypeDetails, fetchBookingTypes, formatDate as formatBookingDate, formatTime as formatBookingTime, formatDuration, releaseSlotHold } from './chunk-FMZOZQBV.mjs';
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
11
|
+
import './chunk-AN4ATCYQ.mjs';
|
|
12
|
+
import './chunk-65SMJBHW.mjs';
|
|
13
|
+
import './chunk-3DPXOZAU.mjs';
|
|
13
14
|
import './chunk-EE6SFAZP.mjs';
|
|
14
15
|
import './chunk-4XPGGLVP.mjs';
|
|
15
16
|
import { useState, useEffect } from 'react';
|
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,SAA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,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,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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A,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"]}
|
package/dist/layout/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkNNZDHLXN_js = require('../chunk-NNZDHLXN.js');
|
|
5
5
|
require('../chunk-HGNSJXWT.js');
|
|
6
6
|
require('../chunk-O7E6QVK3.js');
|
|
7
7
|
require('../chunk-3BNFUMLL.js');
|
|
@@ -11,7 +11,7 @@ require('../chunk-ZSMWDLMK.js');
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "SiteKitClientProviders", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkNNZDHLXN_js.SiteKitClientProviders; }
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=client.js.map
|
|
17
17
|
//# 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 chunkNNZDHLXN_js = require('../chunk-NNZDHLXN.js');
|
|
4
4
|
require('../chunk-HGNSJXWT.js');
|
|
5
5
|
var chunkGCPPXUAI_js = require('../chunk-GCPPXUAI.js');
|
|
6
6
|
require('../chunk-O7E6QVK3.js');
|
|
@@ -39,7 +39,7 @@ async function SiteKitLayout({
|
|
|
39
39
|
favicon && /* @__PURE__ */ jsxRuntime.jsx(chunkGCPPXUAI_js.ManagedFavicon, { apiKey: resolvedApiKey, apiUrl: resolvedApiUrl }),
|
|
40
40
|
managedScripts && /* @__PURE__ */ jsxRuntime.jsx(chunkDV2LJYFD_js.ManagedScripts, { position: "head" }),
|
|
41
41
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
42
|
-
|
|
42
|
+
chunkNNZDHLXN_js.SiteKitClientProviders,
|
|
43
43
|
{
|
|
44
44
|
apiKey: resolvedApiKey,
|
|
45
45
|
apiUrl: resolvedApiUrl,
|
package/dist/layout/index.mjs
CHANGED
package/dist/llms/index.d.mts
CHANGED
|
@@ -488,6 +488,10 @@ interface WriteLLMsTxtOptions {
|
|
|
488
488
|
/**
|
|
489
489
|
* Fetch optimized llms.txt from Portal and write to public/llms.txt
|
|
490
490
|
* Called at build time after sitemap sync (when optimizedLLMsTxt is enabled)
|
|
491
|
+
*
|
|
492
|
+
* Never persists a failure stub: when neither the Portal API nor local data
|
|
493
|
+
* yields real content, the write is skipped entirely so a previously
|
|
494
|
+
* generated (or committed) file keeps serving.
|
|
491
495
|
*/
|
|
492
496
|
declare function writeLLMsTxtToPublic(options?: WriteLLMsTxtOptions): Promise<{
|
|
493
497
|
success: boolean;
|
package/dist/llms/index.d.ts
CHANGED
|
@@ -488,6 +488,10 @@ interface WriteLLMsTxtOptions {
|
|
|
488
488
|
/**
|
|
489
489
|
* Fetch optimized llms.txt from Portal and write to public/llms.txt
|
|
490
490
|
* Called at build time after sitemap sync (when optimizedLLMsTxt is enabled)
|
|
491
|
+
*
|
|
492
|
+
* Never persists a failure stub: when neither the Portal API nor local data
|
|
493
|
+
* yields real content, the write is skipped entirely so a previously
|
|
494
|
+
* generated (or committed) file keeps serving.
|
|
491
495
|
*/
|
|
492
496
|
declare function writeLLMsTxtToPublic(options?: WriteLLMsTxtOptions): Promise<{
|
|
493
497
|
success: boolean;
|
package/dist/llms/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk5B4FABFK_js = require('../chunk-5B4FABFK.js');
|
|
4
|
-
var
|
|
4
|
+
var chunk7TX5BKVA_js = require('../chunk-7TX5BKVA.js');
|
|
5
5
|
var chunkATG4FJY6_js = require('../chunk-ATG4FJY6.js');
|
|
6
6
|
var chunkJ7QI3GDX_js = require('../chunk-J7QI3GDX.js');
|
|
7
7
|
require('../chunk-ZSMWDLMK.js');
|
|
@@ -37,7 +37,7 @@ function createLLMsTxtHandler(options = {}) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const { markdown, metadata } = await
|
|
40
|
+
const { markdown, metadata } = await chunk7TX5BKVA_js.generateLLMsTxt(generateOptions);
|
|
41
41
|
return new Response(markdown, {
|
|
42
42
|
status: 200,
|
|
43
43
|
headers: llmsResponseHeaders(markdown, {
|
|
@@ -71,7 +71,7 @@ function createLLMsFullTxtHandler(options = {}) {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
const { markdown, metadata } = await
|
|
74
|
+
const { markdown, metadata } = await chunk7TX5BKVA_js.generateLLMsFullTxt(generateOptions);
|
|
75
75
|
return new Response(markdown, {
|
|
76
76
|
status: 200,
|
|
77
77
|
headers: llmsResponseHeaders(markdown, {
|
|
@@ -586,39 +586,39 @@ Object.defineProperty(exports, "buildAiDiscoveryHeaders", {
|
|
|
586
586
|
});
|
|
587
587
|
Object.defineProperty(exports, "generateLLMsFullTxt", {
|
|
588
588
|
enumerable: true,
|
|
589
|
-
get: function () { return
|
|
589
|
+
get: function () { return chunk7TX5BKVA_js.generateLLMsFullTxt; }
|
|
590
590
|
});
|
|
591
591
|
Object.defineProperty(exports, "generateLLMsTxt", {
|
|
592
592
|
enumerable: true,
|
|
593
|
-
get: function () { return
|
|
593
|
+
get: function () { return chunk7TX5BKVA_js.generateLLMsTxt; }
|
|
594
594
|
});
|
|
595
595
|
Object.defineProperty(exports, "getBusinessInfo", {
|
|
596
596
|
enumerable: true,
|
|
597
|
-
get: function () { return
|
|
597
|
+
get: function () { return chunk7TX5BKVA_js.getBusinessInfo; }
|
|
598
598
|
});
|
|
599
599
|
Object.defineProperty(exports, "getFAQItems", {
|
|
600
600
|
enumerable: true,
|
|
601
|
-
get: function () { return
|
|
601
|
+
get: function () { return chunk7TX5BKVA_js.getFAQItems; }
|
|
602
602
|
});
|
|
603
603
|
Object.defineProperty(exports, "getLLMsData", {
|
|
604
604
|
enumerable: true,
|
|
605
|
-
get: function () { return
|
|
605
|
+
get: function () { return chunk7TX5BKVA_js.getLLMsData; }
|
|
606
606
|
});
|
|
607
607
|
Object.defineProperty(exports, "getOptimizedLLMsTxt", {
|
|
608
608
|
enumerable: true,
|
|
609
|
-
get: function () { return
|
|
609
|
+
get: function () { return chunk7TX5BKVA_js.getOptimizedLLMsTxt; }
|
|
610
610
|
});
|
|
611
611
|
Object.defineProperty(exports, "getPageSummaries", {
|
|
612
612
|
enumerable: true,
|
|
613
|
-
get: function () { return
|
|
613
|
+
get: function () { return chunk7TX5BKVA_js.getPageSummaries; }
|
|
614
614
|
});
|
|
615
615
|
Object.defineProperty(exports, "getServices", {
|
|
616
616
|
enumerable: true,
|
|
617
|
-
get: function () { return
|
|
617
|
+
get: function () { return chunk7TX5BKVA_js.getServices; }
|
|
618
618
|
});
|
|
619
619
|
Object.defineProperty(exports, "writeLLMsTxtToPublic", {
|
|
620
620
|
enumerable: true,
|
|
621
|
-
get: function () { return
|
|
621
|
+
get: function () { return chunk7TX5BKVA_js.writeLLMsTxtToPublic; }
|
|
622
622
|
});
|
|
623
623
|
Object.defineProperty(exports, "LLMS_DISCLAIMER_MAX_LENGTH", {
|
|
624
624
|
enumerable: true,
|
package/dist/llms/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { buildAiDiscoveryHeaders } from '../chunk-H4OBGC43.mjs';
|
|
2
|
-
import { generateLLMsTxt, generateLLMsFullTxt } from '../chunk-
|
|
3
|
-
export { generateLLMsFullTxt, generateLLMsTxt, getBusinessInfo, getFAQItems, getLLMsData, getOptimizedLLMsTxt, getPageSummaries, getServices, writeLLMsTxtToPublic } from '../chunk-
|
|
2
|
+
import { generateLLMsTxt, generateLLMsFullTxt } from '../chunk-WN5A3KSY.mjs';
|
|
3
|
+
export { generateLLMsFullTxt, generateLLMsTxt, getBusinessInfo, getFAQItems, getLLMsData, getOptimizedLLMsTxt, getPageSummaries, getServices, writeLLMsTxtToPublic } from '../chunk-WN5A3KSY.mjs';
|
|
4
4
|
export { LLMS_DISCLAIMER_MAX_LENGTH, LLMS_PUBLIC_SUMMARY_MAX_LENGTH, LLM_GEO_CONTRACT_VERSION, MANAGED_LLM_SCHEMA_KNOWN_KEYS, pickManagedLlmSchemaForJsonLd, sanitizeLlmsDisclaimerLine, sanitizeLlmsPublicSummary, sanitizePrimaryLanguageTag } from '../chunk-H23ZT2I2.mjs';
|
|
5
5
|
import { safeJsonLd } from '../chunk-662YHKWW.mjs';
|
|
6
6
|
import '../chunk-4XPGGLVP.mjs';
|
package/dist/sitemap/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7TX5BKVA_js = require('../chunk-7TX5BKVA.js');
|
|
4
4
|
var chunkJP5WGL75_js = require('../chunk-JP5WGL75.js');
|
|
5
5
|
require('../chunk-ATG4FJY6.js');
|
|
6
6
|
require('../chunk-ZSMWDLMK.js');
|
|
@@ -500,7 +500,7 @@ function createSitemap(config) {
|
|
|
500
500
|
}
|
|
501
501
|
if (config.optimizedLLMsTxt !== false) {
|
|
502
502
|
try {
|
|
503
|
-
const writeResult = await
|
|
503
|
+
const writeResult = await chunk7TX5BKVA_js.writeLLMsTxtToPublic({
|
|
504
504
|
apiUrl,
|
|
505
505
|
apiKey,
|
|
506
506
|
full: config.optimizedLLMsFullTxt ?? false,
|
package/dist/sitemap/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkFLD5R2PT_js = require('./chunk-FLD5R2PT.js');
|
|
4
|
-
require('./chunk-3BNFUMLL.js');
|
|
5
|
-
require('./chunk-ZSMWDLMK.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "AnalyticsProvider", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () { return chunkFLD5R2PT_js.AnalyticsProvider; }
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "useAnalytics", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return chunkFLD5R2PT_js.useAnalytics; }
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "useAnalyticsOptional", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return chunkFLD5R2PT_js.useAnalyticsOptional; }
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(exports, "useTrackEvent", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () { return chunkFLD5R2PT_js.useTrackEvent; }
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=AnalyticsProvider-N3RNQXTK.js.map
|
|
26
|
-
//# sourceMappingURL=AnalyticsProvider-N3RNQXTK.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { AnalyticsProvider, useAnalytics, useAnalyticsOptional, useTrackEvent } from './chunk-ZDLBI3XX.mjs';
|
|
2
|
-
import './chunk-EE6SFAZP.mjs';
|
|
3
|
-
import './chunk-4XPGGLVP.mjs';
|
|
4
|
-
//# sourceMappingURL=AnalyticsProvider-UKF7ESSP.mjs.map
|
|
5
|
-
//# sourceMappingURL=AnalyticsProvider-UKF7ESSP.mjs.map
|