@wordpress/editor 14.41.2-next.v.202603161435.0 → 14.42.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.
- package/CHANGELOG.md +1 -1
- package/build/components/collaborators-overlay/compute-selection.cjs +10 -10
- package/build/components/collaborators-overlay/compute-selection.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay.cjs +11 -0
- package/build/components/collaborators-overlay/overlay.cjs.map +2 -2
- package/build/components/collaborators-overlay/timing-utils.cjs +46 -0
- package/build/components/collaborators-overlay/timing-utils.cjs.map +7 -0
- package/build/components/collaborators-overlay/use-render-cursors.cjs +1 -1
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +16 -3
- package/build/components/post-locked-modal/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/block-diff.cjs +39 -11
- package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +1 -1
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +2 -2
- package/build/components/post-template/block-theme.cjs +7 -4
- package/build/components/post-template/block-theme.cjs.map +2 -2
- package/build/components/post-template/hooks.cjs +39 -2
- package/build/components/post-template/hooks.cjs.map +2 -2
- package/build/components/post-template/panel.cjs +5 -42
- package/build/components/post-template/panel.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +2 -0
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/revision-block-diff/index.cjs +84 -0
- package/build/components/revision-block-diff/index.cjs.map +7 -0
- package/build/components/sidebar/dataform-post-summary.cjs +17 -2
- package/build/components/sidebar/dataform-post-summary.cjs.map +2 -2
- package/build/components/sidebar/index.cjs +5 -1
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/{sync-connection-modal → sync-connection-error-modal}/index.cjs +87 -78
- package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
- package/build/components/{sync-connection-modal → sync-connection-error-modal}/use-retry-countdown.cjs +14 -27
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +7 -0
- package/build/components/visual-editor/index.cjs +2 -2
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/store/actions.cjs +1 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/utils/media-finalize/index.cjs +43 -0
- package/build/utils/media-finalize/index.cjs.map +7 -0
- package/build/utils/sync-error-messages.cjs +29 -16
- package/build/utils/sync-error-messages.cjs.map +3 -3
- package/build-module/components/collaborators-overlay/compute-selection.mjs +10 -10
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay.mjs +11 -0
- package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/timing-utils.mjs +21 -0
- package/build-module/components/collaborators-overlay/timing-utils.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +1 -1
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +16 -3
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/block-diff.mjs +39 -11
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +1 -1
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-template/block-theme.mjs +7 -4
- package/build-module/components/post-template/block-theme.mjs.map +2 -2
- package/build-module/components/post-template/hooks.mjs +37 -1
- package/build-module/components/post-template/hooks.mjs.map +2 -2
- package/build-module/components/post-template/panel.mjs +5 -42
- package/build-module/components/post-template/panel.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +2 -0
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/revision-block-diff/index.mjs +53 -0
- package/build-module/components/revision-block-diff/index.mjs.map +7 -0
- package/build-module/components/sidebar/dataform-post-summary.mjs +17 -2
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +5 -1
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +177 -0
- package/build-module/components/sync-connection-error-modal/index.mjs.map +7 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +36 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +7 -0
- package/build-module/components/visual-editor/index.mjs +2 -2
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/store/actions.mjs +1 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/utils/media-finalize/index.mjs +12 -0
- package/build-module/utils/media-finalize/index.mjs.map +7 -0
- package/build-module/utils/sync-error-messages.mjs +24 -16
- package/build-module/utils/sync-error-messages.mjs.map +3 -3
- package/build-style/style-rtl.css +24 -8
- package/build-style/style.css +24 -8
- package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/timing-utils.d.ts +11 -0
- package/build-types/components/collaborators-overlay/timing-utils.d.ts.map +1 -0
- package/build-types/components/post-locked-modal/index.d.ts +2 -2
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts +1 -3
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts +1 -0
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/revision-block-diff/index.d.ts +6 -0
- package/build-types/components/revision-block-diff/index.d.ts.map +1 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts +22 -0
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts +11 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -0
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/utils/media-finalize/index.d.ts +2 -0
- package/build-types/utils/media-finalize/index.d.ts.map +1 -0
- package/build-types/utils/sync-error-messages.d.ts +17 -3
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +44 -44
- package/src/components/collaborators-overlay/compute-selection.ts +13 -13
- package/src/components/collaborators-overlay/overlay.tsx +19 -0
- package/src/components/collaborators-overlay/timing-utils.ts +30 -0
- package/src/components/collaborators-overlay/use-render-cursors.ts +1 -1
- package/src/components/post-locked-modal/index.js +21 -3
- package/src/components/post-revisions-preview/block-diff.js +59 -20
- package/src/components/post-revisions-preview/diff-markers.js +2 -2
- package/src/components/post-revisions-preview/revisions-canvas.js +1 -1
- package/src/components/post-revisions-preview/test/block-diff.js +69 -31
- package/src/components/post-template/block-theme.js +4 -1
- package/src/components/post-template/hooks.js +42 -0
- package/src/components/post-template/panel.js +5 -59
- package/src/components/provider/use-block-editor-settings.js +2 -0
- package/src/components/revision-block-diff/index.js +74 -0
- package/src/components/revision-block-diff/style.scss +13 -0
- package/src/components/sidebar/dataform-post-summary.js +37 -13
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sync-connection-error-modal/index.tsx +265 -0
- package/src/components/sync-connection-error-modal/style.scss +14 -0
- package/src/components/sync-connection-error-modal/use-retry-countdown.ts +57 -0
- package/src/components/visual-editor/index.js +2 -2
- package/src/store/actions.js +1 -4
- package/src/style.scss +2 -1
- package/src/utils/media-finalize/index.js +11 -0
- package/src/utils/media-finalize/test/index.js +34 -0
- package/src/utils/sync-error-messages.ts +72 -0
- package/src/utils/test/sync-error-messages.js +9 -32
- package/build/components/sync-connection-modal/index.cjs.map +0 -7
- package/build/components/sync-connection-modal/use-retry-countdown.cjs.map +0 -7
- package/build-module/components/sync-connection-modal/index.mjs +0 -170
- package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
- package/build-module/components/sync-connection-modal/use-retry-countdown.mjs +0 -49
- package/build-module/components/sync-connection-modal/use-retry-countdown.mjs.map +0 -7
- package/build-types/components/sync-connection-modal/index.d.ts +0 -8
- package/build-types/components/sync-connection-modal/index.d.ts.map +0 -1
- package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts +0 -9
- package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts.map +0 -1
- package/src/components/sync-connection-modal/index.js +0 -206
- package/src/components/sync-connection-modal/style.scss +0 -14
- package/src/components/sync-connection-modal/use-retry-countdown.js +0 -70
- package/src/utils/sync-error-messages.js +0 -58
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import mediaFinalize from '..';
|
|
10
|
+
|
|
11
|
+
jest.mock( '@wordpress/api-fetch', () => jest.fn() );
|
|
12
|
+
|
|
13
|
+
describe( 'mediaFinalize', () => {
|
|
14
|
+
beforeEach( () => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
} );
|
|
17
|
+
|
|
18
|
+
it( 'should call the finalize endpoint with the correct path and method', async () => {
|
|
19
|
+
apiFetch.mockResolvedValue( {} );
|
|
20
|
+
|
|
21
|
+
await mediaFinalize( 123 );
|
|
22
|
+
|
|
23
|
+
expect( apiFetch ).toHaveBeenCalledWith( {
|
|
24
|
+
path: '/wp/v2/media/123/finalize',
|
|
25
|
+
method: 'POST',
|
|
26
|
+
} );
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
it( 'should propagate errors from apiFetch', async () => {
|
|
30
|
+
apiFetch.mockRejectedValue( new Error( 'Network error' ) );
|
|
31
|
+
|
|
32
|
+
await expect( mediaFinalize( 456 ) ).rejects.toThrow( 'Network error' );
|
|
33
|
+
} );
|
|
34
|
+
} );
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { type ConnectionError } from '@wordpress/core-data';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
// These error codes are defined in the sync package:
|
|
8
|
+
// packages/sync/src/errors.ts
|
|
9
|
+
export const AUTHENTICATION_FAILED = 'authentication-failed';
|
|
10
|
+
export const CONNECTION_EXPIRED = 'connection-expired';
|
|
11
|
+
export const CONNECTION_LIMIT_EXCEEDED = 'connection-limit-exceeded';
|
|
12
|
+
export const DOCUMENT_SIZE_LIMIT_EXCEEDED = 'document-size-limit-exceeded';
|
|
13
|
+
export const UNKNOWN_ERROR = 'unknown-error';
|
|
14
|
+
|
|
15
|
+
interface ConnectionErrorMessages {
|
|
16
|
+
description: string;
|
|
17
|
+
title: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default error messages for known error codes.
|
|
22
|
+
*/
|
|
23
|
+
const ERROR_MESSAGES: Record< string, ConnectionErrorMessages > = {
|
|
24
|
+
[ AUTHENTICATION_FAILED ]: {
|
|
25
|
+
title: __( 'Unable to connect' ),
|
|
26
|
+
description: __(
|
|
27
|
+
"Real-time collaboration couldn't verify your permissions. " +
|
|
28
|
+
'Check that you have access to edit this post or contact your site administrator.'
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
[ CONNECTION_EXPIRED ]: {
|
|
32
|
+
title: __( 'Connection expired' ),
|
|
33
|
+
description: __(
|
|
34
|
+
'Your connection to real-time collaboration has timed out. ' +
|
|
35
|
+
'Editing is paused to prevent conflicts with other editors.'
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
[ CONNECTION_LIMIT_EXCEEDED ]: {
|
|
39
|
+
title: __( 'Too many editors connected' ),
|
|
40
|
+
description: __(
|
|
41
|
+
'Real-time collaboration has reached its connection limit. ' +
|
|
42
|
+
'Try again later or contact your site administrator.'
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
// DOCUMENT_SIZE_LIMIT_EXCEEDED is not included here because it results in
|
|
46
|
+
// collaboration being disabled entirely.
|
|
47
|
+
[ UNKNOWN_ERROR ]: {
|
|
48
|
+
title: __( 'Connection lost' ),
|
|
49
|
+
description: __(
|
|
50
|
+
'The connection to real-time collaboration was interrupted. ' +
|
|
51
|
+
'Editing is paused to prevent conflicts with other editors.'
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get user-facing title and description from a sync connection error.
|
|
58
|
+
*
|
|
59
|
+
* Provides default messages based on error.code.
|
|
60
|
+
*
|
|
61
|
+
* @param error - Connection error.
|
|
62
|
+
* @return Object with title, description, and canRetry flag.
|
|
63
|
+
*/
|
|
64
|
+
export function getSyncErrorMessages(
|
|
65
|
+
error?: ConnectionError
|
|
66
|
+
): ConnectionErrorMessages {
|
|
67
|
+
if ( error?.code && ERROR_MESSAGES[ error?.code ] ) {
|
|
68
|
+
return ERROR_MESSAGES[ error.code ];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return ERROR_MESSAGES[ UNKNOWN_ERROR ];
|
|
72
|
+
}
|
|
@@ -8,39 +8,16 @@ describe( 'getSyncErrorMessages', () => {
|
|
|
8
8
|
'authentication-failed',
|
|
9
9
|
'connection-expired',
|
|
10
10
|
'connection-limit-exceeded',
|
|
11
|
+
'document-size-limit-exceeded',
|
|
11
12
|
'unknown-error',
|
|
12
|
-
] )(
|
|
13
|
-
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
expect.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
canRetry: expect.any( Boolean ),
|
|
21
|
-
} )
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
it( 'should set canRetry to false for authentication-failed', () => {
|
|
27
|
-
const result = getSyncErrorMessages( {
|
|
28
|
-
code: 'authentication-failed',
|
|
29
|
-
} );
|
|
30
|
-
expect( result.canRetry ).toBe( false );
|
|
31
|
-
} );
|
|
32
|
-
|
|
33
|
-
it( 'should set canRetry to true for retryable errors', () => {
|
|
34
|
-
expect(
|
|
35
|
-
getSyncErrorMessages( { code: 'connection-expired' } ).canRetry
|
|
36
|
-
).toBe( true );
|
|
37
|
-
expect(
|
|
38
|
-
getSyncErrorMessages( { code: 'connection-limit-exceeded' } )
|
|
39
|
-
.canRetry
|
|
40
|
-
).toBe( true );
|
|
41
|
-
expect(
|
|
42
|
-
getSyncErrorMessages( { code: 'unknown-error' } ).canRetry
|
|
43
|
-
).toBe( true );
|
|
13
|
+
] )( 'should return title and description for "%s"', ( code ) => {
|
|
14
|
+
const result = getSyncErrorMessages( { code } );
|
|
15
|
+
expect( result ).toEqual(
|
|
16
|
+
expect.objectContaining( {
|
|
17
|
+
title: expect.any( String ),
|
|
18
|
+
description: expect.any( String ),
|
|
19
|
+
} )
|
|
20
|
+
);
|
|
44
21
|
} );
|
|
45
22
|
|
|
46
23
|
it( 'should fall back to unknown-error for unrecognized codes', () => {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/sync-connection-modal/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, select } from '@wordpress/data';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport {\n\tstore as coreDataStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getSyncErrorMessages } from '../../utils/sync-error-messages';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useRetryCountdown } from './use-retry-countdown';\n\nconst { BlockCanvasCover } = unlock( privateApis );\nconst { retrySyncConnection } = unlock( coreDataPrivateApis );\n\n// Debounce time for initial disconnected status to allow connection to establish.\nconst INITIAL_DISCONNECTED_DEBOUNCE_MS = 5000;\n\n// Debounce time for showing the disconnect dialog after the intial connection,\n// allowing brief network interruptions to resolve.\nconst DISCONNECTED_DEBOUNCE_MS = 2000;\n\n/**\n * Sync connection modal that displays when any entity reports a disconnection.\n * Uses BlockCanvasCover.Fill to render in the block canvas.\n *\n * @return {Element|null} The modal component or null if not disconnected.\n */\nexport function SyncConnectionModal() {\n\tconst { connectionState, postType } = useSelect( ( selectFn ) => {\n\t\tconst currentPostType = selectFn( editorStore ).getCurrentPostType();\n\t\treturn {\n\t\t\tconnectionState:\n\t\t\t\tselectFn( coreDataStore ).getSyncConnectionStatus() || null,\n\t\t\tpostType: currentPostType\n\t\t\t\t? selectFn( coreDataStore ).getPostType( currentPostType )\n\t\t\t\t: null,\n\t\t};\n\t}, [] );\n\n\tconst { secondsRemaining, markRetrying } = useRetryCountdown(\n\t\tconnectionState?.retryInMs,\n\t\tconnectionState?.status\n\t);\n\n\tconst copyButtonRef = useCopyToClipboard( () => {\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\treturn serialize( blocks );\n\t} );\n\tconst [ syncConnectionMessage, setSyncConnectionMessage ] =\n\t\tuseState( null );\n\tconst debounceTimerRef = useRef( null );\n\t// Track whether we've passed the initial load phase.\n\tconst hasInitializedRef = useRef( false );\n\n\tconst connectionStatus = connectionState?.status;\n\tconst connectionErrorCode = connectionState?.error?.code;\n\n\tuseEffect( () => {\n\t\t// Clear any pending debounce timer when status changes.\n\t\tif ( debounceTimerRef.current ) {\n\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\tdebounceTimerRef.current = null;\n\t\t}\n\n\t\tif ( connectionStatus === 'connected' ) {\n\t\t\thasInitializedRef.current = true;\n\t\t\tsetSyncConnectionMessage( null );\n\t\t} else if ( connectionStatus === 'disconnected' ) {\n\t\t\tconst showModal = () => {\n\t\t\t\thasInitializedRef.current = true;\n\t\t\t\tsetSyncConnectionMessage(\n\t\t\t\t\tgetSyncErrorMessages( { code: connectionErrorCode } )\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Debounce on first load and after connection is established to allow\n\t\t\t// brief network interruptions to resolve.\n\t\t\tif ( hasInitializedRef.current ) {\n\t\t\t\tdebounceTimerRef.current = setTimeout(\n\t\t\t\t\tshowModal,\n\t\t\t\t\tDISCONNECTED_DEBOUNCE_MS\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdebounceTimerRef.current = setTimeout(\n\t\t\t\t\tshowModal,\n\t\t\t\t\tINITIAL_DISCONNECTED_DEBOUNCE_MS\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( debounceTimerRef.current ) {\n\t\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\t}\n\t\t};\n\t}, [ connectionStatus, connectionErrorCode ] );\n\n\tif ( ! syncConnectionMessage ) {\n\t\treturn null;\n\t}\n\n\tconst { title, description, canRetry } = syncConnectionMessage;\n\n\tlet retryCountdownText;\n\tif ( secondsRemaining > 0 ) {\n\t\tretryCountdownText = sprintf(\n\t\t\t/* translators: %d: number of seconds until retry */\n\t\t\t_n(\n\t\t\t\t'Retrying connection in %d second\\u2026',\n\t\t\t\t'Retrying connection in %d seconds\\u2026',\n\t\t\t\tsecondsRemaining\n\t\t\t),\n\t\t\tsecondsRemaining\n\t\t);\n\t} else if ( secondsRemaining === 0 ) {\n\t\tretryCountdownText = __( 'Retrying\\u2026' );\n\t}\n\n\tlet editPostHref = 'edit.php';\n\tif ( postType?.slug ) {\n\t\teditPostHref = `edit.php?post_type=${ postType.slug }`;\n\t}\n\n\tconst isRetrying = secondsRemaining === 0;\n\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t<Modal\n\t\t\t\toverlayClassName=\"editor-sync-connection-modal\"\n\t\t\t\tisDismissible={ false }\n\t\t\t\tonRequestClose={ () => {} }\n\t\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\t\tshouldCloseOnEsc={ false }\n\t\t\t\tsize=\"medium\"\n\t\t\t\ttitle={ title }\n\t\t\t>\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t<p>{ description }</p>\n\t\t\t\t\t{ retryCountdownText && (\n\t\t\t\t\t\t<p className=\"editor-sync-connection-modal__retry-countdown\">\n\t\t\t\t\t\t\t{ retryCountdownText }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\thref={ editPostHref }\n\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Post type name (e.g., \"Posts\", \"Pages\"). */\n\t\t\t\t\t\t\t\t__( 'Back to %s' ),\n\t\t\t\t\t\t\t\tpostType?.labels?.name ?? __( 'Posts' )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\tvariant={ canRetry ? 'secondary' : 'primary' }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Copy Post Content' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ canRetry && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\taria-disabled={ isRetrying }\n\t\t\t\t\t\t\t\tisBusy={ isRetrying }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tif ( isRetrying ) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmarkRetrying();\n\t\t\t\t\t\t\t\t\tretrySyncConnection();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Retry' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</Modal>\n\t\t</BlockCanvasCover.Fill>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAkC;AAClC,qBAAmC;AACnC,oBAA0B;AAC1B,uBAGO;AACP,0BAGO;AACP,wBAKO;AACP,qBAA4C;AAC5C,kBAAgC;AAKhC,iCAAqC;AACrC,mBAAqC;AACrC,yBAAuB;AACvB,iCAAkC;AAgI7B;AA9HL,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,+BAAY;AACjD,IAAM,EAAE,oBAAoB,QAAI,2BAAQ,iBAAAA,WAAoB;AAG5D,IAAM,mCAAmC;AAIzC,IAAM,2BAA2B;AAQ1B,SAAS,sBAAsB;AACrC,QAAM,EAAE,iBAAiB,SAAS,QAAI,uBAAW,CAAE,aAAc;AAChE,UAAM,kBAAkB,SAAU,aAAAC,KAAY,EAAE,mBAAmB;AACnE,WAAO;AAAA,M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BAAgB;AAAA,cAChB,QAAS;AAAA,cACT,SAAQ;AAAA,cACR,SAAU,MAAM;AACf,oBAAK,YAAa;AACjB;AAAA,gBACD;AACA,6BAAa;AACb,oCAAoB;AAAA,cACrB;AAAA,cAEE,8BAAI,OAAQ;AAAA;AAAA,UACf;AAAA,WAEF;AAAA,SACD;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
|
-
"names": ["coreDataPrivateApis", "editorStore", "coreDataStore", "blockEditorStore", "VStack", "HStack"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/sync-connection-modal/use-retry-countdown.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef } from '@wordpress/element';\n\nconst MIN_RETRYING_DISPLAY_MS = 600;\n\n/**\n * Hook that computes a countdown in seconds from a retryInMs value.\n *\n * @param {number|undefined} retryInMs Milliseconds until next retry.\n * @param {string|undefined} status Current connection status.\n * @return {Object} Object with `secondsRemaining` (number|null) and `markRetrying` callback.\n */\nexport function useRetryCountdown( retryInMs, status ) {\n\tconst [ secondsRemaining, setSecondsRemaining ] = useState( null );\n\tconst [ isRetrying, setIsRetrying ] = useState( false );\n\tconst retryAtRef = useRef( null );\n\n\t// Show \"Retrying\u2026\" for a minimum duration when manually triggered.\n\tconst markRetrying = () => setIsRetrying( true );\n\n\tuseEffect( () => {\n\t\tif ( ! isRetrying ) {\n\t\t\treturn;\n\t\t}\n\t\tconst id = setTimeout(\n\t\t\t() => setIsRetrying( false ),\n\t\t\tMIN_RETRYING_DISPLAY_MS\n\t\t);\n\t\treturn () => clearTimeout( id );\n\t}, [ isRetrying ] );\n\n\tuseEffect( () => {\n\t\t// Only clear countdown when explicitly connected.\n\t\tif ( status === 'connected' ) {\n\t\t\tsetSecondsRemaining( null );\n\t\t\tretryAtRef.current = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// For transient states (e.g. 'connecting' during a retry attempt)\n\t\t// or when retryInMs is not yet available, keep the previous\n\t\t// countdown value to avoid a brief flash.\n\t\tif ( status !== 'disconnected' || ! retryInMs ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst retryAt = Date.now() + retryInMs;\n\t\tretryAtRef.current = retryAt;\n\t\tsetSecondsRemaining( Math.ceil( retryInMs / 1000 ) );\n\n\t\tconst intervalId = setInterval( () => {\n\t\t\tconst remaining = Math.ceil(\n\t\t\t\t( retryAtRef.current - Date.now() ) / 1000\n\t\t\t);\n\t\t\tsetSecondsRemaining( Math.max( 0, remaining ) );\n\t\t\tif ( remaining <= 0 ) {\n\t\t\t\tclearInterval( intervalId );\n\t\t\t\tsetIsRetrying( true );\n\t\t\t}\n\t\t}, 1000 );\n\n\t\treturn () => clearInterval( intervalId );\n\t}, [ retryInMs, status ] );\n\n\tconst displaySeconds = isRetrying ? 0 : secondsRemaining;\n\n\treturn { secondsRemaining: displaySeconds, markRetrying };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA4C;AAE5C,IAAM,0BAA0B;AASzB,SAAS,kBAAmB,WAAW,QAAS;AACtD,QAAM,CAAE,kBAAkB,mBAAoB,QAAI,yBAAU,IAAK;AACjE,QAAM,CAAE,YAAY,aAAc,QAAI,yBAAU,KAAM;AACtD,QAAM,iBAAa,uBAAQ,IAAK;AAGhC,QAAM,eAAe,MAAM,cAAe,IAAK;AAE/C,gCAAW,MAAM;AAChB,QAAK,CAAE,YAAa;AACnB;AAAA,IACD;AACA,UAAM,KAAK;AAAA,MACV,MAAM,cAAe,KAAM;AAAA,MAC3B;AAAA,IACD;AACA,WAAO,MAAM,aAAc,EAAG;AAAA,EAC/B,GAAG,CAAE,UAAW,CAAE;AAElB,gCAAW,MAAM;AAEhB,QAAK,WAAW,aAAc;AAC7B,0BAAqB,IAAK;AAC1B,iBAAW,UAAU;AACrB;AAAA,IACD;AAKA,QAAK,WAAW,kBAAkB,CAAE,WAAY;AAC/C;AAAA,IACD;AAEA,UAAM,UAAU,KAAK,IAAI,IAAI;AAC7B,eAAW,UAAU;AACrB,wBAAqB,KAAK,KAAM,YAAY,GAAK,CAAE;AAEnD,UAAM,aAAa,YAAa,MAAM;AACrC,YAAM,YAAY,KAAK;AAAA,SACpB,WAAW,UAAU,KAAK,IAAI,KAAM;AAAA,MACvC;AACA,0BAAqB,KAAK,IAAK,GAAG,SAAU,CAAE;AAC9C,UAAK,aAAa,GAAI;AACrB,sBAAe,UAAW;AAC1B,sBAAe,IAAK;AAAA,MACrB;AAAA,IACD,GAAG,GAAK;AAER,WAAO,MAAM,cAAe,UAAW;AAAA,EACxC,GAAG,CAAE,WAAW,MAAO,CAAE;AAEzB,QAAM,iBAAiB,aAAa,IAAI;AAExC,SAAO,EAAE,kBAAkB,gBAAgB,aAAa;AACzD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
// packages/editor/src/components/sync-connection-modal/index.js
|
|
2
|
-
import { useSelect, select } from "@wordpress/data";
|
|
3
|
-
import { useCopyToClipboard } from "@wordpress/compose";
|
|
4
|
-
import { serialize } from "@wordpress/blocks";
|
|
5
|
-
import {
|
|
6
|
-
store as coreDataStore,
|
|
7
|
-
privateApis as coreDataPrivateApis
|
|
8
|
-
} from "@wordpress/core-data";
|
|
9
|
-
import {
|
|
10
|
-
privateApis,
|
|
11
|
-
store as blockEditorStore
|
|
12
|
-
} from "@wordpress/block-editor";
|
|
13
|
-
import {
|
|
14
|
-
Button,
|
|
15
|
-
Modal,
|
|
16
|
-
__experimentalHStack as HStack,
|
|
17
|
-
__experimentalVStack as VStack
|
|
18
|
-
} from "@wordpress/components";
|
|
19
|
-
import { useState, useEffect, useRef } from "@wordpress/element";
|
|
20
|
-
import { __, sprintf, _n } from "@wordpress/i18n";
|
|
21
|
-
import { getSyncErrorMessages } from "../../utils/sync-error-messages.mjs";
|
|
22
|
-
import { store as editorStore } from "../../store/index.mjs";
|
|
23
|
-
import { unlock } from "../../lock-unlock.mjs";
|
|
24
|
-
import { useRetryCountdown } from "./use-retry-countdown.mjs";
|
|
25
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
-
var { BlockCanvasCover } = unlock(privateApis);
|
|
27
|
-
var { retrySyncConnection } = unlock(coreDataPrivateApis);
|
|
28
|
-
var INITIAL_DISCONNECTED_DEBOUNCE_MS = 5e3;
|
|
29
|
-
var DISCONNECTED_DEBOUNCE_MS = 2e3;
|
|
30
|
-
function SyncConnectionModal() {
|
|
31
|
-
const { connectionState, postType } = useSelect((selectFn) => {
|
|
32
|
-
const currentPostType = selectFn(editorStore).getCurrentPostType();
|
|
33
|
-
return {
|
|
34
|
-
connectionState: selectFn(coreDataStore).getSyncConnectionStatus() || null,
|
|
35
|
-
postType: currentPostType ? selectFn(coreDataStore).getPostType(currentPostType) : null
|
|
36
|
-
};
|
|
37
|
-
}, []);
|
|
38
|
-
const { secondsRemaining, markRetrying } = useRetryCountdown(
|
|
39
|
-
connectionState?.retryInMs,
|
|
40
|
-
connectionState?.status
|
|
41
|
-
);
|
|
42
|
-
const copyButtonRef = useCopyToClipboard(() => {
|
|
43
|
-
const blocks = select(blockEditorStore).getBlocks();
|
|
44
|
-
return serialize(blocks);
|
|
45
|
-
});
|
|
46
|
-
const [syncConnectionMessage, setSyncConnectionMessage] = useState(null);
|
|
47
|
-
const debounceTimerRef = useRef(null);
|
|
48
|
-
const hasInitializedRef = useRef(false);
|
|
49
|
-
const connectionStatus = connectionState?.status;
|
|
50
|
-
const connectionErrorCode = connectionState?.error?.code;
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (debounceTimerRef.current) {
|
|
53
|
-
clearTimeout(debounceTimerRef.current);
|
|
54
|
-
debounceTimerRef.current = null;
|
|
55
|
-
}
|
|
56
|
-
if (connectionStatus === "connected") {
|
|
57
|
-
hasInitializedRef.current = true;
|
|
58
|
-
setSyncConnectionMessage(null);
|
|
59
|
-
} else if (connectionStatus === "disconnected") {
|
|
60
|
-
const showModal = () => {
|
|
61
|
-
hasInitializedRef.current = true;
|
|
62
|
-
setSyncConnectionMessage(
|
|
63
|
-
getSyncErrorMessages({ code: connectionErrorCode })
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
if (hasInitializedRef.current) {
|
|
67
|
-
debounceTimerRef.current = setTimeout(
|
|
68
|
-
showModal,
|
|
69
|
-
DISCONNECTED_DEBOUNCE_MS
|
|
70
|
-
);
|
|
71
|
-
} else {
|
|
72
|
-
debounceTimerRef.current = setTimeout(
|
|
73
|
-
showModal,
|
|
74
|
-
INITIAL_DISCONNECTED_DEBOUNCE_MS
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return () => {
|
|
79
|
-
if (debounceTimerRef.current) {
|
|
80
|
-
clearTimeout(debounceTimerRef.current);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}, [connectionStatus, connectionErrorCode]);
|
|
84
|
-
if (!syncConnectionMessage) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const { title, description, canRetry } = syncConnectionMessage;
|
|
88
|
-
let retryCountdownText;
|
|
89
|
-
if (secondsRemaining > 0) {
|
|
90
|
-
retryCountdownText = sprintf(
|
|
91
|
-
/* translators: %d: number of seconds until retry */
|
|
92
|
-
_n(
|
|
93
|
-
"Retrying connection in %d second\u2026",
|
|
94
|
-
"Retrying connection in %d seconds\u2026",
|
|
95
|
-
secondsRemaining
|
|
96
|
-
),
|
|
97
|
-
secondsRemaining
|
|
98
|
-
);
|
|
99
|
-
} else if (secondsRemaining === 0) {
|
|
100
|
-
retryCountdownText = __("Retrying\u2026");
|
|
101
|
-
}
|
|
102
|
-
let editPostHref = "edit.php";
|
|
103
|
-
if (postType?.slug) {
|
|
104
|
-
editPostHref = `edit.php?post_type=${postType.slug}`;
|
|
105
|
-
}
|
|
106
|
-
const isRetrying = secondsRemaining === 0;
|
|
107
|
-
return /* @__PURE__ */ jsx(BlockCanvasCover.Fill, { children: /* @__PURE__ */ jsx(
|
|
108
|
-
Modal,
|
|
109
|
-
{
|
|
110
|
-
overlayClassName: "editor-sync-connection-modal",
|
|
111
|
-
isDismissible: false,
|
|
112
|
-
onRequestClose: () => {
|
|
113
|
-
},
|
|
114
|
-
shouldCloseOnClickOutside: false,
|
|
115
|
-
shouldCloseOnEsc: false,
|
|
116
|
-
size: "medium",
|
|
117
|
-
title,
|
|
118
|
-
children: /* @__PURE__ */ jsxs(VStack, { spacing: 6, children: [
|
|
119
|
-
/* @__PURE__ */ jsx("p", { children: description }),
|
|
120
|
-
retryCountdownText && /* @__PURE__ */ jsx("p", { className: "editor-sync-connection-modal__retry-countdown", children: retryCountdownText }),
|
|
121
|
-
/* @__PURE__ */ jsxs(HStack, { justify: "right", children: [
|
|
122
|
-
/* @__PURE__ */ jsx(
|
|
123
|
-
Button,
|
|
124
|
-
{
|
|
125
|
-
__next40pxDefaultSize: true,
|
|
126
|
-
href: editPostHref,
|
|
127
|
-
isDestructive: true,
|
|
128
|
-
variant: "tertiary",
|
|
129
|
-
children: sprintf(
|
|
130
|
-
/* translators: %s: Post type name (e.g., "Posts", "Pages"). */
|
|
131
|
-
__("Back to %s"),
|
|
132
|
-
postType?.labels?.name ?? __("Posts")
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
/* @__PURE__ */ jsx(
|
|
137
|
-
Button,
|
|
138
|
-
{
|
|
139
|
-
__next40pxDefaultSize: true,
|
|
140
|
-
ref: copyButtonRef,
|
|
141
|
-
variant: canRetry ? "secondary" : "primary",
|
|
142
|
-
children: __("Copy Post Content")
|
|
143
|
-
}
|
|
144
|
-
),
|
|
145
|
-
canRetry && /* @__PURE__ */ jsx(
|
|
146
|
-
Button,
|
|
147
|
-
{
|
|
148
|
-
__next40pxDefaultSize: true,
|
|
149
|
-
"aria-disabled": isRetrying,
|
|
150
|
-
isBusy: isRetrying,
|
|
151
|
-
variant: "primary",
|
|
152
|
-
onClick: () => {
|
|
153
|
-
if (isRetrying) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
markRetrying();
|
|
157
|
-
retrySyncConnection();
|
|
158
|
-
},
|
|
159
|
-
children: __("Retry")
|
|
160
|
-
}
|
|
161
|
-
)
|
|
162
|
-
] })
|
|
163
|
-
] })
|
|
164
|
-
}
|
|
165
|
-
) });
|
|
166
|
-
}
|
|
167
|
-
export {
|
|
168
|
-
SyncConnectionModal
|
|
169
|
-
};
|
|
170
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/sync-connection-modal/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, select } from '@wordpress/data';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport {\n\tstore as coreDataStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getSyncErrorMessages } from '../../utils/sync-error-messages';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useRetryCountdown } from './use-retry-countdown';\n\nconst { BlockCanvasCover } = unlock( privateApis );\nconst { retrySyncConnection } = unlock( coreDataPrivateApis );\n\n// Debounce time for initial disconnected status to allow connection to establish.\nconst INITIAL_DISCONNECTED_DEBOUNCE_MS = 5000;\n\n// Debounce time for showing the disconnect dialog after the intial connection,\n// allowing brief network interruptions to resolve.\nconst DISCONNECTED_DEBOUNCE_MS = 2000;\n\n/**\n * Sync connection modal that displays when any entity reports a disconnection.\n * Uses BlockCanvasCover.Fill to render in the block canvas.\n *\n * @return {Element|null} The modal component or null if not disconnected.\n */\nexport function SyncConnectionModal() {\n\tconst { connectionState, postType } = useSelect( ( selectFn ) => {\n\t\tconst currentPostType = selectFn( editorStore ).getCurrentPostType();\n\t\treturn {\n\t\t\tconnectionState:\n\t\t\t\tselectFn( coreDataStore ).getSyncConnectionStatus() || null,\n\t\t\tpostType: currentPostType\n\t\t\t\t? selectFn( coreDataStore ).getPostType( currentPostType )\n\t\t\t\t: null,\n\t\t};\n\t}, [] );\n\n\tconst { secondsRemaining, markRetrying } = useRetryCountdown(\n\t\tconnectionState?.retryInMs,\n\t\tconnectionState?.status\n\t);\n\n\tconst copyButtonRef = useCopyToClipboard( () => {\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\treturn serialize( blocks );\n\t} );\n\tconst [ syncConnectionMessage, setSyncConnectionMessage ] =\n\t\tuseState( null );\n\tconst debounceTimerRef = useRef( null );\n\t// Track whether we've passed the initial load phase.\n\tconst hasInitializedRef = useRef( false );\n\n\tconst connectionStatus = connectionState?.status;\n\tconst connectionErrorCode = connectionState?.error?.code;\n\n\tuseEffect( () => {\n\t\t// Clear any pending debounce timer when status changes.\n\t\tif ( debounceTimerRef.current ) {\n\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\tdebounceTimerRef.current = null;\n\t\t}\n\n\t\tif ( connectionStatus === 'connected' ) {\n\t\t\thasInitializedRef.current = true;\n\t\t\tsetSyncConnectionMessage( null );\n\t\t} else if ( connectionStatus === 'disconnected' ) {\n\t\t\tconst showModal = () => {\n\t\t\t\thasInitializedRef.current = true;\n\t\t\t\tsetSyncConnectionMessage(\n\t\t\t\t\tgetSyncErrorMessages( { code: connectionErrorCode } )\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Debounce on first load and after connection is established to allow\n\t\t\t// brief network interruptions to resolve.\n\t\t\tif ( hasInitializedRef.current ) {\n\t\t\t\tdebounceTimerRef.current = setTimeout(\n\t\t\t\t\tshowModal,\n\t\t\t\t\tDISCONNECTED_DEBOUNCE_MS\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdebounceTimerRef.current = setTimeout(\n\t\t\t\t\tshowModal,\n\t\t\t\t\tINITIAL_DISCONNECTED_DEBOUNCE_MS\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( debounceTimerRef.current ) {\n\t\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\t}\n\t\t};\n\t}, [ connectionStatus, connectionErrorCode ] );\n\n\tif ( ! syncConnectionMessage ) {\n\t\treturn null;\n\t}\n\n\tconst { title, description, canRetry } = syncConnectionMessage;\n\n\tlet retryCountdownText;\n\tif ( secondsRemaining > 0 ) {\n\t\tretryCountdownText = sprintf(\n\t\t\t/* translators: %d: number of seconds until retry */\n\t\t\t_n(\n\t\t\t\t'Retrying connection in %d second\\u2026',\n\t\t\t\t'Retrying connection in %d seconds\\u2026',\n\t\t\t\tsecondsRemaining\n\t\t\t),\n\t\t\tsecondsRemaining\n\t\t);\n\t} else if ( secondsRemaining === 0 ) {\n\t\tretryCountdownText = __( 'Retrying\\u2026' );\n\t}\n\n\tlet editPostHref = 'edit.php';\n\tif ( postType?.slug ) {\n\t\teditPostHref = `edit.php?post_type=${ postType.slug }`;\n\t}\n\n\tconst isRetrying = secondsRemaining === 0;\n\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t<Modal\n\t\t\t\toverlayClassName=\"editor-sync-connection-modal\"\n\t\t\t\tisDismissible={ false }\n\t\t\t\tonRequestClose={ () => {} }\n\t\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\t\tshouldCloseOnEsc={ false }\n\t\t\t\tsize=\"medium\"\n\t\t\t\ttitle={ title }\n\t\t\t>\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t<p>{ description }</p>\n\t\t\t\t\t{ retryCountdownText && (\n\t\t\t\t\t\t<p className=\"editor-sync-connection-modal__retry-countdown\">\n\t\t\t\t\t\t\t{ retryCountdownText }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\thref={ editPostHref }\n\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Post type name (e.g., \"Posts\", \"Pages\"). */\n\t\t\t\t\t\t\t\t__( 'Back to %s' ),\n\t\t\t\t\t\t\t\tpostType?.labels?.name ?? __( 'Posts' )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\tvariant={ canRetry ? 'secondary' : 'primary' }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Copy Post Content' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ canRetry && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\taria-disabled={ isRetrying }\n\t\t\t\t\t\t\t\tisBusy={ isRetrying }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tif ( isRetrying ) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmarkRetrying();\n\t\t\t\t\t\t\t\t\tretrySyncConnection();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Retry' ) }\n\t\t\t\t\t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oBAAC,iBAAiB,MAAjB,EACA;AAAA,IAAC;AAAA;AAAA,MACA,kBAAiB;AAAA,MACjB,eAAgB;AAAA,MAChB,gBAAiB,MAAM;AAAA,MAAC;AAAA,MACxB,2BAA4B;AAAA,MAC5B,kBAAmB;AAAA,MACnB,MAAK;AAAA,MACL;AAAA,MAEA,+BAAC,UAAO,SAAU,GACjB;AAAA,4BAAC,OAAI,uBAAa;AAAA,QAChB,sBACD,oBAAC,OAAE,WAAU,iDACV,8BACH;AAAA,QAED,qBAAC,UAAO,SAAQ,SACf;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,MAAO;AAAA,cACP,eAAa;AAAA,cACb,SAAQ;AAAA,cAEN;AAAA;AAAA,gBAED,GAAI,YAAa;AAAA,gBACjB,UAAU,QAAQ,QAAQ,GAAI,OAAQ;AAAA,cACvC;AAAA;AAAA,UACD;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,KAAM;AAAA,cACN,SAAU,WAAW,cAAc;AAAA,cAEjC,aAAI,mBAAoB;AAAA;AAAA,UAC3B;AAAA,UACE,YACD;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,iBAAgB;AAAA,cAChB,QAAS;AAAA,cACT,SAAQ;AAAA,cACR,SAAU,MAAM;AACf,oBAAK,YAAa;AACjB;AAAA,gBACD;AACA,6BAAa;AACb,oCAAoB;AAAA,cACrB;AAAA,cAEE,aAAI,OAAQ;AAAA;AAAA,UACf;AAAA,WAEF;AAAA,SACD;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// packages/editor/src/components/sync-connection-modal/use-retry-countdown.js
|
|
2
|
-
import { useState, useEffect, useRef } from "@wordpress/element";
|
|
3
|
-
var MIN_RETRYING_DISPLAY_MS = 600;
|
|
4
|
-
function useRetryCountdown(retryInMs, status) {
|
|
5
|
-
const [secondsRemaining, setSecondsRemaining] = useState(null);
|
|
6
|
-
const [isRetrying, setIsRetrying] = useState(false);
|
|
7
|
-
const retryAtRef = useRef(null);
|
|
8
|
-
const markRetrying = () => setIsRetrying(true);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (!isRetrying) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const id = setTimeout(
|
|
14
|
-
() => setIsRetrying(false),
|
|
15
|
-
MIN_RETRYING_DISPLAY_MS
|
|
16
|
-
);
|
|
17
|
-
return () => clearTimeout(id);
|
|
18
|
-
}, [isRetrying]);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (status === "connected") {
|
|
21
|
-
setSecondsRemaining(null);
|
|
22
|
-
retryAtRef.current = null;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (status !== "disconnected" || !retryInMs) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const retryAt = Date.now() + retryInMs;
|
|
29
|
-
retryAtRef.current = retryAt;
|
|
30
|
-
setSecondsRemaining(Math.ceil(retryInMs / 1e3));
|
|
31
|
-
const intervalId = setInterval(() => {
|
|
32
|
-
const remaining = Math.ceil(
|
|
33
|
-
(retryAtRef.current - Date.now()) / 1e3
|
|
34
|
-
);
|
|
35
|
-
setSecondsRemaining(Math.max(0, remaining));
|
|
36
|
-
if (remaining <= 0) {
|
|
37
|
-
clearInterval(intervalId);
|
|
38
|
-
setIsRetrying(true);
|
|
39
|
-
}
|
|
40
|
-
}, 1e3);
|
|
41
|
-
return () => clearInterval(intervalId);
|
|
42
|
-
}, [retryInMs, status]);
|
|
43
|
-
const displaySeconds = isRetrying ? 0 : secondsRemaining;
|
|
44
|
-
return { secondsRemaining: displaySeconds, markRetrying };
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
useRetryCountdown
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=use-retry-countdown.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/sync-connection-modal/use-retry-countdown.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef } from '@wordpress/element';\n\nconst MIN_RETRYING_DISPLAY_MS = 600;\n\n/**\n * Hook that computes a countdown in seconds from a retryInMs value.\n *\n * @param {number|undefined} retryInMs Milliseconds until next retry.\n * @param {string|undefined} status Current connection status.\n * @return {Object} Object with `secondsRemaining` (number|null) and `markRetrying` callback.\n */\nexport function useRetryCountdown( retryInMs, status ) {\n\tconst [ secondsRemaining, setSecondsRemaining ] = useState( null );\n\tconst [ isRetrying, setIsRetrying ] = useState( false );\n\tconst retryAtRef = useRef( null );\n\n\t// Show \"Retrying\u2026\" for a minimum duration when manually triggered.\n\tconst markRetrying = () => setIsRetrying( true );\n\n\tuseEffect( () => {\n\t\tif ( ! isRetrying ) {\n\t\t\treturn;\n\t\t}\n\t\tconst id = setTimeout(\n\t\t\t() => setIsRetrying( false ),\n\t\t\tMIN_RETRYING_DISPLAY_MS\n\t\t);\n\t\treturn () => clearTimeout( id );\n\t}, [ isRetrying ] );\n\n\tuseEffect( () => {\n\t\t// Only clear countdown when explicitly connected.\n\t\tif ( status === 'connected' ) {\n\t\t\tsetSecondsRemaining( null );\n\t\t\tretryAtRef.current = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// For transient states (e.g. 'connecting' during a retry attempt)\n\t\t// or when retryInMs is not yet available, keep the previous\n\t\t// countdown value to avoid a brief flash.\n\t\tif ( status !== 'disconnected' || ! retryInMs ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst retryAt = Date.now() + retryInMs;\n\t\tretryAtRef.current = retryAt;\n\t\tsetSecondsRemaining( Math.ceil( retryInMs / 1000 ) );\n\n\t\tconst intervalId = setInterval( () => {\n\t\t\tconst remaining = Math.ceil(\n\t\t\t\t( retryAtRef.current - Date.now() ) / 1000\n\t\t\t);\n\t\t\tsetSecondsRemaining( Math.max( 0, remaining ) );\n\t\t\tif ( remaining <= 0 ) {\n\t\t\t\tclearInterval( intervalId );\n\t\t\t\tsetIsRetrying( true );\n\t\t\t}\n\t\t}, 1000 );\n\n\t\treturn () => clearInterval( intervalId );\n\t}, [ retryInMs, status ] );\n\n\tconst displaySeconds = isRetrying ? 0 : secondsRemaining;\n\n\treturn { secondsRemaining: displaySeconds, markRetrying };\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU,WAAW,cAAc;AAE5C,IAAM,0BAA0B;AASzB,SAAS,kBAAmB,WAAW,QAAS;AACtD,QAAM,CAAE,kBAAkB,mBAAoB,IAAI,SAAU,IAAK;AACjE,QAAM,CAAE,YAAY,aAAc,IAAI,SAAU,KAAM;AACtD,QAAM,aAAa,OAAQ,IAAK;AAGhC,QAAM,eAAe,MAAM,cAAe,IAAK;AAE/C,YAAW,MAAM;AAChB,QAAK,CAAE,YAAa;AACnB;AAAA,IACD;AACA,UAAM,KAAK;AAAA,MACV,MAAM,cAAe,KAAM;AAAA,MAC3B;AAAA,IACD;AACA,WAAO,MAAM,aAAc,EAAG;AAAA,EAC/B,GAAG,CAAE,UAAW,CAAE;AAElB,YAAW,MAAM;AAEhB,QAAK,WAAW,aAAc;AAC7B,0BAAqB,IAAK;AAC1B,iBAAW,UAAU;AACrB;AAAA,IACD;AAKA,QAAK,WAAW,kBAAkB,CAAE,WAAY;AAC/C;AAAA,IACD;AAEA,UAAM,UAAU,KAAK,IAAI,IAAI;AAC7B,eAAW,UAAU;AACrB,wBAAqB,KAAK,KAAM,YAAY,GAAK,CAAE;AAEnD,UAAM,aAAa,YAAa,MAAM;AACrC,YAAM,YAAY,KAAK;AAAA,SACpB,WAAW,UAAU,KAAK,IAAI,KAAM;AAAA,MACvC;AACA,0BAAqB,KAAK,IAAK,GAAG,SAAU,CAAE;AAC9C,UAAK,aAAa,GAAI;AACrB,sBAAe,UAAW;AAC1B,sBAAe,IAAK;AAAA,MACrB;AAAA,IACD,GAAG,GAAK;AAER,WAAO,MAAM,cAAe,UAAW;AAAA,EACxC,GAAG,CAAE,WAAW,MAAO,CAAE;AAEzB,QAAM,iBAAiB,aAAa,IAAI;AAExC,SAAO,EAAE,kBAAkB,gBAAgB,aAAa;AACzD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sync connection modal that displays when any entity reports a disconnection.
|
|
3
|
-
* Uses BlockCanvasCover.Fill to render in the block canvas.
|
|
4
|
-
*
|
|
5
|
-
* @return {Element|null} The modal component or null if not disconnected.
|
|
6
|
-
*/
|
|
7
|
-
export function SyncConnectionModal(): Element | null;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/sync-connection-modal/index.js"],"names":[],"mappings":"AAyCA;;;;;GAKG;AACH,uCAFY,OAAO,GAAC,IAAI,CAgKvB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook that computes a countdown in seconds from a retryInMs value.
|
|
3
|
-
*
|
|
4
|
-
* @param {number|undefined} retryInMs Milliseconds until next retry.
|
|
5
|
-
* @param {string|undefined} status Current connection status.
|
|
6
|
-
* @return {Object} Object with `secondsRemaining` (number|null) and `markRetrying` callback.
|
|
7
|
-
*/
|
|
8
|
-
export function useRetryCountdown(retryInMs: number | undefined, status: string | undefined): Object;
|
|
9
|
-
//# sourceMappingURL=use-retry-countdown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-retry-countdown.d.ts","sourceRoot":"","sources":["../../../src/components/sync-connection-modal/use-retry-countdown.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,6CAJW,MAAM,GAAC,SAAS,UAChB,MAAM,GAAC,SAAS,GACf,MAAM,CAyDjB"}
|