Skip to content

Commit

Permalink
Merge branch 'main' into ticketing-linear
Browse files Browse the repository at this point in the history
  • Loading branch information
ganimtron-10 committed Aug 8, 2024
2 parents 5c520ff + fd295d3 commit e18a2ab
Show file tree
Hide file tree
Showing 715 changed files with 35,258 additions and 11,495 deletions.
8 changes: 3 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ REDIS_PASS=A3vniod98Zbuvn9u5

#REDIS_TLS=

MAIL_HOST=smtp.example.com
MAIL_USER=your-email@example.com
MAIL_PASSWORD=your-email-password


# ================================================
# Tip: use mailtrap.io for local development
EMAIL_SENDING_ADDRESS=hello@panora.dev
Expand Down Expand Up @@ -95,6 +90,9 @@ FRONT_TICKETING_CLOUD_CLIENT_SECRET=
# Gitlab
GITLAB_TICKETING_CLOUD_CLIENT_ID=
GITLAB_TICKETING_CLOUD_CLIENT_SECRET=
# Github
GITHUB_TICKETING_CLOUD_CLIENT_ID=
GITHUB_TICKETING_CLOUD_CLIENT_SECRET=
# Linear
LINEAR_TICKETING_CLOUD_CLIENT_ID=
LINEAR_TICKETING_CLOUD_CLIENT_SECRET=
Expand Down
6 changes: 3 additions & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
speakeasyVersion: 1.352.1
speakeasyVersion: 1.357.2
sources:
merge-code-samples-into-spec:
sourceNamespace: merge-code-samples-into-spec
sourceRevisionDigest: sha256:64aa841f4a81958114ef5c8d0d36097d8cd6816ba4977507b48d155017787513
sourceBlobDigest: sha256:38fb5b85581de4dfe07fb4c98d63c3a97c14f558ac6565128c2ad9bacd955057
sourceRevisionDigest: sha256:988368b39832ad5b1e27cac1d48708c4b7bcd4d15f6c1695a75dcee5999d224b
sourceBlobDigest: sha256:a53fd2c2d54acbc2b48b559a43d904e8eb6bcf3e773d074137818326827dadb5
tags:
- latest
- main
Expand Down
20 changes: 8 additions & 12 deletions apps/magic-link/src/hooks/queries/useCreateApiKeyConnection.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import config from '@/helpers/config';
import { useMutation } from '@tanstack/react-query';

interface IApiKeyConnectionDto {
interface IGConnectionDto {
query : {
providerName: string; // Name of the API Key provider
vertical: string; // Vertical (Crm, Ticketing, etc)
projectId: string; // Project ID
linkedUserId: string; // Linked User ID
},
data: {
apikey: string,
[key : string]: string
}
}
Expand All @@ -18,31 +17,28 @@ interface IApiKeyConnectionDto {

// Adjusted useCreateApiKey hook to include a promise-returning function
const useCreateApiKeyConnection = () => {
const createApiKeyConnection = async (apiKeyConnectionData : IApiKeyConnectionDto) => {
const createApiKeyConnection = async (apiKeyConnectionData : IGConnectionDto) => {
const response = await fetch(
`${config.API_URL}/connections/basicorapikey/callback?state=${encodeURIComponent(JSON.stringify(apiKeyConnectionData.query))}`, {
method: 'POST',
method: 'POST',
body: JSON.stringify(apiKeyConnectionData.data),
headers: {
'Content-Type': 'application/json',
headers: {
'Content-Type': 'application/json',
},
});

if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.message || "Unknown error occurred");
const errorData = await response.json();
throw new Error(errorData.message || "Unknown error occurred");
}

return response.json();
return response;
};

return useMutation({
mutationFn: createApiKeyConnection,

onSuccess: () => {
console.log("Successfull !!!!")
}

});
};

Expand Down
2 changes: 1 addition & 1 deletion apps/magic-link/src/hooks/queries/useUniqueMagicLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const useUniqueMagicLink = (id: string | null) => {
if (!id) {
throw new Error('Magic Link ID is not available');
}
const response = await fetch(`${config.API_URL}/magic_links/single?id=${id.trim()}`);
const response = await fetch(`${config.API_URL}/magic_links/${id.trim()}`);
if (!response.ok) {
throw new Error('Network response was not ok');
}
Expand Down
19 changes: 11 additions & 8 deletions apps/magic-link/src/hooks/useOAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ type UseOAuthProps = {
redirectIngressUri: {
status: boolean;
value: string | null;
} // URL of the User's Server
},
onSuccess: () => void;
additionalParams?: {
end_user_domain: string;
}
};

const useOAuth = ({ providerName, vertical, returnUrl, projectId, linkedUserId, redirectIngressUri, onSuccess }: UseOAuthProps) => {
const useOAuth = ({ providerName, vertical, returnUrl, projectId, linkedUserId,additionalParams, redirectIngressUri, onSuccess }: UseOAuthProps) => {
const [isReady, setIsReady] = useState(false);
const intervalRef = useRef<number | ReturnType<typeof setInterval> | null>(null);
const authWindowRef = useRef<Window | null>(null);
const authWindowRef = useRef<Window | null>(null);

useEffect(() => {
// Perform any setup logic here
Expand Down Expand Up @@ -48,7 +51,7 @@ const useOAuth = ({ providerName, vertical, returnUrl, projectId, linkedUserId,
const openModal = async (onWindowClose: () => void) => {
const apiUrl = config.API_URL!;
const authUrl = await constructAuthUrl({
projectId, linkedUserId, providerName, returnUrl, apiUrl , vertical, rediectUriIngress: redirectIngressUri
projectId, linkedUserId, providerName, returnUrl, apiUrl , vertical,additionalParams, redirectUriIngress: redirectIngressUri
});

if (!authUrl) {
Expand All @@ -66,12 +69,12 @@ const useOAuth = ({ providerName, vertical, returnUrl, projectId, linkedUserId,
const interval = setInterval(() => {
try {
const redirectedURL = authWindow!.location.href;
// const redirectedURL = authWindow!.location.protocol + '//' + authWindow!.location.hostname + (authWindow!.location.port ? ':' + authWindow!.location.port : '');
if (redirectedURL === returnUrl) {
onSuccess();
const urlParams = new URL(redirectedURL).searchParams;
const success = urlParams.get('success'); // Example parameter
if (redirectedURL === returnUrl || success) {
onSuccess();
clearExistingInterval(true);
}

} catch (e) {
console.error(e)
}
Expand Down
Loading

0 comments on commit e18a2ab

Please sign in to comment.