f6a3e30da2
* feat(sdk): render iframe in chat-room component * fix(ci): install optional dependencies * feat(sdk): allow subset of attributes * feat(sdk): accept root-domain attribute * feat(sdk): accept custom room name or use sane default * feat(sdk): set allowed features * feat(sdk): add sdk instructions to embed code dialog * fix(sdk): use dynamic rootUrl * fix(sdk): use static defaultRoot * feat(sdk): send config from SDK to chat * fix(sdk): expire poller * fix(sdk): pass parent domain to iframe via query param * refactor(sdk): type message event data * feat(sdk): send user id to chat frame * feat(sdk): handle some attribute updates * chore(package): add build:sdk:watch script * refactor(sdk): move more code to updateIframeAttributes * feat(sdk): support changing rooms * feat(sdk): support more user settings * docs(sdk): add SDK section to README * feat(sdk): render root-url in embed code if necessary * refactor(sdk): use map for chat room attributes * fix(sdk): unbind event listener when chat-room is disconnected * fix(sdk): properly tear down receipt listener * fix(sdk): send config when frame reloads * feat(sdk): listen for config updates * feat(sdk): request config from sdk instead of sending it repeatedly * refactor(sdk): use type guard for config message * fix(sdk): use settings from SDK when there is no preexisting persisted data * fix(sdk): observe all iframe attributes * refactor(sdk): simplify bootup logic * feat(sdk): improve embed code display
22 lines
623 B
TypeScript
22 lines
623 B
TypeScript
import { SettingsContextProps } from 'contexts/SettingsContext'
|
|
import { ColorMode, UserSettings } from 'models/settings'
|
|
|
|
export const userSettingsContextStubFactory = (
|
|
userSettingsOverrides: Partial<UserSettings> = {}
|
|
) => {
|
|
const userSettingsStub: SettingsContextProps = {
|
|
updateUserSettings: () => Promise.resolve(),
|
|
getUserSettings: () => ({
|
|
userId: '',
|
|
customUsername: '',
|
|
colorMode: ColorMode.DARK,
|
|
playSoundOnNewMessage: true,
|
|
showNotificationOnNewMessage: true,
|
|
showActiveTypingStatus: true,
|
|
...userSettingsOverrides,
|
|
}),
|
|
}
|
|
|
|
return userSettingsStub
|
|
}
|