RemoteConfig constructor

const RemoteConfig({
  1. required LocalizedText name,
  2. @JsonKey.new(name: 'welcome_message') required LocalizedText welcomeMessage,
  3. @JsonKey.new(name: 'system_instruction') required LocalizedText systemInstruction,
  4. @JsonKey.new(name: 'default_locale') @Default.new('en') String defaultLocale,
  5. @JsonKey.new(name: 'supported_locales') @Default.new(['en']) List<String> supportedLocales,
  6. @JsonKey.new(name: 'font_family') String? fontFamily,
  7. String? color,
  8. String? avatar,
  9. @JsonKey.new(name: 'fab_configuration') FabConfiguration? fabConfiguration,
  10. @JsonKey.new(name: 'chat_appearance') ChatAppearance? chatAppearance,
  11. @JsonKey.new(name: 'chat_appearance_dark') ChatAppearance? chatAppearanceDark,
  12. @JsonKey.new(name: 'show_theme_toggle') @Default.new(true) bool showThemeToggle,
  13. @JsonKey.new(name: 'default_theme_mode') @Default.new('system') String defaultThemeMode,
  14. @JsonKey.new(name: 'sound_configuration') SoundConfiguration? soundConfiguration,
  15. @JsonKey.new(name: 'enable_user_export') @Default.new(true) bool enableUserExport,
  16. @JsonKey.new(name: 'enable_clear_history') @Default.new(true) bool enableClearHistory,
  17. @JsonKey.new(name: 'enable_file_attach') @Default.new(true) bool enableFileAttach,
  18. @JsonKey.new(name: 'dynamic_language_enabled') @Default.new(false) bool dynamicLanguageEnabled,
  19. @JsonKey.new(name: 'ai_disclosure_enabled') @Default.new(true) bool aiDisclosureEnabled,
  20. @JsonKey.new(name: 'ai_disclosure_text') LocalizedText? aiDisclosureText,
  21. @JsonKey.new(name: 'ai_disclosure_require_ack') @Default.new(false) bool aiDisclosureRequireAck,
  22. @JsonKey.new(name: 'message_reporting_enabled') @Default.new(true) bool messageReportingEnabled,
  23. @JsonKey.new(name: 'ai_info_url') String? aiInfoUrl,
  24. @JsonKey.new(name: 'privacy_url') String? privacyUrl,
  25. @JsonKey.new(name: 'ai_data_reuse_notice') @Default.new(false) bool aiDataReuseNotice,
})

Implementation

const factory RemoteConfig({
  /// Bot display name from server (localized).
  required LocalizedText name,

  /// Welcome message from server configuration (localized).
  // ignore: invalid_annotation_target
  @JsonKey(name: 'welcome_message') required LocalizedText welcomeMessage,

  /// System instructions from server (localized).
  // ignore: invalid_annotation_target
  @JsonKey(name: 'system_instruction')
  required LocalizedText systemInstruction,

  /// Default locale from server
  // ignore: invalid_annotation_target
  @JsonKey(name: 'default_locale') @Default('en') String defaultLocale,

  /// Supported locales from server
  // ignore: invalid_annotation_target
  @JsonKey(name: 'supported_locales')
  @Default(['en'])
  List<String> supportedLocales,

  /// Font family setting from server. The backend emits snake_case
  /// `font_family`; without this JSONKey the generated parser would read
  /// `fontFamily` and always get null, silently falling back to 'Roboto'
  /// no matter what font the tenant configured.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'font_family') String? fontFamily,

  /// Primary color setting from server.
  String? color,

  /// Avatar URL or data from server.
  String? avatar,

  /// FAB configuration from server.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'fab_configuration') FabConfiguration? fabConfiguration,

  /// Chat-surface appearance from server. When present, fields
  /// override the SDK's MD3 defaults; when null/missing, the SDK
  /// uses the ambient [ColorScheme].
  // ignore: invalid_annotation_target
  @JsonKey(name: 'chat_appearance') ChatAppearance? chatAppearance,

  /// Dark-mode chat-surface appearance. Picked when the active theme
  /// brightness is dark; null/missing → the SDK's MD3 dark defaults.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'chat_appearance_dark') ChatAppearance? chatAppearanceDark,

  /// Server gate for the light/dark theme switcher in the more-options
  /// menu. When false the switcher is hidden; the host-supplied
  /// [BotConfiguration] value still wins per the standard precedence.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'show_theme_toggle') @Default(true) bool showThemeToggle,

  /// Initial theme mode before the user overrides it locally — one of
  /// 'light', 'dark', or 'system' (follows the host device brightness).
  // ignore: invalid_annotation_target
  @JsonKey(name: 'default_theme_mode')
  @Default('system')
  String defaultThemeMode,

  /// Per-event sound config from server. Was previously dropped from
  /// RemoteConfig (so dashboard sound settings only affected the live
  /// preview, not the deployed widget) — now parsed so the canonical
  /// config path carries it too.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'sound_configuration')
  SoundConfiguration? soundConfiguration,

  /// Server-side gate for the in-chat "Export chat" menu item.
  /// Hosts can toggle this from the dashboard to hide the action
  /// without redeploying the widget. Defaults true to match the
  /// chat-side default; the host-supplied [BotConfiguration] value
  /// still wins per the standard precedence rules.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'enable_user_export') @Default(true) bool enableUserExport,

  /// Server-side gate for the in-chat "Clear chat history" menu item.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'enable_clear_history')
  @Default(true)
  bool enableClearHistory,

  /// Server-side gate for the paperclip attach button in chat input.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'enable_file_attach') @Default(true) bool enableFileAttach,

  /// Server gate for the live AI language switch + manual picker.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'dynamic_language_enabled')
  @Default(false)
  bool dynamicLanguageEnabled,

  /// Server gate for the in-chat AI disclosure notice.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'ai_disclosure_enabled')
  @Default(true)
  bool aiDisclosureEnabled,

  /// Per-locale disclosure text (null = SDK default).
  // ignore: invalid_annotation_target
  @JsonKey(name: 'ai_disclosure_text') LocalizedText? aiDisclosureText,

  /// Whether the disclosure requires a one-time acknowledgement.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'ai_disclosure_require_ack')
  @Default(false)
  bool aiDisclosureRequireAck,

  /// Server gate for the in-chat message report ("Bad response") flow.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'message_reporting_enabled')
  @Default(true)
  bool messageReportingEnabled,

  /// "Learn more" About-AI link.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'ai_info_url') String? aiInfoUrl,

  /// Privacy page link (fallback "Learn more").
  // ignore: invalid_annotation_target
  @JsonKey(name: 'privacy_url') String? privacyUrl,

  /// Whether to show the data-reuse notice line.
  // ignore: invalid_annotation_target
  @JsonKey(name: 'ai_data_reuse_notice')
  @Default(false)
  bool aiDataReuseNotice,
}) = _RemoteConfig;