@easyling/sanity-connector 0.0.2-rc.1 → 0.0.2-rc.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +28 -0
- package/dist-types/actions/bulkTranslate.d.ts +6 -0
- package/dist-types/actions/manageDNTFields.d.ts +11 -0
- package/dist-types/actions/translateDocument.d.ts +6 -0
- package/dist-types/components/RadioWithDefault.d.ts +16 -0
- package/dist-types/components/auth/AuthNavbar.d.ts +17 -0
- package/dist-types/components/auth/AuthStatus.d.ts +26 -0
- package/dist-types/components/auth/AuthStatusWrapper.d.ts +14 -0
- package/dist-types/components/auth/MigrationPrompt.d.ts +19 -0
- package/dist-types/components/auth/MigrationPromptWrapper.d.ts +13 -0
- package/dist-types/components/auth/OAuthCallback.d.ts +19 -0
- package/dist-types/components/auth/index.d.ts +14 -0
- package/dist-types/components/config/LocaleConfigTool.d.ts +16 -0
- package/dist-types/components/config/LocaleConfigToolWrapper.d.ts +12 -0
- package/dist-types/components/config/OAuthConfig.d.ts +25 -0
- package/dist-types/components/config/OAuthConfigWrapper.d.ts +12 -0
- package/dist-types/components/config/PasswordInput.d.ts +13 -0
- package/dist-types/components/config/index.d.ts +8 -0
- package/dist-types/components/config/localeConfigToolDefinition.d.ts +12 -0
- package/dist-types/components/config/oauthConfigToolDefinition.d.ts +12 -0
- package/dist-types/components/dialogs/ConfirmationDialog.d.ts +20 -0
- package/dist-types/components/dialogs/ErrorDialog.d.ts +20 -0
- package/dist-types/components/dialogs/LocaleSelectionDialog.d.ts +40 -0
- package/dist-types/components/dialogs/SuccessDialog.d.ts +18 -0
- package/dist-types/components/dialogs/index.d.ts +11 -0
- package/dist-types/components/dnt/DNTFieldBadge.d.ts +15 -0
- package/dist-types/components/dnt/DNTFieldComponent.d.ts +16 -0
- package/dist-types/components/dnt/DNTFieldInput.d.ts +13 -0
- package/dist-types/components/dnt/index.d.ts +6 -0
- package/dist-types/config/index.d.ts +5 -0
- package/dist-types/config/pluginConfig.d.ts +162 -0
- package/dist-types/index.d.ts +11 -0
- package/dist-types/plugin.d.ts +2 -0
- package/dist-types/services/authStateManager.d.ts +93 -0
- package/dist-types/services/contentExtractor.d.ts +94 -0
- package/dist-types/services/dialogService.d.ts +95 -0
- package/dist-types/services/dntServiceManager.d.ts +43 -0
- package/dist-types/services/dntStorageAdapter.d.ts +72 -0
- package/dist-types/services/documentCreationService.d.ts +138 -0
- package/dist-types/services/localeService.d.ts +159 -0
- package/dist-types/services/localeStorageAdapter.d.ts +41 -0
- package/dist-types/services/oauthConfigStorage.d.ts +45 -0
- package/dist-types/services/oauthService.d.ts +47 -0
- package/dist-types/services/oauthServiceManager.d.ts +188 -0
- package/dist-types/services/tokenStorage.d.ts +53 -0
- package/dist-types/services/translationService.d.ts +373 -0
- package/dist-types/services/unifiedConfigStorage.d.ts +123 -0
- package/dist-types/test-utils.d.ts +8 -0
- package/dist-types/types/dialog.d.ts +106 -0
- package/dist-types/types/dnt.d.ts +83 -0
- package/dist-types/types/index.d.ts +11 -0
- package/dist-types/types/locale.d.ts +115 -0
- package/dist-types/types/oauth.d.ts +89 -0
- package/dist-types/types/pluginConfig.d.ts +44 -0
- package/dist-types/types/translation.d.ts +121 -0
- package/dist-types/utils/htmlFormatter.d.ts +65 -0
- package/dist-types/utils/index.d.ts +14 -0
- package/dist-types/utils/logger.d.ts +104 -0
- package/dist-types/utils/oauthErrorFeedback.d.ts +75 -0
- package/dist-types/utils/oauthLogger.d.ts +175 -0
- package/dist-types/utils/validator.d.ts +66 -0
- package/package.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-is.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license React
|
|
13
|
+
* react-jsx-runtime.production.min.js
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
23
|
+
*
|
|
24
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
25
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
26
|
+
* @namespace
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document action for managing DNT (Do Not Translate) field preferences
|
|
3
|
+
*
|
|
4
|
+
* Now uses document-type-based configuration: DNT settings apply to ALL documents
|
|
5
|
+
* of the same type, not just individual document instances.
|
|
6
|
+
*/
|
|
7
|
+
import { DocumentActionComponent } from 'sanity';
|
|
8
|
+
/**
|
|
9
|
+
* Document action for managing DNT fields
|
|
10
|
+
*/
|
|
11
|
+
export declare const manageDNTFieldsAction: DocumentActionComponent;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Radio Input Component with Auto-Default
|
|
3
|
+
*
|
|
4
|
+
* This component wraps Sanity's default radio input and automatically sets
|
|
5
|
+
* the default value when the field is undefined. This ensures that:
|
|
6
|
+
* 1. New users see defaults immediately
|
|
7
|
+
* 2. Existing users with legacy configs see defaults without manual intervention
|
|
8
|
+
* 3. The UX is seamless and doesn't require any user action
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { StringInputProps } from 'sanity';
|
|
12
|
+
interface RadioWithDefaultProps extends StringInputProps {
|
|
13
|
+
defaultValue: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const RadioWithDefault: React.FC<RadioWithDefaultProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Navbar Component
|
|
3
|
+
* Requirements: 6.2, 6.3
|
|
4
|
+
*
|
|
5
|
+
* Navbar component that displays authentication status in the Sanity Studio.
|
|
6
|
+
* Positioned for easy access across all plugin pages.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
/**
|
|
10
|
+
* Authentication Navbar
|
|
11
|
+
*
|
|
12
|
+
* Displays the authentication status in a navbar-style component.
|
|
13
|
+
* Designed to be visible across all plugin pages.
|
|
14
|
+
*
|
|
15
|
+
* Requirements: 6.2, 6.3
|
|
16
|
+
*/
|
|
17
|
+
export declare const AuthNavbar: React.FC;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Status Component
|
|
3
|
+
* Requirements: 6.2, 6.3, 1.1, 7.1, 7.2, 7.3
|
|
4
|
+
*
|
|
5
|
+
* Displays the current authentication status and provides controls
|
|
6
|
+
* for connecting to and disconnecting from Easyling.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { AuthStateManager } from '../../services/authStateManager';
|
|
10
|
+
export interface AuthStatusProps {
|
|
11
|
+
/** Authentication state manager instance */
|
|
12
|
+
authStateManager: AuthStateManager;
|
|
13
|
+
/** Callback when user clicks connect button */
|
|
14
|
+
onConnect: () => void;
|
|
15
|
+
/** Callback when user clicks disconnect button */
|
|
16
|
+
onDisconnect: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Authentication Status Component
|
|
20
|
+
*
|
|
21
|
+
* Subscribes to AuthStateManager for reactive updates and displays
|
|
22
|
+
* different UI based on the current authentication state.
|
|
23
|
+
*
|
|
24
|
+
* Requirements: 6.2, 6.3, 1.1, 7.1, 7.2, 7.3
|
|
25
|
+
*/
|
|
26
|
+
export declare const AuthStatus: React.FC<AuthStatusProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Status Wrapper Component
|
|
3
|
+
*
|
|
4
|
+
* Wrapper component that connects AuthStatus to the service manager.
|
|
5
|
+
* Provides the necessary callbacks for connect and disconnect actions.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Authentication Status Wrapper
|
|
10
|
+
*
|
|
11
|
+
* Connects the AuthStatus component to the service manager singleton.
|
|
12
|
+
* Handles connect and disconnect actions by delegating to the service manager.
|
|
13
|
+
*/
|
|
14
|
+
export declare const AuthStatusWrapper: React.FC;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration Prompt Component - DEPRECATED
|
|
3
|
+
*
|
|
4
|
+
* This component is no longer used since OAuth migration prompts are not needed
|
|
5
|
+
* with the new long-lived token authentication approach.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export interface MigrationPromptProps {
|
|
9
|
+
/** Callback when user wants to set up OAuth (deprecated) */
|
|
10
|
+
onSetupOAuth: () => void;
|
|
11
|
+
/** Callback when user dismisses the prompt (deprecated) */
|
|
12
|
+
onDismiss: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Migration Prompt Component - DEPRECATED
|
|
16
|
+
*
|
|
17
|
+
* Returns null as OAuth migration is no longer applicable.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MigrationPrompt: React.FC<MigrationPromptProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration Prompt Wrapper Component - DEPRECATED
|
|
3
|
+
*
|
|
4
|
+
* This component is no longer used since OAuth migration prompts are not needed
|
|
5
|
+
* with the new long-lived token authentication approach.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Migration Prompt Wrapper - DEPRECATED
|
|
10
|
+
*
|
|
11
|
+
* Returns null as OAuth migration is no longer applicable.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MigrationPromptWrapper: React.FC;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Callback Component - DEPRECATED
|
|
3
|
+
*
|
|
4
|
+
* This component is no longer used with the new long-lived token authentication approach.
|
|
5
|
+
* Easyling authentication now uses direct access token configuration instead of OAuth flows.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export interface OAuthCallbackProps {
|
|
9
|
+
/** Callback when authentication is complete (not used) */
|
|
10
|
+
onComplete?: () => void;
|
|
11
|
+
/** Callback to retry authentication (not used) */
|
|
12
|
+
onRetry?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* OAuth Callback Component - DEPRECATED
|
|
16
|
+
*
|
|
17
|
+
* Shows a message that OAuth callbacks are no longer supported.
|
|
18
|
+
*/
|
|
19
|
+
export declare const OAuthCallback: React.FC<OAuthCallbackProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Components
|
|
3
|
+
*
|
|
4
|
+
* Exports all authentication-related UI components
|
|
5
|
+
*/
|
|
6
|
+
export { AuthStatus } from './AuthStatus';
|
|
7
|
+
export type { AuthStatusProps } from './AuthStatus';
|
|
8
|
+
export { OAuthCallback } from './OAuthCallback';
|
|
9
|
+
export type { OAuthCallbackProps } from './OAuthCallback';
|
|
10
|
+
export { AuthStatusWrapper } from './AuthStatusWrapper';
|
|
11
|
+
export { AuthNavbar } from './AuthNavbar';
|
|
12
|
+
export { MigrationPrompt } from './MigrationPrompt';
|
|
13
|
+
export type { MigrationPromptProps } from './MigrationPrompt';
|
|
14
|
+
export { MigrationPromptWrapper } from './MigrationPromptWrapper';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocaleConfigTool Component
|
|
3
|
+
* Requirements: 1.1, 1.2, 1.6, 1.7
|
|
4
|
+
*
|
|
5
|
+
* Administrative interface for managing locale configuration
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { LocaleService } from '../../services/localeService';
|
|
9
|
+
export interface LocaleConfigToolProps {
|
|
10
|
+
/** Locale service instance for CRUD operations */
|
|
11
|
+
localeService: LocaleService;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* LocaleConfigTool component for administrative locale management
|
|
15
|
+
*/
|
|
16
|
+
export declare const LocaleConfigTool: React.FC<LocaleConfigToolProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocaleConfigTool Wrapper for Sanity Tool Integration
|
|
3
|
+
* Requirements: 1.1, 5.1, 5.2, 5.3, 5.7
|
|
4
|
+
*
|
|
5
|
+
* Wraps the LocaleConfigTool component with Sanity client integration
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Wrapper component that provides LocaleService with Sanity storage adapter
|
|
10
|
+
* Requirements: 1.1, 5.1, 5.2, 5.3, 5.7
|
|
11
|
+
*/
|
|
12
|
+
export declare const LocaleConfigToolWrapper: React.FC;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Easyling Configuration Component
|
|
3
|
+
*
|
|
4
|
+
* UI component for configuring Easyling integration with access token and project ID
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { OAuthConfig as OAuthConfigType } from '../../types/oauth';
|
|
8
|
+
export interface OAuthConfigProps {
|
|
9
|
+
/** Callback when configuration is saved */
|
|
10
|
+
onConfigSaved?: (config: OAuthConfigType) => void;
|
|
11
|
+
/** Initial configuration to load */
|
|
12
|
+
initialConfig?: OAuthConfigType | null;
|
|
13
|
+
/** Function to save configuration */
|
|
14
|
+
onSave?: (config: OAuthConfigType) => Promise<void>;
|
|
15
|
+
/** Function to load configuration */
|
|
16
|
+
onLoad?: () => Promise<OAuthConfigType | null>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Easyling Configuration Component
|
|
20
|
+
*
|
|
21
|
+
* Provides a form for configuring Easyling authentication:
|
|
22
|
+
* - Project ID
|
|
23
|
+
* - Access Token (secure password field)
|
|
24
|
+
*/
|
|
25
|
+
export declare const OAuthConfig: React.FC<OAuthConfigProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Configuration Wrapper for Sanity Integration
|
|
3
|
+
* Requirements: 9.1, 9.4
|
|
4
|
+
*
|
|
5
|
+
* Wraps the OAuthConfig component with Sanity client integration
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Wrapper component that provides OAuthConfig with Sanity storage
|
|
10
|
+
* Requirements: 9.1, 9.4
|
|
11
|
+
*/
|
|
12
|
+
export declare const OAuthConfigWrapper: React.FC;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Password Input Component for Sanity
|
|
3
|
+
*
|
|
4
|
+
* Custom input component that obscures sensitive token values in Sanity Studio
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { StringInputProps } from 'sanity';
|
|
8
|
+
/**
|
|
9
|
+
* Password Input Component
|
|
10
|
+
*
|
|
11
|
+
* Renders a password-type input field that obscures the value
|
|
12
|
+
*/
|
|
13
|
+
export declare const PasswordInput: React.FC<StringInputProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration components exports
|
|
3
|
+
*/
|
|
4
|
+
export { LocaleConfigTool } from './LocaleConfigTool';
|
|
5
|
+
export type { LocaleConfigToolProps } from './LocaleConfigTool';
|
|
6
|
+
export { LocaleConfigToolWrapper } from './LocaleConfigToolWrapper';
|
|
7
|
+
export { localeConfigTool } from './localeConfigToolDefinition';
|
|
8
|
+
export { PasswordInput } from './PasswordInput';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale Configuration Tool Definition
|
|
3
|
+
* Requirements: 1.1, 5.1, 5.7
|
|
4
|
+
*
|
|
5
|
+
* Sanity Studio tool for managing locale configuration
|
|
6
|
+
*/
|
|
7
|
+
import { Tool } from 'sanity';
|
|
8
|
+
/**
|
|
9
|
+
* Locale Configuration Tool for Sanity Studio
|
|
10
|
+
* Requirements: 1.1, 5.1, 5.7
|
|
11
|
+
*/
|
|
12
|
+
export declare const localeConfigTool: Tool;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth Configuration Tool Definition
|
|
3
|
+
* Requirements: 9.1, 9.3
|
|
4
|
+
*
|
|
5
|
+
* Sanity Studio tool for managing OAuth configuration
|
|
6
|
+
*/
|
|
7
|
+
import { Tool } from 'sanity';
|
|
8
|
+
/**
|
|
9
|
+
* OAuth Configuration Tool for Sanity Studio
|
|
10
|
+
* Requirements: 9.1, 9.3
|
|
11
|
+
*/
|
|
12
|
+
export declare const oauthConfigTool: Tool;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfirmationDialog Component
|
|
3
|
+
* Requirements: 3.1, 3.2, 3.8
|
|
4
|
+
*
|
|
5
|
+
* A reusable confirmation dialog with proper accessibility support
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ConfirmationDialogOptions } from '../../types/dialog';
|
|
9
|
+
export interface ConfirmationDialogProps extends ConfirmationDialogOptions {
|
|
10
|
+
/** Whether the dialog is open */
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** Callback when user confirms */
|
|
13
|
+
onConfirm: () => void;
|
|
14
|
+
/** Callback when user cancels */
|
|
15
|
+
onCancel: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ConfirmationDialog component with accessibility features
|
|
19
|
+
*/
|
|
20
|
+
export declare const ConfirmationDialog: React.FC<ConfirmationDialogProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ErrorDialog Component
|
|
3
|
+
* Requirements: 3.7, 3.8
|
|
4
|
+
*
|
|
5
|
+
* An error notification dialog with accessibility support and retry functionality
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { ErrorDialogOptions } from '../../types/dialog';
|
|
9
|
+
export interface ErrorDialogProps extends ErrorDialogOptions {
|
|
10
|
+
/** Whether the dialog is open */
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** Callback when dialog is closed */
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
/** Callback when user clicks retry */
|
|
15
|
+
onRetry?: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ErrorDialog component for displaying error messages
|
|
19
|
+
*/
|
|
20
|
+
export declare const ErrorDialog: React.FC<ErrorDialogProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocaleSelectionDialog Component
|
|
3
|
+
* Requirements: 2.1, 2.2, 2.3, 2.4, 2.6, 2.7
|
|
4
|
+
*
|
|
5
|
+
* A dialog for selecting target locales for translation with search and validation
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { LocaleDefinition } from '../../types/locale';
|
|
9
|
+
export interface LocaleSelectionDialogProps {
|
|
10
|
+
/** Whether the dialog is open */
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** Dialog title */
|
|
13
|
+
title: string;
|
|
14
|
+
/** Dialog message/description */
|
|
15
|
+
message: string;
|
|
16
|
+
/** Available locales to choose from */
|
|
17
|
+
availableLocales: LocaleDefinition[];
|
|
18
|
+
/** Currently selected locale codes */
|
|
19
|
+
selectedLocales: string[];
|
|
20
|
+
/** Documents being translated (for context display) */
|
|
21
|
+
selectedDocuments?: any[];
|
|
22
|
+
/** Translation mode */
|
|
23
|
+
mode: 'single' | 'bulk';
|
|
24
|
+
/** Whether multiple locales can be selected */
|
|
25
|
+
allowMultiple?: boolean;
|
|
26
|
+
/** Whether locale selection is required */
|
|
27
|
+
required?: boolean;
|
|
28
|
+
/** Whether to show creation mode option in the dialog */
|
|
29
|
+
showCreationModeOption?: boolean;
|
|
30
|
+
/** Default creation mode to pre-select */
|
|
31
|
+
defaultCreationMode?: 'draft' | 'published';
|
|
32
|
+
/** Callback when user confirms selection */
|
|
33
|
+
onConfirm: (selectedLocales: string[], creationMode?: 'draft' | 'published') => void;
|
|
34
|
+
/** Callback when user cancels */
|
|
35
|
+
onCancel: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* LocaleSelectionDialog component with search and multi-select functionality
|
|
39
|
+
*/
|
|
40
|
+
export declare const LocaleSelectionDialog: React.FC<LocaleSelectionDialogProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SuccessDialog Component
|
|
3
|
+
* Requirements: 3.6, 3.8
|
|
4
|
+
*
|
|
5
|
+
* A success notification dialog with accessibility support
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { SuccessDialogOptions } from '../../types/dialog';
|
|
9
|
+
export interface SuccessDialogProps extends SuccessDialogOptions {
|
|
10
|
+
/** Whether the dialog is open */
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** Callback when dialog is closed */
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* SuccessDialog component for displaying success messages
|
|
17
|
+
*/
|
|
18
|
+
export declare const SuccessDialog: React.FC<SuccessDialogProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dialog components exports
|
|
3
|
+
*/
|
|
4
|
+
export { ConfirmationDialog } from './ConfirmationDialog';
|
|
5
|
+
export type { ConfirmationDialogProps } from './ConfirmationDialog';
|
|
6
|
+
export { SuccessDialog } from './SuccessDialog';
|
|
7
|
+
export type { SuccessDialogProps } from './SuccessDialog';
|
|
8
|
+
export { ErrorDialog } from './ErrorDialog';
|
|
9
|
+
export type { ErrorDialogProps } from './ErrorDialog';
|
|
10
|
+
export { LocaleSelectionDialog } from './LocaleSelectionDialog';
|
|
11
|
+
export type { LocaleSelectionDialogProps } from './LocaleSelectionDialog';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DNT Field Badge Component
|
|
3
|
+
* Displays a badge on fields indicating their translation status and allows toggling
|
|
4
|
+
*
|
|
5
|
+
* Now uses document-type-based configuration: toggling DNT for a field applies to
|
|
6
|
+
* ALL documents of the same type.
|
|
7
|
+
*/
|
|
8
|
+
interface DNTFieldBadgeProps {
|
|
9
|
+
documentId: string;
|
|
10
|
+
documentType: string;
|
|
11
|
+
fieldPath: string;
|
|
12
|
+
fieldTitle?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function DNTFieldBadge(props: DNTFieldBadgeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DNT Field Component
|
|
3
|
+
* A wrapper component that adds DNT toggle functionality to any field
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { ObjectInputProps, StringInputProps, NumberInputProps, BooleanInputProps, ArrayOfObjectsInputProps } from 'sanity';
|
|
7
|
+
type FieldInputProps = ObjectInputProps | StringInputProps | NumberInputProps | BooleanInputProps | ArrayOfObjectsInputProps;
|
|
8
|
+
interface DNTFieldComponentProps {
|
|
9
|
+
documentId?: string;
|
|
10
|
+
documentType?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Higher-order component that wraps field components with DNT functionality
|
|
14
|
+
*/
|
|
15
|
+
export declare function withDNTBadge<P extends FieldInputProps>(Component: React.ComponentType<P>): React.ComponentType<P & DNTFieldComponentProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DNT Field Input Component
|
|
3
|
+
* Wraps any field with a DNT toggle badge
|
|
4
|
+
*
|
|
5
|
+
* Now uses document-type-based configuration: toggling DNT for a field applies to
|
|
6
|
+
* ALL documents of the same type.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { FieldProps } from 'sanity';
|
|
10
|
+
/**
|
|
11
|
+
* Field component that adds DNT badge
|
|
12
|
+
*/
|
|
13
|
+
export declare function DNTFieldInput(props: FieldProps): React.JSX.Element;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin configuration schema and utilities
|
|
3
|
+
* Requirements: 5.1, 5.2, 5.3
|
|
4
|
+
*/
|
|
5
|
+
import { LocaleConfig, LocaleDefinition } from '../types/locale';
|
|
6
|
+
/**
|
|
7
|
+
* Create unified plugin configuration schema for Sanity
|
|
8
|
+
* Internal type prefixed with EL_ to separate from customer document types
|
|
9
|
+
*
|
|
10
|
+
* This single document type stores all plugin configuration:
|
|
11
|
+
* - OAuth/authentication settings
|
|
12
|
+
* - Locale definitions
|
|
13
|
+
* - DNT (Do Not Translate) field mappings by document type
|
|
14
|
+
*
|
|
15
|
+
* @param PasswordInputComponent - Optional password input component for access token field
|
|
16
|
+
*/
|
|
17
|
+
export declare const createPluginConfigSchema: (PasswordInputComponent?: any) => {
|
|
18
|
+
name: string;
|
|
19
|
+
title: string;
|
|
20
|
+
type: string;
|
|
21
|
+
fields: any[];
|
|
22
|
+
groups: ({
|
|
23
|
+
name: string;
|
|
24
|
+
title: string;
|
|
25
|
+
default: boolean;
|
|
26
|
+
description?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
name: string;
|
|
29
|
+
title: string;
|
|
30
|
+
default?: undefined;
|
|
31
|
+
description?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
name: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description: string;
|
|
36
|
+
default?: undefined;
|
|
37
|
+
})[];
|
|
38
|
+
preview: {
|
|
39
|
+
prepare: () => {
|
|
40
|
+
title: string;
|
|
41
|
+
subtitle: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Default export for backward compatibility and tests
|
|
47
|
+
*/
|
|
48
|
+
export declare const pluginConfigSchema: {
|
|
49
|
+
name: string;
|
|
50
|
+
title: string;
|
|
51
|
+
type: string;
|
|
52
|
+
fields: any[];
|
|
53
|
+
groups: ({
|
|
54
|
+
name: string;
|
|
55
|
+
title: string;
|
|
56
|
+
default: boolean;
|
|
57
|
+
description?: undefined;
|
|
58
|
+
} | {
|
|
59
|
+
name: string;
|
|
60
|
+
title: string;
|
|
61
|
+
default?: undefined;
|
|
62
|
+
description?: undefined;
|
|
63
|
+
} | {
|
|
64
|
+
name: string;
|
|
65
|
+
title: string;
|
|
66
|
+
description: string;
|
|
67
|
+
default?: undefined;
|
|
68
|
+
})[];
|
|
69
|
+
preview: {
|
|
70
|
+
prepare: () => {
|
|
71
|
+
title: string;
|
|
72
|
+
subtitle: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Legacy locale-only configuration schema (deprecated, kept for migration)
|
|
78
|
+
* @deprecated Use pluginConfigSchema instead
|
|
79
|
+
*/
|
|
80
|
+
export declare const legacyLocaleConfigSchema: {
|
|
81
|
+
name: string;
|
|
82
|
+
title: string;
|
|
83
|
+
type: string;
|
|
84
|
+
fields: ({
|
|
85
|
+
name: string;
|
|
86
|
+
title: string;
|
|
87
|
+
type: string;
|
|
88
|
+
description: string;
|
|
89
|
+
of: {
|
|
90
|
+
type: string;
|
|
91
|
+
title: string;
|
|
92
|
+
fields: ({
|
|
93
|
+
name: string;
|
|
94
|
+
title: string;
|
|
95
|
+
type: string;
|
|
96
|
+
description: string;
|
|
97
|
+
validation: (Rule: any) => any;
|
|
98
|
+
initialValue?: undefined;
|
|
99
|
+
} | {
|
|
100
|
+
name: string;
|
|
101
|
+
title: string;
|
|
102
|
+
type: string;
|
|
103
|
+
description: string;
|
|
104
|
+
initialValue: boolean;
|
|
105
|
+
validation?: undefined;
|
|
106
|
+
})[];
|
|
107
|
+
preview: {
|
|
108
|
+
select: {
|
|
109
|
+
title: string;
|
|
110
|
+
subtitle: string;
|
|
111
|
+
enabled: string;
|
|
112
|
+
};
|
|
113
|
+
prepare: ({ title, subtitle, enabled }: any) => {
|
|
114
|
+
title: any;
|
|
115
|
+
subtitle: string;
|
|
116
|
+
media: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
}[];
|
|
120
|
+
validation?: undefined;
|
|
121
|
+
initialValue?: undefined;
|
|
122
|
+
readOnly?: undefined;
|
|
123
|
+
} | {
|
|
124
|
+
name: string;
|
|
125
|
+
title: string;
|
|
126
|
+
type: string;
|
|
127
|
+
description: string;
|
|
128
|
+
validation: (Rule: any) => any;
|
|
129
|
+
of?: undefined;
|
|
130
|
+
initialValue?: undefined;
|
|
131
|
+
readOnly?: undefined;
|
|
132
|
+
} | {
|
|
133
|
+
name: string;
|
|
134
|
+
title: string;
|
|
135
|
+
type: string;
|
|
136
|
+
description: string;
|
|
137
|
+
initialValue: string;
|
|
138
|
+
readOnly: boolean;
|
|
139
|
+
of?: undefined;
|
|
140
|
+
validation?: undefined;
|
|
141
|
+
})[];
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Default locale configuration
|
|
145
|
+
*/
|
|
146
|
+
export declare const defaultLocaleConfig: LocaleConfig;
|
|
147
|
+
/**
|
|
148
|
+
* Common locale definitions for quick setup
|
|
149
|
+
*/
|
|
150
|
+
export declare const commonLocales: LocaleDefinition[];
|
|
151
|
+
/**
|
|
152
|
+
* Validate locale code format
|
|
153
|
+
*/
|
|
154
|
+
export declare function validateLocaleCode(code: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Create a new locale definition with current timestamps
|
|
157
|
+
*/
|
|
158
|
+
export declare function createLocaleDefinition(code: string, displayName: string, enabled?: boolean): LocaleDefinition;
|
|
159
|
+
/**
|
|
160
|
+
* Update an existing locale definition with new timestamp
|
|
161
|
+
*/
|
|
162
|
+
export declare function updateLocaleDefinition(locale: LocaleDefinition, updates: Partial<Omit<LocaleDefinition, 'createdAt' | 'updatedAt'>>): LocaleDefinition;
|