Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8b2fd52
chore: Update minimum required version to 6.5.3
jamalisaeed Sep 2, 2024
75b4c74
#1208158399554176 fix:loading display outside of the box
mahdi-ha-dev Sep 9, 2024
bda49ad
Merge pull request #41 from refactco/1208158399554176-adjust-loading-…
jamalisaeed Sep 22, 2024
e230436
#1208256028415588 chore: Update readme.txt with version history and e…
jamalisaeed Sep 22, 2024
f5a5f20
Merge pull request #42 from refactco/1208256028415588-detailed-changelog
jamalisaeed Sep 22, 2024
192b11d
fix: change the terms when post type changed
mahdi-ha-dev Oct 16, 2024
a92275b
#1208500086706037 refactor: replace regex with DOMDocument for campai…
jamalisaeed Oct 17, 2024
3e76bed
#1208607602588029 feat: add REST API endpoints for add and edit sched…
jamalisaeed Oct 28, 2024
21e201e
#1208607600125986 feat: add REST API endpoints for adding and retriev…
jamalisaeed Nov 3, 2024
fb97671
#1208607600125986 feat: add DELETE endpoint for removing connections …
jamalisaeed Nov 3, 2024
0cd23ac
feat: add Connections page and update routing; remove unused import c…
mahdi-ha-dev Nov 18, 2024
ca82e61
#1208607602588029 feat: add connection handling for import campaigns;…
jamalisaeed Nov 20, 2024
d92a4eb
feat: implement Add Button and Add New Schedule Modal components; enh…
mahdi-ha-dev Nov 20, 2024
278d9de
Merge branch 'version-2.0.2' of https://github.com/refactco/integrati…
mahdi-ha-dev Nov 20, 2024
5055e88
#1208158399554181 feat: enhance parameter validation for new connecti…
jamalisaeed Nov 20, 2024
2da803d
#1208158399554181 refactor: clean up code formatting and improve comm…
jamalisaeed Nov 20, 2024
49e4d82
feat: update schedule import functionality; enhance UI and error hand…
mahdi-ha-dev Nov 21, 2024
39eacec
#1208158399554181 feat: enhance connection handling and validation; i…
jamalisaeed Nov 21, 2024
2477727
feat: enhance add new schedule form; improve connection handling and …
mahdi-ha-dev Nov 24, 2024
81f6900
feat: add edit functionality for scheduled imports
mahdi-ha-dev Nov 25, 2024
6db1fa5
feat: update schedule import functionality; remove console logs and i…
mahdi-ha-dev Nov 26, 2024
5ecbd91
feat: update parameter handling in add new schedule form; ensure bool…
jamalisaeed Nov 26, 2024
a560703
#1208607602588029 feat: refine parameter handling in scheduled import…
jamalisaeed Nov 26, 2024
2321bca
feat: enhance scheduled import functionality;
mahdi-ha-dev Dec 1, 2024
d18acaa
feat: enhance connection fetching logic
mahdi-ha-dev Dec 1, 2024
9c4260f
feat: show list of connections
mahdi-ha-dev Dec 1, 2024
51e588e
feat: implement delete connection
mahdi-ha-dev Dec 1, 2024
3a92ffb
feat: use connection handling in manual import
mahdi-ha-dev Dec 2, 2024
defb64f
feat: add subscription box to about page
mahdi-ha-dev Dec 2, 2024
0b5f7ac
feat: implement user interface of about page
mahdi-ha-dev Dec 3, 2024
64086bb
feat: add onboarding modal
mahdi-ha-dev Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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' => '25796d01c3d2c0608321');
3,293 changes: 3,056 additions & 237 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
16 changes: 15 additions & 1 deletion lib/assets/css/reactToastify.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
--toastify-toast-max-height: 800px;
--toastify-toast-bd-radius: 6px;
--toastify-font-family: sans-serif;
--toastify-z-index: 9999;
--toastify-z-index: 100001;
--toastify-text-color-light: #757575;
--toastify-text-color-dark: #fff;
--toastify-text-color-info: #fff;
Expand Down Expand Up @@ -901,3 +901,17 @@
text-decoration: underline;
cursor: pointer;
}

.include-as-connection-container{
margin-top: 40px;
}
.components-modal__content {
margin-top: 0 !important;
}
.components-modal__content.has-scrolled-content:not(.hide-header) .components-modal__header {
border-width: 0 !important;
}
.szh-accordion__item {
margin-bottom: 40px;
border-bottom: 1px solid #d7dbdb !important;
}
30 changes: 30 additions & 0 deletions lib/components/about-plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { styled } from 'styled-components';
export function AboutPlugin() {
return (
<AboutPluginWrapper>
<h2>About RE/beehiiv</h2>
<p>Boost your productivity with our streamlined plugin, designed to simplify your workflow and integrate seamlessly with your favorite tools. Whether you're automating tasks, tracking key metrics, or improving efficiency, this plugin delivers the flexibility and ease you need to stay focused on what matters most. Get started today and experience a smarter, more effective way to work.</p>
</AboutPluginWrapper>
);
};

const AboutPluginWrapper = styled.div`
width: 100%;
display: flex;
flex-direction: column;
gap: 18px;
& > * {
flex: 1;
margin:0;
}
`;

const PluginInfo = styled.div`
display: flex;
flex-direction: row;
gap: 18px;
align-items: center;
& > * {
margin: 0;
}
`;
23 changes: 23 additions & 0 deletions lib/components/add-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Button, ButtonColor } from '@refactco/ui-kit';
const AddButton = ({
children,
icon,
iconPosition = 'left',
buttonColor = ButtonColor.GREEN,
onClick,
}) => {

return(
<Button
color={ buttonColor }
icon={ icon ?? null }
iconPosition={ iconPosition }
style={ { display: 'flex', alignItems: 'center' } }
onClick={ onClick }
>
{ children }
</Button>
)
};

export default AddButton;
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
const apiFetch = wp.apiFetch;
import { toast } from 'react-toastify';
export function addNewConnectionModalHelper(
state,
setState,
handleRefreshConnectionsData,
onClose
) {

function handleInputChange( value, name ) {
setState( ( prevState ) => {
const newState = { ...prevState, [ name ]: value };
return newState;
} );
}
function validateInput( name, value ) {
switch ( name ) {
case 'apiKey':
if ( ! value ) return 'API Key is required.';
if ( value.length !== 64 )
return 'API Key must be 64 characters.';
break;
case 'publicationId':
if ( ! value ) return 'Publication ID is required.';
if ( value.length !== 40 )
return 'Publication ID must be 40 characters.';
break;
case 'connectionName':
if ( ! value ) return 'Connection Name is required.';
break;

default:
return '';
}
}

function handleBlur(name, value) {
const error = validateInput(name, value);
setState((prevState) => {
const newErrors = { ...prevState.errors, [name]: error };
const isFormDisabled = Object.values(newErrors).some((err) => err);

return {
...prevState,
errors: newErrors,
isFormDisabled,
};
});
}

const createNewConnectionHandler = async (event) => {
event.preventDefault();
const { apiKey, publicationId, connectionName } = state;
const data = {
api_key: apiKey,
publication_id: publicationId,
connection_name: connectionName,
};
try {
setState( ( prevState ) => ( {
...prevState,
isFormDisabled: true,
disableInput: true,
} ) );

let path = 'itfb/v1/add-connection';
const response = await apiFetch( {
path,
method: 'POST',
data,
} );
const { message } = response;


if(response.data){
toast.error(message);

} else {
onClose();
handleRefreshConnectionsData();
toast.success( message );

}


} catch ( error ) {
console.log(error)
const { message } = error;

setState( ( prevState ) => ( {
...prevState,
errors: { },
isFormDisabled: false,
disableInput: false,
} ) );

toast.error( message );
}
}
return {
handleInputChange,
handleBlur,
createNewConnectionHandler,
};
}
153 changes: 153 additions & 0 deletions lib/components/add-new-connection-modal/add-new-connection-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
import { Modal } from '@wordpress/components';
import { Section } from '@refactco/ui-kit';
const { useState } = wp.element;
import { addNewConnectionModalHelper } from './add-new-connection-modal-helper';
import {
Button,
Input,
InputType,
Tooltip,
TooltipMode,
TooltipPlace,
} from '@refactco/ui-kit';
import { ErrorContainer } from '../add-new-schedule-form/add-new-schedule-form';
import styled from 'styled-components';

const FormContainer = styled.div`
display: flex;
flex-direction: column;
gap: 16px;
@media (min-width: 768px) {
flex-direction: row;
flex-wrap: wrap;
}
`;

const InputWrapper = styled.div`
width: 100%;
&:nth-child(3) {
margin-bottom: 16px;
}
`;

const AddNewConnectionModal = ({
onClose,
handleRefreshConnectionsData,
}) => {
const [state, setState] = useState({
apiKey: '',
publicationId: '',
connectionName: '',
isFormDisabled: true,
errors: {},
disableInput: false,
});

const {
apiKey,
publicationId,
connectionName,
isFormDisabled,
errors,
disableInput,
} = state;

const helper = addNewConnectionModalHelper(
state,
setState,
handleRefreshConnectionsData,
onClose
);
const {
handleInputChange,
handleBlur,
createNewConnectionHandler,
} = helper;

return (
<Modal onRequestClose={onClose} size="large">
<Section
headerProps={{
title: 'Create a New Connection',
description: 'Create a new connection to use in manual/scheduled imports.',
}}
>
<form onSubmit={createNewConnectionHandler}>
<FormContainer>
<InputWrapper>
<label className="label" htmlFor="apiKey">
API Key
<Tooltip
id="apiKey"
mode={TooltipMode.DARK}
place={TooltipPlace.TOP}
content="The API Key is a unique identifier that allows you to access your Beehiiv account data. You can find your API Key by logging into your Beehiiv account and go to Settings > Integrations > which will open up the API tab"
>
<div className="question-icon">?</div>
</Tooltip>
</label>
<Input
type={InputType.TEXT}
value={apiKey}
onChange={(value) => handleInputChange(value, 'apiKey')}
onBlur={() => handleBlur('apiKey', apiKey)}
required
hasError={errors.apiKey}
disabled={disableInput}
autoFocus
/>
{errors.apiKey && <ErrorContainer>{errors.apiKey}</ErrorContainer>}
</InputWrapper>
<InputWrapper>
<label className="label" htmlFor="publicationId">
Publication ID
<Tooltip
id="publicationId"
mode={TooltipMode.DARK}
place={TooltipPlace.TOP}
content="The Publication ID is a unique identifier that allows you to access your Beehiiv account data. You can find your Publication ID by logging into your Beehiiv account and go to Settings > Integrations > which will open up the API tab"
>
<div className="question-icon">?</div>
</Tooltip>
</label>
<Input
type={InputType.TEXT}
value={publicationId}
onChange={(value) => handleInputChange(value, 'publicationId')}
onBlur={() => handleBlur('publicationId', publicationId)}
required
hasError={errors.publicationId}
disabled={disableInput}
/>
{errors.publicationId && <ErrorContainer>{errors.publicationId}</ErrorContainer>}
</InputWrapper>
<InputWrapper>
<label className="label" htmlFor="connectionName">
Name of Connection
</label>
<Input
type={InputType.TEXT}
value={connectionName}
onChange={(value) => handleInputChange(value, 'connectionName')}
onBlur={() => handleBlur('connectionName', connectionName)}
hasError={errors.connectionName}
required
disabled={disableInput}
/>
{errors.connectionName && <ErrorContainer>{errors.connectionName}</ErrorContainer>}
</InputWrapper>
</FormContainer>
<Button
type="submit"
onClick={createNewConnectionHandler}
disabled={isFormDisabled }
>
Create Connection
</Button>
</form>
</Section>
</Modal>
);
};

export default AddNewConnectionModal;
Loading