@easyling/sanity-connector 1.3.0 → 2.0.0

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.
Files changed (68) hide show
  1. package/README.md +570 -68
  2. package/dist/index.js +2 -1
  3. package/dist/index.js.map +1 -0
  4. package/package.json +38 -54
  5. package/LICENSE +0 -21
  6. package/dist/.tsbuildinfo +0 -1
  7. package/dist-types/actions/bulkTranslate.d.ts +0 -6
  8. package/dist-types/actions/manageDNTFields.d.ts +0 -11
  9. package/dist-types/actions/translateDocument.d.ts +0 -6
  10. package/dist-types/components/RadioWithDefault.d.ts +0 -16
  11. package/dist-types/components/auth/AuthNavbar.d.ts +0 -17
  12. package/dist-types/components/auth/AuthStatus.d.ts +0 -26
  13. package/dist-types/components/auth/AuthStatusWrapper.d.ts +0 -14
  14. package/dist-types/components/auth/MigrationPrompt.d.ts +0 -19
  15. package/dist-types/components/auth/MigrationPromptWrapper.d.ts +0 -13
  16. package/dist-types/components/auth/OAuthCallback.d.ts +0 -19
  17. package/dist-types/components/auth/index.d.ts +0 -14
  18. package/dist-types/components/config/LocaleConfigTool.d.ts +0 -16
  19. package/dist-types/components/config/LocaleConfigToolWrapper.d.ts +0 -12
  20. package/dist-types/components/config/OAuthConfig.d.ts +0 -25
  21. package/dist-types/components/config/OAuthConfigWrapper.d.ts +0 -12
  22. package/dist-types/components/config/PasswordInput.d.ts +0 -13
  23. package/dist-types/components/config/index.d.ts +0 -8
  24. package/dist-types/components/config/localeConfigToolDefinition.d.ts +0 -12
  25. package/dist-types/components/config/oauthConfigToolDefinition.d.ts +0 -12
  26. package/dist-types/components/dialogs/ConfirmationDialog.d.ts +0 -20
  27. package/dist-types/components/dialogs/ErrorDialog.d.ts +0 -20
  28. package/dist-types/components/dialogs/LocaleSelectionDialog.d.ts +0 -40
  29. package/dist-types/components/dialogs/SuccessDialog.d.ts +0 -18
  30. package/dist-types/components/dialogs/index.d.ts +0 -11
  31. package/dist-types/components/dnt/DNTFieldBadge.d.ts +0 -15
  32. package/dist-types/components/dnt/DNTFieldComponent.d.ts +0 -16
  33. package/dist-types/components/dnt/DNTFieldInput.d.ts +0 -13
  34. package/dist-types/components/dnt/DebugDNTBadge.d.ts +0 -19
  35. package/dist-types/components/dnt/index.d.ts +0 -7
  36. package/dist-types/config/index.d.ts +0 -5
  37. package/dist-types/config/pluginConfig.d.ts +0 -162
  38. package/dist-types/index.d.ts +0 -11
  39. package/dist-types/plugin.d.ts +0 -12
  40. package/dist-types/services/authStateManager.d.ts +0 -93
  41. package/dist-types/services/contentExtractor.d.ts +0 -161
  42. package/dist-types/services/dialogService.d.ts +0 -95
  43. package/dist-types/services/dntServiceManager.d.ts +0 -43
  44. package/dist-types/services/dntStorageAdapter.d.ts +0 -72
  45. package/dist-types/services/documentCreationService.d.ts +0 -196
  46. package/dist-types/services/localeService.d.ts +0 -159
  47. package/dist-types/services/localeStorageAdapter.d.ts +0 -41
  48. package/dist-types/services/oauthConfigStorage.d.ts +0 -45
  49. package/dist-types/services/oauthService.d.ts +0 -47
  50. package/dist-types/services/oauthServiceManager.d.ts +0 -195
  51. package/dist-types/services/tokenStorage.d.ts +0 -53
  52. package/dist-types/services/translationService.d.ts +0 -385
  53. package/dist-types/services/unifiedConfigStorage.d.ts +0 -133
  54. package/dist-types/test-utils.d.ts +0 -8
  55. package/dist-types/types/dialog.d.ts +0 -106
  56. package/dist-types/types/dnt.d.ts +0 -83
  57. package/dist-types/types/index.d.ts +0 -11
  58. package/dist-types/types/locale.d.ts +0 -115
  59. package/dist-types/types/oauth.d.ts +0 -89
  60. package/dist-types/types/pluginConfig.d.ts +0 -46
  61. package/dist-types/types/translation.d.ts +0 -121
  62. package/dist-types/utils/dntDefaults.d.ts +0 -101
  63. package/dist-types/utils/htmlFormatter.d.ts +0 -65
  64. package/dist-types/utils/index.d.ts +0 -16
  65. package/dist-types/utils/logger.d.ts +0 -104
  66. package/dist-types/utils/oauthErrorFeedback.d.ts +0 -75
  67. package/dist-types/utils/oauthLogger.d.ts +0 -175
  68. package/dist-types/utils/validator.d.ts +0 -66
@@ -1,161 +0,0 @@
1
- import { SanityDocument } from 'sanity';
2
- export interface DocumentContent {
3
- documentId: string;
4
- title: string;
5
- htmlContent: string;
6
- }
7
- export interface ExtendedDocumentContent extends DocumentContent {
8
- slug?: string;
9
- /** Fields can be either flat values or TranslatableField objects with value and dnt properties */
10
- fields?: Record<string, any>;
11
- /** Whether the title was found at the document's top level (false if extracted from nested fields) */
12
- titleFoundAtTopLevel?: boolean;
13
- /** Whether the body/content was found at the document's top level (false if extracted from nested fields) */
14
- bodyFoundAtTopLevel?: boolean;
15
- /** The field name where body content was found (e.g., 'body', 'content', 'text', or nested path) */
16
- bodyFieldName?: string;
17
- }
18
- export interface ExtractedContent {
19
- documentId: string;
20
- documentType: string;
21
- title: string;
22
- htmlContent: string;
23
- extractedAt: Date;
24
- }
25
- export declare class ContentExtractor {
26
- /**
27
- * Infer the Sanity field type from a value
28
- *
29
- * @param value - The field value to inspect
30
- * @returns The inferred Sanity type string
31
- */
32
- private inferSanityType;
33
- /**
34
- * Check if a value is an atomic Sanity type that should NOT be recursively flattened
35
- * These include types like slug, date, datetime, reference, image, file, etc.
36
- * Custom object types (e.g., articleInfo, footnoteInfo) are NOT atomic and should be flattened
37
- */
38
- private isSanitySpecialType;
39
- /**
40
- * Check if an object should be recursively flattened into separate fields
41
- * Plain objects (fieldsets, custom object types without _type) should be flattened
42
- * Sanity special types should NOT be flattened
43
- */
44
- private shouldFlattenObject;
45
- /**
46
- * Recursively flatten a nested object into individual TranslatableField entries
47
- * Each leaf field gets its own entry with a dotted path key
48
- *
49
- * Arrays of objects with _key are flattened with key-based paths like:
50
- * article.footnotes[_key == "abc123"].footnote
51
- *
52
- * @param obj - The object to flatten
53
- * @param basePath - The base path prefix for keys
54
- * @param fields - The fields record to populate
55
- * @param docContext - Document context for GROQ path generation
56
- */
57
- private flattenObjectToFields;
58
- /**
59
- * Flatten an array into individual TranslatableField entries
60
- * Arrays of objects with _key get key-based paths
61
- *
62
- * @param array - The array to flatten
63
- * @param fieldPath - The field path for this array
64
- * @param fieldName - The field name (last segment of path)
65
- * @param fields - The fields record to populate
66
- * @param docContext - Document context for GROQ path generation
67
- */
68
- private flattenArrayToFields;
69
- /**
70
- * Add a leaf field (primitive or atomic Sanity type) to the fields record
71
- */
72
- private addLeafField;
73
- /**
74
- * Extract content from a single Sanity document and convert to HTML
75
- */
76
- extractDocumentContent(document: SanityDocument): Promise<string>;
77
- /**
78
- * Convert Sanity document content to HTML format
79
- */
80
- convertToHtml(content: any): string;
81
- /**
82
- * Extract structured content with separated body, title, slug, and fields
83
- * Also applies DNT preferences if available
84
- */
85
- extractStructuredContent(document: SanityDocument): Promise<ExtendedDocumentContent>;
86
- /**
87
- * Apply DNT preferences to extracted fields based on document type
88
- * Now uses document-type-based configuration that applies to all documents of the same type
89
- *
90
- * DNT priority:
91
- * 1. Stored user preference (explicit override)
92
- * 2. Default based on field type (slug, date, datetime, reference, etc.)
93
- * 3. Default based on field name (containing "author" or "contributor")
94
- * 4. Default based on group/fieldset name (containing "date" or "time")
95
- * 5. Default to translatable (dnt: false)
96
- */
97
- private applyDNTPreferences;
98
- /**
99
- * Extract content from multiple documents for bulk operations
100
- */
101
- extractBulkContent(documents: SanityDocument[]): Promise<DocumentContent[]>;
102
- /**
103
- * Extract structured content from multiple documents
104
- */
105
- extractBulkStructuredContent(documents: SanityDocument[]): Promise<ExtendedDocumentContent[]>;
106
- /**
107
- * Process individual fields based on their type
108
- */
109
- private processField;
110
- /**
111
- * Process array fields (like portable text blocks)
112
- */
113
- private processArray;
114
- /**
115
- * Process portable text blocks and convert to HTML
116
- */
117
- private processPortableTextBlock;
118
- /**
119
- * Extract content from portable text block children
120
- */
121
- private processPortableTextBlockContent;
122
- /**
123
- * Process object fields
124
- */
125
- private processObject;
126
- /**
127
- * Wrap content in HTML with field name as class
128
- */
129
- private wrapInHtml;
130
- /**
131
- * Separate main content from metadata fields
132
- * All fields are immediately wrapped in TranslatableField format with type information
133
- * DNT defaults are computed based on field type and name patterns
134
- *
135
- * Complex types (objects/fieldsets) are recursively flattened into individual fields
136
- * using dotted path notation (e.g., "metadata.version", "metadata.status")
137
- */
138
- private separateContentAndFields;
139
- /**
140
- * Recursively search nested objects and fieldsets for a body/content field
141
- */
142
- private findBodyInNestedFields;
143
- /**
144
- * Extract slug from document
145
- */
146
- private extractSlug;
147
- /**
148
- * Extract title from document
149
- * Searches top-level fields first, then descends into nested objects/fieldsets
150
- * @returns Object with title string and flag indicating if found at top level
151
- */
152
- private extractTitle;
153
- /**
154
- * Recursively search nested objects and fieldsets for a title field
155
- */
156
- private findTitleInNestedFields;
157
- /**
158
- * Escape HTML special characters
159
- */
160
- private escapeHtml;
161
- }
@@ -1,95 +0,0 @@
1
- /**
2
- * Dialog management service with React state management
3
- * Requirements: 3.1, 3.2, 3.5, 3.6, 3.7
4
- *
5
- * Centralized dialog management with queue support for multiple simultaneous dialogs
6
- */
7
- import React, { ReactNode } from 'react';
8
- import type { DialogManager, ConfirmationDialogOptions, SuccessDialogOptions, ErrorDialogOptions, LocaleSelectionDialogOptions, LocaleSelectionResult } from '../types/dialog';
9
- /**
10
- * Dialog types for queue management
11
- */
12
- type DialogType = 'confirmation' | 'success' | 'error' | 'localeSelection';
13
- /**
14
- * Dialog options union type
15
- */
16
- type DialogOptions = ConfirmationDialogOptions | SuccessDialogOptions | ErrorDialogOptions | LocaleSelectionDialogOptions;
17
- /**
18
- * Dialog queue item structure
19
- */
20
- interface DialogQueueItem {
21
- id: string;
22
- type: DialogType;
23
- options: DialogOptions;
24
- resolve?: (value: unknown) => void;
25
- reject?: (error: Error) => void;
26
- }
27
- /**
28
- * Dialog context state
29
- */
30
- interface DialogContextState {
31
- currentDialog: DialogQueueItem | null;
32
- dialogQueue: DialogQueueItem[];
33
- showConfirmation: (options: ConfirmationDialogOptions) => Promise<boolean>;
34
- showLocaleSelection: (options: LocaleSelectionDialogOptions) => Promise<LocaleSelectionResult>;
35
- showSuccess: (options: SuccessDialogOptions) => void;
36
- showError: (options: ErrorDialogOptions) => Promise<boolean>;
37
- closeAll: () => void;
38
- }
39
- /**
40
- * Hook to access dialog service from React components
41
- */
42
- export declare const useDialogService: () => DialogContextState;
43
- /**
44
- * Dialog Provider Props
45
- */
46
- interface DialogProviderProps {
47
- children: ReactNode;
48
- }
49
- /**
50
- * Dialog Provider Component
51
- * Manages dialog state and queue for the entire application
52
- */
53
- export declare const DialogProvider: React.FC<DialogProviderProps>;
54
- /**
55
- * Singleton DialogService class for non-React contexts
56
- * Note: This requires the DialogProvider to be mounted in the React tree
57
- */
58
- export declare class DialogService implements DialogManager {
59
- private static instance;
60
- private contextRef;
61
- private constructor();
62
- /**
63
- * Get singleton instance
64
- */
65
- static getInstance(): DialogService;
66
- /**
67
- * Set the context reference (called by DialogProvider)
68
- */
69
- setContext(context: DialogContextState): void;
70
- /**
71
- * Show a confirmation dialog
72
- */
73
- showConfirmation(options: ConfirmationDialogOptions): Promise<boolean>;
74
- /**
75
- * Show a locale selection dialog
76
- */
77
- showLocaleSelection(options: LocaleSelectionDialogOptions): Promise<LocaleSelectionResult>;
78
- /**
79
- * Show a success notification
80
- */
81
- showSuccess(options: SuccessDialogOptions): void;
82
- /**
83
- * Show an error dialog
84
- */
85
- showError(options: ErrorDialogOptions): Promise<boolean>;
86
- /**
87
- * Close all open dialogs
88
- */
89
- closeAll(): void;
90
- }
91
- /**
92
- * Export singleton instance for convenience
93
- */
94
- export declare const dialogService: DialogService;
95
- export {};
@@ -1,43 +0,0 @@
1
- /**
2
- * DNT Service Manager
3
- *
4
- * Provides singleton access to DNTStorageAdapter with proper initialization.
5
- * Similar to OAuthServiceManager pattern.
6
- */
7
- import { SanityClient } from 'sanity';
8
- import { DNTStorageAdapter } from './dntStorageAdapter';
9
- /**
10
- * Singleton manager for DNT storage services
11
- */
12
- export declare class DNTServiceManager {
13
- private static instance;
14
- private dntStorage;
15
- private client;
16
- private constructor();
17
- /**
18
- * Get or create the singleton instance
19
- */
20
- static getInstance(client?: SanityClient): DNTServiceManager;
21
- /**
22
- * Initialize the service with a Sanity client
23
- */
24
- initialize(client: SanityClient): void;
25
- /**
26
- * Get the DNT storage adapter
27
- * Throws if not initialized
28
- */
29
- getDNTStorage(): DNTStorageAdapter;
30
- /**
31
- * Check if the service is initialized
32
- */
33
- isInitialized(): boolean;
34
- /**
35
- * Reset the singleton instance (useful for testing)
36
- */
37
- static reset(): void;
38
- }
39
- /**
40
- * Convenience function to get DNT storage adapter
41
- * Throws if service is not initialized
42
- */
43
- export declare function getDNTStorage(): DNTStorageAdapter;
@@ -1,72 +0,0 @@
1
- /**
2
- * DNT (Do Not Translate) preferences storage adapter
3
- *
4
- * Now uses document-type-based storage in the unified configuration.
5
- * When you mark a field as DNT for any document of a type (e.g., 'product'),
6
- * it applies to ALL documents of that type.
7
- *
8
- * This replaces the old per-document localStorage approach with centralized
9
- * configuration stored in Sanity.
10
- */
11
- import { DNTPreferences, DNTStorage } from '../types/dnt';
12
- import { UnifiedConfigStorage } from './unifiedConfigStorage';
13
- /**
14
- * DNT Storage Adapter using unified configuration
15
- */
16
- export declare class DNTStorageAdapter implements DNTStorage {
17
- private configStorage;
18
- constructor(configStorage: UnifiedConfigStorage);
19
- /**
20
- * Get DNT field configuration for a document type
21
- */
22
- getFieldsForType(documentType: string): Promise<Record<string, boolean>>;
23
- /**
24
- * Set DNT status for a specific field in a document type
25
- */
26
- setFieldDNT(documentType: string, fieldPath: string, dnt: boolean): Promise<void>;
27
- /**
28
- * Toggle DNT status for a field in a document type
29
- */
30
- toggleFieldDNT(documentType: string, fieldPath: string): Promise<boolean>;
31
- /**
32
- * Get DNT status for a specific field in a document type
33
- */
34
- getFieldDNT(documentType: string, fieldPath: string): Promise<boolean>;
35
- /**
36
- * Clear all DNT fields for a document type
37
- */
38
- clearFieldsForType(documentType: string): Promise<void>;
39
- /**
40
- * Get all DNT configurations (all document types)
41
- */
42
- getAllDNTFields(): Promise<Record<string, Record<string, boolean>>>;
43
- /**
44
- * @deprecated Use getFieldsForType instead. This method now uses document type, not document ID.
45
- * Get DNT preferences - now based on document type, not individual document ID
46
- */
47
- getPreferences(_documentId: string): Promise<DNTPreferences | null>;
48
- /**
49
- * @deprecated Use setFieldDNT instead
50
- */
51
- savePreferences(preferences: DNTPreferences): Promise<void>;
52
- /**
53
- * @deprecated Use clearFieldsForType instead
54
- */
55
- clearPreferences(_documentId: string): Promise<void>;
56
- }
57
- /**
58
- * Legacy DNT Storage Adapter using localStorage (deprecated)
59
- * Kept for migration purposes only
60
- * @deprecated Use DNTStorageAdapter with UnifiedConfigStorage instead
61
- */
62
- export declare class LegacyDNTStorageAdapter {
63
- private static readonly STORAGE_KEY_PREFIX;
64
- private getStorageKey;
65
- getPreferences(documentId: string): Promise<DNTPreferences | null>;
66
- savePreferences(preferences: DNTPreferences): Promise<void>;
67
- clearPreferences(documentId: string): Promise<void>;
68
- /**
69
- * Migrate legacy localStorage preferences to unified configuration
70
- */
71
- migrateToUnified(configStorage: UnifiedConfigStorage, documentId: string, documentType: string): Promise<void>;
72
- }
@@ -1,196 +0,0 @@
1
- import { SanityDocument, SanityClient } from 'sanity';
2
- import { TranslationResponse } from './translationService';
3
- /**
4
- * Options for document creation from translation
5
- */
6
- export interface DocumentCreationOptions {
7
- /** Target language code for the translated document */
8
- targetLanguage?: string;
9
- /** Source language code of the original document */
10
- sourceLanguage?: string;
11
- /** Whether to create the document as a variant of the original */
12
- createAsVariant?: boolean;
13
- /** ID of the parent document when creating as a variant */
14
- parentDocumentId?: string;
15
- /** Creation mode: 'draft' creates a draft document, 'published' creates a published document */
16
- creationMode?: 'draft' | 'published';
17
- /**
18
- * Whether the title was found at the document's top level during extraction.
19
- * When false, the translated title should not be written as a top-level field.
20
- * This is tracked in-memory by the plugin, not sent to the translation backend.
21
- */
22
- titleFoundAtTopLevel?: boolean;
23
- /**
24
- * Whether the body/content was found at the document's top level during extraction.
25
- * When false, the translated body should not be written as a top-level field.
26
- * This is tracked in-memory by the plugin, not sent to the translation backend.
27
- */
28
- bodyFoundAtTopLevel?: boolean;
29
- /**
30
- * The field name where body content was originally found (e.g., 'body', 'content', or nested path).
31
- * Used to write translated content back to the correct location.
32
- */
33
- bodyFieldName?: string;
34
- }
35
- export interface SlugFallbackInfo {
36
- documentId: string;
37
- originalSlug: string;
38
- fallbackSlug: string;
39
- locale: string;
40
- reason: string;
41
- }
42
- export interface DocumentCreationResult {
43
- success: boolean;
44
- documentId?: string;
45
- document?: SanityDocument;
46
- error?: string;
47
- slugFallback?: SlugFallbackInfo;
48
- }
49
- export interface BulkDocumentCreationResult {
50
- totalDocuments: number;
51
- successfulCreations: number;
52
- failedCreations: number;
53
- results: DocumentCreationResult[];
54
- errors: string[];
55
- rollbackInfo?: RollbackInfo;
56
- slugFallbacks: SlugFallbackInfo[];
57
- }
58
- export interface RollbackInfo {
59
- canRollback: boolean;
60
- createdDocumentIds: string[];
61
- rollbackInstructions: string[];
62
- }
63
- export declare class DocumentCreationService {
64
- private client;
65
- private defaultCreationMode;
66
- constructor(client: SanityClient, defaultCreationMode?: 'draft' | 'published');
67
- /**
68
- * Set the default document creation mode
69
- * @param mode - The creation mode to use by default ('draft' or 'published')
70
- */
71
- setDefaultCreationMode(mode: 'draft' | 'published'): void;
72
- /**
73
- * Create a new Sanity document from translation response
74
- * Requirements: 1.1, 1.2, 2.1, 3.2, 3.4
75
- */
76
- createDocumentFromTranslation(originalDocument: SanityDocument, translationResponse: TranslationResponse, options?: DocumentCreationOptions): Promise<DocumentCreationResult>;
77
- /**
78
- * Validate inputs for document creation
79
- * Requirements: 4.3, 4.4
80
- */
81
- private validateInputsForDocumentCreation;
82
- /**
83
- * Validate business rules for document creation
84
- * Requirements: 4.3, 4.4
85
- */
86
- private validateBusinessRules;
87
- /**
88
- * Check if document has meaningful content
89
- * Searches both top-level and nested fields for title/body content
90
- */
91
- private documentHasContent;
92
- /**
93
- * Recursively search nested objects for title or body content
94
- */
95
- private hasContentInNestedFields;
96
- /**
97
- * Format error messages with additional context
98
- * Requirements: 4.3, 4.4
99
- */
100
- private formatErrorMessage;
101
- /**
102
- * Create multiple documents from bulk translation responses
103
- * Requirements: 2.1, 3.2, 3.4
104
- */
105
- createBulkDocumentsFromTranslations(originalDocuments: SanityDocument[], translationResponses: TranslationResponse[], options?: DocumentCreationOptions): Promise<BulkDocumentCreationResult>;
106
- /**
107
- * Validate bulk translation responses before document creation
108
- * Requirements: 4.3, 4.4
109
- */
110
- private validateBulkTranslationResponses;
111
- /**
112
- * Validate translation response before document creation
113
- * Requirements: 4.3, 4.4
114
- */
115
- private validateTranslationResponseForCreation;
116
- /**
117
- * Create rollback plan for failed bulk operations
118
- * Requirements: 4.3, 4.4
119
- */
120
- createRollbackPlan(createdDocumentIds: string[]): RollbackInfo;
121
- /**
122
- * Parse a field path that may contain array key selectors
123
- * e.g., "article.footnotes[_key == \"c82437b14d71\"].footnote"
124
- *
125
- * @param fieldPath - The field path (may be from the field key or from the path property)
126
- * @returns Array of path segments with type information
127
- */
128
- private parseFieldPath;
129
- /**
130
- * Unflatten fields with complex paths back into nested objects
131
- * Handles both simple dotted paths and GROQ-style array key paths:
132
- * - "metadata.version" → { metadata: { version: ... } }
133
- * - "article.footnotes[_key == \"abc\"].footnote" → { article: { footnotes: [{ _key: "abc", footnote: ... }] } }
134
- *
135
- * @param fields - Flattened fields with path keys
136
- * @param originalDocument - Original document for preserving array structure
137
- * @returns Unflattened nested object structure
138
- */
139
- private unflattenFields;
140
- /**
141
- * Get the original nested value from the original document using a dotted path
142
- *
143
- * @param document - The original document
144
- * @param fieldPath - The dotted path to the field
145
- * @returns The original value at the path, or undefined
146
- */
147
- private getOriginalValueByPath;
148
- /**
149
- * Merge translated content back into original document structure
150
- * Requirements: 1.2, 3.2, 3.4
151
- */
152
- private mergeTranslatedContent;
153
- /**
154
- * Process a translated field value and convert it to the appropriate format
155
- * based on the original document's structure
156
- */
157
- private processTranslatedField;
158
- /**
159
- * Convert HTML content back to Sanity portable text format
160
- * Requirements: 3.2, 3.4
161
- */
162
- private convertHtmlToPortableText;
163
- /**
164
- * Parse inline content and handle formatting
165
- */
166
- private parseInlineContent;
167
- /**
168
- * Get block style from HTML tag name
169
- */
170
- private getBlockStyle;
171
- /**
172
- * Check if content appears to be HTML
173
- */
174
- private isHtmlContent;
175
- /**
176
- * Generate a new document ID based on original ID and target language
177
- */
178
- private generateNewDocumentId;
179
- /**
180
- * Generate a unique key for portable text blocks
181
- */
182
- private generateBlockKey;
183
- /**
184
- * Generate a unique key for spans
185
- */
186
- private generateSpanKey;
187
- /**
188
- * Validate document structure before creation
189
- * Requirements: 3.4
190
- */
191
- private validateDocumentStructure;
192
- /**
193
- * Validate portable text array structure
194
- */
195
- private validatePortableTextArray;
196
- }