PluginProbe
The Innovative Form Builder – IvyForms / 1.4.1
The Innovative Form Builder – IvyForms v1.4.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Integrations / IntegrationService.php

IntegrationService.php in The Innovative Form Builder – IvyForms 1.4.1, at backend/src/Services/Integrations/IntegrationService.php

227 lines 7.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Integrations;
4
5 use IvyForms\Common\Exceptions\InvalidArgumentException;
6 use IvyForms\Services\GoogleSheets\Hooks\InitializationHook as GoogleSheetsInitializationHook;
7
8 /**
9 * Integration Service
10 *
11 * Initializes the integration registry and registers default Lite integrations
12 *
13 * @since 1.0.0
14 */
15 class IntegrationService
16 {
17 private IntegrationRegistry $registry;
18 private GoogleSheetsInitializationHook $googleSheetsInitializationHook;
19
20 public function __construct(
21 IntegrationRegistry $registry,
22 GoogleSheetsInitializationHook $googleSheetsInitializationHook
23 ) {
24 $this->registry = $registry;
25 $this->googleSheetsInitializationHook = $googleSheetsInitializationHook;
26 }
27
28 /**
29 * Initialize integrations
30 *
31 * @return void
32 * @throws InvalidArgumentException
33 */
34 public function init(): void
35 {
36 // Register Lite integrations
37 $this->registerLiteIntegrations();
38
39 /**
40 * Allow Pro/addons to register their integrations
41 *
42 * @since 1.0.0
43 *
44 * @param IntegrationRegistry $registry The integration registry instance
45 */
46 do_action('ivyforms/integrations/register', $this->registry);
47
48 $this->initializeGoogleSheets();
49 }
50
51 private function initializeGoogleSheets(): void
52 {
53 $this->googleSheetsInitializationHook->initialize();
54 }
55
56 /**
57 * Register default Lite integrations
58 *
59 * @return void
60 * @throws InvalidArgumentException
61 */
62 private function registerLiteIntegrations(): void
63 {
64 // wpDataTables Integration (Lite)
65 $this->registry->register('wpdatatables', [
66 'label' => 'wpdatatables_label',
67 'component' => 'WpDataTablesIntegrationSettings',
68 'icon' => 'wpdatatables',
69 'description' => 'wpdatatables_description',
70 'category' => 'Data Management',
71 'requiresAuth' => false,
72 'plan' => 'lite',
73 'settingsSchema' => [
74 'enabled' => [
75 'type' => 'boolean',
76 'default' => false,
77 ],
78 ],
79 ]);
80
81 // Amelia Booking Integration (Lite)
82 $this->registry->register('ameliabooking', [
83 'label' => 'ameliabooking_label',
84 'component' => 'AmeliaBookingIntegrationSettings',
85 'icon' => 'ameliabooking',
86 'description' => 'ameliabooking_description',
87 'category' => 'Booking',
88 'requiresAuth' => false,
89 'hasFormSettings' => false,
90 'plan' => 'lite',
91 'settingsSchema' => [
92 'enabled' => [
93 'type' => 'boolean',
94 'default' => false,
95 ],
96 ],
97 ]);
98
99 $this->registerPageBuilderIntegrations();
100
101 // Register Pro integrations as placeholders
102 // These will be shown with "Upgrade" button when Pro is not installed
103 // When Pro is installed, these will be overwritten by Pro's registrar
104
105 // MailChimp Integration (Pro - Essentials)
106 $this->registry->register('mailchimp', [
107 'label' => 'mailchimp_label',
108 'component' => 'MailChimpIntegrationSettings',
109 'icon' => 'mailchimp',
110 'description' => 'mailchimp_description',
111 'category' => 'Email Marketing',
112 'requiresAuth' => true,
113 'hasGlobalSettings' => true,
114 'plan' => 'essentials',
115 ]);
116
117 // Webhooks Integration (Pro - Growth)
118 $this->registry->register('webhooks', [
119 'label' => 'webhooks_label',
120 'component' => 'WebhooksIntegrationSettings',
121 'icon' => 'webhooks',
122 'description' => 'webhooks_description',
123 'category' => 'Developer Tools',
124 'requiresAuth' => false,
125 'hasGlobalSettings' => false,
126 'plan' => 'growth',
127 'learnMoreUrl' => 'https://ivyforms.com/documentation/webhooks-integration/',
128 'settingsSchema' => [
129 'enabled' => [
130 'type' => 'boolean',
131 'default' => false,
132 ],
133 ],
134 ]);
135
136 // Zapier Integration (Pro - Growth)
137 $this->registry->register('zapier', [
138 'label' => 'zapier_label',
139 'component' => 'ZapierIntegrationSettings',
140 'icon' => 'zapier',
141 'description' => 'zapier_description',
142 'category' => 'Automation',
143 'requiresAuth' => false,
144 'hasGlobalSettings' => true,
145 'plan' => 'growth',
146 ]);
147
148 // Public API Integration (Pro - Agency)
149 $this->registry->register('public-api', [
150 'label' => 'public_api_integration_label',
151 'component' => 'PublicApiSettings',
152 'icon' => 'public-api',
153 'description' => 'public_api_integration_description',
154 'category' => 'Developer Tools',
155 'requiresAuth' => false,
156 'hasGlobalSettings' => true,
157 'hasFormSettings' => false,
158 'plan' => 'agency',
159 'learnMoreUrl' => 'https://ivyforms.com/documentation/public-rest-api/',
160 'settingsSchema' => [
161 'enabled' => [
162 'type' => 'boolean',
163 'default' => false,
164 ],
165 ],
166 ]);
167
168 // Salesforce Integration (Pro - Agency)
169 // $this->registry->register('salesforce', [
170 // 'label' => 'salesforce_label',
171 // 'component' => 'SalesforceIntegrationSettings',
172 // 'icon' => 'salesforce',
173 // 'description' => 'salesforce_description',
174 // 'category' => 'CRM',
175 // 'requiresAuth' => true,
176 // 'plan' => 'agency',
177 // ]);
178
179 // Google Sheets Integration (Lite) — registered last so it appears last in UI lists
180 $this->registry->register('google_sheets', [
181 'label' => 'google_sheets_label',
182 'component' => 'GoogleSheetsIntegrationSettings',
183 'icon' => 'google_sheets',
184 'description' => 'google_sheets_description',
185 'category' => 'Data Management',
186 'requiresAuth' => true,
187 'hasGlobalSettings' => true,
188 'plan' => 'lite',
189 'learnMoreUrl' => 'https://ivyforms.com/documentation/integrations/google-sheets/',
190 'settingsSchema' => [
191 'enabled' => [
192 'type' => 'boolean',
193 'default' => false,
194 ],
195 ],
196 ]);
197 }
198
199 /**
200 * Register page builder integrations (Lite)
201 *
202 * These are informational cards only: forms are embedded through the builder itself,
203 * so there is nothing to enable or configure — the card just links to the documentation.
204 *
205 * @return void
206 * @throws InvalidArgumentException
207 */
208 private function registerPageBuilderIntegrations(): void
209 {
210 $pageBuilderSlugs = ['elementor', 'divi', 'gutenberg'];
211
212 foreach ($pageBuilderSlugs as $slug) {
213 $this->registry->register($slug, [
214 'label' => $slug . '_label',
215 'icon' => $slug,
216 'description' => $slug . '_description',
217 'category' => 'Page Builders',
218 'plan' => 'lite',
219 'docsOnly' => true,
220 'hasGlobalSettings' => false,
221 'hasFormSettings' => false,
222 'learnMoreUrl' => 'https://ivyforms.com/documentation/',
223 ]);
224 }
225 }
226 }
227