@atlaskit/jql-editor 6.1.2 → 6.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/analytics/util.js +1 -1
  3. package/dist/cjs/plugins/autocomplete/view.js +17 -1
  4. package/dist/cjs/plugins/rich-inline-nodes/nodes/base/index.js +3 -2
  5. package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/goal-icon.js +46 -0
  6. package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/goal-node.compiled.css +3 -0
  7. package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/goal-node.js +56 -0
  8. package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/index.js +15 -0
  9. package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/types.js +1 -0
  10. package/dist/cjs/plugins/rich-inline-nodes/nodes/index.js +3 -1
  11. package/dist/cjs/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +9 -1
  12. package/dist/cjs/state/index.js +40 -31
  13. package/dist/es2019/analytics/util.js +1 -1
  14. package/dist/es2019/plugins/autocomplete/view.js +17 -1
  15. package/dist/es2019/plugins/rich-inline-nodes/nodes/base/index.js +3 -2
  16. package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/goal-icon.js +35 -0
  17. package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/goal-node.compiled.css +3 -0
  18. package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/goal-node.js +46 -0
  19. package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/index.js +9 -0
  20. package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/types.js +0 -0
  21. package/dist/es2019/plugins/rich-inline-nodes/nodes/index.js +3 -1
  22. package/dist/es2019/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +10 -1
  23. package/dist/es2019/state/index.js +12 -2
  24. package/dist/esm/analytics/util.js +1 -1
  25. package/dist/esm/plugins/autocomplete/view.js +17 -1
  26. package/dist/esm/plugins/rich-inline-nodes/nodes/base/index.js +3 -2
  27. package/dist/esm/plugins/rich-inline-nodes/nodes/goal/goal-icon.js +39 -0
  28. package/dist/esm/plugins/rich-inline-nodes/nodes/goal/goal-node.compiled.css +3 -0
  29. package/dist/esm/plugins/rich-inline-nodes/nodes/goal/goal-node.js +49 -0
  30. package/dist/esm/plugins/rich-inline-nodes/nodes/goal/index.js +9 -0
  31. package/dist/esm/plugins/rich-inline-nodes/nodes/goal/types.js +0 -0
  32. package/dist/esm/plugins/rich-inline-nodes/nodes/index.js +3 -1
  33. package/dist/esm/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +9 -1
  34. package/dist/esm/state/index.js +39 -30
  35. package/dist/types/plugins/rich-inline-nodes/nodes/base/types.d.ts +1 -0
  36. package/dist/types/plugins/rich-inline-nodes/nodes/goal/goal-icon.d.ts +12 -0
  37. package/dist/types/plugins/rich-inline-nodes/nodes/goal/goal-node.d.ts +10 -0
  38. package/dist/types/plugins/rich-inline-nodes/nodes/goal/index.d.ts +3 -0
  39. package/dist/types/plugins/rich-inline-nodes/nodes/goal/types.d.ts +5 -0
  40. package/dist/types/plugins/rich-inline-nodes/nodes/index.d.ts +1 -0
  41. package/dist/types/state/index.d.ts +36 -1
  42. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/base/types.d.ts +1 -0
  43. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/goal-icon.d.ts +16 -0
  44. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/goal-node.d.ts +10 -0
  45. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/index.d.ts +3 -0
  46. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/types.d.ts +5 -0
  47. package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/index.d.ts +1 -0
  48. package/dist/types-ts4.5/state/index.d.ts +36 -1
  49. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/jql-editor
2
2
 
3
+ ## 6.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2f2e1ff7d48a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f2e1ff7d48a0) -
8
+ [ux] Add goal lozenge and use it on JQL editor
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 6.1.2
4
15
 
5
16
  ### Patch Changes
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useJqlEditorAnalytics = void 0;
7
7
  var _jqlEditorCommon = require("@atlaskit/jql-editor-common");
8
8
  var useJqlEditorAnalytics = exports.useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
9
- return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "0.0.0-development", _jqlEditorCommon.ANALYTICS_CHANNEL);
9
+ return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "6.1.2", _jqlEditorCommon.ANALYTICS_CHANNEL);
10
10
  };
@@ -14,6 +14,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _model = require("@atlaskit/editor-prosemirror/model");
16
16
  var _state = require("@atlaskit/editor-prosemirror/state");
17
+ var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
17
18
  var _jqlAst = require("@atlaskit/jql-ast");
18
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
20
  var _getDocumentPosition = _interopRequireDefault(require("../common/get-document-position"));
@@ -62,7 +63,7 @@ var AutocompletePluginView = exports.default = /*#__PURE__*/function (_ReactPlug
62
63
  if (_this.enableRichInlineNodes && option.type === 'value' && option.valueType === 'user') {
63
64
  transaction.setMeta('hydrate', true);
64
65
  }
65
- if (_this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2'))) {
66
+ if (_this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'goal' && _featureGateJsClient.default.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || option.valueType === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2'))) {
66
67
  transaction.setMeta('hydrate', true);
67
68
  }
68
69
  var documentFrom = (0, _getDocumentPosition.default)(transaction.doc, from);
@@ -128,6 +129,21 @@ var AutocompletePluginView = exports.default = /*#__PURE__*/function (_ReactPlug
128
129
  }
129
130
  break;
130
131
  }
132
+ case 'goal':
133
+ {
134
+ if (_featureGateJsClient.default.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false)) {
135
+ var _attributes3 = {
136
+ type: 'goal',
137
+ id: value,
138
+ name: nameOnRichInlineNode !== null && nameOnRichInlineNode !== void 0 ? nameOnRichInlineNode : name,
139
+ fieldName: context === null || context === void 0 ? void 0 : context.field
140
+ };
141
+ nodes.push(_this.view.state.schema.nodes.goal.create(_attributes3, textContent));
142
+ } else {
143
+ nodes.push(textContent);
144
+ }
145
+ break;
146
+ }
131
147
  default:
132
148
  {
133
149
  nodes.push(textContent);
@@ -43,8 +43,9 @@ var NodeBase = exports.NodeBase = function NodeBase(props) {
43
43
  text = props.text,
44
44
  isLocked = props.isLocked,
45
45
  selected = props.selected,
46
- error = props.error;
47
- var isNewExperienceEnabled = _featureGateJsClient.default.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false);
46
+ error = props.error,
47
+ isRichNodeDisplay = props.isRichNodeDisplay;
48
+ var isNewExperienceEnabled = _featureGateJsClient.default.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false) || isRichNodeDisplay;
48
49
  return /*#__PURE__*/_react.default.createElement(_compiled.Pressable, (0, _extends2.default)({
49
50
  xcss: (0, _css.cx)(styles.nodeWrapper, !isNewExperienceEnabled && styles.nodeWrapperWithHeight, error && styles.nodeWrapperError, selected && (error ? styles.nodeWrapperErrorSelected : styles.nodeWrapperSelected))
50
51
  }, isNewExperienceEnabled ? {
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.isGoalIconKey = exports.GoalIcon = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _icon = require("@atlaskit/icon");
10
+ var _keyResult = _interopRequireDefault(require("@atlaskit/icon/core/key-result"));
11
+ var _objective = _interopRequireDefault(require("@atlaskit/icon/core/objective"));
12
+ var goalAppearances = ['DEFAULT', 'ON_TRACK', 'AT_RISK', 'OFF_TRACK', 'MENU'];
13
+ var GOAL_ICON_KEYS = ['GOAL', 'OBJECTIVE', 'KEY_RESULT'];
14
+ var isGoalAppearance = function isGoalAppearance(value) {
15
+ return goalAppearances.includes(value.toLocaleUpperCase());
16
+ };
17
+ var isGoalIconKey = exports.isGoalIconKey = function isGoalIconKey(value) {
18
+ return GOAL_ICON_KEYS.includes(value);
19
+ };
20
+ var appearanceToColorMap = {
21
+ DEFAULT: 'gray',
22
+ MENU: 'gray',
23
+ OFF_TRACK: 'red',
24
+ AT_RISK: 'yellow',
25
+ ON_TRACK: 'green'
26
+ };
27
+ var keyToIconMap = {
28
+ GOAL: _objective.default,
29
+ OBJECTIVE: _objective.default,
30
+ KEY_RESULT: _keyResult.default
31
+ };
32
+ var GoalIcon = exports.GoalIcon = function GoalIcon(_ref) {
33
+ var _keyToIconMap;
34
+ var status = _ref.status,
35
+ size = _ref.size,
36
+ _ref$iconKey = _ref.iconKey,
37
+ iconKey = _ref$iconKey === void 0 ? 'GOAL' : _ref$iconKey;
38
+ var Icon = (_keyToIconMap = keyToIconMap[iconKey]) !== null && _keyToIconMap !== void 0 ? _keyToIconMap : keyToIconMap.GOAL;
39
+ var appearance = isGoalAppearance(status) ? status : 'DEFAULT';
40
+ return /*#__PURE__*/_react.default.createElement(_icon.IconTile, {
41
+ size: size,
42
+ icon: Icon,
43
+ label: "",
44
+ appearance: appearanceToColorMap[appearance]
45
+ });
46
+ };
@@ -0,0 +1,3 @@
1
+ ._1e0c1txw{display:flex}
2
+ ._4t3i7vkz{height:1pc}
3
+ ._kqswh2mm{position:relative}
@@ -0,0 +1,56 @@
1
+ /* goal-node.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.GoalNode = void 0;
9
+ require("./goal-node.compiled.css");
10
+ var _runtime = require("@compiled/react/runtime");
11
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
14
+ var _react = _interopRequireDefault(require("react"));
15
+ var _compiled = require("@atlaskit/primitives/compiled");
16
+ var _state = require("../../../../state");
17
+ var _base = require("../base");
18
+ var _goalIcon = require("./goal-icon");
19
+ var _excluded = ["id", "fieldName", "name"];
20
+ var styles = {
21
+ iconWrapper: "_1e0c1txw _4t3i7vkz _kqswh2mm"
22
+ };
23
+ function toGoalIconKey(iconKey) {
24
+ return iconKey && (0, _goalIcon.isGoalIconKey)(iconKey) ? iconKey : 'GOAL';
25
+ }
26
+
27
+ /**
28
+ * GoalNode Component
29
+ *
30
+ * This component is a component for rendering a pill-like view for Goal node type
31
+ * in the JQL editor
32
+ */
33
+ var GoalNode = exports.GoalNode = function GoalNode(props) {
34
+ var _goal$status;
35
+ var id = props.id,
36
+ fieldName = props.fieldName,
37
+ name = props.name,
38
+ rest = (0, _objectWithoutProperties2.default)(props, _excluded);
39
+ var _useHydratedGoal = (0, _state.useHydratedGoal)({
40
+ id: id,
41
+ fieldName: fieldName
42
+ }),
43
+ _useHydratedGoal2 = (0, _slicedToArray2.default)(_useHydratedGoal, 1),
44
+ goal = _useHydratedGoal2[0];
45
+ return /*#__PURE__*/_react.default.createElement(_base.NodeBase, (0, _extends2.default)({
46
+ iconBefore: /*#__PURE__*/_react.default.createElement(_compiled.Box, {
47
+ xcss: styles.iconWrapper
48
+ }, /*#__PURE__*/_react.default.createElement(_goalIcon.GoalIcon, {
49
+ size: "16",
50
+ status: (_goal$status = goal === null || goal === void 0 ? void 0 : goal.status) !== null && _goal$status !== void 0 ? _goal$status : "DEFAULT",
51
+ iconKey: toGoalIconKey("GOAL")
52
+ })),
53
+ text: name,
54
+ isRichNodeDisplay: true
55
+ }, rest));
56
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.goal = void 0;
7
+ var _goalNode = require("./goal-node");
8
+ var goal = exports.goal = {
9
+ component: _goalNode.GoalNode,
10
+ attrs: {
11
+ id: {},
12
+ name: {},
13
+ fieldName: {}
14
+ }
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.richInlineNodes = void 0;
7
+ var _goal = require("./goal");
7
8
  var _project = require("./project");
8
9
  var _team = require("./team");
9
10
  var _user = require("./user");
10
11
  var richInlineNodes = exports.richInlineNodes = {
11
12
  user: _user.user,
12
13
  team: _team.team,
13
- project: _project.project
14
+ project: _project.project,
15
+ goal: _goal.goal
14
16
  };
@@ -13,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
13
13
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
16
+ var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
16
17
  var _jqlAst = require("@atlaskit/jql-ast");
17
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _schema = require("../../../schema");
@@ -33,7 +34,7 @@ var replaceRichInlineNodes = exports.replaceRichInlineNodes = function replaceRi
33
34
  fieldName = _ref2[0],
34
35
  values = _ref2[1];
35
36
  values.forEach(function (value) {
36
- if (value.type === 'user' || value.type === 'team' || value.type === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2')) {
37
+ if (value.type === 'user' || value.type === 'team' || value.type === 'goal' && _featureGateJsClient.default.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || value.type === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2')) {
37
38
  // First try to find as direct value operand (e.g., Team[Team] = uuid)
38
39
  var astNodes = getValueNodes(ast, fieldName, value.id);
39
40
 
@@ -82,6 +83,13 @@ var getRichInlineNode = function getRichInlineNode(fieldName, value, text) {
82
83
  fieldName: fieldName
83
84
  }), _textContent2);
84
85
  }
86
+ case 'goal':
87
+ {
88
+ var _textContent3 = _schema.JQLEditorSchema.text(text);
89
+ return _schema.JQLEditorSchema.nodes.goal.create(_objectSpread(_objectSpread({}, value), {}, {
90
+ fieldName: fieldName
91
+ }), _textContent3);
92
+ }
85
93
  default:
86
94
  {
87
95
  throw new Error("Unsupported hydrated value type ".concat(value.type));
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useStoreActions = exports.useScopedId = exports.useRichInlineNodesEnabled = exports.useOnSyntaxHelp = exports.useLineNumbersVisible = exports.useJqlError = exports.useIsSearching = exports.useIntl = exports.useIdPrefix = exports.useHydratedValue = exports.useHydratedUser = exports.useHydratedTeam = exports.useHydratedProject = exports.useHydratedDeprecations = exports.useExternalMessages = exports.useEditorViewHasFocus = exports.useEditorView = exports.useEditorStateHasJqlError = exports.useEditorState = exports.useCustomErrorComponent = exports.useAutocompleteProvider = exports.useAutocompletePosition = exports.useAutocompleteOptions = exports.useAutocompleteLoading = exports.useAutocompleteIsOpen = exports.useAutocomplete = exports.initialState = exports.actions = exports.EditorStateContainer = void 0;
7
+ exports.useStoreActions = exports.useScopedId = exports.useRichInlineNodesEnabled = exports.useOnSyntaxHelp = exports.useLineNumbersVisible = exports.useJqlError = exports.useIsSearching = exports.useIntl = exports.useIdPrefix = exports.useHydratedValue = exports.useHydratedUser = exports.useHydratedTeam = exports.useHydratedProject = exports.useHydratedGoal = exports.useHydratedDeprecations = exports.useExternalMessages = exports.useEditorViewHasFocus = exports.useEditorView = exports.useEditorStateHasJqlError = exports.useEditorState = exports.useCustomErrorComponent = exports.useAutocompleteProvider = exports.useAutocompletePosition = exports.useAutocompleteOptions = exports.useAutocompleteLoading = exports.useAutocompleteIsOpen = exports.useAutocomplete = exports.initialState = exports.actions = exports.EditorStateContainer = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -938,16 +938,25 @@ var useHydratedProject = exports.useHydratedProject = (0, _reactSweetState.creat
938
938
  return project && project.type === 'project' ? project : undefined;
939
939
  }
940
940
  });
941
+ var useHydratedGoal = exports.useHydratedGoal = (0, _reactSweetState.createHook)(Store, {
942
+ selector: function selector(state, _ref42) {
943
+ var _state$hydratedValues9;
944
+ var id = _ref42.id,
945
+ fieldName = _ref42.fieldName;
946
+ var goal = (_state$hydratedValues9 = state.hydratedValues[(0, _util.normaliseHydrationKey)(fieldName)]) === null || _state$hydratedValues9 === void 0 ? void 0 : _state$hydratedValues9.get((0, _jqlAst.normaliseJqlString)(id));
947
+ return goal && goal.type === 'goal' ? goal : undefined;
948
+ }
949
+ });
941
950
  var useHydratedDeprecations = exports.useHydratedDeprecations = (0, _reactSweetState.createHook)(Store, {
942
951
  selector: function selector(state) {
943
952
  var ast = (0, _jqlAst2.getJastFromState)(state.editorState);
944
953
  var fieldsInQuery = (0, _util2.getFieldNodes)(ast);
945
954
  var toReturn = [];
946
- Object.entries(state.hydratedValues).forEach(function (_ref42) {
947
- var _state$hydratedValues9;
948
- var _ref43 = (0, _slicedToArray2.default)(_ref42, 1),
949
- fieldName = _ref43[0];
950
- (_state$hydratedValues9 = state.hydratedValues[fieldName]) === null || _state$hydratedValues9 === void 0 || _state$hydratedValues9.forEach(function (value) {
955
+ Object.entries(state.hydratedValues).forEach(function (_ref43) {
956
+ var _state$hydratedValues0;
957
+ var _ref44 = (0, _slicedToArray2.default)(_ref43, 1),
958
+ fieldName = _ref44[0];
959
+ (_state$hydratedValues0 = state.hydratedValues[fieldName]) === null || _state$hydratedValues0 === void 0 || _state$hydratedValues0.forEach(function (value) {
951
960
  if (value.type === 'deprecated-field') {
952
961
  if (fieldsInQuery.has(value.id.toLowerCase())) {
953
962
  toReturn.push(value);
@@ -970,19 +979,19 @@ var useOnSyntaxHelp = exports.useOnSyntaxHelp = (0, _reactSweetState.createHook)
970
979
  });
971
980
  var EditorStateContainer = exports.EditorStateContainer = (0, _reactSweetState.createContainer)(Store, {
972
981
  onInit: function onInit() {
973
- return function (_ref44, _ref45) {
974
- var getState = _ref44.getState,
975
- setState = _ref44.setState,
976
- dispatch = _ref44.dispatch;
977
- var intlRef = _ref45.intlRef,
978
- query = _ref45.query,
979
- isSearching = _ref45.isSearching,
980
- autocompleteProvider = _ref45.autocompleteProvider,
981
- externalMessages = _ref45.externalMessages,
982
- enableRichInlineNodes = _ref45.enableRichInlineNodes,
983
- onDebugUnsafeMessage = _ref45.onDebugUnsafeMessage,
984
- onSyntaxHelp = _ref45.onSyntaxHelp,
985
- customComponents = _ref45.customComponents;
982
+ return function (_ref45, _ref46) {
983
+ var getState = _ref45.getState,
984
+ setState = _ref45.setState,
985
+ dispatch = _ref45.dispatch;
986
+ var intlRef = _ref46.intlRef,
987
+ query = _ref46.query,
988
+ isSearching = _ref46.isSearching,
989
+ autocompleteProvider = _ref46.autocompleteProvider,
990
+ externalMessages = _ref46.externalMessages,
991
+ enableRichInlineNodes = _ref46.enableRichInlineNodes,
992
+ onDebugUnsafeMessage = _ref46.onDebugUnsafeMessage,
993
+ onSyntaxHelp = _ref46.onSyntaxHelp,
994
+ customComponents = _ref46.customComponents;
986
995
  setState({
987
996
  controlledQuery: query,
988
997
  query: query,
@@ -1011,18 +1020,18 @@ var EditorStateContainer = exports.EditorStateContainer = (0, _reactSweetState.c
1011
1020
  };
1012
1021
  },
1013
1022
  onUpdate: function onUpdate() {
1014
- return function (_ref46, _ref47) {
1015
- var getState = _ref46.getState,
1016
- setState = _ref46.setState,
1017
- dispatch = _ref46.dispatch;
1018
- var controlledQueryProp = _ref47.query,
1019
- isSearching = _ref47.isSearching,
1020
- autocompleteProvider = _ref47.autocompleteProvider,
1021
- externalMessages = _ref47.externalMessages,
1022
- enableRichInlineNodes = _ref47.enableRichInlineNodes,
1023
- onDebugUnsafeMessage = _ref47.onDebugUnsafeMessage,
1024
- onSyntaxHelp = _ref47.onSyntaxHelp,
1025
- customComponents = _ref47.customComponents;
1023
+ return function (_ref47, _ref48) {
1024
+ var getState = _ref47.getState,
1025
+ setState = _ref47.setState,
1026
+ dispatch = _ref47.dispatch;
1027
+ var controlledQueryProp = _ref48.query,
1028
+ isSearching = _ref48.isSearching,
1029
+ autocompleteProvider = _ref48.autocompleteProvider,
1030
+ externalMessages = _ref48.externalMessages,
1031
+ enableRichInlineNodes = _ref48.enableRichInlineNodes,
1032
+ onDebugUnsafeMessage = _ref48.onDebugUnsafeMessage,
1033
+ onSyntaxHelp = _ref48.onSyntaxHelp,
1034
+ customComponents = _ref48.customComponents;
1026
1035
  var _getState12 = getState(),
1027
1036
  controlledQuery = _getState12.controlledQuery,
1028
1037
  query = _getState12.query;
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export const useJqlEditorAnalytics = analyticsSource => {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "0.0.0-development", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.1.2", ANALYTICS_CHANNEL);
4
4
  };
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
4
5
  import { isListOperator } from '@atlaskit/jql-ast';
5
6
  import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import getDocumentPosition from '../common/get-document-position';
@@ -45,7 +46,7 @@ export default class AutocompletePluginView extends ReactPluginView {
45
46
  if (this.enableRichInlineNodes && option.type === 'value' && option.valueType === 'user') {
46
47
  transaction.setMeta('hydrate', true);
47
48
  }
48
- if (this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'project' && fg('projects_in_jira_eap_drop2'))) {
49
+ if (this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'goal' && FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || option.valueType === 'project' && fg('projects_in_jira_eap_drop2'))) {
49
50
  transaction.setMeta('hydrate', true);
50
51
  }
51
52
  const documentFrom = getDocumentPosition(transaction.doc, from);
@@ -113,6 +114,21 @@ export default class AutocompletePluginView extends ReactPluginView {
113
114
  }
114
115
  break;
115
116
  }
117
+ case 'goal':
118
+ {
119
+ if (FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false)) {
120
+ const attributes = {
121
+ type: 'goal',
122
+ id: value,
123
+ name: nameOnRichInlineNode !== null && nameOnRichInlineNode !== void 0 ? nameOnRichInlineNode : name,
124
+ fieldName: context === null || context === void 0 ? void 0 : context.field
125
+ };
126
+ nodes.push(this.view.state.schema.nodes.goal.create(attributes, textContent));
127
+ } else {
128
+ nodes.push(textContent);
129
+ }
130
+ break;
131
+ }
116
132
  default:
117
133
  {
118
134
  nodes.push(textContent);
@@ -37,9 +37,10 @@ export const NodeBase = props => {
37
37
  text,
38
38
  isLocked,
39
39
  selected,
40
- error
40
+ error,
41
+ isRichNodeDisplay
41
42
  } = props;
42
- const isNewExperienceEnabled = FeatureGates.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false);
43
+ const isNewExperienceEnabled = FeatureGates.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false) || isRichNodeDisplay;
43
44
  return /*#__PURE__*/React.createElement(Pressable, _extends({
44
45
  xcss: cx(styles.nodeWrapper, !isNewExperienceEnabled && styles.nodeWrapperWithHeight, error && styles.nodeWrapperError, selected && (error ? styles.nodeWrapperErrorSelected : styles.nodeWrapperSelected))
45
46
  }, isNewExperienceEnabled ? {
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { IconTile } from '@atlaskit/icon';
3
+ import KeyResultIcon from '@atlaskit/icon/core/key-result';
4
+ import ObjectiveIcon from '@atlaskit/icon/core/objective';
5
+ const goalAppearances = ['DEFAULT', 'ON_TRACK', 'AT_RISK', 'OFF_TRACK', 'MENU'];
6
+ const GOAL_ICON_KEYS = ['GOAL', 'OBJECTIVE', 'KEY_RESULT'];
7
+ const isGoalAppearance = value => goalAppearances.includes(value.toLocaleUpperCase());
8
+ export const isGoalIconKey = value => GOAL_ICON_KEYS.includes(value);
9
+ const appearanceToColorMap = {
10
+ DEFAULT: 'gray',
11
+ MENU: 'gray',
12
+ OFF_TRACK: 'red',
13
+ AT_RISK: 'yellow',
14
+ ON_TRACK: 'green'
15
+ };
16
+ const keyToIconMap = {
17
+ GOAL: ObjectiveIcon,
18
+ OBJECTIVE: ObjectiveIcon,
19
+ KEY_RESULT: KeyResultIcon
20
+ };
21
+ export const GoalIcon = ({
22
+ status,
23
+ size,
24
+ iconKey = 'GOAL'
25
+ }) => {
26
+ var _keyToIconMap;
27
+ const Icon = (_keyToIconMap = keyToIconMap[iconKey]) !== null && _keyToIconMap !== void 0 ? _keyToIconMap : keyToIconMap.GOAL;
28
+ const appearance = isGoalAppearance(status) ? status : 'DEFAULT';
29
+ return /*#__PURE__*/React.createElement(IconTile, {
30
+ size: size,
31
+ icon: Icon,
32
+ label: "",
33
+ appearance: appearanceToColorMap[appearance]
34
+ });
35
+ };
@@ -0,0 +1,3 @@
1
+ ._1e0c1txw{display:flex}
2
+ ._4t3i7vkz{height:1pc}
3
+ ._kqswh2mm{position:relative}
@@ -0,0 +1,46 @@
1
+ /* goal-node.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import "./goal-node.compiled.css";
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import React from 'react';
6
+ import { Box } from '@atlaskit/primitives/compiled';
7
+ import { useHydratedGoal } from '../../../../state';
8
+ import { NodeBase } from '../base';
9
+ import { GoalIcon, isGoalIconKey } from './goal-icon';
10
+ const styles = {
11
+ iconWrapper: "_1e0c1txw _4t3i7vkz _kqswh2mm"
12
+ };
13
+ function toGoalIconKey(iconKey) {
14
+ return iconKey && isGoalIconKey(iconKey) ? iconKey : 'GOAL';
15
+ }
16
+
17
+ /**
18
+ * GoalNode Component
19
+ *
20
+ * This component is a component for rendering a pill-like view for Goal node type
21
+ * in the JQL editor
22
+ */
23
+ export const GoalNode = props => {
24
+ var _goal$status;
25
+ const {
26
+ id,
27
+ fieldName,
28
+ name,
29
+ ...rest
30
+ } = props;
31
+ const [goal] = useHydratedGoal({
32
+ id,
33
+ fieldName
34
+ });
35
+ return /*#__PURE__*/React.createElement(NodeBase, _extends({
36
+ iconBefore: /*#__PURE__*/React.createElement(Box, {
37
+ xcss: styles.iconWrapper
38
+ }, /*#__PURE__*/React.createElement(GoalIcon, {
39
+ size: "16",
40
+ status: (_goal$status = goal === null || goal === void 0 ? void 0 : goal.status) !== null && _goal$status !== void 0 ? _goal$status : "DEFAULT",
41
+ iconKey: toGoalIconKey("GOAL")
42
+ })),
43
+ text: name,
44
+ isRichNodeDisplay: true
45
+ }, rest));
46
+ };
@@ -0,0 +1,9 @@
1
+ import { GoalNode } from './goal-node';
2
+ export const goal = {
3
+ component: GoalNode,
4
+ attrs: {
5
+ id: {},
6
+ name: {},
7
+ fieldName: {}
8
+ }
9
+ };
@@ -1,8 +1,10 @@
1
+ import { goal } from './goal';
1
2
  import { project } from './project';
2
3
  import { team } from './team';
3
4
  import { user } from './user';
4
5
  export const richInlineNodes = {
5
6
  user,
6
7
  team,
7
- project
8
+ project,
9
+ goal
8
10
  };
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
2
3
  import { AbstractJastVisitor } from '@atlaskit/jql-ast';
3
4
  import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { JQLEditorSchema } from '../../../schema';
@@ -12,7 +13,7 @@ export const replaceRichInlineNodes = (editorState, hydratedValues) => {
12
13
  transaction.setMeta('addToHistory', false);
13
14
  Object.entries(hydratedValues).forEach(([fieldName, values]) => {
14
15
  values.forEach(value => {
15
- if (value.type === 'user' || value.type === 'team' || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
16
+ if (value.type === 'user' || value.type === 'team' || value.type === 'goal' && FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
16
17
  // First try to find as direct value operand (e.g., Team[Team] = uuid)
17
18
  let astNodes = getValueNodes(ast, fieldName, value.id);
18
19
 
@@ -62,6 +63,14 @@ const getRichInlineNode = (fieldName, value, text) => {
62
63
  fieldName
63
64
  }, textContent);
64
65
  }
66
+ case 'goal':
67
+ {
68
+ const textContent = JQLEditorSchema.text(text);
69
+ return JQLEditorSchema.nodes.goal.create({
70
+ ...value,
71
+ fieldName
72
+ }, textContent);
73
+ }
65
74
  default:
66
75
  {
67
76
  throw new Error(`Unsupported hydrated value type ${value.type}`);
@@ -914,14 +914,24 @@ export const useHydratedProject = createHook(Store, {
914
914
  return project && project.type === 'project' ? project : undefined;
915
915
  }
916
916
  });
917
+ export const useHydratedGoal = createHook(Store, {
918
+ selector: (state, {
919
+ id,
920
+ fieldName
921
+ }) => {
922
+ var _state$hydratedValues9;
923
+ const goal = (_state$hydratedValues9 = state.hydratedValues[normaliseHydrationKey(fieldName)]) === null || _state$hydratedValues9 === void 0 ? void 0 : _state$hydratedValues9.get(normaliseJqlString(id));
924
+ return goal && goal.type === 'goal' ? goal : undefined;
925
+ }
926
+ });
917
927
  export const useHydratedDeprecations = createHook(Store, {
918
928
  selector: state => {
919
929
  const ast = getJastFromState(state.editorState);
920
930
  const fieldsInQuery = getFieldNodes(ast);
921
931
  const toReturn = [];
922
932
  Object.entries(state.hydratedValues).forEach(([fieldName]) => {
923
- var _state$hydratedValues9;
924
- (_state$hydratedValues9 = state.hydratedValues[fieldName]) === null || _state$hydratedValues9 === void 0 ? void 0 : _state$hydratedValues9.forEach(value => {
933
+ var _state$hydratedValues0;
934
+ (_state$hydratedValues0 = state.hydratedValues[fieldName]) === null || _state$hydratedValues0 === void 0 ? void 0 : _state$hydratedValues0.forEach(value => {
925
935
  if (value.type === 'deprecated-field') {
926
936
  if (fieldsInQuery.has(value.id.toLowerCase())) {
927
937
  toReturn.push(value);
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export var useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "0.0.0-development", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.1.2", ANALYTICS_CHANNEL);
4
4
  };
@@ -9,6 +9,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
11
11
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
12
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
12
13
  import { isListOperator } from '@atlaskit/jql-ast';
13
14
  import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import getDocumentPosition from '../common/get-document-position';
@@ -56,7 +57,7 @@ var AutocompletePluginView = /*#__PURE__*/function (_ReactPluginView) {
56
57
  if (_this.enableRichInlineNodes && option.type === 'value' && option.valueType === 'user') {
57
58
  transaction.setMeta('hydrate', true);
58
59
  }
59
- if (_this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'project' && fg('projects_in_jira_eap_drop2'))) {
60
+ if (_this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'goal' && FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || option.valueType === 'project' && fg('projects_in_jira_eap_drop2'))) {
60
61
  transaction.setMeta('hydrate', true);
61
62
  }
62
63
  var documentFrom = getDocumentPosition(transaction.doc, from);
@@ -122,6 +123,21 @@ var AutocompletePluginView = /*#__PURE__*/function (_ReactPluginView) {
122
123
  }
123
124
  break;
124
125
  }
126
+ case 'goal':
127
+ {
128
+ if (FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false)) {
129
+ var _attributes3 = {
130
+ type: 'goal',
131
+ id: value,
132
+ name: nameOnRichInlineNode !== null && nameOnRichInlineNode !== void 0 ? nameOnRichInlineNode : name,
133
+ fieldName: context === null || context === void 0 ? void 0 : context.field
134
+ };
135
+ nodes.push(_this.view.state.schema.nodes.goal.create(_attributes3, textContent));
136
+ } else {
137
+ nodes.push(textContent);
138
+ }
139
+ break;
140
+ }
125
141
  default:
126
142
  {
127
143
  nodes.push(textContent);
@@ -36,8 +36,9 @@ export var NodeBase = function NodeBase(props) {
36
36
  text = props.text,
37
37
  isLocked = props.isLocked,
38
38
  selected = props.selected,
39
- error = props.error;
40
- var isNewExperienceEnabled = FeatureGates.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false);
39
+ error = props.error,
40
+ isRichNodeDisplay = props.isRichNodeDisplay;
41
+ var isNewExperienceEnabled = FeatureGates.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false) || isRichNodeDisplay;
41
42
  return /*#__PURE__*/React.createElement(Pressable, _extends({
42
43
  xcss: cx(styles.nodeWrapper, !isNewExperienceEnabled && styles.nodeWrapperWithHeight, error && styles.nodeWrapperError, selected && (error ? styles.nodeWrapperErrorSelected : styles.nodeWrapperSelected))
43
44
  }, isNewExperienceEnabled ? {
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { IconTile } from '@atlaskit/icon';
3
+ import KeyResultIcon from '@atlaskit/icon/core/key-result';
4
+ import ObjectiveIcon from '@atlaskit/icon/core/objective';
5
+ var goalAppearances = ['DEFAULT', 'ON_TRACK', 'AT_RISK', 'OFF_TRACK', 'MENU'];
6
+ var GOAL_ICON_KEYS = ['GOAL', 'OBJECTIVE', 'KEY_RESULT'];
7
+ var isGoalAppearance = function isGoalAppearance(value) {
8
+ return goalAppearances.includes(value.toLocaleUpperCase());
9
+ };
10
+ export var isGoalIconKey = function isGoalIconKey(value) {
11
+ return GOAL_ICON_KEYS.includes(value);
12
+ };
13
+ var appearanceToColorMap = {
14
+ DEFAULT: 'gray',
15
+ MENU: 'gray',
16
+ OFF_TRACK: 'red',
17
+ AT_RISK: 'yellow',
18
+ ON_TRACK: 'green'
19
+ };
20
+ var keyToIconMap = {
21
+ GOAL: ObjectiveIcon,
22
+ OBJECTIVE: ObjectiveIcon,
23
+ KEY_RESULT: KeyResultIcon
24
+ };
25
+ export var GoalIcon = function GoalIcon(_ref) {
26
+ var _keyToIconMap;
27
+ var status = _ref.status,
28
+ size = _ref.size,
29
+ _ref$iconKey = _ref.iconKey,
30
+ iconKey = _ref$iconKey === void 0 ? 'GOAL' : _ref$iconKey;
31
+ var Icon = (_keyToIconMap = keyToIconMap[iconKey]) !== null && _keyToIconMap !== void 0 ? _keyToIconMap : keyToIconMap.GOAL;
32
+ var appearance = isGoalAppearance(status) ? status : 'DEFAULT';
33
+ return /*#__PURE__*/React.createElement(IconTile, {
34
+ size: size,
35
+ icon: Icon,
36
+ label: "",
37
+ appearance: appearanceToColorMap[appearance]
38
+ });
39
+ };
@@ -0,0 +1,3 @@
1
+ ._1e0c1txw{display:flex}
2
+ ._4t3i7vkz{height:1pc}
3
+ ._kqswh2mm{position:relative}
@@ -0,0 +1,49 @@
1
+ /* goal-node.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["id", "fieldName", "name"];
6
+ import "./goal-node.compiled.css";
7
+ import { ax, ix } from "@compiled/react/runtime";
8
+ import React from 'react';
9
+ import { Box } from '@atlaskit/primitives/compiled';
10
+ import { useHydratedGoal } from '../../../../state';
11
+ import { NodeBase } from '../base';
12
+ import { GoalIcon, isGoalIconKey } from './goal-icon';
13
+ var styles = {
14
+ iconWrapper: "_1e0c1txw _4t3i7vkz _kqswh2mm"
15
+ };
16
+ function toGoalIconKey(iconKey) {
17
+ return iconKey && isGoalIconKey(iconKey) ? iconKey : 'GOAL';
18
+ }
19
+
20
+ /**
21
+ * GoalNode Component
22
+ *
23
+ * This component is a component for rendering a pill-like view for Goal node type
24
+ * in the JQL editor
25
+ */
26
+ export var GoalNode = function GoalNode(props) {
27
+ var _goal$status;
28
+ var id = props.id,
29
+ fieldName = props.fieldName,
30
+ name = props.name,
31
+ rest = _objectWithoutProperties(props, _excluded);
32
+ var _useHydratedGoal = useHydratedGoal({
33
+ id: id,
34
+ fieldName: fieldName
35
+ }),
36
+ _useHydratedGoal2 = _slicedToArray(_useHydratedGoal, 1),
37
+ goal = _useHydratedGoal2[0];
38
+ return /*#__PURE__*/React.createElement(NodeBase, _extends({
39
+ iconBefore: /*#__PURE__*/React.createElement(Box, {
40
+ xcss: styles.iconWrapper
41
+ }, /*#__PURE__*/React.createElement(GoalIcon, {
42
+ size: "16",
43
+ status: (_goal$status = goal === null || goal === void 0 ? void 0 : goal.status) !== null && _goal$status !== void 0 ? _goal$status : "DEFAULT",
44
+ iconKey: toGoalIconKey("GOAL")
45
+ })),
46
+ text: name,
47
+ isRichNodeDisplay: true
48
+ }, rest));
49
+ };
@@ -0,0 +1,9 @@
1
+ import { GoalNode } from './goal-node';
2
+ export var goal = {
3
+ component: GoalNode,
4
+ attrs: {
5
+ id: {},
6
+ name: {},
7
+ fieldName: {}
8
+ }
9
+ };
@@ -1,8 +1,10 @@
1
+ import { goal } from './goal';
1
2
  import { project } from './project';
2
3
  import { team } from './team';
3
4
  import { user } from './user';
4
5
  export var richInlineNodes = {
5
6
  user: user,
6
7
  team: team,
7
- project: project
8
+ project: project,
9
+ goal: goal
8
10
  };
@@ -10,6 +10,7 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  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
12
  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; }
13
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
13
14
  import { AbstractJastVisitor } from '@atlaskit/jql-ast';
14
15
  import { fg } from '@atlaskit/platform-feature-flags';
15
16
  import { JQLEditorSchema } from '../../../schema';
@@ -26,7 +27,7 @@ export var replaceRichInlineNodes = function replaceRichInlineNodes(editorState,
26
27
  fieldName = _ref2[0],
27
28
  values = _ref2[1];
28
29
  values.forEach(function (value) {
29
- if (value.type === 'user' || value.type === 'team' || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
30
+ if (value.type === 'user' || value.type === 'team' || value.type === 'goal' && FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
30
31
  // First try to find as direct value operand (e.g., Team[Team] = uuid)
31
32
  var astNodes = getValueNodes(ast, fieldName, value.id);
32
33
 
@@ -75,6 +76,13 @@ var getRichInlineNode = function getRichInlineNode(fieldName, value, text) {
75
76
  fieldName: fieldName
76
77
  }), _textContent2);
77
78
  }
79
+ case 'goal':
80
+ {
81
+ var _textContent3 = JQLEditorSchema.text(text);
82
+ return JQLEditorSchema.nodes.goal.create(_objectSpread(_objectSpread({}, value), {}, {
83
+ fieldName: fieldName
84
+ }), _textContent3);
85
+ }
78
86
  default:
79
87
  {
80
88
  throw new Error("Unsupported hydrated value type ".concat(value.type));
@@ -932,16 +932,25 @@ export var useHydratedProject = createHook(Store, {
932
932
  return project && project.type === 'project' ? project : undefined;
933
933
  }
934
934
  });
935
+ export var useHydratedGoal = createHook(Store, {
936
+ selector: function selector(state, _ref42) {
937
+ var _state$hydratedValues9;
938
+ var id = _ref42.id,
939
+ fieldName = _ref42.fieldName;
940
+ var goal = (_state$hydratedValues9 = state.hydratedValues[normaliseHydrationKey(fieldName)]) === null || _state$hydratedValues9 === void 0 ? void 0 : _state$hydratedValues9.get(normaliseJqlString(id));
941
+ return goal && goal.type === 'goal' ? goal : undefined;
942
+ }
943
+ });
935
944
  export var useHydratedDeprecations = createHook(Store, {
936
945
  selector: function selector(state) {
937
946
  var ast = getJastFromState(state.editorState);
938
947
  var fieldsInQuery = getFieldNodes(ast);
939
948
  var toReturn = [];
940
- Object.entries(state.hydratedValues).forEach(function (_ref42) {
941
- var _state$hydratedValues9;
942
- var _ref43 = _slicedToArray(_ref42, 1),
943
- fieldName = _ref43[0];
944
- (_state$hydratedValues9 = state.hydratedValues[fieldName]) === null || _state$hydratedValues9 === void 0 || _state$hydratedValues9.forEach(function (value) {
949
+ Object.entries(state.hydratedValues).forEach(function (_ref43) {
950
+ var _state$hydratedValues0;
951
+ var _ref44 = _slicedToArray(_ref43, 1),
952
+ fieldName = _ref44[0];
953
+ (_state$hydratedValues0 = state.hydratedValues[fieldName]) === null || _state$hydratedValues0 === void 0 || _state$hydratedValues0.forEach(function (value) {
945
954
  if (value.type === 'deprecated-field') {
946
955
  if (fieldsInQuery.has(value.id.toLowerCase())) {
947
956
  toReturn.push(value);
@@ -964,19 +973,19 @@ export var useOnSyntaxHelp = createHook(Store, {
964
973
  });
965
974
  export var EditorStateContainer = createContainer(Store, {
966
975
  onInit: function onInit() {
967
- return function (_ref44, _ref45) {
968
- var getState = _ref44.getState,
969
- setState = _ref44.setState,
970
- dispatch = _ref44.dispatch;
971
- var intlRef = _ref45.intlRef,
972
- query = _ref45.query,
973
- isSearching = _ref45.isSearching,
974
- autocompleteProvider = _ref45.autocompleteProvider,
975
- externalMessages = _ref45.externalMessages,
976
- enableRichInlineNodes = _ref45.enableRichInlineNodes,
977
- onDebugUnsafeMessage = _ref45.onDebugUnsafeMessage,
978
- onSyntaxHelp = _ref45.onSyntaxHelp,
979
- customComponents = _ref45.customComponents;
976
+ return function (_ref45, _ref46) {
977
+ var getState = _ref45.getState,
978
+ setState = _ref45.setState,
979
+ dispatch = _ref45.dispatch;
980
+ var intlRef = _ref46.intlRef,
981
+ query = _ref46.query,
982
+ isSearching = _ref46.isSearching,
983
+ autocompleteProvider = _ref46.autocompleteProvider,
984
+ externalMessages = _ref46.externalMessages,
985
+ enableRichInlineNodes = _ref46.enableRichInlineNodes,
986
+ onDebugUnsafeMessage = _ref46.onDebugUnsafeMessage,
987
+ onSyntaxHelp = _ref46.onSyntaxHelp,
988
+ customComponents = _ref46.customComponents;
980
989
  setState({
981
990
  controlledQuery: query,
982
991
  query: query,
@@ -1005,18 +1014,18 @@ export var EditorStateContainer = createContainer(Store, {
1005
1014
  };
1006
1015
  },
1007
1016
  onUpdate: function onUpdate() {
1008
- return function (_ref46, _ref47) {
1009
- var getState = _ref46.getState,
1010
- setState = _ref46.setState,
1011
- dispatch = _ref46.dispatch;
1012
- var controlledQueryProp = _ref47.query,
1013
- isSearching = _ref47.isSearching,
1014
- autocompleteProvider = _ref47.autocompleteProvider,
1015
- externalMessages = _ref47.externalMessages,
1016
- enableRichInlineNodes = _ref47.enableRichInlineNodes,
1017
- onDebugUnsafeMessage = _ref47.onDebugUnsafeMessage,
1018
- onSyntaxHelp = _ref47.onSyntaxHelp,
1019
- customComponents = _ref47.customComponents;
1017
+ return function (_ref47, _ref48) {
1018
+ var getState = _ref47.getState,
1019
+ setState = _ref47.setState,
1020
+ dispatch = _ref47.dispatch;
1021
+ var controlledQueryProp = _ref48.query,
1022
+ isSearching = _ref48.isSearching,
1023
+ autocompleteProvider = _ref48.autocompleteProvider,
1024
+ externalMessages = _ref48.externalMessages,
1025
+ enableRichInlineNodes = _ref48.enableRichInlineNodes,
1026
+ onDebugUnsafeMessage = _ref48.onDebugUnsafeMessage,
1027
+ onSyntaxHelp = _ref48.onSyntaxHelp,
1028
+ customComponents = _ref48.customComponents;
1020
1029
  var _getState12 = getState(),
1021
1030
  controlledQuery = _getState12.controlledQuery,
1022
1031
  query = _getState12.query;
@@ -2,5 +2,6 @@ import { type ReactNode } from 'react';
2
2
  export type NodeBaseProps = {
3
3
  iconBefore: ReactNode;
4
4
  isLocked?: boolean;
5
+ isRichNodeDisplay?: boolean;
5
6
  text?: string;
6
7
  };
@@ -0,0 +1,12 @@
1
+ import React, { type ComponentProps } from 'react';
2
+ import { IconTile } from '@atlaskit/icon';
3
+ declare const GOAL_ICON_KEYS: readonly ["GOAL", "OBJECTIVE", "KEY_RESULT"];
4
+ export type GoalIconKey = (typeof GOAL_ICON_KEYS)[number];
5
+ export declare const isGoalIconKey: (value: string) => value is GoalIconKey;
6
+ interface GoalIconProps {
7
+ iconKey?: GoalIconKey;
8
+ size?: ComponentProps<typeof IconTile>['size'];
9
+ status: string;
10
+ }
11
+ export declare const GoalIcon: ({ status, size, iconKey, }: GoalIconProps) => React.JSX.Element;
12
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { NodeViewProps } from '../../util/react-node-view';
3
+ import type { Props } from './types';
4
+ /**
5
+ * GoalNode Component
6
+ *
7
+ * This component is a component for rendering a pill-like view for Goal node type
8
+ * in the JQL editor
9
+ */
10
+ export declare const GoalNode: (props: NodeViewProps<Props>) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { JQLNodeSpec } from '../types';
2
+ import type { Props } from './types';
3
+ export declare const goal: JQLNodeSpec<Props>;
@@ -0,0 +1,5 @@
1
+ export type Props = {
2
+ fieldName: string;
3
+ id: string;
4
+ name: string;
5
+ };
@@ -2,4 +2,5 @@ export declare const richInlineNodes: {
2
2
  user: import("./types").JQLNodeSpec<import("./user").Props>;
3
3
  team: import("./types").JQLNodeSpec<import("./team").Props>;
4
4
  project: import("./types").JQLNodeSpec<import("./project/types").Props>;
5
+ goal: import("./types").JQLNodeSpec<import("./goal/types").Props>;
5
6
  };
@@ -10,7 +10,7 @@ import { type JqlEditorAnalyticsEvent } from '../analytics';
10
10
  import { type AutocompleteOptionGroup, type AutocompleteOptions, type AutocompleteOptionType, type SelectableAutocompleteOption } from '../plugins/autocomplete/components/types';
11
11
  import { type AutocompleteProvider } from '../plugins/types';
12
12
  import { type PortalActions } from '../ui/jql-editor-portal-provider/types';
13
- import { type HydratedDeprecatedField, type HydratedProject, type HydratedTeam, type HydratedUser, type HydratedValue } from '../ui/jql-editor/types';
13
+ import { type HydratedDeprecatedField, type HydratedProject, type HydratedGoal, type HydratedTeam, type HydratedUser, type HydratedValue } from '../ui/jql-editor/types';
14
14
  import { type AutocompletePosition, type AutocompleteState, type ContextAwareJQLSuggestions, type CustomErrorComponent, type ExternalMessagesNormalized, type OptionsKey, type Props, type State } from './types';
15
15
  export declare const initialState: State;
16
16
  export declare const actions: {
@@ -799,6 +799,41 @@ export declare const useHydratedProject: import("react-sweet-state").HookFunctio
799
799
  fieldName: string;
800
800
  id: string;
801
801
  }>;
802
+ export declare const useHydratedGoal: import("react-sweet-state").HookFunction<HydratedGoal | undefined, import("react-sweet-state").BoundActions<State, {
803
+ onEditorViewBlur: () => Action<State>;
804
+ onEditorViewFocus: (event: FocusEvent<HTMLElement>) => Action<State, Props>;
805
+ openAutocompleteOnNextUpdate: () => Action<State>;
806
+ closeAutocomplete: () => Action<State>;
807
+ setSelectedAutocompleteOptionId: (selectedOptionId: string | undefined) => Action<State>;
808
+ getAutocompleteSuggestions: (editorState: EditorState) => Action<State>;
809
+ getAutocompleteOptions: (suggestions: ContextAwareJQLSuggestions) => Action<State>;
810
+ appendOptionsForObservable: (key: OptionsKey, observable: Observable<AutocompleteOptions>, rule: JQLRuleSuggestion, type: AutocompleteOptionType) => Action<State, void, Observable<AutocompleteOptions>>;
811
+ cancelSubscription: () => Action<State>;
812
+ setLoading: (loading: boolean) => Action<State>;
813
+ setAutocompleteOptions: (options: AutocompleteOptionGroup) => Action<State>;
814
+ setAutocompleteContainer: (container: HTMLElement | null) => Action<State>;
815
+ callAutocompleteProviders: ({ rules, tokens }: ContextAwareJQLSuggestions) => Action<State>;
816
+ updateValidationState: () => Action<State>;
817
+ initialiseEditorState: () => Action<State, Props>;
818
+ configurePlugins: (portalActions: PortalActions | void) => Action<State, Props>;
819
+ onApplyEditorTransaction: (transaction: Transaction) => Action<State, Props>;
820
+ resetEditorState: (query: string, addToHistory?: boolean) => Action<State>;
821
+ initialiseEditorView: (editorViewNode: HTMLElement, attributes: {
822
+ [key: string]: string;
823
+ }, portalActions: PortalActions) => Action<State, Props>;
824
+ updateEditorView: (attributes: {
825
+ [key: string]: string;
826
+ }) => Action<State, Props>;
827
+ setEditorViewContainer: (editorViewContainer: HTMLElement) => Action<State>;
828
+ setEditorViewContainerScroll: (scroll: number) => Action<State>;
829
+ onSearch: () => Action<State>;
830
+ onSearchCommand: (pmState: EditorState, pmDispatch: ((tr: Transaction) => void) | undefined, pmView: EditorView | undefined, keyboardShortcut: boolean) => Action<State, Props, boolean>;
831
+ externalErrorMessageViewed: () => Action<State, Props>;
832
+ createAndFireAnalyticsEvent: (payload: JqlEditorAnalyticsEvent) => Action<State, Props>;
833
+ }>, {
834
+ fieldName: string;
835
+ id: string;
836
+ }>;
802
837
  export declare const useHydratedDeprecations: import("react-sweet-state").HookFunction<HydratedDeprecatedField[], import("react-sweet-state").BoundActions<State, {
803
838
  onEditorViewBlur: () => Action<State>;
804
839
  onEditorViewFocus: (event: FocusEvent<HTMLElement>) => Action<State, Props>;
@@ -2,5 +2,6 @@ import { type ReactNode } from 'react';
2
2
  export type NodeBaseProps = {
3
3
  iconBefore: ReactNode;
4
4
  isLocked?: boolean;
5
+ isRichNodeDisplay?: boolean;
5
6
  text?: string;
6
7
  };
@@ -0,0 +1,16 @@
1
+ import React, { type ComponentProps } from 'react';
2
+ import { IconTile } from '@atlaskit/icon';
3
+ declare const GOAL_ICON_KEYS: readonly [
4
+ "GOAL",
5
+ "OBJECTIVE",
6
+ "KEY_RESULT"
7
+ ];
8
+ export type GoalIconKey = (typeof GOAL_ICON_KEYS)[number];
9
+ export declare const isGoalIconKey: (value: string) => value is GoalIconKey;
10
+ interface GoalIconProps {
11
+ iconKey?: GoalIconKey;
12
+ size?: ComponentProps<typeof IconTile>['size'];
13
+ status: string;
14
+ }
15
+ export declare const GoalIcon: ({ status, size, iconKey, }: GoalIconProps) => React.JSX.Element;
16
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { NodeViewProps } from '../../util/react-node-view';
3
+ import type { Props } from './types';
4
+ /**
5
+ * GoalNode Component
6
+ *
7
+ * This component is a component for rendering a pill-like view for Goal node type
8
+ * in the JQL editor
9
+ */
10
+ export declare const GoalNode: (props: NodeViewProps<Props>) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { JQLNodeSpec } from '../types';
2
+ import type { Props } from './types';
3
+ export declare const goal: JQLNodeSpec<Props>;
@@ -0,0 +1,5 @@
1
+ export type Props = {
2
+ fieldName: string;
3
+ id: string;
4
+ name: string;
5
+ };
@@ -2,4 +2,5 @@ export declare const richInlineNodes: {
2
2
  user: import("./types").JQLNodeSpec<import("./user").Props>;
3
3
  team: import("./types").JQLNodeSpec<import("./team").Props>;
4
4
  project: import("./types").JQLNodeSpec<import("./project/types").Props>;
5
+ goal: import("./types").JQLNodeSpec<import("./goal/types").Props>;
5
6
  };
@@ -10,7 +10,7 @@ import { type JqlEditorAnalyticsEvent } from '../analytics';
10
10
  import { type AutocompleteOptionGroup, type AutocompleteOptions, type AutocompleteOptionType, type SelectableAutocompleteOption } from '../plugins/autocomplete/components/types';
11
11
  import { type AutocompleteProvider } from '../plugins/types';
12
12
  import { type PortalActions } from '../ui/jql-editor-portal-provider/types';
13
- import { type HydratedDeprecatedField, type HydratedProject, type HydratedTeam, type HydratedUser, type HydratedValue } from '../ui/jql-editor/types';
13
+ import { type HydratedDeprecatedField, type HydratedProject, type HydratedGoal, type HydratedTeam, type HydratedUser, type HydratedValue } from '../ui/jql-editor/types';
14
14
  import { type AutocompletePosition, type AutocompleteState, type ContextAwareJQLSuggestions, type CustomErrorComponent, type ExternalMessagesNormalized, type OptionsKey, type Props, type State } from './types';
15
15
  export declare const initialState: State;
16
16
  export declare const actions: {
@@ -799,6 +799,41 @@ export declare const useHydratedProject: import("react-sweet-state").HookFunctio
799
799
  fieldName: string;
800
800
  id: string;
801
801
  }>;
802
+ export declare const useHydratedGoal: import("react-sweet-state").HookFunction<HydratedGoal | undefined, import("react-sweet-state").BoundActions<State, {
803
+ onEditorViewBlur: () => Action<State>;
804
+ onEditorViewFocus: (event: FocusEvent<HTMLElement>) => Action<State, Props>;
805
+ openAutocompleteOnNextUpdate: () => Action<State>;
806
+ closeAutocomplete: () => Action<State>;
807
+ setSelectedAutocompleteOptionId: (selectedOptionId: string | undefined) => Action<State>;
808
+ getAutocompleteSuggestions: (editorState: EditorState) => Action<State>;
809
+ getAutocompleteOptions: (suggestions: ContextAwareJQLSuggestions) => Action<State>;
810
+ appendOptionsForObservable: (key: OptionsKey, observable: Observable<AutocompleteOptions>, rule: JQLRuleSuggestion, type: AutocompleteOptionType) => Action<State, void, Observable<AutocompleteOptions>>;
811
+ cancelSubscription: () => Action<State>;
812
+ setLoading: (loading: boolean) => Action<State>;
813
+ setAutocompleteOptions: (options: AutocompleteOptionGroup) => Action<State>;
814
+ setAutocompleteContainer: (container: HTMLElement | null) => Action<State>;
815
+ callAutocompleteProviders: ({ rules, tokens }: ContextAwareJQLSuggestions) => Action<State>;
816
+ updateValidationState: () => Action<State>;
817
+ initialiseEditorState: () => Action<State, Props>;
818
+ configurePlugins: (portalActions: PortalActions | void) => Action<State, Props>;
819
+ onApplyEditorTransaction: (transaction: Transaction) => Action<State, Props>;
820
+ resetEditorState: (query: string, addToHistory?: boolean) => Action<State>;
821
+ initialiseEditorView: (editorViewNode: HTMLElement, attributes: {
822
+ [key: string]: string;
823
+ }, portalActions: PortalActions) => Action<State, Props>;
824
+ updateEditorView: (attributes: {
825
+ [key: string]: string;
826
+ }) => Action<State, Props>;
827
+ setEditorViewContainer: (editorViewContainer: HTMLElement) => Action<State>;
828
+ setEditorViewContainerScroll: (scroll: number) => Action<State>;
829
+ onSearch: () => Action<State>;
830
+ onSearchCommand: (pmState: EditorState, pmDispatch: ((tr: Transaction) => void) | undefined, pmView: EditorView | undefined, keyboardShortcut: boolean) => Action<State, Props, boolean>;
831
+ externalErrorMessageViewed: () => Action<State, Props>;
832
+ createAndFireAnalyticsEvent: (payload: JqlEditorAnalyticsEvent) => Action<State, Props>;
833
+ }>, {
834
+ fieldName: string;
835
+ id: string;
836
+ }>;
802
837
  export declare const useHydratedDeprecations: import("react-sweet-state").HookFunction<HydratedDeprecatedField[], import("react-sweet-state").BoundActions<State, {
803
838
  onEditorViewBlur: () => Action<State>;
804
839
  onEditorViewFocus: (event: FocusEvent<HTMLElement>) => Action<State, Props>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/jql-editor",
3
- "version": "6.1.2",
3
+ "version": "6.2.0",
4
4
  "description": "This package allows consumers to render an advanced JQL editor component to enable autocomplete-assisted authoring and validation of JQL queries.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,18 +42,18 @@
42
42
  "@atlaskit/afm-i18n-platform-jql-jql-editor": "2.10.0",
43
43
  "@atlaskit/analytics-gas-types": "^5.1.0",
44
44
  "@atlaskit/analytics-next": "^11.2.0",
45
- "@atlaskit/avatar": "^25.11.0",
45
+ "@atlaskit/avatar": "^25.12.0",
46
46
  "@atlaskit/button": "^23.11.0",
47
47
  "@atlaskit/css": "^0.19.0",
48
48
  "@atlaskit/editor-prosemirror": "^7.3.0",
49
- "@atlaskit/emoji": "^70.0.0",
49
+ "@atlaskit/emoji": "^70.1.0",
50
50
  "@atlaskit/feature-gate-js-client": "^5.5.0",
51
51
  "@atlaskit/form": "^15.5.0",
52
52
  "@atlaskit/icon": "^34.2.0",
53
53
  "@atlaskit/icon-lab": "^6.5.0",
54
54
  "@atlaskit/jql-ast": "^3.4.0",
55
55
  "@atlaskit/jql-autocomplete": "^2.0.0",
56
- "@atlaskit/jql-editor-common": "^3.1.0",
56
+ "@atlaskit/jql-editor-common": "^3.2.0",
57
57
  "@atlaskit/jql-parser": "^2.0.0",
58
58
  "@atlaskit/link": "^3.4.0",
59
59
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -89,7 +89,7 @@
89
89
  "@af/integration-testing": "workspace:^",
90
90
  "@af/visual-regression": "workspace:^",
91
91
  "@atlaskit/docs": "^11.8.0",
92
- "@atlaskit/jql-editor-autocomplete-rest": "^3.1.0",
92
+ "@atlaskit/jql-editor-autocomplete-rest": "^3.2.0",
93
93
  "@atlassian/feature-flags-storybook-utils": "^0.3.0",
94
94
  "@atlassian/feature-flags-test-utils": "^1.0.0",
95
95
  "@atlassian/react-compiler-gating": "workspace:^",