π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: remove channel selection
Nevo Davide9f266000238
diff --git a/apps/frontend/src/components/new-launch/providers/kick/kick.channel.select.tsx b/apps/frontend/src/components/new-launch/providers/kick/kick.channel.select.tsxdeleted file mode 100644index 3bdadf04b..000000000--- a/apps/frontend/src/components/new-launch/providers/kick/kick.channel.select.tsx+++ /dev/null@@ -1,63 +0,0 @@-'use client';--import { FC, useEffect, useState } from 'react';-import { useCustomProviderFunction } from '@gitroom/frontend/components/launches/helpers/use.custom.provider.function';-import { Select } from '@gitroom/react/form/select';-import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values';-import { useT } from '@gitroom/react/translation/get.transation.service.client';--export const KickChannelSelect: FC<{- name: string;- onChange: (event: {- target: {- value: string;- name: string;- };- }) => void;-}> = (props) => {- const { onChange, name } = props;- const t = useT();- const customFunc = useCustomProviderFunction();- const [channels, setChannels] = useState([]);- const { getValues } = useSettings();- const [currentChannel, setCurrentChannel] = useState<string | undefined>();-- const onChangeInner = (event: {- target: {- value: string;- name: string;- };- }) => {- setCurrentChannel(event.target.value);- onChange(event);- };-- useEffect(() => {- customFunc.get('channels').then((data) => setChannels(data));- const settings = getValues()[props.name];- if (settings) {- setCurrentChannel(settings);- }- }, []);-- if (!channels.length) {- return null;- }-- return (- <Select- name={name}- label={t('kick_select_channel', 'Select Channel')}- onChange={onChangeInner}- value={currentChannel}- >- <option value="">{t('select_1', '--Select--')}</option>- {channels.map((channel: any) => (- <option key={channel.id} value={channel.id}>- {channel.name}- </option>- ))}- </Select>- );-};-diff --git a/apps/frontend/src/components/new-launch/providers/kick/kick.provider.tsx b/apps/frontend/src/components/new-launch/providers/kick/kick.provider.tsxindex d603c5f93..a18a7ea7e 100644--- a/apps/frontend/src/components/new-launch/providers/kick/kick.provider.tsx+++ b/apps/frontend/src/components/new-launch/providers/kick/kick.provider.tsx@@ -4,27 +4,14 @@ import {PostComment,withProvider,} from '@gitroom/frontend/components/new-launch/providers/high.order.provider';-import { FC } from 'react';-import { useSettings } from '@gitroom/frontend/components/launches/helpers/use.values';-import { KickChannelSelect } from '@gitroom/frontend/components/new-launch/providers/kick/kick.channel.select';-import { KickDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/kick.dto';--const KickComponent: FC = () => {- const form = useSettings();- return (- <div>- <KickChannelSelect {...form.register('broadcasterUserId')} />- </div>- );-};export default withProvider({postComment: PostComment.COMMENT,+ comments: 'no-media',minimumCharacters: [],- SettingsComponent: KickComponent,+ SettingsComponent: undefined,CustomPreviewComponent: undefined,- dto: KickDto,+ dto: undefined,checkValidity: undefined,maximumCharacters: 500,});-diff --git a/libraries/nestjs-libraries/src/dtos/posts/providers-settings/kick.dto.ts b/libraries/nestjs-libraries/src/dtos/posts/providers-settings/kick.dto.tsindex d5a4ab7a6..caf6959f0 100644--- a/libraries/nestjs-libraries/src/dtos/posts/providers-settings/kick.dto.ts+++ b/libraries/nestjs-libraries/src/dtos/posts/providers-settings/kick.dto.ts@@ -1,13 +1 @@-import { IsDefined, IsString, MinLength } from 'class-validator';-import { JSONSchema } from 'class-validator-jsonschema';--export class KickDto {- @MinLength(1)- @IsDefined()- @IsString()- @JSONSchema({- description: 'Broadcaster user ID to post to',- })- broadcasterUserId: string;-}-+export class KickDto {}diff --git a/libraries/nestjs-libraries/src/integrations/social/kick.provider.ts b/libraries/nestjs-libraries/src/integrations/social/kick.provider.tsindex f9b08b0c4..8c2e66ef0 100644--- a/libraries/nestjs-libraries/src/integrations/social/kick.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/kick.provider.ts@@ -9,7 +9,6 @@ import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abimport dayjs from 'dayjs';import { Integration } from '@prisma/client';import { KickDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/kick.dto';-import { Tool } from '@gitroom/nestjs-libraries/integrations/tool.decorator';import { createHash, randomBytes } from 'crypto';export class KickProvider extends SocialAbstract implements SocialProvider {@@ -154,47 +153,6 @@ export class KickProvider extends SocialAbstract implements SocialProvider {};}- @Tool({- description: 'Get list of channels/broadcasters the user can post to',- dataSchema: [],- })- async channels(accessToken: string, params: any, id: string) {- // For Kick, when using a user token, we need to know which broadcaster to post to- // The user posting as themselves would post to their own channel- // Try to get channels the user has access to-- try {- const response = await fetch('https://api.kick.com/public/v1/channels', {- method: 'GET',- headers: {- Authorization: `Bearer ${accessToken}`,- },- });-- if (response.ok) {- const data = await response.json();- const channels = data.data || [];- return channels.map((channel: any) => ({- id: String(- channel.broadcaster_user_id || channel.user_id || channel.id- ),- name: channel.slug || channel.username || channel.name,- }));- }- } catch (e) {- // Fall back to returning the authenticated user's info- }-- // If no channels found, return the user's own channel- // The id parameter is the user's own ID from authentication- return [- {- id: id,- name: 'My Channel',- },- ];- }-async post(id: string,accessToken: string,@@ -202,7 +160,6 @@ export class KickProvider extends SocialAbstract implements SocialProvider {integration: Integration): Promise<PostResponse[]> {const [firstPost] = postDetails;- const broadcasterUserId = firstPost.settings.broadcasterUserId;// Post chat message to Kick// Note: Kick chat doesn't support media attachments directly in messages@@ -215,7 +172,7 @@ export class KickProvider extends SocialAbstract implements SocialProvider {body: JSON.stringify({type: 'user',content: firstPost.message.substring(0, 500), // Ensure max length- broadcaster_user_id: parseInt(broadcasterUserId, 10),+ broadcaster_user_id: parseInt(id, 10),}),});@@ -240,7 +197,6 @@ export class KickProvider extends SocialAbstract implements SocialProvider {integration: Integration): Promise<PostResponse[]> {const [commentPost] = postDetails;- const broadcasterUserId = commentPost.settings.broadcasterUserId;// Kick supports reply_to_message_id for repliesconst response = await this.fetch('https://api.kick.com/public/v1/chat', {@@ -252,7 +208,7 @@ export class KickProvider extends SocialAbstract implements SocialProvider {body: JSON.stringify({type: 'user',content: commentPost.message.substring(0, 500),- broadcaster_user_id: parseInt(broadcasterUserId, 10),+ broadcaster_user_id: parseInt(id, 10),reply_to_message_id: lastCommentId || postId,}),});