diff --git a/CHANGELOG.md b/CHANGELOG.md index 33638ce9f..3ea0c7263 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,14 +8,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added +* Added `CreateInteraction` intent. To be used when a user wants to record an interaction into a system. New context `Interaction` also introduced. An interaction might be a call, IM, email, a meeting (physical or virtual) or the preparation of some specialist data. ([#747](https://github.com/finos/FDC3/pull/747)) +* Added `TransactionResult` context. A context type representing the result of a transaction initiated via FDC3. Its purpose is to provide a status and message (where needed) for the transaction and MAY wrap a returned context object. ([#761] (https://github.com/finos/FDC3/pull/761)) * Added a `MalformedContext` error to the `OpenError`, `ChannelError` and `ResolveError` enumerations, to be used when `broadcast`, `open`, `findIntents`, `raiseIntents` and other related functions are passed an invalid context Object. ([#972](https://github.com/finos/FDC3/pull/972)) * Added error examples to the /v2 App Directory API routes ([#973](https://github.com/finos/FDC3/pull/973)) +* 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. ([#779](https://github.com/finos/FDC3/pull/779)) +* Added an `Action` type, encapsulating either a `Context` or the association of a `Context` with an `Intent` inside another object. ([#779](https://github.com/finos/FDC3/pull/779)) +* 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)) * Added an indication that applications, that can be launched to receive intents or context via a raised intent or open with context, SHOULD add their context or intent listeners via the API within 15 seconds, and that Desktop Agents MUST allow at least a 15 second timeout for them to do so, and MAY set a longer timeout ([#987](https://github.com/finos/FDC3/pull/987)) ### Changed +* Updated definition of the `ChatInitSettings` context type to use the new `Message` type. ([#779](https://github.com/finos/FDC3/pull/779)) +* Updated the `StartChat` intent to return a reference to the room. ([#794](https://github.com/finos/FDC3/pull/794)) * Updated definition of the `Instrument` context type to include optional market identifiers ([#819](https://github.com/finos/FDC3/pull/819)) * Corrected API functions and object types to always use `string` instead of `String` ([#924](https://github.com/finos/FDC3/pull/924)) +* Updated definition of the `otherConfig` element of the `Chart` context type from an Object to an array of Contexts as this allows the `type` of each additional item of config to be examined before it is used ([#985](https://github.com/finos/FDC3/pull/985)) * Corrected the appD `interop.appChannels` metadata to use an `id` field to identify channels, rather than `name` ([#981](https://github.com/finos/FDC3/pull/981)) ### Deprecated diff --git a/docs/context/ref/Action.md b/docs/context/ref/Action.md new file mode 100644 index 000000000..8808c0462 --- /dev/null +++ b/docs/context/ref/Action.md @@ -0,0 +1,75 @@ +--- +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) diff --git a/docs/context/ref/Chart.md b/docs/context/ref/Chart.md index 59cdb829c..efd113b98 100644 --- a/docs/context/ref/Chart.md +++ b/docs/context/ref/Chart.md @@ -31,9 +31,13 @@ In addition to handling requests to plot charts, a charting application may use | `instruments` | Instrument[] | Yes |
[
  {
    "type": "fdc3.instrument",
    "id": {
      "ticker": "AAPL"
    }
  },
  {
    "type": "fdc3.instrument",
    "id": {
      "ticker": "MSFT"
    }
  }
]
| | `range` | TimeRange | No |
{
  "type": "fdc3.timerange",
  "startTime": "2022-03-30T15:44:44+00:00",
  "endTime": "2022-04-30T23:59:59+00:00"
}
| | `style` | string | No | one of: `'line'`, `'bar'`, `'stacked-bar'`, `'mountain'`, `'candle'`, `'pie'`, `'scatter'`, `'histogram'`, `'heatmap'`, `'custom'` | -| `otherConfig`* | object | No | `{ /* unstandardized additional config */}` | +| `otherConfig`* | array | No | `[ {/* additional config context objects */} ]` | -\* It is common for charts to support other configuration, such as indicators, annotations etc., which do not have standardized formats, but may be included in the `otherConfig` element. +::: info + +It is common for charts to support other configuration, such as indicators, annotations etc., which do not have standardized formats, but may be included in the `otherConfig` array as context objects. + +::: ## Example @@ -60,20 +64,24 @@ const chart = { endTime: "2020-10-31T08:00:00.000Z" }, style: "line", - otherConfig: { - indicators: [ - { - name: "ma", - parameters: { - period: 14, - type: "ema" - } - }, - { - name: "volume" + otherConfig: [ + { + type: "somevendor.someproduct.indicator", + name: "stddev", + parameters: { + period: 10, + matype: "exponential" } - ] - } + }, + { + type: "someothervendor.someotherproduct.formula", + formula: "standard-deviation", + fields: { + lookback: 10, + type: "ema" + } + } + ] }; fdc3.raiseIntent("ViewChart", chart); diff --git a/docs/context/ref/ChatInitSettings.md b/docs/context/ref/ChatInitSettings.md index 8a3a24735..7637db1ee 100644 --- a/docs/context/ref/ChatInitSettings.md +++ b/docs/context/ref/ChatInitSettings.md @@ -22,12 +22,12 @@ A collection of settings to start a new chat conversation | 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.isPublic` | 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.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 | @@ -58,27 +58,46 @@ const initSettings = { }, options: { groupRecipients: true, // one chat with both contacts - public: false, // private chat room + isPublic: false, // private chat room 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); -const roomRefs = await res.getResult(); + +// Return a reference to the room +const chatRoom = await res.getResult(); ``` ## See Also Other Types +- [ChatRoom](ChatRoom) - [ContactList](ContactList) +- [Message](Message) Intents - [StartChat](../../intents/ref/StartChat) - [StartCall](../../intents/ref/StartCall) +- [SendChatMessage](../../intents/ref/StartChat) - [ViewContact](../../intents/ref/ViewContact) FINOS Financial Objects diff --git a/docs/context/ref/ChatMessage.md b/docs/context/ref/ChatMessage.md new file mode 100644 index 000000000..5d8483854 --- /dev/null +++ b/docs/context/ref/ChatMessage.md @@ -0,0 +1,51 @@ +--- +id: ChatMessage +sidebar_label: ChatMessage +title: ChatMessage +hide_title: true +--- +# `ChatMessage` + +A context representing a chat message. Typically used to send the message or to pre-populate a message for sending. + +## Type + +`fdc3.chat.message` + +## Schema + +- https://fdc3.finos.org/schemas/next/chatMessage.schema.json + +## Details + +| Property | Type | Required | Example Value | +|-------------|---------|----------|-------------------| +| `type` | string | Yes | `'fdc3.chat.message'` | +| `chatRoom` | ChatRoom | Yes | `{ type: 'fdc3.chat.room', providerName: 'Symphony', id:{ streamId: 'j75xqXy25NBOdacUI3FNBH'} }` | +| `message` | [Message](https://fdc3.finos.org/schemas/next/message.schema.json) | Yes | `'A message to send'` | + +## Example + +```js +const chatMessage = { + type: "fdc3.chat.message", + chatRoom: { + type: 'fdc3.chat.room', + providerName: "Symphony", + id: { + streamId: "j75xqXy25NBOdacUI3FNBH" + } + }, + message: "A message to send" +} +``` + +## See Also + +Intents +- [StartChat](../../intents/ref/StartChat) +- [StartCall](../../intents/ref/StartCall) +- [SendChatMessage](../../intents/ref/SendChatMessage) + +FINOS Financial Objects +- [Contact](https://fo.finos.org/docs/objects/contact) diff --git a/docs/context/ref/ChatRoom.md b/docs/context/ref/ChatRoom.md new file mode 100644 index 000000000..a11984cec --- /dev/null +++ b/docs/context/ref/ChatRoom.md @@ -0,0 +1,64 @@ +--- +id: ChatRoom +sidebar_label: ChatRoom +title: Contact +hide_title: true +--- +# `ChatRoom` + +Reference to the chat room(s) (which could be used later to send a message to the room(s)). + +## Type + +`fdc3.chat.room` + +## Schema + +https://fdc3.finos.org/schemas/next/chatRoom.schema.json + +## Details + +| Property | Type | Required | Example Value | +|-------------|---------|----------|-------------------| +| `type` | string | Yes | `'fdc3.chat.room'` | +| `providerName` | string | Yes | `'Symphony'` | +| `id` | object | Yes | `{ streamId: 'j75xqXy25NBOdacUI3FNBH', anyOtherKey: 'abcdef'}` | +| `url` | string | No | `'http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA'` | +| `name` | string | No | `'My new room'` | + +The `url` is a universal url to access to the room. It could be opened from a browser, a mobile app, etc... + +## Example + +```js +const chatRoom = { + type: "fdc3.chat.room", + providerName: "Symphony", + id: { + streamId: "j75xqXy25NBOdacUI3FNBH" + } + url: "http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA", + name: 'My new room' +}; + +//Chat rooms are returned by the StartChat intent as a result +const intentResolution = await fdc3.raiseIntent("StartChat", context); + +try { + const chatRooms = await intentResolution.getResult(): +} catch (error) { + //chat room were not created... +} +``` + +## See Also + +Other Types +* [ChatInitSettings](ChatInitSettings) + +Intents +- [StartChat](../../intents/ref/StartChat) +- [SendChatMessage](../../intents/ref/SendChatMessage) + +FINOS Financial Objects +- [Contact](https://fo.finos.org/docs/objects/contact) diff --git a/docs/context/ref/Contact.md b/docs/context/ref/Contact.md index 4b29203d0..8b67c59d3 100644 --- a/docs/context/ref/Contact.md +++ b/docs/context/ref/Contact.md @@ -48,6 +48,7 @@ Other Types Intents +- [CreateInteraction](../../intents/ref/CreateInteraction) - [StartChat](../../intents/ref/StartChat) - [StartCall](../../intents/ref/StartCall) - [ViewProfile](../../intents/ref/ViewProfile) diff --git a/docs/context/ref/ContactList.md b/docs/context/ref/ContactList.md index 5f6fb8e65..9860247e2 100644 --- a/docs/context/ref/ContactList.md +++ b/docs/context/ref/ContactList.md @@ -64,6 +64,7 @@ Other Types Intents +- [CreateInteraction](../../intents/ref/CreateInteraction) - [StartChat](../../intents/ref/StartChat) - [StartCall](../../intents/ref/StartCall) diff --git a/docs/context/ref/Interaction.md b/docs/context/ref/Interaction.md new file mode 100644 index 000000000..e10148da2 --- /dev/null +++ b/docs/context/ref/Interaction.md @@ -0,0 +1,96 @@ +--- +id: Interaction +sidebar_label: Interaction +title: Interaction +hide_title: true +--- +# `Interaction` + +An `Interaction` is a significant direct exchange of ideas or information between a number of participants, e.g. a Sell Side party and one or more Buy Side parties. An `Interaction` might be a call, a meeting (physical or virtual), an IM or the preparation of some specialist data, such as financial data for a given company or sector. + +Notes: + +- `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or `'Meeting'` although other string values are permitted. +- `origin` is used to represent the application or service that the interaction was created from to aid in tracing the source of an interaction. +- `id` does not need to be populated by the originating application, however the target application could store it for future reference and SHOULD return it in a `TransactionResult`. +- `id` can be used by a target application to pass an identifier back to the originating application after an interaction record has been created, updated or deleted. +- `id.URI` can be used by a target application to pass a record's link back to the originating application. This offers the originating application a way to open the record for a user to view. + +## Type + +`fdc3.interaction` + +## Schema + +https://fdc3.finos.org/schemas/next/interaction.schema.json + +## Details + +| Property | Type | Required | Example Value | +|--------------------|------------------|-----------|-------------------------------------------------| +| `type` | string | Yes | `fdc3.interaction` | +| `participants` | fdc3.contactList | Yes | See below | +| `timeRange` | fdc3.timeRange | Yes | See below | +| `interactionType` | string | Yes | `Instant Message` | +| `description` | string | Yes | `Blah, blah, blah` | +| `initiator` | fdc3.contact | No | See below | +| `origin` | string | No | `Outlook` | +| `id.SINGLETRACK` | string | No | `a0S8d000000uO05EAE` | +| `id.SALESFORCE` | string | No | `a0S8d000000uO05EAE` | +| `id.URI` | string | No | `https://example.com/record/a0S8d000000uO05EAE` | + + +## Example + +```js +const interaction = { + type: 'fdc3.interaction', + participants: { + type: 'fdc3.contactList', + contacts: [ + { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane.doe@mail.com' + } + }, + { + type: 'fdc3.contact', + name: 'John Doe', + id: { + email: 'john.doe@mail.com' + } + }, + ] + }, + interactionType: 'Instant Message', + timeRange: { + type: 'fdc3.timeRange', + startTime: '2022-02-10T15:12:00Z' + }, + description: 'Laboris libero dapibus fames elit adipisicing eu, fermentum, dignissimos laboriosam, erat, risus qui deserunt. Praesentium! Reiciendis. Hic harum nostrud, harum potenti amet? Mauris. Pretium aliquid animi, eget eiusmod integer proident. Architecto ipsum blandit ducimus, possimus illum sunt illum necessitatibus ab litora sed, nonummy integer minus corrupti ducimus iste senectus accumsan, fugiat nostrud? Pede vero dictumst excepturi, iure earum consequuntur voluptatum', + initiator: { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane.doe@mail.com' + } + }, + origin: 'Outlook' +} + +fdc3.raiseIntent('CreateInteraction', interaction) +``` + +## See Also + +Other Types +- [Contact](Contact) +- [ContactList](ContactList) +- [TimeRange](TimeRange) +- [TransactionResult](TransactionResult) + +Intents +- [CreateInteraction](../../intents/ref/CreateInteraction) +- [ViewInteractions](../../intents/ref/ViewInteractions) \ No newline at end of file diff --git a/docs/context/ref/Message.md b/docs/context/ref/Message.md new file mode 100644 index 000000000..a313f0bd0 --- /dev/null +++ b/docs/context/ref/Message.md @@ -0,0 +1,77 @@ +--- +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) diff --git a/docs/context/ref/SearchCriteria.md b/docs/context/ref/SearchCriteria.md new file mode 100644 index 000000000..13b06ad64 --- /dev/null +++ b/docs/context/ref/SearchCriteria.md @@ -0,0 +1,64 @@ +--- +id: ChatSearchCriteria +sidebar_label: ChatSearchCriteria +title: ChatSearchCriteria +hide_title: true +--- +# `ChatSearchCriteria` + +A context type that represents a simple search criterion, based on a list of other context objects, that can be used to search or filter messages in a chat application. + +## Type + +`fdc3.chat.searchCriteria` + +## Schema + +https://fdc3.finos.org/schemas/next/chatSearchCriteria.schema.json + +## Details + +| Property | Type | Required | Example Value | +|------------------|-----------------|----------|----------------------| +| `type` | string | Yes | `'fdc3.chat.searchCriteria'` | +| `criteria` | (Instrument |
Contact |
Organization |
string)[] | Yes |
[
  {
    "type": "fdc3.instrument",
    "id": {
      "ticker": "AAPL"
    }
  },
  {
    "type": "fdc3.contact",
    "name":"Jane Doe",
    "id": {
      "email": "jane.doe@mail.com"
    }
  },
  {
    "type": "fdc3.organization",
    "name":"Symphony",
  },
  "#OrderID45788422",
]
| + +⚠️ Operators (and/or/not) are not defined in `fdc3.chat.searchCriteria`. It is up to the application that processes the FDC3 Intent to choose and apply the operators between the criteria. + +Empty search criteria can be supported to allow resetting of filters. + +## Example + +```js +const searchCriteria = { + type: "fdc3.chat.searchCriteria", + criteria: [ + { + type: "fdc3.instrument", + id: { + ticker: "AAPL" + } + }, + { + type: "fdc3.contact", + name: "Jane Doe", + id: { + email: "jane.doe@mail.com" + } + }, + { + type: "fdc3.organization", + name: "Symphony" + }, + "#OrderID45788422" + ] +} + +fdc3.raiseIntent('ViewMessages', searchCriteria); +``` + +## See Also + +Intents + +* [ViewMessages](../../intents/ref/ViewMessages) diff --git a/docs/context/ref/TimeRange.md b/docs/context/ref/TimeRange.md index 3ac5ebd1c..7e38bbca4 100644 --- a/docs/context/ref/TimeRange.md +++ b/docs/context/ref/TimeRange.md @@ -80,3 +80,6 @@ const timeRange = { Other Types - [Chart](Chart) + +Intents +- [CreateInteraction](../../intents/ref/CreateInteraction) \ No newline at end of file diff --git a/docs/context/ref/TransactionResult.md b/docs/context/ref/TransactionResult.md new file mode 100644 index 000000000..3f91618e9 --- /dev/null +++ b/docs/context/ref/TransactionResult.md @@ -0,0 +1,59 @@ +--- +id: TransactionResult +sidebar_label: TransactionResult +title: TransactionResult +hide_title: true +--- +# `TransactionResult` + +A context type representing the result of a transaction initiated via FDC3, which SHOULD be returned as an [`IntentResult`](../../api/Types#intentresult) by intents that create, retrieve, update or delete content or records in another application. Its purpose is to provide a status and message (where needed) for the transaction and MAY wrap a returned context object. + +## Type + +`fdc3.transactionResult` + +## Schema + +https://fdc3.finos.org/schemas/next/transactionresult.schema.json + +## Details + +| Property | Type | Required | Example Value | +|------------|---------|----------|-------------------| +| `type` | string | Yes | 'fdc3.transactionResult' | +| `status` | string | Yes | `"Created" \| "Deleted" \| "Updated" \| "Failed"` | +| `context` | Context | No | See Below | +| `message` | string | No | See Below | + +## Example + +```js +const contact = { + type: "fdc3.contact", + name: "Jane Doe", + id: { + email: "jane.doe@mail.com" + } +} + +const resolution = await window.fdc3.raiseIntent('CreateOrUpdateProfile', contact); +const result = await resolution.getResult(); +console.log(JSON.stringify(result)); +``` + +Console log will display: + +```json +{ + "type": "fdc3.transactionResult", + "status": "Updated", + "context": { + "type": "fdc3.contact", + "name": "Jane Doe", + "id": { + "email": "jane.doe@mail.com" + } + }, + "message": "record with id 'jane.doe@mail.com' was updated" +} +``` diff --git a/docs/context/spec.md b/docs/context/spec.md index 99264ac45..c471fecda 100644 --- a/docs/context/spec.md +++ b/docs/context/spec.md @@ -161,8 +161,12 @@ 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.message`](ref/ChatMessage) ([schema](/schemas/next/chatMessage.schema.json)) +- [`fdc3.chat.room`](ref/ChatRoom) ([schema](/schemas/next/chatRoom.schema.json)) +- [`fdc3.chat.searchCriteria`](ref/ChatSearchCriteria) ([schema](/schemas/next/chatSearchCriteria.schema.json)) - [`fdc3.contact`](ref/Contact) ([schema](/schemas/next/contact.schema.json)) - [`fdc3.contactList`](ref/ContactList) ([schema](/schemas/next/contactList.schema.json)) - [`fdc3.country`](ref/Country) ([schema](/schemas/next/country.schema.json)) @@ -170,17 +174,20 @@ 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.interaction`](ref/Interaction) ([schema](/schemas/next/interaction.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)) - [`fdc3.nothing`](ref/Nothing) ([schema](/schemas/next/nothing.schema.json)) - [`fdc3.timerange`](ref/TimeRange) ([schema](/schemas/next/timerange.schema.json)) +- [`fdc3.transactionResult`](ref/TransactionResult) ([schema](/schemas/next/transactionresult.schema.json)) - [`fdc3.valuation`](ref/Valuation) ([schema](/schemas/next/valuation.schema.json)) -**Note:** The below examples show how the base context data interface can be used to define specific context data objects. - ### Examples +The below examples show how the base context data interface can be used to define specific context data objects. + #### Contact ```json diff --git a/docs/intents/ref/CreateInteraction.md b/docs/intents/ref/CreateInteraction.md new file mode 100644 index 000000000..041b663a4 --- /dev/null +++ b/docs/intents/ref/CreateInteraction.md @@ -0,0 +1,126 @@ +--- +id: CreateInteraction +sidebar_label: CreateInteraction +title: CreateInteraction +hide_title: true +--- +# `CreateInteraction` + +Create a record documenting an interaction (calls, meetings, etc.) between a list of contacts. + +## Intent Name + +`CreateInteraction` + +## Display Name + +`Create Interaction` + +## Possible Contexts + +* [ContactList](../../context/ref/ContactList) +* [Interaction](../../context/ref/Interaction) + +SHOULD return context as a result: + +* [TransactionResult](../../context/ref/TransactionResult) + +## Example + +```js +const interaction = { + type: 'fdc3.interaction', + participants: { + type: 'fdc3.contactList', + contacts: [ + { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane.doe@mail.com' + } + }, + { + type: 'fdc3.contact', + name: 'John Doe', + id: { + email: 'john.doe@mail.com' + } + }, + ] + }, + interactionType: 'Instant Message', + timeRange: { + type: 'fdc3.timeRange', + startTime: '2022-02-10T15:12:00Z' + }, + description: 'Laboris libero dapibus fames elit adipisicing eu, fermentum, dignissimos laboriosam, erat, risus qui deserunt. Praesentium! Reiciendis. Hic harum nostrud, harum potenti amet? Mauris. Pretium aliquid animi, eget eiusmod integer proident. Architecto ipsum blandit ducimus, possimus illum sunt illum necessitatibus ab litora sed, nonummy integer minus corrupti ducimus iste senectus accumsan, fugiat nostrud? Pede vero dictumst excepturi, iure earum consequuntur voluptatum', + initiator: { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane.doe@mail.com' + } + }, + origin: 'Outlook' +} + +const intentResolution = await fdc3.raiseIntent('CreateInteraction', interaction); +const result = await intentResolution.getResult(); +console.log(result); +``` + +Console log will display: + +```js +{ + type: 'fdc3.transactionResult', + status: 'Created', + context: { + type: 'fdc3.interaction', + participants: { + type: 'fdc3.contactList', + contacts: [ + { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane.doe@mail.com' + } + }, + { + type: 'fdc3.contact', + name: 'John Doe', + id: { + email: 'john.doe@mail.com' + } + }, + ] + }, + interactionType: 'Instant Message', + timeRange: { + type: 'fdc3.timeRange', + startTime: '2022-02-10T15:12:00Z' + }, + description: 'Laboris libero dapibus fames elit adipisicing eu, fermentum, dignissimos laboriosam, erat, risus qui deserunt. Praesentium! Reiciendis. Hic harum nostrud, harum potenti amet? Mauris. Pretium aliquid animi, eget eiusmod integer proident. Architecto ipsum blandit ducimus, possimus illum sunt illum necessitatibus ab litora sed, nonummy integer minus corrupti ducimus iste senectus accumsan, fugiat nostrud? Pede vero dictumst excepturi, iure earum consequuntur voluptatum', + initiator: { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane.doe@mail.com' + } + }, + origin: 'Outlook' + id: { + Singletrack: 'a0S8d000000uO05EAE' + } + }, + message: 'record with id "a0S8d000000uO05EAE" was created' +} +``` + +## See Also + +Context +- [Interaction](../../context/ref/Interaction) +- [TransactionResult](../../context/ref/TransactionResult) \ No newline at end of file diff --git a/docs/intents/ref/SendChatMessage.md b/docs/intents/ref/SendChatMessage.md new file mode 100644 index 000000000..e34673333 --- /dev/null +++ b/docs/intents/ref/SendChatMessage.md @@ -0,0 +1,50 @@ +--- +id: SendChatMessage +sidebar_label: SendChatMessage +title: SendChatMessage +hide_title: true +--- +# `SendChatMessage` + +Send a message to an existing chat room. + +## Intent Name + +`SendChatMessage` + +## Display Name + +`Send Chat Message` + +## Possible Contexts + +* [ChatMessage](../../context/ref/ChatMessage) + +## Example + +```js +// Start a chat and retrieve a reference to the chat room created +const intentResolution = await fdc3.raiseIntent("StartChat", context); +const chatRoom = intentResolution.getResult(); + +//Some time later + +let chatMessage: ChatMessage = { + type: "fdc3.chat.message", + chatRoom, + message: "Another message to send in the room" +} + +await fdc3.raiseIntent("SendChatMessage", context, intentResolution.source); +``` + +## See Also + +Context +- [ChatMessage](../../context/ref/ChatMessage) +- [ChatRoom](../../context/ref/ChatRoom) + +Intents +* [StartChat](StartChat) +* [StartCall](StartCall) +* [StartEmail](StartEmail) diff --git a/docs/intents/ref/StartChat.md b/docs/intents/ref/StartChat.md index 84ea4c30b..344263076 100644 --- a/docs/intents/ref/StartChat.md +++ b/docs/intents/ref/StartChat.md @@ -6,7 +6,7 @@ hide_title: true --- # `StartChat` -Initiate a chat with a contact, a list of contacts or detailed initialization settings. +Initiate a chat with a contact, a list of contacts or detailed initialization settings. This could be launched from within another application. For example initiating a chat from a research or OMS application. ## Intent Name @@ -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: { @@ -51,27 +57,44 @@ const initSettings = { }, options: { groupRecipients: true, // one chat with both contacts - public: false, // private chat room + isPublic: 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); -const chatRoomRefs = await resolution.getResult(); + +// Return a reference to the room +const chatRoom = await resolution.getResult(); ``` ## See Also Context +- [ChatRoom](../../context/ref/ChatRoom) - [Contact](../../context/ref/Contact) - [ContactList](../../context/ref/ContactList) - [ChatInitSettings](../../context/ref/ChatInitSettings) Intents +- [SendChatMessage](SendChatMessage) - [StartCall](StartCall) - [StartEmail](StartEmail) diff --git a/docs/intents/ref/ViewChat.md b/docs/intents/ref/ViewChat.md new file mode 100644 index 000000000..4a6973bd6 --- /dev/null +++ b/docs/intents/ref/ViewChat.md @@ -0,0 +1,103 @@ +--- +id: ViewChat +sidebar_label: ViewChat +title: ViewChat +hide_title: true +--- +# `ViewChat` + +Open an existing chat room. + +## Intent Name + +`ViewChat` + +## Display Name + +`View Chat` + +## Possible Contexts + +* [ChatRoom](../../context/ref/ChatRoom) +* [Contact](../../context/ref/Contact): It will open the **direct** chat where there is the current user and the contact +* [ContactList](../../context/ref/ContactList): It will open the **room** where there is the current user and the listed contacts. Contact List may need to display search results if there are multiple matches. + +## Output + +This intent returns as output: +* If the chat doesn't exist, will display a modal to create a chat +* if the chat gets created, return its ChatRoom context +* if none is created return void + +## Example: ChatRoom + +```js +const chatRoom = { + type: 'fdc3.chat.room', + providerName: "Symphony", + id: { + streamId: "j75xqXy25NBOdacUI3FNBH" + } +} + +const intentResolution = await fdc3.raiseIntent('ViewChat', chatRoom); + +const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the room was found +``` + +## Example: Contact + +```js +const contact = { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane@mail.com' + } +} + +const intentResolution = await fdc3.raiseIntent('ViewChat', contact); + +const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the direct chat was found +``` + +## Example: ContactList + +```js +const contacts = { + type: 'fdc3.contactList', + contacts: [ + { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane.doe@mail.com' + } + }, + { + type: 'fdc3.contact', + name: 'John Doe', + id: { + email: 'john.doe@mail.com' + } + }, + ] +} + + +const intentResolution = await fdc3.raiseIntent('ViewChat', contacts); + +const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the room was found +``` + +## See Also + +Context + +* [ChatRoom](../../context/ref/ChatRoom) +* [Contact](../../context/ref/Contact) +* [ContactList](../../context/ref/ContactList) + +Intents + +* [StartChat](StartChat) \ No newline at end of file diff --git a/docs/intents/ref/ViewMessages.md b/docs/intents/ref/ViewMessages.md new file mode 100644 index 000000000..fa3c28459 --- /dev/null +++ b/docs/intents/ref/ViewMessages.md @@ -0,0 +1,124 @@ +--- +id: ViewMessages +sidebar_label: ViewMessages +title: ViewMessages +hide_title: true +--- +# `ViewMessages` + +Search and display a list of messages (for example in a chat application or CRM) to the user. + +## Intent Name + +`ViewMessages` + +## Display Name + +`View Messages` + +## Possible Contexts + +* [ChatSearchCriteria](../../context/ref/ChatSearchCriteria) + +## Example + +Request display of messages relating to a specific `fdc3.instrument` (representing a ticker): +```js +const searchCriteria = { + type: "fdc3.chat.searchCriteria", + criteria: [ + { + type: "fdc3.instrument", + id: { + ticker: "AAPL" + } + } + ] +} + +fdc3.raiseIntent('ViewMessages', searchCriteria); +``` + +Request display of messages relating to a specific `fdc3.contact`: + +```js +const searchCriteria = { + type: "fdc3.chat.searchCriteria", + criteria: [ + { + type: "fdc3.contact", + name: "Jane Doe", + id: { + email: "jane.doe@mail.com" + } + } + ] +} + +fdc3.raiseIntent('ViewMessages', searchCriteria); +``` + +Request display of messages relating to a specific `fdc3.organization`: + +```js +const searchCriteria = { + type: "fdc3.chat.searchCriteria", + criteria: [ + { + type: "fdc3.organization", + name: "Symphony" + } + ] +} + +fdc3.raiseIntent('ViewMessages', searchCriteria); +``` + +Request display of messages relating to a specific **phrase**: + +```js +const searchCriteria = { + type: "fdc3.chat.searchCriteria", + criteria: [ + "#OrderID45788422" + ] +} + +fdc3.raiseIntent('ViewMessages', searchCriteria); +``` + +Request display of messages matching _multiple_ criteria: +```js +const searchCriteria = { + type: "fdc3.chat.searchCriteria", + criteria: [ + { + type: "fdc3.contact", + name: "Jane Doe", + id: { + email: "jane.doe@mail.com" + } + }, + { + type: "fdc3.organization", + name: "Symphony" + }, + "#OrderID45788422" + ] +} + +fdc3.raiseIntent('ViewMessages', searchCriteria); +``` + +## See Also + +Context + +* [ChatSearchCriteria](../../context/ref/ChatSearchCriteria) +* [Instrument](../../context/ref/Instrument) +* [Contact](../../context/ref/Contact) +* [Organization](../../context/ref/Organization) + +Intents + +* [ViewChat](ViewChat) \ No newline at end of file diff --git a/docs/intents/spec.md b/docs/intents/spec.md index b9636d745..5ca6e0025 100644 --- a/docs/intents/spec.md +++ b/docs/intents/spec.md @@ -127,6 +127,12 @@ const intentsAndApps = await fdc3.findIntentsByContext({ }); ``` +## Intents that return data + +From FDC3 2.0, intents raised through the Desktop Agent API may return results in the form of a `Context` object or a `Channel`. Where an intent implements a transaction with another application, for example for a CRUD operation, the [`fdc3.transactionResult` context type](../context/ref/TransactionResult) SHOULD be used to provide a result status for the transaction and may wrap a context object that would otherwise be returned. + +For more details on retrieving a result from a raised intent, see the [documentation for `raiseIntent`](../api/ref/DesktopAgent#raiseintent). + ## Intents Standard Compliance An FDC3 Standard compliant application that supports intents **MUST**: @@ -140,6 +146,7 @@ An FDC3 Standard compliant application that supports intents **SHOULD**: - Ensure that proprietary intents follow the recommended naming conventions in the specification. - Apply [namespacing](#namespaces) to proprietary intent names, where it is necessary to avoid collision with those created by other applications. - Where an app is intended to be launched in order to resolve a raised intent, use the [`fdc3.addIntentListener`](../api/ref/DesktopAgent#addintentlistener) API call to set up the necessary handler function(s) within 15 seconds of the application launch (the minimum timeout Desktop Agents are required to provide) in order to be widely compatible with Desktop Agent implementations. +- Use the `fdc3.transactionResult` context type to return a status for any transactions relating to CRUD operations. An FDC3 Standard compliant application that supports intents **MAY**: @@ -151,19 +158,22 @@ For more details on FDC3 Standards compliance (including the versioning, depreca A list of standardized intents are defined in the following pages: -- [`StartCall`](ref/StartCall) -- [`StartChat`](ref/StartChat) -- [`StartEmail`](ref/StartEmail) -- [`ViewAnalysis`](ref/ViewAnalysis) -- [`ViewChart`](ref/ViewChart) -- [`ViewHoldings`](ref/ViewHoldings) -- [`ViewInstrument`](ref/ViewInstrument) -- [`ViewInteractions`](ref/ViewInteractions) -- [`ViewNews`](ref/ViewNews) -- [`ViewOrders`](ref/ViewOrders) -- [`ViewProfile`](ref/ViewProfile) -- [`ViewQuote`](ref/ViewQuote) -- [`ViewResearch`](ref/ViewResearch) +* [`CreateInteraction`](ref/CreateInteraction) +* [`StartCall`](ref/StartCall) +* [`StartChat`](ref/StartChat) +* [`StartEmail`](ref/StartEmail) +* [`ViewAnalysis`](ref/ViewAnalysis) +* [`ViewChat`](ref/ViewChat) +* [`ViewChart`](ref/ViewChart) +* [`ViewHoldings`](ref/ViewHoldings) +* [`ViewInstrument`](ref/ViewInstrument) +* [`ViewInteractions`](ref/ViewInteractions) +* [`ViewMessages`](ref/ViewMessages) +* [`ViewNews`](ref/ViewNews) +* [`ViewOrders`](ref/ViewOrders) +* [`ViewProfile`](ref/ViewProfile) +* [`ViewQuote`](ref/ViewQuote) +* [`ViewResearch`](ref/ViewResearch) ### Deprecated Intents diff --git a/src/context/ContextType.ts b/src/context/ContextType.ts index 5f31fb843..27269dbb9 100644 --- a/src/context/ContextType.ts +++ b/src/context/ContextType.ts @@ -1,6 +1,7 @@ export enum ContextTypes { Chart = 'fdc3.chart', ChatInitSettings = 'fdc3.chat.initSettings', + ChatRoom = 'fdc3.chat.room', Contact = 'fdc3.contact', ContactList = 'fdc3.contactList', Country = 'fdc3.country', @@ -8,11 +9,14 @@ export enum ContextTypes { Email = 'fdc3.email', Instrument = 'fdc3.instrument', InstrumentList = 'fdc3.instrumentList', + Interaction = 'fdc3.interaction', + Nothing = 'fdc3.nothing', Organization = 'fdc3.organization', Portfolio = 'fdc3.portfolio', Position = 'fdc3.position', - Nothing = 'fdc3.nothing', + ChatSearchCriteria = 'fdc3.chat.searchCriteria', TimeRange = 'fdc3.timerange', + TransactionResult = 'fdc3.transactionResult', Valuation = 'fdc3.valuation', } diff --git a/src/context/ContextTypes.ts b/src/context/ContextTypes.ts index b02c22a60..ce36bd04f 100644 --- a/src/context/ContextTypes.ts +++ b/src/context/ContextTypes.ts @@ -24,7 +24,7 @@ export interface Chart { instruments: InstrumentElement[]; - otherConfig?: { [key: string]: any }; + otherConfig?: OtherConfigElement[]; range?: TimeRangeObject; style?: Style; type: string; @@ -62,6 +62,13 @@ export interface PurpleMarket { [property: string]: any; } +export interface OtherConfigElement { + id?: { [key: string]: any }; + name?: string; + type: string; + [property: string]: any; +} + export interface TimeRangeObject { endTime?: Date; startTime?: Date; @@ -230,6 +237,17 @@ export interface InstrumentList { [property: string]: any; } +export interface Interaction { + id?: { [key: string]: string }; + type: string; + participants: ContactList; + timeRange: TimeRange; + interactionType: ('Instant Message' | 'Email' | 'Call' | 'Meeting') | string; + description: string; + initiator?: Contact; + origin?: string; +} + export interface Nothing { type: string; id?: { [key: string]: any }; @@ -286,6 +304,11 @@ export interface TimeRange { [property: string]: any; } +export interface ChatSearchCriteria { + criteria: (Instrument | Organization | Contact | string)[]; + type: string; +} + export interface Valuation { CURRENCY_ISOCODE: string; expiryTime?: Date; @@ -298,6 +321,13 @@ export interface Valuation { [property: string]: any; } +export interface TransactionResult { + status: ('Created' | 'Deleted' | 'Updated' | 'Failed') | string; + type: string; + context?: Context; + message?: string; +} + // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { @@ -600,7 +630,7 @@ const typeMap: any = { Chart: o( [ { json: 'instruments', js: 'instruments', typ: a(r('InstrumentElement')) }, - { json: 'otherConfig', js: 'otherConfig', typ: u(undefined, m('any')) }, + { json: 'otherConfig', js: 'otherConfig', typ: u(undefined, a(r('OtherConfigElement'))) }, { json: 'range', js: 'range', typ: u(undefined, r('TimeRangeObject')) }, { json: 'style', js: 'style', typ: u(undefined, r('Style')) }, { json: 'type', js: 'type', typ: '' }, @@ -641,6 +671,14 @@ const typeMap: any = { ], 'any' ), + OtherConfigElement: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), TimeRangeObject: o( [ { json: 'endTime', js: 'endTime', typ: u(undefined, Date) }, diff --git a/src/context/schemas.json b/src/context/schemas.json index 4310f348d..b367c6ad7 100644 --- a/src/context/schemas.json +++ b/src/context/schemas.json @@ -1,7 +1,10 @@ { + "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"], + "ChatMessage": ["https://fdc3.finos.org/schemas/next/chatMessage.schema.json"], + "ChatRoom": ["https://fdc3.finos.org/schemas/next/chatRoom.schema.json"], "Contact": ["https://fdc3.finos.org/schemas/next/contact.schema.json"], "ContactList": ["https://fdc3.finos.org/schemas/next/contactList.schema.json"], "Country": ["https://fdc3.finos.org/schemas/next/country.schema.json"], @@ -9,10 +12,14 @@ "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"], + "Interaction": ["https://fdc3.finos.org/schemas/next/interaction.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"], "Position": ["https://fdc3.finos.org/schemas/next/position.schema.json"], + "ChatSearchCriteria": ["https://fdc3.finos.org/schemas/next/chatSearchCriteria.schema.json"], "TimeRange": ["https://fdc3.finos.org/schemas/next/timerange.schema.json"], + "TransactionResult": ["https://fdc3.finos.org/schemas/next/transactionresult.schema.json"], "Valuation": ["https://fdc3.finos.org/schemas/next/valuation.schema.json"] } diff --git a/src/context/schemas/action.schema.json b/src/context/schemas/action.schema.json new file mode 100644 index 000000000..553631232 --- /dev/null +++ b/src/context/schemas/action.schema.json @@ -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" + ] +} diff --git a/src/context/schemas/chart.schema.json b/src/context/schemas/chart.schema.json index ab541e70c..9a913f1ce 100644 --- a/src/context/schemas/chart.schema.json +++ b/src/context/schemas/chart.schema.json @@ -20,7 +20,10 @@ "enum": [ "line", "bar", "stacked-bar", "mountain", "candle", "pie", "scatter", "histogram", "heatmap", "custom"] }, "otherConfig": { - "type": "object" + "type": "array", + "items": { + "$ref": "context.schema.json#" + } } }, "required": ["instruments"] diff --git a/src/context/schemas/chatInitSettings.schema.json b/src/context/schemas/chatInitSettings.schema.json index 044068dbd..7f1c5b8c2 100644 --- a/src/context/schemas/chatInitSettings.schema.json +++ b/src/context/schemas/chatInitSettings.schema.json @@ -3,28 +3,34 @@ "$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" - }, + "type": { "const": "fdc3.chat.initSettings" }, "chatName": { "type": "string" }, "members": { "$ref": "contactList.schema.json#" }, - "initMessage": { - "type": "string" + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "message.schema.json#" + } + ] }, "options": { - "groupRecipients": "boolean", - "public": "boolean", - "allowHistoryBrowsing": "boolean", - "allowMessageCopy": "boolean", - "allowAddUser": "boolean" + "type": "object", + "properties": { + "groupRecipients": {"type": "boolean"}, + "isPublic": {"type": "boolean"}, + "allowHistoryBrowsing": {"type": "boolean"}, + "allowMessageCopy": {"type": "boolean"}, + "allowAddUser": {"type": "boolean"} + } } - }, - "required": [ - "type" - ] -} \ No newline at end of file + } +} diff --git a/src/context/schemas/chatMessage.schema.json b/src/context/schemas/chatMessage.schema.json new file mode 100644 index 000000000..72171d832 --- /dev/null +++ b/src/context/schemas/chatMessage.schema.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/chatMessage.schema.json", + "type": "object", + "title": "ChatMessage", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.chat.message" }, + "chatRoom": { "$ref": "chatRoom.schema.json#" }, + "message": { "$ref": "message.schema.json#" } + }, + "required": ["type", "chatRoom", "message"] +} diff --git a/src/context/schemas/chatRoom.schema.json b/src/context/schemas/chatRoom.schema.json new file mode 100644 index 000000000..a5a430a6b --- /dev/null +++ b/src/context/schemas/chatRoom.schema.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/chatRoom.schema.json", + "type": "object", + "title": "ChatRoom", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.chat.room" }, + "providerName": { "type": "string" }, + "id": { "type": "object" }, + "url": { "type": "string" }, + "name": { "type": "string" } + }, + "required": ["providerName", "id"] +} diff --git a/src/context/schemas/chatSearchCriteria.schema.json b/src/context/schemas/chatSearchCriteria.schema.json new file mode 100644 index 000000000..932418859 --- /dev/null +++ b/src/context/schemas/chatSearchCriteria.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/chatSearchCriteria.schema.json", + "type": "object", + "title": "ChatSearchCriteria", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.chat.searchCriteria" }, + "criteria": { + "type": "array", + "items": { + "anyOf": [ + { "$ref":"instrument.schema.json#" }, + { "$ref": "organization.schema.json#" }, + { "$ref": "contact.schema.json#" }, + { "type": "string" } + ] + } + } + }, + "required": ["criteria"] +} diff --git a/src/context/schemas/interaction.schema.json b/src/context/schemas/interaction.schema.json new file mode 100644 index 000000000..ed32dfbc0 --- /dev/null +++ b/src/context/schemas/interaction.schema.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/interaction.schema.json", + "type": "object", + "title": "Interaction", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.interaction" }, + "participants": { + "$ref": "contactList.schema.json#" + }, + "timeRange": { + "$ref": "timerange.schema.json#" + }, + "interactionType": { + "anyOf": [ + { + "type": "string", + "enum": ["Instant Message", "Email", "Call", "Meeting"] + }, + { + "type": "string" + } + ] + }, + "description": { + "type": "string" + }, + "initiator": { + "$ref": "contact.schema.json#" + }, + "origin": { + "type": "string" + } + }, + "required": ["participants", "timeRange", "interactionType", "description"] +} \ No newline at end of file diff --git a/src/context/schemas/message.schema.json b/src/context/schemas/message.schema.json new file mode 100644 index 000000000..05d44205d --- /dev/null +++ b/src/context/schemas/message.schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/message.schema.json", + "type": "object", + "title": "Message", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.message" }, + "text": { + "type": "object", + "properties": { + "text/plain": { + "type": "string" + }, + "text/markdown": { + "type": "string" + } + } + }, + "entities": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "action.schema.json#" + }, + { + "type": "object", + "properties": { + "type": { + "const": "fdc3.entity.fileAttachment" + }, + "data": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "dataUri": { + "type": "string" + } + }, + "required": [ + "name", + "dataUri" + ] + } + }, + "required": ["type", "data"] + } + ] + } + } + } +} diff --git a/src/context/schemas/transactionresult.schema.json b/src/context/schemas/transactionresult.schema.json new file mode 100644 index 000000000..a2db6370d --- /dev/null +++ b/src/context/schemas/transactionresult.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/transactionresult.schema.json", + "type": "object", + "title": "TransactionResult", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.transactionResult" }, + "status": { + "type": "string", + "enum": ["Created", "Deleted", "Updated", "Failed"] + }, + "context": { "$ref": "context.schema.json#" } + }, + "message": { + "type": "string" + }, + "required": ["type", "status"] +} \ No newline at end of file diff --git a/src/intents/Intents.ts b/src/intents/Intents.ts index 09141c0cb..fdf7e297d 100644 --- a/src/intents/Intents.ts +++ b/src/intents/Intents.ts @@ -1,13 +1,17 @@ export enum Intents { + CreateInteraction = 'CreateInteraction', + SendChatMessage = 'SendChatMessage', StartCall = 'StartCall', StartChat = 'StartChat', StartEmail = 'StartEmail', ViewAnalysis = 'ViewAnalysis', + ViewChat = 'ViewChat', ViewChart = 'ViewChart', ViewContact = 'ViewContact', ViewHoldings = 'ViewHoldings', ViewInstrument = 'ViewInstrument', ViewInteractions = 'ViewInteractions', + ViewMessages = 'ViewMessages', ViewNews = 'ViewNews', ViewOrders = 'ViewOrders', ViewProfile = 'ViewProfile', diff --git a/src/intents/standard intents.json b/src/intents/standard intents.json index 8110a5df8..6397ee9a4 100644 --- a/src/intents/standard intents.json +++ b/src/intents/standard intents.json @@ -1,5 +1,9 @@ { "intents": [ + { + "name": "CreateInteraction", + "displayName": "Create Interaction" + }, { "name": "StartCall", "displayName": "Call" diff --git a/website/sidebars.json b/website/sidebars.json index cc3fe6972..b07f5048a 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -38,14 +38,18 @@ "label": "Intents Part", "items": [ "intents/spec", + "intents/ref/CreateInteraction", "intents/ref/StartCall", "intents/ref/StartChat", "intents/ref/StartEmail", + "intents/ref/SendChatMessage", "intents/ref/ViewAnalysis", + "intents/ref/ViewChat", "intents/ref/ViewChart", "intents/ref/ViewHoldings", "intents/ref/ViewInstrument", "intents/ref/ViewInteractions", + "intents/ref/ViewMessages", "intents/ref/ViewNews", "intents/ref/ViewOrders", "intents/ref/ViewProfile", @@ -62,6 +66,8 @@ "context/ref/Context", "context/ref/Chart", "context/ref/ChatInitSettings", + "context/ref/ChatMessage", + "context/ref/ChatRoom", "context/ref/Contact", "context/ref/ContactList", "context/ref/Country", @@ -69,11 +75,15 @@ "context/ref/Email", "context/ref/Instrument", "context/ref/InstrumentList", + "context/ref/Interaction", + "context/ref/Message", "context/ref/Nothing", "context/ref/Organization", "context/ref/Portfolio", "context/ref/Position", + "context/ref/ChatSearchCriteria", "context/ref/TimeRange", + "context/ref/TransactionResult", "context/ref/Valuation" ] } diff --git a/website/static/schemas/2.0/chatInitSettings.schema.json b/website/static/schemas/2.0/chatInitSettings.schema.json index 093cb4051..ed9b45395 100644 --- a/website/static/schemas/2.0/chatInitSettings.schema.json +++ b/website/static/schemas/2.0/chatInitSettings.schema.json @@ -17,11 +17,14 @@ "type": "string" }, "options": { - "groupRecipients": "boolean", - "public": "boolean", - "allowHistoryBrowsing": "boolean", - "allowMessageCopy": "boolean", - "allowAddUser": "boolean" + "type": "object", + "properties": { + "groupRecipients": {"type": "boolean"}, + "isPublic": {"type": "boolean"}, + "allowHistoryBrowsing": {"type": "boolean"}, + "allowMessageCopy": {"type": "boolean"}, + "allowAddUser": {"type": "boolean"} + } } }, "required": [ diff --git a/website/static/schemas/next/action.schema.json b/website/static/schemas/next/action.schema.json new file mode 100644 index 000000000..553631232 --- /dev/null +++ b/website/static/schemas/next/action.schema.json @@ -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" + ] +} diff --git a/website/static/schemas/next/chatInitSettings.schema.json b/website/static/schemas/next/chatInitSettings.schema.json index 044068dbd..7f1c5b8c2 100644 --- a/website/static/schemas/next/chatInitSettings.schema.json +++ b/website/static/schemas/next/chatInitSettings.schema.json @@ -3,28 +3,34 @@ "$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" - }, + "type": { "const": "fdc3.chat.initSettings" }, "chatName": { "type": "string" }, "members": { "$ref": "contactList.schema.json#" }, - "initMessage": { - "type": "string" + "message": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "message.schema.json#" + } + ] }, "options": { - "groupRecipients": "boolean", - "public": "boolean", - "allowHistoryBrowsing": "boolean", - "allowMessageCopy": "boolean", - "allowAddUser": "boolean" + "type": "object", + "properties": { + "groupRecipients": {"type": "boolean"}, + "isPublic": {"type": "boolean"}, + "allowHistoryBrowsing": {"type": "boolean"}, + "allowMessageCopy": {"type": "boolean"}, + "allowAddUser": {"type": "boolean"} + } } - }, - "required": [ - "type" - ] -} \ No newline at end of file + } +} diff --git a/website/static/schemas/next/chatMessage.schema.json b/website/static/schemas/next/chatMessage.schema.json new file mode 100644 index 000000000..72171d832 --- /dev/null +++ b/website/static/schemas/next/chatMessage.schema.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/chatMessage.schema.json", + "type": "object", + "title": "ChatMessage", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.chat.message" }, + "chatRoom": { "$ref": "chatRoom.schema.json#" }, + "message": { "$ref": "message.schema.json#" } + }, + "required": ["type", "chatRoom", "message"] +} diff --git a/website/static/schemas/next/chatRoom.schema.json b/website/static/schemas/next/chatRoom.schema.json new file mode 100644 index 000000000..a5a430a6b --- /dev/null +++ b/website/static/schemas/next/chatRoom.schema.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/chatRoom.schema.json", + "type": "object", + "title": "ChatRoom", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.chat.room" }, + "providerName": { "type": "string" }, + "id": { "type": "object" }, + "url": { "type": "string" }, + "name": { "type": "string" } + }, + "required": ["providerName", "id"] +} diff --git a/website/static/schemas/next/chatSearchCriteria.schema.json b/website/static/schemas/next/chatSearchCriteria.schema.json new file mode 100644 index 000000000..932418859 --- /dev/null +++ b/website/static/schemas/next/chatSearchCriteria.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/chatSearchCriteria.schema.json", + "type": "object", + "title": "ChatSearchCriteria", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.chat.searchCriteria" }, + "criteria": { + "type": "array", + "items": { + "anyOf": [ + { "$ref":"instrument.schema.json#" }, + { "$ref": "organization.schema.json#" }, + { "$ref": "contact.schema.json#" }, + { "type": "string" } + ] + } + } + }, + "required": ["criteria"] +} diff --git a/website/static/schemas/next/context.schema.json b/website/static/schemas/next/context.schema.json index 8671df1a0..2f0d9e0e6 100644 --- a/website/static/schemas/next/context.schema.json +++ b/website/static/schemas/next/context.schema.json @@ -8,7 +8,7 @@ "name": { "type": "string" }, "id": { "type": "object", - "additionalProperties": { "type": "string" } + "unevaluatedProperties": { "type": "string" } } }, "required": ["type"] diff --git a/website/static/schemas/next/instrument.schema.json b/website/static/schemas/next/instrument.schema.json index 4127ed604..ed25d4274 100644 --- a/website/static/schemas/next/instrument.schema.json +++ b/website/static/schemas/next/instrument.schema.json @@ -27,8 +27,10 @@ "name": { "type": "string" }, "COUNTRY_ISOALPHA2": { "type": "string" }, "BBG": { "type": "string" } - } + }, + "unevaluatedProperties": { "type": "string" } } + }, "required": ["id"] } \ No newline at end of file diff --git a/website/static/schemas/next/interaction.schema.json b/website/static/schemas/next/interaction.schema.json new file mode 100644 index 000000000..ed32dfbc0 --- /dev/null +++ b/website/static/schemas/next/interaction.schema.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/interaction.schema.json", + "type": "object", + "title": "Interaction", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.interaction" }, + "participants": { + "$ref": "contactList.schema.json#" + }, + "timeRange": { + "$ref": "timerange.schema.json#" + }, + "interactionType": { + "anyOf": [ + { + "type": "string", + "enum": ["Instant Message", "Email", "Call", "Meeting"] + }, + { + "type": "string" + } + ] + }, + "description": { + "type": "string" + }, + "initiator": { + "$ref": "contact.schema.json#" + }, + "origin": { + "type": "string" + } + }, + "required": ["participants", "timeRange", "interactionType", "description"] +} \ No newline at end of file diff --git a/website/static/schemas/next/message.schema.json b/website/static/schemas/next/message.schema.json new file mode 100644 index 000000000..05d44205d --- /dev/null +++ b/website/static/schemas/next/message.schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/message.schema.json", + "type": "object", + "title": "Message", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.message" }, + "text": { + "type": "object", + "properties": { + "text/plain": { + "type": "string" + }, + "text/markdown": { + "type": "string" + } + } + }, + "entities": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "$ref": "action.schema.json#" + }, + { + "type": "object", + "properties": { + "type": { + "const": "fdc3.entity.fileAttachment" + }, + "data": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "dataUri": { + "type": "string" + } + }, + "required": [ + "name", + "dataUri" + ] + } + }, + "required": ["type", "data"] + } + ] + } + } + } +} diff --git a/website/static/schemas/next/transactionresult.schema.json b/website/static/schemas/next/transactionresult.schema.json new file mode 100644 index 000000000..a2db6370d --- /dev/null +++ b/website/static/schemas/next/transactionresult.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/transactionresult.schema.json", + "type": "object", + "title": "TransactionResult", + "allOf": [{ "$ref": "context.schema.json#" }], + "properties": { + "type": { "const": "fdc3.transactionResult" }, + "status": { + "type": "string", + "enum": ["Created", "Deleted", "Updated", "Failed"] + }, + "context": { "$ref": "context.schema.json#" } + }, + "message": { + "type": "string" + }, + "required": ["type", "status"] +} \ No newline at end of file diff --git a/website/versioned_docs/version-2.0/context/ref/ChatInitSettings.md b/website/versioned_docs/version-2.0/context/ref/ChatInitSettings.md index 9fadecd26..f9d13fba2 100644 --- a/website/versioned_docs/version-2.0/context/ref/ChatInitSettings.md +++ b/website/versioned_docs/version-2.0/context/ref/ChatInitSettings.md @@ -26,7 +26,7 @@ https://fdc3.finos.org/schemas/2.0/chatInitSettings.schema.json | `members` | ContactList | No | ContactList - cf. below | | `initMessage` | string | No | `'Hello!'` | | `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.isPublic` | 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.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 | @@ -58,7 +58,7 @@ const initSettings = { }, options: { groupRecipients: true, // one chat with both contacts - public: false, // private chat room + isPublic: false, // private chat room allowHistoryBrowsing: true, allowMessageCopy: true } diff --git a/website/versioned_docs/version-2.0/intents/ref/StartChat.md b/website/versioned_docs/version-2.0/intents/ref/StartChat.md index 0701de7c2..ba6876dfa 100644 --- a/website/versioned_docs/version-2.0/intents/ref/StartChat.md +++ b/website/versioned_docs/version-2.0/intents/ref/StartChat.md @@ -6,7 +6,7 @@ original_id: StartChat --- # `StartChat` -Initiate a chat with a contact, a list of contacts or detailed initialization settings. +Initiate a chat with a contact, a list of contacts or detailed initialization settings. This could be launched from within another application. For example initiating a chat from a research or OMS application. ## Intent Name @@ -51,7 +51,7 @@ const initSettings = { }, options: { groupRecipients: true, // one chat with both contacts - public: false, // private chat room + isPublic: false, // private chat room allowHistoryBrowsing: true, allowMessageCopy: true, allowAddUser: false, // John won't be authorized to add other users to the chat @@ -60,7 +60,7 @@ const initSettings = { } const resolution = fdc3.raiseIntent('StartChat', initSettings); -const chatRoomRefs = await resolution.getResult(); +const chatRooms = await resolution.getResult(); ``` ## See Also