@atlaskit/rovo-triggers 10.34.0 → 10.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @atlaskit/rovo-triggers
2
2
 
3
+ ## 10.36.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`fd47723e42634`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fd47723e42634) -
8
+ Add artifacts context type
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 10.35.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [`64dbb5601ed23`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64dbb5601ed23) -
19
+ Ask the product for context when the extension context bridge client mounts.
20
+
21
+ `ExtensionContextBridgeClient` now sends a single `request-context` control message once its
22
+ transport is ready. A product that answers requests replies with the context it has already
23
+ published, so a chat opened after the page settled is caught up instead of waiting for the next
24
+ publish.
25
+
26
+ This completes the handshake whose two halves shipped separately: the control message itself, and
27
+ the product-side answer. It exists because the bridge is otherwise fire-and-forget, which suits a
28
+ publisher that runs continuously, such as the Confluence editor, but not one that publishes once
29
+ per navigation, such as a Jira view.
30
+
31
+ Additive and safe against products that do not answer: the request is sent once per mount, carries
32
+ no data, and a product that ignores it behaves exactly as before.
33
+
3
34
  ## 10.34.0
4
35
 
5
36
  ### Minor Changes
@@ -131,6 +131,24 @@ var ExtensionContextBridgeClient = exports.ExtensionContextBridgeClient = functi
131
131
  });
132
132
  }, [activeTransport, publish]);
133
133
 
134
+ // Handshake: ask the product to re-send its current context.
135
+ //
136
+ // The chat only ever sees context published while it is listening, and it mounts long after the
137
+ // page — the user opens the side panel on a page that settled minutes ago. Products that publish
138
+ // once per navigation (Jira views) would otherwise never be observed at all. Asking, rather than
139
+ // having the extension retain context on the chance a panel opens later, keeps page data in the
140
+ // page until a chat actually exists to receive it.
141
+ (0, _react.useEffect)(function () {
142
+ if (!activeTransport) {
143
+ return;
144
+ }
145
+ try {
146
+ activeTransport.send((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.BRIDGE_MESSAGE_MARKER, true), "direction", _constants.BRIDGE_TO_PRODUCT), "control", _constants.BRIDGE_CONTROL_REQUEST_CONTEXT));
147
+ } catch (_unused2) {
148
+ // Never let bridging break the chat iframe.
149
+ }
150
+ }, [activeTransport]);
151
+
134
152
  // Outbound (WRITE, payloads): allowlisted chat actions -> product.
135
153
  (0, _main.useSubscribeAll)(function (payload) {
136
154
  if (!activeTransport) {
@@ -149,7 +167,7 @@ var ExtensionContextBridgeClient = exports.ExtensionContextBridgeClient = functi
149
167
  }
150
168
  try {
151
169
  activeTransport.send((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.BRIDGE_MESSAGE_MARKER, true), "direction", _constants.BRIDGE_TO_PRODUCT), "payload", serialized));
152
- } catch (_unused2) {
170
+ } catch (_unused3) {
153
171
  // Never let bridging break the chat iframe.
154
172
  }
155
173
  });
package/dist/cjs/types.js CHANGED
@@ -49,6 +49,9 @@ var Topics = exports.Topics = {
49
49
 
50
50
  /** Partial database context for iframe updates (e.g. selection-only). */
51
51
 
52
+ // Not using PayloadCore because `data: type | undefined` is necessary
53
+ // but `| undefined` will cause `data` to be removed by PayloadCore.
54
+
52
55
  // Not using the PayloadCore because the `data: type | undefined` is necessary
53
56
  // but `| undefined` will cause `data` to be removed by PayloadCore
54
57
 
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useMemo, useRef } from 'react';
2
2
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
3
  import { usePublish, useSubscribeAll } from '../../../main';
4
- import { BRIDGE_MESSAGE_MARKER, BRIDGE_SOURCE, BRIDGE_TO_EXTENSION, BRIDGE_TO_PRODUCT } from './constants';
4
+ import { BRIDGE_CONTROL_REQUEST_CONTEXT, BRIDGE_MESSAGE_MARKER, BRIDGE_SOURCE, BRIDGE_TO_EXTENSION, BRIDGE_TO_PRODUCT } from './constants';
5
5
  import { shouldRelayToProduct } from './policy';
6
6
  import { deserializePayload, serializePayload } from './registry';
7
7
  import { createWindowTransport, isBridgeControlMessage } from './transport';
@@ -125,6 +125,28 @@ export const ExtensionContextBridgeClient = ({
125
125
  });
126
126
  }, [activeTransport, publish]);
127
127
 
128
+ // Handshake: ask the product to re-send its current context.
129
+ //
130
+ // The chat only ever sees context published while it is listening, and it mounts long after the
131
+ // page — the user opens the side panel on a page that settled minutes ago. Products that publish
132
+ // once per navigation (Jira views) would otherwise never be observed at all. Asking, rather than
133
+ // having the extension retain context on the chance a panel opens later, keeps page data in the
134
+ // page until a chat actually exists to receive it.
135
+ useEffect(() => {
136
+ if (!activeTransport) {
137
+ return;
138
+ }
139
+ try {
140
+ activeTransport.send({
141
+ [BRIDGE_MESSAGE_MARKER]: true,
142
+ direction: BRIDGE_TO_PRODUCT,
143
+ control: BRIDGE_CONTROL_REQUEST_CONTEXT
144
+ });
145
+ } catch {
146
+ // Never let bridging break the chat iframe.
147
+ }
148
+ }, [activeTransport]);
149
+
128
150
  // Outbound (WRITE, payloads): allowlisted chat actions -> product.
129
151
  useSubscribeAll(payload => {
130
152
  if (!activeTransport) {
@@ -43,6 +43,9 @@ export const Topics = {
43
43
 
44
44
  /** Partial database context for iframe updates (e.g. selection-only). */
45
45
 
46
+ // Not using PayloadCore because `data: type | undefined` is necessary
47
+ // but `| undefined` will cause `data` to be removed by PayloadCore.
48
+
46
49
  // Not using the PayloadCore because the `data: type | undefined` is necessary
47
50
  // but `| undefined` will cause `data` to be removed by PayloadCore
48
51
 
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { useEffect, useMemo, useRef } from 'react';
5
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
6
6
  import { usePublish, useSubscribeAll } from '../../../main';
7
- import { BRIDGE_MESSAGE_MARKER, BRIDGE_SOURCE, BRIDGE_TO_EXTENSION, BRIDGE_TO_PRODUCT } from './constants';
7
+ import { BRIDGE_CONTROL_REQUEST_CONTEXT, BRIDGE_MESSAGE_MARKER, BRIDGE_SOURCE, BRIDGE_TO_EXTENSION, BRIDGE_TO_PRODUCT } from './constants';
8
8
  import { shouldRelayToProduct } from './policy';
9
9
  import { deserializePayload, serializePayload } from './registry';
10
10
  import { createWindowTransport, isBridgeControlMessage } from './transport';
@@ -125,6 +125,24 @@ export var ExtensionContextBridgeClient = function ExtensionContextBridgeClient(
125
125
  });
126
126
  }, [activeTransport, publish]);
127
127
 
128
+ // Handshake: ask the product to re-send its current context.
129
+ //
130
+ // The chat only ever sees context published while it is listening, and it mounts long after the
131
+ // page — the user opens the side panel on a page that settled minutes ago. Products that publish
132
+ // once per navigation (Jira views) would otherwise never be observed at all. Asking, rather than
133
+ // having the extension retain context on the chance a panel opens later, keeps page data in the
134
+ // page until a chat actually exists to receive it.
135
+ useEffect(function () {
136
+ if (!activeTransport) {
137
+ return;
138
+ }
139
+ try {
140
+ activeTransport.send(_defineProperty(_defineProperty(_defineProperty({}, BRIDGE_MESSAGE_MARKER, true), "direction", BRIDGE_TO_PRODUCT), "control", BRIDGE_CONTROL_REQUEST_CONTEXT));
141
+ } catch (_unused2) {
142
+ // Never let bridging break the chat iframe.
143
+ }
144
+ }, [activeTransport]);
145
+
128
146
  // Outbound (WRITE, payloads): allowlisted chat actions -> product.
129
147
  useSubscribeAll(function (payload) {
130
148
  if (!activeTransport) {
@@ -143,7 +161,7 @@ export var ExtensionContextBridgeClient = function ExtensionContextBridgeClient(
143
161
  }
144
162
  try {
145
163
  activeTransport.send(_defineProperty(_defineProperty(_defineProperty({}, BRIDGE_MESSAGE_MARKER, true), "direction", BRIDGE_TO_PRODUCT), "payload", serialized));
146
- } catch (_unused2) {
164
+ } catch (_unused3) {
147
165
  // Never let bridging break the chat iframe.
148
166
  }
149
167
  });
package/dist/esm/types.js CHANGED
@@ -43,6 +43,9 @@ export var Topics = {
43
43
 
44
44
  /** Partial database context for iframe updates (e.g. selection-only). */
45
45
 
46
+ // Not using PayloadCore because `data: type | undefined` is necessary
47
+ // but `| undefined` will cause `data` to be removed by PayloadCore.
48
+
46
49
  // Not using the PayloadCore because the `data: type | undefined` is necessary
47
50
  // but `| undefined` will cause `data` to be removed by PayloadCore
48
51
 
@@ -294,6 +294,16 @@ export type JiraCreateContextPayloadData = {
294
294
  fields: Record<string, unknown>;
295
295
  }[] | null;
296
296
  };
297
+ export type ArtifactContextPayloadData = {
298
+ artifactId: string;
299
+ mimeType: string;
300
+ title: string;
301
+ description: string;
302
+ url: string;
303
+ };
304
+ export type ArtifactContextPayload = PayloadCore<'artifact-context-payload'> & {
305
+ data: ArtifactContextPayloadData | undefined;
306
+ };
297
307
  export type EditorContextPayload = PayloadCore<'editor-context-payload'> & {
298
308
  data: EditorContextPayloadData;
299
309
  };
@@ -685,7 +695,7 @@ export type SmartlinksSubscriptionChangedPayload = PayloadCore<'smartlinks-subsc
685
695
  * is expected to be open at a time.
686
696
  */
687
697
  export type CloseInContextAifcModalPayload = PayloadCore<'close-in-context-aifc-modal'>;
688
- export type Payload = MessageSendPayload | ChatClosePayload | CloseInContextAifcModalPayload | SmartCreationModalOpenPayload | ChatNewPayload | InsightsOpenInChatPayload | InsightsChatExitedPayload | ChatDraftPayload | ChatSmartLink3PPostAuthLaunchPayload | EditorContextPayload | ChatOpenPayload | OpenBrowseAgentPayload | SmartlinksSubscriptionChangedPayload | OpenBrowseAgentSidebarPayload | OpenRovoRemixSidebarPayload | UpdateRovoRemixPresetPayload | SubmitRovoRemixPayload | RovoRemixHandoffFailedPayload | EditorSuggestionPayload | EditorAgentChangedPayload | BrowserContextPayload | WhiteboardContextPayload | JiraCreateContextPayload | JiraInlineAgentCreationAgentAssignedPayload | JiraWorkItemsCreatingPayload | JiraWorkItemsCreatedPayload | JiraWorkItemsCreateFailedPayload | DatabaseContextPayload | ForgeAppAuthSuccess | ForgeAppAuthFailure | JiraWorkflowWizardActionsPayload | InsertPromptPayload | DashboardInsightsActionsPayload | SetChatContextPayload | InsertUrlsPayload | InsertSkillPayload | SelectActionPayload | AddChartToDashboardPayload | GenericExternalActionErrorPayload | OpenChatDebugModalPayload | OpenChatFeedbackModalPayload | JsmJourneyBuilderActionsPayload | StudioAutomationBuildUpdatePayload | SolutionArchitectHandoffPayload | SolutionPlanStateUpdatePayload | SolutionDraftAgentUpdatePayload | SolutionArchitectAgentActivationPayload | SolutionArchitectAgentActivationFlowStartedPayload | SolutionArchitectAgentActivationFlowStoppedPayload | UpdateAgentConfigurationPayload | StudioLandingPageRedirectPayload | UploadAndInsertMediaPayload | SmartLinksContextPayload | SpaceSelectedPayload | SpaceDeselectedPayload | RecommendedSpacesSelectedPayload | RecommendedSpacesFirstTimeSelectedPayload | CustomSkillUpdatePayload | TaskPlanConfirmedPayload | TaskAskQuestionRenderedPayload | TaskPlanRenderedPayload | TaskSkipAllQuestionsPayload | TaskCancelPlanPayload | TaskAskQuestionConfirmedPayload | TaskModifyPlanRequestedPayload | TaskModifyPlanSubmittedPayload | ConfluenceContentFinalizedPayload;
698
+ export type Payload = MessageSendPayload | ChatClosePayload | CloseInContextAifcModalPayload | SmartCreationModalOpenPayload | ChatNewPayload | InsightsOpenInChatPayload | InsightsChatExitedPayload | ChatDraftPayload | ChatSmartLink3PPostAuthLaunchPayload | EditorContextPayload | ChatOpenPayload | OpenBrowseAgentPayload | SmartlinksSubscriptionChangedPayload | OpenBrowseAgentSidebarPayload | OpenRovoRemixSidebarPayload | UpdateRovoRemixPresetPayload | SubmitRovoRemixPayload | RovoRemixHandoffFailedPayload | EditorSuggestionPayload | EditorAgentChangedPayload | BrowserContextPayload | WhiteboardContextPayload | JiraCreateContextPayload | ArtifactContextPayload | JiraInlineAgentCreationAgentAssignedPayload | JiraWorkItemsCreatingPayload | JiraWorkItemsCreatedPayload | JiraWorkItemsCreateFailedPayload | DatabaseContextPayload | ForgeAppAuthSuccess | ForgeAppAuthFailure | JiraWorkflowWizardActionsPayload | InsertPromptPayload | DashboardInsightsActionsPayload | SetChatContextPayload | InsertUrlsPayload | InsertSkillPayload | SelectActionPayload | AddChartToDashboardPayload | GenericExternalActionErrorPayload | OpenChatDebugModalPayload | OpenChatFeedbackModalPayload | JsmJourneyBuilderActionsPayload | StudioAutomationBuildUpdatePayload | SolutionArchitectHandoffPayload | SolutionPlanStateUpdatePayload | SolutionDraftAgentUpdatePayload | SolutionArchitectAgentActivationPayload | SolutionArchitectAgentActivationFlowStartedPayload | SolutionArchitectAgentActivationFlowStoppedPayload | UpdateAgentConfigurationPayload | StudioLandingPageRedirectPayload | UploadAndInsertMediaPayload | SmartLinksContextPayload | SpaceSelectedPayload | SpaceDeselectedPayload | RecommendedSpacesSelectedPayload | RecommendedSpacesFirstTimeSelectedPayload | CustomSkillUpdatePayload | TaskPlanConfirmedPayload | TaskAskQuestionRenderedPayload | TaskPlanRenderedPayload | TaskSkipAllQuestionsPayload | TaskCancelPlanPayload | TaskAskQuestionConfirmedPayload | TaskModifyPlanRequestedPayload | TaskModifyPlanSubmittedPayload | ConfluenceContentFinalizedPayload;
689
699
  export type TaskPlanConfirmedPayload = PayloadCore<'task-plan-confirmed', {
690
700
  conversationId: string;
691
701
  planTitle: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-triggers",
3
- "version": "10.34.0",
3
+ "version": "10.36.0",
4
4
  "description": "Provides various trigger events to drive Rovo Chat functionality, such as a publish-subscribe and URL parameter hooks",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/primitives": "^22.5.0",
45
45
  "@atlaskit/ssr": "workspace:^",
46
46
  "@atlassian/a11y-jest-testing": "^0.17.0",
47
- "@atlassian/conversation-assistant-service-api": "^17.11.0",
47
+ "@atlassian/conversation-assistant-service-api": "^17.12.0",
48
48
  "@atlassian/feature-flags-test-utils": "^1.3.0",
49
49
  "@atlassian/testing-library": "^0.11.0",
50
50
  "@atlassian/workbench": "workspace:*",