{"version":3,"file":"internal.mjs","names":["React","createContext","User","UserActions","changeTenant","tenantId","Promise","selectedTenantId","isTenantSwitching","UserAction","type","AccessTokenAction","Dispatch","action","UserContext","Context","UserDispatchContext"],"sources":["../../../src/utilities/auth/internal.ts"],"sourcesContent":["import React, { createContext } from 'react';\nimport { User } from './user';\n\nexport interface UserActions {\n\t/** Fetch + switch to a new tenant-scoped user */\n\tchangeTenant: (tenantId: string) => Promise<void> | void;\n\t/**\n\t * Tenant the app is switching TO. It leads `user.currentTenantId`, which\n\t * only catches up once the new tenant-scoped user response lands.\n\t */\n\tselectedTenantId: string | null;\n\t/**\n\t * True while `user` is still the one we rendered for the tenant being\n\t * switched away from.\n\t * @see useIsTenantSwitching\n\t */\n\tisTenantSwitching: boolean;\n}\n\nexport type UserAction = { type: 'SET_USER' };\nexport type AccessTokenAction = { type: 'SET_ACCESS_TOKEN' };\nexport type Dispatch = (action: UserAction | AccessTokenAction) => void;\nexport const UserContext: React.Context<User | null> = createContext<User | null>(null);\nexport const UserDispatchContext: React.Context<UserActions | null> = createContext<UserActions | null>(null);\n"],"mappings":";;AAsBA,MAAac,cAA0Cb,cAA2B,KAAK;AACvF,MAAae,sBAAyDf,cAAkC,KAAK"}