diff --git a/projects/js-packages/shared-extension-utils/index.js b/projects/js-packages/shared-extension-utils/index.js index 2dd8f77b42027..1e1cb994ebf14 100644 --- a/projects/js-packages/shared-extension-utils/index.js +++ b/projects/js-packages/shared-extension-utils/index.js @@ -1,3 +1,4 @@ +export * from './src/block-icons'; export { default as getJetpackData, JETPACK_DATA_PATH } from './src/get-jetpack-data'; export { default as getSiteFragment } from './src/get-site-fragment'; export * from './src/site-type-utils'; @@ -14,10 +15,17 @@ export { getUsableBlockProps, } from './src/plan-utils'; export { default as isCurrentUserConnected } from './src/is-current-user-connected'; +export { default as useAiFeature } from './src/hooks/use-api-feature'; export { default as useAnalytics } from './src/hooks/use-analytics'; export { default as useModuleStatus } from './src/hooks/use-module-status'; +export { default as usePlanType } from './src/hooks/use-plan-type'; +export { default as usePostContent } from './src/hooks/use-post-content'; +export { default as useSaveToMediaLibrary } from './src/hooks/use-save-to-media-library'; export { default as JetpackEditorPanelLogo } from './src/components/jetpack-editor-panel-logo'; export { getBlockIconComponent, getBlockIconProp } from './src/get-block-icon-from-metadata'; export { default as getJetpackBlocksVariation } from './src/get-jetpack-blocks-variation'; +export * from './src/icons'; export * from './src/modules-state'; export { default as isMyJetpackAvailable } from './src/is-my-jetpack-available'; +export { default as useRafInterval } from './src/use-ref-interval'; +export * from './src/wait-for'; diff --git a/projects/plugins/jetpack/extensions/shared/block-icons.js b/projects/js-packages/shared-extension-utils/src/block-icons.js similarity index 85% rename from projects/plugins/jetpack/extensions/shared/block-icons.js rename to projects/js-packages/shared-extension-utils/src/block-icons.js index c2f176002e749..c072ceac038b3 100644 --- a/projects/plugins/jetpack/extensions/shared/block-icons.js +++ b/projects/js-packages/shared-extension-utils/src/block-icons.js @@ -1,5 +1,5 @@ import colorStudio from '@automattic/color-studio'; -import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; +import { isAtomicSite, isSimpleSite } from './site-type-utils'; /** * Constants diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/components/ai-image-modal.scss b/projects/js-packages/shared-extension-utils/src/components/ai-image/components/ai-image-modal.scss similarity index 100% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/components/ai-image-modal.scss rename to projects/js-packages/shared-extension-utils/src/components/ai-image/components/ai-image-modal.scss diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/components/ai-image-modal.tsx b/projects/js-packages/shared-extension-utils/src/components/ai-image/components/ai-image-modal.tsx similarity index 85% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/components/ai-image-modal.tsx rename to projects/js-packages/shared-extension-utils/src/components/ai-image/components/ai-image-modal.tsx index ea6256a9a7bc7..af5b7756bd64d 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/components/ai-image-modal.tsx +++ b/projects/js-packages/shared-extension-utils/src/components/ai-image/components/ai-image-modal.tsx @@ -9,11 +9,11 @@ import { ImageStyle, AiModalFooter, } from '@automattic/jetpack-ai-client'; -import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; import { SelectControl } from '@wordpress/components'; import { useCallback, useRef, useState, useEffect } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import debugFactory from 'debug'; +import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; /** * Internal dependencies */ @@ -27,6 +27,42 @@ const FEATURED_IMAGE_UPGRADE_PROMPT_PLACEMENT = 'ai-image-generator'; const debug = debugFactory( 'jetpack-ai:ai-image-modal' ); +/** + * + * @param root0 + * @param root0.title + * @param root0.cost + * @param root0.open + * @param root0.placement + * @param root0.images + * @param root0.currentIndex + * @param root0.onClose + * @param root0.onTryAgain + * @param root0.onGenerate + * @param root0.generating + * @param root0.notEnoughRequests + * @param root0.requireUpgrade + * @param root0.currentLimit + * @param root0.currentUsage + * @param root0.isUnlimited + * @param root0.upgradeDescription + * @param root0.hasError + * @param root0.postContent + * @param root0.handlePreviousImage + * @param root0.handleNextImage + * @param root0.acceptButton + * @param root0.autoStart + * @param root0.autoStartAction + * @param root0.generateButtonLabel + * @param root0.instructionsPlaceholder + * @param root0.imageStyles + * @param root0.onGuessStyle + * @param root0.prompt + * @param root0.setPrompt + * @param root0.initialStyle + * @param root0.inputDisabled + * @param root0.actionDisabled + */ export default function AiImageModal( { title, cost, @@ -133,8 +169,8 @@ export default function AiImageModal( { const upgradePromptVisible = ( requireUpgrade || notEnoughRequests ) && ! generating; const counterVisible = Boolean( ! isUnlimited && cost && currentLimit ); - const generateLabel = __( 'Generate', 'jetpack' ); - const tryAgainLabel = __( 'Try again', 'jetpack' ); + const generateLabel = __( 'Generate', 'jetpack-shared-extension-utils' ); + const tryAgainLabel = __( 'Try again', 'jetpack-shared-extension-utils' ); /** * Trigger image generation automatically. @@ -174,7 +210,7 @@ export default function AiImageModal( { { showStyleSelector && (
{ __( 'Create and use an AI generated featured image for your post.', 'jetpack' ) }
++ { __( + 'Create and use an AI generated featured image for your post.', + 'jetpack-shared-extension-utils' + ) } +
> ) } @@ -391,7 +404,7 @@ export default function FeaturedImage( { autoStartAction={ handleFirstGenerate } images={ images } currentIndex={ current } - title={ __( 'Generate a featured image with AI', 'jetpack' ) } + title={ __( 'Generate a featured image with AI', 'jetpack-shared-extension-utils' ) } cost={ featuredImageCost } open={ isFeaturedImageModalVisible } placement={ placement } @@ -414,7 +427,7 @@ export default function FeaturedImage( { generateButtonLabel={ pointer?.current > 0 ? generateAgainText : generateText } instructionsPlaceholder={ __( "Describe the featured image you'd like to create and select a style.", - 'jetpack' + 'jetpack-shared-extension-utils' ) } imageStyles={ imageStyles } onGuessStyle={ handleGuessStyle } diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/general-purpose-image.tsx b/projects/js-packages/shared-extension-utils/src/components/ai-image/general-purpose-image.tsx similarity index 93% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/general-purpose-image.tsx rename to projects/js-packages/shared-extension-utils/src/components/ai-image/general-purpose-image.tsx index 9d87cb99064e4..b82c67577a872 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/general-purpose-image.tsx +++ b/projects/js-packages/shared-extension-utils/src/components/ai-image/general-purpose-image.tsx @@ -1,17 +1,17 @@ /** * External dependencies */ -import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; import { Button } from '@wordpress/components'; import { useCallback, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import debugFactory from 'debug'; +import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; /** * Internal dependencies */ import './style.scss'; -import useAiFeature from '../../../../blocks/ai-assistant/hooks/use-ai-feature'; -import { PLAN_TYPE_UNLIMITED, usePlanType } from '../../../../shared/use-plan-type'; +import useAiFeature from '../../hooks/use-ai-feature'; +import { PLAN_TYPE_UNLIMITED, usePlanType } from '../../hooks/use-plan-type'; import usePostContent from '../../hooks/use-post-content'; import useSaveToMediaLibrary from '../../hooks/use-save-to-media-library'; import AiImageModal from './components/ai-image-modal'; @@ -33,6 +33,13 @@ type SetImageCallbackProps = { const debug = debugFactory( 'jetpack-ai:general-purpose-image' ); +/** + * + * @param root0 + * @param root0.placement + * @param root0.onClose + * @param root0.onSetImage + */ export default function GeneralPurposeImage( { placement, onClose = () => {}, @@ -230,15 +237,15 @@ export default function GeneralPurposeImage( { saveToMediaLibrary, ] ); - const generateAgainText = __( 'Generate another image', 'jetpack' ); - const generateText = __( 'Generate', 'jetpack' ); + const generateAgainText = __( 'Generate another image', 'jetpack-shared-extension-utils' ); + const generateText = __( 'Generate', 'jetpack-shared-extension-utils' ); const upgradeDescription = notEnoughRequests ? sprintf( // Translators: %d is the cost of generating a featured image. __( "Image generation costs %d requests per image. You don't have enough requests to generate another image.", - 'jetpack' + 'jetpack-shared-extension-utils' ), generalImageCost ) @@ -250,7 +257,7 @@ export default function GeneralPurposeImage( { variant="primary" disabled={ ! currentImage?.image || currentImage?.generating } > - { __( 'Insert image', 'jetpack' ) } + { __( 'Insert image', 'jetpack-shared-extension-utils' ) } ); @@ -259,7 +266,7 @@ export default function GeneralPurposeImage( { postContent={ true } images={ images } currentIndex={ current } - title={ __( 'Generate an image with AI', 'jetpack' ) } + title={ __( 'Generate an image with AI', 'jetpack-shared-extension-utils' ) } cost={ generalImageCost } open={ isFeaturedImageModalVisible } placement={ placement } @@ -280,7 +287,7 @@ export default function GeneralPurposeImage( { generateButtonLabel={ pointer?.current > 0 ? generateAgainText : generateText } instructionsPlaceholder={ __( "Describe the image you'd like to create and select a style.", - 'jetpack' + 'jetpack-shared-extension-utils' ) } imageStyles={ imageStyles } onGuessStyle={ guessStyle } diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/hooks/use-ai-image.ts b/projects/js-packages/shared-extension-utils/src/components/ai-image/hooks/use-ai-image.ts similarity index 94% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/hooks/use-ai-image.ts rename to projects/js-packages/shared-extension-utils/src/components/ai-image/hooks/use-ai-image.ts index 0edcb0176663b..194a9008f7777 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/hooks/use-ai-image.ts +++ b/projects/js-packages/shared-extension-utils/src/components/ai-image/hooks/use-ai-image.ts @@ -14,7 +14,7 @@ import { cleanForSlug } from '@wordpress/url'; /** * Internal dependencies */ -import useAiFeature from '../../../../../blocks/ai-assistant/hooks/use-ai-feature'; +import useAiFeature from '../../../hooks/use-ai-feature'; import useSaveToMediaLibrary from '../../../hooks/use-save-to-media-library'; /** * Types @@ -37,6 +37,15 @@ export type ImageResponse = { revisedPrompt?: string; }; +/** + * + * @param root0 + * @param root0.feature + * @param root0.type + * @param root0.cost + * @param root0.autoStart + * @param root0.previousMediaId + */ export default function useAiImage( { feature, type, @@ -158,7 +167,10 @@ export default function useAiImage( { { generating: false, error: new Error( - __( "You don't have enough requests to generate another image.", 'jetpack' ) + __( + "You don't have enough requests to generate another image.", + 'jetpack-shared-extension-utils' + ) ), }, pointer.current @@ -200,7 +212,9 @@ export default function useAiImage( { updateRequestsCount(); saveToMediaLibrary( image, name ) .then( savedImage => { - showSnackbarNotice( __( 'Image saved to media library.', 'jetpack' ) ); + showSnackbarNotice( + __( 'Image saved to media library.', 'jetpack-shared-extension-utils' ) + ); updateImages( { libraryId: savedImage?.id, libraryUrl: savedImage?.url, generating: false }, pointer.current diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/hooks/use-site-type.ts b/projects/js-packages/shared-extension-utils/src/components/ai-image/hooks/use-site-type.ts similarity index 97% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/hooks/use-site-type.ts rename to projects/js-packages/shared-extension-utils/src/components/ai-image/hooks/use-site-type.ts index cc99cfa282f22..4e94f023459d2 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/hooks/use-site-type.ts +++ b/projects/js-packages/shared-extension-utils/src/components/ai-image/hooks/use-site-type.ts @@ -1,9 +1,12 @@ /** * External dependencies */ -import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; import { useState } from '@wordpress/element'; +import { isAtomicSite, isSimpleSite } from '@automattic/jetpack-shared-extension-utils'; +/** + * + */ export default function useSiteType() { const getSiteType = () => { if ( isAtomicSite() ) { diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/index.ts b/projects/js-packages/shared-extension-utils/src/components/ai-image/index.ts similarity index 100% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/index.ts rename to projects/js-packages/shared-extension-utils/src/components/ai-image/index.ts diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/style.scss b/projects/js-packages/shared-extension-utils/src/components/ai-image/style.scss similarity index 100% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/style.scss rename to projects/js-packages/shared-extension-utils/src/components/ai-image/style.scss diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/types.ts b/projects/js-packages/shared-extension-utils/src/components/ai-image/types.ts similarity index 100% rename from projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-image/types.ts rename to projects/js-packages/shared-extension-utils/src/components/ai-image/types.ts diff --git a/projects/plugins/jetpack/extensions/shared/components/number-control/index.jsx b/projects/js-packages/shared-extension-utils/src/components/number-control/index.jsx similarity index 100% rename from projects/plugins/jetpack/extensions/shared/components/number-control/index.jsx rename to projects/js-packages/shared-extension-utils/src/components/number-control/index.jsx diff --git a/projects/plugins/jetpack/extensions/shared/external-media/constants.js b/projects/js-packages/shared-extension-utils/src/external-media/constants.js similarity index 64% rename from projects/plugins/jetpack/extensions/shared/external-media/constants.js rename to projects/js-packages/shared-extension-utils/src/external-media/constants.js index 83e1731df976e..34e1377a13d8c 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/constants.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/constants.js @@ -18,11 +18,11 @@ export const PATH_ROOT = '/'; export const PATH_OPTIONS = [ { value: PATH_RECENT, - label: __( 'Photos', 'jetpack' ), + label: __( 'Photos', 'jetpack-shared-extension-utils' ), }, { value: PATH_ROOT, - label: __( 'Albums', 'jetpack' ), + label: __( 'Albums', 'jetpack-shared-extension-utils' ), }, ]; export const GOOGLE_PHOTOS_PICKER_SESSION = 'google_photos_picker_session'; @@ -30,107 +30,107 @@ export const GOOGLE_PHOTOS_CATEGORIES = [ { value: '', /* translators: category of images */ - label: __( 'All categories', 'jetpack' ), + label: __( 'All categories', 'jetpack-shared-extension-utils' ), }, { value: 'animals', /* translators: category of images */ - label: __( 'Animals', 'jetpack' ), + label: __( 'Animals', 'jetpack-shared-extension-utils' ), }, { value: 'arts', /* translators: category of images */ - label: __( 'Arts', 'jetpack' ), + label: __( 'Arts', 'jetpack-shared-extension-utils' ), }, { value: 'birthdays', /* translators: category of images */ - label: __( 'Birthdays', 'jetpack' ), + label: __( 'Birthdays', 'jetpack-shared-extension-utils' ), }, { value: 'cityscapes', /* translators: category of images */ - label: __( 'Cityscapes', 'jetpack' ), + label: __( 'Cityscapes', 'jetpack-shared-extension-utils' ), }, { value: 'crafts', /* translators: category of images */ - label: __( 'Crafts', 'jetpack' ), + label: __( 'Crafts', 'jetpack-shared-extension-utils' ), }, { value: 'fashion', /* translators: category of images */ - label: __( 'Fashion', 'jetpack' ), + label: __( 'Fashion', 'jetpack-shared-extension-utils' ), }, { value: 'food', /* translators: category of images */ - label: __( 'Food', 'jetpack' ), + label: __( 'Food', 'jetpack-shared-extension-utils' ), }, { value: 'flowers', /* translators: category of images */ - label: __( 'Flowers', 'jetpack' ), + label: __( 'Flowers', 'jetpack-shared-extension-utils' ), }, { value: 'gardens', /* translators: category of images */ - label: __( 'Gardens', 'jetpack' ), + label: __( 'Gardens', 'jetpack-shared-extension-utils' ), }, { value: 'holidays', /* translators: category of images */ - label: __( 'Holidays', 'jetpack' ), + label: __( 'Holidays', 'jetpack-shared-extension-utils' ), }, { value: 'houses', /* translators: category of images */ - label: __( 'Houses', 'jetpack' ), + label: __( 'Houses', 'jetpack-shared-extension-utils' ), }, { value: 'landmarks', /* translators: category of images */ - label: __( 'Landmarks', 'jetpack' ), + label: __( 'Landmarks', 'jetpack-shared-extension-utils' ), }, { value: 'landscapes', /* translators: category of images */ - label: __( 'Landscapes', 'jetpack' ), + label: __( 'Landscapes', 'jetpack-shared-extension-utils' ), }, { value: 'night', /* translators: category of images */ - label: __( 'Night', 'jetpack' ), + label: __( 'Night', 'jetpack-shared-extension-utils' ), }, { value: 'people', /* translators: category of images */ - label: __( 'People', 'jetpack' ), + label: __( 'People', 'jetpack-shared-extension-utils' ), }, { value: 'pets', /* translators: category of images */ - label: __( 'Pets', 'jetpack' ), + label: __( 'Pets', 'jetpack-shared-extension-utils' ), }, { value: 'selfies', /* translators: category of images */ - label: __( 'Selfies', 'jetpack' ), + label: __( 'Selfies', 'jetpack-shared-extension-utils' ), }, { value: 'sport', /* translators: category of images */ - label: __( 'Sport', 'jetpack' ), + label: __( 'Sport', 'jetpack-shared-extension-utils' ), }, { value: 'travel', /* translators: category of images */ - label: __( 'Travel', 'jetpack' ), + label: __( 'Travel', 'jetpack-shared-extension-utils' ), }, { value: 'weddings', /* translators: category of images */ - label: __( 'Weddings', 'jetpack' ), + label: __( 'Weddings', 'jetpack-shared-extension-utils' ), }, ]; export const PEXELS_EXAMPLE_QUERIES = [ @@ -151,34 +151,34 @@ export const DATE_RANGE_CUSTOM = 'CUSTOM'; export const GOOGLE_PHOTOS_DATE_PRESETS = [ { value: DATE_RANGE_ANY, - label: __( 'Any time', 'jetpack' ), + label: __( 'Any time', 'jetpack-shared-extension-utils' ), }, { value: DATE_RANGE_LAST_7_DAYS, - label: __( 'Last 7 days', 'jetpack' ), + label: __( 'Last 7 days', 'jetpack-shared-extension-utils' ), }, { value: DATE_RANGE_LAST_30_DAYS, - label: __( 'Last 30 days', 'jetpack' ), + label: __( 'Last 30 days', 'jetpack-shared-extension-utils' ), }, { value: DATE_RANGE_LAST_6_MONTHS, - label: __( 'Last 6 months', 'jetpack' ), + label: __( 'Last 6 months', 'jetpack-shared-extension-utils' ), }, { value: DATE_RANGE_LAST_12_MONTHS, - label: __( 'Last 12 months', 'jetpack' ), + label: __( 'Last 12 months', 'jetpack-shared-extension-utils' ), }, { value: DATE_RANGE_CUSTOM, - label: __( 'Specific Month/Year', 'jetpack' ), + label: __( 'Specific Month/Year', 'jetpack-shared-extension-utils' ), }, ]; export const CURRENT_YEAR = new Date().getFullYear(); export const MONTH_SELECT_OPTIONS = [ - { label: __( 'Any Month', 'jetpack' ), value: -1 }, + { label: __( 'Any Month', 'jetpack-shared-extension-utils' ), value: -1 }, ...map( range( 0, 12 ), value => ( { // Following call generates a new date object for the particular month and gets its name. label: dateI18n( 'F', new Date( 0, value ) ), diff --git a/projects/plugins/jetpack/extensions/shared/external-media/editor.scss b/projects/js-packages/shared-extension-utils/src/external-media/editor.scss similarity index 100% rename from projects/plugins/jetpack/extensions/shared/external-media/editor.scss rename to projects/js-packages/shared-extension-utils/src/external-media/editor.scss diff --git a/projects/plugins/jetpack/extensions/shared/external-media/index.js b/projects/js-packages/shared-extension-utils/src/external-media/index.js similarity index 98% rename from projects/plugins/jetpack/extensions/shared/external-media/index.js rename to projects/js-packages/shared-extension-utils/src/external-media/index.js index ecf704908fa6f..d15baf7156a70 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/index.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/index.js @@ -1,11 +1,16 @@ -import { isCurrentUserConnected } from '@automattic/jetpack-shared-extension-utils'; import { useBlockEditContext } from '@wordpress/block-editor'; import { addFilter } from '@wordpress/hooks'; +import { isCurrentUserConnected } from '@automattic/jetpack-shared-extension-utils'; import MediaButton from './media-button'; import { addPexelsToMediaInserter, addGooglePhotosToMediaInserter } from './media-service'; import { mediaSources } from './sources'; import './editor.scss'; +/** + * + * @param settings + * @param name + */ function insertExternalMediaBlocks( settings, name ) { if ( name !== 'core/image' ) { return settings; diff --git a/projects/plugins/jetpack/extensions/shared/external-media/media-browser/index.js b/projects/js-packages/shared-extension-utils/src/external-media/media-browser/index.js similarity index 93% rename from projects/plugins/jetpack/extensions/shared/external-media/media-browser/index.js rename to projects/js-packages/shared-extension-utils/src/external-media/media-browser/index.js index afddfb0cdec73..28a805b5b5ece 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/media-browser/index.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/media-browser/index.js @@ -11,10 +11,16 @@ const MAX_SELECTED = 10; const EmptyResults = memo( () => ({ __( 'Sorry, but nothing matched your search criteria.', 'jetpack' ) }
++ { __( 'Sorry, but nothing matched your search criteria.', 'jetpack-shared-extension-utils' ) } +
{ __( 'To get started, connect your site to your Google Photos library.', 'jetpack' ) }
-{ __( 'You can remove the connection in either of these places:', 'jetpack' ) }
++ { __( + 'To get started, connect your site to your Google Photos library.', + 'jetpack-shared-extension-utils' + ) } +
++ { __( + 'You can remove the connection in either of these places:', + 'jetpack-shared-extension-utils' + ) } +
{ __( 'Awaiting authorization', 'jetpack' ) }
; + return{ __( 'Awaiting authorization', 'jetpack-shared-extension-utils' ) }
; } export default memo( AuthProgress ); diff --git a/projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/breadcrumbs.js b/projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/breadcrumbs.js similarity index 76% rename from projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/breadcrumbs.js rename to projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/breadcrumbs.js index 71649500f1a41..a6f9c4e927917 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/breadcrumbs.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/breadcrumbs.js @@ -3,11 +3,17 @@ import { Fragment, memo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { PATH_ROOT } from '../../constants'; +/** + * + * @param root0 + * @param root0.path + * @param root0.setPath + */ function Breadcrumbs( { path, setPath } ) { return ({ __( "We've updated our Google Photos service. You will need to disconnect and reconnect to continue accessing your photos.", - 'jetpack' + 'jetpack-shared-extension-utils' ) }
diff --git a/projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/google-photos-auth.js b/projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/google-photos-auth.js similarity index 93% rename from projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/google-photos-auth.js rename to projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/google-photos-auth.js index a6cc6b8e49647..a001c12a8fe45 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/google-photos-auth.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/google-photos-auth.js @@ -8,6 +8,10 @@ import { getApiUrl } from '../api'; import AuthInstructions from './auth-instructions'; import AuthProgress from './auth-progress'; +/** + * + * @param props + */ function GooglePhotosAuth( props ) { const { setAuthenticated } = props; const [ isAuthing, setIsAuthing ] = useState( false ); @@ -41,7 +45,7 @@ function GooglePhotosAuth( props ) { { isAuthing ?{ __( 'Select photos directly from your Google Photos library.', 'jetpack' ) }
++ { __( + 'Select photos directly from your Google Photos library.', + 'jetpack-shared-extension-utils' + ) } +
diff --git a/projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/index.js b/projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/index.js similarity index 99% rename from projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/index.js rename to projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/index.js index 9438f568b24ff..156fc857fca8e 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/index.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/sources/google-photos/index.js @@ -9,6 +9,10 @@ import GooglePhotosAuthUpgrade from './google-photos-auth-upgrade'; import GooglePhotosMedia from './google-photos-media'; import GooglePhotosPickerButton from './google-photos-picker-button'; +/** + * + * @param props + */ function GooglePhotos( props ) { const { isAuthenticated, diff --git a/projects/plugins/jetpack/extensions/shared/external-media/sources/index.js b/projects/js-packages/shared-extension-utils/src/external-media/sources/index.js similarity index 88% rename from projects/plugins/jetpack/extensions/shared/external-media/sources/index.js rename to projects/js-packages/shared-extension-utils/src/external-media/sources/index.js index f150a47ed609c..c5c9a4fa87bda 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/sources/index.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/sources/index.js @@ -22,7 +22,7 @@ import PexelsMedia from './pexels'; export const internalMediaSources = [ { id: SOURCE_JETPACK_APP_MEDIA, - label: __( 'Your Phone', 'jetpack' ), + label: __( 'Your Phone', 'jetpack-shared-extension-utils' ), icon:{ hasImageUploaded && __( 'Select the images below to add, or continue adding more from your device.', - 'jetpack' + 'jetpack-shared-extension-utils' ) } { ! hasImageUploaded && __( 'Scan the QR code with your iPhone or Android camera to upload from your photos.', - 'jetpack' + 'jetpack-shared-extension-utils' ) }
{ ! hasImageUploaded && ( diff --git a/projects/plugins/jetpack/extensions/shared/external-media/sources/openverse.js b/projects/js-packages/shared-extension-utils/src/external-media/sources/openverse.js similarity index 95% rename from projects/plugins/jetpack/extensions/shared/external-media/sources/openverse.js rename to projects/js-packages/shared-extension-utils/src/external-media/sources/openverse.js index abf2a66aa0a38..9d3179f9d079e 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/sources/openverse.js +++ b/projects/js-packages/shared-extension-utils/src/external-media/sources/openverse.js @@ -8,6 +8,10 @@ import { MediaSource } from '../media-service/types'; import { getApiUrl } from './api'; import withMedia from './with-media'; +/** + * + * @param props + */ function OpenverseMedia( props ) { const { media, isCopying, isLoading, pageHandle, multiple, copyMedia, getMedia } = props; @@ -76,7 +80,7 @@ function OpenverseMedia( props ) { onSubmit={ onSearch } >