2022-07-28 19:58:26 +00:00
|
|
|
import type { TFunction } from "next-i18next";
|
|
|
|
|
2022-04-05 18:03:22 +00:00
|
|
|
export enum DefaultLocationType {
|
2022-02-15 20:30:52 +00:00
|
|
|
InPerson = "inPerson",
|
|
|
|
Phone = "phone",
|
2022-05-16 15:50:12 +00:00
|
|
|
UserPhone = "userPhone",
|
2022-03-13 15:56:56 +00:00
|
|
|
Link = "link",
|
2022-04-05 18:03:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** If your App has a location option, add it here */
|
|
|
|
export enum AppStoreLocationType {
|
2022-02-15 20:30:52 +00:00
|
|
|
GoogleMeet = "integrations:google:meet",
|
|
|
|
Zoom = "integrations:zoom",
|
|
|
|
Daily = "integrations:daily",
|
|
|
|
Jitsi = "integrations:jitsi",
|
|
|
|
Huddle01 = "integrations:huddle01",
|
|
|
|
Tandem = "integrations:tandem",
|
2022-03-23 22:00:30 +00:00
|
|
|
Teams = "integrations:office365_video",
|
2022-06-27 10:17:38 +00:00
|
|
|
Whereby = "integrations:whereby_video",
|
|
|
|
Around = "integrations:around_video",
|
|
|
|
Riverside = "integrations:riverside_video",
|
2022-02-15 20:30:52 +00:00
|
|
|
}
|
2022-04-05 18:03:22 +00:00
|
|
|
|
2022-05-25 20:34:08 +00:00
|
|
|
export type LocationObject = {
|
|
|
|
type: LocationType;
|
|
|
|
address?: string;
|
|
|
|
link?: string;
|
|
|
|
displayLocationPublicly?: boolean;
|
|
|
|
hostPhoneNumber?: string;
|
|
|
|
};
|
|
|
|
|
2022-04-05 18:03:22 +00:00
|
|
|
export const LocationType = { ...DefaultLocationType, ...AppStoreLocationType };
|
|
|
|
export type LocationType = DefaultLocationType | AppStoreLocationType;
|
2022-05-25 20:34:08 +00:00
|
|
|
|
|
|
|
export const locationHiddenFilter = (locations: LocationObject[]) =>
|
|
|
|
locations.filter((el) => {
|
|
|
|
// Filter out locations that are not to be displayed publicly
|
|
|
|
const values = Object.values(AppStoreLocationType);
|
|
|
|
// Display if the location can be set to public - and also display all locations like google meet etc
|
|
|
|
if (el.displayLocationPublicly || values.includes(el["type"] as unknown as AppStoreLocationType))
|
|
|
|
return el;
|
|
|
|
else {
|
|
|
|
delete el.address;
|
|
|
|
delete el.link;
|
|
|
|
return el;
|
|
|
|
}
|
|
|
|
});
|
2022-07-28 19:58:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Use this function for translating event location to a readable string
|
|
|
|
* @param location
|
|
|
|
* @param t
|
|
|
|
* @returns string
|
|
|
|
*/
|
|
|
|
export const LocationOptionsToString = (location: string, t: TFunction) => {
|
|
|
|
switch (location) {
|
|
|
|
case LocationType.InPerson:
|
|
|
|
return t("set_address_place");
|
|
|
|
case LocationType.Link:
|
|
|
|
return t("set_link_meeting");
|
|
|
|
case LocationType.Phone:
|
|
|
|
return t("cal_invitee_phone_number_scheduling");
|
|
|
|
case LocationType.GoogleMeet:
|
|
|
|
return t("cal_provide_google_meet_location");
|
|
|
|
case LocationType.Zoom:
|
|
|
|
return t("cal_provide_zoom_meeting_url");
|
|
|
|
case LocationType.Daily:
|
|
|
|
return t("cal_provide_video_meeting_url");
|
|
|
|
case LocationType.Jitsi:
|
|
|
|
return t("cal_provide_jitsi_meeting_url");
|
|
|
|
case LocationType.Huddle01:
|
|
|
|
return t("cal_provide_huddle01_meeting_url");
|
|
|
|
case LocationType.Tandem:
|
|
|
|
return t("cal_provide_tandem_meeting_url");
|
|
|
|
case LocationType.Teams:
|
|
|
|
return t("cal_provide_teams_meeting_url");
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|