Skip to content

Commit

Permalink
fix: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy committed Dec 18, 2024
1 parent a94b5ee commit 4ecc577
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 21 deletions.
3 changes: 2 additions & 1 deletion apps/dashboard/src/components/primitives/secret-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState } from 'react';
import { Eye, EyeOff } from 'lucide-react';
import { Input } from './input';
import { Button } from './button';
import { AUTOCOMPLETE_PASSWORD_MANAGERS_OFF } from '../../utils/constants';

interface SecretInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
register?: any;
Expand All @@ -16,7 +17,7 @@ export function SecretInput({ className, register, registerKey, registerOptions,

return (
<>
<Input type={revealed ? 'text' : 'password'} {...inputProps} />
<Input type={revealed ? 'text' : 'password'} {...AUTOCOMPLETE_PASSWORD_MANAGERS_OFF} {...inputProps} />
<Button
type="button"
variant="ghost"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function CreateIntegrationSidebar({ isOpened }: CreateIntegrationSidebarP
onBack: handleBack,
});

const { integrationsByChannel } = useIntegrationList(providers, searchQuery);
const { integrationsByChannel } = useIntegrationList(searchQuery);
const provider = providers?.find((p) => p.id === (selectedIntegration || providerId));
const {
isPrimaryModalOpen,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
import { useMemo } from 'react';
import { ChannelTypeEnum, IProviderConfig } from '@novu/shared';
import { ChannelTypeEnum, ChatProviderIdEnum, IProviderConfig, PushProviderIdEnum } from '@novu/shared';
import { providers, EmailProviderIdEnum, SmsProviderIdEnum } from '@novu/shared';
import { ProvidersIdEnum } from '@novu/shared';

export function useIntegrationList(providers: IProviderConfig[] | undefined, searchQuery: string = '') {
export function useIntegrationList(searchQuery: string = '') {
const filteredIntegrations = useMemo(() => {
if (!providers) return [];

const filtered = providers.filter(
(provider: IProviderConfig) =>
provider.displayName.toLowerCase().includes(searchQuery.toLowerCase()) &&
provider.id !== 'novu-email' &&
provider.id !== 'novu-sms'
provider.id !== EmailProviderIdEnum.Novu &&
provider.id !== SmsProviderIdEnum.Novu
);

const popularityOrder: Record<ChannelTypeEnum, string[]> = {
const popularityOrder: Record<ChannelTypeEnum, ProvidersIdEnum[]> = {
[ChannelTypeEnum.EMAIL]: [
'sendgrid',
'mailgun',
'postmark',
'mailjet',
'mandrill',
'ses',
'outlook365',
'custom-smtp',
EmailProviderIdEnum.SendGrid,
EmailProviderIdEnum.Mailgun,
EmailProviderIdEnum.Postmark,
EmailProviderIdEnum.Mailjet,
EmailProviderIdEnum.Mandrill,
EmailProviderIdEnum.SES,
EmailProviderIdEnum.Outlook365,
EmailProviderIdEnum.CustomSMTP,
],
[ChannelTypeEnum.SMS]: [
SmsProviderIdEnum.Twilio,
SmsProviderIdEnum.Plivo,
SmsProviderIdEnum.SNS,
SmsProviderIdEnum.Nexmo,
SmsProviderIdEnum.Telnyx,
SmsProviderIdEnum.Sms77,
SmsProviderIdEnum.Infobip,
SmsProviderIdEnum.Gupshup,
],
[ChannelTypeEnum.PUSH]: [
PushProviderIdEnum.FCM,
PushProviderIdEnum.EXPO,
PushProviderIdEnum.APNS,
PushProviderIdEnum.OneSignal,
],
[ChannelTypeEnum.CHAT]: [
ChatProviderIdEnum.Slack,
ChatProviderIdEnum.Discord,
ChatProviderIdEnum.MsTeams,
ChatProviderIdEnum.Mattermost,
],
[ChannelTypeEnum.SMS]: ['twilio', 'plivo', 'sns', 'nexmo', 'telnyx', 'sms77', 'infobip', 'gupshup'],
[ChannelTypeEnum.PUSH]: ['fcm', 'expo', 'apns', 'one-signal'],
[ChannelTypeEnum.CHAT]: ['slack', 'discord', 'ms-teams', 'mattermost'],
[ChannelTypeEnum.IN_APP]: [],
};

Expand All @@ -49,6 +70,7 @@ export function useIntegrationList(providers: IProviderConfig[] | undefined, sea
return Object.values(ChannelTypeEnum).reduce(
(acc, channel) => {
acc[channel] = filteredIntegrations.filter((provider: IProviderConfig) => provider.channel === channel);

return acc;
},
{} as Record<ChannelTypeEnum, IProviderConfig[]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export function CredentialsSection({ provider, register, control, errors }: Cred
</InputField>
)}
{credential.description && (
<div className="text-foreground-400 flex items-center gap-1 text-xs">
<Info className="h-3 w-3" />
<div className="text-foreground-400 flex gap-1 text-xs">
<Info className="relative top-[2px] h-3 w-3" />
<span>{credential.description}</span>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function GeneralSettings({
<div className="border-neutral-alpha-200 bg-background text-foreground-600 mx-0 mt-0 flex flex-col gap-2 rounded-lg border p-3">
<div className="flex items-center justify-between gap-2">
<Label className="text-xs" htmlFor="active">
Enable Integration{' '}
Active Integration{' '}
<HelpTooltipIndicator
className="relative top-1"
size="4"
Expand Down

0 comments on commit 4ecc577

Please sign in to comment.