Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): sync zendesk from profile query (#40473)

yyh668fb4c14a22
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a142f579fed..d2104938791 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -426,9 +426,6 @@ catalogs:
jotai:
specifier: 2.20.2
version: 2.20.2
- jotai-effect:
- specifier: 2.4.1
- version: 2.4.1
jotai-scope:
specifier: 0.11.0
version: 0.11.0
@@ -1341,9 +1338,6 @@ importers:
jotai:
specifier: 'catalog:'
- jotai-effect:
- specifier: 'catalog:'
jotai-scope:
specifier: 'catalog:'
@@ -6772,12 +6766,6 @@ packages:
resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}
hasBin: true
- resolution: {integrity: sha512-wptUnVOEeU8SkBA+sKGzXGnR3rbSfXLXrRxcj5QF3ukxH7CUbo5hoO2iMwUzsJSYaZM804ZpPoAxUY9nmksu8w==}
- engines: {node: '>=12.20.0'}
- peerDependencies:
- jotai: '>=2.20.0 || >=3.0.0-alpha.0'
-
resolution: {integrity: sha512-ofiW0Z0i3lTw509Gx0+T6fqsDPMDxMn+AHmNs9iF9OA8CmK1/0xRprPxuZ89UZdBzt6jcrTYdunNZSF2255zJQ==}
engines: {node: '>=14.0.0'}
@@ -10009,7 +9997,7 @@ snapshots:
'@eslint/core': 1.2.1
'@eslint/plugin-kit': 0.7.2
github-slugger: 2.0.0
- mdast-util-from-markdown: 2.0.3([email protected])
+ mdast-util-from-markdown: 2.0.3([email protected])
mdast-util-frontmatter: 2.0.1([email protected])
mdast-util-gfm: 3.1.0([email protected])
mdast-util-math: 3.0.0([email protected])
@@ -14711,10 +14699,6 @@ snapshots:
- dependencies:
-
dependencies:
@@ -15047,23 +15031,6 @@ snapshots:
unist-util-is: 6.0.1
unist-util-visit-parents: 6.0.2
- dependencies:
- '@types/mdast': 4.0.4
- '@types/unist': 3.0.3
- decode-named-character-reference: 1.3.0
- devlop: 1.1.0
- mdast-util-to-string: 4.0.0
- micromark: 4.0.2([email protected])
- micromark-util-decode-numeric-character-reference: 2.0.2
- micromark-util-decode-string: 2.0.1
- micromark-util-normalize-identifier: 2.0.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
- unist-util-stringify-position: 4.0.0
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@types/mdast': 4.0.4
@@ -15554,28 +15521,6 @@ snapshots:
- dependencies:
- '@types/debug': 4.1.13
- debug: 4.4.3([email protected])
- decode-named-character-reference: 1.3.0
- devlop: 1.1.0
- micromark-core-commonmark: 2.0.3
- micromark-factory-space: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-chunked: 2.0.1
- micromark-util-combine-extensions: 2.0.1
- micromark-util-decode-numeric-character-reference: 2.0.2
- micromark-util-encode: 2.0.1
- micromark-util-normalize-identifier: 2.0.1
- micromark-util-resolve-all: 2.0.1
- micromark-util-sanitize-uri: 2.0.1
- micromark-util-subtokenize: 2.1.0
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@types/debug': 4.1.13
@@ -18025,7 +17970,6 @@ time:
[email protected]: '2026-07-09T13:42:14.596Z'
[email protected]: '2026-04-20T06:18:25.132Z'
[email protected]: '2026-08-05T19:25:04.961Z'
- [email protected]: '2026-07-20T23:14:54.605Z'
[email protected]: '2026-05-13T18:43:15.331Z'
[email protected]: '2025-08-01T02:55:49.826Z'
[email protected]: '2026-07-14T13:52:11.083Z'
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 8e105591abe..3517b184dcb 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -191,7 +191,6 @@ catalog:
iconify-import-svg: 0.2.0
immer: 11.1.16
jotai: 2.20.2
- jotai-effect: 2.4.1
jotai-scope: 0.11.0
jotai-tanstack-query: 0.11.0
js-cookie: 3.0.8
diff --git a/web/app/(commonLayout)/external-service-sync.tsx b/web/app/(commonLayout)/external-service-sync.tsx
index 409e03d9231..05f37a2f5d4 100644
--- a/web/app/(commonLayout)/external-service-sync.tsx
+++ b/web/app/(commonLayout)/external-service-sync.tsx
@@ -1,17 +1,21 @@
'use client'
import type { GetAccountProfileResponse } from '@dify/contracts/api/console/account/types.gen'
+import type { DeploymentEdition } from '@dify/contracts/api/console/system-features/types.gen'
import type { GetWorkspacesCurrentSummaryResponse } from '@dify/contracts/api/console/workspaces/types.gen'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
-import { useEffect, useRef } from 'react'
+import { Fragment, useEffect, useRef } from 'react'
import { setUserId, setUserProperties } from '@/app/components/base/amplitude'
import { flushRegistrationSuccess } from '@/app/components/base/amplitude/registration-tracking'
import { useAmplitudeInitialized } from '@/app/components/base/amplitude/use-amplitude-initialized'
import { useAnalyticsConsent } from '@/app/components/base/analytics-consent/consent-store'
+import { setZendeskConversationFields } from '@/app/components/base/zendesk/utils'
+import { ZENDESK_FIELD_IDS } from '@/config'
+import { langGeniusVersionInfoAtom } from '@/context/version-state'
import { currentWorkspaceAtom } from '@/context/workspace-state'
-import { zendeskConversationSyncAtom } from '@/context/zendesk-conversation-sync'
import { userProfileQueryOptions } from '@/features/account-profile/client'
+import { deploymentEditionAtom } from '@/features/system-features/state'
type AmplitudeProperties = Record<string, string | number | boolean>
@@ -69,10 +73,104 @@ function AmplitudeIdentitySync() {
return null
}
+type ZendeskSyncState = {
+ email?: string
+ environment?: string
+ version?: string
+ workspaceId?: string
+}
+
+function syncZendeskField({
+ fieldId,
+ deploymentEdition,
+ previousValue,
+ setNextValue,
+ value,
+}: {
+ fieldId: string | undefined
+ deploymentEdition: DeploymentEdition
+ previousValue: string | undefined
+ setNextValue: (value: string) => void
+ value: string
+}) {
+ if (deploymentEdition !== 'CLOUD' || !fieldId || !value || value === previousValue) return
+
+ setZendeskConversationFields(
+ [
+ {
+ id: fieldId,
+ value,
+ },
+ ],
+ deploymentEdition,
+ )
+ setNextValue(value)
+}
+
+function ZendeskConversationSync() {
+ const { data: userProfile } = useSuspenseQuery({
+ ...userProfileQueryOptions(),
+ select: (data) => data.profile,
+ })
+ const currentWorkspace = useAtomValue(currentWorkspaceAtom)
+ const langGeniusVersionInfo = useAtomValue(langGeniusVersionInfoAtom)
+ const deploymentEdition = useAtomValue(deploymentEditionAtom)
+ const syncStateRef = useRef<ZendeskSyncState>({})
+
+ useEffect(() => {
+ const nextState = { ...syncStateRef.current }
+
+ syncZendeskField({
+ fieldId: ZENDESK_FIELD_IDS.ENVIRONMENT,
+ deploymentEdition,
+ value: langGeniusVersionInfo.current_env.toLowerCase(),
+ previousValue: syncStateRef.current.environment,
+ setNextValue: (value) => {
+ nextState.environment = value
+ },
+ })
+ syncZendeskField({
+ fieldId: ZENDESK_FIELD_IDS.VERSION,
+ deploymentEdition,
+ value: langGeniusVersionInfo.version,
+ previousValue: syncStateRef.current.version,
+ setNextValue: (value) => {
+ nextState.version = value
+ },
+ })
+ syncZendeskField({
+ fieldId: ZENDESK_FIELD_IDS.EMAIL,
+ deploymentEdition,
+ value: userProfile.email,
+ previousValue: syncStateRef.current.email,
+ setNextValue: (value) => {
+ nextState.email = value
+ },
+ })
+ syncZendeskField({
+ fieldId: ZENDESK_FIELD_IDS.WORKSPACE_ID,
+ deploymentEdition,
+ value: currentWorkspace.id,
+ previousValue: syncStateRef.current.workspaceId,
+ setNextValue: (value) => {
+ nextState.workspaceId = value
+ },
+ })
+
+ syncStateRef.current = nextState
+ }, [currentWorkspace.id, deploymentEdition, langGeniusVersionInfo, userProfile.email])
+
+ return null
+}
+
export function ExternalServiceSync() {
const analyticsConsent = useAnalyticsConsent()
const amplitudeInitialized = useAmplitudeInitialized()
- useAtomValue(zendeskConversationSyncAtom)
- return analyticsConsent === 'granted' && amplitudeInitialized ? <AmplitudeIdentitySync /> : null
+ return (
+ <Fragment>
+ <ZendeskConversationSync />
+ {analyticsConsent === 'granted' && amplitudeInitialized && <AmplitudeIdentitySync />}
+ </Fragment>
+ )
}
diff --git a/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx b/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx
index 556b9c44bd1..3b8b116c0d0 100644
--- a/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx
+++ b/web/app/components/app-sidebar/__tests__/app-detail-section.spec.tsx
@@ -37,10 +37,6 @@ vi.mock('@/app/components/app/store', () => ({
}),
}))
-vi.mock('@/context/account-state', async () => {
- const { createAccountStateModuleMock } = await import('@/test/console/state-fixture')
- return createAccountStateModuleMock(() => mockConsoleState.current)
-})
vi.mock('@/context/permission-state', async () => {
const { createPermissionStateModuleMock } = await import('@/test/console/state-fixture')
return createPermissionStateModuleMock(() => mockConsoleState.current)
diff --git a/web/app/components/app-sidebar/__tests__/dataset-detail-section.spec.tsx b/web/app/components/app-sidebar/__tests__/dataset-detail-section.spec.tsx
index 8cf4eb5db27..ce2543c9e21 100644
--- a/web/app/components/app-sidebar/__tests__/dataset-detail-section.spec.tsx
+++ b/web/app/components/app-sidebar/__tests__/dataset-detail-section.spec.tsx
@@ -26,10 +26,6 @@ vi.mock('@/next/navigation', () => ({
usePathname: () => mockPathname,
}))
-vi.mock('@/context/account-state', async () => {
- const { createAccountStateModuleMock } = await import('@/test/console/state-fixture')
- return createAccountStateModuleMock(() => mockConsoleState.current)
-})
vi.mock('@/context/permission-state', async () => {
const { createPermissionStateModuleMock } = await import('@/test/console/state-fixture')
return createPermissionStateModuleMock(() => mockConsoleState.current)
diff --git a/web/app/components/custom/custom-web-app-brand/hooks/__tests__/use-web-app-brand.spec.tsx b/web/app/components/custom/custom-web-app-brand/hooks/__tests__/use-web-app-brand.spec.tsx
index a9f8cc4e0fc..4068ab31955 100644
--- a/web/app/components/custom/custom-web-app-brand/hooks/__tests__/use-web-app-brand.spec.tsx
+++ b/web/app/components/custom/custom-web-app-brand/hooks/__tests__/use-web-app-brand.spec.tsx
@@ -100,13 +100,6 @@ vi.mock('@/service/client', async (importOriginal) => {
consoleQuery,
}
})
-vi.mock('@/context/account-state', async () => {
- const { createAccountStateModuleMock } = await import('@/test/console/state-fixture')
- return createAccountStateModuleMock(() => ({
- ...consoleStateRef.value,
- refreshCurrentWorkspace: consoleStateRef.value?.refreshCurrentWorkspace,
- }))
-})
vi.mock('@/context/workspace-state', async () => {
const { createWorkspaceStateModuleMock } = await import('@/test/console/state-fixture')
return createWorkspaceStateModuleMock(() => ({
diff --git a/web/app/components/main-nav/__tests__/index.spec.tsx b/web/app/components/main-nav/__tests__/index.spec.tsx
index 91698cdbedc..ba4866781d1 100644
--- a/web/app/components/main-nav/__tests__/index.spec.tsx
+++ b/web/app/components/main-nav/__tests__/index.spec.tsx
@@ -168,10 +168,6 @@ vi.mock('@/app/components/base/amplitude', () => ({
trackEvent: mockTrackEvent,
}))
-vi.mock('@/context/account-state', async () => {
- const { createAccountStateModuleMock } = await import('@/test/console/state-fixture')
- return createAccountStateModuleMock(() => mockConsoleState.current ?? {})
-})
vi.mock('@/context/workspace-state', async () => {
const { createWorkspaceStateModuleMock } = await import('@/test/console/state-fixture')
return createWorkspaceStateModuleMock(() => mockConsoleState.current ?? {})
diff --git a/web/app/components/main-nav/components/__tests__/workspace-card.spec.tsx b/web/app/components/main-nav/components/__tests__/workspace-card.spec.tsx
index aad653a814c..132c289bd84 100644
--- a/web/app/components/main-nav/components/__tests__/workspace-card.spec.tsx
+++ b/web/app/components/main-nav/components/__tests__/workspace-card.spec.tsx
@@ -40,10 +40,6 @@ vi.mock('@/context/provider-context', () => ({
useProviderContext: vi.fn(),
}))
-vi.mock('@/context/account-state', async () => {
- const { createAccountStateModuleMock } = await import('@/test/console/state-fixture')
- return createAccountStateModuleMock(() => mockConsoleState.current)
-})
vi.mock('@/context/permission-state', async () => {
const { createPermissionStateModuleMock } = await import('@/test/console/state-fixture')
return createPermissionStateModuleMock(() => mockConsoleState.current)
diff --git a/web/app/components/snippet-list/__tests__/index.spec.tsx b/web/app/components/snippet-list/__tests__/index.spec.tsx
index ac1e4c16b50..54f49a76d32 100644
--- a/web/app/components/snippet-list/__tests__/index.spec.tsx
+++ b/web/app/components/snippet-list/__tests__/index.spec.tsx
@@ -80,15 +80,6 @@ const mockIsCurrentWorkspaceEditor = vi.fn(() => true)
const mockIsCurrentWorkspaceDatasetOperator = vi.fn(() => false)
const mockWorkspacePermissionKeys = vi.fn(() => ['snippets.create_and_modify'])
-vi.mock('@/context/account-state', async () => {
- const { createAccountStateModuleMock } = await import('@/test/console/state-fixture')
- return createAccountStateModuleMock(() => ({
- userProfile: { id: 'creator-1' },
- currentWorkspace: { id: 'workspace-1' },
- isLoadingCurrentWorkspace: false,
- workspacePermissionKeys: mockWorkspacePermissionKeys(),
- }))
-})
vi.mock('@/context/workspace-state', async () => {
const { createWorkspaceStateModuleMock } = await import('@/test/console/state-fixture')
return createWorkspaceStateModuleMock(() => ({
diff --git a/web/context/__tests__/console-bootstrap.spec.tsx b/web/context/__tests__/console-bootstrap.spec.tsx
index 58dfc291a5d..4ce31543eca 100644
--- a/web/context/__tests__/console-bootstrap.spec.tsx
+++ b/web/context/__tests__/console-bootstrap.spec.tsx
@@ -13,7 +13,6 @@ import { setAnalyticsConsent } from '@/app/components/base/analytics-consent/con
import { setZendeskConversationFields } from '@/app/components/base/zendesk/utils'
import { ZENDESK_FIELD_IDS } from '@/config'
import { createSystemFeaturesFixture } from '@/test/console/system-features'
-import { userProfileAtom } from '../account-state'
import { initialWorkspaceSummary } from '../app-context-defaults'
import {
datasetDefaultPermissionKeysAtom,
@@ -199,7 +198,6 @@ vi.mock('@/app/components/header/maintenance-notice', () => ({
}))
function ConsoleBootstrapProbe() {
- const userProfile = useAtomValue(userProfileAtom)
const currentWorkspace = useAtomValue(currentWorkspaceAtom)
const isCurrentWorkspaceManager = useAtomValue(isCurrentWorkspaceManagerAtom)
const isCurrentWorkspaceOwner = useAtomValue(isCurrentWorkspaceOwnerAtom)
@@ -232,10 +230,6 @@ function ConsoleBootstrapProbe() {
workspace loading:
{String(isLoadingCurrentWorkspace)}
</span>
- <span>
- user:
- {userProfile.email}
- </span>
<span>
workspace:
{currentWorkspace.name}
@@ -377,7 +371,6 @@ describe('Console bootstrap', () => {
it('should provide profile, workspace, permissions, loading state, and version metadata', async () => {
renderConsoleBootstrap()
- expect(await screen.findByText('user:[email protected]')).toBeInTheDocument()
expect(await screen.findByText('workspace:Workspace')).toBeInTheDocument()
expect(await screen.findByText('keys:app.create_and_management')).toBeInTheDocument()
expect(screen.getByText('dataset keys:dataset.acl.edit')).toBeInTheDocument()
@@ -394,8 +387,9 @@ describe('Console bootstrap', () => {
renderConsoleBootstrap()
- expect(await screen.findByText('user:[email protected]')).toBeInTheDocument()
- expect(screen.getByText(`workspace:${initialWorkspaceSummary.name}`)).toBeInTheDocument()
+ expect(
+ await screen.findByText(`workspace:${initialWorkspaceSummary.name}`),
+ ).toBeInTheDocument()
expect(screen.getByText(`role:${initialWorkspaceSummary.role}`)).toBeInTheDocument()
expect(screen.getByText('keys:')).toBeInTheDocument()
expect(screen.getByText('dataset keys:')).toBeInTheDocument()
@@ -525,6 +519,60 @@ describe('Console bootstrap', () => {
})
})
+ it('should not sync Zendesk fields outside cloud deployments', async () => {
+ mockSystemFeaturesState.data = createSystemFeaturesFixture({
+ deployment_edition: 'COMMUNITY',
+ })
+
+ renderConsoleBootstrap()
+
+ await screen.findByText('workspace:Workspace')
+ expect(setZendeskConversationFields).not.toHaveBeenCalled()
+ })
+
+ it('should resync only changed Zendesk fields', async () => {
+ const { queryClient, rerender } = renderConsoleBootstrap()
+
+ await waitFor(() => expect(setZendeskConversationFields).toHaveBeenCalledTimes(4))
+
+ rerender(
+ <JotaiProvider>
+ <QueryClientProvider client={queryClient}>
+ <TestQueryClientHydrator queryClient={queryClient}>
+ <Suspense fallback={<span>loading</span>}>
+ <ExternalServiceSync />
+ <ConsoleBootstrapProbe />
+ </Suspense>
+ </TestQueryClientHydrator>
+ </QueryClientProvider>
+ </JotaiProvider>,
+ )
+ expect(setZendeskConversationFields).toHaveBeenCalledTimes(4)
+
+ act(() => {
+ queryClient.setQueryData(['user-profile'], {
+ ...mockUserProfileResponseState.data,
+ profile: {
+ ...mockUserProfileResponseState.data.profile,
+ email: '[email protected]',
+ },
+ })
+ })
+
+ await waitFor(() => {
+ expect(setZendeskConversationFields).toHaveBeenCalledTimes(5)
+ expect(setZendeskConversationFields).toHaveBeenLastCalledWith(
+ [
+ {
+ id: ZENDESK_FIELD_IDS.EMAIL,
+ value: '[email protected]',
+ },
+ ],
+ 'CLOUD',
+ )
+ })
+ })
+
it('should not sync Amplitude identity when user id is missing', async () => {
mockUserProfileResponseState.data = {
profile: {
@@ -543,7 +591,7 @@ describe('Console bootstrap', () => {
renderConsoleBootstrap()
- await screen.findByText('user:')
+ await screen.findByText('workspace:Workspace')
expect(setUserId).not.toHaveBeenCalled()
expect(setUserProperties).not.toHaveBeenCalled()
expect(flushRegistrationSuccess).not.toHaveBeenCalled()
@@ -553,7 +601,7 @@ describe('Console bootstrap', () => {
setAnalyticsConsent('denied')
renderConsoleBootstrap()
- await screen.findByText('user:[email protected]')
+ await screen.findByText('workspace:Workspace')
expect(setUserId).not.toHaveBeenCalled()
expect(setUserProperties).not.toHaveBeenCalled()
diff --git a/web/context/account-state.ts b/web/context/account-state.ts
index 7d883ca5fb5..746e7e7f959 100644
--- a/web/context/account-state.ts
+++ b/web/context/account-state.ts
@@ -6,10 +6,6 @@ import { atomWithResolvedSuspenseQuery } from '@/utils/query-atoms'
const accountProfileQueryAtom = atomWithResolvedSuspenseQuery(() => userProfileQueryOptions())
-export const userProfileAtom = atom((get) => {
- return get(accountProfileQueryAtom).data.profile
-})
-
export const accountProfileMetaAtom = atom((get) => {
return get(accountProfileQueryAtom).data.meta
})
diff --git a/web/context/zendesk-conversation-sync.ts b/web/context/zendesk-conversation-sync.ts
deleted file mode 100644
index dfc9a0634d4..00000000000
--- a/web/context/zendesk-conversation-sync.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-'use client'
-
-import type { DeploymentEdition } from '@dify/contracts/api/console/system-features/types.gen'
-import { atom } from 'jotai'
-import { atomEffect } from 'jotai-effect'
-import { setZendeskConversationFields } from '@/app/components/base/zendesk/utils'
-import { ZENDESK_FIELD_IDS } from '@/config'
-import { deploymentEditionAtom } from '@/features/system-features/state'
-import { userProfileAtom } from './account-state'
-import { langGeniusVersionInfoAtom } from './version-state'
-import { currentWorkspaceAtom } from './workspace-state'
-
-type ZendeskSyncState = {
- email?: string
- environment?: string
- version?: string
- workspaceId?: string
-}
-
-const zendeskConversationSyncStateAtom = atom<ZendeskSyncState>({})
-
-function syncZendeskField({
- fieldId,
- deploymentEdition,
- previousValue,
- setNextValue,
- value,
-}: {
- fieldId: string | undefined
- deploymentEdition: DeploymentEdition
- previousValue: string | undefined
- setNextValue: (value: string) => void
- value: string
-}) {
- if (deploymentEdition !== 'CLOUD' || !fieldId || !value || value === previousValue) return false
-
- setZendeskConversationFields(
- [
- {
- id: fieldId,
- value,
- },
- ],
- deploymentEdition,
- )
- setNextValue(value)
-
- return true
-}
-
-export const zendeskConversationSyncAtom = atomEffect((get, set) => {
- const userProfile = get(userProfileAtom)
- const currentWorkspace = get(currentWorkspaceAtom)
- const langGeniusVersionInfo = get(langGeniusVersionInfoAtom)
- const deploymentEdition = get(deploymentEditionAtom)
- const state = get.peek(zendeskConversationSyncStateAtom)
- const nextState = { ...state }
-
- let didSync = false
- didSync =
- syncZendeskField({
- fieldId: ZENDESK_FIELD_IDS.ENVIRONMENT,
- deploymentEdition,
- value: langGeniusVersionInfo.current_env.toLowerCase(),
- previousValue: state.environment,
- setNextValue: (value) => {
- nextState.environment = value
- },
- }) || didSync
- didSync =
- syncZendeskField({
- fieldId: ZENDESK_FIELD_IDS.VERSION,
- deploymentEdition,
- value: langGeniusVersionInfo.version,
- previousValue: state.version,
- setNextValue: (value) => {
- nextState.version = value
- },
- }) || didSync
- didSync =
- syncZendeskField({
- fieldId: ZENDESK_FIELD_IDS.EMAIL,
- deploymentEdition,
- value: userProfile.email,
- previousValue: state.email,
- setNextValue: (value) => {
- nextState.email = value
- },
- }) || didSync
- didSync =
- syncZendeskField({
- fieldId: ZENDESK_FIELD_IDS.WORKSPACE_ID,
- deploymentEdition,
- value: currentWorkspace.id,
- previousValue: state.workspaceId,
- setNextValue: (value) => {
- nextState.workspaceId = value
- },
- }) || didSync
-
- if (didSync) set(zendeskConversationSyncStateAtom, nextState)
-})
diff --git a/web/package.json b/web/package.json
index 29de1656627..a416e30acfb 100644
--- a/web/package.json
+++ b/web/package.json
@@ -94,7 +94,6 @@
"i18next-resources-to-backend": "catalog:",
"immer": "catalog:",
"jotai": "catalog:",
- "jotai-effect": "catalog:",
"jotai-scope": "catalog:",
"jotai-tanstack-form": "workspace:*",
"jotai-tanstack-query": "catalog:",
diff --git a/web/test/console/state-fixture.ts b/web/test/console/state-fixture.ts
index 767280f801a..a689e6f51de 100644
--- a/web/test/console/state-fixture.ts
+++ b/web/test/console/state-fixture.ts
@@ -31,16 +31,7 @@ export type ConsoleStateFixture = {
type ConsoleStateFixtureResolver = () => ConsoleStateFixture
type JotaiStore = ReturnType<typeof createStore>
-type ConsoleStateOwner = 'account' | 'workspace' | 'permission' | 'systemFeatures' | 'version'
-
-const defaultUserProfile = {
- id: 'user-1',
- name: 'User',
- email: '[email protected]',
- avatar: '',
- avatar_url: '',
- is_password_set: true,
-}
+type ConsoleStateOwner = 'workspace' | 'permission' | 'systemFeatures' | 'version'
const defaultCurrentWorkspace = {
id: 'workspace-1',
@@ -58,10 +49,6 @@ const defaultLangGeniusVersionInfo = {
release_notes: '',
} satisfies LangGeniusVersionInfo
-const userProfileAtom = atom(defaultUserProfile)
-const userProfileIdAtom = atom((get) => get(userProfileAtom).id)
-const userProfileEmailAtom = atom((get) => get(userProfileAtom).email)
-const accountProfileMetaAtom = atom({ currentVersion: null, currentEnv: null })
const currentWorkspaceAtom = atom<GetWorkspacesCurrentSummaryResponse>(defaultCurrentWorkspace)
const currentWorkspaceIdAtom = atom((get) => get(currentWorkspaceAtom).id)
const isCurrentWorkspaceManagerAtom = atom(false)
@@ -100,10 +87,6 @@ export const seedRegisteredConsoleStateFixture = (store: JotaiStore) => {
if (!resolvers.length) return false
const state = Object.assign({}, ...resolvers.map((resolve) => resolve()))
- store.set(userProfileAtom, {
- ...defaultUserProfile,
- ...state.userProfile,
- })
store.set(currentWorkspaceAtom, {
...defaultCurrentWorkspace,
...state.currentWorkspace,
@@ -137,21 +120,6 @@ export const seedRegisteredConsoleStateFixture = (store: JotaiStore) => {
return true
}
-export const createAccountStateModuleMock = (getState: ConsoleStateFixtureResolver) => {
- registerConsoleStateFixture('account', () => {
- const state = getState()
- return {
- userProfile: state.userProfile,
- }
- })
- return {
- userProfileAtom,
- userProfileIdAtom,
- userProfileEmailAtom,
- accountProfileMetaAtom,
- }
-}
-
export const createWorkspaceStateModuleMock = (getState: ConsoleStateFixtureResolver) => {
registerConsoleStateFixture('workspace', () => {
const state = getState()