Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib/app-context/app-context.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export const buildContext = (newConfig: Partial<NavigationAppProps>, prevContext
fullFooter = prevContext.toolConfig?.fullFooter,
showSalesCta = prevContext.toolConfig?.showSalesCta,
profileCompletionData = prevContext.auth?.profileCompletionData,
signupUtmCodes = prevContext.signupUtmCodes,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The addition of signupUtmCodes to the destructuring assignment and the return object seems correct, but ensure that signupUtmCodes is always defined in prevContext to avoid potential undefined issues. Consider providing a default value if necessary.

simplifiedNav = prevContext.simplifiedNav,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The addition of simplifiedNav to the destructuring assignment and the return object is correct, but similar to signupUtmCodes, ensure that simplifiedNav is always defined in prevContext to avoid potential undefined issues. Consider providing a default value if necessary.

} = {...newConfig, user: undefined}

const hasUserProp = hasOwnProperty(newConfig, 'user') && newConfig['user'] !== 'auto'
Expand Down Expand Up @@ -45,6 +47,8 @@ export const buildContext = (newConfig: Partial<NavigationAppProps>, prevContext
fullFooter,
showSalesCta,
},
signupUtmCodes,
simplifiedNav,
supportMeta,
integrations,
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/app-context/app-context.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export interface AppContext {
toolConfig: ToolConfig
navigationHandler: NavigationHandler
supportMeta?: SupportMeta
signupUtmCodes?: string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Consider using a more descriptive type for signupUtmCodes instead of string if it represents a structured data format (e.g., an object or a specific pattern). This will improve type safety and maintainability.

simplifiedNav?: boolean
}
9 changes: 8 additions & 1 deletion src/lib/components/user-area/UserArea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@
function onSignIn(signup?: any) {
const locationHref = `${window.location.origin}${window.location.pathname}`
window.location.href = `${AUTH0_AUTHENTICATOR_URL}?retUrl=${encodeURIComponent(locationHref)}${signup === true ? '&mode=signUp' : ''}`;
const signupUrl = [
`${AUTH0_AUTHENTICATOR_URL}?retUrl=${encodeURIComponent(locationHref)}`,
signup === true ? '&mode=signUp' : '',
$ctx.signupUtmCodes,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ security]
Ensure $ctx.signupUtmCodes is properly sanitized and validated to prevent potential security vulnerabilities such as injection attacks. If this variable is user-controlled or derived from user input, it could pose a security risk.

].filter(Boolean).join('&')
window.location.href = signupUrl;
}
function onSignUp() {
Expand Down
1 change: 1 addition & 0 deletions src/lib/marketing-navigation/MarketingNavigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
menuItems={menuItems}
isMobile={$isMobile}
navigationHandler={navigationHandler}
simplifiedNav={$ctx.simplifiedNav}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The use of $ctx.simplifiedNav assumes that simplifiedNav is always present in the context. Consider adding a check to ensure that simplifiedNav is defined to prevent potential runtime errors if the context changes.

>
<UserArea slot="auth" />
</NavigationBar>
Expand Down
31 changes: 17 additions & 14 deletions src/lib/marketing-navigation/components/NavigationBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,26 @@
export let activeRoute: NavMenuItem;
export let isMobile: boolean = false;
export let navigationHandler: NavigationHandler | undefined;
export let simplifiedNav: boolean = false;
</script>

<TopNavbar style={style} minVersionLogo={isMobile}>
{#if isMobile}
<MobileNavigation
menuItems={[...menuItems]}
activeRoute={activeRoute}
activeRoutePath={activeRoutePath}
/>
{:else}
<LinksMenu
menuItems={menuItems}
style={style}
activeRoute={activeRoute}
activeRoutePath={activeRoutePath}
navigationHandler={navigationHandler}
/>
{#if !simplifiedNav}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The introduction of the simplifiedNav flag changes the logic for rendering the navigation components. Ensure that this flag is correctly set and tested across different scenarios to avoid unintended UI behavior.

{#if isMobile}
<MobileNavigation
menuItems={[...menuItems]}
activeRoute={activeRoute}
activeRoutePath={activeRoutePath}
/>
{:else}
<LinksMenu
menuItems={menuItems}
style={style}
activeRoute={activeRoute}
activeRoutePath={activeRoutePath}
navigationHandler={navigationHandler}
/>
{/if}
{/if}

<svelte:fragment slot="right">
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export type NavigationAppProps = {
supportMeta?: SupportMeta

integrations?: {[key: string]: 'disable'}
signupUtmCodes?: string
simplifiedNav?: boolean
}

export type TcUniNavMethods = 'init' | 'update' | 'destroy'
Expand Down
2 changes: 2 additions & 0 deletions types/src/lib/app-context/app-context.functions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export declare const buildContext: (newConfig: Partial<NavigationAppProps>, prev
fullFooter: any;
showSalesCta: any;
};
signupUtmCodes: any;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
The type any is used for signupUtmCodes. Consider specifying a more precise type to improve type safety and maintainability.

simplifiedNav: any;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
The type any is used for simplifiedNav. Consider specifying a more precise type to improve type safety and maintainability.

supportMeta: any;
integrations: any;
};
Expand Down
2 changes: 2 additions & 0 deletions types/src/lib/app-context/app-context.model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export interface AppContext {
toolConfig: ToolConfig;
navigationHandler: NavigationHandler;
supportMeta?: SupportMeta;
signupUtmCodes?: string;
simplifiedNav?: boolean;
}
2 changes: 2 additions & 0 deletions types/src/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export declare type NavigationAppProps = {
integrations?: {
[key: string]: 'disable';
};
signupUtmCodes?: string;
simplifiedNav?: boolean;
};
export declare type TcUniNavMethods = 'init' | 'update' | 'destroy';
export declare type TcUniNavFn = (method: TcUniNavMethods, targetId: string, config: NavigationAppProps) => void;
Loading