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: integrate formbricks for team disband action #13362

Conversation

ShubhamPalriwala
Copy link
Contributor

What does this PR do?

Shows Formbricks In-App Survey whenever a user disbands ie Deletes a team!

  • Renames existing Formbricks env variables to work client side too
  • Adds a new formbricks/js package
  • Builds a new formbricks-client.ts file to run client side formbricks/js methods
  • Tracks the team_disbanded action whenever the deleteTeam happens in the UI. The moment this happens, the user will be displayed the in-app survey that you've configured!

This PR is an updated version of #10659

Requirement/Documentation

Type of change

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

How should this be tested?

  • Set the env vars
  • Define the code action, the in-app survey, and its triggering to this action
  • Now try Deleting a Team and you should see the survey in the cal app!

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Copy link

vercel bot commented Jan 22, 2024

@ShubhamPalriwala is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

github-actions bot commented Jan 22, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@github-actions github-actions bot added the ❗️ .env changes contains changes to env variables label Jan 22, 2024
Copy link

socket-security bot commented Jan 22, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@formbricks/js@1.5.0 network 0 500 kB matthiasnannt

View full report↗︎

Copy link
Contributor

github-actions bot commented Jan 22, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Sixty-five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/apps 287.33 KB 475.48 KB 135.85% (🟡 +2.28%)
/apps/[slug] 304.84 KB 492.99 KB 140.85% (🟡 +2.28%)
/apps/[slug]/[...pages] 555.29 KB 743.44 KB 212.41% (🟡 +2.22%)
/apps/categories 265.02 KB 453.16 KB 129.47% (🟡 +2.28%)
/apps/categories/[category] 269.32 KB 457.47 KB 130.71% (🟡 +2.27%)
/apps/installed/[category] 288.41 KB 476.56 KB 136.16% (🟡 +2.28%)
/availability 434.24 KB 622.38 KB 177.82% (🟡 +2.28%)
/availability/[schedule] 361.53 KB 549.67 KB 157.05% (🟡 +2.28%)
/bookings/[status] 324.79 KB 512.94 KB 146.55% (🟡 +2.28%)
/enterprise 265.48 KB 453.63 KB 129.61% (🟡 +2.27%)
/event-types 556.13 KB 744.28 KB 212.65% (🟡 +2.20%)
/event-types/[type] 432.24 KB 620.38 KB 177.25% (🟡 +2.28%)
/insights 483.83 KB 671.97 KB 191.99% (🟡 +2.28%)
/more 264.64 KB 452.79 KB 129.37% (🟡 +2.27%)
/settings/admin 271.35 KB 459.49 KB 131.28% (🟡 +2.28%)
/settings/admin/apps 282.82 KB 470.97 KB 134.56% (🟡 +2.28%)
/settings/admin/apps/[category] 282.78 KB 470.93 KB 134.55% (🟡 +2.28%)
/settings/admin/flags 275.11 KB 463.26 KB 132.36% (🟡 +2.27%)
/settings/admin/impersonation 271.65 KB 459.79 KB 131.37% (🟡 +2.27%)
/settings/admin/oAuth 283.36 KB 471.51 KB 134.72% (🟡 +2.27%)
/settings/admin/orgMigrations/_OrgMigrationLayout 264.11 KB 452.26 KB 129.22% (🟡 +2.27%)
/settings/admin/orgMigrations/moveTeamToOrg 273.29 KB 461.43 KB 131.84% (🟡 +2.27%)
/settings/admin/orgMigrations/moveUserToOrg 291.8 KB 479.95 KB 137.13% (🟡 +2.27%)
/settings/admin/orgMigrations/removeTeamFromOrg 273.05 KB 461.19 KB 131.77% (🟡 +2.27%)
/settings/admin/orgMigrations/removeUserFromOrg 273.06 KB 461.2 KB 131.77% (🟡 +2.28%)
/settings/admin/organizations 273.37 KB 461.52 KB 131.86% (🟡 +2.28%)
/settings/admin/organizations/[id]/edit 271.87 KB 460.01 KB 131.43% (🟡 +2.28%)
/settings/admin/users 274.07 KB 462.21 KB 132.06% (🟡 +2.28%)
/settings/admin/users/[id]/edit 365.68 KB 553.83 KB 158.24% (🟡 +2.20%)
/settings/admin/users/add 365.36 KB 553.5 KB 158.14% (🟡 +2.19%)
/settings/billing 271.55 KB 459.7 KB 131.34% (🟡 +2.28%)
/settings/developer/api-keys 275.98 KB 464.12 KB 132.61% (🟡 +2.27%)
/settings/developer/webhooks 275.9 KB 464.04 KB 132.58% (🟡 +2.28%)
/settings/developer/webhooks/[id] 276.96 KB 465.1 KB 132.89% (🟡 +2.27%)
/settings/developer/webhooks/new 277 KB 465.15 KB 132.90% (🟡 +2.27%)
/settings/my-account/appearance 287.49 KB 475.63 KB 135.89% (🟡 +2.28%)
/settings/my-account/calendars 282.34 KB 470.49 KB 134.42% (🟡 +2.28%)
/settings/my-account/conferencing 283.23 KB 471.37 KB 134.68% (🟡 +2.27%)
/settings/my-account/general 359.7 KB 547.84 KB 156.53% (🟡 +2.27%)
/settings/my-account/out-of-office 275.77 KB 463.92 KB 132.55% (🟡 +2.27%)
/settings/my-account/profile 408.12 KB 596.27 KB 170.36% (🟡 +2.28%)
/settings/organizations/appearance 294.38 KB 482.52 KB 137.86% (🟡 +2.11%)
/settings/organizations/billing 271.59 KB 459.73 KB 131.35% (🟡 +2.28%)
/settings/organizations/general 352.24 KB 540.38 KB 154.40% (🟡 +2.27%)
/settings/organizations/members 444.09 KB 632.23 KB 180.64% (🟡 +2.27%)
/settings/organizations/profile 405.11 KB 593.25 KB 169.50% (🟡 +2.28%)
/settings/organizations/teams/other 272.43 KB 460.57 KB 131.59% (🟡 +2.28%)
/settings/organizations/teams/other/[id]/appearance 284.05 KB 472.2 KB 134.91% (🟡 +2.28%)
/settings/organizations/teams/other/[id]/members 278.94 KB 467.08 KB 133.45% (🟡 +2.28%)
/settings/organizations/teams/other/[id]/profile 476.88 KB 665.02 KB 190.01% (🟡 +2.16%)
/settings/security/impersonation 276.67 KB 464.81 KB 132.80% (🟡 +2.28%)
/settings/security/password 278.03 KB 466.17 KB 133.19% (🟡 +2.28%)
/settings/security/sso 281.65 KB 469.79 KB 134.23% (🟡 +2.27%)
/settings/security/two-factor-auth 280.49 KB 468.63 KB 133.90% (🟡 +2.27%)
/settings/teams 271.08 KB 459.23 KB 131.21% (🟡 +2.27%)
/settings/teams/[id]/appearance 284.04 KB 472.19 KB 134.91% (🟡 +2.28%)
/settings/teams/[id]/billing 271.59 KB 459.74 KB 131.35% (🟡 +2.28%)
/settings/teams/[id]/members 389.46 KB 577.61 KB 165.03% (🟡 +2.28%)
/settings/teams/[id]/profile 477.71 KB 665.85 KB 190.24% (🟡 +2.17%)
/settings/teams/[id]/sso 282.18 KB 470.33 KB 134.38% (🟡 +2.27%)
/settings/teams/new 214.88 KB 403.03 KB 115.15% (🟡 +2.24%)
/teams 264.92 KB 453.07 KB 129.45% (🟡 +2.27%)
/upgrade 265.09 KB 453.24 KB 129.50% (🟡 +2.27%)
/workflows 295.94 KB 484.09 KB 138.31% (🟡 +2.28%)
/workflows/[workflow] 409.07 KB 597.21 KB 170.63% (🟡 +2.28%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@CarinaWolli CarinaWolli linked an issue Jan 22, 2024 that may be closed by this pull request
@keithwillcode keithwillcode added the Medium priority Created by Linear-GitHub Sync label Jan 22, 2024
@keithwillcode keithwillcode added this to the v3.8 milestone Jan 22, 2024
@keithwillcode keithwillcode requested a review from a team January 22, 2024 15:44
@keithwillcode keithwillcode added the community Created by Linear-GitHub Sync label Jan 22, 2024
FORMBRICKS_HOST_URL=https://app.formbricks.com
FORMBRICKS_ENVIRONMENT_ID=
NEXT_PUBLIC_FORMBRICKS_HOST_URL=https://app.formbricks.com
NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=
Copy link
Contributor

Choose a reason for hiding this comment

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

@ShubhamPalriwala where can i get the environment ID to test this?

Copy link
Member

Choose a reason for hiding this comment

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

DMed you!

Copy link
Contributor

Choose a reason for hiding this comment

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

@Udit-takkar @PeerRich Just double-checking that this is ok to be exposed client-side?

Copy link
Contributor

Choose a reason for hiding this comment

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

@keithwillcode I don't think so there is any issue as we using initFormbricks inside useEffect we would have to use NEXT_PUBLIC_* to expose variable to client side

Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

@ShubhamPalriwala After i changed my environement id variable I got this error.

Screenshot 2024-01-23 at 6 32 38 PM

@github-actions github-actions bot added the ✨ feature New feature or request label Jan 23, 2024
@ShubhamPalriwala
Copy link
Contributor Author

Hey @Udit-takkar, that's unexpected! But I do see that a request already went through for the same! Could you try disbanding the team and see if the action as well as a survey gets triggered?

@mattinannt
Copy link
Contributor

@ShubhamPalriwala After i changed my environement id variable I got this error.

Screenshot 2024-01-23 at 6 32 38 PM

@Udit-takkar This looks like a caching issue on our side that we will try to reproduce and solve 😊.
Essentially what happens is that when sending a new attribute twice the second call gets stuck since it's trying again to create the attribute class because the cache still thinks this doesn't exist but it finally fails in the database. Since the cache gets revalidated every 30 minutes, please try again now. In this environment the error should not happen again.

Copy link
Contributor

Hey there, there is a merge conflict, can you take a look?

@github-actions github-actions bot added the 🚨 merge conflict This PR has a merge conflict that has to be addressed label Jan 28, 2024
@mattinannt
Copy link
Contributor

@Udit-takkar What are the next steps for the review? Is everything else working as expected? 😊

@Udit-takkar Udit-takkar self-requested a review January 30, 2024 20:40
Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

@ShubhamPalriwala works fine 👍. there are some conflicts that needs to be resolved.

we would have to rename environment variables on vercel cc: @keithwillcode

@ShubhamPalriwala ShubhamPalriwala force-pushed the shubham/for-1698-calcom-disband-team-survey branch from 0e6ac3f to e4d355a Compare February 1, 2024 08:19
@ShubhamPalriwala
Copy link
Contributor Author

Hey team, I've resolved the conflicts! Please let us know of the next steps 🤞🏼

cc: @keithwillcode @Udit-takkar

@keithwillcode
Copy link
Contributor

Before merge, we need to make sure the yarn.lock changes are correct. It's a lot.

@ShubhamPalriwala
Copy link
Contributor Author

Hey @keithwillcode, A main merge and a fresh slate fixed the yarn.lock changes! Please take a look now 🤞🏼

Should be relatively easier for you as compared to before 😎

Copy link

vercel bot commented Feb 5, 2024

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

Name Status Preview Comments Updated (UTC)
api ❌ Failed (Inspect) Feb 5, 2024 11:01am

@keithwillcode keithwillcode merged commit 8469c91 into calcom:main Feb 7, 2024
30 of 38 checks passed
@mattinannt
Copy link
Contributor

@keithwillcode Happy to see this got merged 🤩
I just checked app.cal.com and it seems like Formbricks isn't loaded. Did you already set the environment variables NEXT_PUBLIC_FORMBRICKS_HOST_URL & NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Created by Linear-GitHub Sync ❗️ .env changes contains changes to env variables ✨ feature New feature or request Medium priority Created by Linear-GitHub Sync 🚨 merge conflict This PR has a merge conflict that has to be addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-2890] Add Formbricks experience management support
5 participants