pluginData.ts
67 lines
| 1 | import contactForm7PluginIcon from '@/assets/images/icons/contact-form-7-plugin.svg'; |
| 2 | import emailReachPluginIcon from '@/assets/images/icons/email-reach-plugin.svg'; |
| 3 | import wpFormsLitePluginIcon from '@/assets/images/icons/wp-forms-lite-plugin.svg'; |
| 4 | import type { Integration } from '@/types/models'; |
| 5 | |
| 6 | export const PLUGIN_IDS = { |
| 7 | HOSTINGER_REACH: 'hostinger-reach', |
| 8 | CONTACT_FORM_7: 'contact-form-7', |
| 9 | WP_FORMS_LITE: 'wp-forms-lite' |
| 10 | } as const; |
| 11 | |
| 12 | export const INTEGRATION_TO_FORM_TYPE_MAP: Record<string, string> = { |
| 13 | hostingerReach: 'hostinger-reach', |
| 14 | 'contactForm-7': 'contact-form-7', |
| 15 | wpformsLite: 'wpforms-lite' |
| 16 | } as const; |
| 17 | |
| 18 | export const PLUGIN_TITLES = { |
| 19 | HOSTINGER_REACH: 'hostinger_reach_plugin_titles_hostinger_reach', |
| 20 | CONTACT_FORM_7: 'hostinger_reach_plugin_titles_contact_form_7', |
| 21 | WP_FORMS_LITE: 'hostinger_reach_plugin_titles_wp_forms_lite' |
| 22 | } as const; |
| 23 | |
| 24 | export const PLUGIN_STATUSES = { |
| 25 | ACTIVE: 'active', |
| 26 | INACTIVE: 'inactive' |
| 27 | } as const; |
| 28 | |
| 29 | export type PluginId = (typeof PLUGIN_IDS)[keyof typeof PLUGIN_IDS]; |
| 30 | export type PluginStatus = (typeof PLUGIN_STATUSES)[keyof typeof PLUGIN_STATUSES]; |
| 31 | |
| 32 | export interface PluginInfo { |
| 33 | id: string; |
| 34 | title: string; |
| 35 | icon: string; |
| 36 | } |
| 37 | |
| 38 | export const DEFAULT_PLUGIN_DATA: Record<string, PluginInfo> = { |
| 39 | hostingerReach: { |
| 40 | id: 'hostingerReach', |
| 41 | title: PLUGIN_TITLES.HOSTINGER_REACH, |
| 42 | icon: emailReachPluginIcon |
| 43 | }, |
| 44 | 'contactForm-7': { |
| 45 | id: 'contactForm-7', |
| 46 | title: PLUGIN_TITLES.CONTACT_FORM_7, |
| 47 | icon: contactForm7PluginIcon |
| 48 | }, |
| 49 | wpformsLite: { |
| 50 | id: 'wpformsLite', |
| 51 | title: PLUGIN_TITLES.WP_FORMS_LITE, |
| 52 | icon: wpFormsLitePluginIcon |
| 53 | } |
| 54 | } as const; |
| 55 | |
| 56 | export const PLUGIN_DATA = DEFAULT_PLUGIN_DATA; |
| 57 | |
| 58 | export const getPluginInfo = (integration: Integration): PluginInfo => { |
| 59 | const defaultInfo = DEFAULT_PLUGIN_DATA[integration.id]; |
| 60 | |
| 61 | return { |
| 62 | id: integration.id, |
| 63 | title: defaultInfo?.title || integration.title, |
| 64 | icon: defaultInfo?.icon || '' |
| 65 | }; |
| 66 | }; |
| 67 |