Skip to content

Commit f72b938

Browse files
authored
Merge branch 'gitroomhq:main' into discord_limit_fix
2 parents 35c017a + 43b434a commit f72b938

File tree

6 files changed

+44
-26
lines changed

6 files changed

+44
-26
lines changed

apps/frontend/src/app/layout.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ import { Chakra_Petch } from 'next/font/google';
1010
import PlausibleProvider from 'next-plausible';
1111
import clsx from 'clsx';
1212
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
13+
import { Fragment } from 'react';
1314

1415
const chakra = Chakra_Petch({ weight: '400', subsets: ['latin'] });
1516

1617
export default async function AppLayout({ children }: { children: ReactNode }) {
18+
const Plausible = !!process.env.STRIPE_PUBLISHABLE_KEY
19+
? PlausibleProvider
20+
: Fragment;
21+
1722
return (
1823
<html className={interClass}>
1924
<head>
@@ -25,7 +30,9 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
2530
</head>
2631
<body className={clsx(chakra.className, 'text-primary dark')}>
2732
<VariableContextComponent
28-
storageProvider={process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'}
33+
storageProvider={
34+
process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'
35+
}
2936
backendUrl={process.env.NEXT_PUBLIC_BACKEND_URL!}
3037
plontoKey={process.env.NEXT_PUBLIC_POLOTNO!}
3138
billingEnabled={!!process.env.STRIPE_PUBLISHABLE_KEY}
@@ -34,11 +41,11 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
3441
isGeneral={!!process.env.IS_GENERAL}
3542
uploadDirectory={process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY!}
3643
>
37-
<PlausibleProvider
44+
<Plausible
3845
domain={!!process.env.IS_GENERAL ? 'postiz.com' : 'gitroom.com'}
3946
>
4047
<LayoutContext>{children}</LayoutContext>
41-
</PlausibleProvider>
48+
</Plausible>
4249
</VariableContextComponent>
4350
</body>
4451
</html>

apps/frontend/src/components/billing/main.billing.component.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { useModals } from '@mantine/modals';
2424
import { AddProviderComponent } from '@gitroom/frontend/components/launches/add.provider.component';
2525
import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component';
2626
import { Textarea } from '@gitroom/react/form/textarea';
27+
import { useFireEvents } from '@gitroom/helpers/utils/use.fire.events';
2728

2829
export interface Tiers {
2930
month: Array<{
@@ -156,9 +157,11 @@ export const Features: FC<{
156157
const Info: FC<{ proceed: (feedback: string) => void }> = (props) => {
157158
const [feedback, setFeedback] = useState('');
158159
const modal = useModals();
160+
const events = useFireEvents();
159161

160162
const cancel = useCallback(() => {
161163
props.proceed(feedback);
164+
events('cancel_subscription');
162165
modal.closeAll();
163166
}, [modal, feedback]);
164167

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
import {usePlausible} from 'next-plausible'
2-
import {useCallback} from "react";
1+
import { usePlausible } from 'next-plausible';
2+
import { useCallback } from 'react';
3+
import { useVariables } from '@gitroom/react/helpers/variable.context';
34

45
export const useFireEvents = () => {
5-
const plausible = usePlausible();
6-
return useCallback((name: string, props?: any) => {
7-
plausible(name, {props});
8-
}, []);
9-
}
6+
const { billingEnabled } = useVariables();
7+
const plausible = usePlausible();
8+
return useCallback((name: string, props?: any) => {
9+
if (!billingEnabled) {
10+
return;
11+
}
12+
plausible(name, { props });
13+
}, []);
14+
};

libraries/nestjs-libraries/src/database/prisma/organizations/organization.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class OrganizationRepository {
149149
});
150150

151151
if (
152-
!process.env.STRIPE_PUBLISHABLE_KEY ||
152+
process.env.STRIPE_PUBLISHABLE_KEY &&
153153
checkForSubscription?.subscription?.subscriptionTier !==
154154
SubscriptionTier.PRO
155155
) {

libraries/nestjs-libraries/src/integrations/social/tiktok.provider.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
7878
`?client_key=${process.env.TIKTOK_CLIENT_ID}` +
7979
`&redirect_uri=${encodeURIComponent(
8080
`${
81-
process.env.NODE_ENV === 'development' || !process.env.NODE_ENV
82-
? `https://integration.git.sn/integrations/social/tiktok`
83-
: `${process.env.FRONTEND_URL}/integrations/social/tiktok`
84-
}`
81+
process?.env?.FRONTEND_URL?.indexOf('https') === -1
82+
? 'https://redirectmeto.com/'
83+
: ''
84+
}${process?.env?.FRONTEND_URL}/integrations/social/tiktok`
8585
)}` +
8686
`&state=${state}` +
8787
`&response_type=code` +
@@ -199,7 +199,9 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
199199
? `https://www.tiktok.com/@${id}`
200200
: `https://www.tiktok.com/@${id}/video/` +
201201
publicaly_available_post_id,
202-
id: !publicaly_available_post_id ? publishId : publicaly_available_post_id?.[0],
202+
id: !publicaly_available_post_id
203+
? publishId
204+
: publicaly_available_post_id?.[0],
203205
};
204206
}
205207

@@ -210,7 +212,6 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
210212
});
211213
}
212214

213-
214215
await timer(3000);
215216
}
216217
}

package-lock.json

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)