Powers all conversational UX. From the Onboarding conversation to logging a meal, this component will enable the back and forth with the user, including the display of in-context sub-components.
<Chat moduleName={ModuleNames.LOG_MEAL}>
<MessagesList />
<ChatInput allowPhotos=”true” />
</Chat>
| Prop | Type | Description || :---- | :----- | :---- || moduleName (required) | ModuleNames | Which chat module to load || onSendMessage | (message: string) => void; | Function to call when message is sent || onEndChat | () => void | Function to call when chat is done || endChatLabel | string | Button text when the chat module is complete. Defaults to Done || onLogMeal | (mealId: string) => void | Function to call when a meal is saved. (Coming Soon: onLogSleep, onLogActivity, onLogMood) || onNotificationScheduled | (params: ScheduleNotificationParams) => void | Function to call when a notification is scheduled during chat. I.e. a notification reminder to log the meal discussed in the ‘recipes’ module || introMessage |string | First message to display to the user on chat component load. Default is set in the module. |
List of all messages back and forth between the Miri Coach and the user. This will include text and images from the user and text and sub-components (i.e. MealCard) from the Coach.
<MessagesList />
None
Input bar for the user to type in text or upload a photo to be used in chat.
<ChatInput />
| Prop | Type | Description || :---- | :---- | :---- || allowPhotos | boolean | If true, the input bar shows a photo input button which will show the Camera Sheet for users to take and/or upload photos to send in the chat. Note: the user will be prompted for photo permissions if they have not yet been granted. Defaults to true|| cameraPermissionText | string | The text to show when requesting camera and photo gallery permission || onImageUploadError | (error: unknown) => void | Handler to call if image upload fails |