From 89a83d04dd1dd6c15cc6ebd8e28ebfff87574904 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Thu, 2 Apr 2026 11:43:43 -0600 Subject: [PATCH] set up the bones for the whitelabel, just need to generate the icons from a logo once we get it --- .env | 1 + README.md | 14 +++++++++----- src/navigation/SideNavigator.tsx | 3 ++- src/services/whiteLabel.ts | 29 ++++++++++++++++++++++++++++- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.env b/.env index 9fdc8f3..90ef699 100644 --- a/.env +++ b/.env @@ -14,6 +14,7 @@ VITE_AUTH0_ADAPTIVE_CONSTRUCTION_CLIENT_ID=32rABabJzXRvJiWivTmeKFgwFiqh4ok7 VITE_AUTH0_AEROGROW_CLIENT_ID=KHl9ooUt1nia1RYw5n224dyggCXdbsSd VITE_AUTH0_MIVENT_CLIENT_ID=VNALE7RW6l3dY5uYcxgwElZV0lcT25Fg VITE_AUTH0_OMNIAIR_CLIENT_ID=IblmarD8wFafiD6doxTmOHQ6Bx3L9wWl +VITE_AUTH0_INTELLIFARMS_CLIENT_ID=RYtuAyOcB4DSaaqJMLDMf3pV8SFY9PdY #Branding (Default theme) VITE_APP_WEBSITE_TITLE="Adaptive Dashboard" diff --git a/README.md b/README.md index 8528fdc..4a47964 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,10 @@ Steps to add a new white label - add a `CNAME` record pointing their custom subdomain (ex: dashboard.example.com) to brandxtech.ca - add a login button on their website point to `/login` of their custom subdomain (ex: dashboard.example.com/login) +It is recommended to start with the Auth0 stage once everything from the client has been recieved as things like the client ID will be needed in other stages + +Frontend Steps 1. Create a PWA folder in `public` that is named after the client and generate PWA assets using [this](https://realfavicongenerator.net/) website (use the company logo but you might need to use a custom favicon depending on the result) - https://maskable.app/ also create a maskable icon for PWA @@ -29,22 +32,23 @@ Steps to add a new white label 4. If there are any pages specific to the whitelabel be sure to update the side and bottom navigator +Backend Steps 1. In `dynamic-config.prod.yml`, add a router entry for the new whitelabel 2. In `pond/http/server.go`, add the sub-domain to the `allowedOrigins` 3. In `pond/whitelabel.go`, add an entry for the new white label -4. Enable the white-label sub-domain for CORS in the backend by adding it to the allowed origins http/server.go -1. Create a new `Auth0` application for the client +Auth0 Steps +1. Create a new Single Page App on Auth0 using React as the tech +2. Once you have the client ID add it to your .env file in the frontend +3. Adjust settings accordingly in the new application - use a image bucket like [postimg](https://postimages.org/) to store their company logo and favicon - add a whitelabel logo - - allow necessary `origins`, `callback URLs`, and `CORS domains` to the application settings (see the default application as a guideline) + - allow necessary `origins`, `callback URLs`, and `CORS domains` to the application settings (see other applications/whitelabels as a guideline) - customize the Universal Login page to handle the new whitelabel - check if the client ID matches this client's Auth0 application - change the Universal Login theme using white-label colours and images stored in a bucket (ex: [postimg](https://postimages.org/)) -- in [http.go](https://gitlab.com/brandx/backend/blob/master/pond/http.go), add the white-label sub-domain to the `AllowedOrigins` list - ## Expanding the ESLint configuration If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: diff --git a/src/navigation/SideNavigator.tsx b/src/navigation/SideNavigator.tsx index 6bab36c..efc3635 100644 --- a/src/navigation/SideNavigator.tsx +++ b/src/navigation/SideNavigator.tsx @@ -27,6 +27,7 @@ import { IsAdaptiveAgriculture, // hasTutorialPlaylist, IsAdCon, + IsIntellifarms, IsMiPCA, // isBXT, IsMiVent, @@ -165,7 +166,7 @@ export default function SideNavigator(props: Props) { const authenticatedSideMenu = () => { const isMiVent = IsMiVent(); - const isAg = IsAdaptiveAgriculture() + const isAg = IsAdaptiveAgriculture() || IsIntellifarms() const isStreamline = IsStreamline() const isOmni = IsOmniAir() const isMiPCA = IsMiPCA() diff --git a/src/services/whiteLabel.ts b/src/services/whiteLabel.ts index 29c4427..8c1f56d 100644 --- a/src/services/whiteLabel.ts +++ b/src/services/whiteLabel.ts @@ -180,6 +180,32 @@ export function IsAdaptiveAgriculture(): boolean { ); } +const INTELLIFARMS_WHITE_LABEL: WhiteLabel = { + name: "Intellifarms", + primaryColour: "", + secondaryColour: "", + signatureColour: "", + signatureAccentColour: "", + auth0ClientId: import.meta.env.VITE_AUTH0_INTELLIFARMS_CLIENT_ID, + redirectOnLogout: true, + logoutRedirectTarget: "https://myintellifarms.com", + darkLogo: "", + lightLogo: "", + transparentLogoBG: true, + blacklist: [], + docs: "Platform", + protips: protips, + homePage: "/bins" +}; + +export function IsIntellifarms(): boolean { + return ( + getName() === "Intellifarms" + // window.location.origin.includes("staging") || + // window.location.origin.includes("localhost") + ); +} + export function IsStreamline(): boolean { return ( getName() === "Streamline" @@ -324,7 +350,8 @@ const whitelabels = new Map([ ["adaptiveconstruction", ADAPTIVE_CONSTRUCTION_WHITE_LABEL], ["omniair", OMNIAIR_WHITE_LABEL], ["mipca", MIPCA_WHITE_LABEL], - ["mionetech", MIPCA_WHITE_LABEL] + ["mionetech", MIPCA_WHITE_LABEL], + ["intellifarms", INTELLIFARMS_WHITE_LABEL] ]); export function getWhitelabel(): WhiteLabel {