Skip to content

Commit

Permalink
add js script (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova authored Apr 11, 2024
1 parent b86913b commit 0ae16c5
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 85 deletions.
202 changes: 141 additions & 61 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,77 +1,157 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!--
<!--
Notice the use of %BASE_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%BASE_URL%favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
-->
<link rel="icon" type="image/png" sizes="32x32" href="%BASE_URL%favicon.ico">

<title>Neosync</title>

<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2" as="font" crossorigin="anonymous">
<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2" as="font" crossorigin="anonymous">
<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2" as="font" crossorigin="anonymous">
<link rel="preload" href="%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2" as="font" crossorigin="anonymous">
<!-- SEE: https://docs.keycloakify.dev/limitations#self-hosted-fonts -->
<!-- Don't forget to import your custom fonts in Storybook as well: https://github.com/keycloakify/keycloakify-starter/blob/bb019e66fb09166cb9af1e24e230994f59daa420/src/keycloak-theme/login/createPageStory.tsx#L21 -->
<style>
/* latin */
@font-face {
font-family: 'Work Sans';
font-style: normal;
font-weight: normal;
/*400*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2") format("woff2");
}

/* latin */
@font-face {
font-family: 'Work Sans';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2") format("woff2");
}
<link
rel="icon"
type="image/png"
sizes="32x32"
href="%BASE_URL%favicon.ico"
/>
<script>
!(function (t, e) {
var o, n, p, r;
e.__SV ||
((window.posthog = e),
(e._i = []),
(e.init = function (i, s, a) {
function g(t, e) {
var o = e.split(".");
2 == o.length && ((t = t[o[0]]), (e = o[1])),
(t[e] = function () {
t.push([e].concat(Array.prototype.slice.call(arguments, 0)));
});
}
((p = t.createElement("script")).type = "text/javascript"),
(p.async = !0),
(p.src = s.api_host + "/static/array.js"),
(r = t.getElementsByTagName("script")[0]).parentNode.insertBefore(
p,
r
);
var u = e;
for (
void 0 !== a ? (u = e[a] = []) : (a = "posthog"),
u.people = u.people || [],
u.toString = function (t) {
var e = "posthog";
return (
"posthog" !== a && (e += "." + a), t || (e += " (stub)"), e
);
},
u.people.toString = function () {
return u.toString(1) + ".people (stub)";
},
o =
"capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(
" "
),
n = 0;
n < o.length;
n++
)
g(u, o[n]);
e._i.push([i, s, a]);
}),
(e.__SV = 1));
})(document, window.posthog || []);
posthog.init("phc_yc5YUhGheWJL8XSKlLQJ9DYOH5Fi1IQyi7RB1TD4eyA", {
api_host: "https://app.posthog.com",
});
</script>
<title>Neosync</title>

/* latin */
@font-face {
font-family: 'Work Sans';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2") format("woff2");
}
<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<link
rel="preload"
href="%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2"
as="font"
crossorigin="anonymous"
/>
<!-- SEE: https://docs.keycloakify.dev/limitations#self-hosted-fonts -->
<!-- Don't forget to import your custom fonts in Storybook as well: https://github.com/keycloakify/keycloakify-starter/blob/bb019e66fb09166cb9af1e24e230994f59daa420/src/keycloak-theme/login/createPageStory.tsx#L21 -->
<style>
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: normal;
/*400*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-regular-webfont.woff2")
format("woff2");
}

/* latin */
@font-face {
font-family: 'Work Sans';
font-style: normal;
font-weight: bold;
/*700*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2") format("woff2");
}
</style>
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-medium-webfont.woff2")
format("woff2");
}

<meta name="keycloakify-ignore-start">
<script>console.log("This is logged Only in the main app, stripped out in the theme")</script>
<meta name="keycloakify-ignore-end">
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-semibold-webfont.woff2")
format("woff2");
}

</head>
/* latin */
@font-face {
font-family: "Work Sans";
font-style: normal;
font-weight: bold;
/*700*/
font-display: swap;
src: url("%BASE_URL%fonts/WorkSans/worksans-bold-webfont.woff2")
format("woff2");
}
</style>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<meta name="keycloakify-ignore-start" />
<script>
console.log(
"This is logged Only in the main app, stripped out in the theme"
);
</script>
<meta name="keycloakify-ignore-end" />
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "neosync",
"homepage": "https://neosync.dev",
"version": "1.0.7",
"version": "1.0.8",
"description": "Auth templates for Neosync Cloud",
"repository": {
"type": "git",
Expand Down
35 changes: 12 additions & 23 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,23 @@ import { kcContext as kcLoginThemeContext } from "./login/kcContext";
const KcLoginThemeApp = lazy(() => import("./login/KcApp"));
const KcAccountThemeApp = lazy(() => import("./account/KcApp"));

import { PostHogProvider } from "posthog-js/react";

const options = {
api_host: "https://app.posthog.com",
};

createRoot(document.getElementById("root")!).render(
<StrictMode>
<Suspense>
<PostHogProvider
apiKey="phc_yc5YUhGheWJL8XSKlLQJ9DYOH5Fi1IQyi7RB1TD4eyAY"
options={options}
>
{(() => {
if (kcLoginThemeContext !== undefined) {
return <KcLoginThemeApp kcContext={kcLoginThemeContext} />;
}
{(() => {
if (kcLoginThemeContext !== undefined) {
return <KcLoginThemeApp kcContext={kcLoginThemeContext} />;
}

if (kcAccountThemeContext !== undefined) {
return <KcAccountThemeApp kcContext={kcAccountThemeContext} />;
}
if (kcAccountThemeContext !== undefined) {
return <KcAccountThemeApp kcContext={kcAccountThemeContext} />;
}

throw new Error(
"This app is a Keycloak theme" +
"It isn't meant to be deployed outside of Keycloak"
);
})()}
</PostHogProvider>
throw new Error(
"This app is a Keycloak theme" +
"It isn't meant to be deployed outside of Keycloak"
);
})()}
</Suspense>
</StrictMode>
);

0 comments on commit 0ae16c5

Please sign in to comment.