@atlaskit/rovo-triggers 7.0.0 → 7.2.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,29 @@
1
1
  # @atlaskit/rovo-triggers
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ce0bb4cdbafcd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ce0bb4cdbafcd) -
8
+ Publishes an event `jira-inline-agent-creation-agent-assigned` when an agent is created and
9
+ assigned
10
+
11
+ ## 7.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`3813de687aea3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3813de687aea3) -
16
+ Fix Rovo nudge prompt not being inserted into chat on the first cold-start open of the chat.
17
+ Guarded by `rovo_chat_fix_cold_start_prompt_insertion`.
18
+
19
+ Stop `set-message-context` from overwriting the single-slot `triggerLatest` replay queue, which
20
+ could displace a queued action event (e.g. a nudge's `insert-prompt`) before a late subscriber
21
+ (PubSubListener) mounts on cold start.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 7.0.0
4
28
 
5
29
  ### Major Changes
package/dist/cjs/main.js CHANGED
@@ -8,6 +8,7 @@ exports.useSubscribeAll = exports.useSubscribe = exports.usePublish = exports.Su
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = require("react");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
14
  var ignoredTriggerLatestEvents = new Set(['editor-context-payload', 'agent-changed',
@@ -16,6 +17,12 @@ var ignoredTriggerLatestEvents = new Set(['editor-context-payload', 'agent-chang
16
17
  // instead of the real action event (e.g. open-browse-agent-modal) that
17
18
  // originally opened the chat.
18
19
  'smartlinks-subscription-changed', 'smartlinks-context-payload']);
20
+ var isIgnoredForTriggerLatest = function isIgnoredForTriggerLatest(type) {
21
+ if (ignoredTriggerLatestEvents.has(type)) {
22
+ return true;
23
+ }
24
+ return type === 'set-message-context' && (0, _platformFeatureFlags.fg)('rovo_chat_fix_cold_start_prompt_insertion');
25
+ };
19
26
  var createPubSub = function createPubSub() {
20
27
  var subscribedEvents = {};
21
28
  var publishQueue = {};
@@ -76,7 +83,7 @@ var createPubSub = function createPubSub() {
76
83
  * This ensures new subscribers can trigger their callback if `triggerLatest` is true, and the event hasn't already been triggered.
77
84
  */
78
85
  // This `ignoredTriggerLatestEvents` is a quick fix to prevent triggering the latest event for certain events
79
- if (!ignoredTriggerLatestEvents.has(payload.type)) {
86
+ if (!isIgnoredForTriggerLatest(payload.type)) {
80
87
  publishQueue[topic] = payload;
81
88
  }
82
89
 
package/dist/cjs/types.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Topics = void 0;
6
+ exports.Topics = exports.JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT = void 0;
7
7
  var Topics = exports.Topics = {
8
8
  AI_MATE: 'ai-mate',
9
9
  AI_MATE_ACTIONS: 'ai-mate-actions',
@@ -57,4 +57,6 @@ var Topics = exports.Topics = {
57
57
  // Not using PayloadCore because `data: type | undefined` is necessary
58
58
  // but `| undefined` will cause `data` to be removed by PayloadCore
59
59
 
60
- /** Published by the consumer hook to notify the publisher whether it should fetch SmartLinks. */
60
+ /** Published by the consumer hook to notify the publisher whether it should fetch SmartLinks. */
61
+
62
+ var JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT = exports.JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT = 'jira-inline-agent-creation-agent-assigned';
@@ -1,10 +1,17 @@
1
1
  import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  const ignoredTriggerLatestEvents = new Set(['editor-context-payload', 'agent-changed',
3
4
  // Internal signals that must never overwrite the publish queue — they would
4
5
  // cause `triggerLatest` subscribers (e.g. PubSubListener) to replay them
5
6
  // instead of the real action event (e.g. open-browse-agent-modal) that
6
7
  // originally opened the chat.
7
8
  'smartlinks-subscription-changed', 'smartlinks-context-payload']);
9
+ const isIgnoredForTriggerLatest = type => {
10
+ if (ignoredTriggerLatestEvents.has(type)) {
11
+ return true;
12
+ }
13
+ return type === 'set-message-context' && fg('rovo_chat_fix_cold_start_prompt_insertion');
14
+ };
8
15
  const createPubSub = () => {
9
16
  let subscribedEvents = {};
10
17
  let publishQueue = {};
@@ -69,7 +76,7 @@ const createPubSub = () => {
69
76
  * This ensures new subscribers can trigger their callback if `triggerLatest` is true, and the event hasn't already been triggered.
70
77
  */
71
78
  // This `ignoredTriggerLatestEvents` is a quick fix to prevent triggering the latest event for certain events
72
- if (!ignoredTriggerLatestEvents.has(payload.type)) {
79
+ if (!isIgnoredForTriggerLatest(payload.type)) {
73
80
  publishQueue[topic] = payload;
74
81
  }
75
82
 
@@ -51,4 +51,6 @@ export const Topics = {
51
51
  // Not using PayloadCore because `data: type | undefined` is necessary
52
52
  // but `| undefined` will cause `data` to be removed by PayloadCore
53
53
 
54
- /** Published by the consumer hook to notify the publisher whether it should fetch SmartLinks. */
54
+ /** Published by the consumer hook to notify the publisher whether it should fetch SmartLinks. */
55
+
56
+ export const JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT = 'jira-inline-agent-creation-agent-assigned';
package/dist/esm/main.js CHANGED
@@ -3,12 +3,19 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  var ignoredTriggerLatestEvents = new Set(['editor-context-payload', 'agent-changed',
7
8
  // Internal signals that must never overwrite the publish queue — they would
8
9
  // cause `triggerLatest` subscribers (e.g. PubSubListener) to replay them
9
10
  // instead of the real action event (e.g. open-browse-agent-modal) that
10
11
  // originally opened the chat.
11
12
  'smartlinks-subscription-changed', 'smartlinks-context-payload']);
13
+ var isIgnoredForTriggerLatest = function isIgnoredForTriggerLatest(type) {
14
+ if (ignoredTriggerLatestEvents.has(type)) {
15
+ return true;
16
+ }
17
+ return type === 'set-message-context' && fg('rovo_chat_fix_cold_start_prompt_insertion');
18
+ };
12
19
  var createPubSub = function createPubSub() {
13
20
  var subscribedEvents = {};
14
21
  var publishQueue = {};
@@ -69,7 +76,7 @@ var createPubSub = function createPubSub() {
69
76
  * This ensures new subscribers can trigger their callback if `triggerLatest` is true, and the event hasn't already been triggered.
70
77
  */
71
78
  // This `ignoredTriggerLatestEvents` is a quick fix to prevent triggering the latest event for certain events
72
- if (!ignoredTriggerLatestEvents.has(payload.type)) {
79
+ if (!isIgnoredForTriggerLatest(payload.type)) {
73
80
  publishQueue[topic] = payload;
74
81
  }
75
82
 
package/dist/esm/types.js CHANGED
@@ -51,4 +51,6 @@ export var Topics = {
51
51
  // Not using PayloadCore because `data: type | undefined` is necessary
52
52
  // but `| undefined` will cause `data` to be removed by PayloadCore
53
53
 
54
- /** Published by the consumer hook to notify the publisher whether it should fetch SmartLinks. */
54
+ /** Published by the consumer hook to notify the publisher whether it should fetch SmartLinks. */
55
+
56
+ export var JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT = 'jira-inline-agent-creation-agent-assigned';
@@ -451,7 +451,7 @@ export type SmartlinksSubscriptionChangedPayload = PayloadCore<'smartlinks-subsc
451
451
  openChat: false;
452
452
  isActive: boolean;
453
453
  };
454
- export type Payload = MessageSendPayload | ChatClosePayload | SmartCreationModalOpenPayload | ChatNewPayload | ChatDraftPayload | EditorContextPayload | ChatOpenPayload | OpenBrowseAgentPayload | SmartlinksSubscriptionChangedPayload | OpenBrowseAgentSidebarPayload | EditorSuggestionPayload | EditorAgentChangedPayload | BrowserContextPayload | WhiteboardContextPayload | JiraCreateContextPayload | DatabaseContextPayload | ForgeAppAuthSuccess | ForgeAppAuthFailure | JiraWorkflowWizardActionsPayload | InsertPromptPayload | DashboardInsightsActionsPayload | SetChatContextPayload | InsertUrlsPayload | SelectActionPayload | AddChartToDashboardPayload | GenericExternalActionErrorPayload | OpenChatDebugModalPayload | OpenChatFeedbackModalPayload | JsmJourneyBuilderActionsPayload | StudioAutomationBuildUpdatePayload | SolutionArchitectHandoffPayload | SolutionPlanStateUpdatePayload | SolutionDraftAgentUpdatePayload | SolutionArchitectAgentActivationPayload | SolutionArchitectAgentActivationFlowStartedPayload | SolutionArchitectAgentActivationFlowStoppedPayload | UpdateAgentConfigurationPayload | StudioLandingPageRedirectPayload | UploadAndInsertMediaPayload | SmartLinksContextPayload | SpaceSelectedPayload | SpaceDeselectedPayload | RecommendedSpacesSelectedPayload | TaskPlanConfirmedPayload | TaskAskQuestionRenderedPayload | TaskPlanRenderedPayload | TaskSkipAllQuestionsPayload | TaskCancelPlanPayload | TaskAskQuestionConfirmedPayload | TaskModifyPlanRequestedPayload | TaskModifyPlanSubmittedPayload;
454
+ export type Payload = MessageSendPayload | ChatClosePayload | SmartCreationModalOpenPayload | ChatNewPayload | ChatDraftPayload | EditorContextPayload | ChatOpenPayload | OpenBrowseAgentPayload | SmartlinksSubscriptionChangedPayload | OpenBrowseAgentSidebarPayload | EditorSuggestionPayload | EditorAgentChangedPayload | BrowserContextPayload | WhiteboardContextPayload | JiraCreateContextPayload | JiraInlineAgentCreationAgentAssignedPayload | DatabaseContextPayload | ForgeAppAuthSuccess | ForgeAppAuthFailure | JiraWorkflowWizardActionsPayload | InsertPromptPayload | DashboardInsightsActionsPayload | SetChatContextPayload | InsertUrlsPayload | SelectActionPayload | AddChartToDashboardPayload | GenericExternalActionErrorPayload | OpenChatDebugModalPayload | OpenChatFeedbackModalPayload | JsmJourneyBuilderActionsPayload | StudioAutomationBuildUpdatePayload | SolutionArchitectHandoffPayload | SolutionPlanStateUpdatePayload | SolutionDraftAgentUpdatePayload | SolutionArchitectAgentActivationPayload | SolutionArchitectAgentActivationFlowStartedPayload | SolutionArchitectAgentActivationFlowStoppedPayload | UpdateAgentConfigurationPayload | StudioLandingPageRedirectPayload | UploadAndInsertMediaPayload | SmartLinksContextPayload | SpaceSelectedPayload | SpaceDeselectedPayload | RecommendedSpacesSelectedPayload | TaskPlanConfirmedPayload | TaskAskQuestionRenderedPayload | TaskPlanRenderedPayload | TaskSkipAllQuestionsPayload | TaskCancelPlanPayload | TaskAskQuestionConfirmedPayload | TaskModifyPlanRequestedPayload | TaskModifyPlanSubmittedPayload;
455
455
  export type TaskPlanConfirmedPayload = PayloadCore<'task-plan-confirmed', {
456
456
  conversationId: string;
457
457
  planTitle: string;
@@ -485,6 +485,10 @@ export type TaskModifyPlanSubmittedPayload = PayloadCore<'task-modify-plan-submi
485
485
  invocationId: string;
486
486
  prompt: string;
487
487
  }>;
488
+ export declare const JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT: "jira-inline-agent-creation-agent-assigned";
489
+ export type JiraInlineAgentCreationAgentAssignedPayload = PayloadCore<typeof JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT, {
490
+ issueId: string;
491
+ }>;
488
492
  export type Callback = (payload: Payload) => void;
489
493
  export type TopicEvents = {
490
494
  [key in Topic]?: Array<{
@@ -451,7 +451,7 @@ export type SmartlinksSubscriptionChangedPayload = PayloadCore<'smartlinks-subsc
451
451
  openChat: false;
452
452
  isActive: boolean;
453
453
  };
454
- export type Payload = MessageSendPayload | ChatClosePayload | SmartCreationModalOpenPayload | ChatNewPayload | ChatDraftPayload | EditorContextPayload | ChatOpenPayload | OpenBrowseAgentPayload | SmartlinksSubscriptionChangedPayload | OpenBrowseAgentSidebarPayload | EditorSuggestionPayload | EditorAgentChangedPayload | BrowserContextPayload | WhiteboardContextPayload | JiraCreateContextPayload | DatabaseContextPayload | ForgeAppAuthSuccess | ForgeAppAuthFailure | JiraWorkflowWizardActionsPayload | InsertPromptPayload | DashboardInsightsActionsPayload | SetChatContextPayload | InsertUrlsPayload | SelectActionPayload | AddChartToDashboardPayload | GenericExternalActionErrorPayload | OpenChatDebugModalPayload | OpenChatFeedbackModalPayload | JsmJourneyBuilderActionsPayload | StudioAutomationBuildUpdatePayload | SolutionArchitectHandoffPayload | SolutionPlanStateUpdatePayload | SolutionDraftAgentUpdatePayload | SolutionArchitectAgentActivationPayload | SolutionArchitectAgentActivationFlowStartedPayload | SolutionArchitectAgentActivationFlowStoppedPayload | UpdateAgentConfigurationPayload | StudioLandingPageRedirectPayload | UploadAndInsertMediaPayload | SmartLinksContextPayload | SpaceSelectedPayload | SpaceDeselectedPayload | RecommendedSpacesSelectedPayload | TaskPlanConfirmedPayload | TaskAskQuestionRenderedPayload | TaskPlanRenderedPayload | TaskSkipAllQuestionsPayload | TaskCancelPlanPayload | TaskAskQuestionConfirmedPayload | TaskModifyPlanRequestedPayload | TaskModifyPlanSubmittedPayload;
454
+ export type Payload = MessageSendPayload | ChatClosePayload | SmartCreationModalOpenPayload | ChatNewPayload | ChatDraftPayload | EditorContextPayload | ChatOpenPayload | OpenBrowseAgentPayload | SmartlinksSubscriptionChangedPayload | OpenBrowseAgentSidebarPayload | EditorSuggestionPayload | EditorAgentChangedPayload | BrowserContextPayload | WhiteboardContextPayload | JiraCreateContextPayload | JiraInlineAgentCreationAgentAssignedPayload | DatabaseContextPayload | ForgeAppAuthSuccess | ForgeAppAuthFailure | JiraWorkflowWizardActionsPayload | InsertPromptPayload | DashboardInsightsActionsPayload | SetChatContextPayload | InsertUrlsPayload | SelectActionPayload | AddChartToDashboardPayload | GenericExternalActionErrorPayload | OpenChatDebugModalPayload | OpenChatFeedbackModalPayload | JsmJourneyBuilderActionsPayload | StudioAutomationBuildUpdatePayload | SolutionArchitectHandoffPayload | SolutionPlanStateUpdatePayload | SolutionDraftAgentUpdatePayload | SolutionArchitectAgentActivationPayload | SolutionArchitectAgentActivationFlowStartedPayload | SolutionArchitectAgentActivationFlowStoppedPayload | UpdateAgentConfigurationPayload | StudioLandingPageRedirectPayload | UploadAndInsertMediaPayload | SmartLinksContextPayload | SpaceSelectedPayload | SpaceDeselectedPayload | RecommendedSpacesSelectedPayload | TaskPlanConfirmedPayload | TaskAskQuestionRenderedPayload | TaskPlanRenderedPayload | TaskSkipAllQuestionsPayload | TaskCancelPlanPayload | TaskAskQuestionConfirmedPayload | TaskModifyPlanRequestedPayload | TaskModifyPlanSubmittedPayload;
455
455
  export type TaskPlanConfirmedPayload = PayloadCore<'task-plan-confirmed', {
456
456
  conversationId: string;
457
457
  planTitle: string;
@@ -485,6 +485,10 @@ export type TaskModifyPlanSubmittedPayload = PayloadCore<'task-modify-plan-submi
485
485
  invocationId: string;
486
486
  prompt: string;
487
487
  }>;
488
+ export declare const JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT: "jira-inline-agent-creation-agent-assigned";
489
+ export type JiraInlineAgentCreationAgentAssignedPayload = PayloadCore<typeof JIRA_INLINE_AGENT_CREATION_AGENT_ASSIGNED_EVENT, {
490
+ issueId: string;
491
+ }>;
488
492
  export type Callback = (payload: Payload) => void;
489
493
  export type TopicEvents = {
490
494
  [key in Topic]?: Array<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-triggers",
3
- "version": "7.0.0",
3
+ "version": "7.2.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": {
@@ -92,5 +92,10 @@
92
92
  "import-no-extraneous-disable-for-examples-and-docs"
93
93
  ]
94
94
  }
95
+ },
96
+ "platform-feature-flags": {
97
+ "rovo_chat_fix_cold_start_prompt_insertion": {
98
+ "type": "boolean"
99
+ }
95
100
  }
96
101
  }