@atlaskit/smart-card 27.0.0 → 27.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +57 -55
  4. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +25 -57
  5. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +1 -20
  6. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +0 -7
  7. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +6 -8
  8. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +9 -10
  9. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +1 -3
  10. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +1 -3
  11. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +1 -6
  12. package/dist/cjs/view/LinkUrl/index.js +1 -1
  13. package/dist/es2019/utils/analytics/analytics.js +1 -1
  14. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +57 -55
  15. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +6 -34
  16. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +1 -2
  17. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +0 -1
  18. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +5 -7
  19. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +7 -8
  20. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +0 -2
  21. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +0 -2
  22. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +1 -8
  23. package/dist/es2019/view/LinkUrl/index.js +1 -1
  24. package/dist/esm/utils/analytics/analytics.js +1 -1
  25. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +57 -55
  26. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +24 -57
  27. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +1 -2
  28. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +0 -1
  29. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +6 -8
  30. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +9 -10
  31. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +1 -3
  32. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +1 -3
  33. package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +1 -6
  34. package/dist/esm/view/LinkUrl/index.js +1 -1
  35. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.d.ts +7 -5
  36. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.d.ts +3 -8
  37. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.d.ts +1 -2
  38. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.d.ts +0 -1
  39. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.d.ts +3 -5
  40. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.d.ts +5 -6
  41. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.d.ts +1 -3
  42. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +1 -3
  43. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.d.ts +7 -5
  44. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.d.ts +3 -8
  45. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.d.ts +1 -2
  46. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.d.ts +0 -1
  47. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.d.ts +3 -5
  48. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.d.ts +5 -6
  49. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.d.ts +1 -3
  50. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +1 -3
  51. package/package.json +2 -2
  52. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +0 -138
  53. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +0 -51
  54. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +0 -131
  55. package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.d.ts +0 -3
  56. package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.d.ts +0 -3
@@ -2,67 +2,69 @@ import { UserInputType } from './types';
2
2
  const mockScope = {
3
3
  resources: []
4
4
  };
5
- export const mockRules = [{
6
- id: 0,
7
- name: 'Test rule 0 (no inputs)',
8
- ruleScope: mockScope,
9
- userInputs: []
10
- }, {
11
- id: 1,
12
- name: 'Test rule 1 (has inputs)',
13
- ruleScope: mockScope,
14
- userInputs: [{
15
- defaultValue: '',
16
- displayName: 'Test user input',
17
- inputType: UserInputType.TEXT,
18
- required: false,
19
- variableName: 'testUserInput'
20
- }]
21
- }, {
22
- id: 2,
23
- name: 'Test rule 2 (has multiple inputs)',
24
- ruleScope: mockScope,
25
- userInputs: [{
26
- defaultValue: '',
27
- displayName: 'Text user input',
28
- inputType: UserInputType.TEXT,
29
- required: false,
30
- variableName: 'textUserInput'
31
- }, {
32
- defaultValue: '',
33
- displayName: 'Number user input',
34
- inputType: UserInputType.NUMBER,
35
- required: false,
36
- variableName: 'numberUserInput'
5
+ export const mockRules = {
6
+ data: [{
7
+ id: 0,
8
+ name: 'Test rule 0 (no inputs)',
9
+ ruleScope: mockScope,
10
+ userInputs: []
37
11
  }, {
38
- defaultValue: true,
39
- displayName: 'Boolean user input',
40
- inputType: UserInputType.BOOLEAN,
41
- required: false,
42
- variableName: 'booleanUserInput'
12
+ id: 1,
13
+ name: 'Test rule 1 (has inputs)',
14
+ ruleScope: mockScope,
15
+ userInputs: [{
16
+ defaultValue: '',
17
+ displayName: 'Test user input',
18
+ inputType: UserInputType.TEXT,
19
+ required: false,
20
+ variableName: 'testUserInput'
21
+ }]
43
22
  }, {
44
- defaultValue: [''],
45
- displayName: 'Dropdown user input',
46
- inputType: UserInputType.DROPDOWN,
47
- required: false,
48
- variableName: 'dropdownUserInput'
49
- }, {
50
- defaultValue: '',
51
- displayName: 'Paragraph user input',
52
- inputType: UserInputType.PARAGRAPH,
53
- required: false,
54
- variableName: 'paragraphUserInput'
23
+ id: 2,
24
+ name: 'Test rule 2 (has multiple inputs)',
25
+ ruleScope: mockScope,
26
+ userInputs: [{
27
+ defaultValue: '',
28
+ displayName: 'Text user input',
29
+ inputType: UserInputType.TEXT,
30
+ required: false,
31
+ variableName: 'textUserInput'
32
+ }, {
33
+ defaultValue: '',
34
+ displayName: 'Number user input',
35
+ inputType: UserInputType.NUMBER,
36
+ required: false,
37
+ variableName: 'numberUserInput'
38
+ }, {
39
+ defaultValue: true,
40
+ displayName: 'Boolean user input',
41
+ inputType: UserInputType.BOOLEAN,
42
+ required: false,
43
+ variableName: 'booleanUserInput'
44
+ }, {
45
+ defaultValue: [''],
46
+ displayName: 'Dropdown user input',
47
+ inputType: UserInputType.DROPDOWN,
48
+ required: false,
49
+ variableName: 'dropdownUserInput'
50
+ }, {
51
+ defaultValue: '',
52
+ displayName: 'Paragraph user input',
53
+ inputType: UserInputType.PARAGRAPH,
54
+ required: false,
55
+ variableName: 'paragraphUserInput'
56
+ }]
55
57
  }]
56
- }];
58
+ };
57
59
  export const mockTransformedRules = [{
58
- ...mockRules[0],
59
- userInputPrompts: mockRules[0].userInputs
60
+ ...mockRules.data[0],
61
+ userInputPrompts: mockRules.data[0].userInputs
60
62
  }, {
61
- ...mockRules[1],
62
- userInputPrompts: mockRules[1].userInputs
63
+ ...mockRules.data[1],
64
+ userInputPrompts: mockRules.data[1].userInputs
63
65
  }, {
64
- ...mockRules[2],
65
- userInputPrompts: mockRules[2].userInputs
66
+ ...mockRules.data[2],
67
+ userInputPrompts: mockRules.data[2].userInputs
66
68
  }];
67
69
  export const mockInvocationResponse = {
68
70
  'TEST-1': 'SUCCESS'
@@ -1,5 +1,3 @@
1
- import { getAutomationStack } from './stack-resolver';
2
-
3
1
  /**
4
2
  * This function will extract the cloud ID and product from a product level Site ARI.
5
3
  * ARIs can be found at the following link: {@link https://developer.atlassian.com/platform/atlassian-resource-identifier/resource-owners/registry/#ari-registry}
@@ -41,32 +39,29 @@ export const extractCloudIdAndProductFromSite = site => {
41
39
  * model language is used here, even though for the meantime we only concern ourselves with alerts.
42
40
  *
43
41
  */
44
- export const getSearchUrl = async (env, site) => {
42
+ export const getSearchUrl = async site => {
45
43
  const {
46
44
  product,
47
45
  cloudId
48
46
  } = extractCloudIdAndProductFromSite(site);
49
- const automationStack = await getAutomationStack(env, cloudId);
50
47
  // TODO in the unified API, GET requests as according to Atlassian API standards will destructure the whole query into
51
48
  // query parameters as part of the URL. For now, this is considered a POST request instead and thus the query is used
52
49
  // later on as the request body.
53
- return `/gateway/api/automation/internal-api/${product}/${cloudId}/${automationStack}/rest/v1/rules/manual/search`;
50
+ return `/gateway/api/automation/public/${product}/${cloudId}/rest/v1/rule/manual/search`;
54
51
  };
55
- export const getInvocationUrl = async (env, site, ruleId) => {
52
+ export const getInvocationUrl = async (site, ruleId) => {
56
53
  const {
57
54
  product,
58
55
  cloudId
59
56
  } = extractCloudIdAndProductFromSite(site);
60
- const automationStack = await getAutomationStack(env, cloudId);
61
- return `/gateway/api/automation/internal-api/${product}/${cloudId}/${automationStack}/rest/v1/rules/manual/invocation/${ruleId}`;
57
+ return `/gateway/api/automation/public/${product}/${cloudId}/rest/v1/rule/manual/${ruleId}/invocation`;
62
58
  };
63
59
  const DEFAULT_HEADER = {
64
60
  'Content-Type': 'application/json'
65
61
  };
66
- const _performRequest = async (url, method, options = {
67
- headers: DEFAULT_HEADER
68
- }) => {
62
+ const _performRequest = async (url, method, options) => {
69
63
  const response = await fetch(url, {
64
+ headers: DEFAULT_HEADER,
70
65
  ...options,
71
66
  method
72
67
  });
@@ -77,27 +72,4 @@ export const performGetRequest = async (url, options) => {
77
72
  };
78
73
  export const performPostRequest = async (url, options) => {
79
74
  return _performRequest(url, 'POST', options);
80
- };
81
-
82
- // TODO this will need to be expanded to resolve the correct product URL, too.
83
- // TODO for instance this will need to support Alerts UI URL resolution in the
84
- // TODO short term
85
- export const getBaseAutomationUrl = ({
86
- projectKey,
87
- projectType,
88
- isSimplified
89
- }) => {
90
- /**
91
- * Confusing mapping of urls here.
92
- * Classic Projects - always under /automate
93
- * Next Gen Projects - under /automation for all project types except JSD
94
- */
95
- switch (projectType) {
96
- case 'service_desk':
97
- return `/jira/servicedesk/projects/${projectKey}/settings/automate`;
98
- case 'business':
99
- return `/jira/core/projects/${projectKey}/settings/${isSimplified ? 'automation' : 'automate'}`;
100
- default:
101
- return `/jira/software/${isSimplified ? '' : 'c/'}projects/${projectKey}/settings/${isSimplified ? 'automation' : 'automate'}`;
102
- }
103
75
  };
@@ -1,2 +1 @@
1
- export { extractCloudIdAndProductFromSite, getSearchUrl, getInvocationUrl, performGetRequest, performPostRequest, getBaseAutomationUrl } from './api';
2
- export { getAutomationStackFromLocalStorage, getAutomationStack } from './stack-resolver';
1
+ export { extractCloudIdAndProductFromSite, getSearchUrl, getInvocationUrl, performGetRequest, performPostRequest } from './api';
@@ -1,3 +1,2 @@
1
1
  export { searchManuallyTriggeredRules, invokeManuallyTriggeredRule } from './services';
2
- export { getBaseAutomationUrl } from './common/utils';
3
2
  export { useManualRules, ManualRulesContainer } from './main';
@@ -7,11 +7,10 @@ import UserInputForm from './manual-triggers-form/main';
7
7
  /**
8
8
  * React hook that implements the fetch and invoke actions for manual triggers.
9
9
  * Can be used standalone or in the HOC provided below.
10
- * @param env - The environment to retrieve rules from
11
10
  * @param site - The site to filter on. We map this to just a cloudId to resolve the manual rules API path
12
11
  * @param query - Query object containing filter props (container, object(s))
13
12
  */
14
- export const useManualRules = (env, site, query) => {
13
+ export const useManualRules = (site, query) => {
15
14
  const [initialised, setInitialised] = useState(false);
16
15
  const [error, setError] = useState(null);
17
16
  const [rules, setRules] = useState([]);
@@ -22,7 +21,7 @@ export const useManualRules = (env, site, query) => {
22
21
  const triggerFetch = async () => {
23
22
  setInitialised(false);
24
23
  try {
25
- const fetchedRules = await searchManuallyTriggeredRules(env, site, query);
24
+ const fetchedRules = await searchManuallyTriggeredRules(site, query);
26
25
  setError(null);
27
26
  setRules(transformRules(fetchedRules));
28
27
  } catch (e) {
@@ -50,11 +49,10 @@ export const useManualRules = (env, site, query) => {
50
49
  * should not care about this, only how to trigger invocation and understand
51
50
  * the invocation lifecycle.
52
51
  *
53
- * @param props - environment, cloudId, projectId, children
52
+ * @param props - cloudId, projectId, children
54
53
  */
55
54
  export const ManualRulesContainer = props => {
56
55
  const {
57
- env,
58
56
  site,
59
57
  query,
60
58
  children,
@@ -66,7 +64,7 @@ export const ManualRulesContainer = props => {
66
64
  onRuleInvocationLifecycleDone
67
65
  } = props;
68
66
  // Initial data loading state
69
- const [triggerFetch, initialised, error, rules] = useManualRules(env, site, query);
67
+ const [triggerFetch, initialised, error, rules] = useManualRules(site, query);
70
68
  // We store a rule in state here if and only if a rule has user inputs, and thus
71
69
  // we need to preserve state while the input dialog is open.
72
70
  const [selectedRule, setSelectedRule] = useState(null);
@@ -102,7 +100,7 @@ export const ManualRulesContainer = props => {
102
100
  if (onRuleInvocationLifecycleStarted) {
103
101
  onRuleInvocationLifecycleStarted(ruleId, objects, userInputs);
104
102
  }
105
- const response = await invokeManuallyTriggeredRule(env, site, ruleId, objects, userInputs);
103
+ const response = await invokeManuallyTriggeredRule(site, ruleId, objects, userInputs);
106
104
  const failedObjects = getFailedObjects(response);
107
105
  setInvokingRuleId(null);
108
106
  if (failedObjects.length === 0) {
@@ -2,19 +2,19 @@ import { getInvocationUrl, getSearchUrl, performPostRequest } from './../common/
2
2
 
3
3
  /**
4
4
  * Manual trigger rules API fetch. Fetches a list of manually triggered rules according to the context provided
5
- * in env, and query.
6
- * @param env - The environment to look up rules against
5
+ * in query.
6
+ * @param site - the site ARI to fetch the rules against
7
7
  * @param query - the workspace/container/objects to fetch rules against
8
8
  */
9
- export const searchManuallyTriggeredRules = async (env, site, query) => {
10
- const url = await getSearchUrl(env, site);
9
+ export const searchManuallyTriggeredRules = async (site, query) => {
10
+ const url = await getSearchUrl(site);
11
11
  // TODO this will in the new API be a GET request instead, with the above getSearchUrl method
12
12
  // constructing a URL with the appropriate query parameters. For now, instead, we pass the
13
13
  // destructured query through as a POST body.
14
14
  const response = await performPostRequest(url, {
15
15
  body: JSON.stringify(query)
16
16
  });
17
- return response.reduce((acc, {
17
+ return response.data.reduce((acc, {
18
18
  id,
19
19
  name,
20
20
  ruleScope,
@@ -33,14 +33,13 @@ export const searchManuallyTriggeredRules = async (env, site, query) => {
33
33
 
34
34
  /**
35
35
  * Invoke a manually triggered rule via the API.
36
- * @param env - the environment to use when invoking the rule
37
36
  * @param cloudId - the site the rule belongs to
38
37
  * @param ruleId - the identifier of the rule you want to invoke
39
38
  * @param objects - the list of objects you wish to create an automation event for.
40
39
  * @param userInputs - the optional user inputs if this manual trigger requires them
41
40
  */
42
- export const invokeManuallyTriggeredRule = async (env, site, ruleId, objects, userInputs) => {
43
- const url = await getInvocationUrl(env, site, ruleId);
41
+ export const invokeManuallyTriggeredRule = async (site, ruleId, objects, userInputs) => {
42
+ const url = await getInvocationUrl(site, ruleId);
44
43
  const bodyRaw = {
45
44
  objects
46
45
  };
@@ -6,7 +6,6 @@ import { AutomationModalBody } from './sub-components/body';
6
6
  import { AutomationModalFooter } from './sub-components/footer';
7
7
  import { AutomationModalHeader } from './sub-components/header';
8
8
  export const AutomationModal = ({
9
- environment,
10
9
  baseAutomationUrl,
11
10
  siteAri,
12
11
  objectAri,
@@ -32,7 +31,6 @@ export const AutomationModal = ({
32
31
  }).fire();
33
32
  }, [createAnalyticsEvent, analyticsSource]);
34
33
  return /*#__PURE__*/React.createElement(AutomationMenuContextContainer, {
35
- environment: environment,
36
34
  baseAutomationUrl: baseAutomationUrl,
37
35
  objectAri: objectAri,
38
36
  siteAri: siteAri,
@@ -22,7 +22,6 @@ export const useAutomationMenu = () => {
22
22
  return context;
23
23
  };
24
24
  export const AutomationMenuContextContainer = ({
25
- environment,
26
25
  baseAutomationUrl,
27
26
  analyticsSource,
28
27
  objectAri,
@@ -36,7 +35,6 @@ export const AutomationMenuContextContainer = ({
36
35
  onRuleInvocationLifecycleDone
37
36
  }) => {
38
37
  return /*#__PURE__*/React.createElement(ManualRulesContainer, {
39
- env: environment,
40
38
  site: siteAri,
41
39
  query: {
42
40
  objects: [objectAri]
@@ -6,7 +6,6 @@ import Action from '../action';
6
6
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
7
7
  import { ActionName } from '../../../../../constants';
8
8
  import { messages } from '../../../../../messages';
9
- import { useSmartLinkContext } from '@atlaskit/link-provider';
10
9
  const AutomationModal = /*#__PURE__*/lazy(() => import( /* webpackChunkName: "@atlaskit-internal_smart-card-automation-modal" */'./automation-manual-triggers/manual-triggers-modal'));
11
10
  const handleAutomateActionClick = setIsModalOpen => {
12
11
  setIsModalOpen(true);
@@ -15,16 +14,11 @@ const handleAutomationActionClose = setIsModalOpen => {
15
14
  setIsModalOpen(false);
16
15
  };
17
16
  const AutomationAction = props => {
18
- var _ref, _context$actions;
17
+ var _context$actions;
19
18
  const [isModalOpen, setIsModalOpen] = useState(false);
20
19
  const {
21
20
  formatMessage
22
21
  } = useIntl();
23
- const smartLinkContext = useSmartLinkContext();
24
- const {
25
- connections
26
- } = smartLinkContext;
27
- const environment = (_ref = connections.client.envKey) !== null && _ref !== void 0 ? _ref : 'prod';
28
22
  const context = useFlexibleUiContext();
29
23
  const automationActionData = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.AutomationAction];
30
24
  if (!automationActionData) {
@@ -66,7 +60,6 @@ const AutomationAction = props => {
66
60
  React.createElement(Suspense, {
67
61
  fallback: false
68
62
  }, /*#__PURE__*/React.createElement(AutomationModal, {
69
- environment: environment,
70
63
  baseAutomationUrl: baseAutomationUrl,
71
64
  objectAri: objectAri,
72
65
  siteAri: siteAri,
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "27.0.0",
10
+ packageVersion: "27.1.0",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "27.0.0"
18
+ packageVersion: "27.1.0"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -5,64 +5,66 @@ import { UserInputType } from './types';
5
5
  var mockScope = {
6
6
  resources: []
7
7
  };
8
- export var mockRules = [{
9
- id: 0,
10
- name: 'Test rule 0 (no inputs)',
11
- ruleScope: mockScope,
12
- userInputs: []
13
- }, {
14
- id: 1,
15
- name: 'Test rule 1 (has inputs)',
16
- ruleScope: mockScope,
17
- userInputs: [{
18
- defaultValue: '',
19
- displayName: 'Test user input',
20
- inputType: UserInputType.TEXT,
21
- required: false,
22
- variableName: 'testUserInput'
23
- }]
24
- }, {
25
- id: 2,
26
- name: 'Test rule 2 (has multiple inputs)',
27
- ruleScope: mockScope,
28
- userInputs: [{
29
- defaultValue: '',
30
- displayName: 'Text user input',
31
- inputType: UserInputType.TEXT,
32
- required: false,
33
- variableName: 'textUserInput'
34
- }, {
35
- defaultValue: '',
36
- displayName: 'Number user input',
37
- inputType: UserInputType.NUMBER,
38
- required: false,
39
- variableName: 'numberUserInput'
8
+ export var mockRules = {
9
+ data: [{
10
+ id: 0,
11
+ name: 'Test rule 0 (no inputs)',
12
+ ruleScope: mockScope,
13
+ userInputs: []
40
14
  }, {
41
- defaultValue: true,
42
- displayName: 'Boolean user input',
43
- inputType: UserInputType.BOOLEAN,
44
- required: false,
45
- variableName: 'booleanUserInput'
15
+ id: 1,
16
+ name: 'Test rule 1 (has inputs)',
17
+ ruleScope: mockScope,
18
+ userInputs: [{
19
+ defaultValue: '',
20
+ displayName: 'Test user input',
21
+ inputType: UserInputType.TEXT,
22
+ required: false,
23
+ variableName: 'testUserInput'
24
+ }]
46
25
  }, {
47
- defaultValue: [''],
48
- displayName: 'Dropdown user input',
49
- inputType: UserInputType.DROPDOWN,
50
- required: false,
51
- variableName: 'dropdownUserInput'
52
- }, {
53
- defaultValue: '',
54
- displayName: 'Paragraph user input',
55
- inputType: UserInputType.PARAGRAPH,
56
- required: false,
57
- variableName: 'paragraphUserInput'
26
+ id: 2,
27
+ name: 'Test rule 2 (has multiple inputs)',
28
+ ruleScope: mockScope,
29
+ userInputs: [{
30
+ defaultValue: '',
31
+ displayName: 'Text user input',
32
+ inputType: UserInputType.TEXT,
33
+ required: false,
34
+ variableName: 'textUserInput'
35
+ }, {
36
+ defaultValue: '',
37
+ displayName: 'Number user input',
38
+ inputType: UserInputType.NUMBER,
39
+ required: false,
40
+ variableName: 'numberUserInput'
41
+ }, {
42
+ defaultValue: true,
43
+ displayName: 'Boolean user input',
44
+ inputType: UserInputType.BOOLEAN,
45
+ required: false,
46
+ variableName: 'booleanUserInput'
47
+ }, {
48
+ defaultValue: [''],
49
+ displayName: 'Dropdown user input',
50
+ inputType: UserInputType.DROPDOWN,
51
+ required: false,
52
+ variableName: 'dropdownUserInput'
53
+ }, {
54
+ defaultValue: '',
55
+ displayName: 'Paragraph user input',
56
+ inputType: UserInputType.PARAGRAPH,
57
+ required: false,
58
+ variableName: 'paragraphUserInput'
59
+ }]
58
60
  }]
59
- }];
60
- export var mockTransformedRules = [_objectSpread(_objectSpread({}, mockRules[0]), {}, {
61
- userInputPrompts: mockRules[0].userInputs
62
- }), _objectSpread(_objectSpread({}, mockRules[1]), {}, {
63
- userInputPrompts: mockRules[1].userInputs
64
- }), _objectSpread(_objectSpread({}, mockRules[2]), {}, {
65
- userInputPrompts: mockRules[2].userInputs
61
+ };
62
+ export var mockTransformedRules = [_objectSpread(_objectSpread({}, mockRules.data[0]), {}, {
63
+ userInputPrompts: mockRules.data[0].userInputs
64
+ }), _objectSpread(_objectSpread({}, mockRules.data[1]), {}, {
65
+ userInputPrompts: mockRules.data[1].userInputs
66
+ }), _objectSpread(_objectSpread({}, mockRules.data[2]), {}, {
67
+ userInputPrompts: mockRules.data[2].userInputs
66
68
  })];
67
69
  export var mockInvocationResponse = {
68
70
  'TEST-1': 'SUCCESS'
@@ -3,8 +3,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
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 _regeneratorRuntime from "@babel/runtime/regenerator";
6
- import { getAutomationStack } from './stack-resolver';
7
-
8
6
  /**
9
7
  * This function will extract the cloud ID and product from a product level Site ARI.
10
8
  * ARIs can be found at the following link: {@link https://developer.atlassian.com/platform/atlassian-resource-identifier/resource-owners/registry/#ari-registry}
@@ -47,46 +45,40 @@ export var extractCloudIdAndProductFromSite = function extractCloudIdAndProductF
47
45
  *
48
46
  */
49
47
  export var getSearchUrl = /*#__PURE__*/function () {
50
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(env, site) {
51
- var _extractCloudIdAndPro, product, cloudId, automationStack;
48
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(site) {
49
+ var _extractCloudIdAndPro, product, cloudId;
52
50
  return _regeneratorRuntime.wrap(function _callee$(_context) {
53
51
  while (1) switch (_context.prev = _context.next) {
54
52
  case 0:
55
- _extractCloudIdAndPro = extractCloudIdAndProductFromSite(site), product = _extractCloudIdAndPro.product, cloudId = _extractCloudIdAndPro.cloudId;
56
- _context.next = 3;
57
- return getAutomationStack(env, cloudId);
58
- case 3:
59
- automationStack = _context.sent;
60
- return _context.abrupt("return", "/gateway/api/automation/internal-api/".concat(product, "/").concat(cloudId, "/").concat(automationStack, "/rest/v1/rules/manual/search"));
61
- case 5:
53
+ _extractCloudIdAndPro = extractCloudIdAndProductFromSite(site), product = _extractCloudIdAndPro.product, cloudId = _extractCloudIdAndPro.cloudId; // TODO in the unified API, GET requests as according to Atlassian API standards will destructure the whole query into
54
+ // query parameters as part of the URL. For now, this is considered a POST request instead and thus the query is used
55
+ // later on as the request body.
56
+ return _context.abrupt("return", "/gateway/api/automation/public/".concat(product, "/").concat(cloudId, "/rest/v1/rule/manual/search"));
57
+ case 2:
62
58
  case "end":
63
59
  return _context.stop();
64
60
  }
65
61
  }, _callee);
66
62
  }));
67
- return function getSearchUrl(_x, _x2) {
63
+ return function getSearchUrl(_x) {
68
64
  return _ref.apply(this, arguments);
69
65
  };
70
66
  }();
71
67
  export var getInvocationUrl = /*#__PURE__*/function () {
72
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(env, site, ruleId) {
73
- var _extractCloudIdAndPro2, product, cloudId, automationStack;
68
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(site, ruleId) {
69
+ var _extractCloudIdAndPro2, product, cloudId;
74
70
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
75
71
  while (1) switch (_context2.prev = _context2.next) {
76
72
  case 0:
77
73
  _extractCloudIdAndPro2 = extractCloudIdAndProductFromSite(site), product = _extractCloudIdAndPro2.product, cloudId = _extractCloudIdAndPro2.cloudId;
78
- _context2.next = 3;
79
- return getAutomationStack(env, cloudId);
80
- case 3:
81
- automationStack = _context2.sent;
82
- return _context2.abrupt("return", "/gateway/api/automation/internal-api/".concat(product, "/").concat(cloudId, "/").concat(automationStack, "/rest/v1/rules/manual/invocation/").concat(ruleId));
83
- case 5:
74
+ return _context2.abrupt("return", "/gateway/api/automation/public/".concat(product, "/").concat(cloudId, "/rest/v1/rule/manual/").concat(ruleId, "/invocation"));
75
+ case 2:
84
76
  case "end":
85
77
  return _context2.stop();
86
78
  }
87
79
  }, _callee2);
88
80
  }));
89
- return function getInvocationUrl(_x3, _x4, _x5) {
81
+ return function getInvocationUrl(_x2, _x3) {
90
82
  return _ref2.apply(this, arguments);
91
83
  };
92
84
  }();
@@ -94,30 +86,27 @@ var DEFAULT_HEADER = {
94
86
  'Content-Type': 'application/json'
95
87
  };
96
88
  var _performRequest = /*#__PURE__*/function () {
97
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(url, method) {
98
- var options,
99
- response,
100
- _args3 = arguments;
89
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(url, method, options) {
90
+ var response;
101
91
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
102
92
  while (1) switch (_context3.prev = _context3.next) {
103
93
  case 0:
104
- options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {
94
+ _context3.next = 2;
95
+ return fetch(url, _objectSpread(_objectSpread({
105
96
  headers: DEFAULT_HEADER
106
- };
107
- _context3.next = 3;
108
- return fetch(url, _objectSpread(_objectSpread({}, options), {}, {
97
+ }, options), {}, {
109
98
  method: method
110
99
  }));
111
- case 3:
100
+ case 2:
112
101
  response = _context3.sent;
113
102
  return _context3.abrupt("return", response.json());
114
- case 5:
103
+ case 4:
115
104
  case "end":
116
105
  return _context3.stop();
117
106
  }
118
107
  }, _callee3);
119
108
  }));
120
- return function _performRequest(_x6, _x7) {
109
+ return function _performRequest(_x4, _x5, _x6) {
121
110
  return _ref3.apply(this, arguments);
122
111
  };
123
112
  }();
@@ -133,7 +122,7 @@ export var performGetRequest = /*#__PURE__*/function () {
133
122
  }
134
123
  }, _callee4);
135
124
  }));
136
- return function performGetRequest(_x8, _x9) {
125
+ return function performGetRequest(_x7, _x8) {
137
126
  return _ref4.apply(this, arguments);
138
127
  };
139
128
  }();
@@ -149,29 +138,7 @@ export var performPostRequest = /*#__PURE__*/function () {
149
138
  }
150
139
  }, _callee5);
151
140
  }));
152
- return function performPostRequest(_x10, _x11) {
141
+ return function performPostRequest(_x9, _x10) {
153
142
  return _ref5.apply(this, arguments);
154
143
  };
155
- }();
156
-
157
- // TODO this will need to be expanded to resolve the correct product URL, too.
158
- // TODO for instance this will need to support Alerts UI URL resolution in the
159
- // TODO short term
160
- export var getBaseAutomationUrl = function getBaseAutomationUrl(_ref6) {
161
- var projectKey = _ref6.projectKey,
162
- projectType = _ref6.projectType,
163
- isSimplified = _ref6.isSimplified;
164
- /**
165
- * Confusing mapping of urls here.
166
- * Classic Projects - always under /automate
167
- * Next Gen Projects - under /automation for all project types except JSD
168
- */
169
- switch (projectType) {
170
- case 'service_desk':
171
- return "/jira/servicedesk/projects/".concat(projectKey, "/settings/automate");
172
- case 'business':
173
- return "/jira/core/projects/".concat(projectKey, "/settings/").concat(isSimplified ? 'automation' : 'automate');
174
- default:
175
- return "/jira/software/".concat(isSimplified ? '' : 'c/', "projects/").concat(projectKey, "/settings/").concat(isSimplified ? 'automation' : 'automate');
176
- }
177
- };
144
+ }();