diff --git a/apps/frontend/src/app/layout.tsx b/apps/frontend/src/app/layout.tsx
index c143d959..17b2c758 100644
--- a/apps/frontend/src/app/layout.tsx
+++ b/apps/frontend/src/app/layout.tsx
@@ -13,6 +13,7 @@ import { VariableContextComponent } from '@gitroom/react/helpers/variable.contex
import { Fragment } from 'react';
import { PHProvider } from '@gitroom/react/helpers/posthog';
import UtmSaver from '@gitroom/helpers/utils/utm.saver';
+import { ToltScript } from '@gitroom/frontend/components/layout/tolt.script';
const chakra = Chakra_Petch({ weight: '400', subsets: ['latin'] });
@@ -42,7 +43,9 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
frontEndUrl={process.env.FRONTEND_URL!}
isGeneral={!!process.env.IS_GENERAL}
uploadDirectory={process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY!}
+ tolt={process.env.NEXT_PUBLIC_TOLT!}
>
+
diff --git a/apps/frontend/src/components/billing/main.billing.component.tsx b/apps/frontend/src/components/billing/main.billing.component.tsx
index 3a4e331d..c2e9395c 100644
--- a/apps/frontend/src/components/billing/main.billing.component.tsx
+++ b/apps/frontend/src/components/billing/main.billing.component.tsx
@@ -23,6 +23,7 @@ import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.titl
import { Textarea } from '@gitroom/react/form/textarea';
import { useFireEvents } from '@gitroom/helpers/utils/use.fire.events';
import { useUtmUrl } from '@gitroom/helpers/utils/utm.saver';
+import { useTolt } from '@gitroom/frontend/components/layout/tolt.script';
export interface Tiers {
month: Array<{
@@ -221,6 +222,7 @@ export const MainBillingComponent: FC<{
const modal = useModals();
const router = useRouter();
const utm = useUtmUrl();
+ const tolt = useTolt();
const [subscription, setSubscription] = useState(
sub
@@ -348,6 +350,7 @@ export const MainBillingComponent: FC<{
period: monthlyOrYearly === 'on' ? 'YEARLY' : 'MONTHLY',
utm,
billing,
+ tolt: tolt()
}),
})
).json();
diff --git a/apps/frontend/src/components/layout/tolt.script.tsx b/apps/frontend/src/components/layout/tolt.script.tsx
new file mode 100644
index 00000000..e881f7d9
--- /dev/null
+++ b/apps/frontend/src/components/layout/tolt.script.tsx
@@ -0,0 +1,23 @@
+'use client';
+
+import { useVariables } from '@gitroom/react/helpers/variable.context';
+import Script from 'next/script';
+
+export const useTolt = () => {
+ return () => {
+ // @ts-ignore
+ return window?.tolt_referral || '';
+ };
+};
+
+export const ToltScript = () => {
+ const { tolt } = useVariables();
+ if (!tolt) return null;
+ return (
+
+ );
+};
diff --git a/libraries/nestjs-libraries/src/dtos/billing/billing.subscribe.dto.ts b/libraries/nestjs-libraries/src/dtos/billing/billing.subscribe.dto.ts
index 1cbde147..642effae 100644
--- a/libraries/nestjs-libraries/src/dtos/billing/billing.subscribe.dto.ts
+++ b/libraries/nestjs-libraries/src/dtos/billing/billing.subscribe.dto.ts
@@ -8,4 +8,6 @@ export class BillingSubscribeDto {
billing: 'STANDARD' | 'PRO' | 'TEAM' | 'ULTIMATE';
utm: string;
+
+ tolt: string;
}
diff --git a/libraries/nestjs-libraries/src/services/stripe.service.ts b/libraries/nestjs-libraries/src/services/stripe.service.ts
index 64837eea..768ca957 100644
--- a/libraries/nestjs-libraries/src/services/stripe.service.ts
+++ b/libraries/nestjs-libraries/src/services/stripe.service.ts
@@ -286,6 +286,11 @@ export class StripeService {
uniqueId,
},
},
+ ...body.tolt ? {
+ metadata: {
+ tolt_referral: body.tolt,
+ }
+ } : {},
allow_promotion_codes: true,
line_items: [
{
diff --git a/libraries/react-shared-libraries/src/helpers/variable.context.tsx b/libraries/react-shared-libraries/src/helpers/variable.context.tsx
index dbadde01..cac54ca0 100644
--- a/libraries/react-shared-libraries/src/helpers/variable.context.tsx
+++ b/libraries/react-shared-libraries/src/helpers/variable.context.tsx
@@ -11,6 +11,7 @@ interface VariableContextInterface {
backendUrl: string;
discordUrl: string;
uploadDirectory: string;
+ tolt: string;
}
const VariableContext = createContext({
billingEnabled: false,
@@ -21,6 +22,7 @@ const VariableContext = createContext({
backendUrl: '',
discordUrl: '',
uploadDirectory: '',
+ tolt: '',
} as VariableContextInterface);
export const VariableContextComponent: FC<