Skip to content

Commit 0da47e1

Browse files
authored
fix(UI-1291): templates landing page (#1396)
## Description 1. Removed justLoggedIn.current guards so template logic runs immediately: - Set systemCookies.templatesLandingName without checking !justLoggedIn.current. - Navigate to /template?template-name=... without checking !justLoggedIn.current. 2. Renamed the template cookie key: systemCookies.templatesLandingName: "landing-template-name" → "ak-landing-template-name". These changes make the template landing redirect and cookie-setting occur more deterministically after login and avoid conflicts with the previous “just logged in” suppression. ## Linear Ticket [UI-1291: Template landing page](https://linear.app/autokitteh/issue/UI-1291/template-landing-page) ## What type of PR is this? (check all applicable) - [ ] 💡 (feat) - A new feature (non-breaking change which adds functionality) - [ ] 🔄 (refactor) - Code Refactoring - A code change that neither fixes a bug nor adds a feature - [x] 🐞 (fix) - Bug Fix (non-breaking change which fixes an issue) - [ ] 🏎 (perf) - Optimization - [ ] 📄 (docs) - Documentation - Documentation only changes - [ ] 📄 (test) - Tests - Adding missing tests or correcting existing tests - [ ] ⚙️ (ci) - Continuous Integrations - Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) - [ ] ☑️ (chore) - Chores - Other changes that don't modify src or test files - [ ] ↩️ (revert) - Reverts - Reverts a previous commit(s). <!-- For a timely review/response, please avoid force-pushing additional commits if your PR already received reviews or comments. Before submitting a Pull Request, please ensure you've done the following: - 👷‍♀️ Create small PRs. In most cases this will be possible. - ✅ Provide tests for your changes. - 📝 Use descriptive commit messages (as described below). - 📗 Update any related documentation and include any relevant screenshots. Commit Message Structure (all lower-case): <type>(optional ticket number): <description> [optional body] -->
1 parent 543f3ff commit 0da47e1

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/components/templates/descopeMiddleware.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,7 @@ export const DescopeMiddleware = ({ children }: { children: ReactNode }) => {
9393
if (startParam) {
9494
Cookies.set(systemCookies.chatStartMessage, startParam, { path: "/" });
9595
}
96-
if (
97-
templateName &&
98-
!templateNameFromCookies &&
99-
templateName !== templateNameFromCookies &&
100-
!justLoggedIn.current
101-
) {
96+
if (templateName && !templateNameFromCookies && templateName !== templateNameFromCookies) {
10297
Cookies.set(systemCookies.templatesLandingName, templateName, {
10398
path: "/",
10499
});
@@ -161,7 +156,7 @@ export const DescopeMiddleware = ({ children }: { children: ReactNode }) => {
161156
}
162157

163158
const templateNameFromCookies = Cookies.get(systemCookies.templatesLandingName);
164-
if (templateNameFromCookies && location.pathname !== "/template" && !justLoggedIn.current) {
159+
if (templateNameFromCookies && location.pathname !== "/template") {
165160
navigate(`/template?template-name=${templateNameFromCookies}`);
166161
}
167162

src/constants/global.constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const chatbotIframeConnectionTimeout = 8000;
4444

4545
export const systemCookies = {
4646
isLoggedIn: "ak_logged_in",
47-
templatesLandingName: "landing-template-name",
47+
templatesLandingName: "ak-landing-template-name",
4848
chatStartMessage: "chat-start-message",
4949
hubSpot: "hubspotutk",
5050
};

0 commit comments

Comments
 (0)