@lynx-seo/engine 3.3.1 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +63 -0
  2. package/dist/analytics/app-store-optimization-engine.d.ts +96 -0
  3. package/dist/analytics/behavioral-psychology-persuasion-engine.d.ts +48 -0
  4. package/dist/analytics/co-marketing-partner-scoring-engine.d.ts +58 -0
  5. package/dist/analytics/cold-email-outreach-engine.d.ts +58 -0
  6. package/dist/analytics/competitor-intelligence-radar-engine.d.ts +65 -0
  7. package/dist/analytics/customer-voice-research-voc-engine.d.ts +70 -0
  8. package/dist/analytics/directory-submissions-auditor-engine.d.ts +62 -0
  9. package/dist/analytics/earned-media-pr-pitch-engine.d.ts +56 -0
  10. package/dist/analytics/engineering-as-marketing-free-tool-engine.d.ts +67 -0
  11. package/dist/analytics/ethical-popup-overlay-engine.d.ts +59 -0
  12. package/dist/analytics/grand-slam-offer-engine.d.ts +68 -0
  13. package/dist/analytics/in-app-paywall-gate-engine.d.ts +69 -0
  14. package/dist/analytics/influencer-creator-campaign-engine.d.ts +67 -0
  15. package/dist/analytics/landing-page-hero-copy-engine.d.ts +49 -0
  16. package/dist/analytics/lead-capture-form-optimization-engine.d.ts +57 -0
  17. package/dist/analytics/lead-magnet-architecture-engine.d.ts +40 -0
  18. package/dist/analytics/product-hunt-launch-war-room-engine.d.ts +57 -0
  19. package/dist/analytics/recurring-marketing-loop-engine.d.ts +73 -0
  20. package/dist/analytics/revops-pipeline-scoring-engine.d.ts +58 -0
  21. package/dist/analytics/saas-pricing-packaging-engine.d.ts +55 -0
  22. package/dist/analytics/saas-value-metric-pricing-engine.d.ts +64 -0
  23. package/dist/analytics/server-side-tracking-capi-engine.d.ts +99 -0
  24. package/dist/analytics/signal-prospecting-qualification-engine.d.ts +54 -0
  25. package/dist/analytics/sms-marketing-compliance-engine.d.ts +62 -0
  26. package/dist/analytics/statistical-experiment-ab-testing-engine.d.ts +103 -0
  27. package/dist/analytics/subscription-churn-prevention-engine.d.ts +91 -0
  28. package/dist/analytics/user-onboarding-activation-engine.d.ts +68 -0
  29. package/dist/cro-landing-page-auditor.d.ts +3 -3
  30. package/dist/http-middleware.d.ts +121 -0
  31. package/dist/index.d.ts +39 -0
  32. package/dist/index.js +4706 -22
  33. package/dist/index.mjs +4706 -22
  34. package/dist/matrix-engine.d.ts +3 -0
  35. package/dist/mcp-seo-server.js +7 -1
  36. package/dist/plugins/two-factor-auth/index.d.ts +3 -2
  37. package/dist/sample-dataset.d.ts +15 -0
  38. package/dist/types.d.ts +3 -0
  39. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @file saas-value-metric-pricing-engine.ts
3
+ * @description Moteur d'optimisation de Value Metric, grille tarifaire 3 tiers et vecteur d'expansion SaaS.
4
+ * Évalue la pertinence de la métrique de valeur (usage vs siège vs hybride), modélise l'effet leurre (Decoy Effect),
5
+ * calcule l'ARPU prévisionnel, le NRR potentiel et génère la matrice de packaging optimale.
6
+ * Inspiré de la skill pricing et des meilleures pratiques OpenView / ProfitWell.
7
+ */
8
+ export type SaasValueMetricType = 'per_seat' | 'usage_volume' | 'hybrid_tier_usage' | 'revenue_percentage';
9
+ export interface SaasTierPricingInput {
10
+ name: string;
11
+ monthlyPriceEur: number;
12
+ annualBilledMonthlyPriceEur: number;
13
+ includedQuotaMetric: string;
14
+ includedSeats: number;
15
+ targetCustomerSegment: string;
16
+ isPopularDecoyAnchor?: boolean;
17
+ }
18
+ export interface SaasValueMetricPricingInput {
19
+ productName: string;
20
+ valueMetricType: SaasValueMetricType;
21
+ primaryMetricUnit: string;
22
+ targetArpuEur?: number;
23
+ estimatedTotalCustomers?: number;
24
+ tiers?: SaasTierPricingInput[];
25
+ }
26
+ export interface SaasPricingTierOutput {
27
+ name: string;
28
+ monthlyPriceEur: number;
29
+ annualBilledMonthlyPriceEur: number;
30
+ annualSavingsPercent: number;
31
+ includedQuotaMetric: string;
32
+ includedSeats: number;
33
+ targetCustomerSegment: string;
34
+ isPopularDecoyAnchor: boolean;
35
+ projectedCustomerSharePercent: number;
36
+ }
37
+ export interface SaasValueMetricAudit {
38
+ metricType: SaasValueMetricType;
39
+ expansionPotentialScore: number;
40
+ seatSharingRiskScore: number;
41
+ alignmentWithCustomerSuccessScore: number;
42
+ keyMetricDiagnosis: string;
43
+ recommendation: string;
44
+ }
45
+ export interface SaasPricingFinancialForecast {
46
+ estimatedBlendedArpuEur: number;
47
+ estimatedMonthlyMrrEur: number;
48
+ estimatedAnnualArrEur: number;
49
+ projectedNrrExpansionPotentialPercent: number;
50
+ }
51
+ export interface SaasValueMetricPricingReport {
52
+ productName: string;
53
+ audit: SaasValueMetricAudit;
54
+ tiers: SaasPricingTierOutput[];
55
+ financials: SaasPricingFinancialForecast;
56
+ packagingRules: string[];
57
+ executiveSummary: string;
58
+ }
59
+ export declare class SaaSValueMetricPricingEngine {
60
+ /**
61
+ * Analyse et optimise la structure tarifaire SaaS et la métrique de facturation.
62
+ */
63
+ static evaluate(input: SaasValueMetricPricingInput): SaasValueMetricPricingReport;
64
+ }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @license AGPL-3.0-or-later
3
+ * LynxSEO - Server-Side Tracking & Conversion API (CAPI) Engine
4
+ *
5
+ * Implements modern multi-platform server-side measurement standards:
6
+ * 1. Cryptographic PII Normalization & SHA-256 Hashing:
7
+ * - RFC-compliant email sanitization (lowercase, whitespace stripped) + SHA-256.
8
+ * - E.164 phone number formatting + SHA-256.
9
+ * - First/last name, postal code, city and ISO country normalization + SHA-256.
10
+ * 2. Deterministic Browser / Server Deduplication:
11
+ * - Matching `event_id` and `event_name` pairing between client pixel and server CAPI.
12
+ * - Server event timestamp validation within 48-hour attribution window.
13
+ * 3. Event Match Quality (EMQ) Scoring (0.0 to 10.0 scale):
14
+ * - Meta CAPI & Google Ads Enhanced Conversions signal density calculation.
15
+ * 4. Adblocker & iOS ATT Signal Recovery Modeler:
16
+ * - Simulates lost conversion recovery (+15% to +35% additional tracked GMV).
17
+ * 5. Multi-Platform Payload Formatter:
18
+ * - Meta CAPI (Graph API v20.0 `/events`), Google Ads Enhanced Conversions API, TikTok Events API v1.3.
19
+ */
20
+ export interface RawUserDataInput {
21
+ email?: string;
22
+ phone?: string;
23
+ firstName?: string;
24
+ lastName?: string;
25
+ city?: string;
26
+ postalCode?: string;
27
+ countryCode?: string;
28
+ clientIpAddress?: string;
29
+ clientUserAgent?: string;
30
+ fbpCookie?: string;
31
+ fbcCookie?: string;
32
+ }
33
+ export interface HashedUserData {
34
+ em?: string[];
35
+ ph?: string[];
36
+ fn?: string[];
37
+ ln?: string[];
38
+ ct?: string[];
39
+ zp?: string[];
40
+ country?: string[];
41
+ client_ip_address?: string;
42
+ client_user_agent?: string;
43
+ fbp?: string;
44
+ fbc?: string;
45
+ }
46
+ export interface ServerEventInput {
47
+ eventId: string;
48
+ eventName: "Purchase" | "Lead" | "CompleteRegistration" | "ViewContent" | "InitiateCheckout";
49
+ eventTimeUnix: number;
50
+ eventSourceUrl: string;
51
+ actionSource: "website" | "app" | "system_generated";
52
+ currency?: string;
53
+ value?: number;
54
+ userData: RawUserDataInput;
55
+ hasBrowserPixelDuplicate: boolean;
56
+ }
57
+ export interface EmqEvaluation {
58
+ score: number;
59
+ grade: "poor" | "fair" | "good" | "excellent";
60
+ providedSignals: string[];
61
+ missingHighImpactSignals: string[];
62
+ }
63
+ export interface SignalRecoveryProjection {
64
+ baselineBrowserOnlyTrackedConversions: number;
65
+ adblockerLossRatePct: number;
66
+ recoveredConversionsViaServer: number;
67
+ totalHybridTrackedConversions: number;
68
+ incrementalConversionLiftPct: number;
69
+ recoveredRevenueAmount: number;
70
+ }
71
+ export interface FormattedPlatformPayloads {
72
+ metaCapi: Record<string, unknown>;
73
+ googleEnhancedConversions: Record<string, unknown>;
74
+ tiktokEventsApi: Record<string, unknown>;
75
+ }
76
+ export interface ServerSideTrackingAuditReport {
77
+ eventId: string;
78
+ eventName: string;
79
+ isDeduplicationValid: boolean;
80
+ emq: EmqEvaluation;
81
+ recovery: SignalRecoveryProjection;
82
+ hashedUserData: HashedUserData;
83
+ payloads: FormattedPlatformPayloads;
84
+ recommendations: string[];
85
+ }
86
+ export declare class ServerSideTrackingCapiEngine {
87
+ /**
88
+ * Fast pure JS SHA-256 hash implementation for zero-dependency portability
89
+ */
90
+ static sha256(ascii: string): string;
91
+ /**
92
+ * Normalizes & hashes user identity parameters conforming to Meta & Google privacy specs
93
+ */
94
+ static hashUserData(data: RawUserDataInput): HashedUserData;
95
+ /**
96
+ * Audits server-side event payload, computes EMQ score, and projects recovery lift
97
+ */
98
+ static audit(event: ServerEventInput, estimatedMonthlyOrders?: number): ServerSideTrackingAuditReport;
99
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Signal-Based B2B Outbound Prospecting & Qualification Engine
3
+ *
4
+ * Moteur de qualification de leads par signaux d'intention et d'affaires :
5
+ * - 4 Branches (SaaS B2B, Entreprise B2B, Commerce Local SMB, Signaux de Demande / Timing)
6
+ * - Matrice de score pondéré ICP + Signaux d'intention (0-100)
7
+ * - Tiers de priorité (Tier 1 Hot, Tier 2 Warm, Tier 3 Nurture)
8
+ * - Générateur d'accroches personnalisées (Icebreakers) contextualisées par le signal
9
+ *
10
+ * Déterministe, sans dépendance externe.
11
+ */
12
+ export type ProspectMotionBranch = "saas" | "b2b_general" | "local_smb" | "demand_signal";
13
+ export interface IntentSignalItem {
14
+ id: string;
15
+ type: "hiring_seo_specialist" | "tech_stack_migration" | "serp_drop_post_update" | "competitor_churn_frustration" | "missing_server_side_capi" | "slow_mobile_cwv" | "funding_growth_round";
16
+ detectedAtIso: string;
17
+ sourceContext: string;
18
+ }
19
+ export interface ProspectAccountInput {
20
+ id: string;
21
+ companyName: string;
22
+ domain: string;
23
+ branch: ProspectMotionBranch;
24
+ employeeCount: number;
25
+ industry: string;
26
+ country: string;
27
+ estimatedAnnualRevenueEur?: number;
28
+ signals: IntentSignalItem[];
29
+ }
30
+ export interface ProspectQualificationScores {
31
+ firmographicIcpScore: number;
32
+ intentSignalScore: number;
33
+ totalQualificationScore: number;
34
+ tier: "tier_1_hot" | "tier_2_warm" | "tier_3_nurture";
35
+ tierLabel: string;
36
+ recommendedSlaAction: string;
37
+ }
38
+ export interface ProspectIcebreakerHook {
39
+ channel: "cold_email" | "linkedin_inmail" | "executive_brief";
40
+ subjectLine: string;
41
+ openingSentence: string;
42
+ valuePropositionSnippet: string;
43
+ callToAction: string;
44
+ }
45
+ export interface QualifiedProspectReport {
46
+ account: ProspectAccountInput;
47
+ scores: ProspectQualificationScores;
48
+ detectedSignalsSummary: string[];
49
+ suggestedIcebreaker: ProspectIcebreakerHook;
50
+ }
51
+ export declare class SignalProspectingQualificationEngine {
52
+ private static getSignalWeight;
53
+ static evaluateProspect(account: ProspectAccountInput, senderBrand?: string): QualifiedProspectReport;
54
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * SMS Marketing & Regulatory Compliance Engine
3
+ *
4
+ * Moteur de rédaction, de calcul de segments GSM-7 et d'audit de conformité SMS (TCPA / RGPD) :
5
+ * - Comptage strict GSM-7 (160 caractères/segment standard, 153 car/segment pour les SMS concaténés).
6
+ * - Détection du basculement d'encodage UCS-2 (émojis ou caractères spéciaux réduisant le segment à 70 caractères).
7
+ * - Audit de conformité obligatoire :
8
+ * 1. Identification de la marque dès l'amorce.
9
+ * 2. Mot-clé de désabonnement obligatoire ("STOP pour stopper" ou "Reply STOP to cancel").
10
+ * 3. Règle des Heures de Silence (Quiet Hours : 8h00 - 21h00 heure locale du destinataire).
11
+ * 4. Consentement explicite traçable (TCPA / A2P 10DLC).
12
+ * - 4 Scénarios à fort ROI : Panier abandonné, Alerte SEO critique, Fin d'essai gratuit, Bienvenue.
13
+ */
14
+ export type SmsCampaignScenario = 'abandoned_checkout' | 'seo_critical_alert' | 'trial_ending_urgency' | 'welcome_activation';
15
+ export interface SmsDraftInput {
16
+ scenario: SmsCampaignScenario;
17
+ brandName: string;
18
+ recipientFirstName?: string;
19
+ dynamicDetail?: string;
20
+ ctaShortUrl: string;
21
+ includeEmoji?: boolean;
22
+ }
23
+ export interface SmsAuditComplianceResult {
24
+ hasBrandIdentification: boolean;
25
+ hasStopOptOut: boolean;
26
+ isCompliant: boolean;
27
+ complianceIssues: string[];
28
+ quietHoursNotice: string;
29
+ }
30
+ export interface SmsEncodingMetrics {
31
+ characterCount: number;
32
+ encoding: 'GSM-7' | 'UCS-2';
33
+ segmentsCount: number;
34
+ maxCharactersInCurrentSegment: number;
35
+ charactersRemainingInSegment: number;
36
+ estimatedCostPerMessageEur: number;
37
+ }
38
+ export interface SmsCampaignResult {
39
+ scenario: SmsCampaignScenario;
40
+ messageText: string;
41
+ encodingMetrics: SmsEncodingMetrics;
42
+ compliance: SmsAuditComplianceResult;
43
+ expectedMetrics: {
44
+ predictedOpenRatePct: number;
45
+ averageReadTimeMinutes: number;
46
+ predictedCtrPct: number;
47
+ };
48
+ }
49
+ export declare class SmsMarketingComplianceEngine {
50
+ /**
51
+ * Analyse le texte SMS, calcule le nombre de segments et vérifie l'encodage GSM-7 vs UCS-2
52
+ */
53
+ static analyzeEncoding(text: string): SmsEncodingMetrics;
54
+ /**
55
+ * Vérifie la conformité légale (TCPA, RGPD, Carrier rules)
56
+ */
57
+ static auditCompliance(text: string, brandName: string): SmsAuditComplianceResult;
58
+ /**
59
+ * Génère un SMS optimisé pour l'un des 4 scénarios stratégiques
60
+ */
61
+ static generateSms(input: SmsDraftInput): SmsCampaignResult;
62
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Statistical Experiment & A/B Testing Engine
3
+ *
4
+ * Moteur rigoureux de planification et d'analyse d'expérimentations statistiques A/B/n :
5
+ * - Calcul de taille d'échantillon minimale requise (formule d'Evan Miller / normale)
6
+ * - Durée prévisionnelle en jours basée sur le trafic journalier
7
+ * - Test Z pour deux proportions indépendantes, P-valeur bilatérale et IC à 95%
8
+ * - Détection du Sample Ratio Mismatch (SRM) par test du Chi-carré
9
+ * - Contrôle des biais de Peeking (arrêt prématuré) et Loi de Twyman (résultat trop beau pour être vrai)
10
+ * - Générateur d'hypothèse structurée actionnable
11
+ */
12
+ export interface SampleSizeParameters {
13
+ baselineConversionRate: number;
14
+ minimumDetectableEffect: number;
15
+ dailyTraffic: number;
16
+ statisticalPower?: number;
17
+ significanceLevel?: number;
18
+ }
19
+ export interface SampleSizeCalculationResult {
20
+ baselineRate: number;
21
+ targetRate: number;
22
+ mdePercent: number;
23
+ sampleSizePerVariant: number;
24
+ totalSampleSizeRequired: number;
25
+ estimatedDaysToRun: number;
26
+ isTrafficSufficient: boolean;
27
+ recommendation: string;
28
+ }
29
+ export interface AbTestEvaluationInput {
30
+ experimentName: string;
31
+ variantA: {
32
+ name: string;
33
+ visitors: number;
34
+ conversions: number;
35
+ };
36
+ variantB: {
37
+ name: string;
38
+ visitors: number;
39
+ conversions: number;
40
+ };
41
+ requiredSampleSizePerVariant?: number;
42
+ }
43
+ export interface AbTestEvaluationResult {
44
+ experimentName: string;
45
+ variantA: {
46
+ name: string;
47
+ visitors: number;
48
+ conversions: number;
49
+ conversionRate: number;
50
+ };
51
+ variantB: {
52
+ name: string;
53
+ visitors: number;
54
+ conversions: number;
55
+ conversionRate: number;
56
+ };
57
+ absoluteLift: number;
58
+ relativeLiftPercent: number;
59
+ zScore: number;
60
+ pValue: number;
61
+ isStatisticallySignificant: boolean;
62
+ confidenceInterval95: [number, number];
63
+ sampleRatioMismatch: {
64
+ isSrmDetected: boolean;
65
+ chiSquareValue: number;
66
+ pValueSrm: number;
67
+ message: string;
68
+ };
69
+ peekingRisk: {
70
+ hasPeekingRisk: boolean;
71
+ completionRatioPercent: number;
72
+ warningMessage?: string;
73
+ };
74
+ twymansLawAlert: boolean;
75
+ verdict: "winner_variant_b" | "winner_variant_a" | "inconclusive_flat" | "invalid_sample_ratio_mismatch" | "underpowered_continue_testing";
76
+ summary: string;
77
+ }
78
+ export interface HypothesisBlueprintInput {
79
+ observationData: string;
80
+ proposedChange: string;
81
+ expectedOutcome: string;
82
+ targetAudience: string;
83
+ primaryMetric: string;
84
+ guardrailMetric?: string;
85
+ }
86
+ export declare class StatisticalExperimentAbTestingEngine {
87
+ /**
88
+ * Calcule la taille d'échantillon par variante requise pour un test A/B standard.
89
+ */
90
+ static calculateSampleSize(params: SampleSizeParameters): SampleSizeCalculationResult;
91
+ /**
92
+ * Analyse et évalue les résultats d'un test A/B en cours ou terminé.
93
+ */
94
+ static evaluateExperiment(input: AbTestEvaluationInput): AbTestEvaluationResult;
95
+ /**
96
+ * Génère une hypothèse structurée respectant le template formel.
97
+ */
98
+ static generateStructuredHypothesis(input: HypothesisBlueprintInput): string;
99
+ /**
100
+ * Approximation de la fonction de répartition normale standard CDF Phi(x).
101
+ */
102
+ private static normalCdf;
103
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Moteur d'Analyse et de Prévention du Churn SaaS & Rétention
3
+ *
4
+ * Inspiré du skill `churn-prevention` et des standards de rétention SaaS 2026 :
5
+ * - Gestion du Churn Volontaire (Flux d'Offboarding, Exit Survey & Save Offers dynamiques).
6
+ * - Gestion du Churn Involontaire (Échéancier de Dunning et smart retries pour échecs de paiement).
7
+ * - Conformité FTC 2024/2026 "Click-to-Cancel" (aucun confirm-shaming, 1 clic de confirmation si offre déclinée).
8
+ * - Modélisation financière du MRR/ARR sauvé et projection du taux de rétention.
9
+ */
10
+ export type SubscriptionCancellationReason = 'too_expensive' | 'low_usage' | 'missing_feature' | 'switching_competitor' | 'technical_issues' | 'temporary_need' | 'business_closed';
11
+ export type SaveOfferType = 'discount_50_pct_3mo' | 'pause_subscription' | 'downgrade_lite' | 'concierge_onboarding' | 'roadmap_early_access' | 'graceful_exit';
12
+ export interface SubscriptionCustomerProfile {
13
+ customerId: string;
14
+ planId: 'starter' | 'pro' | 'enterprise';
15
+ monthlyRateUsd: number;
16
+ tenureMonths: number;
17
+ usageEngagementScore: number;
18
+ lastActiveDaysAgo: number;
19
+ reportedReason?: SubscriptionCancellationReason;
20
+ competitorName?: string;
21
+ missingFeatureName?: string;
22
+ }
23
+ export interface SubscriptionDynamicSaveOffer {
24
+ type: SaveOfferType;
25
+ headline: string;
26
+ description: string;
27
+ ctaText: string;
28
+ declineText: string;
29
+ financialImpactPct: number;
30
+ pauseDurationDays?: number;
31
+ estimatedAcceptanceRate: number;
32
+ }
33
+ export interface DunningRecoveryStep {
34
+ dayOffset: number;
35
+ channel: 'email' | 'in_app' | 'sms';
36
+ subject: string;
37
+ callToAction: string;
38
+ smartRetryRecommended: boolean;
39
+ }
40
+ export interface FtcClickToCancelAudit {
41
+ isFtcCompliant: boolean;
42
+ clearCancellationButton: boolean;
43
+ noArtificialPhoneCallRequired: boolean;
44
+ noGuiltTripConfirmShaming: boolean;
45
+ clearEndOfBillingAccessNotice: boolean;
46
+ violations: string[];
47
+ }
48
+ export interface ChurnPreventionAnalysisResult {
49
+ customerProfile: SubscriptionCustomerProfile;
50
+ recommendedSaveOffer: SubscriptionDynamicSaveOffer;
51
+ secondaryOffer?: SubscriptionDynamicSaveOffer;
52
+ ftcCompliance: FtcClickToCancelAudit;
53
+ dunningRecoveryCadence: DunningRecoveryStep[];
54
+ economics: {
55
+ mrrAtRiskUsd: number;
56
+ annualizedAtRiskUsd: number;
57
+ expectedMrrSavedMonthlyUsd: number;
58
+ expectedArrSavedAnnualUsd: number;
59
+ baselineSaveRateEstimatePct: number;
60
+ };
61
+ }
62
+ export declare class SubscriptionChurnPreventionEngine {
63
+ /**
64
+ * Analyse le profil du client en demande de résiliation et génère l'offre de sauvetage dynamique optimale.
65
+ */
66
+ static evaluateCancelFlow(profile: SubscriptionCustomerProfile, customOptions?: {
67
+ hasSelfServeCancel?: boolean;
68
+ requireCallToCancel?: boolean;
69
+ useGuiltTripShaming?: boolean;
70
+ }): ChurnPreventionAnalysisResult;
71
+ /**
72
+ * Détermine l'offre de rétention dynamique principale selon la raison invoquée.
73
+ */
74
+ private static resolvePrimarySaveOffer;
75
+ /**
76
+ * Offre alternative de second recours si la première est déclinée.
77
+ */
78
+ private static resolveSecondarySaveOffer;
79
+ /**
80
+ * Vérifie la conformité FTC 2024/2026 "Click-to-Cancel Rule"
81
+ */
82
+ static auditFtcCompliance(options: {
83
+ hasSelfServeCancel: boolean;
84
+ requireCallToCancel: boolean;
85
+ useGuiltTripShaming: boolean;
86
+ }): FtcClickToCancelAudit;
87
+ /**
88
+ * Échéancier de relances et smart-retries pour le churn involontaire (Dunning Recovery).
89
+ */
90
+ static getDunningCadence(): DunningRecoveryStep[];
91
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Moteur d'Analyse et d'Optimisation de l'Onboarding & Activation Utilisateur
3
+ *
4
+ * Inspiré du skill `onboarding` et de la psychologie comportementale du produit SaaS :
5
+ * - Minimum Path to Value (MPTV) : réduction drastique du Time-to-Value vers l'Aha Moment.
6
+ * - Endowed Progress Effect : pré-complétion de la première étape (+40% de taux d'achèvement).
7
+ * - Modèle de comportement BJ Fogg (Motivation × Capacité × Déclencheur).
8
+ * - Diagnostic des Accélérateurs (Boosters) vs Obstacles (Blockers) dans le parcours premier run.
9
+ * - Empty State CRO : évaluation des états vides transformés en tremplins d'action.
10
+ */
11
+ export interface OnboardingStepDefinition {
12
+ id: string;
13
+ title: string;
14
+ description: string;
15
+ isCompleted: boolean;
16
+ isEndowedPrecompleted?: boolean;
17
+ estimatedSecondsToComplete: number;
18
+ foggDifficultyLevel: 'low' | 'medium' | 'high';
19
+ isAhaMoment: boolean;
20
+ boosterFeature?: string;
21
+ blockerRisk?: string;
22
+ }
23
+ export interface EmptyStateAudit {
24
+ hasActionableCta: boolean;
25
+ hasPreloadedTemplateOrSample: boolean;
26
+ hasEducationalMicrocopy: boolean;
27
+ isDeadEnd: boolean;
28
+ croScore: number;
29
+ recommendations: string[];
30
+ }
31
+ export interface OnboardingAuditInput {
32
+ activationGoal: string;
33
+ steps: OnboardingStepDefinition[];
34
+ hasEndowedProgress: boolean;
35
+ emptyState: {
36
+ hasSampleData: boolean;
37
+ hasOneClickStarter: boolean;
38
+ isPlainGrayBox: boolean;
39
+ };
40
+ }
41
+ export interface OnboardingAuditReport {
42
+ activationGoal: string;
43
+ totalSteps: number;
44
+ completedSteps: number;
45
+ completionRatePct: number;
46
+ endowedBonusPct: number;
47
+ estimatedTimeToAhaSeconds: number;
48
+ ahaMomentStep?: OnboardingStepDefinition;
49
+ frictionBlockers: string[];
50
+ recommendedBoosters: string[];
51
+ emptyStateAudit: EmptyStateAudit;
52
+ overallActivationHealthScore: number;
53
+ verdict: 'EXCELLENT_ACTIVATION' | 'ACCEPTABLE_PATH' | 'HIGH_FRICTION_DROP_OFF';
54
+ }
55
+ export declare class UserOnboardingActivationEngine {
56
+ /**
57
+ * Analyse le flux d'onboarding complet et produit un diagnostic chiffré.
58
+ */
59
+ static evaluateOnboarding(input: OnboardingAuditInput): OnboardingAuditReport;
60
+ /**
61
+ * Évalue la qualité de conversion d'un conteneur d'état vide (Empty State CRO).
62
+ */
63
+ static evaluateEmptyState(config: {
64
+ hasSampleData: boolean;
65
+ hasOneClickStarter: boolean;
66
+ isPlainGrayBox: boolean;
67
+ }): EmptyStateAudit;
68
+ }
@@ -48,15 +48,15 @@ export declare class CroLandingPageAuditor {
48
48
  /**
49
49
  * Evaluates the 5-second Value Proposition clarity.
50
50
  */
51
- evaluateValueProposition(headline: string, subheadline?: string): CroDimensionScore;
51
+ evaluateValueProposition(headline?: string, subheadline?: string): CroDimensionScore;
52
52
  /**
53
53
  * Evaluates Headline effectiveness and specificity.
54
54
  */
55
- evaluateHeadline(headline: string): CroDimensionScore;
55
+ evaluateHeadline(headline?: string): CroDimensionScore;
56
56
  /**
57
57
  * Evaluates CTA Action-Verb clarity and friction reducers.
58
58
  */
59
- evaluateCta(ctaText: string, ctaSubtext?: string, requiresCreditCard?: boolean): CroDimensionScore;
59
+ evaluateCta(ctaText?: string, ctaSubtext?: string, requiresCreditCard?: boolean): CroDimensionScore;
60
60
  /**
61
61
  * Evaluates social proof density and trust signals.
62
62
  */
@@ -0,0 +1,121 @@
1
+ /**
2
+ * 🚀 Universal HTTP Middleware & Node Handler for LynxSEO Engine
3
+ *
4
+ * Provides drop-in 1-line integration for Express, Connect, Polka, and native Node.js:
5
+ * 1. Serves /sitemap-pseo.xml and /sitemap.xml dynamically with proper caching headers.
6
+ * 2. Serves /llms.txt for AI crawlers (Perplexity, ChatGPT, Claude).
7
+ * 3. Serves /robots.txt with AI search crawler directives.
8
+ * 4. Automatically records visitor pageviews & AI bot hits in non-blocking fashion.
9
+ * 5. Provides an optional API endpoint /api/lynx/analytics for AnalyticsSummaryReport.
10
+ */
11
+ import type { LynxSeoEngine } from "./engine";
12
+ export interface LynxMiddlewareOptions {
13
+ /**
14
+ * Path to serve the programmatic sitemap.
15
+ * @default "/sitemap-pseo.xml"
16
+ */
17
+ sitemapPath?: string;
18
+ /**
19
+ * Also serve the root /sitemap.xml as an alias.
20
+ * @default true
21
+ */
22
+ serveRootSitemap?: boolean;
23
+ /**
24
+ * Path to serve the /llms.txt AI crawler manifest.
25
+ * @default "/llms.txt"
26
+ */
27
+ llmsTxtPath?: string;
28
+ /**
29
+ * Path to serve /robots.txt.
30
+ * Set to false to disable handling robots.txt.
31
+ * @default "/robots.txt"
32
+ */
33
+ robotsTxtPath?: string | false;
34
+ /**
35
+ * Path to serve the JSON AnalyticsSummaryReport.
36
+ * Useful for internal dashboards or monitoring.
37
+ * By default, this is disabled (false) to prevent public visitors from reading traffic/stats.
38
+ * Set to a path (e.g. "/api/lynx/analytics") or true to enable.
39
+ * When enabled, you can protect it using `authorizeAnalytics`.
40
+ * @default false
41
+ */
42
+ analyticsReportPath?: string | boolean;
43
+ /**
44
+ * Optional authorization check for the analytics endpoint.
45
+ * If provided and returns false or rejects, returns a 401/403 status.
46
+ * Can inspect request headers (e.g. Authorization Bearer token or cookie).
47
+ */
48
+ authorizeAnalytics?: (req: ExpressReq) => boolean | Promise<boolean>;
49
+ /**
50
+ * Cache-Control header max-age in seconds for sitemap and text feeds.
51
+ * @default 3600 (1 hour)
52
+ */
53
+ cacheMaxAge?: number;
54
+ /**
55
+ * Whether to automatically track pageviews on GET HTML requests.
56
+ * Ignores static assets (.js, .css, .png, etc.).
57
+ * @default true
58
+ */
59
+ autoTrackPageViews?: boolean;
60
+ }
61
+ export type ExpressReq = {
62
+ method?: string;
63
+ url?: string;
64
+ originalUrl?: string;
65
+ path?: string;
66
+ headers?: Record<string, string | string[] | undefined>;
67
+ get?: (headerName: string) => string | undefined;
68
+ query?: Record<string, unknown>;
69
+ };
70
+ export type ExpressRes = {
71
+ setHeader: (name: string, value: string | number | readonly string[]) => void;
72
+ status?: (code: number) => ExpressRes;
73
+ statusCode: number;
74
+ end: (chunk?: unknown, encoding?: string) => void;
75
+ send?: (body?: unknown) => void;
76
+ json?: (body?: unknown) => void;
77
+ };
78
+ export type ExpressNext = (err?: unknown) => void;
79
+ /**
80
+ * Creates a universal Node.js request handler function.
81
+ * Returns `true` if the request was handled and completed, `false` otherwise.
82
+ */
83
+ export declare function createLynxNodeHandler(engine: LynxSeoEngine, options?: LynxMiddlewareOptions): (req: ExpressReq, res: ExpressRes, next?: ExpressNext) => Promise<boolean>;
84
+ /**
85
+ * Standard Express / Connect middleware ready for 1-line app.use().
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * import express from "express";
90
+ * import { LynxSeoEngine, expressMiddleware } from "@lynx-seo/engine";
91
+ *
92
+ * const app = express();
93
+ * const engine = new LynxSeoEngine({ ... });
94
+ *
95
+ * // 1 line plugs /sitemap-pseo.xml, /llms.txt, /robots.txt and auto-tracking
96
+ * app.use(expressMiddleware(engine));
97
+ * ```
98
+ */
99
+ export declare function expressMiddleware(engine: LynxSeoEngine, options?: LynxMiddlewareOptions): (req: ExpressReq, res: ExpressRes, next: ExpressNext) => void;
100
+ /**
101
+ * Native Node.js HTTP request handler (creates a `(req, res) => Promise<boolean>` function).
102
+ * Returns `true` if the route was handled and `res.end()` was called, `false` otherwise.
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * import http from "node:http";
107
+ * import { LynxSeoEngine, nodeHandler } from "@lynx-seo/engine";
108
+ *
109
+ * const engine = new LynxSeoEngine({ ... });
110
+ * const handleLynx = nodeHandler(engine);
111
+ *
112
+ * const server = http.createServer(async (req, res) => {
113
+ * const handled = await handleLynx(req, res);
114
+ * if (handled) return; // Lynx handled /sitemap.xml, /robots.txt, etc.
115
+ *
116
+ * // Fallback to your custom SPA / static router
117
+ * serveStatic(req, res);
118
+ * });
119
+ * ```
120
+ */
121
+ export declare const nodeHandler: typeof createLynxNodeHandler;