Skip to content

Commit 7ca7a14

Browse files
committed
feat: plugs
2 parents d87d83d + d07ed2b commit 7ca7a14

File tree

73 files changed

+8233
-6086
lines changed

Some content is hidden

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

73 files changed

+8233
-6086
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "🙏🏻 Installation Problem"
2+
description: "Report an issue with installation"
3+
title: "Installation Problem"
4+
labels: ["type: installation"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: For installation issues, please visit our [Discord Support](https://discord.postiz.com) for assistance.
9+
- type: textarea
10+
id: feature-description
11+
validations:
12+
required: true
13+
attributes:
14+
label: For installation issues, please visit our https://discord.postiz.com for assistance.
15+
description: For installation issues, please visit our [Discord Support](https://discord.postiz.com) for assistance.
16+
placeholder: |
17+
For installation issues, please visit our https://discord.postiz.com for assistance.
18+
Please do not save this issue - do not submit installation issues on GitHub.
19+
File renamed without changes.

README.md

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
<p align="center">
2+
<a href="https://affiliate.postiz.com">
3+
<img src="https://github.com/user-attachments/assets/af9f47b3-e20c-402b-bd11-02f39248d738" />
4+
</a>
5+
</p>
6+
17
<p align="center">
28
<a href="https://postiz.com" target="_blank">
39
<picture>
410
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/765e9d72-3ee7-4a56-9d59-a2c9befe2311">
5-
<img alt="Novu Logo" src="https://github.com/user-attachments/assets/f0d30d70-dddb-4142-8876-e9aa6ed1cb99" width="280"/>
11+
<img alt="Postiz Logo" src="https://github.com/user-attachments/assets/f0d30d70-dddb-4142-8876-e9aa6ed1cb99" width="280"/>
612
</picture>
713
</a>
814
</p>
@@ -58,22 +64,6 @@
5864

5965
<br />
6066

61-
62-
<p align="center">
63-
<br /><br /><br />
64-
<h1>We participate in Hacktoberfest 2024! 🎉🎊</h1>
65-
<p align="left">We are sending a t-shirt for every merged PR! (max 1 per person)</p>
66-
<p align="left"><strong>Rules:</strong></p>
67-
<ul align="left">
68-
<li>You must create an issue before making a pull request.</li>
69-
<li>You can also ask to be assigned to an issue. During Hacktoberfest, each issue can have multiple assignees.</li>
70-
<li>We have to approve the issue and add a "hacktoberfest" tag.</li>
71-
<li>We encourage everybody to contribute to all types of issues. We will only send swag for issues with features and bug fixes (no typos, sorry).</li>
72-
</ul>
73-
<p align="center"><img align="center" width="400" src="https://github.com/user-attachments/assets/3ceffccc-e4b3-4098-b9ba-44a94cf01294" /></p>
74-
<br /><br /><br />
75-
</p>
76-
7767
<p align="center">
7868
<video src="https://github.com/user-attachments/assets/05436a01-19c8-4827-b57f-05a5e7637a67" width="100%" />
7969
</p>

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

+83-7
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ import { PostsService } from '@gitroom/nestjs-libraries/database/prisma/posts/po
2222
import { IntegrationTimeDto } from '@gitroom/nestjs-libraries/dtos/integrations/integration.time.dto';
2323
import { AuthService } from '@gitroom/helpers/auth/auth.service';
2424
import { AuthTokenDetails } from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
25-
import { NotEnoughScopes } from '@gitroom/nestjs-libraries/integrations/social.abstract';
2625
import { PlugDto } from '@gitroom/nestjs-libraries/dtos/plugs/plug.dto';
26+
import {
27+
NotEnoughScopes,
28+
RefreshToken,
29+
} from '@gitroom/nestjs-libraries/integrations/social.abstract';
30+
import { timer } from '@gitroom/helpers/utils/timer';
2731

2832
@ApiTags('Integrations')
2933
@Controller('/integrations')
@@ -38,6 +42,37 @@ export class IntegrationsController {
3842
return this._integrationManager.getAllIntegrations();
3943
}
4044

45+
@Get('/customers')
46+
getCustomers(@GetOrgFromRequest() org: Organization) {
47+
return this._integrationService.customers(org.id);
48+
}
49+
50+
@Put('/:id/group')
51+
async updateIntegrationGroup(
52+
@GetOrgFromRequest() org: Organization,
53+
@Param('id') id: string,
54+
@Body() body: { group: string }
55+
) {
56+
return this._integrationService.updateIntegrationGroup(
57+
org.id,
58+
id,
59+
body.group
60+
);
61+
}
62+
63+
@Put('/:id/customer-name')
64+
async updateOnCustomerName(
65+
@GetOrgFromRequest() org: Organization,
66+
@Param('id') id: string,
67+
@Body() body: { name: string }
68+
) {
69+
return this._integrationService.updateOnCustomerName(
70+
org.id,
71+
id,
72+
body.name
73+
);
74+
}
75+
4176
@Get('/list')
4277
async getIntegrationList(@GetOrgFromRequest() org: Organization) {
4378
return {
@@ -52,7 +87,7 @@ export class IntegrationsController {
5287
id: p.id,
5388
internalId: p.internalId,
5489
disabled: p.disabled,
55-
picture: p.picture,
90+
picture: p.picture || '/no-picture.jpg',
5691
identifier: p.providerIdentifier,
5792
inBetweenSteps: p.inBetweenSteps,
5893
refreshNeeded: p.refreshNeeded,
@@ -61,6 +96,7 @@ export class IntegrationsController {
6196
time: JSON.parse(p.postingTimes),
6297
changeProfilePicture: !!findIntegration?.changeProfilePicture,
6398
changeNickName: !!findIntegration?.changeNickname,
99+
customer: p.customer,
64100
};
65101
}),
66102
};
@@ -202,11 +238,51 @@ export class IntegrationsController {
202238
}
203239

204240
if (integrationProvider[body.name]) {
205-
return integrationProvider[body.name](
206-
getIntegration.token,
207-
body.data,
208-
getIntegration.internalId
209-
);
241+
try {
242+
const load = await integrationProvider[body.name](
243+
getIntegration.token,
244+
body.data,
245+
getIntegration.internalId
246+
);
247+
248+
return load;
249+
} catch (err) {
250+
if (err instanceof RefreshToken) {
251+
const { accessToken, refreshToken, expiresIn } =
252+
await integrationProvider.refreshToken(
253+
getIntegration.refreshToken
254+
);
255+
256+
if (accessToken) {
257+
await this._integrationService.createOrUpdateIntegration(
258+
getIntegration.organizationId,
259+
getIntegration.name,
260+
getIntegration.picture!,
261+
'social',
262+
getIntegration.internalId,
263+
getIntegration.providerIdentifier,
264+
accessToken,
265+
refreshToken,
266+
expiresIn
267+
);
268+
269+
getIntegration.token = accessToken;
270+
271+
if (integrationProvider.refreshWait) {
272+
await timer(10000);
273+
}
274+
return this.functionIntegration(org, body);
275+
} else {
276+
await this._integrationService.disconnectChannel(
277+
org.id,
278+
getIntegration
279+
);
280+
return false;
281+
}
282+
}
283+
284+
return false;
285+
}
210286
}
211287
throw new Error('Function not found');
212288
}

apps/frontend/public/favicon.ico

100644100755
320 Bytes
Binary file not shown.

apps/frontend/public/no-picture.jpg

27.7 KB
Loading

apps/frontend/src/app/global.scss

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ html {
1010
}
1111
.box {
1212
position: relative;
13-
padding: 8px 24px;
1413
}
1514
.box span {
1615
position: relative;
@@ -385,3 +384,14 @@ div div .set-font-family {
385384
font-style: normal !important;
386385
font-weight: 400 !important;
387386
}
387+
388+
.col-calendar:hover:before {
389+
content: "Date passed";
390+
color: white;
391+
position: absolute;
392+
left: 50%;
393+
top: 50%;
394+
transform: translate(-50%, -50%);
395+
white-space: nowrap;
396+
opacity: 30%;
397+
}

apps/frontend/src/app/layout.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import clsx from 'clsx';
1212
import { VariableContextComponent } from '@gitroom/react/helpers/variable.context';
1313
import { Fragment } from 'react';
1414
import { PHProvider } from '@gitroom/react/helpers/posthog';
15+
import UtmSaver from '@gitroom/helpers/utils/utm.saver';
16+
import { ToltScript } from '@gitroom/frontend/components/layout/tolt.script';
1517

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

@@ -25,7 +27,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
2527
<head>
2628
<link
2729
rel="icon"
28-
href={!!process.env.IS_GENERAL ? '/favicon.png' : '/postiz-fav.png'}
30+
href="/favicon.ico"
2931
sizes="any"
3032
/>
3133
</head>
@@ -41,14 +43,17 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
4143
frontEndUrl={process.env.FRONTEND_URL!}
4244
isGeneral={!!process.env.IS_GENERAL}
4345
uploadDirectory={process.env.NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY!}
46+
tolt={process.env.NEXT_PUBLIC_TOLT!}
4447
>
48+
<ToltScript />
4549
<Plausible
4650
domain={!!process.env.IS_GENERAL ? 'postiz.com' : 'gitroom.com'}
4751
>
4852
<PHProvider
4953
phkey={process.env.NEXT_PUBLIC_POSTHOG_KEY}
5054
host={process.env.NEXT_PUBLIC_POSTHOG_HOST}
5155
>
56+
<UtmSaver />
5257
<LayoutContext>{children}</LayoutContext>
5358
</PHProvider>
5459
</Plausible>

apps/frontend/src/components/analytics/chart-social.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { FC, useEffect, useMemo, useRef } from 'react';
33
import DrawChart from 'chart.js/auto';
44
import { TotalList } from '@gitroom/frontend/components/analytics/stars.and.forks.interface';
5-
import dayjs from 'dayjs';
65
import { chunk } from 'lodash';
76

87
function mergeDataPoints(data: TotalList[], numPoints: number): TotalList[] {

apps/frontend/src/components/analytics/chart.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use client';
2-
import { FC, useEffect, useMemo, useRef } from 'react';
2+
import { FC, useEffect, useRef } from 'react';
33
import DrawChart from 'chart.js/auto';
44
import {
55
ForksList,

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import { Slider } from '@gitroom/react/form/slider';
44
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
55
import { Button } from '@gitroom/react/form/button';
6-
import { sortBy } from 'lodash';
7-
import { Track } from '@gitroom/react/form/track';
86
import { useFetch } from '@gitroom/helpers/utils/custom.fetch';
97
import { Subscription } from '@prisma/client';
108
import { useDebouncedCallback } from 'use-debounce';
@@ -21,10 +19,11 @@ import interClass from '@gitroom/react/helpers/inter.font';
2119
import { useRouter } from 'next/navigation';
2220
import { useVariables } from '@gitroom/react/helpers/variable.context';
2321
import { useModals } from '@mantine/modals';
24-
import { AddProviderComponent } from '@gitroom/frontend/components/launches/add.provider.component';
2522
import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component';
2623
import { Textarea } from '@gitroom/react/form/textarea';
2724
import { useFireEvents } from '@gitroom/helpers/utils/use.fire.events';
25+
import { useUtmUrl } from '@gitroom/helpers/utils/utm.saver';
26+
import { useTolt } from '@gitroom/frontend/components/layout/tolt.script';
2827

2928
export interface Tiers {
3029
month: Array<{
@@ -222,6 +221,8 @@ export const MainBillingComponent: FC<{
222221
const user = useUser();
223222
const modal = useModals();
224223
const router = useRouter();
224+
const utm = useUtmUrl();
225+
const tolt = useTolt();
225226

226227
const [subscription, setSubscription] = useState<Subscription | undefined>(
227228
sub
@@ -347,7 +348,9 @@ export const MainBillingComponent: FC<{
347348
method: 'POST',
348349
body: JSON.stringify({
349350
period: monthlyOrYearly === 'on' ? 'YEARLY' : 'MONTHLY',
351+
utm,
350352
billing,
353+
tolt: tolt()
351354
}),
352355
})
353356
).json();
@@ -389,7 +392,7 @@ export const MainBillingComponent: FC<{
389392

390393
setLoading(false);
391394
},
392-
[monthlyOrYearly, subscription, user]
395+
[monthlyOrYearly, subscription, user, utm]
393396
);
394397

395398
if (user?.isLifetime) {

0 commit comments

Comments
 (0)