Skip to content

Commit 500acd9

Browse files
authored
Merge branch 'main' into sentry-ai/mcp
2 parents 118e47c + f37c913 commit 500acd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+532
-251
lines changed

apps/backend/src/api/routes/integrations.controller.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Controller,
44
Delete,
55
Get,
6+
HttpException,
67
Param,
78
Post,
89
Put,
@@ -261,7 +262,7 @@ export class IntegrationsController {
261262
throw new Error('Invalid integration');
262263
}
263264

264-
let newList: any[] | {none: true} = [];
265+
let newList: any[] | { none: true } = [];
265266
try {
266267
newList = (await this.functionIntegration(org, body)) || [];
267268
} catch (err) {
@@ -298,7 +299,7 @@ export class IntegrationsController {
298299
image: p.image,
299300
label: p.name,
300301
})),
301-
...newList as any[],
302+
...(newList as any[]),
302303
],
303304
(p) => p.id
304305
).filter((f) => f.label && f.id);
@@ -487,6 +488,18 @@ export class IntegrationsController {
487488
validName = `Channel_${String(id).slice(0, 8)}`;
488489
}
489490
}
491+
492+
if (
493+
process.env.STRIPE_PUBLISHABLE_KEY &&
494+
org.isTrailing &&
495+
(await this._integrationService.checkPreviousConnections(
496+
org.id,
497+
String(id)
498+
))
499+
) {
500+
throw new HttpException('', 412);
501+
}
502+
490503
return this._integrationService.createOrUpdateIntegration(
491504
additionalSettings,
492505
!!integrationProvider.oneTimeToken,

apps/cron/src/tasks/check.missing.queues.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ export class CheckMissingQueues {
1919
id: p.id,
2020
publishDate: p.publishDate,
2121
isJob:
22-
(await this._workerServiceProducer
23-
.getQueue('post')
24-
.getJobState(p.id)) === 'delayed',
22+
['delayed', 'waiting'].indexOf(
23+
await this._workerServiceProducer
24+
.getQueue('post')
25+
.getJobState(p.id)
26+
) > -1,
2527
}))
2628
)
2729
).filter((p) => !p.isJob);

apps/cron/src/tasks/post.now.pending.queues.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ export class PostNowPendingQueues {
1818
id: p.id,
1919
publishDate: p.publishDate,
2020
isJob:
21-
(await this._workerServiceProducer
22-
.getQueue('post')
23-
.getJobState(p.id)) === 'delayed',
21+
['delayed', 'waiting'].indexOf(
22+
await this._workerServiceProducer
23+
.getQueue('post')
24+
.getJobState(p.id)
25+
) > -1,
2426
}))
2527
)
2628
).filter((p) => !p.isJob);

apps/frontend/src/app/(app)/layout.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import { FacebookComponent } from '@gitroom/frontend/components/layout/facebook.
1818
import { headers } from 'next/headers';
1919
import { headerName } from '@gitroom/react/translation/i18n.config';
2020
import { HtmlComponent } from '@gitroom/frontend/components/layout/html.component';
21-
import dynamicLoad from 'next/dynamic';
22-
const SetTimezone = dynamicLoad(
23-
() => import('@gitroom/frontend/components/layout/set.timezone'),
24-
{
25-
ssr: false,
26-
}
27-
);
21+
// import dynamicLoad from 'next/dynamic';
22+
// const SetTimezone = dynamicLoad(
23+
// () => import('@gitroom/frontend/components/layout/set.timezone'),
24+
// {
25+
// ssr: false,
26+
// }
27+
// );
2828

2929
const jakartaSans = Plus_Jakarta_Sans({
3030
weight: ['600', '500'],
@@ -79,7 +79,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
7979
}
8080
>
8181
<SentryComponent>
82-
<SetTimezone />
82+
{/*<SetTimezone />*/}
8383
<HtmlComponent />
8484
<ToltScript />
8585
<FacebookComponent />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ export const MainBillingComponent: FC<{
505505
{t(
506506
'your_subscription_will_be_canceled_at',
507507
'Your subscription will be canceled at'
508-
)}
508+
)}{' '}
509509
{newDayjs(subscription.cancelAt).local().format('D MMM, YYYY')}
510510
<br />
511511
{t(

apps/frontend/src/components/launches/add.provider.component.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use client';
22

33
import { useModals } from '@mantine/modals';
4-
import React, { FC, useCallback, useMemo } from 'react';
4+
import React, { FC, useCallback, useEffect, useMemo } from 'react';
55
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
66
import { Input } from '@gitroom/react/form/input';
77
import { FieldValues, FormProvider, useForm } from 'react-hook-form';
88
import { Button } from '@gitroom/react/form/button';
99
import { classValidatorResolver } from '@hookform/resolvers/class-validator';
1010
import { ApiKeyDto } from '@gitroom/nestjs-libraries/dtos/integrations/api.key.dto';
11-
import { useRouter } from 'next/navigation';
11+
import { useRouter, useSearchParams } from 'next/navigation';
1212
import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component';
1313
import { useVariables } from '@gitroom/react/helpers/variable.context';
1414
import { useToaster } from '@gitroom/react/toaster/toaster';
@@ -42,9 +42,16 @@ export const AddProviderButton: FC<{
4242
update?: () => void;
4343
}> = (props) => {
4444
const { update } = props;
45+
const query = useSearchParams();
4546
const add = useAddProvider(update);
4647
const t = useT();
4748

49+
useEffect(() => {
50+
if (query.get('onboarding')) {
51+
add();
52+
}
53+
}, []);
54+
4855
return (
4956
<button
5057
className="text-btnText bg-btnSimple h-[44px] pt-[12px] pb-[14px] ps-[16px] pe-[20px] justify-center items-center flex rounded-[8px] gap-[8px]"

apps/frontend/src/components/launches/continue.integration.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ export const ContinueIntegration: FC<{
4040

4141
const data = await fetch(`/integrations/social/${provider}/connect`, {
4242
method: 'POST',
43-
body: JSON.stringify({...modifiedParams, timezone}),
43+
body: JSON.stringify({ ...modifiedParams, timezone }),
4444
});
4545

46+
if (data.status === HttpStatusCode.PreconditionFailed) {
47+
push(`/launches?precondition=true`);
48+
return ;
49+
}
50+
4651
if (data.status === HttpStatusCode.NotAcceptable) {
4752
const { msg } = await data.json();
4853
push(`/launches?msg=${msg}`);

apps/frontend/src/components/launches/helpers/media.settings.component.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,12 @@ export const CreateThumbnail: FC<{
106106
const [isCapturing, setIsCapturing] = useState(false);
107107

108108
const handleLoadedMetadata = useCallback(() => {
109-
if (videoRef.current) {
110-
setDuration(videoRef.current.duration);
111-
setIsLoaded(true);
112-
}
109+
setDuration(videoRef?.current?.duration);
110+
setIsLoaded(true);
113111
}, []);
114112

115113
const handleTimeUpdate = useCallback(() => {
116-
if (videoRef.current) {
117-
setCurrentTime(videoRef.current.currentTime);
118-
}
114+
setCurrentTime(videoRef?.current?.currentTime);
119115
}, []);
120116

121117
const handleSeek = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
@@ -127,8 +123,6 @@ export const CreateThumbnail: FC<{
127123
}, []);
128124

129125
const captureFrame = useCallback(async () => {
130-
if (!videoRef.current || !canvasRef.current) return;
131-
132126
setIsCapturing(true);
133127

134128
try {
@@ -299,7 +293,14 @@ export const MediaComponentInner: FC<{
299293
alt: string;
300294
}) => void;
301295
media:
302-
| { id: string; name: string; path: string; thumbnail: string; alt: string, thumbnailTimestamp?: number }
296+
| {
297+
id: string;
298+
name: string;
299+
path: string;
300+
thumbnail: string;
301+
alt: string;
302+
thumbnailTimestamp?: number;
303+
}
303304
| undefined;
304305
}> = (props) => {
305306
const { onClose, onSelect, media } = props;

apps/frontend/src/components/layout/layout.settings.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const LayoutSettings = ({ children }: { children: ReactNode }) => {
8484
<Toaster />
8585
<ShowPostSelector />
8686
<NewSubscription />
87-
{user.tier !== 'FREE' && <Onboarding />}
8887
<Support />
8988
<ContinueProvider />
9089
<div className="min-h-[100vh] w-full max-w-[1440px] mx-auto bg-primary px-6 text-textColor flex flex-col">
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React, { FC, useEffect } from 'react';
2+
import { useSearchParams } from 'next/navigation';
3+
import { ModalWrapperComponent } from '@gitroom/frontend/components/new-launch/modal.wrapper.component';
4+
import { useModals } from '@mantine/modals';
5+
import { Button } from '@gitroom/react/form/button';
6+
7+
export const PreConditionComponentModal: FC = () => {
8+
return (
9+
<div className="flex flex-col gap-[16px]">
10+
<div className="whitespace-pre-line">
11+
This social channel was connected previously to another Postiz account.{'\n'}
12+
To continue, please fast-track your trial for an immediate charge.{'\n'}{'\n'}
13+
** Please be advised that the account will not eligible for a refund, and the charge is final.
14+
</div>
15+
<div className="flex gap-[2px] justify-center">
16+
<Button onClick={() => window.location.href='/billing?finishTrial=true'}>Fast track - Charge me now</Button>
17+
<Button secondary={true}>Cancel</Button>
18+
</div>
19+
</div>
20+
);
21+
};
22+
export const PreConditionComponent: FC = () => {
23+
const modal = useModals();
24+
const query = useSearchParams();
25+
useEffect(() => {
26+
if (query.get('precondition')) {
27+
modal.openModal({
28+
title: '',
29+
withCloseButton: false,
30+
classNames: {
31+
modal: 'text-textColor',
32+
},
33+
size: 'auto',
34+
children: (
35+
<ModalWrapperComponent title="Suspicious activity detected">
36+
<PreConditionComponentModal />
37+
</ModalWrapperComponent>
38+
),
39+
});
40+
}
41+
}, []);
42+
return null;
43+
};

0 commit comments

Comments
 (0)