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
8 changes: 8 additions & 0 deletions src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
gclid?: string;
};

export function checkout({ planId, promoCodeId, planType, mode, currency, gclid }: PaymentCheckoutConfig): void {

Check failure on line 256 in src/lib/auth.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=internxt_website&issues=AZzjDRuhguHjumTn3bF0&open=AZzjDRuhguHjumTn3bF0&pullRequest=1847
if (REDIRECT_AUTH_ENABLED) {
const params = new URLSearchParams();
const pathname = '/checkout';
Expand All @@ -265,6 +265,14 @@
mode && params.set('mode', mode ? mode : 'subscription');
gclid && params.set('gclid', gclid);

const currentParams = new URLSearchParams(globalThis.location.search);
const celloProductId = currentParams.get('productId');
const celloUcc = currentParams.get('ucc');
const celloN = currentParams.get('celloN');
if (celloProductId) params.set('productId', celloProductId);
if (celloUcc) params.set('ucc', celloUcc);
if (celloN) params.set('celloN', celloN);

window.location.href = AUTH_FLOW_URL + `${pathname}?${params.toString()}`;
}

Expand Down
2 changes: 2 additions & 0 deletions src/pages/specialoffer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Layout from '@/components/layout/Layout';
import Script from 'next/script';

import { PromoCodeName } from '@/lib/types';
import Footer from '@/components/layout/footers/Footer';
Expand Down Expand Up @@ -83,6 +84,7 @@ function SpecialOffer({

return (
<Layout title={metatags[0].title} description={metatags[0].description} segmentName="Partners" lang={lang}>
<Script src={process.env.NEXT_PUBLIC_CELLO_ATTRIBUTION_URL} type="module" strategy="afterInteractive" />
<Navbar lang={lang} textContent={navbarLang} cta={['payment']} isLinksHidden hideCTA />

<HeroSection textContent={langJson.HeroSection} percentOff={percentOff} image={'internxt-private-cloud'} />
Expand Down
4 changes: 3 additions & 1 deletion src/pages/specialoffer/[filename].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import Layout from '@/components/layout/Layout';
import Script from 'next/script';
import { PromoCodeName } from '@/lib/types';
import Footer from '@/components/layout/footers/Footer';
import usePricing from '@/hooks/usePricing';
Expand Down Expand Up @@ -39,7 +40,7 @@ const ALLOWED_PATHS = [
'love',
];

const ALTERNATE_RECOMENDATED_PLAN_PATHS = ['grabon', 'kripesh','rclone'];
const ALTERNATE_RECOMENDATED_PLAN_PATHS = ['grabon', 'kripesh', 'rclone'];
const DARK_MODE_PATHS = ['baity'];

const COUPON_CODES = {
Expand Down Expand Up @@ -147,6 +148,7 @@ function CombinedSpecialOffer({
lang={lang}
robots="noindex, follow"
>
<Script src={process.env.NEXT_PUBLIC_CELLO_ATTRIBUTION_URL} type="module" strategy="afterInteractive" />
<Navbar lang={lang} textContent={navbarLang} cta={['payment']} isLinksHidden hideLogoLink hideCTA />

<HeroSection
Expand Down
Loading