gentiq 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ import { RechargeIntervalUnit } from './api';
2
+ /**
3
+ * The default first-renewal anchor when the admin leaves it blank.
4
+ *
5
+ * Snaps to the next round boundary of the interval unit in the admin's **local** time
6
+ * (an hourly policy at 15:32 → 16:00, a daily one → next local midnight, a monthly one →
7
+ * the 1st of next month). Computed in the browser rather than the backend so "00:00" means
8
+ * the admin's wall-clock midnight, not 00:00 UTC. Returned as a UTC ISO instant.
9
+ */
10
+ export declare function nextRoundAnchor(unit: RechargeIntervalUnit, from?: Date): string;
@@ -1,4 +1,4 @@
1
1
  import { MessageListProps } from '../types';
2
- export declare function MessageList({ messages, status, isLoadingHistory, error, conversationId, regen, onSuggestionClick, chat, className, readonly, }: MessageListProps & {
2
+ export declare function MessageList({ messages, status, isLoadingHistory, error, conversationId, regen, chat, className, readonly, }: MessageListProps & {
3
3
  className?: string;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,9 @@ interface PromptInputAreaProps {
6
6
  stop: () => void;
7
7
  isErrorVisible: boolean;
8
8
  conversationId?: string;
9
+ /** When true, this is the centered new-chat composer (animated placeholder). */
10
+ newChat?: boolean;
9
11
  className?: string;
10
12
  }
11
- export declare function PromptInputArea({ onSend, status, isLastMessageFinished, stop, isErrorVisible, conversationId, className, }: PromptInputAreaProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function PromptInputArea({ onSend, status, isLastMessageFinished, stop, isErrorVisible, conversationId, newChat, className, }: PromptInputAreaProps): import("react/jsx-runtime").JSX.Element;
12
14
  export {};
@@ -1,7 +1,14 @@
1
1
  import { LucideIcon } from 'lucide-react';
2
2
  interface WelcomeScreenProps {
3
- onSuggestionClick: (suggestion: string) => void;
3
+ /** Retained for API compatibility with custom WelcomeScreen overrides. */
4
+ onSuggestionClick?: (suggestion: string) => void;
4
5
  icons?: LucideIcon[];
5
6
  }
6
- export declare const WelcomeScreen: ({ onSuggestionClick, icons }: WelcomeScreenProps) => import("react/jsx-runtime").JSX.Element;
7
+ /**
8
+ * The new-chat header: an optional brand icon, the (optionally personalized)
9
+ * title and an optional static subtitle. Rendered directly above the centered
10
+ * composer. The rotating typing-effect messages now live in the composer's
11
+ * placeholder rather than here.
12
+ */
13
+ export declare const WelcomeScreen: (_props: WelcomeScreenProps) => import("react/jsx-runtime").JSX.Element;
7
14
  export {};
@@ -0,0 +1,20 @@
1
+ export interface UseTypewriterOptions {
2
+ /** Milliseconds between typing each character. */
3
+ typingSpeed?: number;
4
+ /** Milliseconds between erasing each character. */
5
+ deletingSpeed?: number;
6
+ /** How long a fully typed message is held before erasing. */
7
+ pauseMs?: number;
8
+ /** Delay before the very first character is typed. */
9
+ startDelayMs?: number;
10
+ }
11
+ /**
12
+ * Drives a typewriter effect that loops through a list of messages:
13
+ * type → pause → erase → next, forever.
14
+ *
15
+ * Respects `prefers-reduced-motion` by swapping whole messages on an interval
16
+ * instead of animating character-by-character.
17
+ *
18
+ * @returns The text to render for the current frame.
19
+ */
20
+ export declare function useTypewriter(messages: string[], options?: UseTypewriterOptions): string;
@@ -0,0 +1,28 @@
1
+ import { ReactNode } from 'react';
2
+ import { LucideIcon } from 'lucide-react';
3
+ export interface UseWelcomeContentOptions {
4
+ /**
5
+ * Set to false to skip resolving dynamic (user-conditioned) content, e.g. when
6
+ * the consumer only needs typing messages on the new-chat screen.
7
+ */
8
+ enabled?: boolean;
9
+ }
10
+ export interface WelcomeContent {
11
+ /** Resolved welcome title/greeting. */
12
+ title: string | null;
13
+ /** Resolved static subtitle, if configured. */
14
+ subtitle: string | null;
15
+ /** Translated rotating typewriter messages (empty when none configured). */
16
+ typingMessages: string[];
17
+ /** Whether the current language renders right-to-left. */
18
+ isRtl: boolean;
19
+ /** Optional welcome icon. */
20
+ icon: LucideIcon | ReactNode | undefined;
21
+ }
22
+ /**
23
+ * Resolves the welcome-screen configuration (greeting, subtitle, icon and the
24
+ * rotating typewriter messages) into ready-to-render values. Shared by the
25
+ * new-chat header and the composer's animated placeholder so the resolution
26
+ * logic lives in one place.
27
+ */
28
+ export declare function useWelcomeContent({ enabled, }?: UseWelcomeContentOptions): WelcomeContent;
@@ -24,5 +24,6 @@ export { default as UserLoginPage } from './pages/UserLoginPage';
24
24
  export { default as SharedChatView } from './pages/SharedChatView';
25
25
  export { useGentiqChat } from './hooks/useGentiqChat';
26
26
  export { useGentiqUser, type UseGentiqUserOptions } from './hooks/useGentiqUser';
27
+ export { useTypewriter, type UseTypewriterOptions } from './hooks/useTypewriter';
27
28
  export { useComponents } from './ComponentsContext';
28
29
  export { useTranslation, withTranslation, Translation, Trans } from 'react-i18next';
@@ -2,4 +2,17 @@ import { ChoiceQuestion, ChoiceQuestionPartProps } from '../types';
2
2
  export type { ChoiceQuestionPartProps } from '../types';
3
3
  export declare function normalizeChoiceQuestion(data: unknown): ChoiceQuestion | null;
4
4
  export declare function extractChoiceQuestionFromText(text: string | undefined): ChoiceQuestion | null;
5
+ export type ChoiceQuestionSegment = {
6
+ type: 'text';
7
+ text: string;
8
+ } | {
9
+ type: 'choice-question';
10
+ question: ChoiceQuestion;
11
+ };
12
+ /**
13
+ * Split a text part into an ordered sequence of prose and choice-question
14
+ * segments. Text appearing before, between, and after choice-question markers
15
+ * is preserved so nothing is dropped when a message interleaves prose and cards.
16
+ */
17
+ export declare function splitChoiceQuestionSegments(text: string | undefined): ChoiceQuestionSegment[];
5
18
  export declare function ChoiceQuestionPart({ part, disabled, onAnswer }: ChoiceQuestionPartProps): import("react/jsx-runtime").JSX.Element | null;
@@ -322,15 +322,6 @@ export interface HistoryConfig {
322
322
  /** Whether to show the pin action for threads. */
323
323
  showPin?: boolean;
324
324
  }
325
- /**
326
- * A suggested prompt to display on the welcome screen.
327
- */
328
- export interface WelcomeSuggestion {
329
- /** The text of the suggestion. */
330
- text: string;
331
- /** Optional icon to display alongside the text. */
332
- icon?: LucideIcon;
333
- }
334
325
  /**
335
326
  * Configuration for the welcome/empty-state screen.
336
327
  */
@@ -342,8 +333,13 @@ export interface WelcomeScreenConfig {
342
333
  greeting?: string | ((context: WelcomeGreetingContext) => string);
343
334
  /** Optional override for the welcome message subtitle. */
344
335
  subtitle?: string;
345
- /** Optional override for the starter prompt suggestions. */
346
- prompts?: (string | WelcomeSuggestion)[];
336
+ /**
337
+ * Dynamic rotating subtitle messages rendered with a typewriter effect.
338
+ * When set (and non-empty) this REPLACES the static `subtitle`. Accepts a
339
+ * static array or a function receiving the authenticated user, allowing the
340
+ * messages to be conditioned on user info.
341
+ */
342
+ typingPrompts?: string[] | ((context: WelcomeGreetingContext) => string[]);
347
343
  /** Optional override for the icon displayed on the welcome screen. Defaults to null. */
348
344
  icon?: LucideIcon | ReactNode;
349
345
  }
@@ -761,6 +757,8 @@ export interface PromptInputProps {
761
757
  isErrorVisible: boolean;
762
758
  /** The current conversation thread ID. */
763
759
  conversationId?: string;
760
+ /** Whether this is the centered new-chat composer (enables the animated placeholder). */
761
+ newChat?: boolean;
764
762
  /** Custom CSS class names. */
765
763
  className?: string;
766
764
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "provenance": true
11
11
  },
12
12
  "description": "React UI library for the Gentiq AI framework.",
13
- "version": "0.10.0",
13
+ "version": "0.10.2",
14
14
  "type": "module",
15
15
  "files": [
16
16
  "dist"