Skip to content

Commit

Permalink
Merge pull request #330 from panoratech/feat/jira+gorgias
Browse files Browse the repository at this point in the history
✨ Add Jira & Gorgias
  • Loading branch information
naelob authored Apr 7, 2024
2 parents d0071d0 + 67d15e6 commit d8c4a6c
Show file tree
Hide file tree
Showing 320 changed files with 11,386 additions and 1,570 deletions.
33 changes: 20 additions & 13 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,37 @@ POSTGRES_HOST=postgres
# ================================================
# CRM
# Hubspot
HUBSPOT_CLIENT_ID=
HUBSPOT_CLIENT_SECRET=
HUBSPOT_CRM_CLIENT_ID=
HUBSPOT_CRM_CLIENT_SECRET=
# Zoho
ZOHOCRM_CLIENT_ID=
ZOHOCRM_CLIENT_SECRET=
ZOHO_CRM_CLIENT_ID=
ZOHO_CRM_CLIENT_SECRET=
# Pipedrive
PIPEDRIVE_CLIENT_ID=
PIPEDRIVE_CLIENT_SECRET=
PIPEDRIVE_CRM_CLIENT_ID=
PIPEDRIVE_CRM_CLIENT_SECRET=
# Zendesk
ZENDESK_SELL_CLIENT_ID=
ZENDESK_SELL_CLIENT_SECRET=
ZENDESK_CRM_CLIENT_ID=
ZENDESK_CRM_CLIENT_SECRET=
# Freshsales
FRESHSALES_CLIENT_ID=
FRESHSALES_CLIENT_SECRET=
FRESHSALES_CRM_CLIENT_ID=
FRESHSALES_CRM_CLIENT_SECRET=
# Attio
ATTIO_CLIENT_ID=
ATTIO_CLIENT_SECRET=
ATTIO_CRM_CLIENT_ID=
ATTIO_CRM_CLIENT_SECRET=
# ================================================
# Ticketing
# ================================================
# Zendesk
ZENDESK_TICKETING_SUBDOMAIN=
ZENDESK_TICKETING_CLIENT_ID=
ZENDESK_TICKETING_CLIENT_SECRET=
ZENDESK_TICKETING_SUBDOMAIN=
JIRA_TICKETING_CLIENT_ID=
JIRA_TICKETING_CLIENT_SECRET=
GORGIAS_TICKETING_CLIENT_ID=
GORGIAS_TICKETING_CLIENT_SECRET=
GORGIAS_TICKETING_SUBDOMAIN=
FRONT_TICKETING_CLIENT_ID=
FRONT_TICKETING_CLIENT_SECRET=

# ================================================
# Webapp settings
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/sh-build-push-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,5 @@ jobs:
PIPEDRIVE_CLIENT_SECRET=${{ secrets.PIPEDRIVE_CLIENT_SECRET }}
ZENDESK_CLIENT_ID=${{ secrets.ZENDESK_CLIENT_ID }}
ZENDESK_CLIENT_SECRET=${{ secrets.ZENDESK_CLIENT_SECRET }}
ZENDESK_TICKETING_SUBDOMAIN=${{ secrets.ZENDESK_TICKETING_SUBDOMAIN }}
ZENDESK_TICKETING_CLIENT_ID=${{ secrets.ZENDESK_TICKETING_CLIENT_ID }}
ZENDESK_TICKETING_CLIENT_SECRET=${{ secrets.ZENDESK_TICKETING_CLIENT_SECRET }}
20 changes: 18 additions & 2 deletions apps/client-ts/src/app/authenticate/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import { Suspense, useEffect } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { useStytchUser, useStytch } from "@stytch/nextjs";
import useProfile from "@/hooks/useProfile";
import useProfileMutation from "@/hooks/mutations/useProfileMutation";
//import useOrganisations from "@/hooks/useOrganisations";

const OAUTH_TOKEN = "oauth";
const MAGIC_LINKS_TOKEN = "magic_links";
Expand All @@ -21,6 +24,9 @@ const InnerAuthenticate = () => {
const stytch = useStytch();
const router = useRouter();
const searchParams = useSearchParams();
const { data, isLoading } = useProfile(user?.user_id!);
const { mutate } = useProfileMutation();
//const { data: orgs, isLoading: isloadingOrganisations } = useOrganisations();

useEffect(() => {
if (stytch && !user && isInitialized) {
Expand All @@ -44,9 +50,19 @@ const InnerAuthenticate = () => {
return;
}
if (user) {
if (!data) {
mutate({
first_name: user.name.first_name,
last_name: user.name.last_name,
email: user.emails[0].email,
stytch_id_user: user.user_id,
strategy: 'b2c',
//id_organization: orgs && orgs[0].id_organization
});
}
router.replace("/b2c/profile");
}
}, [router, user, isInitialized]);
}, [router, user, isInitialized, data, mutate]);

return null;
};
Expand All @@ -55,7 +71,7 @@ const Authenticate = () => {

return (
<Suspense>
<InnerAuthenticate/>
<InnerAuthenticate />
</Suspense>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const AddLinkedAccount = () => {

const posthog = usePostHog()

//const {idOrg} = useOrganisationStore();
const {idOrg} = useOrganisationStore();
const {idProject} = useProjectStore();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function ConnectionTable() {
status: connection.status,
linkedUser: connection.id_linked_user,
date: new Date().toISOString(),
connectionToken: connection.connection_token!
}))


Expand Down
29 changes: 28 additions & 1 deletion apps/client-ts/src/components/Connection/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ function truncateMiddle(str: string, maxLength: number) {
return `${start}...${end}`;
}

function insertDots(originalString: string): string {
if(!originalString) return "";
if (originalString.length <= 50) {
return originalString;
}
return originalString.substring(0, 50 - 3) + '...';
}

export const columns: ColumnDef<Connection>[] = [
{
id: "select",
Expand Down Expand Up @@ -95,7 +103,7 @@ export const columns: ColumnDef<Connection>[] = [
return value.includes(row.getValue(id))
},
},
{
{
accessorKey: "status",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Status" />
Expand Down Expand Up @@ -157,5 +165,24 @@ export const columns: ColumnDef<Connection>[] = [
</div>
)
},
},
{
accessorKey: "connectionToken",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Connection Token" />
),
cell: ({ row }) => {
<div className="flex">
<div className=" truncate mr-2">
<Badge variant="outline">{insertDots(row.getValue("connectionToken"))}</Badge>
</div>
<div
className="h-5 w-5 cursor-pointer mt-1"
onClick={() => navigator.clipboard.writeText(row.getValue("connectionToken"))}
>
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.6788 2.95419C10.0435 2.53694 9.18829 2.54594 8.51194 3.00541C8.35757 3.11027 8.1921 3.27257 7.7651 3.69957L7.14638 4.31829C6.95112 4.51355 6.63454 4.51355 6.43928 4.31829C6.24401 4.12303 6.24401 3.80645 6.43928 3.61119L7.058 2.99247C7.0725 2.97797 7.08679 2.96366 7.1009 2.94955C7.47044 2.57991 7.70691 2.34336 7.95001 2.17822C8.94398 1.50299 10.2377 1.46813 11.2277 2.11832C11.4692 2.27689 11.7002 2.508 12.0515 2.85942C12.0662 2.8741 12.081 2.88898 12.0961 2.90408C12.1112 2.91917 12.1261 2.93405 12.1408 2.94871C12.4922 3.30001 12.7233 3.53102 12.8819 3.77248C13.5321 4.76252 13.4972 6.05623 12.822 7.0502C12.6568 7.2933 12.4203 7.52976 12.0507 7.89929C12.0366 7.9134 12.0222 7.92771 12.0077 7.94221L11.389 8.56093C11.1938 8.7562 10.8772 8.7562 10.6819 8.56093C10.4867 8.36567 10.4867 8.04909 10.6819 7.85383L11.3006 7.23511C11.7276 6.80811 11.8899 6.64264 11.9948 6.48827C12.4543 5.81192 12.4633 4.95675 12.046 4.32141C11.9513 4.17714 11.8009 4.02307 11.389 3.61119C10.9771 3.1993 10.8231 3.04893 10.6788 2.95419ZM4.31796 6.43961C4.51322 6.63487 4.51322 6.95146 4.31796 7.14672L3.69924 7.76544C3.27224 8.19244 3.10993 8.35791 3.00507 8.51227C2.54561 9.18863 2.53661 10.0438 2.95385 10.6791C3.0486 10.8234 3.19896 10.9775 3.61085 11.3894C4.02274 11.8012 4.17681 11.9516 4.32107 12.0464C4.95642 12.4636 5.81158 12.4546 6.48794 11.9951C6.6423 11.8903 6.80777 11.728 7.23477 11.301L7.85349 10.6823C8.04875 10.487 8.36533 10.487 8.5606 10.6823C8.75586 10.8775 8.75586 11.1941 8.5606 11.3894L7.94188 12.0081C7.92738 12.0226 7.91307 12.0369 7.89897 12.051C7.52943 12.4206 7.29296 12.6572 7.04986 12.8223C6.05589 13.4976 4.76219 13.5324 3.77214 12.8822C3.53068 12.7237 3.29967 12.4925 2.94837 12.1411C2.93371 12.1264 2.91883 12.1116 2.90374 12.0965C2.88865 12.0814 2.87377 12.0665 2.8591 12.0518C2.50766 11.7005 2.27656 11.4695 2.11799 11.2281C1.4678 10.238 1.50265 8.94432 2.17788 7.95035C2.34303 7.70724 2.57957 7.47077 2.94922 7.10124C2.96333 7.08713 2.97763 7.07283 2.99213 7.05833L3.61085 6.43961C3.80611 6.24435 4.12269 6.24435 4.31796 6.43961Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path></svg>
</div>
</div>
},
}
]
13 changes: 13 additions & 0 deletions apps/client-ts/src/components/Connection/data/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",

},
{
Expand All @@ -16,6 +17,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-7839",
Expand All @@ -25,6 +27,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-5562",
Expand All @@ -34,6 +37,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-8686",
Expand All @@ -43,6 +47,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-1280",
Expand All @@ -52,6 +57,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-7262",
Expand All @@ -61,6 +67,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-1138",
Expand All @@ -70,6 +77,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-7184",
Expand All @@ -79,6 +87,7 @@ export const CONNECTIONS = [
"category": "low",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-5160",
Expand All @@ -88,6 +97,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-5618",
Expand All @@ -97,6 +107,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-6699",
Expand All @@ -106,6 +117,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-2858",
Expand All @@ -115,5 +127,6 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
]
3 changes: 2 additions & 1 deletion apps/client-ts/src/components/Connection/data/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const connectionSchema = z.object({
category: z.string(),
status: z.string(),
linkedUser: z.string(),
date: z.string()
date: z.string(),
connectionToken: z.string()
})

export type Connection = z.infer<typeof connectionSchema>
20 changes: 9 additions & 11 deletions apps/client-ts/src/components/Nav/user-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ import {
import { Skeleton } from "@/components/ui/skeleton";
import useProfile from "@/hooks/useProfile";
import useProfileStore from "@/state/profileStore";
import { useStytchUser } from "@stytch/nextjs";
import Link from "next/link";
import { useEffect } from "react";

export function UserNav() {
/*const {data, isLoading} = useProfile();
const { user } = useStytchUser();
const {data, isLoading} = useProfile(user?.user_id!);
if(!data) {
console.log("loading profiles");
}
Expand All @@ -30,13 +32,13 @@ export function UserNav() {
if(data && data.length > 0 ){
setProfile({
id_user: data[0].id_user,
email: data[0].email,
email: data[0].email!,
first_name: data[0].first_name,
last_name: data[0].last_name,
id_organization: data[0].id_organization as string,
//id_organization: data[0].id_organization as string,
})
}
}, [data, setProfile]);*/
}, [data, setProfile]);

return (
<DropdownMenu>
Expand All @@ -49,17 +51,13 @@ export function UserNav() {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56 ml-10" align="end" forceMount>
{/*<DropdownMenuLabel className="font-normal">
<DropdownMenuLabel className="font-normal">
<div className="flex flex-col space-y-1">
<p className="text-sm font-medium leading-none">
{profile ? profile.first_name : isLoading ? <Skeleton className="w-[100px] h-[20px] rounded-md" /> : "No profiles found"}
</p>
<p className="text-xs leading-none text-muted-foreground">
{profile ? profile.email : isLoading ? <Skeleton className="w-[100px] h-[20px] rounded-md" /> : "No mail found"}
{profile ? profile.first_name || profile.email : isLoading ? <Skeleton className="w-[100px] h-[20px] rounded-md" /> : "No mail found"}
</p>
</div>
</DropdownMenuLabel>*/}
</DropdownMenuLabel>
<DropdownMenuGroup>
<Link href={"/profile"}>
<DropdownMenuItem>
Expand Down
15 changes: 8 additions & 7 deletions apps/client-ts/src/components/shared/team-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import useOrganisationStore from "@/state/organisationStore"
import useProfileStore from "@/state/profileStore"
import useProjects from "@/hooks/useProjects"
import { Skeleton } from "../ui/skeleton"
import useOrganisations from "@/hooks/useOrganisations"
//import useOrganisations from "@/hooks/useOrganisations"
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import * as z from "zod"
Expand Down Expand Up @@ -82,11 +82,10 @@ export default function TeamSwitcher({ className }: TeamSwitcherProps) {
open: false,
})

const { data : orgs, isLoading: isloadingOrganisations } = useOrganisations();
//const { data : orgs, isLoading: isloadingOrganisations } = useOrganisations();
const { data : projects, isLoading: isloadingProjects } = useProjects();

const { idProject, setIdProject } = useProjectStore();
const { nameOrg, setOrganisationName } = useOrganisationStore();

const { profile } = useProfileStore();

Expand All @@ -95,10 +94,12 @@ export default function TeamSwitcher({ className }: TeamSwitcherProps) {
if(projects && projects[0]){
setIdProject(projects[0].id_project);
}
if(orgs && orgs[0]){
//TODO: display connected user
/*if(orgs && orgs[0]){
setOrganisationName(orgs[0].name);
}
},[projects, orgs, setIdProject, setOrganisationName])
setIdOrg(orgs[0].id_organization);
}*/
},[projects, setIdProject])

const handleOpenChange = (open: boolean) => {
setShowNewDialog(prevState => ({ ...prevState, open }));
Expand Down Expand Up @@ -189,7 +190,7 @@ export default function TeamSwitcher({ className }: TeamSwitcherProps) {
<CommandGroup>
{
config.DISTRIBUTION == "managed" && (
<h4>{nameOrg}</h4>
<h4>USER TO DISPLAY</h4>
)
}
<DialogTrigger asChild>
Expand Down
Loading

1 comment on commit d8c4a6c

@vercel
Copy link

@vercel vercel bot commented on d8c4a6c Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.