@greatapps/common 1.1.580 → 1.1.581
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.
|
@@ -30,15 +30,19 @@ function useHideCrispOnExcludedRoutes(isExcluded) {
|
|
|
30
30
|
}
|
|
31
31
|
}, [isExcluded]);
|
|
32
32
|
}
|
|
33
|
-
function EmbedWidgets(
|
|
33
|
+
function EmbedWidgets({
|
|
34
|
+
frill = true,
|
|
35
|
+
crisp = true,
|
|
36
|
+
clarity = true
|
|
37
|
+
} = {}) {
|
|
34
38
|
const pathname = usePathname();
|
|
35
39
|
const isExcluded = EXCLUDED_ROUTES.some((route) => pathname.startsWith(route));
|
|
36
40
|
useHideCrispOnExcludedRoutes(isExcluded);
|
|
37
41
|
if (isExcluded) return null;
|
|
38
42
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
-
/* @__PURE__ */ jsx(FrillEmbed, {}),
|
|
40
|
-
/* @__PURE__ */ jsx(CrispEmbed, {}),
|
|
41
|
-
/* @__PURE__ */ jsx(ClarityEmbed, {})
|
|
43
|
+
frill && /* @__PURE__ */ jsx(FrillEmbed, {}),
|
|
44
|
+
crisp && /* @__PURE__ */ jsx(CrispEmbed, {}),
|
|
45
|
+
clarity && /* @__PURE__ */ jsx(ClarityEmbed, {})
|
|
42
46
|
] });
|
|
43
47
|
}
|
|
44
48
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/embeds/EmbedWidgets.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport { usePathname } from 'next/navigation';\nimport { FrillEmbed } from './FrillEmbed';\nimport { CrispEmbed } from './CrispEmbed';\nimport { ClarityEmbed } from './ClarityEmbed';\n\nconst EXCLUDED_ROUTES = ['/login', '/forgot-password', '/register'];\n\nfunction getCrisp(): unknown[] | null {\n try {\n const key = '$crisp';\n if (!(key in window)) return null;\n const value = window[key];\n return Array.isArray(value) ? value : null;\n } catch {\n return null;\n }\n}\n\nfunction useHideCrispOnExcludedRoutes(isExcluded: boolean) {\n useEffect(() => {\n try {\n const $crisp = getCrisp();\n if (!$crisp) return;\n\n if (isExcluded) {\n $crisp.push(['do', 'chat:hide']);\n } else {\n $crisp.push(['do', 'chat:show']);\n }\n } catch {}\n }, [isExcluded]);\n}\n\nexport function EmbedWidgets() {\n const pathname = usePathname();\n const isExcluded = EXCLUDED_ROUTES.some((route) => pathname.startsWith(route));\n\n useHideCrispOnExcludedRoutes(isExcluded);\n\n if (isExcluded) return null;\n\n return (\n <>\n <FrillEmbed
|
|
1
|
+
{"version":3,"sources":["../../../src/components/embeds/EmbedWidgets.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\nimport { usePathname } from 'next/navigation';\nimport { FrillEmbed } from './FrillEmbed';\nimport { CrispEmbed } from './CrispEmbed';\nimport { ClarityEmbed } from './ClarityEmbed';\n\nconst EXCLUDED_ROUTES = ['/login', '/forgot-password', '/register'];\n\nfunction getCrisp(): unknown[] | null {\n try {\n const key = '$crisp';\n if (!(key in window)) return null;\n const value = window[key];\n return Array.isArray(value) ? value : null;\n } catch {\n return null;\n }\n}\n\nfunction useHideCrispOnExcludedRoutes(isExcluded: boolean) {\n useEffect(() => {\n try {\n const $crisp = getCrisp();\n if (!$crisp) return;\n\n if (isExcluded) {\n $crisp.push(['do', 'chat:hide']);\n } else {\n $crisp.push(['do', 'chat:show']);\n }\n } catch {}\n }, [isExcluded]);\n}\n\ntype EmbedWidgetsProps = {\n frill?: boolean;\n crisp?: boolean;\n clarity?: boolean;\n};\n\nexport function EmbedWidgets({\n frill = true,\n crisp = true,\n clarity = true,\n}: EmbedWidgetsProps = {}) {\n const pathname = usePathname();\n const isExcluded = EXCLUDED_ROUTES.some((route) => pathname.startsWith(route));\n\n useHideCrispOnExcludedRoutes(isExcluded);\n\n if (isExcluded) return null;\n\n return (\n <>\n {frill && <FrillEmbed />}\n {crisp && <CrispEmbed />}\n {clarity && <ClarityEmbed />}\n </>\n );\n}\n"],"mappings":";AAuDI,mBACY,KADZ;AArDJ,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAE7B,MAAM,kBAAkB,CAAC,UAAU,oBAAoB,WAAW;AAElE,SAAS,WAA6B;AACpC,MAAI;AACF,UAAM,MAAM;AACZ,QAAI,EAAE,OAAO,QAAS,QAAO;AAC7B,UAAM,QAAQ,OAAO,GAAG;AACxB,WAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ;AAAA,EACxC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,6BAA6B,YAAqB;AACzD,YAAU,MAAM;AACd,QAAI;AACF,YAAM,SAAS,SAAS;AACxB,UAAI,CAAC,OAAQ;AAEb,UAAI,YAAY;AACd,eAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAAA,MACjC,OAAO;AACL,eAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAAA,MACjC;AAAA,IACF,QAAQ;AAAA,IAAC;AAAA,EACX,GAAG,CAAC,UAAU,CAAC;AACjB;AAQO,SAAS,aAAa;AAAA,EAC3B,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AACZ,IAAuB,CAAC,GAAG;AACzB,QAAM,WAAW,YAAY;AAC7B,QAAM,aAAa,gBAAgB,KAAK,CAAC,UAAU,SAAS,WAAW,KAAK,CAAC;AAE7E,+BAA6B,UAAU;AAEvC,MAAI,WAAY,QAAO;AAEvB,SACE,iCACG;AAAA,aAAS,oBAAC,cAAW;AAAA,IACrB,SAAS,oBAAC,cAAW;AAAA,IACrB,WAAW,oBAAC,gBAAa;AAAA,KAC5B;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -34,7 +34,17 @@ function useHideCrispOnExcludedRoutes(isExcluded: boolean) {
|
|
|
34
34
|
}, [isExcluded]);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
type EmbedWidgetsProps = {
|
|
38
|
+
frill?: boolean;
|
|
39
|
+
crisp?: boolean;
|
|
40
|
+
clarity?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function EmbedWidgets({
|
|
44
|
+
frill = true,
|
|
45
|
+
crisp = true,
|
|
46
|
+
clarity = true,
|
|
47
|
+
}: EmbedWidgetsProps = {}) {
|
|
38
48
|
const pathname = usePathname();
|
|
39
49
|
const isExcluded = EXCLUDED_ROUTES.some((route) => pathname.startsWith(route));
|
|
40
50
|
|
|
@@ -44,9 +54,9 @@ export function EmbedWidgets() {
|
|
|
44
54
|
|
|
45
55
|
return (
|
|
46
56
|
<>
|
|
47
|
-
<FrillEmbed />
|
|
48
|
-
<CrispEmbed />
|
|
49
|
-
<ClarityEmbed />
|
|
57
|
+
{frill && <FrillEmbed />}
|
|
58
|
+
{crisp && <CrispEmbed />}
|
|
59
|
+
{clarity && <ClarityEmbed />}
|
|
50
60
|
</>
|
|
51
61
|
);
|
|
52
62
|
}
|