Skip to content

Commit

Permalink
Merge pull request #493 from infinum/feature/notionbuilder
Browse files Browse the repository at this point in the history
### Added

- `Success` and `Error` buttons for admin.
- New `NationBuilder` integration.
- `NationBuilder` cron job.
- OAuth implementation for `NationBuilder` integration and future integrations.
- `Mailer` can now send empty field values based on the admin settings.
- New filter `esFormsIntegrationsMailerBodyTemplate` for filtering html body of the email before sending.

### Changed

- `Clearbit` cron job internal logic.

### Removed

- Clearbit `setQueue` filter.
- HubSpot `getContactProperties` filter.
- HubSpot `postContactProperties` filter.
  • Loading branch information
iruzevic authored Feb 5, 2025
2 parents 3a25f31 + f969078 commit 949938f
Show file tree
Hide file tree
Showing 64 changed files with 2,412 additions and 188 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.

This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).

## [6.1.0]

### Added

- `Success` and `Error` buttons for admin.
- New `NationBuilder` integration.
- `NationBuilder` cron job.
- OAuth implementation for `NationBuilder` integration and future integrations.
- `Mailer` can now send empty field values based on the admin settings.
- New filter `esFormsIntegrationsMailerBodyTemplate` for filtering HTML body of the email before sending.

### Changed

- `Clearbit` cron job internal logic.

### Removed

- Clearbit `setQueue` filter.
- HubSpot `getContactProperties` filter.
- HubSpot `postContactProperties` filter.

## [6.0.0]

### Fixed
Expand Down Expand Up @@ -1069,6 +1090,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

- Initial production release.

[6.1.0]: https://github.com/infinum/eightshift-forms/compare/6.0.0...6.1.0
[6.0.0]: https://github.com/infinum/eightshift-forms/compare/5.9.10...6.0.0
[5.9.10]: https://github.com/infinum/eightshift-forms/compare/5.9.9...5.9.10
[5.9.9]: https://github.com/infinum/eightshift-forms/compare/5.9.8...5.9.9
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"require": {
"php": ">=8.3",
"erusev/parsedown": "^1.7.4",
"infinum/eightshift-forms-utils": "^3.1.3"
"infinum/eightshift-forms-utils": "^3.2.0"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

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

2 changes: 1 addition & 1 deletion eightshift-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: Eightshift Forms is a complete form builder plugin that utilizes modern Block editor features with multiple third-party integrations, bringing your project to a new level.
* Author: WordPress team @Infinum
* Author URI: https://eightshift.com/
* Version: 6.0.0
* Version: 6.1.0
* Text Domain: eightshift-forms
*
* @package EightshiftForms
Expand Down
5 changes: 2 additions & 3 deletions src/AdminMenus/FormAdminTopBarMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public function getTopBarMenu(WP_Admin_Bar $adminBar): void

$prefix = FormAdminMenu::ADMIN_MENU_SLUG;
$isDevelopMode = UtilsDeveloperHelper::isDeveloperModeActive();
$isDevelopModeQmLog = UtilsDeveloperHelper::isDeveloperQMLogActive();

$version = Helpers::getPluginVersion();

Expand All @@ -93,10 +92,10 @@ public function getTopBarMenu(WP_Admin_Bar $adminBar): void
'id' => $prefix,
'parent' => null,
'group' => null,
'title' => ($isDevelopMode || $isDevelopModeQmLog) ? $mainLabel . UtilsHelper::getUtilsIcons('warning') : $mainLabel,
'title' => $isDevelopMode ? $mainLabel . UtilsHelper::getUtilsIcons('warning') : $mainLabel,
'href' => UtilsGeneralHelper::getListingPageUrl(),
'meta' => [
'title' => ($isDevelopMode || $isDevelopModeQmLog) ? \esc_html__('Debug tools are active!', 'eightshift-forms') : $mainLabel,
'title' => $isDevelopMode ? \esc_html__('Debug tools are active!', 'eightshift-forms') : $mainLabel,
]
],
);
Expand Down
34 changes: 34 additions & 0 deletions src/Blocks/components/submit/submit-admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,33 @@ button {
}
}

&--success,
&--error {
background: transparent;
color: var(--global-colors-esf-admin-accent);
border: 1px solid var(--global-colors-esf-admin-accent);

&:hover {
background: var(--global-colors-esf-admin-accent-05);
}

.es-submit__inner::before {
content: '';
display: inline-block;
inline-size: 0.375rem;
block-size: 0.375rem;
border-radius: 100%;
vertical-align: middle;
background: var(--global-colors-esf-green-500);
}
}

&--error {
.es-submit__inner::before {
background: var(--global-colors-esf-red-500);
}
}

&--fit-icon {
padding: 0.625rem 1rem;
}
Expand All @@ -70,3 +97,10 @@ button {
}
}
}

.es-form-is-disabled {
.es-submit {
pointer-events: none;
opacity: 0.5;
}
}
35 changes: 34 additions & 1 deletion src/Blocks/custom/form-selector/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"eightshift-forms/corvus",
"eightshift-forms/paycek",
"eightshift-forms/pipedrive",
"eightshift-forms/calculator"
"eightshift-forms/calculator",
"eightshift-forms/nationbuilder"
]
}
},
Expand Down Expand Up @@ -328,6 +329,38 @@
"eightshift-forms/submit"
]
]
},
{
"label": "Nationbuilder",
"slug": "nationbuilder",
"blockName": "eightshift-forms/nationbuilder",
"innerBlocks": [
[
"eightshift-forms/input",
{
"inputInputFieldLabel": "E-mail",
"inputInputType": "email",
"inputInputName": "email",
"inputInputIsRequired": true,
"inputInputIsEmail": true,
"inputInputDisabledOptions": [
"inputInputIsRequired",
"inputInputName"
]
}
],
[
"eightshift-forms/input",
{
"inputInputFieldLabel": "Name",
"inputInputIsRequired": true,
"inputInputName": "name"
}
],
[
"eightshift-forms/submit"
]
]
}
]
}
30 changes: 30 additions & 0 deletions src/Blocks/custom/nationbuilder/components/nationbuilder-editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { select } from '@wordpress/data';
import { InnerBlocks } from '@wordpress/block-editor';
import { props, checkAttr, BlockInserter, STORE_NAME } from '@eightshift/frontend-libs/scripts';
import { FormEditor } from '../../../components/form/components/form-editor';

export const NationbuilderEditor = ({ attributes, setAttributes, clientId }) => {
const manifest = select(STORE_NAME).getBlock('nationbuilder');

const {
blockClass,
} = attributes;

const nationbuilderAllowedBlocks = checkAttr('nationbuilderAllowedBlocks', attributes, manifest);

return (
<div className={blockClass}>
<FormEditor
{...props('form', attributes, {
setAttributes,
formContent: <InnerBlocks
allowedBlocks={(typeof nationbuilderAllowedBlocks === 'undefined') || nationbuilderAllowedBlocks}
templateLock={false}
renderAppender={() => <BlockInserter clientId={clientId} />}
/>
})}
/>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { select } from '@wordpress/data';
import { IntegrationsInternalOptions } from '../../../components/integrations/components/integrations-internal-options';
import { STORE_NAME } from '@eightshift/frontend-libs/scripts';

export const NationbuilderOptions = ({
attributes,
setAttributes,
clientId,
}) => {
const manifest = select(STORE_NAME).getBlock('nationbuilder');

const {
title,
} = manifest;

return (
<IntegrationsInternalOptions
title={title}
clientId={clientId}
attributes={attributes}
setAttributes={setAttributes}
/>
);
};
35 changes: 35 additions & 0 deletions src/Blocks/custom/nationbuilder/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs/develop/schemas/block.json",
"blockName": "nationbuilder",
"title": "NationBuilder form",
"description" : "NationBuilder form block",
"category": "eightshift-forms",
"icon": {
"src": "esf-form-nationbuilder"
},
"keywords": [
"nationbuilder"
],
"components": {
"form": "form",
"step": "step"
},
"hasInnerBlocks": true,
"attributes": {
"nationbuilderAllowedBlocks": {
"type": "array"
},
"nationbuilderIntegrationId": {
"type": "string"
},
"nationbuilderFormPostId": {
"type": "string"
},
"nationbuilderFormDataTypeSelector": {
"type": "string"
}
},
"parent": [
"eightshift-forms/form-selector"
]
}
15 changes: 15 additions & 0 deletions src/Blocks/custom/nationbuilder/nationbuilder-block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { InspectorControls } from '@wordpress/block-editor';
import { NationbuilderEditor } from './components/nationbuilder-editor';
import { NationbuilderOptions } from './components/nationbuilder-options';

export const Nationbuilder = (props) => {
return (
<>
<InspectorControls>
<NationbuilderOptions {...props} />
</InspectorControls>
<NationbuilderEditor {...props} />
</>
);
};
33 changes: 33 additions & 0 deletions src/Blocks/custom/nationbuilder/nationbuilder-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* global esFormsLocalization */

import { addFilter } from '@wordpress/hooks';
import { select } from '@wordpress/data';
import { STORE_NAME } from '@eightshift/frontend-libs/scripts/editor';
import { isArray } from 'lodash';

// Provide additional blocks to the forms.
export const hooks = () => {
const { blockName } = select(STORE_NAME).getBlock('nationbuilder');
const namespace = select(STORE_NAME).getSettingsNamespace();

// Adding all additional blocks to the custom form builder.
addFilter('blocks.registerBlockType', `${namespace}/${blockName}`, (settings, name) => {
if (name === `${namespace}/${blockName}`) {
if (typeof esFormsLocalization !== 'undefined' && isArray(esFormsLocalization?.additionalBlocks)) {
esFormsLocalization.additionalBlocks.forEach((element) => {
if (!settings.attributes.nationbuilderAllowedBlocks.default.includes(element)) {
settings.attributes.nationbuilderAllowedBlocks.default.push(element);
}
});
}

select(STORE_NAME).getSettings().allowedBlocksBuilderIntegrationAdditionalBlocksList.forEach((element) => {
if (!settings.attributes.nationbuilderAllowedBlocks.default.includes(element)) {
settings.attributes.nationbuilderAllowedBlocks.default.push(element);
}
});
}

return settings;
});
};
17 changes: 17 additions & 0 deletions src/Blocks/custom/nationbuilder/nationbuilder-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import globalManifest from '../../manifest.json';
import manifest from './manifest.json';
import { getUtilsIcons } from '../../components/form/assets/state-init';

export const overrides = {
...manifest,
icon: {
src: getUtilsIcons('nationbuilder') ?? manifest.icon.src,
},
attributes: {
...manifest.attributes,
nationbuilderAllowedBlocks: {
...manifest.attributes.nationbuilderAllowedBlocks,
default: globalManifest.allowedBlocksBuilderBlocksList
},
},
};
16 changes: 16 additions & 0 deletions src/Blocks/custom/nationbuilder/nationbuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* Template for the NationBuilder Block view.
*
* @package EightshiftForms
*/

use EightshiftFormsVendor\EightshiftLibs\Helpers\Helpers;

echo Helpers::render(
'form',
Helpers::props('form', $attributes, [
'formContent' => $renderContent,
])
);
Loading

0 comments on commit 949938f

Please sign in to comment.