Notification & Integrations refactoring (#346)

* Integrations Refactoring - WIP

* integrations list & edit - WIP

* Fix integration store binding issue

* integrations refactor - WIP

* Form integration - WIP

* Form integration Edit - WIP

* Integration Refactor - Slack - WIP

* Integration Refactor - Discord - WIP

* Integration Refactor - Webhook - WIP

* Integration Refactor - Send Submission Confirmation - WIP

* Integration Refactor - Backend handler - WIP

* Form Integration Status field

* Integration Refactor - Backend SubmissionConfirmation - WIP

* IntegrationMigration Command

* skip confirmation email test case

* Small refactoring

* FormIntegration status active/inactive

* formIntegrationData to integrationData

* Rename file name with Integration suffix for integration realted files

* Loader on form integrations

* WIP

* form integration test case

* WIP

* Added Integration card - working on refactoring

* change location for IntegrationCard and update package file

* Form Integration Create/Edit in single Modal

* Remove integration extra pages

* crisp_help_page_slug for integration json

* integration logic as collapse

* UI improvements

* WIP

* Trying to debug vue devtools

* WIP for integrations

* getIntegrationHandler change namespace name

* useForm for integration fields + validation structure

* Integration Test case & apply validation rules

* Apply useform changes to integration other files

* validation rules for FormNotificationsMessageActions fields

* Zapier integration as coming soon

* Update FormCleaner

* set default settings for confirmation integration

* WIP

* Finish validation for all integrations

* Updated purify, added integration formatData

* Fix testcase

* Ran pint; working on integration errors

* Handle integration events

* command for Delete Old Integration Events

* Display Past Events in Modal

* on Integration event create with status error send email to form creator

* Polish styling

* Minor improvements

* Finish badge and integration status

* Fix tests and add an integration event test

* Lint

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
formsdev
2024-03-28 22:44:30 +05:30
committed by GitHub
parent d9996e0d9d
commit 6f61faa9ef
84 changed files with 6121 additions and 2205 deletions

View File

@@ -28,12 +28,8 @@ class FormCleaner
private array $customKeys = ['seo_meta'];
private array $formDefaults = [
'notifies' => false,
'no_branding' => false,
'webhook_url' => null,
'database_fields_update' => null,
'slack_webhook_url' => null,
'discord_webhook_url' => null,
'editable_submissions' => false,
'custom_code' => null,
'seo_meta' => [],
@@ -46,12 +42,8 @@ class FormCleaner
private array $cleaningMessages = [
// For form
'notifies' => 'Email notification were disabled.',
'no_branding' => 'OpenForm branding is not hidden.',
'webhook_url' => 'Webhook disabled.',
'database_fields_update' => 'Form submission will only create new records (no updates).',
'slack_webhook_url' => 'Slack webhook disabled.',
'discord_webhook_url' => 'Discord webhook disabled.',
'editable_submissions' => 'Users will not be able to edit their submissions.',
'custom_code' => 'Custom code was disabled',
'seo_meta' => 'Custom SEO was disabled',
@@ -126,7 +118,7 @@ class FormCleaner
*/
public function simulateCleaning(Workspace $workspace): FormCleaner
{
if (! $this->isPro($workspace)) {
if (!$this->isPro($workspace)) {
$this->data = $this->removeProFeatures($this->data, true);
}
@@ -141,7 +133,7 @@ class FormCleaner
*/
public function performCleaning(Workspace $workspace): FormCleaner
{
if (! $this->isPro($workspace)) {
if (!$this->isPro($workspace)) {
$this->data = $this->removeProFeatures($this->data);
}
@@ -217,14 +209,14 @@ class FormCleaner
$formVal = (($formVal === 0 || $formVal === '0') ? false : $formVal);
$formVal = (($formVal === 1 || $formVal === '1') ? true : $formVal);
if (! is_null($formVal) && $formVal !== $value) {
if (! isset($this->cleanings['form'])) {
if (!is_null($formVal) && $formVal !== $value) {
if (!isset($this->cleanings['form'])) {
$this->cleanings['form'] = [];
}
$this->cleanings['form'][] = $key;
// If not a simulation, do the cleaning
if (! $simulation) {
if (!$simulation) {
Arr::set($data, $key, $value);
}
}
@@ -236,7 +228,7 @@ class FormCleaner
foreach ($defaults as $key => $value) {
if (isset($data[$key]) && Arr::get($data, $key) !== $value) {
$this->cleanings[$data['name']][] = $key;
if (! $simulation) {
if (!$simulation) {
Arr::set($data, $key, $value);
}
}