/** * WordPress dependencies */ import { select } from '@safe-wordpress/data'; /** * External dependencies */ import { store as NC_DATA } from '@nelio-content/data'; import type { Maybe, Uuid, BufferSettings } from '@nelio-content/types'; export type BufferSettingsAction = SetBufferSettingsInProfileAction; export function setBufferSettingsInProfile( profileId: Maybe< Uuid >, bufferSettings: BufferSettings ): Maybe< SetBufferSettingsInProfileAction > { if ( ! profileId ) { return; } const profile = select( NC_DATA ).getSocialProfile( profileId ); if ( ! profile ) { return; } if ( ! profile.isBuffer ) { return; } return { type: 'SET_BUFFER_SETTINGS_IN_PROFILE', profileId, bufferSettings, }; } // ============ // HELPER TYPES // ============ export type SetBufferSettingsInProfileAction = { readonly type: 'SET_BUFFER_SETTINGS_IN_PROFILE'; readonly profileId: Uuid; readonly bufferSettings: BufferSettings; };