Skip to content

Direct links to accept/reject a booking#5939

Merged
PeerRich merged 20 commits intomainfrom
feat/direct-link-accept-reject-booking
Dec 13, 2022
Merged

Direct links to accept/reject a booking#5939
PeerRich merged 20 commits intomainfrom
feat/direct-link-accept-reject-booking

Conversation

@leog
Copy link
Copy Markdown
Contributor

@leog leog commented Dec 8, 2022

What does this PR do?

Implement direct links in a email with required confirmation for a booking in order to accept or reject it, no need to log in.

Now when getting a booking that requires confirmation, it has 2 CTAs:
image

When clicking on accept:

When clicking on reject, it requires a reason to reject:

Once the reason for reject is provided:

In case an already accepted/rejected booking is visited again:

In case a booking does not exist, using the 500 error with custom text:

In case the wrong URL is provided, hence the signature is not correct:

Closes #5807

Internal Tech Specs for the implementation (WIP): https://app.gitbook.com/o/6snd8PyPYMhg0wUw6CeQ/s/VM7BFW5yP5ZxWKDW57nx/technical-specs/direct-link-actions-wip

Loom Video: TBD

Environment: Staging(main branch) / Production

Type of change

  • New feature (non-breaking change which adds functionality)

How should this be tested?

Book required confirmation event-types and interact with the email CTAs.

@leog leog requested a review from a team December 8, 2022 21:34
@leog leog self-assigned this Dec 8, 2022
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 8, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cal ✅ Ready (Inspect) Visit Preview Dec 13, 2022 at 11:11PM (UTC)

@PeerRich
Copy link
Copy Markdown
Member

PeerRich commented Dec 8, 2022

never to primary buttons. Accept should be primary, reject should be secondary

@leog
Copy link
Copy Markdown
Contributor Author

leog commented Dec 8, 2022

never to primary buttons. Accept should be primary, reject should be secondary

@PeerRich fixed, thanks!

Comment thread packages/emails/src/components/Info.tsx Outdated
Comment thread apps/web/pages/500.tsx Outdated
const router = useRouter();

return (
<div className="flex h-screen">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NIT: unrelated but i think this container isnt mobile responsive

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I drafted this PR because mobile was pending testing/tweaking, it will work as it works for the booking page.

Comment thread apps/web/pages/api/email.ts
Comment thread packages/emails/src/components/CallToAction.tsx Outdated
@leog
Copy link
Copy Markdown
Contributor Author

leog commented Dec 9, 2022

@PeerRich Here is how the screen currently looks like in my iPhone mini:

@ciaranha
Copy link
Copy Markdown
Member

ciaranha commented Dec 9, 2022

@leog @PeerRich Reason for rejecting should be optional?

@leog
Copy link
Copy Markdown
Contributor Author

leog commented Dec 9, 2022

@leog @PeerRich Reason for rejecting should be optional?

@Jaibles It is optional, you can click on "Reject the booking" button without entering anything in the textarea. BTW, is the mobile screen OK? it behaves the same as the booking page within the app if I'm not mistaken

@ciaranha
Copy link
Copy Markdown
Member

ciaranha commented Dec 9, 2022

Perhaps we can make those error pages a bit more readable?
CleanShot 2022-12-09 at 16 52 24@2x

https://www.figma.com/file/9MOufQNLtdkpnDucmNX10R/%E2%9D%96-Cal-DS?node-id=22675%3A143776&t=BvUyxGFdLgVige8O-1

@ciaranha
Copy link
Copy Markdown
Member

ciaranha commented Dec 9, 2022

@Jaibles It is optional, you can click on "Reject the booking" button without entering anything in the textarea.

In that case, can we put "Reason for rejecting (optional)" in the label so?

BTW, is the mobile screen OK? it behaves the same as the booking page within the app if I'm not mistaken

I would prefer the title left aligned, and it would probably be better single column rather than having the "Who, What, etc" in a second column but it's ok for now, especially if the booking page is the same. We can fix both of those separately? We actually have designs for this already here
CleanShot 2022-12-09 at 16 58 31@2x

@leog
Copy link
Copy Markdown
Contributor Author

leog commented Dec 9, 2022

Feedback applied @PeerRich @Jaibles

New 500 error page:

Mobile view to accept/reject a booking using the direct link:

v2 buttons in emails:

@leog leog marked this pull request as ready for review December 12, 2022 15:45
Comment thread apps/web/pages/500.tsx
Something went wrong on our end. Get in touch with our support team, and we’ll get it fixed right
away for you.
</p>
{router.query.error && (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New 500 error page design plus an optional message to give more context of the error for support purposes.


export const CallToAction = (props: { label: string; href: string }) => (
export const CallToAction = (props: { label: string; href: string; secondary?: boolean }) => (
<p
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

v2 design for email buttons

import { BASE_URL, IS_PRODUCTION } from "@calcom/lib/constants";

export const LinkIcon = () => (
export const LinkIcon = ({ secondary }: { secondary?: boolean }) => (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New v2 design for email buttons adding secondary state

<img
src={IS_PRODUCTION ? BASE_URL + "/emails/linkIcon.png" : "https://app.cal.com/emails/linkIcon.png"}
width="12px"
srcSet={IS_PRODUCTION ? BASE_URL + "/emails/linkIcon.svg" : "https://app.cal.com/emails/linkIcon.svg"}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the possibility to load an SVG to be a crisper image, otherwise it loads usual png

@@ -0,0 +1,3 @@
export const Separator = () => (
<p style={{ width: "16px", height: "16px", display: "inline-block" }}>&nbsp;</p>
);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New separator component for email in this case to separate two buttons from each other

const t = calEvent.attendees[0].language.translate;
const rruleOptions = new RRule(calEvent.recurringEvent).options;
const recurringEvent: RecurringEvent = {
export function getRecurringWhen({
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Making the definition more accurate to what's expected to broaden up its usage

@PeerRich PeerRich merged commit 61e6f76 into main Dec 13, 2022
@PeerRich PeerRich deleted the feat/direct-link-accept-reject-booking branch December 13, 2022 21:09
Comment thread packages/trpc/server/routers/viewer/bookings.tsx
@zomars zomars mentioned this pull request Dec 21, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-514] Direct links to accept/reject booking

4 participants