@atlaskit/rovo-triggers 7.0.0 → 7.1.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 +16 -0
- package/dist/cjs/main.js +8 -1
- package/dist/es2019/main.js +8 -1
- package/dist/esm/main.js +8 -1
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/rovo-triggers
|
|
2
2
|
|
|
3
|
+
## 7.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`3813de687aea3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3813de687aea3) -
|
|
8
|
+
Fix Rovo nudge prompt not being inserted into chat on the first cold-start open of the chat.
|
|
9
|
+
Guarded by `rovo_chat_fix_cold_start_prompt_insertion`.
|
|
10
|
+
|
|
11
|
+
Stop `set-message-context` from overwriting the single-slot `triggerLatest` replay queue, which
|
|
12
|
+
could displace a queued action event (e.g. a nudge's `insert-prompt`) before a late subscriber
|
|
13
|
+
(PubSubListener) mounts on cold start.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 7.0.0
|
|
4
20
|
|
|
5
21
|
### 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 (!
|
|
86
|
+
if (!isIgnoredForTriggerLatest(payload.type)) {
|
|
80
87
|
publishQueue[topic] = payload;
|
|
81
88
|
}
|
|
82
89
|
|
package/dist/es2019/main.js
CHANGED
|
@@ -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 (!
|
|
79
|
+
if (!isIgnoredForTriggerLatest(payload.type)) {
|
|
73
80
|
publishQueue[topic] = payload;
|
|
74
81
|
}
|
|
75
82
|
|
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 (!
|
|
79
|
+
if (!isIgnoredForTriggerLatest(payload.type)) {
|
|
73
80
|
publishQueue[topic] = payload;
|
|
74
81
|
}
|
|
75
82
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/rovo-triggers",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.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
|
}
|