diff --git a/api/app/Http/Controllers/Integrations/Zapier/IntegrationController.php b/api/app/Http/Controllers/Integrations/Zapier/IntegrationController.php index 46235897..4a8b97b0 100644 --- a/api/app/Http/Controllers/Integrations/Zapier/IntegrationController.php +++ b/api/app/Http/Controllers/Integrations/Zapier/IntegrationController.php @@ -52,11 +52,15 @@ public function poll(PollSubmissionRequest $request) $this->authorize('view', $form); $lastSubmission = $form->submissions()->latest()->first(); + $submissionData = null; if (!$lastSubmission) { // Generate fake data when no previous submissions $submissionData = (new FormSubmissionDataFactory($form))->asFormSubmissionData()->createSubmissionData(); } + $cacheKey = "zapier-poll-submissions-{$form->id}"; + return (array) \Cache::remember($cacheKey, 60 * 5, function () use ($form, $submissionData, $lastSubmission) { + return [ZapierIntegration::formatWebhookData($form, $submissionData ?? $lastSubmission->data)]; + }); - return [ZapierIntegration::formatWebhookData($form, $submissionData ?? $lastSubmission->data)]; } } diff --git a/api/app/Integrations/Handlers/AbstractIntegrationHandler.php b/api/app/Integrations/Handlers/AbstractIntegrationHandler.php index 7d95ef05..47fc78cb 100644 --- a/api/app/Integrations/Handlers/AbstractIntegrationHandler.php +++ b/api/app/Integrations/Handlers/AbstractIntegrationHandler.php @@ -114,13 +114,12 @@ public static function formatWebhookData(Form $form, array $submissionData): arr // Old format - kept for retro-compatibility $oldFormatData = []; - foreach ($formatter->getFieldsWithValue() as $field) { - $oldFormatData[$field['name']] = $field['value']; - } - - // New format using ID $formattedData = []; - foreach ($formatter->getFieldsWithValue() as $field) { + $fieldsWithValue = $formatter->getFieldsWithValue(); + + foreach ($fieldsWithValue as $field) { + $oldFormatData[$field['name']] = $field['value']; + // New format using ID $formattedData[$field['id']] = [ 'value' => $field['value'], 'name' => $field['name'], diff --git a/client/components/open/forms/components/FirstSubmissionModal.vue b/client/components/open/forms/components/FirstSubmissionModal.vue new file mode 100644 index 00000000..25fbbf99 --- /dev/null +++ b/client/components/open/forms/components/FirstSubmissionModal.vue @@ -0,0 +1,108 @@ + + +