@salesmind-ai/design-system 0.1.6 → 0.1.8
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/audit-CiyPkxk1.d.cts +194 -0
- package/dist/audit-CiyPkxk1.d.ts +194 -0
- package/dist/index.cjs +422 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +36 -19
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +400 -21
- package/dist/index.js.map +1 -1
- package/dist/marketing/index.cjs +132 -20
- package/dist/marketing/index.cjs.map +1 -1
- package/dist/marketing/index.css +1 -1
- package/dist/marketing/index.css.map +1 -1
- package/dist/marketing/index.js +133 -21
- package/dist/marketing/index.js.map +1 -1
- package/dist/styles/styles.css +4 -1
- package/dist/web/index.cjs +426 -9
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +27 -1
- package/dist/web/index.d.ts +27 -1
- package/dist/web/index.js +404 -11
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
package/dist/marketing/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React47, { forwardRef, useState, useRef, useEffect, useMemo, useCallback,
|
|
1
|
+
import React47, { forwardRef, useState, useRef, useEffect, createContext, useMemo, useCallback, useContext } from 'react';
|
|
2
2
|
import clsx39 from 'clsx';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { motion, useInView } from 'framer-motion';
|
|
@@ -560,23 +560,138 @@ var PlatformBadge = forwardRef(
|
|
|
560
560
|
}
|
|
561
561
|
);
|
|
562
562
|
PlatformBadge.displayName = "PlatformBadge";
|
|
563
|
+
var UtmContext = createContext(null);
|
|
564
|
+
|
|
565
|
+
// src/web/utm/useUtmDefaults.ts
|
|
566
|
+
function useUtmDefaults() {
|
|
567
|
+
return useContext(UtmContext);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// src/web/utm/builders.ts
|
|
571
|
+
var PLACEHOLDER_ORIGIN = "https://__placeholder__.internal";
|
|
572
|
+
function buildUtmUrl(baseUrl, params) {
|
|
573
|
+
const isRelative = baseUrl.startsWith("/");
|
|
574
|
+
let url;
|
|
575
|
+
try {
|
|
576
|
+
url = isRelative ? new URL(baseUrl, PLACEHOLDER_ORIGIN) : new URL(baseUrl);
|
|
577
|
+
} catch {
|
|
578
|
+
return baseUrl;
|
|
579
|
+
}
|
|
580
|
+
const existingParams = [];
|
|
581
|
+
url.searchParams.forEach((value, key) => {
|
|
582
|
+
existingParams.push([key, value]);
|
|
583
|
+
});
|
|
584
|
+
for (const [key] of existingParams) {
|
|
585
|
+
url.searchParams.delete(key);
|
|
586
|
+
}
|
|
587
|
+
for (const [key, value] of existingParams) {
|
|
588
|
+
if (!key.startsWith("utm_")) {
|
|
589
|
+
url.searchParams.set(key, value);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
url.searchParams.set("utm_source", params.source);
|
|
593
|
+
url.searchParams.set("utm_medium", params.medium);
|
|
594
|
+
url.searchParams.set("utm_campaign", params.campaign);
|
|
595
|
+
if (params.term !== void 0) {
|
|
596
|
+
url.searchParams.set("utm_term", params.term);
|
|
597
|
+
}
|
|
598
|
+
if (params.content !== void 0) {
|
|
599
|
+
url.searchParams.set("utm_content", params.content);
|
|
600
|
+
}
|
|
601
|
+
if (isRelative) {
|
|
602
|
+
return url.href.replace(PLACEHOLDER_ORIGIN, "");
|
|
603
|
+
}
|
|
604
|
+
return url.href;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// src/web/utm/classifiers.ts
|
|
608
|
+
var INTERNAL_PATTERNS = [
|
|
609
|
+
/^\/(?!\/)/,
|
|
610
|
+
// Relative paths
|
|
611
|
+
/^https?:\/\/(www\.)?sales-mind\.ai/i,
|
|
612
|
+
// Marketing site
|
|
613
|
+
/^https?:\/\/app\.sales-mind\.ai/i,
|
|
614
|
+
// Web app
|
|
615
|
+
/^https?:\/\/apps\.sales-mind\.ai/i,
|
|
616
|
+
// Web app (legacy)
|
|
617
|
+
/^https?:\/\/meet\.sales-mind\.ai/i,
|
|
618
|
+
// Booking
|
|
619
|
+
/^https?:\/\/docs\.sales-mind\.ai/i
|
|
620
|
+
// Docs
|
|
621
|
+
];
|
|
622
|
+
var SYSTEM_PATTERNS = [
|
|
623
|
+
/^https?:\/\/.*\/api\//i,
|
|
624
|
+
// API endpoints
|
|
625
|
+
/^https?:\/\/.*\/webhook/i,
|
|
626
|
+
// Webhooks
|
|
627
|
+
/^https?:\/\/.*\/oauth/i,
|
|
628
|
+
// OAuth callbacks
|
|
629
|
+
/^https?:\/\/.*\/callback/i,
|
|
630
|
+
// Callbacks
|
|
631
|
+
/^https?:\/\/.*\.supabase\.(co|com)/i,
|
|
632
|
+
// Supabase
|
|
633
|
+
/^https?:\/\/.*\.firebaseapp\.com/i,
|
|
634
|
+
// Firebase
|
|
635
|
+
/^https?:\/\/.*\.cloudfunctions\.net/i
|
|
636
|
+
// Cloud Functions
|
|
637
|
+
];
|
|
638
|
+
var ASSET_PATTERNS = [
|
|
639
|
+
/\.(css|js|mjs|map|woff2?|ttf|eot|svg|png|jpe?g|gif|webp|avif|ico|pdf)(\?.*)?$/i
|
|
640
|
+
];
|
|
641
|
+
var CONVERSION_PATTERNS = [
|
|
642
|
+
/^https?:\/\/(www\.)?calendly\.com/i,
|
|
643
|
+
/^https?:\/\/(checkout\.)?stripe\.com/i,
|
|
644
|
+
/^https?:\/\/buy\.stripe\.com/i,
|
|
645
|
+
/^https?:\/\/chromewebstore\.google\.com/i,
|
|
646
|
+
/^https?:\/\/meet\.sales-mind\.ai/i
|
|
647
|
+
];
|
|
648
|
+
var PROTOCOL_EXEMPT = [
|
|
649
|
+
/^mailto:/i,
|
|
650
|
+
/^tel:/i,
|
|
651
|
+
/^#/,
|
|
652
|
+
/^javascript:/i
|
|
653
|
+
];
|
|
654
|
+
function classifyUrl(url) {
|
|
655
|
+
if (PROTOCOL_EXEMPT.some((p) => p.test(url))) return "protocol";
|
|
656
|
+
if (ASSET_PATTERNS.some((p) => p.test(url))) return "asset";
|
|
657
|
+
if (SYSTEM_PATTERNS.some((p) => p.test(url))) return "system";
|
|
658
|
+
if (CONVERSION_PATTERNS.some((p) => p.test(url))) return "conversion";
|
|
659
|
+
if (INTERNAL_PATTERNS.some((p) => p.test(url))) return "internal";
|
|
660
|
+
return "external";
|
|
661
|
+
}
|
|
563
662
|
|
|
564
663
|
// src/components/OutboundLink/outbound-link-utils.ts
|
|
565
|
-
var
|
|
664
|
+
var LEGACY_UTM_SOURCE = "salesmind";
|
|
566
665
|
var EXEMPT_PATTERNS = [
|
|
567
666
|
/^https?:\/\/(www\.)?(stripe\.com|checkout\.stripe\.com|paypal\.com)/i,
|
|
568
667
|
/^https?:\/\/(www\.)?github\.com\/login\/oauth/i
|
|
569
668
|
];
|
|
570
669
|
var isExemptUrl = (urlStr) => {
|
|
571
670
|
if (urlStr.startsWith("mailto:") || urlStr.startsWith("tel:")) return true;
|
|
671
|
+
const classification = classifyUrl(urlStr);
|
|
672
|
+
if (classification === "system" || classification === "protocol" || classification === "asset") {
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
572
675
|
return EXEMPT_PATTERNS.some((pattern) => pattern.test(urlStr));
|
|
573
676
|
};
|
|
677
|
+
var appendGovernedUTMs = (href, params, preserveExisting = true) => {
|
|
678
|
+
try {
|
|
679
|
+
const url = new URL(href);
|
|
680
|
+
if (preserveExisting) {
|
|
681
|
+
const hasAll = url.searchParams.has("utm_source") && url.searchParams.has("utm_medium") && url.searchParams.has("utm_campaign");
|
|
682
|
+
if (hasAll) return href;
|
|
683
|
+
}
|
|
684
|
+
return buildUtmUrl(href, params);
|
|
685
|
+
} catch {
|
|
686
|
+
return href;
|
|
687
|
+
}
|
|
688
|
+
};
|
|
574
689
|
var appendUTMs = (href, context, pageSlug, options) => {
|
|
575
690
|
try {
|
|
576
691
|
const url = new URL(href);
|
|
577
692
|
const { mediumOverride = "outbound_link", campaignOverride, preserveExisting = true } = options;
|
|
578
693
|
const utms = {
|
|
579
|
-
utm_source:
|
|
694
|
+
utm_source: LEGACY_UTM_SOURCE,
|
|
580
695
|
utm_medium: mediumOverride,
|
|
581
696
|
utm_campaign: campaignOverride || pageSlug,
|
|
582
697
|
utm_content: context
|
|
@@ -603,10 +718,13 @@ var OutboundLink = forwardRef(
|
|
|
603
718
|
preserveExistingUTM = true,
|
|
604
719
|
openInNewTab = true,
|
|
605
720
|
disableTracking = false,
|
|
721
|
+
utmParams,
|
|
606
722
|
onClick,
|
|
607
723
|
children,
|
|
608
724
|
...props
|
|
609
725
|
}, ref) => {
|
|
726
|
+
const contextParams = useUtmDefaults();
|
|
727
|
+
const resolvedUtmParams = utmParams ?? contextParams;
|
|
610
728
|
let hostname = "";
|
|
611
729
|
try {
|
|
612
730
|
const url = new URL(href);
|
|
@@ -631,16 +749,20 @@ var OutboundLink = forwardRef(
|
|
|
631
749
|
}
|
|
632
750
|
const isExempt = isExemptUrl(href) || disableTracking;
|
|
633
751
|
if (isExternal && !isExempt) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
752
|
+
if (resolvedUtmParams) {
|
|
753
|
+
setFinalHref(appendGovernedUTMs(href, resolvedUtmParams, preserveExistingUTM));
|
|
754
|
+
} else {
|
|
755
|
+
const pageSlug = window.location.pathname.replace(/^\/|\/$/g, "") || "home";
|
|
756
|
+
setFinalHref(appendUTMs(href, context, pageSlug, {
|
|
757
|
+
mediumOverride: currentMedium,
|
|
758
|
+
campaignOverride,
|
|
759
|
+
preserveExisting: preserveExistingUTM
|
|
760
|
+
}));
|
|
761
|
+
}
|
|
640
762
|
} else {
|
|
641
763
|
setFinalHref(href);
|
|
642
764
|
}
|
|
643
|
-
}, [href, context, mediumOverride, campaignOverride, preserveExistingUTM, disableTracking]);
|
|
765
|
+
}, [href, context, mediumOverride, campaignOverride, preserveExistingUTM, disableTracking, resolvedUtmParams]);
|
|
644
766
|
const handleClick = (e) => {
|
|
645
767
|
if (typeof window === "undefined" || disableTracking) {
|
|
646
768
|
onClick?.(e);
|
|
@@ -913,17 +1035,6 @@ var LogoItemRender = ({ item, className }) => {
|
|
|
913
1035
|
] });
|
|
914
1036
|
if (item.href) {
|
|
915
1037
|
const isInternal = item.href.startsWith("/");
|
|
916
|
-
if (isInternal) {
|
|
917
|
-
return /* @__PURE__ */ jsx(
|
|
918
|
-
"a",
|
|
919
|
-
{
|
|
920
|
-
href: item.href,
|
|
921
|
-
className: clsx39("ds-social-logos__item", className),
|
|
922
|
-
title: item.alt,
|
|
923
|
-
children: innerContent
|
|
924
|
-
}
|
|
925
|
-
);
|
|
926
|
-
}
|
|
927
1038
|
return /* @__PURE__ */ jsx(
|
|
928
1039
|
OutboundLink,
|
|
929
1040
|
{
|
|
@@ -931,6 +1042,7 @@ var LogoItemRender = ({ item, className }) => {
|
|
|
931
1042
|
context: "social-proof-logo",
|
|
932
1043
|
className: clsx39("ds-social-logos__item", className),
|
|
933
1044
|
title: item.alt,
|
|
1045
|
+
openInNewTab: !isInternal,
|
|
934
1046
|
children: innerContent
|
|
935
1047
|
}
|
|
936
1048
|
);
|