Skip to content

Commit

Permalink
Merge Yannick-Symphony:message_container
Browse files Browse the repository at this point in the history
  • Loading branch information
symphony-jean-michael committed Dec 8, 2022
2 parents 6564051 + 7586c45 commit f887601
Show file tree
Hide file tree
Showing 10 changed files with 301 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Added a `SendChatMessage` intent to be used when a user wants to send a message to an existing chat room. ([#794](https://github.com/finos/FDC3/pull/794))
* Added a context type representing a chat message (`fdc3.chat.message`). ([#794](https://github.com/finos/FDC3/pull/794))
* Added a context type representing a chat room (`fdc3.chat.room`). ([#794](https://github.com/finos/FDC3/pull/794))
* Added a chat `Message` type in order to describe messages with rich content and attachments
* Added an `Action` type, encapsulating either a `Context` or the association of a `Context` with an `Intent` inside another object
* Added a `ViewChat` Intent to be used when a user wants to open an existing chat room. ([#796](https://github.com/finos/FDC3/pull/796))
* Added a `ViewMessages` intent to be used when a user wants to search and see a list of messages. ([#797](https://github.com/finos/FDC3/pull/797))
* Added a context type representing a ChatSearchCriteria (`fdc3.chat.searchCriteria`). ([#797](https://github.com/finos/FDC3/pull/797))

### Changed

* Updated definition of the `ChatInitSettings` context type to use the new `Message` type
* Updated definition of the `Instrument` context type to include optional market identifiers ([#819](https://github.com/finos/FDC3/pull/819))
* Updated the `StartChat` intent to return a reference to the room. ([#794](https://github.com/finos/FDC3/pull/794))

Expand Down
74 changes: 74 additions & 0 deletions docs/context/ref/Action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
id: Action
sidebar_label: Action
title: Action
hide_title: true
---
# `Action`

A representation of an FDC3 Action (specified via a Context or Context & Intent) that can be inserted inside another object,
for example a chat message.

The action may be completed by calling `fdc3.raiseIntent()` with the specified Intent and Context, or, if only a context is specified, by calling `fdc3.raiseIntentForContext()` (which the Desktop Agent will resolve by presenting the user with a list of available Intents for the Context).

Accepts an optional `app` parameter in order to specify a certain app.

## Type

`fdc3.action`

## Schema

https://fdc3.finos.org/schemas/next/action.schema.json

## Details

| Property | Type | Required | Example Value |
|-------------------|-------------------------------------------|----------|-------------------------|
| `type` | string | Yes | `'fdc3.action'` |
| `title` | string | Yes | `'Click to view Chart'` |
| `intent` | string | No | `'ViewChart'` |
| `context` | string | Yes | See Below |
| `app` | object | No | `'myApp'` |
| `app.appId` | string | Yes | `'app1'` |
| `app.instanceId` | string | No | `'instance1'` |



## Example

```js
const action = {
type: 'fdc3.action',
title: 'Click to view Chart',
intent: 'ViewChart',
context {
type: 'fdc3.chart',
instruments: [
{
type: 'fdc3.instrument',
id: {
ticker: 'EURUSD'
}
}
],
range: {
type: 'fdc3.dateRange',
starttime: '2020-09-01T08:00:00.000Z',
endtime: '2020-10-31T08:00:00.000Z'
},
style: 'candle'
},
app {
appId: 'MyChartViewingApp',
instanceId: 'instance1'
}
}

## See Also

Other Types
* [Message](Message)

Intents
* [StartChat](../../intents/ref/StartChat)
23 changes: 19 additions & 4 deletions docs/context/ref/ChatInitSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json
| Property | Type | Required | Example Value |
| ------------------------------ | ----------- | -------- | -------------------------------------------------------------------- |
| `type` | string | Yes | `'fdc3.chat.initSettings'` |
| `chatName` | string | No | `'Instrument XYZ'` |
| `chatName` | string | No | `'Instrument XYZ'` |
| `members` | ContactList | No | ContactList - cf. below |
| `initMessage` | string | No | `'Hello!'` |
| `message` | Message | No | Message - cf. below |
| `options.groupRecipients` | boolean | No | `true`: if false a separate chat will be created for each member |
| `options.public` | boolean | No | `true`: the room will be visible to everyone in the chat application |
| `options.allowHistoryBrowsing` | boolean | No | `true`: members will be allowed to browse past messages |
| `options.allowHistoryBrowsing` | boolean | No | `true`: members will be allowed to browse past messages |
| `options.allowMessageCopy` | boolean | No | `true`: members will be allowed to copy/paste messages |
| `options.allowAddUser` | boolean | No | `true`: members will be allowed to add other members to the chat |

Expand Down Expand Up @@ -62,7 +62,21 @@ const initSettings = {
allowHistoryBrowsing: true,
allowMessageCopy: true
}
initMessage: 'Hello both!'
message: {
type: 'fdc3.message',
text: {
'text/plain': 'Hey all, can we discuss the issue together? I attached a screenshot'
},
entities: {
'0': {
type: 'fdc3.fileAttachment',
data: {
name: 'myImage.png',
dataUri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII'
}
}
}
}
}

const res = fdc3.raiseIntent('StartChat', initSettings);
Expand All @@ -77,6 +91,7 @@ Other Types

- [ChatRoom](ChatRoom)
- [ContactList](ContactList)
- [Message](Message)

Intents
- [StartChat](../../intents/ref/StartChat)
Expand Down
76 changes: 76 additions & 0 deletions docs/context/ref/Message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
id: Message
sidebar_label: Message
title: Message
hide_title: true
---
# `Message`

A chat message to be sent through an instant messaging application. Can contain one or several text bodies (organised by mime-type, plaintext or markdown),
as well as attached entities (either arbitrary file attachments or FDC3 actions to be embedded in the message). To be put inside a ChatInitSettings object.

## Type

`fdc3.message`

## Schema

https://fdc3.finos.org/schemas/next/message.schema.json

## Details

| Property | Type | Required | Example Value |
|-------------------|-------------------------------------------|----------|-------------------------|
| `type` | string | Yes | `'fdc3.message'` |
| `text` | map of string mime-type to string content | No | { text/plain: 'Hello' } |
| `entities` | map of json entity to string id | No | See Below |

## Example

```js
const message = {
type: 'fdc3.message',
text: {
'text/plain': 'Hey all, can we discuss the issue together? I attached a screenshot and a link to the current exchange rate'
},
entities: {
'picture1': {
type: 'fdc3.fileAttachment',
data: {
name: 'myImage.png',
dataUri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII'
}
},
'eurusd_action': {
type: 'fdc3.action',
title: 'Click to view Chart',
intent: 'ViewChart',
context: {
type: 'fdc3.chart',
instruments: [
{
type: 'fdc3.instrument',
id: {
ticker: 'EURUSD'
}
}
],
range: {
type: 'fdc3.dateRange',
starttime: '2020-09-01T08:00:00.000Z',
endtime: '2020-10-31T08:00:00.000Z'
},
style: 'candle'
}
}
}
}

## See Also

Other Types
* [ChatInitSettings](ChatInitSettings)
* [Action](Action)

Intents
* [StartChat](../../intents/ref/StartChat)
2 changes: 2 additions & 0 deletions docs/context/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ For more details on FDC3 Standards compliance (including the versioning, depreca

The following are standard FDC3 context types:

* [`fdc3.action`](ref/Action) ([schema](/schemas/next/action.schema.json))
* [`fdc3.chart`](ref/Chart) ([schema](/schemas/next/chart.schema.json))
* [`fdc3.chat.initSettings`](ref/ChatInitSettings) ([schema](/schemas/next/chatInitSettings.schema.json))
* [`fdc3.chat.room`](ref/ChatRoom) ([schema](/schemas/next/chatRoom.schema.json))
Expand All @@ -169,6 +170,7 @@ The following are standard FDC3 context types:
* [`fdc3.email`](ref/Email) ([schema](/schemas/next/email.schema.json))
* [`fdc3.instrument`](ref/Instrument) ([schema](/schemas/next/instrument.schema.json))
* [`fdc3.instrumentList`](ref/InstrumentList) ([schema](/schemas/next/instrumentList.schema.json))
* [`fdc3.message`](ref/Message) ([schema](/schemas/next/message.schema.json))
* [`fdc3.organization`](ref/Organization) ([schema](/schemas/next/organization.schema.json))
* [`fdc3.portfolio`](ref/Portfolio) ([schema](/schemas/next/portfolio.schema.json))
* [`fdc3.position`](ref/Position) ([schema](/schemas/next/position.schema.json))
Expand Down
27 changes: 23 additions & 4 deletions docs/intents/ref/StartChat.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ fdc3.raiseIntent('StartChat', contact)
// chat with initialization settings
const initSettings = {
type: 'fdc3.chat.initSettings',
chatName: 'Issue #123',
chatName: 'Chat ABCD',
members: {
type: 'fdc3.contactList',
contacts: [{
type: 'fdc3.contact',
name: 'Jane Doe',
id: {
email: 'jane@mail.com'
}
},{
type: 'fdc3.contact',
name: 'John Doe',
id: {
Expand All @@ -53,10 +59,23 @@ const initSettings = {
groupRecipients: true, // one chat with both contacts
public: false, // private chat room
allowHistoryBrowsing: true,
allowMessageCopy: true,
allowAddUser: false, // John won't be authorized to add other users to the chat
allowMessageCopy: true
}
message: {
type: 'fdc3.message',
text: {
'text/plain': 'Hey all, can we discuss the issue together? I attached a screenshot'
},
entities: {
'0': {
type: 'fdc3.fileAttachment',
data: {
name: 'myImage.png',
dataUri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII'
}
}
}
}
initMessage: 'Hello John!'
}

const resolution = fdc3.raiseIntent('StartChat', initSettings);
Expand Down
2 changes: 2 additions & 0 deletions src/context/schemas.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"Action": ["https://fdc3.finos.org/schemas/next/action.schema.json"],
"Context": ["https://fdc3.finos.org/schemas/next/context.schema.json"],
"Chart": ["https://fdc3.finos.org/schemas/next/chart.schema.json"],
"ChatInitSettings": ["https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json"],
Expand All @@ -11,6 +12,7 @@
"Email": ["https://fdc3.finos.org/schemas/next/email.schema.json"],
"Instrument": ["https://fdc3.finos.org/schemas/next/instrument.schema.json"],
"InstrumentList": ["https://fdc3.finos.org/schemas/next/instrumentList.schema.json"],
"Message": ["https://fdc3.finos.org/schemas/next/message.schema.json"],
"Nothing": ["https://fdc3.finos.org/schemas/next/nothing.schema.json"],
"Organization": ["https://fdc3.finos.org/schemas/next/organization.schema.json"],
"Portfolio": ["https://fdc3.finos.org/schemas/next/portfolio.schema.json"],
Expand Down
35 changes: 35 additions & 0 deletions src/context/schemas/action.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/action.schema.json",
"type": "object",
"title": "Action",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.action" },
"title": {
"type": "string"
},
"intent": {
"type": "string",
"$comment": "Should reference an intent type name, such as those defined in the FDC3 Standard'"
},
"context": {
"type": "object",
"$ref": "context.schema.json#"
},
"app": {
"type": "object",
"properties": {
"appId": { "type": "string" },
"instanceId": { "type": "string" }
},
"required": ["appId"]
},
"customConfig": {
"type": "object"
}
},
"required": [
"title", "context"
]
}
19 changes: 12 additions & 7 deletions src/context/schemas/chatInitSettings.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$id": "https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json",
"type": "object",
"title": "ChatInitSettings",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": {
"const": "fdc3.chat.initSettings"
Expand All @@ -13,8 +14,15 @@
"members": {
"$ref": "contactList.schema.json#"
},
"initMessage": {
"type": "string"
"message": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "message.schema.json#"
}
]
},
"options": {
"groupRecipients": "boolean",
Expand All @@ -23,8 +31,5 @@
"allowMessageCopy": "boolean",
"allowAddUser": "boolean"
}
},
"required": [
"type"
]
}
}
}
Loading

0 comments on commit f887601

Please sign in to comment.