Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into update/convert-e2e-t…
Browse files Browse the repository at this point in the history
…ests-to-esm
  • Loading branch information
anomiex committed Nov 6, 2023
2 parents b2c3668 + 1cd6e0f commit 26eb748
Show file tree
Hide file tree
Showing 382 changed files with 3,844 additions and 6,941 deletions.
216 changes: 191 additions & 25 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Labelling: handle automatic labeling of Contact Form changes in the package.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ async function getLabelsToAdd( octokit, owner, repo, number, isDraft, isRevert )
keywords.add( 'Actions' );
}

// The Contact Form feature now lives in both a package and a Jetpack module.
const contactForm = file.match( /^projects\/packages\/forms\/(?<blocks>src\/blocks)?/ );
if ( contactForm !== null ) {
keywords.add( '[Feature] Contact Form' );
if ( contactForm.groups.blocks ) {
keywords.add( '[Block] Contact Form' );
}
}

// Docker.
const docker = file.match( /^(projects\/plugins\/boost\/docker|tools\/docker)\// );
if ( docker !== null ) {
Expand Down
3 changes: 3 additions & 0 deletions projects/js-packages/ai-client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.14] - 2023-11-03

## [0.1.13] - 2023-10-23
### Changed
- Updated package dependencies. [#33687]
Expand Down Expand Up @@ -151,6 +153,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated package dependencies. [#31659]
- Updated package dependencies. [#31785]

[0.1.14]: https://github.com/Automattic/jetpack-ai-client/compare/v0.1.13...v0.1.14
[0.1.13]: https://github.com/Automattic/jetpack-ai-client/compare/v0.1.12...v0.1.13
[0.1.12]: https://github.com/Automattic/jetpack-ai-client/compare/v0.1.11...v0.1.12
[0.1.11]: https://github.com/Automattic/jetpack-ai-client/compare/v0.1.10...v0.1.11
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion projects/js-packages/ai-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": false,
"name": "@automattic/jetpack-ai-client",
"version": "0.1.14-alpha",
"version": "0.1.14",
"description": "A JS client for consuming Jetpack AI services",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme",
"bugs": {
Expand Down
3 changes: 3 additions & 0 deletions projects/js-packages/boost-score-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.15] - 2023-11-03

## [0.1.14] - 2023-10-19
### Changed
- Updated package dependencies. [#33687]
Expand Down Expand Up @@ -75,6 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Create package for the boost score bar API [#30781]

[0.1.15]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.14...v0.1.15
[0.1.14]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.13...v0.1.14
[0.1.13]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.12...v0.1.13
[0.1.12]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.11...v0.1.12
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion projects/js-packages/boost-score-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-boost-score-api",
"version": "0.1.15-alpha",
"version": "0.1.15",
"description": "A package to get the Jetpack Boost score of a site",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/boost-score-api/#readme",
"bugs": {
Expand Down
5 changes: 5 additions & 0 deletions projects/js-packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### This is a list detailing changes for the Jetpack RNA Components package releases.

## [0.44.4] - 2023-11-03
### Changed
- Updated package dependencies. [#33904]

## [0.44.3] - 2023-10-31
### Fixed
- Fix IconTooltip Popover styles. [#33856]
Expand Down Expand Up @@ -868,6 +872,7 @@
### Changed
- Update node version requirement to 14.16.1

[0.44.4]: https://github.com/Automattic/jetpack-components/compare/0.44.3...0.44.4
[0.44.3]: https://github.com/Automattic/jetpack-components/compare/0.44.2...0.44.3
[0.44.2]: https://github.com/Automattic/jetpack-components/compare/0.44.1...0.44.2
[0.44.1]: https://github.com/Automattic/jetpack-components/compare/0.44.0...0.44.1
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion projects/js-packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-components",
"version": "0.44.4-alpha",
"version": "0.44.4",
"description": "Jetpack Components Package",
"author": "Automattic",
"license": "GPL-2.0-or-later",
Expand Down
9 changes: 9 additions & 0 deletions projects/js-packages/publicize-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.41.2] - 2023-11-03
### Added
- Added Facebook to Quick Share buttons. [#33934]
- Added Nextdoor to Social Previews. [#33907]

### Changed
- Updated package dependencies. [#33904]

## [0.41.1] - 2023-10-26
### Fixed
- Fixed Social Image Generator debouncing. [#33767]
Expand Down Expand Up @@ -483,6 +491,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Updated package dependencies. [#24470]

[0.41.2]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.41.1...v0.41.2
[0.41.1]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.41.0...v0.41.1
[0.41.0]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.40.2...v0.41.0
[0.40.2]: https://github.com/Automattic/jetpack-publicize-components/compare/v0.40.1...v0.40.2
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fixed an issue where initial state is not in sync

This file was deleted.

2 changes: 1 addition & 1 deletion projects/js-packages/publicize-components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-publicize-components",
"version": "0.41.2-alpha",
"version": "0.41.3-alpha",
"description": "A library of JS components required by the Publicize editor plugin",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/publicize-components/#readme",
"bugs": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ToggleControl } from '@automattic/jetpack-components';
import { useSelect, useDispatch } from '@wordpress/data';
import { useCallback } from '@wordpress/element';
import { useEffect } from '@wordpress/element';
import React from 'react';
import { SOCIAL_STORE_ID } from '../../../social-store';
import { SocialStoreSelectors } from '../../../types/types';
Expand All @@ -15,6 +16,11 @@ type AutoConversionToggleProps = {
* The class name to add to the toggle.
*/
toggleClass?: string;

/**
* Whether or not to refresh the settings.
*/
shouldRefresh?: boolean;
};

/**
Expand All @@ -23,7 +29,17 @@ type AutoConversionToggleProps = {
* @param {AutoConversionToggleProps} props - Component props.
* @returns {React.ReactElement} - JSX.Element
*/
const AutoConversionToggle: React.FC< AutoConversionToggleProps > = props => {
const AutoConversionToggle: React.FC< AutoConversionToggleProps > = ( {
shouldRefresh = false,
toggleClass,
children,
} ) => {
const refreshSettings = useDispatch( SOCIAL_STORE_ID ).refreshAutoConversionSettings;

useEffect( () => {
shouldRefresh && refreshSettings();
}, [ shouldRefresh, refreshSettings ] );

const { isEnabled, isUpdating } = useSelect( select => {
const store = select( SOCIAL_STORE_ID ) as SocialStoreSelectors;
return {
Expand All @@ -43,11 +59,11 @@ const AutoConversionToggle: React.FC< AutoConversionToggleProps > = props => {

return (
<ToggleControl
className={ props.toggleClass }
className={ toggleClass }
disabled={ isUpdating }
checked={ isEnabled }
onChange={ toggleStatus }
label={ props.children }
label={ children }
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ToggleControl } from '@automattic/jetpack-components';
import { useSelect, useDispatch } from '@wordpress/data';
import { useCallback } from '@wordpress/element';
import { useEffect } from '@wordpress/element';
import React from 'react';
import { SOCIAL_STORE_ID } from '../../../social-store';
import { SocialStoreSelectors } from '../../../types/types';
Expand All @@ -15,6 +16,11 @@ type SocialImageGeneratorToggleProps = {
* The class name to add to the toggle.
*/
toggleClass?: string;

/**
* Whether or not to refresh the settings.
*/
shouldRefresh?: boolean;
};

/**
Expand All @@ -23,7 +29,17 @@ type SocialImageGeneratorToggleProps = {
* @param {SocialImageGeneratorToggleProps} props - Component props.
* @returns {React.ReactElement} - JSX.Element
*/
const SocialImageGeneratorToggle: React.FC< SocialImageGeneratorToggleProps > = props => {
const SocialImageGeneratorToggle: React.FC< SocialImageGeneratorToggleProps > = ( {
toggleClass,
children,
shouldRefresh = false,
} ) => {
const refreshSettings = useDispatch( SOCIAL_STORE_ID ).refreshSocialImageGeneratorSettings;

useEffect( () => {
shouldRefresh && refreshSettings();
}, [ refreshSettings, shouldRefresh ] );

const { isEnabled, isUpdating } = useSelect( select => {
const store = select( SOCIAL_STORE_ID ) as SocialStoreSelectors;
return {
Expand All @@ -43,11 +59,11 @@ const SocialImageGeneratorToggle: React.FC< SocialImageGeneratorToggleProps > =

return (
<ToggleControl
className={ props.toggleClass }
className={ toggleClass }
disabled={ isUpdating }
checked={ isEnabled }
onChange={ toggleStatus }
label={ props.children }
label={ children }
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ export function* updateAutoConversionSettings( settings ) {
*/
export function* refreshAutoConversionSettings() {
try {
yield setUpdatingAutoConversionSettings();
const updatedSettings = yield fetchAutoConversionSettings();
yield setAutoConversionSettings( updatedSettings );
return true;
} catch ( e ) {
return false;
} finally {
yield setUpdatingAutoConversionSettingsDone();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,27 @@ export function setSocialImageGeneratorSettings( options ) {
return { type: SET_SOCIAL_IMAGE_GENERATOR_SETTINGS, options };
}

export default { updateSocialImageGeneratorSettings, setSocialImageGeneratorSettings };
/**
* Yield actions to refresh settings
*
* @yields {object} - an action object.
* @returns {object} - an action object.
*/
export function* refreshSocialImageGeneratorSettings() {
try {
yield setUpdatingSocialImageGeneratorSettings();
const updatedSettings = yield fetchSocialImageGeneratorSettings();
yield setSocialImageGeneratorSettings( updatedSettings );
return true;
} catch ( e ) {
return false;
} finally {
yield setUpdatingSocialImageGeneratorSettingsDone();
}
}

export default {
updateSocialImageGeneratorSettings,
setSocialImageGeneratorSettings,
refreshSocialImageGeneratorSettings,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
React data sync updates.
6 changes: 2 additions & 4 deletions projects/js-packages/react-data-sync-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"devDependencies": {
"@automattic/jetpack-webpack-config": "workspace:*",
"@tanstack/react-query": "5.0.5",
"jest": "*",
"react": "18.2.0",
"ts-loader": "9.4.2",
Expand All @@ -45,8 +46,5 @@
}
},
"main": "./build/index.js",
"types": "./build/index.d.ts",
"dependencies": {
"swr": "2.2.4"
}
"types": "./build/index.d.ts"
}
19 changes: 19 additions & 0 deletions projects/js-packages/react-data-sync-client/src/ApiError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export class ApiError extends Error {
public name = 'ApiError';
constructor(
public location: string,
public status: number | 'failed_to_sync' | 'json_parse_error' | 'json_empty' | 'schema_error',
public message: string
) {
super( message );

/**
* This makes `foo instanceof ApiError` work.
* To make instanceof work correctly
* set the prototype explicitly.
*
* @see https://stackoverflow.com/a/41102306/1015046
*/
Object.setPrototypeOf( this, ApiError.prototype );
}
}
Loading

0 comments on commit 26eb748

Please sign in to comment.