chore: Update EWS package (#16950)

* Update ews package

* Hide exchange version if using NTLM

* Remove instance of gzip

* Update yarn.lock file

* Updated yarn.lock

* Update yarn.lock

* Update yarn.lock

* Update yarn.lock (again)

* chore: Increase readability of [number] indexes by using find

* chore: Async not needed

* fix: Move 'use client' to appropriate file

* refactor

* install deasync directly as dev dependency

* fix type error

---------

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: Benny Joo <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-10-10 15:48:58 +01:00
1 parent 99caae8665
commit c8e8800647
11 files changed
+1371 -154

No files matched your search

@@ -204,7 +204,6 @@ export default class ExchangeCalendarService implements Calendar {
if (this.payload.authenticationMethod === ExchangeAuthentication.NTLM) {
const xhr: XhrApi = new XhrApi({
rejectUnauthorized: false,
gzip: this.payload.useCompression,
}).useNtlmAuthentication(this.payload.username, this.payload.password);
service.XHRApi = xhr;
}
@@ -8,7 +8,7 @@
"dependencies": {
"@calcom/lib": "*",
"@calcom/prisma": "*",
"@ewsjs/xhr": "^1.4.4",
"@ewsjs/xhr": "^3.1.2",
"ews-javascript-api": "^0.11.0"
},
"devDependencies": {
@@ -6,7 +6,7 @@ import { Toaster } from "react-hot-toast";
import z from "zod";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Alert, Button, EmailField, Form, PasswordField, SelectField, Switch, TextField } from "@calcom/ui";
import { Alert, Button, EmailField, Form, PasswordField, SelectField, TextField } from "@calcom/ui";
import { ExchangeAuthentication, ExchangeVersion } from "../../enums";
@@ -36,11 +36,12 @@ export default function ExchangeSetup() {
const [errorMessage, setErrorMessage] = useState("");
const form = useForm<IFormData>({
defaultValues: {
authenticationMethod: ExchangeAuthentication.STANDARD,
authenticationMethod: ExchangeAuthentication.NTLM,
exchangeVersion: ExchangeVersion.Exchange2016,
},
resolver: zodResolver(schema),
});
const authenticationMethod = form.watch("authenticationMethod");
const authenticationMethods = [
{ value: ExchangeAuthentication.STANDARD, label: t("exchange_authentication_standard") },
{ value: ExchangeAuthentication.NTLM, label: t("exchange_authentication_ntlm") },
@@ -115,44 +116,49 @@ export default function ExchangeSetup() {
<Controller
name="authenticationMethod"
control={form.control}
render={({ field: { onChange } }) => (
<SelectField
label={t("exchange_authentication")}
options={authenticationMethods}
defaultValue={authenticationMethods[0]}
onChange={async (authentication) => {
if (authentication) {
onChange(authentication.value);
form.setValue("authenticationMethod", authentication.value);
}
}}
/>
)}
/>
<Controller
name="exchangeVersion"
control={form.control}
render={({ field: { onChange } }) => (
<SelectField
label={t("exchange_version")}
options={exchangeVersions}
defaultValue={exchangeVersions[7]}
onChange={async (version) => {
onChange(version?.value);
if (version) {
form.setValue("exchangeVersion", version.value);
}
}}
/>
)}
/>
<Switch
label={t("exchange_compression")}
name="useCompression"
onCheckedChange={async (alt) => {
form.setValue("useCompression", alt);
render={({ field: { onChange } }) => {
const ntlmAuthenticationMethod = authenticationMethods.find(
(method) => method.value === ExchangeAuthentication.NTLM
);
return (
<SelectField
label={t("exchange_authentication")}
options={authenticationMethods}
defaultValue={ntlmAuthenticationMethod}
onChange={(authentication) => {
if (authentication) {
onChange(authentication.value);
form.setValue("authenticationMethod", authentication.value);
}
}}
/>
);
}}
/>
{authenticationMethod === ExchangeAuthentication.STANDARD ? (
<Controller
name="exchangeVersion"
control={form.control}
render={({ field: { onChange } }) => {
const exchangeVersion2016 = exchangeVersions.find(
(exchangeVersion) => exchangeVersion.value === ExchangeVersion.Exchange2016
);
return (
<SelectField
label={t("exchange_version")}
options={exchangeVersions}
defaultValue={exchangeVersion2016}
onChange={(version) => {
onChange(version?.value);
if (version) {
form.setValue("exchangeVersion", version.value);
}
}}
/>
);
}}
/>
) : null}
</fieldset>
{errorMessage && <Alert severity="error" title={errorMessage} className="my-4" />}
<div className="mt-4 flex justify-end space-x-2 rtl:space-x-reverse">