## class: `WyMessengerNew`, `wy-messenger-new`

Weavy messenger component to render a create conversation button with dialogs.

When a conversation is created, the component fires a `"wy-action"` event with the action type `"select"` and details about the conversation.

\*\* Component layout \*\*

The button is displayed as a clickable icon that acts as a button. The default size of the button is the icon size `1.5rem`/`24px` together with the set `--wy-padding` (which defaults to `0.5rem`/`8px`) on every side of the icon, which makes a total of `2.5rem`/`40px` per default.

The select member dialog renders in a modal overlay centered in the [top layer](https://developer.mozilla.org/en-US/docs/Glossary/Top_layer). That means that the dialog does not occupy any visual layout space where it's placed in the DOM, it only renders in the top layer.

You can add additional styling using *CSS Custom Properties* and *CSS Shadow Parts* and further customization using *slots*.

**Used sub components:**

*   [`<wy-conversation-new>`](./components/wy-conversation-new)

### Examples

<figure class="example"><figcaption>Inline new conversation button in a text</figcaption>

Display an icon button that opens a dialog to select users for a new conversation.

```html
<div>Create conversation <wy-messenger-new></wy-messenger-new></div>
```

</figure>

### Fields

| Name             | Type                                                 | Default            | Description                                                                                                            | Inherited From     |
| ---------------- | ---------------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `overlay`        | `"modal" \| "sheet" \| "drawer" \| "full" \| "none"` | `"modal"`          | Overlay appearance used for the create conversation dialog.                                                            |                    |
| `link`           | `LinkType \| undefined`                              |                    | Any provided link that should be loaded, shown and highlighted.                                                        | WeavyTypeComponent |
| `features`       | `string \| undefined`                                |                    | Config for enabling/disabling specific features in the weavy component.&#xA;Prefix a feature with minus to disable it. | WeavyTypeComponent |
| `agent`          | `string \| undefined`                                |                    | The configured uid of the agent for the weavy component.                                                               | WeavyTypeComponent |
| `contextualData` | `string \| undefined`                                |                    | Contextual data for agents to reference. Provide descriptive data for optimal results.&#xA;&#xA;### Examples           | WeavyTypeComponent |
| `annotations`    | `AnnotationsAppearanceType`                          | `"buttons-inline"` | Appearance of annotations.                                                                                             | WeavyTypeComponent |
| `enterToSend`    | `EnterToSend`                                        | `"auto"`           | Enter-to-send keymap in the editor. \`"modifier"\` is \`Enter\` combined with \`Ctrl\` or \`Cmd\`.                     | WeavyTypeComponent |
| `reactions`      | `string`                                             | `"😍 😎 😉 😜 👍"` | A space separated string of available reaction emojis in unicode.                                                      | WeavyTypeComponent |
| `weavy`          | `WeavyType \| undefined`                             |                    | The consumed weavy context.                                                                                            | WeavyComponent     |
| `contextId`      | `ContextIdType`                                      |                    | Contextual guid that is unique for the client context.                                                                 | WeavyComponent     |
| `user`           | `UserType \| undefined`                              |                    | The current user.                                                                                                      | WeavyComponent     |

### Methods

| Name                 | Description                                          | Parameters                        | Return                    | Inherited From |
| -------------------- | ---------------------------------------------------- | --------------------------------- | ------------------------- | -------------- |
| `createConversation` | Creates a new conversation.                          | `members: MemberIdType[]`         |                           |                |
| `selectMembers`      | Opens the select-member dialog.                      |                                   |                           |                |
| `whenUser`           | Resolves when current user data is available.        |                                   | `Promise<UserType>`       | WeavyComponent |
| `whenWeavy`          | Resolves when a weavy context is available.          |                                   | `Promise<WeavyType>`      | WeavyComponent |
| `whenReady`          | Resolves when the component has rendered first time. |                                   | `Promise<WeavyComponent>` | WeavyComponent |
| `dispatchAction`     | Dispatch a \`wy-action\` event on the component.     | `detail: WyActionEventDetailType` | `boolean`                 | WeavyComponent |

### Events

| Name        | Type                | Description                                                        | Inherited From |
| ----------- | ------------------- | ------------------------------------------------------------------ | -------------- |
| `wy-action` | `WyActionEventType` | Emitted when a conversation app is created and should be selected. |                |
| `ready`     | `CustomEvent`       | When the component has rendered.                                   | WeavyComponent |

### Attributes

| Name             | Field          | Inherited From     |
| ---------------- | -------------- | ------------------ |
| `overlay`        | overlay        |                    |
| `link`           | link           | WeavyTypeComponent |
| `features`       | features       | WeavyTypeComponent |
| `agent`          | agent          | WeavyTypeComponent |
| `contextualData` | contextualData | WeavyTypeComponent |
| `annotations`    | annotations    | WeavyTypeComponent |
| `enterToSend`    | enterToSend    | WeavyTypeComponent |
| `reactions`      | reactions      | WeavyTypeComponent |

<details><summary>Private API</summary>

### Fields

| Name                         | Privacy   | Type                                                               | Default                                                                                                                   | Description                             | Inherited From     |
| ---------------------------- | --------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------------------ |
| `visibilityElement`          | protected | `Element \| undefined`                                             |                                                                                                                           | Element to match visibility on.         | WeavyTypeComponent |
| `appTypes`                   | protected | `AppTypeGuid[]`                                                    |                                                                                                                           | Any app types handled by the component. | WeavyTypeComponent |
| `#data`                      | private   | `ContextDataType[] \| undefined`                                   |                                                                                                                           |                                         | WeavyTypeComponent |
| `#annotations`               | private   | `WeavyComponentSettingProps["annotations"] \| undefined`           |                                                                                                                           |                                         | WeavyTypeComponent |
| `#enterToSend`               | private   | `EnterToSend \| undefined`                                         |                                                                                                                           |                                         | WeavyTypeComponent |
| `#reactions`                 | private   | `WeavyComponentSettingProps["reactions"] \| undefined`             |                                                                                                                           |                                         | WeavyTypeComponent |
| `#resolveContextDataBlobs`   | private   | `(blobs: ContextDataBlobsType) => void \| undefined`               |                                                                                                                           |                                         | WeavyTypeComponent |
| `#whenContextDataBlobs`      | private   |                                                                    | `new Promise<ContextDataBlobsType>((r) => { this.#resolveContextDataBlobs = r; })`                                        |                                         | WeavyTypeComponent |
| `#resolveComponentFeatures`  | private   | `(componentFeatures: ComponentFeaturePolicy) => void \| undefined` |                                                                                                                           |                                         | WeavyTypeComponent |
| `#whenComponentFeatures`     | private   |                                                                    | `new Promise<ComponentFeaturePolicy>((r) => { this.#resolveComponentFeatures = r; })`                                     |                                         | WeavyTypeComponent |
| `#resolveLink`               | private   | `(link: LinkType) => void \| undefined`                            |                                                                                                                           |                                         | WeavyTypeComponent |
| `#whenLink`                  | private   |                                                                    | `new Promise<LinkType>((r) => { this.#resolveLink = r; })`                                                                |                                         | WeavyTypeComponent |
| `#resolveSettings`           | private   | `(settings: WeavyComponentSettingsType) => void \| undefined`      |                                                                                                                           |                                         | WeavyTypeComponent |
| `#whenSettings`              | private   |                                                                    | `new Promise<WeavyComponentSettingsType>((r) => { this.#resolveSettings = r; })`                                          |                                         | WeavyTypeComponent |
| `#contextDataRefs`           | private   | `Map<ContextDataType, DataRefType>`                                | `new Map()`                                                                                                               |                                         | WeavyTypeComponent |
| `#uploadContextDataMutation` | private   |                                                                    | `new MutationController<BlobType, Error, MutateFileProps, FileMutationContextType>(this)`                                 |                                         | WeavyTypeComponent |
| `#mutatingContextData`       | private   |                                                                    | `new MutationStateController< BlobType \| FileType \| EmbedType, Error, MutateFileProps, FileMutationContextType >(this)` |                                         | WeavyTypeComponent |
| `#resolveContextId`          | private   | `(contextId: ContextIdType) => void \| undefined`                  |                                                                                                                           |                                         | WeavyComponent     |
| `#whenContextId`             | private   |                                                                    | `new Promise<ContextIdType>((r) => { this.#resolveContextId = r; })`                                                      |                                         | WeavyComponent     |
| `#resolveUser`               | private   | `(user: UserType) => void \| undefined`                            |                                                                                                                           |                                         | WeavyComponent     |
| `#whenUser`                  | private   |                                                                    | `new Promise<UserType>((r) => { this.#resolveUser = r; })`                                                                |                                         | WeavyComponent     |
| `#resolveWeavy`              | private   | `(weavy: WeavyType) => void \| undefined`                          |                                                                                                                           |                                         | WeavyComponent     |
| `#whenWeavy`                 | private   |                                                                    | `new Promise<WeavyType>((r) => { this.#resolveWeavy = r; })`                                                              |                                         | WeavyComponent     |
| `#resolveReady`              | private   | `(component: WeavyComponent) => void \| undefined`                 |                                                                                                                           |                                         | WeavyComponent     |
| `#whenReady`                 | private   |                                                                    | `new Promise<WeavyComponent>((r) => { this.#resolveReady = r; })`                                                         |                                         | WeavyComponent     |
| `#userQuery`                 | private   |                                                                    | `new QueryController<UserType>(this)`                                                                                     |                                         | WeavyComponent     |

### Methods

| Name                 | Privacy   | Description                                                                                                            | Parameters                    | Return | Inherited From     |
| -------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ------ | ------------------ |
| `setLink`            | protected | Sets the link value to a new link                                                                                      | `link: LinkType \| undefined` |        | WeavyTypeComponent |
| `provideStorageLink` | protected | Shares a link with other blocks that may consume it automatically in other tabs or windows or when reloading the page. | `link: LinkType`              |        | WeavyTypeComponent |

</details>

<hr/>

## Exports

| Kind                        | Name               | Declaration    | Module                   | Package |
| --------------------------- | ------------------ | -------------- | ------------------------ | ------- |
| `js`                        | `WyMessengerNew`   | WyMessengerNew | lib/wy-messenger-new\.ts |         |
| `custom-element-definition` | `wy-messenger-new` | WyMessengerNew | lib/wy-messenger-new\.ts |         |
