lynkow 3.2.4 → 3.4.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/README.md CHANGED
@@ -410,7 +410,7 @@ const unsubscribe = lynkow.on('consent-changed', (categories) => {
410
410
  console.log('Consent changed:', categories)
411
411
  })
412
412
 
413
- // Unsubscribe when done
413
+ // Unsubscribe when done
414
414
  unsubscribe()
415
415
  ```
416
416
 
package/dist/index.d.mts CHANGED
@@ -763,6 +763,83 @@ interface Tag {
763
763
  locale: string;
764
764
  }
765
765
 
766
+ /**
767
+ * FAQ item detected from content
768
+ */
769
+ interface FaqItem {
770
+ /** Unique ID (8-char MD5 hash of normalized question) */
771
+ id: string;
772
+ /** Question text */
773
+ question: string;
774
+ /** Answer as HTML */
775
+ answerHtml: string;
776
+ /** Answer as plain text */
777
+ answerText: string;
778
+ /** Source of the FAQ */
779
+ source: 'explicit' | 'heading';
780
+ /** Whether this FAQ is enabled for JSON-LD */
781
+ enabled: boolean;
782
+ }
783
+ /**
784
+ * JSON-LD FAQPage schema
785
+ */
786
+ interface JsonLdFaqPage {
787
+ '@context': 'https://schema.org';
788
+ '@type': 'FAQPage';
789
+ mainEntity: Array<{
790
+ '@type': 'Question';
791
+ name: string;
792
+ acceptedAnswer: {
793
+ '@type': 'Answer';
794
+ text: string;
795
+ };
796
+ }>;
797
+ }
798
+ /**
799
+ * JSON-LD Article schema
800
+ */
801
+ interface JsonLdArticle {
802
+ '@context': 'https://schema.org';
803
+ '@type': 'Article';
804
+ headline: string;
805
+ description?: string;
806
+ image?: string;
807
+ datePublished?: string;
808
+ dateModified?: string;
809
+ author?: {
810
+ '@type': 'Person';
811
+ name: string;
812
+ };
813
+ }
814
+ /**
815
+ * Alternate language version
816
+ */
817
+ interface StructuredDataAlternate {
818
+ /** Locale code */
819
+ locale: string;
820
+ /** URL to this version */
821
+ url: string;
822
+ }
823
+ /**
824
+ * Structured data generated for a content
825
+ */
826
+ interface StructuredData {
827
+ /** Format version */
828
+ version: number;
829
+ /** FAQ data */
830
+ faq: {
831
+ /** All detected FAQ items */
832
+ items: FaqItem[];
833
+ /** JSON-LD FAQPage schema (null if no enabled items) */
834
+ jsonLd: JsonLdFaqPage | null;
835
+ };
836
+ /** Article JSON-LD schema */
837
+ article: {
838
+ jsonLd: JsonLdArticle;
839
+ };
840
+ /** Alternate language versions */
841
+ alternates: StructuredDataAlternate[];
842
+ }
766
843
  /**
767
844
  * Content author
768
845
  */
@@ -850,7 +927,7 @@ interface Content extends ContentSummary {
850
927
  /** Open Graph image */
851
928
  ogImage: string | null;
852
929
  /** JSON-LD structured data */
853
- structuredData: Record<string, unknown> | null;
930
+ structuredData: StructuredData | null;
854
931
  /** Article author */
855
932
  author: Author | null;
856
933
  /** Associated categories */
@@ -1797,6 +1874,58 @@ declare class BrandingService {
1797
1874
  destroy(): void;
1798
1875
  }
1799
1876
 
1877
+ /**
1878
+ * Content Enhancements module for Lynkow SDK
1879
+ *
1880
+ * Browser-only module. Adds interactive features to content rendered from the API:
1881
+ * - Copy button for code blocks
1882
+ * - (Future: lightbox for images, table of contents, etc.)
1883
+ */
1884
+ /**
1885
+ * Content Enhancements service
1886
+ *
1887
+ * Browser-only. All methods are no-op on server.
1888
+ *
1889
+ * @example
1890
+ * ```typescript
1891
+ * const lynkow = createClient({ siteId: 'your-site-id' })
1892
+ *
1893
+ * // Enhancements are automatically initialized
1894
+ * // Or manually reinitialize after dynamic content load:
1895
+ * lynkow.enhancements.init()
1896
+ * ```
1897
+ */
1898
+ declare class EnhancementsService {
1899
+ private initialized;
1900
+ private observer;
1901
+ /**
1902
+ * Inject styles into document head
1903
+ */
1904
+ private injectStyles;
1905
+ /**
1906
+ * Handle copy button click
1907
+ */
1908
+ private handleCopyClick;
1909
+ /**
1910
+ * Bind copy functionality to all code blocks
1911
+ */
1912
+ private bindCodeBlockCopy;
1913
+ /**
1914
+ * Initialize content enhancements
1915
+ *
1916
+ * Call this after loading dynamic content to bind event handlers.
1917
+ */
1918
+ init(): void;
1919
+ /**
1920
+ * Check if enhancements are initialized
1921
+ */
1922
+ isInitialized(): boolean;
1923
+ /**
1924
+ * Clean up resources
1925
+ */
1926
+ destroy(): void;
1927
+ }
1928
+
1800
1929
  /**
1801
1930
  * Lynkow SDK Client
1802
1931
  * Main entry point for the SDK
@@ -1873,6 +2002,10 @@ interface Client extends LynkowClient {
1873
2002
  * Branding service (badge for free plan)
1874
2003
  */
1875
2004
  branding: BrandingService;
2005
+ /**
2006
+ * Content enhancements service (code copy, etc.)
2007
+ */
2008
+ enhancements: EnhancementsService;
1876
2009
  }
1877
2010
  /**
1878
2011
  * Creates a Lynkow client instance (SDK v3)
@@ -2022,4 +2155,4 @@ declare function browserOnly<T>(fn: () => T, fallback: T): T;
2022
2155
  */
2023
2156
  declare function browserOnlyAsync<T>(fn: () => Promise<T>, fallback: T): Promise<T>;
2024
2157
 
2025
- export { type Alternate, type ApiErrorDetail, type Author, type BaseRequestOptions, type CategoriesListResponse, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, type Content, type ContentBody, type ContentResolveResponse, type ContentSummary, type ContentsFilters, type ContentsListResponse, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, type FunnelStepData, type GlobalBlock, type GlobalBlockResponse, type LegalDocument, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, type Page, type PageSeo, type PageSummary, type PagesListResponse, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, type SiteConfig, type SiteConfigResponse, type SortOptions, type SubmitOptions, type Tag, type TagsListResponse, type TipTapMark, type TipTapNode, browserOnly, browserOnlyAsync, createClient, createLynkowClient, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer };
2158
+ export { type Alternate, type ApiErrorDetail, type Author, type BaseRequestOptions, type CategoriesListResponse, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, type Content, type ContentBody, type ContentResolveResponse, type ContentSummary, type ContentsFilters, type ContentsListResponse, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, type FunnelStepData, type GlobalBlock, type GlobalBlockResponse, type LegalDocument, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, type Page, type PageSeo, type PageSummary, type PagesListResponse, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, type SiteConfig, type SiteConfigResponse, type SortOptions, type SubmitOptions, type Tag, type TagsListResponse, type TipTapMark, type TipTapNode, browserOnly, browserOnlyAsync, createClient, createLynkowClient, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer };
package/dist/index.d.ts CHANGED
@@ -763,6 +763,83 @@ interface Tag {
763
763
  locale: string;
764
764
  }
765
765
 
766
+ /**
767
+ * FAQ item detected from content
768
+ */
769
+ interface FaqItem {
770
+ /** Unique ID (8-char MD5 hash of normalized question) */
771
+ id: string;
772
+ /** Question text */
773
+ question: string;
774
+ /** Answer as HTML */
775
+ answerHtml: string;
776
+ /** Answer as plain text */
777
+ answerText: string;
778
+ /** Source of the FAQ */
779
+ source: 'explicit' | 'heading';
780
+ /** Whether this FAQ is enabled for JSON-LD */
781
+ enabled: boolean;
782
+ }
783
+ /**
784
+ * JSON-LD FAQPage schema
785
+ */
786
+ interface JsonLdFaqPage {
787
+ '@context': 'https://schema.org';
788
+ '@type': 'FAQPage';
789
+ mainEntity: Array<{
790
+ '@type': 'Question';
791
+ name: string;
792
+ acceptedAnswer: {
793
+ '@type': 'Answer';
794
+ text: string;
795
+ };
796
+ }>;
797
+ }
798
+ /**
799
+ * JSON-LD Article schema
800
+ */
801
+ interface JsonLdArticle {
802
+ '@context': 'https://schema.org';
803
+ '@type': 'Article';
804
+ headline: string;
805
+ description?: string;
806
+ image?: string;
807
+ datePublished?: string;
808
+ dateModified?: string;
809
+ author?: {
810
+ '@type': 'Person';
811
+ name: string;
812
+ };
813
+ }
814
+ /**
815
+ * Alternate language version
816
+ */
817
+ interface StructuredDataAlternate {
818
+ /** Locale code */
819
+ locale: string;
820
+ /** URL to this version */
821
+ url: string;
822
+ }
823
+ /**
824
+ * Structured data generated for a content
825
+ */
826
+ interface StructuredData {
827
+ /** Format version */
828
+ version: number;
829
+ /** FAQ data */
830
+ faq: {
831
+ /** All detected FAQ items */
832
+ items: FaqItem[];
833
+ /** JSON-LD FAQPage schema (null if no enabled items) */
834
+ jsonLd: JsonLdFaqPage | null;
835
+ };
836
+ /** Article JSON-LD schema */
837
+ article: {
838
+ jsonLd: JsonLdArticle;
839
+ };
840
+ /** Alternate language versions */
841
+ alternates: StructuredDataAlternate[];
842
+ }
766
843
  /**
767
844
  * Content author
768
845
  */
@@ -850,7 +927,7 @@ interface Content extends ContentSummary {
850
927
  /** Open Graph image */
851
928
  ogImage: string | null;
852
929
  /** JSON-LD structured data */
853
- structuredData: Record<string, unknown> | null;
930
+ structuredData: StructuredData | null;
854
931
  /** Article author */
855
932
  author: Author | null;
856
933
  /** Associated categories */
@@ -1797,6 +1874,58 @@ declare class BrandingService {
1797
1874
  destroy(): void;
1798
1875
  }
1799
1876
 
1877
+ /**
1878
+ * Content Enhancements module for Lynkow SDK
1879
+ *
1880
+ * Browser-only module. Adds interactive features to content rendered from the API:
1881
+ * - Copy button for code blocks
1882
+ * - (Future: lightbox for images, table of contents, etc.)
1883
+ */
1884
+ /**
1885
+ * Content Enhancements service
1886
+ *
1887
+ * Browser-only. All methods are no-op on server.
1888
+ *
1889
+ * @example
1890
+ * ```typescript
1891
+ * const lynkow = createClient({ siteId: 'your-site-id' })
1892
+ *
1893
+ * // Enhancements are automatically initialized
1894
+ * // Or manually reinitialize after dynamic content load:
1895
+ * lynkow.enhancements.init()
1896
+ * ```
1897
+ */
1898
+ declare class EnhancementsService {
1899
+ private initialized;
1900
+ private observer;
1901
+ /**
1902
+ * Inject styles into document head
1903
+ */
1904
+ private injectStyles;
1905
+ /**
1906
+ * Handle copy button click
1907
+ */
1908
+ private handleCopyClick;
1909
+ /**
1910
+ * Bind copy functionality to all code blocks
1911
+ */
1912
+ private bindCodeBlockCopy;
1913
+ /**
1914
+ * Initialize content enhancements
1915
+ *
1916
+ * Call this after loading dynamic content to bind event handlers.
1917
+ */
1918
+ init(): void;
1919
+ /**
1920
+ * Check if enhancements are initialized
1921
+ */
1922
+ isInitialized(): boolean;
1923
+ /**
1924
+ * Clean up resources
1925
+ */
1926
+ destroy(): void;
1927
+ }
1928
+
1800
1929
  /**
1801
1930
  * Lynkow SDK Client
1802
1931
  * Main entry point for the SDK
@@ -1873,6 +2002,10 @@ interface Client extends LynkowClient {
1873
2002
  * Branding service (badge for free plan)
1874
2003
  */
1875
2004
  branding: BrandingService;
2005
+ /**
2006
+ * Content enhancements service (code copy, etc.)
2007
+ */
2008
+ enhancements: EnhancementsService;
1876
2009
  }
1877
2010
  /**
1878
2011
  * Creates a Lynkow client instance (SDK v3)
@@ -2022,4 +2155,4 @@ declare function browserOnly<T>(fn: () => T, fallback: T): T;
2022
2155
  */
2023
2156
  declare function browserOnlyAsync<T>(fn: () => Promise<T>, fallback: T): Promise<T>;
2024
2157
 
2025
- export { type Alternate, type ApiErrorDetail, type Author, type BaseRequestOptions, type CategoriesListResponse, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, type Content, type ContentBody, type ContentResolveResponse, type ContentSummary, type ContentsFilters, type ContentsListResponse, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, type FunnelStepData, type GlobalBlock, type GlobalBlockResponse, type LegalDocument, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, type Page, type PageSeo, type PageSummary, type PagesListResponse, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, type SiteConfig, type SiteConfigResponse, type SortOptions, type SubmitOptions, type Tag, type TagsListResponse, type TipTapMark, type TipTapNode, browserOnly, browserOnlyAsync, createClient, createLynkowClient, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer };
2158
+ export { type Alternate, type ApiErrorDetail, type Author, type BaseRequestOptions, type CategoriesListResponse, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, type Content, type ContentBody, type ContentResolveResponse, type ContentSummary, type ContentsFilters, type ContentsListResponse, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, type FunnelStepData, type GlobalBlock, type GlobalBlockResponse, type LegalDocument, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, type Page, type PageSeo, type PageSummary, type PagesListResponse, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, type SiteConfig, type SiteConfigResponse, type SortOptions, type SubmitOptions, type Tag, type TagsListResponse, type TipTapMark, type TipTapNode, browserOnly, browserOnlyAsync, createClient, createLynkowClient, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer };