Skip to content

Commit adb15aa

Browse files
marawan206DrJKLchristian-byrne
authored
feat: pre-fill user info in Zendesk support link (#6586)
Add user email and ID as URL parameters when opening the Contact Support link to improve support experience. Only includes user data when logged in. ## Summary Enhanced the Contact Support command to automatically pre-fill user email and ID in Zendesk support tickets, streamlining the support request process for authenticated users. ## Changes - **What**: - Added `useCurrentUser` composable to access authenticated user data in `useCoreCommands.ts` - Modified `Comfy.ContactSupport` command to append user email (`tf_anonymous_requester_email` and `tf_40029135130388`) and user ID (`tf_42515251051412`) as URL parameters when available - Maintained backward compatibility by only adding user parameters when user is logged in - Preserved existing `tf_42243568391700` parameter for distribution type (oss/ccloud) ## Review Focus - Verify that the URL parameters are correctly appended only when user is authenticated - Confirm that non-authenticated users still get the base support URL with just the distribution type parameter - Check that both Firebase auth and API key auth users have their information properly included Example URLs generated when you press on help locally (it will change automatically to ccloud on Cloud): - **Logged out**: `https://support.comfy.org/hc/en-us/requests/new?tf_42243568391700=oss` - **Logged in**: `https://support.comfy.org/hc/en-us/requests/new?tf_42243568391700=ccloud&[email protected]&[email protected]&tf_42515251051412=abc123xyz` ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6586-feat-pre-fill-user-info-in-Zendesk-support-link-2a26d73d36508171b428c634b310f68b) by [Unito](https://www.unito.io) --------- Co-authored-by: Alexander Brown <[email protected]> Co-authored-by: bymyself <[email protected]>
1 parent 8752f1b commit adb15aa

File tree

2 files changed

+43
-11
lines changed

2 files changed

+43
-11
lines changed

src/composables/useCoreCommands.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
12
import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions'
23
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
34
import { useModelSelectorDialog } from '@/composables/useModelSelectorDialog'
@@ -20,7 +21,7 @@ import { useAssetBrowserDialog } from '@/platform/assets/composables/useAssetBro
2021
import { createModelNodeFromAsset } from '@/platform/assets/utils/createModelNodeFromAsset'
2122
import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription'
2223
import { useSettingStore } from '@/platform/settings/settingStore'
23-
import { SUPPORT_URL } from '@/platform/support/config'
24+
import { buildSupportUrl } from '@/platform/support/config'
2425
import { useTelemetry } from '@/platform/telemetry'
2526
import type { ExecutionTriggerSource } from '@/platform/telemetry/types'
2627
import { useToastStore } from '@/platform/updates/common/toastStore'
@@ -840,7 +841,12 @@ export function useCoreCommands(): ComfyCommand[] {
840841
label: 'Contact Support',
841842
versionAdded: '1.17.8',
842843
function: () => {
843-
window.open(SUPPORT_URL, '_blank')
844+
const { userEmail, resolvedUserInfo } = useCurrentUser()
845+
const supportUrl = buildSupportUrl({
846+
userEmail: userEmail.value,
847+
userId: resolvedUserInfo.value?.id
848+
})
849+
window.open(supportUrl, '_blank')
844850
}
845851
},
846852
{

src/platform/support/config.ts

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,43 @@
11
import { isCloud } from '@/platform/distribution/types'
22

33
/**
4-
* Zendesk ticket form field ID for the distribution tag.
5-
* This field is used to categorize support requests by their source (cloud vs OSS).
4+
* Zendesk ticket form field IDs.
65
*/
7-
const DISTRIBUTION_FIELD_ID = 'tf_42243568391700'
6+
const ZENDESK_FIELDS = {
7+
/** Distribution tag (cloud vs OSS) */
8+
DISTRIBUTION: 'tf_42243568391700',
9+
/** User email (anonymous requester) */
10+
ANONYMOUS_EMAIL: 'tf_anonymous_requester_email',
11+
/** User email (authenticated) */
12+
EMAIL: 'tf_40029135130388',
13+
/** User ID */
14+
USER_ID: 'tf_42515251051412'
15+
} as const
16+
17+
const SUPPORT_BASE_URL = 'https://support.comfy.org/hc/en-us/requests/new'
818

919
/**
10-
* Support URLs for the ComfyUI platform.
11-
* The URL varies based on whether the application is running in Cloud or OSS distribution.
20+
* Builds the support URL with optional user information for pre-filling.
21+
* Users without login information will still get a valid support URL without pre-fill.
1222
*
13-
* - Cloud: Includes 'ccloud' tag for identifying cloud-based support requests
14-
* - OSS: Includes 'oss' tag for identifying open-source support requests
23+
* @param params - User information to pre-fill in the support form
24+
* @returns Complete Zendesk support URL with query parameters
1525
*/
16-
const TAG = isCloud ? 'ccloud' : 'oss'
17-
export const SUPPORT_URL = `https://support.comfy.org/hc/en-us/requests/new?${DISTRIBUTION_FIELD_ID}=${TAG}`
26+
export function buildSupportUrl(params?: {
27+
userEmail?: string | null
28+
userId?: string | null
29+
}): string {
30+
const searchParams = new URLSearchParams({
31+
[ZENDESK_FIELDS.DISTRIBUTION]: isCloud ? 'ccloud' : 'oss'
32+
})
33+
34+
if (params?.userEmail) {
35+
searchParams.append(ZENDESK_FIELDS.ANONYMOUS_EMAIL, params.userEmail)
36+
searchParams.append(ZENDESK_FIELDS.EMAIL, params.userEmail)
37+
}
38+
if (params?.userId) {
39+
searchParams.append(ZENDESK_FIELDS.USER_ID, params.userId)
40+
}
41+
42+
return `${SUPPORT_BASE_URL}?${searchParams.toString()}`
43+
}

0 commit comments

Comments
 (0)