@dialob/composer-material 0.0.15 → 0.0.16

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.
@@ -18,7 +18,7 @@ import { VisibilityField } from '../items/ItemComponents';
18
18
 
19
19
  declare interface ApiResponse {
20
20
  success: boolean;
21
- result?: SaveResult | DuplicateResult | CreateTagResult | ChangeIdResult | CreateSessionResult;
21
+ result?: SaveResult | DuplicateResult | CreateTagResult | ChangeIdResult | CreateSessionResult | TranslationResponse;
22
22
  apiError?: any;
23
23
  }
24
24
 
@@ -32,6 +32,7 @@ declare interface AppConfig {
32
32
  tenantId: string;
33
33
  credentialMode: RequestCredentials;
34
34
  version: string;
35
+ translationServiceUrl?: string;
35
36
  }
36
37
 
37
38
  declare interface BackendState {
@@ -47,6 +48,7 @@ declare interface BackendState {
47
48
  getTags(formName: string): Promise<ComposerTag[]>;
48
49
  changeItemId(form: ComposerState, oldId: string, newId: string): Promise<ApiResponse>;
49
50
  createPreviewSession(formId: string, language: string, context?: PreviewSessionContext): Promise<ApiResponse>;
51
+ translateEntries(request: TranslationRequest): Promise<ApiResponse>;
50
52
  }
51
53
 
52
54
  declare namespace BackendTypes {
@@ -63,6 +65,10 @@ declare namespace BackendTypes {
63
65
  TransportConfig,
64
66
  DialobComposerConfig,
65
67
  AppConfig,
68
+ TranslationEntry,
69
+ TranslationRequest,
70
+ TranslationResult,
71
+ TranslationResponse,
66
72
  BackendState
67
73
  }
68
74
  }
@@ -129,6 +135,7 @@ declare type ComposerMetadata = {
129
135
  contextValues?: {
130
136
  [name: string]: string;
131
137
  };
138
+ aiTranslations?: TranslationMetadata[];
132
139
  };
133
140
 
134
141
  declare type ComposerState = {
@@ -253,6 +260,7 @@ declare interface DialobComposerConfig {
253
260
  itemTypes: ItemTypeConfig;
254
261
  backendVersion: string;
255
262
  closeHandler: () => void;
263
+ translationServiceUrl?: string;
256
264
  }
257
265
 
258
266
  declare type DialobItem = DialobItemTemplate & {
@@ -300,6 +308,7 @@ declare namespace DialobTypes {
300
308
  DialobItems,
301
309
  VisibilityType,
302
310
  ComposerTag,
311
+ TranslationMetadata,
303
312
  ComposerMetadata,
304
313
  ComposerState,
305
314
  FormMetadata,
@@ -393,10 +402,7 @@ export declare const GlobalList: default_2.FC<{
393
402
  entries?: ValueSetEntry[];
394
403
  }>;
395
404
 
396
- export declare const GlobalListsDialog: default_2.FC<{
397
- open: boolean;
398
- onClose: () => void;
399
- }>;
405
+ export declare const GlobalListsDialog: default_2.FC;
400
406
 
401
407
  export declare const Group: default_2.FC<{
402
408
  item: DialobItem;
@@ -576,8 +582,36 @@ export declare const TranslationDialog: default_2.FC<{
576
582
  onClose: () => void;
577
583
  }>;
578
584
 
585
+ declare interface TranslationEntry {
586
+ id: string;
587
+ text: string;
588
+ }
589
+
579
590
  export declare const TranslationFileEditor: default_3.FC;
580
591
 
592
+ declare type TranslationMetadata = {
593
+ entryId: string;
594
+ sourceLanguage: string;
595
+ targetLanguage: string;
596
+ timestamp: string;
597
+ };
598
+
599
+ declare interface TranslationRequest {
600
+ sourceLanguage: string;
601
+ targetLanguage: string;
602
+ entries: TranslationEntry[];
603
+ }
604
+
605
+ declare interface TranslationResponse {
606
+ translations: TranslationResult[];
607
+ targetLanguage: string;
608
+ }
609
+
610
+ declare interface TranslationResult {
611
+ id: string;
612
+ translatedText: string;
613
+ }
614
+
581
615
  declare interface TransportConfig {
582
616
  csrf?: {
583
617
  headerName: string;
@@ -646,6 +680,8 @@ export declare const useComposer: () => {
646
680
  applyListChanges: (newState: SavingState) => void;
647
681
  applyVariableChanges: (newState: SavingState) => void;
648
682
  applyFormChanges: (newState: SavingState) => void;
683
+ applyTranslations: (translations: TranslationResult[], sourceLanguage: string, targetLanguage: string) => void;
684
+ removeAITranslation: (entryId: string, targetLanguage: string) => void;
649
685
  form: ComposerState;
650
686
  };
651
687