Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add advanced tab attributes to api/v2/event-types #28

Closed

Conversation

lizard-boy
Copy link

Overview

  1. This PR introduces the advancedTab attribute to the following updated endpoints:

    Event Types:

    • [POST] /v2/event-types
    • [PATCH] /v2/event-types/{eventTypeId}
    • [GET] /v2/event-types/{eventTypeId} — now includes additional attributes.

    Organizations Event Types:

    • [POST] /v2/organizations/{orgId}/teams/{teamId}/event-types
    • [PATCH] /v2/organizations/{orgId}/teams/{teamId}/event-types/{eventTypeId}
    • [GET] /v2/organizations/{orgId}/teams/{teamId}/event-types/{eventTypeId} — now includes additional attributes.
  2. Adds a disabled state to the following attributes:

    • seats
    • recurrence
    • bookingLimitsCount
    • bookingLimitsDuration
    • bookingWindow
    • confirmationPolicy

    Commits related to this change:

  3. Refactors the codebase to implement pipes for transforming input data and uses interceptors for transforming output data. The goal is to keep the service layer cleaner by handling transformation logic at the controller level, allowing services to interact freely without duplicating transformation processes.

    Commits related to this change:

  4. Refactors our event-type input, output, and update classes to extend from a single base class. This simplifies the process of adding new attributes in the future.

    Commit related to this change:


Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A sizable PR without self-review might be rejected).
  • I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Set "version": "1.2.3" in packages/platform/libraries/package.json.
  2. Add "@calcom/platform-libraries-1.2.3": "npm:@calcom/[email protected]" to apps/api/v2/package.json.
  3. If you encounter a Cannot write file error while running api/v2, delete the dist folder in platform/types and try running api/v2 again.

Testing api/v2/event-types:


1. Layout:

Screenshot

  • Input for the handler:
    {
      "metadata": {
        "enabledLayouts": ["month_view", "column_view"],
        "defaultLayout": "month_view"
      }
    }
  • API V2:
    {
      "bookerLayouts": {
        "enabledLayouts": ["column", "month", "week"],
        "defaultLayout": "month"
      }
    }

2. Requires Confirmation - Always:

Screenshot

  • Input for the handler:
    {
      "requiresConfirmation": true,
      "requiresConfirmationWillBlockSlot": true
    }
  • API V2:
    {
      "confirmationPolicy": {
        "type": "always",
        "blockCalendarForUnconfirmedBookings": true
      }
    }

3. Requires Confirmation - When booked with less than:

Screenshot

  • Input for the handler:
    {
      "requiresConfirmation": true,
      "requiresConfirmationWillBlockSlot": true,
      "metadata": {
        "requiresConfirmationThreshold": {
          "time": 60,
          "unit": "minutes"
        }
      }
    }
  • API V2:
    {
      "confirmationPolicy": {
        "type": "always",
        "blockCalendarForUnconfirmedBookings": true,
        "noticeThreshold": {
          "count": 60,
          "unit": "minutes"
        }
      }
    }

4. Requires Confirmation - Disabled:

Screenshot

  • Input for the handler:
    {
      "requiresConfirmation": false,
      "requiresConfirmationWillBlockSlot": false
    }
  • API V2:
    {
      "confirmationPolicy": {
        "disabled": true
      }
    }

5. Requires Booker Email Verification:

Screenshot

  • Input for the handler:
    {
      "requiresBookerEmailVerification": true
    }
  • API V2:
    {
      "requiresBookerEmailVerification": true
    }

6. Hide Notes in Calendar:

Screenshot

  • Input for the handler:
    {
      "hideCalendarNotes": true
    }
  • API V2:
    {
      "hideCalendarNotes": true
    }

7. Offer Seats:

Screenshot

  • Input for the handler:
    {
      "seatsPerTimeSlot": 4,
      "seatsShowAttendees": true,
      "seatsShowAvailabilityCount": true
    }
  • API V2:
    {
      "seats": {
        "seatsPerTimeSlot": 4,
        "showAttendeeInfo": true,
        "showAvailabilityCount": true
      }
    }

8. Offer Seats — Disabled:

Screenshot

  • Input for the handler:
    {
      "seatsPerTimeSlot": null
    }
  • API V2:
    {
      "seats": {
        "disabled": true
      }
    }

9. Lock Timezone on Booking Page:

Screenshot

  • Input for the handler:
    {
      "lockTimeZoneToggleOnBookingPage": true
    }
  • API V2:
    {
      "lockTimeZoneToggleOnBookingPage": true
    }

10. Event Type Color:

Screenshot

  • Input for the handler:
    {
      "eventTypeColor": {
        "lightEventTypeColor": "#292929",
        "darkEventTypeColor": "#fafafa"
      }
    }
  • API V2:
    {
      "color": {
        "lightThemeHex": "#292929",
        "darkThemeHex": "#fafafa"
      }
    }

11. Custom Event Name:

Screenshot 2024-09-13 at 2 59 23 PM

  • Input for the handler:

    {
      "eventName": "{Event type title} between {Organiser} and {Scheduler}"
    }
  • API V2:

    {
      "customName": "{Event type title} between {Organiser} and {Scheduler}"
    }

    Valid Variables that can be used in the custom event name:

    • {Event type title}
    • {Organiser}
    • {Scheduler}
    • {Location}
    • {Organiser first name}
    • {Scheduler first name}
    • {Scheduler last name}
    • {Event duration}
    • {LOCATION}
    • {HOST/ATTENDEE}
    • {HOST}
    • {ATTENDEE}
    • {USER}

12. Destination Calendar:

Screenshot 2024-09-13 at 2 58 42 PM

  • Input for the handler:

    {
      "destinationCalendar": {
        "integration": "google_calendar",
        "externalId": "[email protected]"
      }
    }
  • API V2:

    {
      "destinationCalendar": {
        "integration": "google_calendar",
        "externalId": "[email protected]"
      }
    }

    Note on Testing:
    Testing this feature requires a connected calendar. Here's how you can test it:

    1. Use the example app to connect a Google Calendar to your account.
    2. Retrieve the user ID of the account (found in the platform dashboard).
    3. In Postman, force refresh the access token for the user ID.
    4. Use the refreshed access token to call the following API:
      POST http://localhost:5555/v2/calendars
      
      This API will return a list of destinationCalendars connected to the account.
    5. Choose an externalId and integration from the response and use them in the create-event type payload as shown above.

13. Use Event Type Destination Calendar Email:

Screenshot 2024-09-13 at 2 57 54 PM

  • Input for the handler:

    {
      "useEventTypeDestinationCalendarEmail": true
    }
  • API V2:

    {
      "useDestinationCalendarEmail": true
    }

    Note on Enabling:
    To enable this, a calendar must already be connected to your account.

sean-brydon and others added 23 commits September 17, 2024 19:09
* update version

* fix button to match new spec

* migrate tests to objectContaining

* fix tests

* update RTL

* yarn.lock update

* bump fetch mock to latest vitest version

* update deep mock to use vitest 2.0

* fix mock prisma type cast

* meet base test fn singature for V2

* remove console.log from next test
* chore: EventTypeWebWrapper base pr

* fixup! chore: EventTypeWebWrapper base pr

* fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base

* wip

* fix: error

* Event type atom wrapper handles app dir

* fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base

* fixup! fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base

* remove console log

* review comments

* fixup! review comments

* fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base

---------

Co-authored-by: Somay Chauhan <[email protected]>
* refactor: define inputs and outputs by separating default and custom fields

* refactor: event type api <-> internal transformers

* refactor: v2 use refactored libraries to transform input and output booking fields

* refactor: dont allow custom slugs with default reserved slugs

* refactor: input service store only specific default system fields

* refactor: atoms display only specific default system fields

* refactor: delete unused system field constants

* fix: tests

* fix: old event types

* fix: imports

* fix: import

* chore: release libraries and use v2 with them

* fix: unit tests

* refactor: push email in case of missing phone

* refactor: satisfies check for event-type locations
* fix: fixed more flaky e2e tests (round 2)

* update

* fix and update

* update
* added retell ai to app store

* added retell ai
* chore: EventTypeWebWrapper base pr

* fixup! chore: EventTypeWebWrapper base pr

* fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base

* wip

* fix: error

* Event type atom wrapper handles app dir

* fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base

* fixup! fixup! Merge branch 'main' into morgan/cal-4183-eventtypeatom-web-wrapper-base

* remove console log

* refactor: event-type-atom (setup tab)

* review comments

* update: better naming

* fixup! review comments

* revert: defaultMenuIsOpen --will create a separate PR

---------

Co-authored-by: Morgan Vernay <[email protected]>
Co-authored-by: Morgan <[email protected]>
…erSideProps`/`getStaticProps` to `/lib` (calcom#16458)

* booking: Move getServerSideProps to /lib

* remove duplicate

* bookings: Move getStaticProps to /lib

* fix type check

* replace setHeader with a server action call in withEmbedSSR

* Add env variables for booking
* chore: removes unnecessary prisma env warnings

* Revert lockfile

Signed-off-by: zomars <[email protected]>

* Update yarn lock

Signed-off-by: zomars <[email protected]>

---------

Signed-off-by: zomars <[email protected]>
* docs: schedules

* docs: wip event-types

* docs:event-types

* docs:event-types

* Delete yarn.lock

* Revert "Delete yarn.lock"

This reverts commit bb3eb23.

---------

Co-authored-by: Morgan <[email protected]>
calcom#16648)

* fix settings/admin/page

* remove references to pages for settings/teams

* remove double layouts

* move pages that do not need layout out of (settings) group

* fix

* fix

* fix

* fix

* add sso page and fix layouts
… in `/auth`, `/insights`, `/d`, `signup` and add missing default `/future` page (calcom#16589)

* remove references to /pages for sso, setup, signin pages in /auth

* remove references to pages for insights

* remove references to pages for d

* remove references to pages for signup

* add page for /future index page

* fix routing-forms

* fix

* add missing defaults

* use getServerSessionForAppDir instead

* fix apps/[slug]/[...pages]

* fix metadata in apps/slug/pages

* refactor

* refactor

* remove duplicate code for PageProps

* remove references to pages for /reschedule

* fix

* fix routing forms

* type fix

* fix routing forms again

* revert changes for app/slug/pages

* revert

* revert changes in yarn lock

---------

Co-authored-by: Joe Au-Yeung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.