Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.0.2 #43

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-element'), 'version' => '34829a68d99b83395c79');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-element'), 'version' => 'b8ed4bdccbcd56ab8952');
36,058 changes: 112 additions & 35,946 deletions build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-toolkit-for-beehiiv.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: integration-toolkit-for-beehiiv
* Domain Path: /languages
* Requires at least: 5.5.0
* Requires at least: 6.5.3
* Tested up to: 6.6.1
* Requires PHP: 7.4
*
Expand Down
5 changes: 3 additions & 2 deletions lib/components/spinner.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styled, { keyframes } from 'styled-components';

const Spinner = ( { label } ) => (
const Spinner = ( { label, marginBottom } ) => (
<SpinnerContainer>
<Loader />
<Loader marginBottom={ marginBottom } />
{ label && <Label>{ label }</Label> }
</SpinnerContainer>
);
Expand Down Expand Up @@ -30,6 +30,7 @@ const Loader = styled.div`
border-radius: 50%;
width: 40px;
height: 40px;
margin-bottom: ${ ( props ) => props.marginBottom ?? '16px' };
animation: ${ spin } 1s linear infinite;
`;

Expand Down
35 changes: 25 additions & 10 deletions lib/container/manaulImport/manaulImportHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function manaulImportHelper(
removeTotalQueuedCampaigns,
scheduleID,
setScheduleID,
removeScheduleID,
removeScheduleID
) {
async function getDefaultOptions() {
try {
Expand Down Expand Up @@ -84,16 +84,31 @@ export function manaulImportHelper(
newState.taxonomies = selectedPostType
? selectedPostType.taxonomies
: [];
newState.selectedTaxonomy = newState.taxonomies.length > 0 ? newState.taxonomies[ 0 ].taxonomy_slug : '';
newState.selectedTerm = (newState.taxonomies.length > 0 && newState.terms.length > 0) ? newState.terms[ 0 ].term_id : '';
newState.selectedTaxonomy =
newState.taxonomies.length > 0
? newState.taxonomies[ 0 ].taxonomy_slug
: '';
newState.selectedTerm =
newState.taxonomies.length > 0 && newState.terms.length > 0
? newState.terms[ 0 ].term_id
: '';
newState.terms = newState.selectedTaxonomy
? newState.taxonomies.find(
( pt ) =>
pt.taxonomy_slug === newState.selectedTaxonomy
).terms
: [];
}

if ( name === 'selectedTaxonomy' ) {
const selectedTaxonomy = state.taxonomies.find(
( pt ) => pt.taxonomy_slug === value
);
newState.terms = selectedTaxonomy ? selectedTaxonomy.terms : [];
newState.selectedTerm = newState.terms.length > 0 ? newState.terms[ 0 ].term_id : '';
newState.selectedTerm =
newState.terms.length > 0
? newState.terms[ 0 ].term_id
: '';
}
if (
( name === 'publishedCampaigns' ||
Expand Down Expand Up @@ -257,7 +272,7 @@ export function manaulImportHelper(
if ( response && response.status === 'active' ) {
updateProgress( response );
clearAllIntervals();
const newIntervalId = importStatus(groupName);
const newIntervalId = importStatus( groupName );
setState( ( prevState ) => ( {
...prevState,
intervalId: [ ...state.intervalId, newIntervalId ],
Expand Down Expand Up @@ -408,16 +423,16 @@ export function manaulImportHelper(
} );
try {
clearAllIntervals();
// Define the base path
let path = `itfb/v1/manage-import-job?job_action=${jobAction}`;
// Define the base path
let path = `itfb/v1/manage-import-job?job_action=${ jobAction }`;

// Check if jobAction is 'cancel' and add groupname to the path if true
if (jobAction === 'cancel') {
if ( jobAction === 'cancel' ) {
const scheduleId = state.scheduleId ?? scheduleID;
path += `&group_name=${groupName}&schedule_id=${scheduleId}`;
path += `&group_name=${ groupName }&schedule_id=${ scheduleId }`;
}
const response = await apiFetch( {
path: path,
path,
method: 'POST',
} );
if ( response ) {
Expand Down
24 changes: 11 additions & 13 deletions lib/container/manaulImport/manualImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ const ManualImport = () => {
contentType,
} = state;

const [
groupName,
setGroupName,
removeGroupName
] = useLocalStorage(
const [ groupName, setGroupName, removeGroupName ] = useLocalStorage(
'groupName',
null
);
Expand All @@ -116,11 +112,10 @@ const ManualImport = () => {
removeTotalQueuedCampaigns,
] = useLocalStorage( 'totalQueuedCampaigns', null );

const [
scheduleID,
setScheduleID,
removeScheduleID,
] = useLocalStorage( 'scheduleID', null );
const [ scheduleID, setScheduleID, removeScheduleID ] = useLocalStorage(
'scheduleID',
null
);

const helper = manaulImportHelper(
state,
Expand All @@ -132,7 +127,7 @@ const ManualImport = () => {
removeTotalQueuedCampaigns,
scheduleID,
setScheduleID,
removeScheduleID,
removeScheduleID
);

const {
Expand Down Expand Up @@ -166,7 +161,10 @@ const ManualImport = () => {
show
modalClosed={ () => logger( 'Fetching Campaigns ...' ) }
>
<Spinner label="Fetching campaigns from Beehiiv. Please wait..." />
<Spinner
label="Fetching campaigns from Beehiiv. Please wait..."
marginBottom="0px"
/>
</Backdrop>
) }
{ startImporting ? (
Expand Down Expand Up @@ -350,7 +348,7 @@ const ManualImport = () => {
{
label: 'All',
value: 'all',
}
},
] }
value={
contentType
Expand Down
6 changes: 3 additions & 3 deletions lib/container/scheduleImport/scheduleImport.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/no-unescaped-entities */
/* eslint-disable react-hooks/exhaustive-deps */
import { Section, Table, Button, ButtonColor } from '@refactco/ui-kit';
import { Table, Button, ButtonColor } from '@refactco/ui-kit';
const { useState, useEffect } = wp.element;
import Spinner from '../../components/spinner';
import { scheduleImportHelper } from './scheduleImportHelper';
Expand Down Expand Up @@ -63,7 +63,7 @@ const ScheduledImport = () => {
const headers = [ 'Schedule Id', 'Recurrency ', 'Publication Id' ];

return (
<Section>
<>
{ loadingScheduledImports ? (
<Spinner />
) : (
Expand Down Expand Up @@ -209,7 +209,7 @@ const ScheduledImport = () => {
</>
) }
</Modal>
</Section>
</>
);
};

Expand Down
28 changes: 14 additions & 14 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { StyledWordpressComponent } from '@refactco/ui-kit';
import { createRoot } from '@wordpress/element';
import Home from './pages/home/home';

document.addEventListener('DOMContentLoaded', () => {
const element = document.getElementById(
'integration-toolkit-for-beehiiv-app'
);
const root = createRoot(element);
if (element) {
root.render(
<>
<StyledWordpressComponent />
<Home />
</>
);
}
});
document.addEventListener( 'DOMContentLoaded', () => {
const element = document.getElementById(
'integration-toolkit-for-beehiiv-app'
);
const root = createRoot( element );
if ( element ) {
root.render(
<>
<StyledWordpressComponent />
<Home />
</>
);
}
} );
1 change: 1 addition & 0 deletions lib/pages/import-campaigns/import-campaigns.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const TabContent = styled.div`
box-shadow: 0px 2px 4px 0px rgba( 0, 0, 0, 0.08 );
padding: 25px 45px;
box-sizing: border-box;
position: relative;
background-color: white; // Match the body's background color
// Removing border for a seamless integration with the rest of the page
`;
Expand Down
29 changes: 16 additions & 13 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,26 @@ Yes, at any time you can navigate to the plugin’s settings in your dashboard a
2. Manual Import
3. Automatic Import

== Upgrade Notice ==
= v1.0.0 =
New: Initial release

== Changelog ==

= v1.0.0 =
New: Initial release

= v1.0.1 =
Fix: Minor bug fixes
= 2.0.1 =
Enhancement: Resolved bugs and improved overall stability.
Enhancement: Added backward compatibility with versions earlier than v2.0.0.

= 2.0.0 =
New: Introduced new features and improvements.
Enhancement: Changed the backend structure of the plugin to use background processing, significantly improving the import process speed.
Enhancement: Enhanced the user interface and user experience of the plugin

= v2.0.0 =
improvements: Added new features
= 1.0.1 =
Rename: Changed the plugin name to "WP to beehiiv Integration."
New: Added beehiiv import option to the WordPress importer.
Fix: Addressed various plugin bugs based on WordPress reports.

= v2.0.1 =
Fix: Resolved bugs and improved stability
Compatibility: Added backward compatibility with versions earlier than v2.0.0
= 1.0.0 =
New: Added a global settings page.
New: Imported posts from beehiiv using the API.
New: Added support for multiple accounts and publications.


Loading