@planningcenter/chat-react-native 4.8.0-qa-staging.8 → 4.8.0-qa-staging.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/build/contexts/session_context.d.ts +0 -1
  2. package/build/contexts/session_context.d.ts.map +1 -1
  3. package/build/contexts/session_context.js.map +1 -1
  4. package/build/utils/theme.js +20 -21
  5. package/build/utils/theme.js.map +1 -1
  6. package/package.json +3 -3
  7. package/src/__tests__/contexts/session_context.tsx +19 -39
  8. package/src/__tests__/hooks/useTheme.tsx +0 -7
  9. package/src/__tests__/hooks/use_async_storage.test.tsx +1 -87
  10. package/src/__tests__/hooks/use_attachment_uploader.test.tsx +0 -11
  11. package/src/__tests__/hooks/use_font_scale.test.ts +0 -25
  12. package/src/__tests__/utils/cache/page_mutations.ts +3 -68
  13. package/src/__tests__/utils/client.ts +6 -15
  14. package/src/__tests__/utils/native_adapters/configuration.ts +15 -50
  15. package/src/__tests__/utils/parse_simple_markdown.ts +0 -6
  16. package/src/__tests__/utils/session.ts +0 -11
  17. package/src/__tests__/utils/theme.ts +0 -17
  18. package/src/components/conversations/__tests__/conversations.test.tsx +4 -1
  19. package/src/components/display/__tests__/filter_dropdown.test.tsx +1 -19
  20. package/src/components/display/__tests__/icon_tile.test.tsx +24 -7
  21. package/src/components/page/__tests__/component_error_boundary.test.tsx +0 -12
  22. package/src/contexts/session_context.tsx +0 -1
  23. package/src/hooks/__tests__/jolt_refresh_throttling.test.tsx +0 -35
  24. package/src/screens/__tests__/conversation_details_screen.test.tsx +0 -19
  25. package/src/screens/avatar_picker/__tests__/avatar_picker_state.test.ts +0 -14
  26. package/src/screens/conversations/__tests__/conversations_screen.test.tsx +0 -6
  27. package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +0 -8
  28. package/src/screens/conversations/components/__tests__/search_list_header_component.test.tsx +0 -10
  29. package/src/screens/search/components/__tests__/search_results_list.test.tsx +1 -0
  30. package/src/utils/__tests__/attachment_kind.test.ts +0 -4
  31. package/src/utils/__tests__/convert_attachments_for_create.test.ts +0 -28
  32. package/src/utils/__tests__/is_input_editable.test.ts +1 -2
  33. package/src/utils/__tests__/message_text.test.ts +0 -5
  34. package/src/utils/__tests__/session_manager.test.ts +0 -83
  35. package/src/utils/__tests__/sha_256.test.ts +0 -34
  36. package/src/utils/__tests__/uri.test.ts +51 -0
  37. package/src/utils/theme.ts +20 -21
  38. package/src/__tests__/event-polyfill.test.ts +0 -313
  39. package/src/__tests__/index.tsx +0 -5
  40. package/src/__tests__/jest.ts +0 -11
  41. package/src/__tests__/utils/uri.ts +0 -65
  42. package/src/components/display/__tests__/version_footer.test.tsx +0 -48
  43. package/src/screens/search/components/__tests__/search_blank_states.test.tsx +0 -20
  44. package/src/utils/__tests__/membership_sync_info_text.test.ts +0 -15
@@ -35,7 +35,6 @@ export type SessionContextConfig = {
35
35
  retryText?: string;
36
36
  logoutText?: string;
37
37
  };
38
- defaultEnv?: ENV;
39
38
  };
40
39
  export declare function SessionContextProvider({ children, queryClient, config, }: PropsWithChildren<{
41
40
  queryClient: QueryClient;
@@ -1 +1 @@
1
- {"version":3,"file":"session_context.d.ts","sourceRoot":"","sources":["../../src/contexts/session_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,EAEZ,iBAAiB,EAKlB,MAAM,OAAO,CAAA;AAMd,OAAO,EAAyB,cAAc,EAAE,UAAU,EAAwB,MAAM,UAAU,CAAA;AAElG,OAAO,EAAE,GAAG,EAAgB,OAAO,EAA8B,MAAM,UAAU,CAAA;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AAKzE,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAEtC,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,GAAG,CAAA;IACR,MAA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CAAA;IAG7B,cAAc,EAAE,CAAC,MAAM,EAAE;QACvB,aAAa,EAAE,MAAM,CAAA;QACrB,GAAG,EAAE,GAAG,CAAA;QACR,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;IACzB,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAGpC,WAAW,CAAC,EAAE;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAC1B,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF,CAAA;AAgCD,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,WAAW,EACX,MAAM,GACP,EAAE,iBAAiB,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAAC,2CAiN/E"}
@@ -1 +1 @@
1
- {"version":3,"file":"session_context.js","names":["useMutation","React","createContext","useCallback","useEffect","useMemo","useState","Alert","currentPersonQueryKey","organizationRequestArgs","useStorage","getRequestQueryKey","Session","UNAUTHENTICATED_SESSION_ID","SessionManager","cancelThrottledRefreshes","chatQueryClient","jsx","_jsx","SessionContext","env","setEnv","session","sessions","token","undefined","handleUnauthorizedResponse","logout","setToken","switchSession","createSession","Promise","resolve","decorateSession","isAuthenticated","data","personData","fetchQuery","queryKey","organizationData","name","avatar","id","setPerson","type","setOrganization","SessionContextProvider","t0","$","_c","children","queryClient","config","secureStorage","refreshTokenFn","onLogout","storageKeys","t1","alertConfig","t2","t3","t4","sessionsKey","managerString","setManagerString","t5","hydrate","sessionManager","currentSession","alertShown","setAlertShown","t6","refresh_token","t7","mutate","refreshToken","isPending","isRefreshingToken","isError","isRefreshError","mutationKey","mutationFn","reject","Error","prototypeName","then","handleTokenUpdate","onError","t","handleRefreshFailed","t8","clear","handleClearQueryClient","t9","_env","_prototypeName","updatedManager","sameEnvironment","productionEnvironments","switchingToDevelopment","includes","switchingToProduction","switchingPrototype","newSession","upsertSession","toString","handleSetEnv","t10","session_0","updatedManager_0","currentSessionId","handleCreateSession","t11","sessionId","updatedManager_1","t12","alert","handleSwitchSession","manager","removeSession","handleLogout","t13","t_0","updatedManager_2","updateCurrentToken","t14","t_1","status","errors","t15","isForcedLogout","some","_temp","response","t16","errors_0","isUnauthorized","_temp2","isForcedLogout_0","_temp3","isExpiredToken","_temp4","t17","sessionContextValue","alertTitle","title","alertMessage","message","retryText","logoutText","t18","text","onPress","t19","t20","t21","t22","manager_0","decoratedSession","t23","Provider","e_2","test","e","detail","e_1","e_0"],"sources":["../../src/contexts/session_context.tsx"],"sourcesContent":["import { QueryClient, useMutation } from '@tanstack/react-query'\nimport React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport { Alert } from 'react-native'\nimport { currentPersonQueryKey } from '../hooks/use_current_person'\nimport { organizationRequestArgs } from '../hooks/use_organization'\nimport { useStorage } from '../hooks/use_storage'\nimport { getRequestQueryKey } from '../hooks/use_suspense_api'\nimport { CurrentPersonResource, FailedResponse, OAuthToken, OrganizationResource } from '../types'\nimport { ApiResource } from '../types/api_primitives'\nimport { ENV, PartialToken, Session, UNAUTHENTICATED_SESSION_ID } from '../utils'\nimport { StorageAdapter } from '../utils/native_adapters/storage_adapter'\nimport { SessionManager } from '../utils/session_manager'\nimport { cancelThrottledRefreshes } from '../utils/throttled_refresh'\nimport { chatQueryClient } from './api_provider'\n\ntype Sessions = Record<string, string> // Key is session ID\n\nexport type SessionContextValue = {\n env: ENV\n setEnv: (_env: ENV, _prototypeName?: string) => void\n session: Session\n sessions: Sessions\n token: OAuthToken | undefined\n handleUnauthorizedResponse: (_response: FailedResponse) => void\n logout: () => void\n setToken: (_token: OAuthToken) => void\n switchSession: (_sessionId: string) => void\n createSession: (_session: Session) => Promise<void>\n}\n\nexport const SessionContext = createContext<SessionContextValue>({\n env: 'production',\n setEnv: () => null,\n session: new Session(),\n sessions: {},\n token: undefined,\n handleUnauthorizedResponse: () => null,\n logout: () => null,\n setToken: () => null,\n switchSession: () => null,\n createSession: () => Promise.resolve(),\n})\n\nexport type SessionContextConfig = {\n // Storage adapters\n secureStorage: StorageAdapter // For sensitive data (tokens/sessions)\n\n // Functional callbacks\n refreshTokenFn: (params: {\n refresh_token: string\n env: ENV\n prototypeName?: string\n }) => Promise<OAuthToken>\n onLogout: () => void | Promise<void>\n\n // Optional configuration\n storageKeys?: {\n sessions?: string\n currentSessionId?: string\n }\n alertConfig?: {\n title?: string\n message?: string\n retryText?: string\n logoutText?: string\n }\n defaultEnv?: ENV\n}\n\nconst decorateSession = async <T extends PartialToken>(session: Session<T>) => {\n if (!session.isAuthenticated) return session\n\n const { data: personData } = await chatQueryClient.fetchQuery<ApiResource<CurrentPersonResource>>(\n {\n queryKey: currentPersonQueryKey,\n }\n )\n const { data: organizationData } = await chatQueryClient.fetchQuery<\n ApiResource<OrganizationResource>\n >({\n queryKey: getRequestQueryKey(organizationRequestArgs),\n })\n\n if (personData) {\n const { name, avatar, id } = personData || {}\n session.setPerson({ id, type: 'Person', name, avatar })\n }\n\n if (organizationData) {\n session.setOrganization({\n id: organizationData.id,\n type: 'Organization',\n name: organizationData.name,\n })\n }\n\n return session\n}\n\nexport function SessionContextProvider({\n children,\n queryClient,\n config,\n}: PropsWithChildren<{ queryClient: QueryClient; config: SessionContextConfig }>) {\n const { secureStorage, refreshTokenFn, onLogout, storageKeys = {}, alertConfig = {} } = config\n\n const sessionsKey = storageKeys.sessions || 'sessions-storage'\n const [managerString, setManagerString] = useStorage<string>(secureStorage, sessionsKey, '')\n const sessionManager = useMemo(() => SessionManager.hydrate(managerString), [managerString])\n\n const sessions = sessionManager.sessions\n const currentSession = sessionManager.currentSession\n\n const [alertShown, setAlertShown] = useState(false)\n\n const { token } = currentSession\n\n const {\n mutate: refreshToken,\n isPending: isRefreshingToken,\n isError: isRefreshError,\n } = useMutation({\n mutationKey: ['refresh-token', token?.refresh_token],\n mutationFn: () => {\n if (!token?.refresh_token) {\n return Promise.reject(new Error('Refresh token is required'))\n }\n return refreshTokenFn({\n refresh_token: token.refresh_token,\n env: currentSession.env,\n prototypeName: currentSession.prototypeName,\n }).then(handleTokenUpdate)\n },\n onError: (t: Partial<FailedResponse>) => {\n handleRefreshFailed(t)\n },\n })\n\n const handleClearQueryClient = useCallback(() => {\n cancelThrottledRefreshes(chatQueryClient)\n cancelThrottledRefreshes(queryClient)\n chatQueryClient.clear()\n queryClient.clear()\n }, [queryClient])\n\n const handleSetEnv = useCallback(\n async (_env: ENV, _prototypeName?: string) => {\n const updatedManager = SessionManager.hydrate(managerString)\n const session = updatedManager.currentSession\n const sameEnvironment = _env === session.env && _prototypeName === session.prototypeName\n if (sameEnvironment) return\n\n const productionEnvironments = ['production', 'staging']\n const switchingToDevelopment =\n _env === 'development' && productionEnvironments.includes(session.env)\n const switchingToProduction = _env === 'production' && session.env === 'development'\n const switchingPrototype = _env === 'prototype' || session.env === 'prototype'\n\n if (switchingToDevelopment || switchingToProduction || switchingPrototype) {\n const newSession = new Session({ env: _env, prototypeName: _prototypeName })\n updatedManager.upsertSession(newSession)\n }\n\n updatedManager.setEnv(_env, _prototypeName)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleCreateSession = useCallback(\n async (session: Session) => {\n const updatedManager = SessionManager.hydrate(managerString)\n updatedManager.sessions[session.id] = session.toString()\n updatedManager.currentSessionId = session.id\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleSwitchSession = useCallback(\n async (sessionId: string) => {\n const updatedManager = SessionManager.hydrate(managerString)\n try {\n updatedManager.switchSession(sessionId)\n } catch (_error) {\n Alert.alert('Error', 'Session is not authenticated')\n }\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleLogout = useCallback(async () => {\n handleClearQueryClient()\n const manager = SessionManager.hydrate(managerString)\n\n // Clear the current session ID\n if (manager.currentSessionId) {\n manager.removeSession(manager.currentSessionId)\n await setManagerString(manager.toString())\n }\n\n return onLogout()\n }, [managerString, setManagerString, handleClearQueryClient, onLogout])\n\n const handleTokenUpdate = useCallback(\n async (t: OAuthToken) => {\n const updatedManager = SessionManager.hydrate(managerString)\n\n updatedManager.updateCurrentToken(t)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleRefreshFailed = useCallback(\n (t: Partial<FailedResponse>) => {\n if (t.status !== 401) return\n // If we didn't fail because of an unauthorized response ( 401 ),\n // it could be because we were unable to store the token.\n // Do not log out.\n\n const { errors = [] } = t\n // The code for a forced logout is \"capuchin\"\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n\n if (isForcedLogout) {\n handleLogout()\n }\n },\n [handleLogout]\n )\n\n const handleUnauthorizedResponse = useCallback(\n async (response: FailedResponse) => {\n const { errors = [] } = response\n\n const isUnauthorized = errors.some((e: { detail?: string }) =>\n /TRASH_PANDA/i.test(e.detail || '')\n )\n\n if (isUnauthorized) return\n\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n const isExpiredToken = errors.some((e: { detail?: string }) => /baboon/i.test(e.detail || ''))\n\n if (!isRefreshingToken || isExpiredToken || isForcedLogout) {\n refreshToken()\n }\n },\n [refreshToken, isRefreshingToken]\n )\n\n const sessionContextValue: SessionContextValue = {\n env: currentSession.env,\n token: currentSession.token as OAuthToken | undefined,\n session: currentSession,\n sessions,\n logout: handleLogout,\n setToken: handleTokenUpdate,\n handleUnauthorizedResponse,\n setEnv: handleSetEnv,\n switchSession: handleSwitchSession,\n createSession: handleCreateSession,\n }\n\n const alertTitle = alertConfig.title || 'Oops'\n const alertMessage = alertConfig.message || 'Something went wrong with your login!'\n const retryText = alertConfig.retryText || 'Keep trying'\n const logoutText = alertConfig.logoutText || 'Logout'\n\n useEffect(() => {\n if (isRefreshError && !alertShown && token?.refresh_token) {\n setAlertShown(true)\n Alert.alert(alertTitle, alertMessage, [\n {\n text: retryText,\n onPress: () => {\n refreshToken()\n setAlertShown(false)\n },\n },\n { text: logoutText, onPress: () => handleLogout() },\n ])\n }\n }, [\n isRefreshError,\n handleLogout,\n alertShown,\n refreshToken,\n token?.refresh_token,\n alertTitle,\n alertMessage,\n retryText,\n logoutText,\n ])\n\n useEffect(() => {\n const manager = SessionManager.hydrate(managerString)\n if (manager.currentSessionId === UNAUTHENTICATED_SESSION_ID) return\n\n decorateSession(manager.currentSession).then(async decoratedSession => {\n manager.upsertSession(decoratedSession)\n await setManagerString(manager.toString())\n })\n }, [managerString, setManagerString])\n\n return <SessionContext.Provider value={sessionContextValue}>{children}</SessionContext.Provider>\n}\n"],"mappings":";AAAA,SAAsBA,WAAW,QAAQ,uBAAuB;AAChE,OAAOC,KAAK,IACVC,aAAa,EAEbC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,kBAAkB,QAAQ,2BAA2B;AAG9D,SAA4BC,OAAO,EAAEC,0BAA0B,QAAQ,UAAU;AAEjF,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,eAAe,QAAQ,gBAAgB;;AAET;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAevC,OAAO,MAAMC,cAAc,GAAGjB,aAAa,CAAsB;EAC/DkB,GAAG,EAAE,YAAY;EACjBC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClB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a,EAAEC,gBAAgB,CAAC;IAAAhB,CAAA,OAAAe,aAAA;IAAAf,CAAA,OAAAgB,gBAAA;IAAAhB,CAAA,OAAA2G,GAAA;IAAA3G,CAAA,OAAA4G,GAAA;EAAA;IAAAD,GAAA,GAAA3G,CAAA;IAAA4G,GAAA,GAAA5G,CAAA;EAAA;EARpC5C,SAAS,CAACuJ,GAQT,EAAEC,GAAiC,CAAC;EAAA,IAAAG,GAAA;EAAA,IAAA/G,CAAA,SAAAE,QAAA,IAAAF,CAAA,SAAA+F,mBAAA;IAE9BgB,GAAA,gBAAA7I,IAAA,CAAAC,cAAA,CAAA6I,QAAA;MAAgCjB,KAAmB,EAAnBA,mBAAmB;MAAA7F,QAAA,EAAGA;IAAQ,CAA0B,CAAC;IAAAF,CAAA,OAAAE,QAAA;IAAAF,CAAA,OAAA+F,mBAAA;IAAA/F,CAAA,OAAA+G,GAAA;EAAA;IAAAA,GAAA,GAAA/G,CAAA;EAAA;EAAA,OAAzF+G,GAAyF;AAAA;AApN3F,SAAAlB,OAAAoB,GAAA;EAAA,OAqJ8D,SAAS,CAAAC,IAAK,CAACC,GAAC,CAAAC,MAAa,IAAd,EAAc,CAAC;AAAA;AArJ5F,SAAAzB,OAAA0B,GAAA;EAAA,OAmJC,WAAW,CAAAH,IAAK,CAACC,GAAC,CAAAC,MAAa,IAAd,EAAc,CAAC;AAAA;AAnJjC,SAAA3B,OAAA6B,GAAA;EAAA,OA6IC,cAAc,CAAAJ,IAAK,CAACC,GAAC,CAAAC,MAAa,IAAd,EAAc,CAAC;AAAA;AA7IpC,SAAAhC,MAAA+B,CAAA;EAAA,OA8HC,WAAW,CAAAD,IAAK,CAACC,CAAC,CAAAC,MAAa,IAAd,EAAc,CAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"session_context.js","names":["useMutation","React","createContext","useCallback","useEffect","useMemo","useState","Alert","currentPersonQueryKey","organizationRequestArgs","useStorage","getRequestQueryKey","Session","UNAUTHENTICATED_SESSION_ID","SessionManager","cancelThrottledRefreshes","chatQueryClient","jsx","_jsx","SessionContext","env","setEnv","session","sessions","token","undefined","handleUnauthorizedResponse","logout","setToken","switchSession","createSession","Promise","resolve","decorateSession","isAuthenticated","data","personData","fetchQuery","queryKey","organizationData","name","avatar","id","setPerson","type","setOrganization","SessionContextProvider","t0","$","_c","children","queryClient","config","secureStorage","refreshTokenFn","onLogout","storageKeys","t1","alertConfig","t2","t3","t4","sessionsKey","managerString","setManagerString","t5","hydrate","sessionManager","currentSession","alertShown","setAlertShown","t6","refresh_token","t7","mutate","refreshToken","isPending","isRefreshingToken","isError","isRefreshError","mutationKey","mutationFn","reject","Error","prototypeName","then","handleTokenUpdate","onError","t","handleRefreshFailed","t8","clear","handleClearQueryClient","t9","_env","_prototypeName","updatedManager","sameEnvironment","productionEnvironments","switchingToDevelopment","includes","switchingToProduction","switchingPrototype","newSession","upsertSession","toString","handleSetEnv","t10","session_0","updatedManager_0","currentSessionId","handleCreateSession","t11","sessionId","updatedManager_1","t12","alert","handleSwitchSession","manager","removeSession","handleLogout","t13","t_0","updatedManager_2","updateCurrentToken","t14","t_1","status","errors","t15","isForcedLogout","some","_temp","response","t16","errors_0","isUnauthorized","_temp2","isForcedLogout_0","_temp3","isExpiredToken","_temp4","t17","sessionContextValue","alertTitle","title","alertMessage","message","retryText","logoutText","t18","text","onPress","t19","t20","t21","t22","manager_0","decoratedSession","t23","Provider","e_2","test","e","detail","e_1","e_0"],"sources":["../../src/contexts/session_context.tsx"],"sourcesContent":["import { QueryClient, useMutation } from '@tanstack/react-query'\nimport React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport { Alert } from 'react-native'\nimport { currentPersonQueryKey } from '../hooks/use_current_person'\nimport { organizationRequestArgs } from '../hooks/use_organization'\nimport { useStorage } from '../hooks/use_storage'\nimport { getRequestQueryKey } from '../hooks/use_suspense_api'\nimport { CurrentPersonResource, FailedResponse, OAuthToken, OrganizationResource } from '../types'\nimport { ApiResource } from '../types/api_primitives'\nimport { ENV, PartialToken, Session, UNAUTHENTICATED_SESSION_ID } from '../utils'\nimport { StorageAdapter } from '../utils/native_adapters/storage_adapter'\nimport { SessionManager } from '../utils/session_manager'\nimport { cancelThrottledRefreshes } from '../utils/throttled_refresh'\nimport { chatQueryClient } from './api_provider'\n\ntype Sessions = Record<string, string> // Key is session ID\n\nexport type SessionContextValue = {\n env: ENV\n setEnv: (_env: ENV, _prototypeName?: string) => void\n session: Session\n sessions: Sessions\n token: OAuthToken | undefined\n handleUnauthorizedResponse: (_response: FailedResponse) => void\n logout: () => void\n setToken: (_token: OAuthToken) => void\n switchSession: (_sessionId: string) => void\n createSession: (_session: Session) => Promise<void>\n}\n\nexport const SessionContext = createContext<SessionContextValue>({\n env: 'production',\n setEnv: () => null,\n session: new Session(),\n sessions: {},\n token: undefined,\n handleUnauthorizedResponse: () => null,\n logout: () => null,\n setToken: () => null,\n switchSession: () => null,\n createSession: () => Promise.resolve(),\n})\n\nexport type SessionContextConfig = {\n // Storage adapters\n secureStorage: StorageAdapter // For sensitive data (tokens/sessions)\n\n // Functional callbacks\n refreshTokenFn: (params: {\n refresh_token: string\n env: ENV\n prototypeName?: string\n }) => Promise<OAuthToken>\n onLogout: () => void | Promise<void>\n\n // Optional configuration\n storageKeys?: {\n sessions?: string\n currentSessionId?: string\n }\n alertConfig?: {\n title?: string\n message?: string\n retryText?: string\n logoutText?: string\n }\n}\n\nconst decorateSession = async <T extends PartialToken>(session: Session<T>) => {\n if (!session.isAuthenticated) return session\n\n const { data: personData } = await chatQueryClient.fetchQuery<ApiResource<CurrentPersonResource>>(\n {\n queryKey: currentPersonQueryKey,\n }\n )\n const { data: organizationData } = await chatQueryClient.fetchQuery<\n ApiResource<OrganizationResource>\n >({\n queryKey: getRequestQueryKey(organizationRequestArgs),\n })\n\n if (personData) {\n const { name, avatar, id } = personData || {}\n session.setPerson({ id, type: 'Person', name, avatar })\n }\n\n if (organizationData) {\n session.setOrganization({\n id: organizationData.id,\n type: 'Organization',\n name: organizationData.name,\n })\n }\n\n return session\n}\n\nexport function SessionContextProvider({\n children,\n queryClient,\n config,\n}: PropsWithChildren<{ queryClient: QueryClient; config: SessionContextConfig }>) {\n const { secureStorage, refreshTokenFn, onLogout, storageKeys = {}, alertConfig = {} } = config\n\n const sessionsKey = storageKeys.sessions || 'sessions-storage'\n const [managerString, setManagerString] = useStorage<string>(secureStorage, sessionsKey, '')\n const sessionManager = useMemo(() => SessionManager.hydrate(managerString), [managerString])\n\n const sessions = sessionManager.sessions\n const currentSession = sessionManager.currentSession\n\n const [alertShown, setAlertShown] = useState(false)\n\n const { token } = currentSession\n\n const {\n mutate: refreshToken,\n isPending: isRefreshingToken,\n isError: isRefreshError,\n } = useMutation({\n mutationKey: ['refresh-token', token?.refresh_token],\n mutationFn: () => {\n if (!token?.refresh_token) {\n return Promise.reject(new Error('Refresh token is required'))\n }\n return refreshTokenFn({\n refresh_token: token.refresh_token,\n env: currentSession.env,\n prototypeName: currentSession.prototypeName,\n }).then(handleTokenUpdate)\n },\n onError: (t: Partial<FailedResponse>) => {\n handleRefreshFailed(t)\n },\n })\n\n const handleClearQueryClient = useCallback(() => {\n cancelThrottledRefreshes(chatQueryClient)\n cancelThrottledRefreshes(queryClient)\n chatQueryClient.clear()\n queryClient.clear()\n }, [queryClient])\n\n const handleSetEnv = useCallback(\n async (_env: ENV, _prototypeName?: string) => {\n const updatedManager = SessionManager.hydrate(managerString)\n const session = updatedManager.currentSession\n const sameEnvironment = _env === session.env && _prototypeName === session.prototypeName\n if (sameEnvironment) return\n\n const productionEnvironments = ['production', 'staging']\n const switchingToDevelopment =\n _env === 'development' && productionEnvironments.includes(session.env)\n const switchingToProduction = _env === 'production' && session.env === 'development'\n const switchingPrototype = _env === 'prototype' || session.env === 'prototype'\n\n if (switchingToDevelopment || switchingToProduction || switchingPrototype) {\n const newSession = new Session({ env: _env, prototypeName: _prototypeName })\n updatedManager.upsertSession(newSession)\n }\n\n updatedManager.setEnv(_env, _prototypeName)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleCreateSession = useCallback(\n async (session: Session) => {\n const updatedManager = SessionManager.hydrate(managerString)\n updatedManager.sessions[session.id] = session.toString()\n updatedManager.currentSessionId = session.id\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleSwitchSession = useCallback(\n async (sessionId: string) => {\n const updatedManager = SessionManager.hydrate(managerString)\n try {\n updatedManager.switchSession(sessionId)\n } catch (_error) {\n Alert.alert('Error', 'Session is not authenticated')\n }\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleLogout = useCallback(async () => {\n handleClearQueryClient()\n const manager = SessionManager.hydrate(managerString)\n\n // Clear the current session ID\n if (manager.currentSessionId) {\n manager.removeSession(manager.currentSessionId)\n await setManagerString(manager.toString())\n }\n\n return onLogout()\n }, [managerString, setManagerString, handleClearQueryClient, onLogout])\n\n const handleTokenUpdate = useCallback(\n async (t: OAuthToken) => {\n const updatedManager = SessionManager.hydrate(managerString)\n\n updatedManager.updateCurrentToken(t)\n await setManagerString(updatedManager.toString())\n },\n [managerString, setManagerString]\n )\n\n const handleRefreshFailed = useCallback(\n (t: Partial<FailedResponse>) => {\n if (t.status !== 401) return\n // If we didn't fail because of an unauthorized response ( 401 ),\n // it could be because we were unable to store the token.\n // Do not log out.\n\n const { errors = [] } = t\n // The code for a forced logout is \"capuchin\"\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n\n if (isForcedLogout) {\n handleLogout()\n }\n },\n [handleLogout]\n )\n\n const handleUnauthorizedResponse = useCallback(\n async (response: FailedResponse) => {\n const { errors = [] } = response\n\n const isUnauthorized = errors.some((e: { detail?: string }) =>\n /TRASH_PANDA/i.test(e.detail || '')\n )\n\n if (isUnauthorized) return\n\n const isForcedLogout = errors.some((e: { detail?: string }) =>\n /capuchin/i.test(e.detail || '')\n )\n const isExpiredToken = errors.some((e: { detail?: string }) => /baboon/i.test(e.detail || ''))\n\n if (!isRefreshingToken || isExpiredToken || isForcedLogout) {\n refreshToken()\n }\n },\n [refreshToken, isRefreshingToken]\n )\n\n const sessionContextValue: SessionContextValue = {\n env: currentSession.env,\n token: currentSession.token as OAuthToken | undefined,\n session: currentSession,\n sessions,\n logout: handleLogout,\n setToken: handleTokenUpdate,\n handleUnauthorizedResponse,\n setEnv: handleSetEnv,\n switchSession: handleSwitchSession,\n createSession: handleCreateSession,\n }\n\n const alertTitle = alertConfig.title || 'Oops'\n const alertMessage = alertConfig.message || 'Something went wrong with your login!'\n const retryText = alertConfig.retryText || 'Keep trying'\n const logoutText = alertConfig.logoutText || 'Logout'\n\n useEffect(() => {\n if (isRefreshError && !alertShown && token?.refresh_token) {\n setAlertShown(true)\n Alert.alert(alertTitle, alertMessage, [\n {\n text: retryText,\n onPress: () => {\n refreshToken()\n setAlertShown(false)\n },\n },\n { text: logoutText, onPress: () => handleLogout() },\n ])\n }\n }, [\n isRefreshError,\n handleLogout,\n alertShown,\n refreshToken,\n token?.refresh_token,\n alertTitle,\n alertMessage,\n retryText,\n logoutText,\n ])\n\n useEffect(() => {\n const manager = SessionManager.hydrate(managerString)\n if (manager.currentSessionId === UNAUTHENTICATED_SESSION_ID) return\n\n decorateSession(manager.currentSession).then(async decoratedSession => {\n manager.upsertSession(decoratedSession)\n await setManagerString(manager.toString())\n })\n }, [managerString, setManagerString])\n\n return <SessionContext.Provider value={sessionContextValue}>{children}</SessionContext.Provider>\n}\n"],"mappings":";AAAA,SAAsBA,WAAW,QAAQ,uBAAuB;AAChE,OAAOC,KAAK,IACVC,aAAa,EAEbC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AACd,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,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,cAAc,CAAAJ,IAAK,CAACC,GAAC,CAAAC,MAAa,IAAd,EAAc,CAAC;AAAA;AA7IpC,SAAAhC,MAAA+B,CAAA;EAAA,OA8HC,WAAW,CAAAD,IAAK,CAACC,CAAC,CAAAC,MAAa,IAAd,EAAc,CAAC;AAAA","ignoreList":[]}
@@ -63,20 +63,20 @@ const colorsChatLight = {
63
63
  statusErrorText: tokens.textColorStatusError,
64
64
  statusErrorBorder: tokens.borderColorStatusError,
65
65
  statusErrorFill: tokens.fillColorStatusErrorSolid,
66
- statusInfoComposedIcon: tokens.iconColorStatusInfoPrimary,
67
- statusInfoComposedText: tokens.textColorStatusInfo,
66
+ statusInfoComposedIcon: tokens.textColorStatusInfo,
67
+ statusInfoComposedText: tokens.colorNeutral24,
68
68
  statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,
69
- statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimary,
70
- statusSuccessComposedText: tokens.textColorStatusSuccess,
69
+ statusSuccessComposedIcon: tokens.textColorStatusSuccess,
70
+ statusSuccessComposedText: tokens.colorNeutral24,
71
71
  statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,
72
- statusWarningComposedIcon: tokens.iconColorStatusWarningPrimary,
73
- statusWarningComposedText: tokens.textColorStatusWarning,
72
+ statusWarningComposedIcon: tokens.textColorStatusWarning,
73
+ statusWarningComposedText: tokens.colorNeutral24,
74
74
  statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,
75
- statusErrorComposedIcon: tokens.iconColorStatusErrorPrimary,
76
- statusErrorComposedText: tokens.textColorStatusError,
75
+ statusErrorComposedIcon: tokens.textColorStatusError,
76
+ statusErrorComposedText: tokens.colorNeutral24,
77
77
  statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,
78
- statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimary,
79
- statusNeutralComposedText: tokens.textColorStatusNeutral,
78
+ statusNeutralComposedIcon: tokens.textColorStatusNeutral,
79
+ statusNeutralComposedText: tokens.colorNeutral24,
80
80
  statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,
81
81
  borderColorChip: tokens.colorNeutral88,
82
82
  fillColorChip: 'transparent',
@@ -108,21 +108,20 @@ const colorsChatDark = {
108
108
  statusErrorText: tokens.textColorStatusErrorDark,
109
109
  statusErrorBorder: tokens.borderColorStatusErrorDark,
110
110
  statusErrorFill: tokens.fillColorStatusErrorSolidDark,
111
- // Note: CCA inverts composed status colors in dark mode
112
- statusInfoComposedIcon: tokens.iconColorStatusInfoPrimaryDark,
113
- statusInfoComposedText: tokens.textColorStatusInfoDark,
111
+ statusInfoComposedIcon: tokens.textColorStatusInfoDark,
112
+ statusInfoComposedText: tokens.colorNeutral88,
114
113
  statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,
115
- statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimaryDark,
116
- statusSuccessComposedText: tokens.textColorStatusSuccessDark,
114
+ statusSuccessComposedIcon: tokens.textColorStatusSuccessDark,
115
+ statusSuccessComposedText: tokens.colorNeutral88,
117
116
  statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,
118
- statusWarningComposedIcon: tokens.iconColorStatusWarningPrimaryDark,
119
- statusWarningComposedText: tokens.textColorStatusWarningDark,
117
+ statusWarningComposedIcon: tokens.textColorStatusWarningDark,
118
+ statusWarningComposedText: tokens.colorNeutral88,
120
119
  statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,
121
- statusErrorComposedIcon: tokens.iconColorStatusErrorPrimaryDark,
122
- statusErrorComposedText: tokens.textColorStatusErrorDark,
120
+ statusErrorComposedIcon: tokens.textColorStatusErrorDark,
121
+ statusErrorComposedText: tokens.colorNeutral88,
123
122
  statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,
124
- statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimaryDark,
125
- statusNeutralComposedText: tokens.textColorStatusNeutralDark,
123
+ statusNeutralComposedIcon: tokens.textColorStatusNeutralDark,
124
+ statusNeutralComposedText: tokens.colorNeutral88,
126
125
  statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,
127
126
  borderColorChip: tokens.colorNeutral24,
128
127
  fillColorChip: 'transparent',
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","names":["Platform","PlatformColor","aliasTokensColorMap","tokens","defaultTheme","colorScheme","scheme","defaultColors","chatThemeColorMap","colors","button","borderRadius","chip","hslLightnessChipSelected","showBadgeProductLogo","iOSLinkColor","OS","undefined","colorsChatLight","name","androidModalHeaderButtonTextColor","fillColorInteractionDefault","iOSModalHeaderButtonTextColor","buttonStart","buttonEnd","interaction","androidSwitchThumbColor","conversationActionsBackground","colorNeutral100White","testColor","statusInfoIcon","iconColorStatusInfoPrimary","statusInfoText","textColorStatusInfo","statusInfoBorder","borderColorStatusInfo","statusInfoFill","fillColorStatusInfoSolid","statusSuccessIcon","iconColorStatusSuccessPrimary","statusSuccessText","textColorStatusSuccess","statusSuccessBorder","borderColorStatusSuccess","statusSuccessFill","fillColorStatusSuccessSolid","statusWarningIcon","iconColorStatusWarningPrimary","statusWarningText","textColorStatusWarning","statusWarningBorder","borderColorStatusWarning","statusWarningFill","fillColorStatusWarningSolid","statusErrorIcon","iconColorStatusErrorPrimary","statusErrorText","textColorStatusError","statusErrorBorder","borderColorStatusError","statusErrorFill","fillColorStatusErrorSolid","statusInfoComposedIcon","statusInfoComposedText","statusInfoComposedBackground","fillColorStatusInfoGhost","statusSuccessComposedIcon","statusSuccessComposedText","statusSuccessComposedBackground","fillColorStatusSuccessGhost","statusWarningComposedIcon","statusWarningComposedText","statusWarningComposedBackground","fillColorStatusWarningGhost","statusErrorComposedIcon","statusErrorComposedText","statusErrorComposedBackground","fillColorStatusErrorGhost","statusNeutralComposedIcon","iconColorStatusNeutralPrimary","statusNeutralComposedText","textColorStatusNeutral","statusNeutralComposedBackground","fillColorStatusNeutralGhost","borderColorChip","colorNeutral88","fillColorChip","textColorChip","colorNeutral45","colorsChatDark","fillColorInteractionDefaultDark","colorNeutral7","iconColorStatusInfoPrimaryDark","textColorStatusInfoDark","borderColorStatusInfoDark","fillColorStatusInfoSolidDark","iconColorStatusSuccessPrimaryDark","textColorStatusSuccessDark","borderColorStatusSuccessDark","fillColorStatusSuccessSolidDark","iconColorStatusWarningPrimaryDark","textColorStatusWarningDark","borderColorStatusWarningDark","fillColorStatusWarningSolidDark","iconColorStatusErrorPrimaryDark","textColorStatusErrorDark","borderColorStatusErrorDark","fillColorStatusErrorSolidDark","fillColorStatusInfoGhostDark","fillColorStatusSuccessGhostDark","fillColorStatusWarningGhostDark","fillColorStatusErrorGhostDark","iconColorStatusNeutralPrimaryDark","textColorStatusNeutralDark","fillColorStatusNeutralGhostDark","colorNeutral24","colorNeutral68","light","dark"],"sources":["../../src/utils/theme.ts"],"sourcesContent":["import { Platform, PlatformColor } from 'react-native'\nimport type { ColorSchemeName, ColorValue, OpaqueColorValue } from 'react-native'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n chip: {\n hslLightnessChipSelected: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName | null): ChatTheme => {\n const scheme: 'light' | 'dark' = colorScheme === 'dark' ? 'dark' : 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n chip: {\n hslLightnessChipSelected: scheme === 'dark' ? 12 : 92,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n androidSwitchThumbColor: string | undefined\n conversationActionsBackground: string\n testColor: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBorder: string\n statusSuccessFill: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBorder: string\n statusInfoFill: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBorder: string\n statusWarningFill: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBorder: string\n statusErrorFill: string\n statusSuccessComposedIcon: string\n statusSuccessComposedText: string\n statusSuccessComposedBackground: string\n statusInfoComposedIcon: string\n statusInfoComposedText: string\n statusInfoComposedBackground: string\n statusWarningComposedIcon: string\n statusWarningComposedText: string\n statusWarningComposedBackground: string\n statusErrorComposedIcon: string\n statusErrorComposedText: string\n statusErrorComposedBackground: string\n statusNeutralComposedIcon: string\n statusNeutralComposedText: string\n statusNeutralComposedBackground: string\n borderColorChip: string\n fillColorChip: string\n textColorChip: string\n /**\n * Selected-chip colors (border/fill/text). Never assign a static default\n * directly — these stay optional so they always fall back to\n * `colors.interaction` via `??` at the read site. Every current consumer\n * overrides `interaction` at runtime, and a seeded default here could win\n * over that override depending on merge order.\n */\n borderColorChipSelected?: string\n fillColorChipSelected?: string\n textColorChipSelected?: string\n}\n\n// 'link' is an iOS-only semantic color name — constructing it on Android is\n// undefined behavior, so only build it when the code is actually running on iOS\nconst iOSLinkColor = Platform.OS === 'ios' ? PlatformColor('link') : undefined\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral100White,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBorder: tokens.borderColorStatusInfo,\n statusInfoFill: tokens.fillColorStatusInfoSolid,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBorder: tokens.borderColorStatusSuccess,\n statusSuccessFill: tokens.fillColorStatusSuccessSolid,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBorder: tokens.borderColorStatusWarning,\n statusWarningFill: tokens.fillColorStatusWarningSolid,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBorder: tokens.borderColorStatusError,\n statusErrorFill: tokens.fillColorStatusErrorSolid,\n statusInfoComposedIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoComposedText: tokens.textColorStatusInfo,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessComposedText: tokens.textColorStatusSuccess,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningComposedIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningComposedText: tokens.textColorStatusWarning,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,\n statusErrorComposedIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorComposedText: tokens.textColorStatusError,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralComposedText: tokens.textColorStatusNeutral,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,\n borderColorChip: tokens.colorNeutral88,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral45,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral7,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBorder: tokens.borderColorStatusInfoDark,\n statusInfoFill: tokens.fillColorStatusInfoSolidDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBorder: tokens.borderColorStatusSuccessDark,\n statusSuccessFill: tokens.fillColorStatusSuccessSolidDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBorder: tokens.borderColorStatusWarningDark,\n statusWarningFill: tokens.fillColorStatusWarningSolidDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBorder: tokens.borderColorStatusErrorDark,\n statusErrorFill: tokens.fillColorStatusErrorSolidDark,\n\n // Note: CCA inverts composed status colors in dark mode\n statusInfoComposedIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoComposedText: tokens.textColorStatusInfoDark,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessComposedText: tokens.textColorStatusSuccessDark,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningComposedIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningComposedText: tokens.textColorStatusWarningDark,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorComposedIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorComposedText: tokens.textColorStatusErrorDark,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralComposedText: tokens.textColorStatusNeutralDark,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorChip: tokens.colorNeutral24,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral68,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAEtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,MAAM,QAAQ,2BAA2B;;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAAgB;EAC9E,MAAMC,MAAwB,GAAGD,WAAW,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;EAE1E,MAAME,aAAa,GAAG;IACpB,GAAGC,iBAAiB,CAACF,MAAM,CAAC;IAC5B,GAAGJ,mBAAmB,CAACI,MAAM;EAC/B,CAAC;EAED,OAAO;IACLG,MAAM,EAAEF,aAAa;IACrBG,MAAM,EAAE;MACNC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,wBAAwB,EAAEP,MAAM,KAAK,MAAM,GAAG,EAAE,GAAG;IACrD,CAAC;IACDQ,oBAAoB,EAAE,IAAI,CAAE;EAC9B,CAAC;AACH,CAAC;AA4DD;AACA;AACA,MAAMC,YAAY,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGf,aAAa,CAAC,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vE9B,eAAe,EAAEjF,MAAM,CAACgH,cAAc;EACtC7B,aAAa,EAAE,aAAa;EAC5BC,aAAa,EAAEpF,MAAM,CAACiH;AACxB,CAAC;AAED,MAAM5G,iBAAiB,GAAG;EACxB6G,KAAK,EAAEnG,eAAe;EACtBoG,IAAI,EAAE7B;AACR,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"theme.js","names":["Platform","PlatformColor","aliasTokensColorMap","tokens","defaultTheme","colorScheme","scheme","defaultColors","chatThemeColorMap","colors","button","borderRadius","chip","hslLightnessChipSelected","showBadgeProductLogo","iOSLinkColor","OS","undefined","colorsChatLight","name","androidModalHeaderButtonTextColor","fillColorInteractionDefault","iOSModalHeaderButtonTextColor","buttonStart","buttonEnd","interaction","androidSwitchThumbColor","conversationActionsBackground","colorNeutral100White","testColor","statusInfoIcon","iconColorStatusInfoPrimary","statusInfoText","textColorStatusInfo","statusInfoBorder","borderColorStatusInfo","statusInfoFill","fillColorStatusInfoSolid","statusSuccessIcon","iconColorStatusSuccessPrimary","statusSuccessText","textColorStatusSuccess","statusSuccessBorder","borderColorStatusSuccess","statusSuccessFill","fillColorStatusSuccessSolid","statusWarningIcon","iconColorStatusWarningPrimary","statusWarningText","textColorStatusWarning","statusWarningBorder","borderColorStatusWarning","statusWarningFill","fillColorStatusWarningSolid","statusErrorIcon","iconColorStatusErrorPrimary","statusErrorText","textColorStatusError","statusErrorBorder","borderColorStatusError","statusErrorFill","fillColorStatusErrorSolid","statusInfoComposedIcon","statusInfoComposedText","colorNeutral24","statusInfoComposedBackground","fillColorStatusInfoGhost","statusSuccessComposedIcon","statusSuccessComposedText","statusSuccessComposedBackground","fillColorStatusSuccessGhost","statusWarningComposedIcon","statusWarningComposedText","statusWarningComposedBackground","fillColorStatusWarningGhost","statusErrorComposedIcon","statusErrorComposedText","statusErrorComposedBackground","fillColorStatusErrorGhost","statusNeutralComposedIcon","textColorStatusNeutral","statusNeutralComposedText","statusNeutralComposedBackground","fillColorStatusNeutralGhost","borderColorChip","colorNeutral88","fillColorChip","textColorChip","colorNeutral45","colorsChatDark","fillColorInteractionDefaultDark","colorNeutral7","iconColorStatusInfoPrimaryDark","textColorStatusInfoDark","borderColorStatusInfoDark","fillColorStatusInfoSolidDark","iconColorStatusSuccessPrimaryDark","textColorStatusSuccessDark","borderColorStatusSuccessDark","fillColorStatusSuccessSolidDark","iconColorStatusWarningPrimaryDark","textColorStatusWarningDark","borderColorStatusWarningDark","fillColorStatusWarningSolidDark","iconColorStatusErrorPrimaryDark","textColorStatusErrorDark","borderColorStatusErrorDark","fillColorStatusErrorSolidDark","fillColorStatusInfoGhostDark","fillColorStatusSuccessGhostDark","fillColorStatusWarningGhostDark","fillColorStatusErrorGhostDark","textColorStatusNeutralDark","fillColorStatusNeutralGhostDark","colorNeutral68","light","dark"],"sources":["../../src/utils/theme.ts"],"sourcesContent":["import { Platform, PlatformColor } from 'react-native'\nimport type { ColorSchemeName, ColorValue, OpaqueColorValue } from 'react-native'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n chip: {\n hslLightnessChipSelected: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName | null): ChatTheme => {\n const scheme: 'light' | 'dark' = colorScheme === 'dark' ? 'dark' : 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n chip: {\n hslLightnessChipSelected: scheme === 'dark' ? 12 : 92,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n androidSwitchThumbColor: string | undefined\n conversationActionsBackground: string\n testColor: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBorder: string\n statusSuccessFill: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBorder: string\n statusInfoFill: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBorder: string\n statusWarningFill: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBorder: string\n statusErrorFill: string\n statusSuccessComposedIcon: string\n statusSuccessComposedText: string\n statusSuccessComposedBackground: string\n statusInfoComposedIcon: string\n statusInfoComposedText: string\n statusInfoComposedBackground: string\n statusWarningComposedIcon: string\n statusWarningComposedText: string\n statusWarningComposedBackground: string\n statusErrorComposedIcon: string\n statusErrorComposedText: string\n statusErrorComposedBackground: string\n statusNeutralComposedIcon: string\n statusNeutralComposedText: string\n statusNeutralComposedBackground: string\n borderColorChip: string\n fillColorChip: string\n textColorChip: string\n /**\n * Selected-chip colors (border/fill/text). Never assign a static default\n * directly — these stay optional so they always fall back to\n * `colors.interaction` via `??` at the read site. Every current consumer\n * overrides `interaction` at runtime, and a seeded default here could win\n * over that override depending on merge order.\n */\n borderColorChipSelected?: string\n fillColorChipSelected?: string\n textColorChipSelected?: string\n}\n\n// 'link' is an iOS-only semantic color name — constructing it on Android is\n// undefined behavior, so only build it when the code is actually running on iOS\nconst iOSLinkColor = Platform.OS === 'ios' ? PlatformColor('link') : undefined\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral100White,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBorder: tokens.borderColorStatusInfo,\n statusInfoFill: tokens.fillColorStatusInfoSolid,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBorder: tokens.borderColorStatusSuccess,\n statusSuccessFill: tokens.fillColorStatusSuccessSolid,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBorder: tokens.borderColorStatusWarning,\n statusWarningFill: tokens.fillColorStatusWarningSolid,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBorder: tokens.borderColorStatusError,\n statusErrorFill: tokens.fillColorStatusErrorSolid,\n statusInfoComposedIcon: tokens.textColorStatusInfo,\n statusInfoComposedText: tokens.colorNeutral24,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessComposedIcon: tokens.textColorStatusSuccess,\n statusSuccessComposedText: tokens.colorNeutral24,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningComposedIcon: tokens.textColorStatusWarning,\n statusWarningComposedText: tokens.colorNeutral24,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,\n statusErrorComposedIcon: tokens.textColorStatusError,\n statusErrorComposedText: tokens.colorNeutral24,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralComposedIcon: tokens.textColorStatusNeutral,\n statusNeutralComposedText: tokens.colorNeutral24,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,\n borderColorChip: tokens.colorNeutral88,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral45,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral7,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBorder: tokens.borderColorStatusInfoDark,\n statusInfoFill: tokens.fillColorStatusInfoSolidDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBorder: tokens.borderColorStatusSuccessDark,\n statusSuccessFill: tokens.fillColorStatusSuccessSolidDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBorder: tokens.borderColorStatusWarningDark,\n statusWarningFill: tokens.fillColorStatusWarningSolidDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBorder: tokens.borderColorStatusErrorDark,\n statusErrorFill: tokens.fillColorStatusErrorSolidDark,\n\n statusInfoComposedIcon: tokens.textColorStatusInfoDark,\n statusInfoComposedText: tokens.colorNeutral88,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessComposedIcon: tokens.textColorStatusSuccessDark,\n statusSuccessComposedText: tokens.colorNeutral88,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningComposedIcon: tokens.textColorStatusWarningDark,\n statusWarningComposedText: tokens.colorNeutral88,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorComposedIcon: tokens.textColorStatusErrorDark,\n statusErrorComposedText: tokens.colorNeutral88,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralComposedIcon: tokens.textColorStatusNeutralDark,\n statusNeutralComposedText: tokens.colorNeutral88,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorChip: tokens.colorNeutral24,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral68,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAEtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,MAAM,QAAQ,2BAA2B;;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAAgB;EAC9E,MAAMC,MAAwB,GAAGD,WAAW,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;EAE1E,MAAME,aAAa,GAAG;IACpB,GAAGC,iBAAiB,CAACF,MAAM,CAAC;IAC5B,GAAGJ,mBAAmB,CAACI,MAAM;EAC/B,CAAC;EAED,OAAO;IACLG,MAAM,EAAEF,aAAa;IACrBG,MAAM,EAAE;MACNC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,wBAAwB,EAAEP,MAAM,KAAK,MAAM,GAAG,EAAE,GAAG;IACrD,CAAC;IACDQ,oBAAoB,EAAE,IAAI,CAAE;EAC9B,CAAC;AACH,CAAC;AA4DD;AACA;AACA,MAAMC,YAAY,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGf,aAAa,CAAC,MAAM,CAAC,GAAGgB,SAAS;AAE9E,MAAMC,eAA2B,GAAG;EAClCC,IAAI,EAAE,OAAO;EACbC,iCAAiC,EAAEjB,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AG;EACxB2G,KAAK,EAAEjG,eAAe;EACtBkG,IAAI,EAAE3B;AACR,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "4.8.0-qa-staging.8",
3
+ "version": "4.8.0-qa-staging.10",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@fortawesome/fontawesome-svg-core": "^7.2.0",
35
35
  "@fortawesome/react-native-fontawesome": "^0.3.2",
36
- "@planningcenter/emoji-keyboard": "4.8.0-qa-staging.8",
36
+ "@planningcenter/emoji-keyboard": "4.8.0-qa-staging.10",
37
37
  "lodash-inflection": "^1.5.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -84,5 +84,5 @@
84
84
  "sf-symbols-typescript": "^2.2.0",
85
85
  "typescript": "~6.0.3"
86
86
  },
87
- "gitHead": "49729d571fb59f2d748b71ca24a6c14480f62e24"
87
+ "gitHead": "1eb54a05b1923f837f7f26c81f926c4343253a2d"
88
88
  }
@@ -1,8 +1,9 @@
1
1
  import AsyncStorage from '@react-native-async-storage/async-storage'
2
- import { QueryClientProvider } from '@tanstack/react-query'
2
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
3
3
  import { renderHook, act } from '@testing-library/react-native'
4
4
  import React, { useContext, Suspense } from 'react'
5
5
  import { buildTestQueryClient } from '../../__utils__/query_client'
6
+ import { chatQueryClient } from '../../contexts/api_provider'
6
7
  import {
7
8
  SessionContext,
8
9
  SessionContextProvider,
@@ -85,6 +86,7 @@ beforeEach(() => {
85
86
  mockSecureStorage = createMockStorage()
86
87
  mockRefreshTokenFn = jest.fn()
87
88
  mockOnLogout = jest.fn()
89
+ jest.mocked(chatQueryClient.clear).mockClear()
88
90
  // Reset AsyncStorage mocks with a storage implementation
89
91
  const asyncStorageData: Record<string, string> = {}
90
92
  mockAsyncStorage.getItem.mockImplementation(async (key: string) => {
@@ -131,20 +133,6 @@ describe('SessionContextProvider', () => {
131
133
  expect(result.current.env).toBe('production')
132
134
  expect(result.current.token).toBeUndefined()
133
135
  })
134
-
135
- it('should use custom default environment', async () => {
136
- // Note: defaultEnv is not currently used in the implementation
137
- // This test verifies the current behavior (defaults to 'production')
138
- const config = createConfig({ defaultEnv: 'staging' })
139
- const { result } = renderHook(() => useSessionContext(), {
140
- wrapper: createWrapper(config),
141
- })
142
-
143
- await waitForQuery()
144
-
145
- // Currently defaults to 'production' regardless of defaultEnv config
146
- expect(result.current.env).toBe('production')
147
- })
148
136
  })
149
137
 
150
138
  describe('logout', () => {
@@ -182,23 +170,24 @@ describe('SessionContextProvider', () => {
182
170
  await waitForQuery() // Extra wait for async operations
183
171
 
184
172
  expect(mockOnLogout).toHaveBeenCalledTimes(1)
173
+ const storedValue = await mockSecureStorage.getItem(TEST_SESSIONS_KEY)
174
+ expect(SessionManager.hydrate(JSON.parse(storedValue!)).sessions).toEqual({})
185
175
  })
186
176
 
187
- it('should clear query clients on logout', async () => {
188
- const config = createConfig()
177
+ it('should clear the chat and host query clients', async () => {
178
+ const hostClear = jest.spyOn(QueryClient.prototype, 'clear')
189
179
  const { result } = renderHook(() => useSessionContext(), {
190
- wrapper: createWrapper(config),
180
+ wrapper: createWrapper(createConfig()),
191
181
  })
192
182
 
193
183
  await waitForQuery()
194
184
 
195
- // Note: We can't spy on the queryClient since it's created inside createWrapper
196
- // But we can verify logout was called
197
185
  await act(async () => {
198
186
  await result.current.logout()
199
187
  })
200
188
 
201
- expect(mockOnLogout).toHaveBeenCalled()
189
+ expect(chatQueryClient.clear).toHaveBeenCalledTimes(1)
190
+ expect(hostClear).toHaveBeenCalledTimes(1)
202
191
  })
203
192
  })
204
193
 
@@ -256,7 +245,7 @@ describe('SessionContextProvider', () => {
256
245
  })
257
246
  })
258
247
 
259
- it('should handle multiple unauthorized responses', async () => {
248
+ it('should start only one refresh while one is already running', async () => {
260
249
  const token: OAuthToken = {
261
250
  access_token: 'old-token-12345678',
262
251
  refresh_token: 'refresh-token',
@@ -266,22 +255,13 @@ describe('SessionContextProvider', () => {
266
255
  created_at: Date.now(),
267
256
  }
268
257
 
269
- const newToken: OAuthToken = {
270
- access_token: 'new-token-87654321',
271
- refresh_token: 'new-refresh-token',
272
- expires_in: 3600,
273
- token_type: 'Bearer',
274
- scope: 'read write',
275
- created_at: Date.now(),
276
- }
277
-
278
- mockRefreshTokenFn.mockResolvedValue(newToken)
279
-
280
258
  const session = new Session({ env: 'production', token })
281
259
  const manager = new SessionManager()
282
260
  manager.upsertSession(session)
283
261
  await mockSecureStorage.setItem(TEST_SESSIONS_KEY, JSON.stringify(manager.toString()))
284
262
 
263
+ mockRefreshTokenFn.mockReturnValue(new Promise(() => {}))
264
+
285
265
  const config = createConfig()
286
266
  const { result } = renderHook(() => useSessionContext(), {
287
267
  wrapper: createWrapper(config),
@@ -289,23 +269,23 @@ describe('SessionContextProvider', () => {
289
269
 
290
270
  await waitForQuery()
291
271
 
292
- expect(result.current.token).toBeDefined()
293
-
294
272
  const failedResponse: FailedResponse = {
295
273
  status: 401,
296
274
  statusText: 'Unauthorized',
297
275
  errors: [{ detail: 'other-error', title: 'Unauthorized', status: '401' }],
298
276
  } as FailedResponse
299
277
 
300
- // Call handleUnauthorizedResponse - should trigger refresh
301
278
  await act(async () => {
302
279
  result.current.handleUnauthorizedResponse(failedResponse)
280
+ await jest.runOnlyPendingTimersAsync()
303
281
  })
304
282
 
305
- await waitForQuery()
283
+ await act(async () => {
284
+ result.current.handleUnauthorizedResponse(failedResponse)
285
+ await jest.runOnlyPendingTimersAsync()
286
+ })
306
287
 
307
- // Verify refresh was called
308
- expect(mockRefreshTokenFn).toHaveBeenCalled()
288
+ expect(mockRefreshTokenFn).toHaveBeenCalledTimes(1)
309
289
  })
310
290
 
311
291
  it('should logout on forced logout error (capuchin)', async () => {
@@ -55,13 +55,6 @@ const Wrapper = ({ children }: { children: React.ReactNode }) => {
55
55
  )
56
56
  }
57
57
 
58
- test('should use theme', () => {
59
- themeProps = {}
60
- const { result } = renderHook(() => useTheme(), { wrapper: Wrapper })
61
-
62
- expect(result.current).toBeDefined()
63
- })
64
-
65
58
  describe('configurable theme', () => {
66
59
  test('should not error is theme is undefined', () => {
67
60
  //@ts-expect-error
@@ -71,6 +71,7 @@ describe('useAsyncStorage', () => {
71
71
 
72
72
  expect(result.current).toBeDefined()
73
73
  expect(result.current[0]).toEqual(storedValue)
74
+ expect(mockAsyncStorage.getItem).toHaveBeenCalledWith('test-key')
74
75
  })
75
76
 
76
77
  it('returns raw string value when JSON parsing fails', async () => {
@@ -99,22 +100,6 @@ describe('useAsyncStorage', () => {
99
100
  expect(result.current).toBeDefined()
100
101
  expect(result.current[0]).toBe('initial-value')
101
102
  })
102
-
103
- it('returns initial value when getItem throws quota exceeded error', async () => {
104
- const quotaError = new Error('database or disk is full (code 13): SQLITE_FULL')
105
- mockAsyncStorage.getItem.mockRejectedValue(quotaError)
106
-
107
- const { result } = renderHook(() => useAsyncStorage('test-key', 'initial-value'), {
108
- wrapper: createWrapper(),
109
- })
110
-
111
- await act(async () => {
112
- await waitForQuery()
113
- })
114
-
115
- expect(result.current).toBeDefined()
116
- expect(result.current[0]).toBe('initial-value')
117
- })
118
103
  })
119
104
 
120
105
  describe('setValue', () => {
@@ -136,23 +121,6 @@ describe('useAsyncStorage', () => {
136
121
  expect(mockAsyncStorage.setItem).toHaveBeenCalledWith('test-key', JSON.stringify(newValue))
137
122
  })
138
123
 
139
- it('saves object value to storage', async () => {
140
- const { result } = renderHook(() => useAsyncStorage('test-key', { initial: 'value' }), {
141
- wrapper: createWrapper(),
142
- })
143
-
144
- await waitForQuery()
145
-
146
- expect(result.current).toBeDefined()
147
-
148
- const newValue = { initial: 'new-value', data: 'test' }
149
- await act(async () => {
150
- await result.current[1](newValue)
151
- })
152
-
153
- expect(mockAsyncStorage.setItem).toHaveBeenCalledWith('test-key', JSON.stringify(newValue))
154
- })
155
-
156
124
  it('removes item when value is null', async () => {
157
125
  mockAsyncStorage.getItem.mockResolvedValue(JSON.stringify({ data: 'existing' }))
158
126
 
@@ -230,27 +198,6 @@ describe('useAsyncStorage', () => {
230
198
  })
231
199
  })
232
200
 
233
- it('does not throw error when setItem throws other errors by default', async () => {
234
- const error = new Error('Storage write failed')
235
- mockAsyncStorage.setItem.mockRejectedValue(error)
236
-
237
- const { result } = renderHook(() => useAsyncStorage('test-key', 'initial'), {
238
- wrapper: createWrapper(),
239
- })
240
-
241
- await waitForQuery()
242
-
243
- expect(result.current).toBeDefined()
244
- expect(result.current[0]).toBe('initial')
245
-
246
- // Should not throw - errors are caught by default
247
- let promiseResult: void | undefined
248
- await act(async () => {
249
- promiseResult = await result.current[1]('new-value')
250
- })
251
- expect(promiseResult).toBeUndefined()
252
- })
253
-
254
201
  it('does not throw error when removeItem throws an error by default', async () => {
255
202
  const error = new Error('Remove failed')
256
203
  mockAsyncStorage.removeItem.mockRejectedValue(error)
@@ -272,37 +219,4 @@ describe('useAsyncStorage', () => {
272
219
  expect(promiseResult).toBeUndefined()
273
220
  })
274
221
  })
275
-
276
- describe('edge cases', () => {
277
- it('handles complex nested objects', async () => {
278
- const complexValue = {
279
- nested: {
280
- array: [1, 2, { deep: 'value' }],
281
- date: '2024-01-01',
282
- },
283
- }
284
- mockAsyncStorage.getItem.mockResolvedValue(JSON.stringify(complexValue))
285
-
286
- const { result } = renderHook(() => useAsyncStorage('test-key', {}), {
287
- wrapper: createWrapper(),
288
- })
289
-
290
- await waitForQuery()
291
-
292
- expect(result.current).toBeDefined()
293
- expect(result.current[0]).toEqual(complexValue)
294
- })
295
-
296
- it('uses correct cache key format', async () => {
297
- const { result } = renderHook(() => useAsyncStorage('my-unique-key', 'value'), {
298
- wrapper: createWrapper(),
299
- })
300
-
301
- await waitForQuery()
302
-
303
- expect(result.current).toBeDefined()
304
- expect(result.current[0]).toBe('value')
305
- expect(mockAsyncStorage.getItem).toHaveBeenCalledWith('my-unique-key')
306
- })
307
- })
308
222
  })
@@ -126,17 +126,6 @@ describe('useAttachmentUploader', () => {
126
126
  expect(result.current.attachments).toHaveLength(0)
127
127
  })
128
128
 
129
- it('formats an integer MB limit without a trailing decimal', () => {
130
- setChatConfiguration({ maxFileSizeInBytes: 25 * 1024 * 1024 })
131
- const { result } = renderUploader()
132
-
133
- act(() => {
134
- result.current.handleFilesAttached([makeFile({ size: 25 * 1024 * 1024 + 1 })])
135
- })
136
-
137
- expect(result.current.errorMessage).toBe('File size exceeds 25 MB')
138
- })
139
-
140
129
  it('formats a fractional MB limit to one decimal', () => {
141
130
  // 50.5 MB — server could in principle return a non-multiple-of-MB cap.
142
131
  setChatConfiguration({ maxFileSizeInBytes: Math.round(50.5 * 1024 * 1024) })
@@ -41,29 +41,4 @@ describe('useFontScale', () => {
41
41
  expect(result.current).toBe(2)
42
42
  })
43
43
  })
44
-
45
- describe('with both constraints', () => {
46
- test('returns native scale when within bounds', () => {
47
- const { result } = renderHook(() =>
48
- useFontScale({ minFontSizeMultiplier: 0.5, maxFontSizeMultiplier: 2 })
49
- )
50
- expect(result.current).toBe(DEFAULT_NATIVE_FONT_SCALE)
51
- })
52
-
53
- test('clamps to minimum when native scale is below', () => {
54
- mockUseWindowDimensions.mockReturnValue({ fontScale: SMALL_NATIVE_FONT_SCALE })
55
- const { result } = renderHook(() =>
56
- useFontScale({ minFontSizeMultiplier: 1, maxFontSizeMultiplier: 2 })
57
- )
58
- expect(result.current).toBe(1)
59
- })
60
-
61
- test('clamps to maximum when native scale exceeds', () => {
62
- mockUseWindowDimensions.mockReturnValue({ fontScale: LARGE_NATIVE_FONT_SCALE })
63
- const { result } = renderHook(() =>
64
- useFontScale({ minFontSizeMultiplier: 1, maxFontSizeMultiplier: 2 })
65
- )
66
- expect(result.current).toBe(2)
67
- })
68
- })
69
44
  })