2022-07-06 19:31:07 +00:00
|
|
|
import classNames from "classnames";
|
2022-11-08 16:36:14 +00:00
|
|
|
import { debounce, noop } from "lodash";
|
2023-07-13 12:21:28 +00:00
|
|
|
import { useSession } from "next-auth/react";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { RefCallback } from "react";
|
|
|
|
import { useEffect, useMemo, useState } from "react";
|
2022-07-06 19:31:07 +00:00
|
|
|
|
|
|
|
import { fetchUsername } from "@calcom/lib/fetchUsername";
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { TRPCClientErrorLike } from "@calcom/trpc/client";
|
2022-07-22 17:27:06 +00:00
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2023-02-16 22:39:57 +00:00
|
|
|
import type { AppRouter } from "@calcom/trpc/server/routers/_app";
|
2023-08-07 14:00:31 +00:00
|
|
|
import { Button, Dialog, DialogClose, DialogContent, TextField, DialogFooter } from "@calcom/ui";
|
2023-04-12 15:26:31 +00:00
|
|
|
import { Check, Edit2 } from "@calcom/ui/components/icon";
|
2022-07-06 19:31:07 +00:00
|
|
|
|
|
|
|
interface ICustomUsernameProps {
|
|
|
|
currentUsername: string | undefined;
|
2022-11-08 16:36:14 +00:00
|
|
|
setCurrentUsername?: (newUsername: string) => void;
|
2022-07-06 19:31:07 +00:00
|
|
|
inputUsernameValue: string | undefined;
|
2022-11-08 16:36:14 +00:00
|
|
|
usernameRef: RefCallback<HTMLInputElement>;
|
2022-07-06 19:31:07 +00:00
|
|
|
setInputUsernameValue: (value: string) => void;
|
|
|
|
onSuccessMutation?: () => void;
|
|
|
|
onErrorMutation?: (error: TRPCClientErrorLike<AppRouter>) => void;
|
|
|
|
}
|
|
|
|
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
const UsernameTextfield = (props: ICustomUsernameProps & Partial<React.ComponentProps<typeof TextField>>) => {
|
2022-07-06 19:31:07 +00:00
|
|
|
const { t } = useLocale();
|
2023-07-13 12:21:28 +00:00
|
|
|
const { data: session, update } = useSession();
|
2023-07-27 08:41:33 +00:00
|
|
|
|
2022-07-06 19:31:07 +00:00
|
|
|
const {
|
|
|
|
currentUsername,
|
2022-11-08 16:36:14 +00:00
|
|
|
setCurrentUsername = noop,
|
2022-07-06 19:31:07 +00:00
|
|
|
inputUsernameValue,
|
|
|
|
setInputUsernameValue,
|
|
|
|
usernameRef,
|
|
|
|
onSuccessMutation,
|
|
|
|
onErrorMutation,
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
...rest
|
2022-07-06 19:31:07 +00:00
|
|
|
} = props;
|
|
|
|
const [usernameIsAvailable, setUsernameIsAvailable] = useState(false);
|
|
|
|
const [markAsError, setMarkAsError] = useState(false);
|
|
|
|
const [openDialogSaveUsername, setOpenDialogSaveUsername] = useState(false);
|
|
|
|
|
2022-11-08 16:36:14 +00:00
|
|
|
const debouncedApiCall = useMemo(
|
|
|
|
() =>
|
|
|
|
debounce(async (username) => {
|
|
|
|
const { data } = await fetchUsername(username);
|
|
|
|
setMarkAsError(!data.available);
|
|
|
|
setUsernameIsAvailable(data.available);
|
|
|
|
}, 150),
|
2022-07-06 19:31:07 +00:00
|
|
|
[]
|
|
|
|
);
|
|
|
|
|
|
|
|
useEffect(() => {
|
2022-11-08 16:36:14 +00:00
|
|
|
if (!inputUsernameValue) {
|
|
|
|
debouncedApiCall.cancel();
|
|
|
|
setUsernameIsAvailable(false);
|
|
|
|
setMarkAsError(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-06 19:31:07 +00:00
|
|
|
if (currentUsername !== inputUsernameValue) {
|
|
|
|
debouncedApiCall(inputUsernameValue);
|
|
|
|
} else {
|
|
|
|
setUsernameIsAvailable(false);
|
|
|
|
}
|
2022-11-08 16:36:14 +00:00
|
|
|
}, [inputUsernameValue, debouncedApiCall, currentUsername]);
|
2022-07-06 19:31:07 +00:00
|
|
|
|
|
|
|
const utils = trpc.useContext();
|
|
|
|
|
2022-11-10 23:40:01 +00:00
|
|
|
const updateUsernameMutation = trpc.viewer.updateProfile.useMutation({
|
2022-07-06 19:31:07 +00:00
|
|
|
onSuccess: async () => {
|
|
|
|
onSuccessMutation && (await onSuccessMutation());
|
|
|
|
setOpenDialogSaveUsername(false);
|
2022-11-10 23:40:01 +00:00
|
|
|
setCurrentUsername(inputUsernameValue);
|
2023-07-27 08:41:33 +00:00
|
|
|
await update({ username: inputUsernameValue });
|
2022-07-06 19:31:07 +00:00
|
|
|
},
|
|
|
|
onError: (error) => {
|
|
|
|
onErrorMutation && onErrorMutation(error);
|
|
|
|
},
|
|
|
|
async onSettled() {
|
2022-11-10 23:40:01 +00:00
|
|
|
await utils.viewer.public.i18n.invalidate();
|
2022-07-06 19:31:07 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-09-22 17:34:17 +00:00
|
|
|
const ActionButtons = () => {
|
2022-07-06 19:31:07 +00:00
|
|
|
return usernameIsAvailable && currentUsername !== inputUsernameValue ? (
|
2023-06-22 22:25:37 +00:00
|
|
|
<div className="me-2 ms-2 flex flex-row space-x-2">
|
2022-07-06 19:31:07 +00:00
|
|
|
<Button
|
|
|
|
type="button"
|
|
|
|
onClick={() => setOpenDialogSaveUsername(true)}
|
2022-09-22 17:34:17 +00:00
|
|
|
data-testid="update-username-btn">
|
2022-07-06 19:31:07 +00:00
|
|
|
{t("update")}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
type="button"
|
|
|
|
color="minimal"
|
|
|
|
onClick={() => {
|
|
|
|
if (currentUsername) {
|
|
|
|
setInputUsernameValue(currentUsername);
|
|
|
|
}
|
|
|
|
}}>
|
|
|
|
{t("cancel")}
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<></>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-11-08 16:36:14 +00:00
|
|
|
const updateUsername = async () => {
|
2022-11-10 23:40:01 +00:00
|
|
|
updateUsernameMutation.mutate({
|
2022-11-08 16:36:14 +00:00
|
|
|
username: inputUsernameValue,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-07-06 19:31:07 +00:00
|
|
|
return (
|
2022-09-06 22:58:16 +00:00
|
|
|
<div>
|
2023-01-09 18:35:00 +00:00
|
|
|
<div className="flex rounded-md">
|
2022-07-06 19:31:07 +00:00
|
|
|
<div className="relative w-full">
|
2023-01-04 07:38:45 +00:00
|
|
|
<TextField
|
2022-07-06 19:31:07 +00:00
|
|
|
ref={usernameRef}
|
2022-07-12 17:50:04 +00:00
|
|
|
name="username"
|
2022-12-07 20:15:15 +00:00
|
|
|
value={inputUsernameValue}
|
2022-07-12 17:50:04 +00:00
|
|
|
autoComplete="none"
|
|
|
|
autoCapitalize="none"
|
|
|
|
autoCorrect="none"
|
2022-07-06 19:31:07 +00:00
|
|
|
className={classNames(
|
2023-04-16 19:35:17 +00:00
|
|
|
"mb-0 mt-0 rounded-md rounded-l-none",
|
2022-07-06 19:31:07 +00:00
|
|
|
markAsError
|
|
|
|
? "focus:shadow-0 focus:ring-shadow-0 border-red-500 focus:border-red-500 focus:outline-none focus:ring-0"
|
|
|
|
: ""
|
|
|
|
)}
|
|
|
|
onChange={(event) => {
|
|
|
|
event.preventDefault();
|
|
|
|
setInputUsernameValue(event.target.value);
|
|
|
|
}}
|
|
|
|
data-testid="username-input"
|
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
|
|
|
{...rest}
|
2022-07-06 19:31:07 +00:00
|
|
|
/>
|
|
|
|
{currentUsername !== inputUsernameValue && (
|
2023-01-04 07:38:45 +00:00
|
|
|
<div className="absolute right-[2px] top-6 flex flex-row">
|
2023-07-05 18:19:42 +00:00
|
|
|
<span className={classNames("mx-2 py-3.5")}>
|
2023-04-20 22:33:49 +00:00
|
|
|
{usernameIsAvailable ? <Check className="h-4 w-4" /> : <></>}
|
2022-07-06 19:31:07 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2023-06-05 09:16:28 +00:00
|
|
|
<div className="mt-7 hidden md:inline">
|
2022-09-22 17:34:17 +00:00
|
|
|
<ActionButtons />
|
2022-07-06 19:31:07 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-01-04 07:38:45 +00:00
|
|
|
{markAsError && <p className="mt-1 text-xs text-red-500">{t("username_already_taken")}</p>}
|
2022-07-06 19:31:07 +00:00
|
|
|
|
|
|
|
{usernameIsAvailable && currentUsername !== inputUsernameValue && (
|
2022-09-22 17:34:17 +00:00
|
|
|
<div className="mt-2 flex justify-end md:hidden">
|
|
|
|
<ActionButtons />
|
2022-07-06 19:31:07 +00:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
<Dialog open={openDialogSaveUsername}>
|
2023-04-12 15:26:31 +00:00
|
|
|
<DialogContent type="confirmation" Icon={Edit2} title={t("confirm_username_change_dialog_title")}>
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="flex flex-row">
|
|
|
|
<div className="mb-4 w-full pt-1">
|
2023-07-13 12:28:16 +00:00
|
|
|
<div className="bg-subtle flex w-full flex-wrap gap-6 rounded-sm px-2 py-3 text-sm">
|
|
|
|
<div>
|
2023-04-05 18:14:46 +00:00
|
|
|
<p className="text-subtle">{t("current_username")}</p>
|
|
|
|
<p className="text-emphasis mt-1" data-testid="current-username">
|
2022-07-06 19:31:07 +00:00
|
|
|
{currentUsername}
|
|
|
|
</p>
|
|
|
|
</div>
|
2023-07-13 12:28:16 +00:00
|
|
|
<div>
|
2023-04-05 18:14:46 +00:00
|
|
|
<p className="text-subtle" data-testid="new-username">
|
2022-07-20 18:12:18 +00:00
|
|
|
{t("new_username")}
|
2022-07-06 19:31:07 +00:00
|
|
|
</p>
|
2023-07-13 12:28:16 +00:00
|
|
|
<p className="text-emphasis mt-1">{inputUsernameValue}</p>
|
2022-07-06 19:31:07 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-07 14:00:31 +00:00
|
|
|
|
|
|
|
<DialogFooter className="mt-4">
|
2022-07-06 19:31:07 +00:00
|
|
|
<Button
|
|
|
|
type="button"
|
2022-11-08 16:36:14 +00:00
|
|
|
loading={updateUsernameMutation.isLoading}
|
2022-07-06 19:31:07 +00:00
|
|
|
data-testid="save-username"
|
2022-11-08 16:36:14 +00:00
|
|
|
onClick={updateUsername}>
|
2022-07-06 19:31:07 +00:00
|
|
|
{t("save")}
|
|
|
|
</Button>
|
|
|
|
|
2022-11-28 19:14:38 +00:00
|
|
|
<DialogClose color="secondary" onClick={() => setOpenDialogSaveUsername(false)}>
|
|
|
|
{t("cancel")}
|
2022-07-06 19:31:07 +00:00
|
|
|
</DialogClose>
|
2023-08-07 14:00:31 +00:00
|
|
|
</DialogFooter>
|
2022-07-06 19:31:07 +00:00
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
2022-09-06 22:58:16 +00:00
|
|
|
</div>
|
2022-07-06 19:31:07 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export { UsernameTextfield };
|