@distinctagency/cms-client 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -297,9 +297,9 @@ declare function createShopClient(supabase: SupabaseClient, options: {
297
297
  };
298
298
 
299
299
  interface CmsAnalyticsProps {
300
- /** The CMS tracking endpoint URL */
301
- trackingUrl?: string;
302
- /** Tenant API key */
300
+ /** The CMS tracking endpoint URL (required — your CMS app URL + /api/track) */
301
+ trackingUrl: string;
302
+ /** Tenant API key (public, read-only — safe for client-side use) */
303
303
  apiKey: string;
304
304
  /** Content item ID (from CMS) */
305
305
  contentItemId?: string;
@@ -316,9 +316,13 @@ interface CmsAnalyticsProps {
316
316
  * Drop-in analytics component for CMS content pages.
317
317
  * Tracks page views, scroll depth, and time on page.
318
318
  *
319
+ * The apiKey is a public, read-only tenant identifier — it only grants
320
+ * access to published content and is safe for client-side use.
321
+ *
319
322
  * Usage:
320
323
  * ```tsx
321
324
  * <CmsAnalytics
325
+ * trackingUrl={process.env.NEXT_PUBLIC_CMS_URL + "/api/track"}
322
326
  * apiKey={process.env.NEXT_PUBLIC_CMS_API_KEY!}
323
327
  * contentTypeSlug="blog_posts"
324
328
  * itemSlug={params.slug}
@@ -328,9 +332,9 @@ interface CmsAnalyticsProps {
328
332
  declare function CmsAnalytics({ trackingUrl, apiKey, contentItemId, contentTypeSlug, itemSlug, trackScroll, trackTime, }: CmsAnalyticsProps): null;
329
333
 
330
334
  interface PageTrackerProps {
331
- /** The CMS tracking endpoint URL */
332
- trackingUrl?: string;
333
- /** Tenant API key */
335
+ /** The CMS tracking endpoint URL (required — your CMS app URL + /api/track) */
336
+ trackingUrl: string;
337
+ /** Tenant API key (public, read-only — safe for client-side use) */
334
338
  apiKey: string;
335
339
  /** Enable scroll depth tracking (default: true) */
336
340
  trackScroll?: boolean;
@@ -341,13 +345,19 @@ interface PageTrackerProps {
341
345
  * Site-wide page tracker. Add once in root layout to track all pages.
342
346
  * Automatically detects CMS content pages from URL structure.
343
347
  *
348
+ * The apiKey is a public, read-only tenant identifier — it only grants
349
+ * access to published content and is safe for client-side use.
350
+ *
344
351
  * Usage in src/app/layout.tsx:
345
352
  * ```tsx
346
- * import { PageTracker } from "@distinct-cms/client"
353
+ * import { PageTracker } from "@distinctagency/cms-client"
347
354
  *
348
355
  * <body>
349
356
  * {children}
350
- * <PageTracker apiKey={process.env.NEXT_PUBLIC_CMS_API_KEY!} />
357
+ * <PageTracker
358
+ * trackingUrl={process.env.NEXT_PUBLIC_CMS_URL + "/api/track"}
359
+ * apiKey={process.env.NEXT_PUBLIC_CMS_API_KEY!}
360
+ * />
351
361
  * </body>
352
362
  * ```
353
363
  */
package/dist/index.d.ts CHANGED
@@ -297,9 +297,9 @@ declare function createShopClient(supabase: SupabaseClient, options: {
297
297
  };
298
298
 
299
299
  interface CmsAnalyticsProps {
300
- /** The CMS tracking endpoint URL */
301
- trackingUrl?: string;
302
- /** Tenant API key */
300
+ /** The CMS tracking endpoint URL (required — your CMS app URL + /api/track) */
301
+ trackingUrl: string;
302
+ /** Tenant API key (public, read-only — safe for client-side use) */
303
303
  apiKey: string;
304
304
  /** Content item ID (from CMS) */
305
305
  contentItemId?: string;
@@ -316,9 +316,13 @@ interface CmsAnalyticsProps {
316
316
  * Drop-in analytics component for CMS content pages.
317
317
  * Tracks page views, scroll depth, and time on page.
318
318
  *
319
+ * The apiKey is a public, read-only tenant identifier — it only grants
320
+ * access to published content and is safe for client-side use.
321
+ *
319
322
  * Usage:
320
323
  * ```tsx
321
324
  * <CmsAnalytics
325
+ * trackingUrl={process.env.NEXT_PUBLIC_CMS_URL + "/api/track"}
322
326
  * apiKey={process.env.NEXT_PUBLIC_CMS_API_KEY!}
323
327
  * contentTypeSlug="blog_posts"
324
328
  * itemSlug={params.slug}
@@ -328,9 +332,9 @@ interface CmsAnalyticsProps {
328
332
  declare function CmsAnalytics({ trackingUrl, apiKey, contentItemId, contentTypeSlug, itemSlug, trackScroll, trackTime, }: CmsAnalyticsProps): null;
329
333
 
330
334
  interface PageTrackerProps {
331
- /** The CMS tracking endpoint URL */
332
- trackingUrl?: string;
333
- /** Tenant API key */
335
+ /** The CMS tracking endpoint URL (required — your CMS app URL + /api/track) */
336
+ trackingUrl: string;
337
+ /** Tenant API key (public, read-only — safe for client-side use) */
334
338
  apiKey: string;
335
339
  /** Enable scroll depth tracking (default: true) */
336
340
  trackScroll?: boolean;
@@ -341,13 +345,19 @@ interface PageTrackerProps {
341
345
  * Site-wide page tracker. Add once in root layout to track all pages.
342
346
  * Automatically detects CMS content pages from URL structure.
343
347
  *
348
+ * The apiKey is a public, read-only tenant identifier — it only grants
349
+ * access to published content and is safe for client-side use.
350
+ *
344
351
  * Usage in src/app/layout.tsx:
345
352
  * ```tsx
346
- * import { PageTracker } from "@distinct-cms/client"
353
+ * import { PageTracker } from "@distinctagency/cms-client"
347
354
  *
348
355
  * <body>
349
356
  * {children}
350
- * <PageTracker apiKey={process.env.NEXT_PUBLIC_CMS_API_KEY!} />
357
+ * <PageTracker
358
+ * trackingUrl={process.env.NEXT_PUBLIC_CMS_URL + "/api/track"}
359
+ * apiKey={process.env.NEXT_PUBLIC_CMS_API_KEY!}
360
+ * />
351
361
  * </body>
352
362
  * ```
353
363
  */
package/dist/index.js CHANGED
@@ -6833,9 +6833,8 @@ function createShopClient(supabase, options) {
6833
6833
 
6834
6834
  // src/analytics.tsx
6835
6835
  var import_react = __toESM(require_react());
6836
- var DEFAULT_TRACKING_URL = "https://cms.distinctstudio.co.nz/api/track";
6837
6836
  function CmsAnalytics({
6838
- trackingUrl = DEFAULT_TRACKING_URL,
6837
+ trackingUrl,
6839
6838
  apiKey,
6840
6839
  contentItemId,
6841
6840
  contentTypeSlug,
@@ -6920,9 +6919,8 @@ function getSessionId() {
6920
6919
  // src/page-tracker.tsx
6921
6920
  var import_react2 = __toESM(require_react());
6922
6921
  var import_navigation = __toESM(require_navigation2());
6923
- var DEFAULT_TRACKING_URL2 = "https://cms.distinctstudio.co.nz/api/track";
6924
6922
  function PageTracker({
6925
- trackingUrl = DEFAULT_TRACKING_URL2,
6923
+ trackingUrl,
6926
6924
  apiKey,
6927
6925
  trackScroll = true,
6928
6926
  trackTime = true