-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #493 from infinum/feature/notionbuilder
### 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
Showing
64 changed files
with
2,412 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/Blocks/custom/nationbuilder/components/nationbuilder-editor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |
25 changes: 25 additions & 0 deletions
25
src/Blocks/custom/nationbuilder/components/nationbuilder-options.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
17
src/Blocks/custom/nationbuilder/nationbuilder-overrides.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
]) | ||
); |
Oops, something went wrong.