appointments.js
1 week ago
attendees.js
1 week ago
colorManipulation.js
1 week ago
customer.js
1 week ago
date.js
1 week ago
defaultCustomize.js
1 week ago
employee.js
1 week ago
events.js
1 week ago
formFieldsTemplates.js
1 week ago
formatting.js
1 week ago
helper.js
1 week ago
image.js
1 week ago
integrationApple.js
1 week ago
integrationGoogle.js
1 week ago
integrationOutlook.js
1 week ago
integrationStripe.js
1 week ago
integrationZoom.js
1 week ago
licence.js
1 week ago
phone.js
1 week ago
pricing.js
1 week ago
recurring.js
1 week ago
responsive.js
1 week ago
scrollElements.js
1 week ago
settings.js
1 week ago
translationsElementPlus.js
1 week ago
utilHeaderHeight.js
1 week ago
settings.js
56 lines
| 1 | import httpClient from '../../../plugins/axios' |
| 2 | import { settings } from '../../../plugins/settings.js' |
| 3 | |
| 4 | function usePopulateSettings( |
| 5 | globalSettings, |
| 6 | defaultSettings, |
| 7 | savedSettings = {}, |
| 8 | resultSettings = {}, |
| 9 | ) { |
| 10 | for (let key in defaultSettings) { |
| 11 | if (key in globalSettings && defaultSettings[key] && typeof defaultSettings[key] === 'object') { |
| 12 | if (!(key in resultSettings)) { |
| 13 | resultSettings[key] = {} |
| 14 | } |
| 15 | |
| 16 | usePopulateSettings( |
| 17 | globalSettings[key], |
| 18 | defaultSettings[key], |
| 19 | key in savedSettings ? savedSettings[key] : globalSettings[key], |
| 20 | resultSettings[key], |
| 21 | ) |
| 22 | |
| 23 | if (Object.keys(resultSettings[key]).length === 0) { |
| 24 | delete resultSettings[key] |
| 25 | } |
| 26 | } else if (key in savedSettings) { |
| 27 | resultSettings[key] = savedSettings[key] |
| 28 | } else if (key in globalSettings) { |
| 29 | resultSettings[key] = globalSettings[key] |
| 30 | } else { |
| 31 | resultSettings[key] = defaultSettings[key] |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | return resultSettings |
| 36 | } |
| 37 | |
| 38 | function useUpdateStashEntities() { |
| 39 | if (settings.activation.stash) { |
| 40 | httpClient |
| 41 | .post( |
| 42 | '/stash', |
| 43 | {}, |
| 44 | { |
| 45 | params: { |
| 46 | source: 'cabinet-provider', |
| 47 | }, |
| 48 | }, |
| 49 | ) |
| 50 | .then(() => {}) |
| 51 | .catch(() => {}) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | export { usePopulateSettings, useUpdateStashEntities } |
| 56 |