Skip to content

Commit

Permalink
Merge pull request #1080 from Parsely/release/3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
acicovic authored Sep 13, 2022
2 parents 4e21db6 + d79377c commit 747c7be
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 46 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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).

## [3.5.1](https://github.com/Parsely/wp-parsely/compare/3.5.0...3.5.1) - 2022-09-13

### Fixed

- Content Helper: Fix broken links in "Post Stats" button ([#1077](https://github.com/Parsely/wp-parsely/pull/1077))

## [3.5.0](https://github.com/Parsely/wp-parsely/compare/3.4.2...3.5.0) - 2022-08-08

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Parse.ly

Stable tag: 3.5.0
Stable tag: 3.5.1
Requires at least: 5.0
Tested up to: 6.0.1
Requires PHP: 7.1
Expand Down
2 changes: 1 addition & 1 deletion build/content-helper.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url'), 'version' => '957d060e2aab264a31ce');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url'), 'version' => '4de2014303dbe6c5c613');
2 changes: 1 addition & 1 deletion build/content-helper.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-parsely",
"version": "3.5.0",
"version": "3.5.1",
"private": true,
"description": "The Parse.ly plugin facilitates real-time and historical analytics to your content through a platform designed and built for digital publishing.",
"author": "parsely, hbbtstar, jblz, mikeyarce, GaryJ, parsely_mike, pauarge",
Expand Down
7 changes: 0 additions & 7 deletions src/@types/index.d.ts

This file was deleted.

21 changes: 12 additions & 9 deletions src/Endpoints/class-analytics-posts-api-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ public function get_items( WP_REST_Request $request ): stdClass {
* @return array<stdClass> The generated data.
*/
protected function generate_data( array $response ): array {
$date_format = get_option( 'date_format' );
$result = array_map(
static function( stdClass $item ) use ( $date_format ) {
$date_format = get_option( 'date_format' );
$stats_base_url = trailingslashit( 'https://dash.parsely.com/' . esc_js( $this->parsely->get_api_key() ) ) . 'find';

$result = array_map(
static function( stdClass $item ) use ( $date_format, $stats_base_url ) {
return (object) array(
'author' => $item->author,
'date' => wp_date( $date_format, strtotime( $item->pub_date ) ),
'id' => $item->url,
'title' => $item->title,
'url' => $item->url,
'views' => $item->metrics->views,
'author' => $item->author,
'date' => wp_date( $date_format, strtotime( $item->pub_date ) ),
'id' => $item->url,
'statsUrl' => $stats_base_url . '?url=' . rawurlencode( $item->url ),
'title' => $item->title,
'url' => $item->url,
'views' => $item->metrics->views,
);
},
$response
Expand Down
2 changes: 1 addition & 1 deletion src/Endpoints/class-base-api-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract class Base_API_Proxy {
*
* @var Parsely
*/
private $parsely;
protected $parsely;

/**
* Proxy object which does the actual calls to the Parse.ly API.
Expand Down
9 changes: 1 addition & 8 deletions src/blocks/content-helper/content-helper-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ContentHelperProvider {
message = `${ __( 'The Parse.ly API did not return any results for top-performing posts', 'wp-parsely' ) } ${ fetchQueryResult.message }.`;
}

return { message, posts: this.processData( data ) };
return { message, posts: data };
}

private static async fetchData( fetchDataQueryResult: BuildFetchDataQueryResult ): Promise<SuggestedPost[] | string> {
Expand All @@ -75,13 +75,6 @@ class ContentHelperProvider {
return response?.data || [];
}

private static processData( data: SuggestedPost[] ): SuggestedPost[] {
return data.map( ( p ) => {
const statsUrl = `${ window.wpParselyContentHelperPrefix }?url=${ window.encodeURIComponent( p.url ) }`;
return Object.assign( p, { statsUrl } );
} );
}

private static buildFetchDataQuery( author: Schema.User, category: Schema.Taxonomy, tag: Schema.Taxonomy ): BuildFetchDataQueryResult {
const limit = 5;

Expand Down
26 changes: 14 additions & 12 deletions tests/Integration/Endpoints/AnalyticsPostsProxyEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,22 @@ function () use ( &$dispatched ) {
(object) array(
'data' => array(
(object) array(
'author' => 'Aakash Shah',
'date' => wp_date( $date_format, strtotime( '2020-04-06T13:30:58' ) ),
'id' => 'https://blog.parse.ly/web-analytics-software-tools/?itm_source=parsely-api',
'title' => '9 Types of Web Analytics Tools — And How to Know Which Ones You Really Need',
'url' => 'https://blog.parse.ly/web-analytics-software-tools/?itm_source=parsely-api',
'views' => 142,
'author' => 'Aakash Shah',
'date' => wp_date( $date_format, strtotime( '2020-04-06T13:30:58' ) ),
'id' => 'https://blog.parse.ly/web-analytics-software-tools/?itm_source=parsely-api',
'statsUrl' => 'https://dash.parsely.com/blog.parsely.com/find?url=https%3A%2F%2Fblog.parse.ly%2Fweb-analytics-software-tools%2F%3Fitm_source%3Dparsely-api',
'title' => '9 Types of Web Analytics Tools — And How to Know Which Ones You Really Need',
'url' => 'https://blog.parse.ly/web-analytics-software-tools/?itm_source=parsely-api',
'views' => 142,
),
(object) array(
'author' => 'Stephanie Schwartz and Andrew Butler',
'date' => wp_date( $date_format, strtotime( '2021-04-30T20:30:24' ) ),
'id' => 'https://blog.parse.ly/5-tagging-best-practices-content-strategy/?itm_source=parsely-api',
'title' => '5 Tagging Best Practices For Getting the Most Out of Your Content Strategy',
'url' => 'https://blog.parse.ly/5-tagging-best-practices-content-strategy/?itm_source=parsely-api',
'views' => 40,
'author' => 'Stephanie Schwartz and Andrew Butler',
'date' => wp_date( $date_format, strtotime( '2021-04-30T20:30:24' ) ),
'id' => 'https://blog.parse.ly/5-tagging-best-practices-content-strategy/?itm_source=parsely-api',
'statsUrl' => 'https://dash.parsely.com/blog.parsely.com/find?url=https%3A%2F%2Fblog.parse.ly%2F5-tagging-best-practices-content-strategy%2F%3Fitm_source%3Dparsely-api',
'title' => '5 Tagging Best Practices For Getting the Most Out of Your Content Strategy',
'url' => 'https://blog.parse.ly/5-tagging-best-practices-content-strategy/?itm_source=parsely-api',
'views' => 40,
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
visitAdminPage,
} from '@wordpress/e2e-test-utils';

export const PLUGIN_VERSION = '3.5.0';
export const PLUGIN_VERSION = '3.5.1';

export const waitForWpAdmin = () => page.waitForSelector( 'body.wp-admin' );

Expand Down
4 changes: 2 additions & 2 deletions wp-parsely.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Parse.ly
* Plugin URI: https://www.parse.ly/help/integration/wordpress
* Description: This plugin makes it a snap to add Parse.ly tracking code and metadata to your WordPress blog.
* Version: 3.5.0
* Version: 3.5.1
* Author: Parse.ly
* Author URI: https://www.parse.ly
* Text Domain: wp-parsely
Expand Down Expand Up @@ -52,7 +52,7 @@
return;
}

const PARSELY_VERSION = '3.5.0';
const PARSELY_VERSION = '3.5.1';
const PARSELY_FILE = __FILE__;

require __DIR__ . '/src/class-parsely.php';
Expand Down

0 comments on commit 747c7be

Please sign in to comment.