UNPKG

@yext/chat-headless

Version:

A state manager library powered by Redux for Yext Chat integrations

26 lines (22 loc) 664 B
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import { MetaState } from "../models/slices/MetaState"; export const initialState: MetaState = {}; /** * Registers with Redux the slice of {@link State} pertaining to * meta attributes of Chat Headless. */ export const metaSlice = createSlice({ name: "meta", initialState, reducers: { setContext: ( state: MetaState, // eslint-disable-next-line @typescript-eslint/no-explicit-any action: PayloadAction<any | undefined> ) => { state.context = action.payload; }, }, }); export const { setContext } = metaSlice.actions; export default metaSlice.reducer;