# leadin/11.1.13/scripts/utils/withMetaData.ts

HubSpot All-In-One Marketing – Forms, Popups, Live Chat, version 11.1.13. 31 lines.

- Page: https://pluginprobe.com/plugins/leadin/11.1.13/code/scripts/utils/withMetaData.ts
- Raw: https://pluginprobe.com/plugins/leadin/11.1.13/raw/scripts/utils/withMetaData.ts
- Modified: 2024-05-23T13:10:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/leadin/11.1.13/code/scripts/utils/withMetaData.ts#L10-L20`.

```typescript
import { withSelect, withDispatch, select } from '@wordpress/data';

// from answer here: https://github.com/WordPress/gutenberg/issues/44477#issuecomment-1263026599
export const isFullSiteEditor = () => {
  return select && !!select('core/edit-site');
};

const applyWithSelect = withSelect((select: Function, props: any): any => {
  return {
    metaValue: select('core/editor').getEditedPostAttribute('meta')[
      props.metaKey
    ],
  };
});

const applyWithDispatch = withDispatch(
  (dispatch: Function, props: any): any => {
    return {
      setMetaValue(value: string) {
        dispatch('core/editor').editPost({ meta: { [props.metaKey]: value } });
      },
    };
  }
);

function apply<T>(el: T): T {
  return applyWithSelect(applyWithDispatch(el));
}

export default apply;

```
