captcha
2 years ago
gateways
2 years ago
proAddons
2 years ago
proGateways
2 years ago
sidebar
2 years ago
tabs
2 years ago
IsPROIcon.vue
2 years ago
SettingsPage.vue
2 years ago
addons-tabs.js
2 years ago
index.js
2 years ago
addons-tabs.js
59 lines
| 1 | import hubspot from './proAddons/hubspot'; |
| 2 | import addressAutocomplete from './proAddons/addressAutocomplete'; |
| 3 | import convertkit from './proAddons/convertkit'; |
| 4 | import mailerlite from './proAddons/mailerlite'; |
| 5 | import moosend from './proAddons/moosend'; |
| 6 | import stripe from './proGateways/stripe'; |
| 7 | |
| 8 | const { addFilter } = wp.hooks; |
| 9 | |
| 10 | const addons = [ |
| 11 | addressAutocomplete, |
| 12 | hubspot, |
| 13 | convertkit, |
| 14 | mailerlite, |
| 15 | moosend, |
| 16 | ]; |
| 17 | |
| 18 | const gateways = [ |
| 19 | stripe |
| 20 | ]; |
| 21 | |
| 22 | const getModulesNames = modules => modules.map( item => ( |
| 23 | item.component.name |
| 24 | ) ); |
| 25 | |
| 26 | |
| 27 | const run = () => { |
| 28 | addFilter( 'jet.fb.register.settings-page.tabs', 'jet-form-builder', modules => { |
| 29 | const names = getModulesNames( modules ); |
| 30 | |
| 31 | for ( const addon of addons ) { |
| 32 | if ( names.includes( addon.component.name ) ) { |
| 33 | continue; |
| 34 | } |
| 35 | modules.push( addon ); |
| 36 | } |
| 37 | |
| 38 | return modules; |
| 39 | }, 1000 ); |
| 40 | |
| 41 | addFilter( 'jet.fb.register.gateways', 'jet-form-builder', modules => { |
| 42 | const names = getModulesNames( modules ); |
| 43 | |
| 44 | for ( const gateway of gateways ) { |
| 45 | if ( names.includes( gateway.component.name ) ) { |
| 46 | continue; |
| 47 | } |
| 48 | modules.push( gateway ); |
| 49 | } |
| 50 | |
| 51 | return modules; |
| 52 | }, 1000 ); |
| 53 | }; |
| 54 | |
| 55 | if ( ! window?.JetFBPageConfig?.is_active ) { |
| 56 | run(); |
| 57 | } |
| 58 | |
| 59 |