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AU,GAAWzJ,MAAA,CAlEnD,aAkEmD,cAAa,CAAE6F,MAAAA,EAAO0E,OAAAA,CAAO,GAGxF,OADAzK,EAAAA,CAAMA,CAACC,KAAK,CAAC,GAAcC,MAAA,CAAX9B,EAAW,uBAAsB,CAAEkL,OAAAA,CAAO,GACnDA,CACX,CAAE,MAAOnJ,EAAO,CAEZ,MADAH,EAAAA,CAAMA,CAACG,KAAK,CAAC,GAAcD,MAAA,CAAX9B,EAAW,yBAAwB,CAAE+B,MAAAA,CAAM,GACrDA,CACV,CACJ","sources":["webpack://_N_E/./src/layers/presentation/components/providers/ProviderProfileCompletion.tsx","webpack://_N_E/./src/layers/presentation/utils/profileUtils.ts","webpack://_N_E/./src/layers/presentation/context/AuthContext.tsx","webpack://_N_E/./src/layers/presentation/context/NotificationContext.tsx","webpack://_N_E/./src/layers/presentation/hooks/useProviderProfileUpdate.ts","webpack://_N_E/./src/layers/presentation/services/providers.ts","webpack://_N_E/./src/layers/presentation/services/sponsors.ts","webpack://_N_E/./src/layers/presentation/services/users.ts"],"sourcesContent":["'use client';\n\nimport { useTranslation } from '@/layers/presentation/i18n/client';\nimport logger from '@/layers/support/monitoring/logger';\nimport { Button, Checkbox, Input } from '@nextui-org/react';\nimport { useEffect, useState } from 'react';\n\nconst LOG_MODULE = 'FE [Presentation / Components / ProviderProfileCompletion]';\n\ninterface ProviderProfileCompletionProps {\n onComplete: (data: { npi: string; acknowledgement: boolean }) => Promise;\n onCancel?: () => void;\n initialValues?: {\n npi: string;\n acknowledgement?: boolean;\n };\n isLoading?: boolean;\n}\n\nexport function ProviderProfileCompletion({\n onComplete,\n onCancel,\n initialValues,\n isLoading = false,\n}: ProviderProfileCompletionProps) {\n const { t } = useTranslation();\n const [formData, setFormData] = useState({\n npi: initialValues?.npi || '',\n acknowledgement: initialValues?.acknowledgement || false,\n });\n const [errors, setErrors] = useState>({});\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n // Update form data when initialValues change\n useEffect(() => {\n if (initialValues) {\n setFormData({\n npi: initialValues.npi || '',\n acknowledgement: initialValues?.acknowledgement || false,\n });\n }\n }, [initialValues]);\n\n const validateForm = () => {\n const newErrors: Record = {};\n\n if (!formData.npi) {\n newErrors.npi = t('common:validation.required');\n } else if (!/^\\d{10}$/.test(formData.npi)) {\n newErrors.npi = t('common:validation.invalidNPI');\n }\n\n if (!initialValues?.npi && !formData.acknowledgement) {\n newErrors.acknowledgement = t('common:validation.required');\n }\n\n setErrors(newErrors);\n return Object.keys(newErrors).length === 0;\n };\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (!validateForm()) {\n return;\n }\n\n setIsSubmitting(true);\n\n try {\n await onComplete(formData);\n logger.debug(`${LOG_MODULE} Profile completion successful`, { formData });\n } catch (error) {\n logger.error(`${LOG_MODULE} Error completing profile`, { error });\n setErrors({\n form: t('common:errors.generalError'),\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n const handleChange = (e: React.ChangeEvent) => {\n const { name, value } = e.target;\n setFormData(prev => ({\n ...prev,\n [name]: value,\n }));\n\n // Clear error for this field when user types\n if (errors[name]) {\n setErrors(prev => {\n const newErrors = { ...prev };\n delete newErrors[name];\n return newErrors;\n });\n }\n };\n\n const handleCheckboxChange = (isSelected: boolean) => {\n setFormData(prev => ({\n ...prev,\n acknowledgement: isSelected,\n }));\n\n // Clear error for checkbox when user changes it\n if (errors.acknowledgement) {\n setErrors(prev => {\n const newErrors = { ...prev };\n delete newErrors.acknowledgement;\n return newErrors;\n });\n }\n };\n\n const isShowCheckbox = !(\n initialValues?.npi &&\n initialValues?.npi.length === 10 &&\n initialValues?.acknowledgement\n );\n\n // Log for debugging\n useEffect(() => {\n logger.debug(`${LOG_MODULE} Rendering ProviderProfileCompletion`, {\n isShowCheckbox,\n initialValues,\n formData,\n });\n }, [isShowCheckbox, initialValues, formData]);\n\n return (\n
\n {errors.form &&
{errors.form}
}\n \n {isShowCheckbox && (\n \n I confirm that I am a licensed healthcare provider or an authorized\n representative acting on behalf of one.\n {errors.acknowledgement && (\n
{errors.acknowledgement}
\n )}\n \n )}\n
\n {onCancel && (\n \n )}\n \n {t('users:providerProfile.updateProfile')}\n \n
\n \n );\n}\n","import logger from '@/layers/support/monitoring/logger';\nimport { ProviderProfile } from '@/types/models';\n\nconst LOG_MODULE = 'FE [Presentation / Utils / profileUtils]';\n\n/**\n * Checks if a provider profile requires completion\n * @param providerProfile The provider profile to check\n * @returns Boolean indicating if profile needs completion\n */\nexport function providerProfileNeedsCompletion(providerProfile: ProviderProfile | null): boolean {\n if (!providerProfile) {\n return false;\n }\n\n // Check both regular fields (for backward compatibility) and meta fields\n const hasNpi = !!providerProfile.npi || !!providerProfile.meta?.npi;\n const hasAcknowledgement = !!providerProfile.meta?.acknowledgement;\n\n const needsCompletion = !hasNpi || !hasAcknowledgement;\n\n logger.debug(`${LOG_MODULE} Provider profile completion check`, {\n needsCompletion,\n hasNpi,\n hasAcknowledgement,\n usesMetaFields: {\n npi: !!providerProfile.meta?.npi,\n acknowledgement: !!providerProfile.meta?.acknowledgement,\n },\n });\n\n return needsCompletion;\n}\n","'use client';\nimport logger from '@/layers/support/monitoring/logger';\nimport { UserGender, UserType } from '@/types/modelEnums';\nimport { ProviderProfile, User } from '@/types/models';\nimport { Authenticator, useAuthenticator } from '@aws-amplify/ui-react';\nimport { fetchUserAttributes } from 'aws-amplify/auth';\nimport {\n createContext,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { getProfile } from '../services/users';\nimport { providerProfileNeedsCompletion } from '../utils/profileUtils';\nimport { useGlobalState } from './GlobalStateContext';\n\nconst LOG_MODULE = 'FE [Presentation / Context / AuthContext]';\n\n// Storage keys\nconst AUTH_CACHE_KEY = 'r2h_auth_cache';\n\ninterface AuthCache {\n user: User | null;\n timestamp: number;\n // We don't cache full profile for security reasons, just user basic info\n}\n\ninterface AuthContextType {\n isProfileLoading: boolean;\n refreshProfile: () => Promise;\n refreshUserAttributes: () => Promise;\n userRole: string | null;\n needsProviderProfileCompletion: boolean;\n}\n\ninterface AuthProviderProps {\n children: ReactNode;\n}\n\nconst AuthContext = createContext(undefined);\n\n// Helper to load cached user data with type safety\nconst loadCachedAuthState = (): AuthCache | null => {\n if (typeof window === 'undefined') return null;\n try {\n const cachedData = localStorage.getItem(AUTH_CACHE_KEY);\n if (!cachedData) return null;\n\n const parsed = JSON.parse(cachedData) as AuthCache;\n // Check if cache is too old (24 hours)\n const cacheAge = Date.now() - parsed.timestamp;\n if (cacheAge > 24 * 60 * 60 * 1000) {\n localStorage.removeItem(AUTH_CACHE_KEY);\n return null;\n }\n return parsed;\n } catch (e) {\n console.error('Error loading cached auth state', e);\n return null;\n }\n};\n\n// Helper to save cache\nconst saveAuthCache = (user: User | null) => {\n if (typeof window === 'undefined') return;\n try {\n if (!user) {\n localStorage.removeItem(AUTH_CACHE_KEY);\n return;\n }\n\n const cache: AuthCache = {\n user,\n timestamp: Date.now(),\n };\n localStorage.setItem(AUTH_CACHE_KEY, JSON.stringify(cache));\n } catch (e) {\n console.error('Error saving auth cache', e);\n }\n};\n\nexport const AuthProvider: React.FC = ({ children }) => {\n const { user: globalUser, profile: globalProfile, setUser, setProfile } = useGlobalState();\n const { user, authStatus } = useAuthenticator(context => [context.user, context.authStatus]);\n const [isProfileLoading, setIsProfileLoading] = useState(false);\n const [userAttributes, setUserAttributes] = useState(null);\n const [userRole, setUserRole] = useState(null);\n const [needsProviderProfileCompletion, setNeedsProviderProfileCompletion] =\n useState(false);\n const profileFetchedRef = useRef(false);\n const cacheInitializedRef = useRef(false);\n\n // Initialize from cache on mount - exactly once\n useEffect(() => {\n if (cacheInitializedRef.current || globalUser) return;\n\n const cachedState = loadCachedAuthState();\n if (cachedState?.user && !globalUser) {\n logger.debug(`${LOG_MODULE} Initializing from cache`, cachedState);\n setUser(cachedState.user);\n // We'll set userRole from the cached user\n if (cachedState.user.role) {\n setUserRole(cachedState.user.role);\n }\n }\n\n cacheInitializedRef.current = true;\n }, [globalUser, setUser]);\n\n logger.debug(`${LOG_MODULE}`, {\n isProfileLoading,\n globalUser,\n globalProfile,\n user,\n authStatus,\n userAttributes,\n userRole,\n fromCache: cacheInitializedRef.current,\n });\n\n const fetchProfile = useCallback(\n async (userId: string, userType: UserType) => {\n if (profileFetchedRef.current) return;\n setIsProfileLoading(true);\n try {\n const fetchedProfile = await getProfile(userId, userType);\n setProfile(fetchedProfile);\n profileFetchedRef.current = true;\n } catch (error) {\n console.error('Error fetching profile:', error);\n } finally {\n setIsProfileLoading(false);\n }\n },\n [setProfile],\n );\n\n const refreshProfile = useCallback(async () => {\n if (globalUser) {\n profileFetchedRef.current = false;\n await fetchProfile(globalUser.id, globalUser.type);\n }\n }, [globalUser, fetchProfile]);\n\n // Add a function to manually refresh user attributes when needed\n const refreshUserAttributes = useCallback(async () => {\n if (user) {\n try {\n const attributes = await fetchUserAttributes();\n setUserAttributes(attributes);\n logger.debug(`${LOG_MODULE} Refreshed user attributes`, attributes);\n } catch (error) {\n logger.error(`${LOG_MODULE} Error refreshing user attributes`, error);\n }\n }\n }, [user]);\n\n // Clear global state when user signs out\n useEffect(() => {\n // When authStatus changes to 'unauthenticated' (logged out), clear global state\n if (authStatus === 'unauthenticated' && (globalUser || globalProfile)) {\n logger.debug(`${LOG_MODULE} Detected sign out, clearing global state`);\n setUser(null);\n setProfile(null);\n setUserAttributes(null);\n setUserRole(null);\n profileFetchedRef.current = false;\n saveAuthCache(null); // Clear cache on sign out\n }\n }, [authStatus, globalUser, globalProfile, setUser, setProfile]);\n\n useEffect(() => {\n const fetchAttributes = async () => {\n if (user && !userAttributes) {\n try {\n const attributes = await fetchUserAttributes();\n setUserAttributes(attributes);\n const role = attributes['custom:role']?.toLowerCase() || null;\n setUserRole(role);\n } catch (error) {\n // This can happen during logout, so we handle it gracefully\n logger.debug(\n `${LOG_MODULE} Error fetching user attributes, user may be logging out`,\n error,\n );\n setUserAttributes(null);\n setUserRole(null);\n }\n }\n };\n fetchAttributes();\n }, [user, userAttributes]);\n\n useEffect(() => {\n if (user && userAttributes) {\n const currentUser: User = {\n id: user.userId,\n type: userAttributes['custom:type'] as UserType,\n role: userAttributes['custom:role']?.toLowerCase(),\n };\n currentUser.personal_info = {\n email: userAttributes['email'] as string,\n first_name: userAttributes['custom:first_name'] as string,\n last_name: userAttributes['custom:last_name'] as string,\n gender: (userAttributes['custom:gender'] as UserGender) || undefined,\n age: userAttributes['custom:age']\n ? Number(userAttributes['custom:age'])\n : undefined,\n institution: userAttributes['custom:institution'] as string,\n };\n\n // Log for debugging\n logger.debug(`${LOG_MODULE} Setting user with attributes`, {\n currentUser,\n attributesPresent: !!userAttributes['custom:first_name'],\n });\n\n setUser(currentUser);\n\n // Update cache when we get fresh user data\n saveAuthCache(currentUser);\n }\n }, [user, userAttributes, setUser]);\n\n useEffect(() => {\n if (globalUser && !globalProfile && !profileFetchedRef.current) {\n fetchProfile(globalUser.id, globalUser.type);\n }\n }, [globalUser, globalProfile, fetchProfile]);\n\n // Check if provider profile is complete\n useEffect(() => {\n if (globalUser?.type === UserType.PROVIDER && globalProfile) {\n const providerProfile = globalProfile as ProviderProfile;\n const needsCompletion = providerProfileNeedsCompletion(providerProfile);\n\n setNeedsProviderProfileCompletion(needsCompletion);\n } else {\n setNeedsProviderProfileCompletion(false);\n }\n }, [globalUser, globalProfile]);\n\n const value = {\n isProfileLoading,\n refreshProfile,\n refreshUserAttributes,\n userRole,\n needsProviderProfileCompletion,\n };\n\n return (\n \n {children}\n \n );\n};\n\nexport const useAuth = () => {\n const context = useContext(AuthContext);\n if (context === undefined) {\n throw new Error('useAuth must be used within an AuthProvider');\n }\n return context;\n};\n","import React, { createContext, useContext, ReactNode } from 'react';\nimport { ToastContainer, toast, ToastOptions } from 'react-toastify';\nimport logger from '@/layers/support/monitoring/logger';\nimport { NotificationType } from '@/types/modelEnums';\ninterface NotificationContextProps {\n handleNotification: (\n type: NotificationType,\n message: string,\n context?: Record,\n options?: ToastOptions,\n ) => void;\n}\n\nconst NotificationContext = createContext(undefined);\n\nexport const NotificationProvider: React.FC<{ children: ReactNode }> = ({ children }) => {\n const handleNotification = (\n type: NotificationType,\n message: string,\n context: Record = {},\n options?: ToastOptions,\n ) => {\n // Log the notification with context\n logger.info('Global Notification Handler', { type, message, ...context });\n\n // Determine default options if not provided\n const toastOptions: ToastOptions = {\n position: 'bottom-left',\n autoClose: 5000,\n hideProgressBar: false,\n closeOnClick: true,\n pauseOnHover: true,\n draggable: true,\n theme: 'colored',\n ...options,\n };\n\n // Display standard errors\n if (context.error) {\n if (context.error.name === 'ValidationError') {\n toast.warn(context.error.message || 'A validation error occurred.', toastOptions);\n } else if (context.error.name === 'AuthenticationError') {\n toast.error(context.error.message || 'Authentication failed.', toastOptions);\n } else {\n toast.error(context.error.message || 'An unexpected error occurred.', toastOptions);\n }\n\n // Display custom notifications\n } else {\n switch (type) {\n case NotificationType.Info:\n toast.info(message || 'Information.', toastOptions);\n break;\n case NotificationType.Warning:\n toast.warn(message || 'Warning.', toastOptions);\n break;\n case NotificationType.Error:\n toast.error(message || 'An error occurred.', toastOptions);\n break;\n case NotificationType.Success:\n toast.success(message || 'Success!', toastOptions);\n break;\n default:\n toast(message, toastOptions);\n }\n }\n };\n\n return (\n \n {children}\n \n \n );\n};\n\nexport const useNotification = (): NotificationContextProps => {\n const context = useContext(NotificationContext);\n if (!context) {\n throw new Error('useNotification must be used within a NotificationProvider');\n }\n return context;\n};\n","import { useState } from 'react';\nimport { useAuth } from '../context/AuthContext';\nimport { useNotification } from '../context/NotificationContext';\nimport { updateProviderProfile } from '../services/providers';\nimport { NotificationType } from '@/types/modelEnums';\nimport logger from '@/layers/support/monitoring/logger';\nimport { ProviderProfile } from '@/types/models';\n\nconst LOG_MODULE = '[Hooks / useProviderProfileUpdate]';\n\ninterface ProfileUpdateData {\n npi: string;\n acknowledgement: boolean;\n}\n\nexport const useProviderProfileUpdate = (providerProfile: ProviderProfile | null) => {\n const [isUpdating, setIsUpdating] = useState(false);\n const { refreshProfile } = useAuth();\n const { handleNotification } = useNotification();\n\n const updateProfile = async (data: ProfileUpdateData): Promise => {\n if (!providerProfile) return;\n\n setIsUpdating(true);\n try {\n logger.debug(`${LOG_MODULE} Updating provider profile`, { data });\n\n await updateProviderProfile(providerProfile.id, {\n meta: {\n ...providerProfile.meta,\n npi: data.npi,\n acknowledgement: data.acknowledgement,\n },\n });\n\n await refreshProfile();\n\n handleNotification(\n NotificationType.Success,\n 'Your provider profile has been successfully updated.',\n );\n } catch (error) {\n logger.error(`${LOG_MODULE} Error updating provider profile`, { error });\n handleNotification(\n NotificationType.Error,\n 'Failed to update profile. Please try again.',\n );\n throw error;\n } finally {\n setIsUpdating(false);\n }\n };\n\n const getInitialValues = () => {\n if (!providerProfile) {\n return {\n npi: '',\n acknowledgement: false,\n };\n }\n\n return {\n npi: providerProfile.meta?.npi || providerProfile.npi || '',\n acknowledgement: providerProfile.meta?.acknowledgement || false,\n };\n };\n\n return {\n updateProfile,\n isUpdating,\n getInitialValues,\n };\n};\n","import logger from '@/layers/support/monitoring/logger';\nimport { NewProviderRequest } from '@/types/providers';\nimport { ProviderProfile } from '@/types/models';\nimport { fetchWrapper } from '../utils/fetchWrapper';\n\nconst LOG_MODULE = 'FE [Presentation / Services / Health Providers]';\n\nconst API_URL = '/api/users/providers';\n\nexport const fetchProviderById = async (id: string): Promise => {\n logger.debug(`${LOG_MODULE} fetchProviderById: begin`, { id });\n\n try {\n const result = await fetchWrapper.get(`${API_URL}/${id}`);\n\n logger.debug(`${LOG_MODULE} fetchProviderById: end`, { result });\n return result;\n } catch (error) {\n logger.error(`${LOG_MODULE} fetchProviderById`, { error });\n throw error;\n }\n};\n\nexport const fetchProviderByUserId = async (id: string): Promise => {\n logger.debug(`${LOG_MODULE} fetchProviderByUserId: begin`, { id });\n\n try {\n const result = await fetchWrapper.get(`${API_URL}/user/${id}`);\n\n logger.debug(`${LOG_MODULE} fetchProviderByUserId: end`, { result });\n return result;\n } catch (error) {\n logger.error(`${LOG_MODULE} fetchProviderByUserId`, { error });\n throw error;\n }\n};\n\nexport const createProvider = async (provider: NewProviderRequest): Promise => {\n logger.debug(`${LOG_MODULE} createProvider: begin`, { provider });\n\n try {\n const result = await fetchWrapper.post(API_URL, provider);\n\n logger.debug(`${LOG_MODULE} createProvider: end`, { result });\n return result;\n } catch (error) {\n logger.error(`${LOG_MODULE} createProvider`, { error });\n throw error;\n }\n};\n\nexport const submitProviderVerification = async (\n providerId: string,\n npi: string,\n): Promise => {\n logger.debug(`${LOG_MODULE} submitProviderVerification: begin`, {\n providerId,\n npi,\n });\n\n try {\n await fetchWrapper.put(`${API_URL}/${providerId}/verify`, { npi });\n } catch (error) {\n logger.error(`${LOG_MODULE} submitProviderVerification`, { error });\n throw error;\n }\n};\n\nexport const updateProviderProfile = async (\n providerId: string,\n data: {\n npi?: string;\n medical_institution?: string;\n personal_info?: {\n first_name?: string;\n last_name?: string;\n };\n meta?: {\n npi?: string;\n medical_institution?: string;\n given_name?: string;\n family_name?: string;\n [key: string]: any;\n };\n },\n): Promise => {\n logger.debug(`${LOG_MODULE} updateProviderProfile: begin`, { providerId, data });\n\n try {\n const result = await fetchWrapper.put(`${API_URL}/${providerId}`, data);\n\n logger.debug(`${LOG_MODULE} updateProviderProfile: end`, { result });\n return result;\n } catch (error) {\n logger.error(`${LOG_MODULE} updateProviderProfile`, { error });\n throw error;\n }\n};\n","import { SponsorProfile } from '@/types/models';\nimport { fetchWrapper } from '../utils/fetchWrapper';\nimport { NewSponsorRequest } from '@/types/sponsors';\nimport logger from '@/layers/support/monitoring/logger';\n\nconst LOG_MODULE = 'FE [Presentation / Services / Sponsors]';\n\nconst API_URL = '/api/users/sponsors';\n\nexport const fetchSponsorByUserId = async (id: string): Promise => {\n logger.debug(`${LOG_MODULE} fetchSponsorByUserId: begin`, { id });\n\n try {\n const result = await fetchWrapper.get(`${API_URL}/user/${id}`);\n\n logger.debug(`${LOG_MODULE} fetchSponsorByUserId: end`, { result });\n return result;\n } catch (error) {\n logger.error(`${LOG_MODULE} fetchSponsorByUserId`, { error });\n throw error;\n }\n};\n\nexport const createSponsor = async (sponsor: NewSponsorRequest): Promise => {\n logger.debug(`${LOG_MODULE} createSponsor: begin`, { sponsor });\n\n try {\n const result = await fetchWrapper.post(API_URL, sponsor);\n\n logger.debug(`${LOG_MODULE} createSponsor: end`, { result });\n return result;\n } catch (error) {\n logger.error(`${LOG_MODULE} createSponsor`, { error });\n throw error;\n }\n};\n","import { ValidProfiles } from '@/types/models';\nimport logger from '@/layers/support/monitoring/logger';\nimport { UserType } from '@/types/modelEnums';\nimport { fetchProviderByUserId, createProvider } from './providers';\nimport { createSponsor, fetchSponsorByUserId } from './sponsors';\nimport { fetchWrapper } from '../utils/fetchWrapper';\nimport { SubscriptionParams } from '@/types/users';\nimport { createPatientByUserId } from './patients';\nimport { fetchPatientByUserId } from './patients';\n\nconst API_URL = '/api/users';\nconst LOG_MODULE = 'FE [Presentation / Services / users]';\n\nexport const getProfile = async (\n userId: string,\n userType: UserType,\n): Promise => {\n logger.debug(`${LOG_MODULE} getProfile: begin`, { userId, userType });\n\n try {\n let profile: ValidProfiles | null = null;\n\n switch (userType) {\n case UserType.PROVIDER:\n profile = await fetchProviderByUserId(userId);\n if (!profile) {\n profile = await createProvider({ user_id: userId });\n }\n break;\n\n case UserType.PATIENT:\n profile = await fetchPatientByUserId(userId);\n if (!profile) {\n profile = await createPatientByUserId({ user_id: userId });\n }\n break;\n\n case UserType.SPONSOR:\n profile = await fetchSponsorByUserId(userId);\n if (!profile) {\n profile = await createSponsor({ user_id: userId });\n }\n break;\n\n // Add cases for other profile types as needed\n default:\n throw new Error(`Unsupported user type: ${userType}`);\n }\n\n profile = enhanceProfileWithType(profile, userType);\n\n logger.debug(`${LOG_MODULE} getProfile: end`, { profile });\n return profile;\n } catch (error) {\n logger.error(`${LOG_MODULE} getProfile`, { error });\n throw error;\n }\n};\n\n/**\n * Enhances a raw profile object with the specified UserType.\n * @param profile - The raw profile object fetched from the backend.\n * @param type - The UserType to assign to the profile.\n * @returns The profile object augmented with the type property.\n */\nconst enhanceProfileWithType = (profile: T, type: UserType): T & { type: UserType } => {\n return { ...profile, type };\n};\n\nexport const subscribeUser = async (\n email: string,\n params: SubscriptionParams,\n): Promise => {\n logger.debug(`${LOG_MODULE} subscribeUser: begin`, { email, params });\n\n try {\n const result = await fetchWrapper.post(`${API_URL}/subscribe`, { email, params });\n\n logger.debug(`${LOG_MODULE} subscribeUser: end`, { result });\n return result;\n } catch (error) {\n logger.error(`${LOG_MODULE} subscribeUser: error`, { error });\n throw error;\n }\n};\n"],"names":["LOG_MODULE","ProviderProfileCompletion","param","onComplete","onCancel","initialValues","isLoading","t","useTranslation","formData","setFormData","useState","npi","acknowledgement","errors","setErrors","isSubmitting","setIsSubmitting","useEffect","validateForm","newErrors","test","Object","keys","length","handleSubmit","e","preventDefault","logger","debug","concat","error","form","isShowCheckbox","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsxs","onSubmit","className","jsx","div","Input","label","name","value","onChange","target","prev","isInvalid","errorMessage","description","Checkbox","isSelected","onValueChange","Button","variant","onPress","disabled","size","color","type","AUTH_CACHE_KEY","AuthContext","createContext","undefined","loadCachedAuthState","cachedData","localStorage","getItem","parsed","JSON","parse","cacheAge","now","timestamp","removeItem","console","saveAuthCache","user","cache","Date","setItem","stringify","AuthProvider","children","globalUser","profile","globalProfile","setUser","setProfile","useGlobalState","authStatus","useAuthenticator","context","isProfileLoading","setIsProfileLoading","userAttributes","setUserAttributes","userRole","setUserRole","needsProviderProfileCompletion","setNeedsProviderProfileCompletion","profileFetchedRef","useRef","cacheInitializedRef","current","cachedState","role","fromCache","fetchProfile","useCallback","userId","userType","fetchedProfile","getProfile","refreshProfile","id","refreshUserAttributes","attributes","fetchUserAttributes","fetchAttributes","toLowerCase","currentUser","personal_info","email","first_name","last_name","gender","age","Number","institution","attributesPresent","UserType","PROVIDER","providerProfileNeedsCompletion","providerProfile","hasNpi","meta","hasAcknowledgement","needsCompletion","usesMetaFields","jsx_runtime","Authenticator","Provider","useAuth","useContext","NotificationContext","NotificationProvider","handleNotification","message","options","info","toastOptions","position","autoClose","hideProgressBar","closeOnClick","pauseOnHover","draggable","theme","toast","warn","NotificationType","Info","Warning","Error","Success","success","ToastContainer","useNotification","useProviderProfileUpdate","isUpdating","setIsUpdating","updateProfile","data","updateProviderProfile","getInitialValues","API_URL","fetchProviderByUserId","result","fetchWrapper","get","createProvider","provider","post","submitProviderVerification","providerId","put","fetchSponsorByUserId","createSponsor","sponsor","user_id","PATIENT","fetchPatientByUserId","createPatientByUserId","SPONSOR","enhanceProfileWithType","subscribeUser","params"],"sourceRoot":""}