π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: tolt affiliate
Nevo David65e3bf0852f1
diff --git a/apps/frontend/src/app/layout.tsx b/apps/frontend/src/app/layout.tsxindex c143d959a..17b2c758c 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.conteximport { 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!}>+ <ToltScript /><Plausibledomain={!!process.env.IS_GENERAL ? 'postiz.com' : 'gitroom.com'}>diff --git a/apps/frontend/src/components/billing/main.billing.component.tsx b/apps/frontend/src/components/billing/main.billing.component.tsxindex 3a4e331d4..c2e9395c9 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.titlimport { 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<Subscription | undefined>(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.tsxnew file mode 100644index 000000000..e881f7d97--- /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 (+ <Script+ async={true}+ src="https://cdn.tolt.io/tolt.js"+ data-tolt={tolt}+ />+ );+};diff --git a/libraries/nestjs-libraries/src/dtos/billing/billing.subscribe.dto.ts b/libraries/nestjs-libraries/src/dtos/billing/billing.subscribe.dto.tsindex 1cbde1477..642effaee 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.tsindex 64837eeaa..768ca9571 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.tsxindex dbadde01d..cac54ca01 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<