Merge branch 'gitroomhq:main' into discord_limit_fix

This commit is contained in:
Aryan Pokharkar 2024-10-27 14:24:40 +05:30 committed by GitHub
commit f72b938d42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 44 additions and 26 deletions

View File

@ -10,10 +10,15 @@ import { Chakra_Petch } from 'next/font/google';
import PlausibleProvider from 'next-plausible';
import clsx from 'clsx';
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
import { Fragment } from 'react';
const chakra = Chakra_Petch({ weight: '400', subsets: ['latin'] });
export default async function AppLayout({ children }: { children: ReactNode }) {
const Plausible = !!process.env.STRIPE_PUBLISHABLE_KEY
? PlausibleProvider
: Fragment;
return (
<html className={interClass}>
<head>
@ -25,7 +30,9 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
</head>
<body className={clsx(chakra.className, 'text-primary dark')}>
<VariableContextComponent
storageProvider={process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'}
storageProvider={
process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'
}
backendUrl={process.env.NEXT_PUBLIC_BACKEND_URL!}
plontoKey={process.env.NEXT_PUBLIC_POLOTNO!}
billingEnabled={!!process.env.STRIPE_PUBLISHABLE_KEY}
@ -34,11 +41,11 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
isGeneral={!!process.env.IS_GENERAL}
uploadDirectory={process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY!}
>
<PlausibleProvider
<Plausible
domain={!!process.env.IS_GENERAL ? 'postiz.com' : 'gitroom.com'}
>
<LayoutContext>{children}</LayoutContext>
</PlausibleProvider>
</Plausible>
</VariableContextComponent>
</body>
</html>

View File

@ -24,6 +24,7 @@ import { useModals } from '@mantine/modals';
import { AddProviderComponent } from '@gitroom/frontend/components/launches/add.provider.component';
import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component';
import { Textarea } from '@gitroom/react/form/textarea';
import { useFireEvents } from '@gitroom/helpers/utils/use.fire.events';
export interface Tiers {
month: Array<{
@ -156,9 +157,11 @@ export const Features: FC<{
const Info: FC<{ proceed: (feedback: string) => void }> = (props) => {
const [feedback, setFeedback] = useState('');
const modal = useModals();
const events = useFireEvents();
const cancel = useCallback(() => {
props.proceed(feedback);
events('cancel_subscription');
modal.closeAll();
}, [modal, feedback]);

View File

@ -1,9 +1,14 @@
import {usePlausible} from 'next-plausible'
import {useCallback} from "react";
import { usePlausible } from 'next-plausible';
import { useCallback } from 'react';
import { useVariables } from '@gitroom/react/helpers/variable.context';
export const useFireEvents = () => {
const plausible = usePlausible();
return useCallback((name: string, props?: any) => {
plausible(name, {props});
}, []);
}
const { billingEnabled } = useVariables();
const plausible = usePlausible();
return useCallback((name: string, props?: any) => {
if (!billingEnabled) {
return;
}
plausible(name, { props });
}, []);
};

View File

@ -149,7 +149,7 @@ export class OrganizationRepository {
});
if (
!process.env.STRIPE_PUBLISHABLE_KEY ||
process.env.STRIPE_PUBLISHABLE_KEY &&
checkForSubscription?.subscription?.subscriptionTier !==
SubscriptionTier.PRO
) {

View File

@ -78,10 +78,10 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
`?client_key=${process.env.TIKTOK_CLIENT_ID}` +
`&redirect_uri=${encodeURIComponent(
`${
process.env.NODE_ENV === 'development' || !process.env.NODE_ENV
? `https://integration.git.sn/integrations/social/tiktok`
: `${process.env.FRONTEND_URL}/integrations/social/tiktok`
}`
process?.env?.FRONTEND_URL?.indexOf('https') === -1
? 'https://redirectmeto.com/'
: ''
}${process?.env?.FRONTEND_URL}/integrations/social/tiktok`
)}` +
`&state=${state}` +
`&response_type=code` +
@ -199,7 +199,9 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
? `https://www.tiktok.com/@${id}`
: `https://www.tiktok.com/@${id}/video/` +
publicaly_available_post_id,
id: !publicaly_available_post_id ? publishId : publicaly_available_post_id?.[0],
id: !publicaly_available_post_id
? publishId
: publicaly_available_post_id?.[0],
};
}
@ -210,7 +212,6 @@ export class TiktokProvider extends SocialAbstract implements SocialProvider {
});
}
await timer(3000);
}
}

20
package-lock.json generated
View File

@ -22270,9 +22270,10 @@
}
},
"node_modules/http-proxy-middleware": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-3.0.2.tgz",
"integrity": "sha512-fBLFpmvDzlxdckwZRjM0wWtwDZ4KBtQ8NFqhrFKoEtK4myzuiumBuNTxD+F4cVbXfOZljIbrynmvByofDzT7Ag==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-3.0.3.tgz",
"integrity": "sha512-usY0HG5nyDUwtqpiZdETNbmKtw3QQ1jwYFZ9wi5iHzX2BcILwQKtYDJPo7XHTsu5Z0B2Hj3W9NNnbd+AjFWjqg==",
"license": "MIT",
"dependencies": {
"@types/http-proxy": "^1.17.15",
"debug": "^4.3.6",
@ -31760,9 +31761,9 @@
}
},
"node_modules/polotno": {
"version": "2.14.3",
"resolved": "https://registry.npmjs.org/polotno/-/polotno-2.14.3.tgz",
"integrity": "sha512-CYf5BmK12wAYpnFnHpe8gSoYksPr5RmJQXHAib00Fx09FSG47jLzVC+R/v7CpDrcOW/1CpQqONz1po0D245xjA==",
"version": "2.14.4",
"resolved": "https://registry.npmjs.org/polotno/-/polotno-2.14.4.tgz",
"integrity": "sha512-Wq6j1BKkBWtSCILHAv04UnJp+F3MvriIo9N65wMRniPcNbwPY1IxhkEJ9co0AaPrQHmOiu25BOl5isYhH5jc4w==",
"license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
"@blueprintjs/core": "5.12.0",
@ -39011,9 +39012,10 @@
}
},
"node_modules/webpack-dev-server/node_modules/http-proxy-middleware": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz",
"integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==",
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz",
"integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==",
"license": "MIT",
"dependencies": {
"@types/http-proxy": "^1.17.8",
"http-proxy": "^1.18.1",