bstp-agent-widget 0.2.73 → 0.2.74
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.
- package/package.json +2 -1
- package/src/types/dto/api-error.ts +12 -0
- package/src/types/dto/genai-agent-message-request.dto.ts +12 -0
- package/src/types/dto/genai-agent-message-response.dto.ts +10 -0
- package/src/types/dto/genai-agent-reply.dto.ts +5 -0
- package/src/types/dto/genai-login-request.dto.ts +4 -0
- package/src/types/dto/genai-login.dto.ts +8 -0
- package/src/types/dto/genai-send-agent-message-request.dto.ts +5 -0
- package/src/types/dto/generic-error.ts +24 -0
- package/src/types/dto/keycloak-api-error.ts +4 -0
- package/src/types/dto/operation-result.ts +6 -0
- package/src/types/dto/page.ts +31 -0
- package/src/types/dto/permission.ts +7 -0
- package/src/types/dto/spring-error.ts +6 -0
- package/src/types/dto/user.ts +9 -0
- package/src/types/enums/markdown-renderer-response-type.ts +9 -0
- package/src/types/enums/markdown-renderer-visualization-type.ts +6 -0
- package/src/types/markdown-ui__react.d.ts +24 -0
- package/src/types/models/agent-chat-config.ts +49 -0
- package/src/types/models/agent-chat-runtime.ts +29 -0
- package/src/types/models/agent-chat-usage-chart-item.ts +12 -0
- package/src/types/models/agent-chat-widget-ui.ts +26 -0
- package/src/types/models/app-config.ts +46 -0
- package/src/types/models/app-feature-config.ts +3 -0
- package/src/types/models/base-button-props.ts +3 -0
- package/src/types/models/confirmation-modal-types.ts +34 -0
- package/src/types/models/create-genai-client-options.ts +5 -0
- package/src/types/models/error-types.ts +3 -0
- package/src/types/models/form-types.ts +63 -0
- package/src/types/models/growth-book-config.ts +5 -0
- package/src/types/models/hierarchy-item.ts +8 -0
- package/src/types/models/keycloak-extended.ts +18 -0
- package/src/types/models/logger-type.ts +32 -0
- package/src/types/models/meta.ts +13 -0
- package/src/types/models/nested-key-value.ts +6 -0
- package/src/types/models/party-role-token.ts +7 -0
- package/src/types/models/root-route-context.ts +7 -0
- package/src/types/models/v-table-sort-info.ts +14 -0
- package/src/types/models/v-table-types.ts +7 -0
- package/src/types/speech-recognition.d.ts +56 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bstp-agent-widget",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.74",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/agent-widget.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"README.md",
|
|
23
23
|
"src/lib/index.d.ts",
|
|
24
|
+
"src/types",
|
|
24
25
|
"dist/agent-widget.js",
|
|
25
26
|
"dist/agent-widget.js.map",
|
|
26
27
|
"dist/bstp-agent-widget.css",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Example:
|
|
3
|
+
{
|
|
4
|
+
"status": 400,
|
|
5
|
+
"type": "https://etiya.com/problems/bss/common/busines-validation",
|
|
6
|
+
"code": "BSN_INTER_ALREADY_EXIST",
|
|
7
|
+
"detail": "Some message",
|
|
8
|
+
"traceId": "acbd0001-7b8e-4e81-9d6b-3e34ce7c9a9e",
|
|
9
|
+
"errorId": 1746796609,
|
|
10
|
+
"timestamp": "2024-03-19T01:10:23.937+00:00",
|
|
11
|
+
"instance": "https://.../crm/v1/customer/12345"
|
|
12
|
+
}
|
|
13
|
+
*/
|
|
14
|
+
export interface GenericError {
|
|
15
|
+
status: number;
|
|
16
|
+
type: string;
|
|
17
|
+
code: string;
|
|
18
|
+
detail: string;
|
|
19
|
+
traceId: string;
|
|
20
|
+
errorId: number;
|
|
21
|
+
timestamp: string;
|
|
22
|
+
instance: string;
|
|
23
|
+
properties: Record<string, number | string | boolean>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export interface Page<T> {
|
|
3
|
+
content: T[];
|
|
4
|
+
pageable: Pageable;
|
|
5
|
+
last: boolean;
|
|
6
|
+
totalElements: number;
|
|
7
|
+
totalPages: number;
|
|
8
|
+
size: number;
|
|
9
|
+
number: number;
|
|
10
|
+
sort: Sort;
|
|
11
|
+
first: boolean;
|
|
12
|
+
numberOfElements: number;
|
|
13
|
+
empty: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** @public */
|
|
17
|
+
export interface Pageable {
|
|
18
|
+
sort: Sort;
|
|
19
|
+
offset: number;
|
|
20
|
+
pageSize: number;
|
|
21
|
+
pageNumber: number;
|
|
22
|
+
paged: boolean;
|
|
23
|
+
unpaged: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** @public */
|
|
27
|
+
export interface Sort {
|
|
28
|
+
sorted: boolean;
|
|
29
|
+
unsorted: boolean;
|
|
30
|
+
empty: boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export enum MarkdownRendererResponseType {
|
|
2
|
+
ACCOUNT_OVERVIEW = 'accountOverview',
|
|
3
|
+
CUSTOMER_PROFILE = 'customerProfile',
|
|
4
|
+
OFFER_RECOMMENDATION = 'offerRecommendation',
|
|
5
|
+
BASKET = 'basket',
|
|
6
|
+
USAGE_ANALYSIS = 'usageAnalysis',
|
|
7
|
+
TWIN_INSIGHT = 'twinInsight',
|
|
8
|
+
UNKNOWN = 'unknown',
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare module '@markdown-ui/react' {
|
|
2
|
+
export type WidgetEvent = {
|
|
3
|
+
type: string;
|
|
4
|
+
data?: Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function MarkdownUI(props: {
|
|
8
|
+
html: string;
|
|
9
|
+
onWidgetEvent?: (event: WidgetEvent) => void;
|
|
10
|
+
renderWidget?: (widgetData: unknown) => React.ReactNode;
|
|
11
|
+
}): JSX.Element;
|
|
12
|
+
|
|
13
|
+
export const ButtonGroup: unknown;
|
|
14
|
+
export const Chart: unknown;
|
|
15
|
+
export const Form: unknown;
|
|
16
|
+
export const Incomplete: unknown;
|
|
17
|
+
export const MultipleChoiceQuestion: unknown;
|
|
18
|
+
export const Quiz: unknown;
|
|
19
|
+
export const Select: unknown;
|
|
20
|
+
export const SelectMulti: unknown;
|
|
21
|
+
export const ShortAnswerQuestion: unknown;
|
|
22
|
+
export const Slider: unknown;
|
|
23
|
+
export const TextInput: unknown;
|
|
24
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type AgentChatAssistantConfig = {
|
|
2
|
+
assistantKey: string;
|
|
3
|
+
assistantId: number;
|
|
4
|
+
label: string;
|
|
5
|
+
initialMessage?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type AgentChatGenAiInit = {
|
|
9
|
+
email: string;
|
|
10
|
+
clientSecret: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type AgentChatConfigValue = {
|
|
14
|
+
assistantId: number;
|
|
15
|
+
assistants?: AgentChatAssistantConfig[];
|
|
16
|
+
genaiInit?: AgentChatGenAiInit;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type AgentChatConfigGetter = {
|
|
20
|
+
getAssistantId: () => number | null;
|
|
21
|
+
getAssistants?: () => AgentChatAssistantConfig[];
|
|
22
|
+
getGenaiInit?: () => AgentChatGenAiInit | null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type AgentChatConfig = AgentChatConfigValue | AgentChatConfigGetter;
|
|
26
|
+
|
|
27
|
+
export function resolveAssistantId(config: AgentChatConfig): number | null {
|
|
28
|
+
if ('assistantId' in config) return config.assistantId;
|
|
29
|
+
return config.getAssistantId();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function resolveAssistants(config: AgentChatConfig): AgentChatAssistantConfig[] {
|
|
33
|
+
if ('assistants' in config) return config.assistants ?? [];
|
|
34
|
+
return 'getAssistants' in config ? (config.getAssistants?.() ?? []) : [];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function resolveGenaiInit(config: AgentChatConfig): AgentChatGenAiInit | null {
|
|
38
|
+
if ('genaiInit' in config) return config.genaiInit ?? null;
|
|
39
|
+
return 'getGenaiInit' in config ? (config.getGenaiInit?.() ?? null) : null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function resolveInitialMessage(config: AgentChatConfig): string | null {
|
|
43
|
+
const assistantId = resolveAssistantId(config);
|
|
44
|
+
if (!assistantId) return null;
|
|
45
|
+
|
|
46
|
+
const assistants = resolveAssistants(config);
|
|
47
|
+
const assistant = assistants.find((a) => a.assistantId === assistantId);
|
|
48
|
+
return assistant?.initialMessage ?? null;
|
|
49
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type AgentChatRuntimeValue = {
|
|
2
|
+
customerId: string;
|
|
3
|
+
customerToken: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type AgentChatRuntimeGetter = {
|
|
8
|
+
getCustomerId: () => string | null;
|
|
9
|
+
getCustomerToken: () => string | null | Promise<string | null>;
|
|
10
|
+
getLanguage?: () => string | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type AgentChatRuntime = AgentChatRuntimeValue | AgentChatRuntimeGetter;
|
|
14
|
+
|
|
15
|
+
export function resolveCustomerId(runtime: AgentChatRuntime): string | null {
|
|
16
|
+
if ('customerId' in runtime) return runtime.customerId;
|
|
17
|
+
return runtime.getCustomerId();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function resolveCustomerToken(runtime: AgentChatRuntime): Promise<string | null> {
|
|
21
|
+
if ('customerToken' in runtime) return runtime.customerToken;
|
|
22
|
+
return runtime.getCustomerToken();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function resolveLanguage(runtime: AgentChatRuntime): string | null {
|
|
26
|
+
if ('language' in runtime) return runtime.language ?? null;
|
|
27
|
+
if ('getLanguage' in runtime && runtime.getLanguage) return runtime.getLanguage();
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type AgentChatWidgetUiOptions = {
|
|
2
|
+
/** Panel width in px */
|
|
3
|
+
panelWidth?: number;
|
|
4
|
+
/** Panel height in px or CSS value */
|
|
5
|
+
panelHeight?: number | string;
|
|
6
|
+
/** Panel header height in px */
|
|
7
|
+
panelHeaderHeight?: number;
|
|
8
|
+
/** Text shown in panel header title */
|
|
9
|
+
panelTitle?: string;
|
|
10
|
+
/** Accent color used by widget surfaces */
|
|
11
|
+
accentColor?: string;
|
|
12
|
+
/** FAB button bottom offset in px */
|
|
13
|
+
fabBottomOffset?: number;
|
|
14
|
+
/** FAB button top offset in px (takes precedence over bottom offset when provided) */
|
|
15
|
+
fabTopOffset?: number;
|
|
16
|
+
/** FAB button right offset in px */
|
|
17
|
+
fabRightOffset?: number;
|
|
18
|
+
/** FAB button left offset in px (takes precedence over right offset when provided) */
|
|
19
|
+
fabLeftOffset?: number;
|
|
20
|
+
/** FAB button label text */
|
|
21
|
+
fabButtonLabel?: string;
|
|
22
|
+
/** Widget z-index (affects both FAB and panel) */
|
|
23
|
+
zIndex?: number;
|
|
24
|
+
/** CSS selector for the host layout node that should reserve space for the widget */
|
|
25
|
+
hostContainerSelector?: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AppFeatureConfig } from './app-feature-config';
|
|
2
|
+
import { GrowthBookConfig } from './growth-book-config';
|
|
3
|
+
|
|
4
|
+
export interface AppConfig {
|
|
5
|
+
url: AppConfigUrl;
|
|
6
|
+
keycloak: AppConfigKeycloak;
|
|
7
|
+
features: AppFeatureConfig;
|
|
8
|
+
growthBook?: GrowthBookConfig;
|
|
9
|
+
genai?: AppConfigGenai;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface AppConfigUrl {
|
|
13
|
+
app: string;
|
|
14
|
+
api: string;
|
|
15
|
+
apiPaths: ApiPathsConfig;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ApiPathsConfig {
|
|
19
|
+
crm: string;
|
|
20
|
+
uiAuthz: string;
|
|
21
|
+
genai?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface AppConfigKeycloak {
|
|
25
|
+
url: string;
|
|
26
|
+
realm: string;
|
|
27
|
+
clientId: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface AppConfigGenaiAssistant {
|
|
31
|
+
assistantKey: string;
|
|
32
|
+
assistantId: number;
|
|
33
|
+
label: string;
|
|
34
|
+
initialMessage?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface AppConfigGenai {
|
|
38
|
+
config: {
|
|
39
|
+
assistantId: number;
|
|
40
|
+
agents?: AppConfigGenaiAssistant[];
|
|
41
|
+
};
|
|
42
|
+
init: {
|
|
43
|
+
email: string;
|
|
44
|
+
clientSecret: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ExtendedButtonVariant } from '@/type-augmentation';
|
|
2
|
+
import { ModalProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export type ConfirmationModalVariant = 'danger' | 'warning' | 'info' | 'success';
|
|
6
|
+
|
|
7
|
+
export interface ModalTitleProps {
|
|
8
|
+
title: string;
|
|
9
|
+
variant: ConfirmationModalVariant;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface BaseConfirmationModalProps {
|
|
13
|
+
modalId?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
onConfirm?: () => void;
|
|
17
|
+
onCancel?: () => void;
|
|
18
|
+
variant?: ConfirmationModalVariant;
|
|
19
|
+
confirmButtonVariant?: ExtendedButtonVariant;
|
|
20
|
+
cancelButtonVariant?: ExtendedButtonVariant;
|
|
21
|
+
confirmLabel?: string;
|
|
22
|
+
cancelLabel?: string;
|
|
23
|
+
confirmButtonVisible?: boolean;
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
autoCloseOnConfirm?: boolean;
|
|
27
|
+
size?: ModalProps['size'];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ShowConfirmationModalReturnType {
|
|
31
|
+
modalId: string;
|
|
32
|
+
closeModal: () => void;
|
|
33
|
+
updateModal: (props: Partial<BaseConfirmationModalProps>) => void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// oxlint-disable no-explicit-any
|
|
2
|
+
import type { BaseFieldComponents } from '@/hooks/useAppFormSetup';
|
|
3
|
+
import type {
|
|
4
|
+
AppFieldExtendedReactFormApi,
|
|
5
|
+
FormApi,
|
|
6
|
+
FormAsyncValidateOrFn,
|
|
7
|
+
FormValidateOrFn,
|
|
8
|
+
FormValidators,
|
|
9
|
+
} from '@tanstack/react-form';
|
|
10
|
+
import { ComponentType } from 'react';
|
|
11
|
+
import { BaseIssue, BaseSchema, InferOutput, ObjectSchema } from 'valibot';
|
|
12
|
+
|
|
13
|
+
export type FormValidatorsType<TSchema extends BaseSchema<any, any, BaseIssue<any>>> = FormValidators<
|
|
14
|
+
InferOutput<TSchema>,
|
|
15
|
+
FormValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
16
|
+
FormValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
17
|
+
FormAsyncValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
18
|
+
FormValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
19
|
+
FormAsyncValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
20
|
+
FormValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
21
|
+
FormAsyncValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
22
|
+
FormValidateOrFn<InferOutput<TSchema>> | undefined,
|
|
23
|
+
FormAsyncValidateOrFn<InferOutput<TSchema>> | undefined
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export type GenericObjectSchema = ObjectSchema<any, any>;
|
|
27
|
+
|
|
28
|
+
/** @public */
|
|
29
|
+
export type GenericAppFieldExtendedReactFormApi<
|
|
30
|
+
T,
|
|
31
|
+
TSubmitMeta = never,
|
|
32
|
+
TFieldComponents extends Record<string, ComponentType<any>> = BaseFieldComponents,
|
|
33
|
+
TFormComponents extends Record<string, ComponentType<any>> = Record<string, never>,
|
|
34
|
+
> = AppFieldExtendedReactFormApi<
|
|
35
|
+
T,
|
|
36
|
+
FormValidateOrFn<T> | undefined,
|
|
37
|
+
FormValidateOrFn<T> | undefined,
|
|
38
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
39
|
+
FormValidateOrFn<T> | undefined,
|
|
40
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
41
|
+
FormValidateOrFn<T> | undefined,
|
|
42
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
43
|
+
FormValidateOrFn<T> | undefined,
|
|
44
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
45
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
46
|
+
TSubmitMeta,
|
|
47
|
+
TFieldComponents,
|
|
48
|
+
TFormComponents
|
|
49
|
+
>;
|
|
50
|
+
|
|
51
|
+
export type GenericFormApi<T> = FormApi<
|
|
52
|
+
T,
|
|
53
|
+
FormValidateOrFn<T> | undefined,
|
|
54
|
+
FormValidateOrFn<T> | undefined,
|
|
55
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
56
|
+
FormValidateOrFn<T> | undefined,
|
|
57
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
58
|
+
FormValidateOrFn<T> | undefined,
|
|
59
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
60
|
+
FormValidateOrFn<T> | undefined,
|
|
61
|
+
FormAsyncValidateOrFn<T> | undefined,
|
|
62
|
+
FormAsyncValidateOrFn<T> | undefined
|
|
63
|
+
>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type Keycloak from 'keycloak-js';
|
|
2
|
+
import type { KeycloakTokenParsed } from 'keycloak-js';
|
|
3
|
+
import { PartyRoleToken } from './party-role-token';
|
|
4
|
+
|
|
5
|
+
export interface KeycloakTokenParsedExtended extends KeycloakTokenParsed {
|
|
6
|
+
mainSub: string;
|
|
7
|
+
name: string;
|
|
8
|
+
partyId: number;
|
|
9
|
+
partyRoles: PartyRoleToken[];
|
|
10
|
+
partyRoleType: string;
|
|
11
|
+
preferred_username: string;
|
|
12
|
+
saleChannelCode: string;
|
|
13
|
+
locale: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface KeycloakExtended extends Keycloak {
|
|
17
|
+
tokenParsed: KeycloakTokenParsedExtended;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
2
|
+
|
|
3
|
+
export interface LogEntry {
|
|
4
|
+
'@timestamp': string;
|
|
5
|
+
message: string;
|
|
6
|
+
logger_name: string;
|
|
7
|
+
level: LogLevel;
|
|
8
|
+
level_value: number;
|
|
9
|
+
applicationName: string;
|
|
10
|
+
traceId: string;
|
|
11
|
+
spanId: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface LoggerOptions {
|
|
16
|
+
name: string;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
minLogLevel?: LogLevel;
|
|
19
|
+
additionalFields?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface LoggerConfig {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
minLogLevel: LogLevel;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const LOG_LEVEL_VALUES: Record<LogLevel, number> = {
|
|
28
|
+
DEBUG: 10000,
|
|
29
|
+
INFO: 20000,
|
|
30
|
+
WARN: 30000,
|
|
31
|
+
ERROR: 40000,
|
|
32
|
+
} as const;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { I18n } from '@lingui/core';
|
|
2
|
+
|
|
3
|
+
export type MetaObject =
|
|
4
|
+
| {
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
| { name: string; content: string }
|
|
8
|
+
| { property: string; content: string };
|
|
9
|
+
|
|
10
|
+
export type MetaFunction<T extends Record<string, unknown> = Record<string, unknown>> = (
|
|
11
|
+
i18n: I18n,
|
|
12
|
+
args?: Partial<T>,
|
|
13
|
+
) => MetaObject[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnSortingValues } from '@/enums/column-sorting-values.enum';
|
|
2
|
+
import { ComboboxItem } from '@mantine/core';
|
|
3
|
+
|
|
4
|
+
export interface VTableSortInfo {
|
|
5
|
+
field: string;
|
|
6
|
+
direction: ColumnSortingValues;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Sorting configuration for VTable - use with useUrlMetadata hook */
|
|
10
|
+
export interface VTableSorting {
|
|
11
|
+
sortState: VTableSortInfo | null;
|
|
12
|
+
sortOptions: ComboboxItem[];
|
|
13
|
+
onServerSort: (sortInfo: VTableSortInfo) => void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
interface SpeechRecognitionEvent extends Event {
|
|
2
|
+
readonly resultIndex: number;
|
|
3
|
+
readonly results: SpeechRecognitionResultList;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface SpeechRecognitionResultList {
|
|
7
|
+
readonly length: number;
|
|
8
|
+
item(index: number): SpeechRecognitionResult;
|
|
9
|
+
[index: number]: SpeechRecognitionResult;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface SpeechRecognitionResult {
|
|
13
|
+
readonly isFinal: boolean;
|
|
14
|
+
readonly length: number;
|
|
15
|
+
item(index: number): SpeechRecognitionAlternative;
|
|
16
|
+
[index: number]: SpeechRecognitionAlternative;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface SpeechRecognitionAlternative {
|
|
20
|
+
readonly transcript: string;
|
|
21
|
+
readonly confidence: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface SpeechRecognitionErrorEvent extends Event {
|
|
25
|
+
readonly error: string;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface SpeechRecognition extends EventTarget {
|
|
30
|
+
lang: string;
|
|
31
|
+
continuous: boolean;
|
|
32
|
+
interimResults: boolean;
|
|
33
|
+
maxAlternatives: number;
|
|
34
|
+
start(): void;
|
|
35
|
+
stop(): void;
|
|
36
|
+
abort(): void;
|
|
37
|
+
onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => void) | null;
|
|
38
|
+
onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => void) | null;
|
|
39
|
+
onend: ((this: SpeechRecognition, ev: Event) => void) | null;
|
|
40
|
+
onstart: ((this: SpeechRecognition, ev: Event) => void) | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare var SpeechRecognition: {
|
|
44
|
+
prototype: SpeechRecognition;
|
|
45
|
+
new (): SpeechRecognition;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
declare var webkitSpeechRecognition: {
|
|
49
|
+
prototype: SpeechRecognition;
|
|
50
|
+
new (): SpeechRecognition;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
interface Window {
|
|
54
|
+
SpeechRecognition: typeof SpeechRecognition;
|
|
55
|
+
webkitSpeechRecognition: typeof webkitSpeechRecognition;
|
|
56
|
+
}
|