@atlaskit/smart-card 26.69.1 → 26.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/extractors/flexible/actions/extract-automation-action.js +1 -1
- package/dist/cjs/messages.js +2 -2
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +2 -2
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/utils.js +31 -1
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +87 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +14 -78
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +8 -1
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/messages.js +64 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +78 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/test-utils.js +127 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.js +18 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +183 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +55 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +138 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +38 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +249 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.js +28 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/main.js +136 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/number-prompt/main.js +59 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/paragraph-prompt/main.js +49 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/select-prompt/main.js +52 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/text-prompt/main.js +38 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +95 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/index.js +14 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +74 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.js +18 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +70 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +39 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/empty-icon/index.js +136 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/main.js +93 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/error-icon/index.js +66 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +50 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +121 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +60 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/manual-trigger-icon/index.js +29 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.js +69 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/main.js +32 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/index.js +12 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/main.js +86 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +54 -12
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +11 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-automation-action.js +1 -1
- package/dist/es2019/messages.js +2 -2
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -3
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/utils.js +30 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +79 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +15 -80
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +5 -1
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/messages.js +58 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +71 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/test-utils.js +74 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.js +12 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +103 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +51 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +156 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.js +23 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/main.js +126 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/number-prompt/main.js +52 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/paragraph-prompt/main.js +44 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/select-prompt/main.js +45 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/text-prompt/main.js +31 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +53 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/index.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +62 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +61 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +32 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/empty-icon/index.js +127 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/main.js +89 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/error-icon/index.js +57 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +44 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +117 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +57 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/manual-trigger-icon/index.js +20 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.js +65 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/main.js +25 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/main.js +79 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +49 -11
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +8 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-automation-action.js +1 -1
- package/dist/esm/messages.js +2 -2
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +3 -3
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/utils.js +30 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +78 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +14 -75
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +5 -1
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/messages.js +58 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.js +71 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/test-utils.js +118 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.js +12 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.js +177 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.js +131 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.js +3 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.js +240 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.js +21 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/main.js +126 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/number-prompt/main.js +52 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/paragraph-prompt/main.js +42 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/select-prompt/main.js +45 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/text-prompt/main.js +31 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.js +89 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/index.js +3 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.js +64 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.js +61 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.js +30 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/empty-icon/index.js +129 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/main.js +86 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/error-icon/index.js +59 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.js +43 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.js +114 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +53 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/manual-trigger-icon/index.js +22 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.js +62 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/index.js +2 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/main.js +25 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/main.js +80 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +51 -11
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +11 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/utils.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/action-button.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +3 -3
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +2 -5
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/messages.d.ts +58 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/test-utils.d.ts +27 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.d.ts +94 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.d.ts +31 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.d.ts +52 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/main.d.ts +11 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/number-prompt/main.d.ts +12 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/paragraph-prompt/main.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/select-prompt/main.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/text-prompt/main.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.d.ts +17 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/index.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.d.ts +17 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +28 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/empty-icon/index.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/main.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/error-icon/index.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/manual-trigger-icon/index.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.d.ts +9 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/main.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/main.d.ts +7 -0
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/utils.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/action-button.d.ts +12 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +3 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +2 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +5 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/messages.d.ts +58 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/mocks.d.ts +6 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/test-utils.d.ts +27 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/types.d.ts +94 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/api.d.ts +31 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/common/utils/stack-resolver.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/main.d.ts +52 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/boolean-prompt/main.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/main.d.ts +11 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/number-prompt/main.d.ts +12 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/paragraph-prompt/main.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/select-prompt/main.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/manual-triggers-form/text-prompt/main.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-container/services/index.d.ts +17 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/index.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/main.d.ts +17 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/menu-context/main.d.ts +28 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/body/main.d.ts +8 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/empty-icon/index.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/empty-state/main.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/error-icon/index.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/error-state/main.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/footer/main.d.ts +8 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.d.ts +7 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/manual-trigger-icon/index.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.d.ts +9 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule-list/main.d.ts +8 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/skeleton/main.d.ts +7 -0
- package/package.json +9 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UserInputType = exports.SOFTWARE_PROJECT = exports.SERVICE_DESK_PROJECT = exports.PRODUCT_DISCOVERY_PROJECT = exports.CORE_PROJECT = void 0;
|
|
7
|
+
var UserInputType = exports.UserInputType = /*#__PURE__*/function (UserInputType) {
|
|
8
|
+
UserInputType["NUMBER"] = "NUMBER";
|
|
9
|
+
UserInputType["TEXT"] = "TEXT";
|
|
10
|
+
UserInputType["BOOLEAN"] = "BOOLEAN";
|
|
11
|
+
UserInputType["DROPDOWN"] = "DROPDOWN";
|
|
12
|
+
UserInputType["PARAGRAPH"] = "PARAGRAPH";
|
|
13
|
+
return UserInputType;
|
|
14
|
+
}({});
|
|
15
|
+
var CORE_PROJECT = exports.CORE_PROJECT = 'business';
|
|
16
|
+
var SOFTWARE_PROJECT = exports.SOFTWARE_PROJECT = 'software';
|
|
17
|
+
var SERVICE_DESK_PROJECT = exports.SERVICE_DESK_PROJECT = 'service_desk';
|
|
18
|
+
var PRODUCT_DISCOVERY_PROJECT = exports.PRODUCT_DISCOVERY_PROJECT = 'product_discovery';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.performPostRequest = exports.performGetRequest = exports.getSearchUrl = exports.getInvocationUrl = exports.getBaseAutomationUrl = exports.extractCloudIdAndProductFromSite = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _stackResolver = require("./stack-resolver");
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
/**
|
|
15
|
+
* This function will extract the cloud ID and product from a product level Site ARI.
|
|
16
|
+
* ARIs can be found at the following link: {@link https://developer.atlassian.com/platform/atlassian-resource-identifier/resource-owners/registry/#ari-registry}
|
|
17
|
+
* @param site The Site ARI where the manual trigger rule is executed. Should be a product level Site ARI.
|
|
18
|
+
*/
|
|
19
|
+
var extractCloudIdAndProductFromSite = exports.extractCloudIdAndProductFromSite = function extractCloudIdAndProductFromSite(site) {
|
|
20
|
+
var cloudId;
|
|
21
|
+
var resourceOwner;
|
|
22
|
+
var resourceType;
|
|
23
|
+
var ariRegex = new RegExp("^ari:cloud:([a-zA-Z.\\-]+)::([a-zA-Z.\\-]+)/([a-zA-Z0-9\\-]+)");
|
|
24
|
+
var parsedAri = site.match(ariRegex);
|
|
25
|
+
if (parsedAri) {
|
|
26
|
+
resourceOwner = parsedAri[1];
|
|
27
|
+
resourceType = parsedAri[2];
|
|
28
|
+
cloudId = parsedAri[3];
|
|
29
|
+
}
|
|
30
|
+
// Keep backwards compatibility for platform site ARIs
|
|
31
|
+
if (resourceOwner === 'platform') {
|
|
32
|
+
resourceOwner = 'jira';
|
|
33
|
+
}
|
|
34
|
+
if (resourceType !== 'site' || cloudId === undefined || resourceOwner === undefined) {
|
|
35
|
+
throw new Error('Not a site ARI: ' + site);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
product: resourceOwner,
|
|
39
|
+
cloudId: cloudId
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/***
|
|
44
|
+
* TODO remove when unified public API is available.
|
|
45
|
+
*
|
|
46
|
+
* Currently we're in a transitory phase where we have one API for invocation for Jira, and one for JSM. They concern themselves
|
|
47
|
+
* with issues and alerts respectively.
|
|
48
|
+
*
|
|
49
|
+
* We are working on a unified public API that only cares about product-agnostic filters like object, workspace, container as
|
|
50
|
+
* part of the collaboration model. For the meantime, you'll see two APIs instead. In this package, we're only using the
|
|
51
|
+
* alerts API. It is this API that will be expanded to retroactively support Jira, and thus the updated collaboration
|
|
52
|
+
* model language is used here, even though for the meantime we only concern ourselves with alerts.
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
var getSearchUrl = exports.getSearchUrl = /*#__PURE__*/function () {
|
|
56
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(env, site) {
|
|
57
|
+
var _extractCloudIdAndPro, product, cloudId, automationStack;
|
|
58
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
59
|
+
while (1) switch (_context.prev = _context.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
_extractCloudIdAndPro = extractCloudIdAndProductFromSite(site), product = _extractCloudIdAndPro.product, cloudId = _extractCloudIdAndPro.cloudId;
|
|
62
|
+
_context.next = 3;
|
|
63
|
+
return (0, _stackResolver.getAutomationStack)(env, cloudId);
|
|
64
|
+
case 3:
|
|
65
|
+
automationStack = _context.sent;
|
|
66
|
+
return _context.abrupt("return", "/gateway/api/automation/internal-api/".concat(product, "/").concat(cloudId, "/").concat(automationStack, "/rest/v1/rules/manual/search"));
|
|
67
|
+
case 5:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context.stop();
|
|
70
|
+
}
|
|
71
|
+
}, _callee);
|
|
72
|
+
}));
|
|
73
|
+
return function getSearchUrl(_x, _x2) {
|
|
74
|
+
return _ref.apply(this, arguments);
|
|
75
|
+
};
|
|
76
|
+
}();
|
|
77
|
+
var getInvocationUrl = exports.getInvocationUrl = /*#__PURE__*/function () {
|
|
78
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(env, site, ruleId) {
|
|
79
|
+
var _extractCloudIdAndPro2, product, cloudId, automationStack;
|
|
80
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
81
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
_extractCloudIdAndPro2 = extractCloudIdAndProductFromSite(site), product = _extractCloudIdAndPro2.product, cloudId = _extractCloudIdAndPro2.cloudId;
|
|
84
|
+
_context2.next = 3;
|
|
85
|
+
return (0, _stackResolver.getAutomationStack)(env, cloudId);
|
|
86
|
+
case 3:
|
|
87
|
+
automationStack = _context2.sent;
|
|
88
|
+
return _context2.abrupt("return", "/gateway/api/automation/internal-api/".concat(product, "/").concat(cloudId, "/").concat(automationStack, "/rest/v1/rules/manual/invocation/").concat(ruleId));
|
|
89
|
+
case 5:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context2.stop();
|
|
92
|
+
}
|
|
93
|
+
}, _callee2);
|
|
94
|
+
}));
|
|
95
|
+
return function getInvocationUrl(_x3, _x4, _x5) {
|
|
96
|
+
return _ref2.apply(this, arguments);
|
|
97
|
+
};
|
|
98
|
+
}();
|
|
99
|
+
var DEFAULT_HEADER = {
|
|
100
|
+
'Content-Type': 'application/json'
|
|
101
|
+
};
|
|
102
|
+
var _performRequest = /*#__PURE__*/function () {
|
|
103
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(url, method) {
|
|
104
|
+
var options,
|
|
105
|
+
response,
|
|
106
|
+
_args3 = arguments;
|
|
107
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
108
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {
|
|
111
|
+
headers: DEFAULT_HEADER
|
|
112
|
+
};
|
|
113
|
+
_context3.next = 3;
|
|
114
|
+
return fetch(url, _objectSpread(_objectSpread({}, options), {}, {
|
|
115
|
+
method: method
|
|
116
|
+
}));
|
|
117
|
+
case 3:
|
|
118
|
+
response = _context3.sent;
|
|
119
|
+
return _context3.abrupt("return", response.json());
|
|
120
|
+
case 5:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context3.stop();
|
|
123
|
+
}
|
|
124
|
+
}, _callee3);
|
|
125
|
+
}));
|
|
126
|
+
return function _performRequest(_x6, _x7) {
|
|
127
|
+
return _ref3.apply(this, arguments);
|
|
128
|
+
};
|
|
129
|
+
}();
|
|
130
|
+
var performGetRequest = exports.performGetRequest = /*#__PURE__*/function () {
|
|
131
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(url, options) {
|
|
132
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
133
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
134
|
+
case 0:
|
|
135
|
+
return _context4.abrupt("return", _performRequest(url, 'GET', options));
|
|
136
|
+
case 1:
|
|
137
|
+
case "end":
|
|
138
|
+
return _context4.stop();
|
|
139
|
+
}
|
|
140
|
+
}, _callee4);
|
|
141
|
+
}));
|
|
142
|
+
return function performGetRequest(_x8, _x9) {
|
|
143
|
+
return _ref4.apply(this, arguments);
|
|
144
|
+
};
|
|
145
|
+
}();
|
|
146
|
+
var performPostRequest = exports.performPostRequest = /*#__PURE__*/function () {
|
|
147
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(url, options) {
|
|
148
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
149
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
return _context5.abrupt("return", _performRequest(url, 'POST', options));
|
|
152
|
+
case 1:
|
|
153
|
+
case "end":
|
|
154
|
+
return _context5.stop();
|
|
155
|
+
}
|
|
156
|
+
}, _callee5);
|
|
157
|
+
}));
|
|
158
|
+
return function performPostRequest(_x10, _x11) {
|
|
159
|
+
return _ref5.apply(this, arguments);
|
|
160
|
+
};
|
|
161
|
+
}();
|
|
162
|
+
|
|
163
|
+
// TODO this will need to be expanded to resolve the correct product URL, too.
|
|
164
|
+
// TODO for instance this will need to support Alerts UI URL resolution in the
|
|
165
|
+
// TODO short term
|
|
166
|
+
var getBaseAutomationUrl = exports.getBaseAutomationUrl = function getBaseAutomationUrl(_ref6) {
|
|
167
|
+
var projectKey = _ref6.projectKey,
|
|
168
|
+
projectType = _ref6.projectType,
|
|
169
|
+
isSimplified = _ref6.isSimplified;
|
|
170
|
+
/**
|
|
171
|
+
* Confusing mapping of urls here.
|
|
172
|
+
* Classic Projects - always under /automate
|
|
173
|
+
* Next Gen Projects - under /automation for all project types except JSD
|
|
174
|
+
*/
|
|
175
|
+
switch (projectType) {
|
|
176
|
+
case 'service_desk':
|
|
177
|
+
return "/jira/servicedesk/projects/".concat(projectKey, "/settings/automate");
|
|
178
|
+
case 'business':
|
|
179
|
+
return "/jira/core/projects/".concat(projectKey, "/settings/").concat(isSimplified ? 'automation' : 'automate');
|
|
180
|
+
default:
|
|
181
|
+
return "/jira/software/".concat(isSimplified ? '' : 'c/', "projects/").concat(projectKey, "/settings/").concat(isSimplified ? 'automation' : 'automate');
|
|
182
|
+
}
|
|
183
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "extractCloudIdAndProductFromSite", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _api.extractCloudIdAndProductFromSite;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getAutomationStack", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _stackResolver.getAutomationStack;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getAutomationStackFromLocalStorage", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _stackResolver.getAutomationStackFromLocalStorage;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getBaseAutomationUrl", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _api.getBaseAutomationUrl;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "getInvocationUrl", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _api.getInvocationUrl;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "getSearchUrl", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _api.getSearchUrl;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "performGetRequest", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _api.performGetRequest;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "performPostRequest", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _api.performPostRequest;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var _api = require("./api");
|
|
55
|
+
var _stackResolver = require("./stack-resolver");
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getAutomationStackFromLocalStorage = exports.getAutomationStack = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var AUTOMATION_LOCAL_STORAGE_PREFIX = 'automationPlatform';
|
|
12
|
+
var AUTOMATION_LOCAL_STORAGE_STACK = 'automationStack';
|
|
13
|
+
var AUTOMATION_DEV_STACK_URL = 'https://localhost:8082/devStack.json';
|
|
14
|
+
var getAutomationProdStackUrl = function getAutomationProdStackUrl(cloudId) {
|
|
15
|
+
return "/gateway/api/automation/internal-api/jira/".concat(cloudId, "/pro/rest/environments");
|
|
16
|
+
};
|
|
17
|
+
var getLatestPreProdStack = /*#__PURE__*/function () {
|
|
18
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(cloudId) {
|
|
19
|
+
var response, stacksResponse, preProdStacks, _preProdStacks, _preProdStacks$, latestPreProdStack;
|
|
20
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
_context.prev = 0;
|
|
24
|
+
_context.next = 3;
|
|
25
|
+
return fetch(getAutomationProdStackUrl(cloudId));
|
|
26
|
+
case 3:
|
|
27
|
+
response = _context.sent;
|
|
28
|
+
_context.next = 6;
|
|
29
|
+
return response.json();
|
|
30
|
+
case 6:
|
|
31
|
+
stacksResponse = _context.sent;
|
|
32
|
+
preProdStacks = stacksResponse.prod.otherStacks.filter(function (_ref2) {
|
|
33
|
+
var releasedSuccessfully = _ref2.releasedSuccessfully;
|
|
34
|
+
return !releasedSuccessfully;
|
|
35
|
+
}).map(function (_ref3) {
|
|
36
|
+
var stack = _ref3.stack;
|
|
37
|
+
return stack;
|
|
38
|
+
});
|
|
39
|
+
_preProdStacks = (0, _slicedToArray2.default)(preProdStacks, 1), _preProdStacks$ = _preProdStacks[0], latestPreProdStack = _preProdStacks$ === void 0 ? null : _preProdStacks$;
|
|
40
|
+
return _context.abrupt("return", latestPreProdStack);
|
|
41
|
+
case 12:
|
|
42
|
+
_context.prev = 12;
|
|
43
|
+
_context.t0 = _context["catch"](0);
|
|
44
|
+
// eslint-disable-next-line no-console
|
|
45
|
+
console.warn("Failed to fetch pre-prod stack from ".concat(getAutomationProdStackUrl(cloudId), " with error: ").concat(_context.t0));
|
|
46
|
+
return _context.abrupt("return", null);
|
|
47
|
+
case 16:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context.stop();
|
|
50
|
+
}
|
|
51
|
+
}, _callee, null, [[0, 12]]);
|
|
52
|
+
}));
|
|
53
|
+
return function getLatestPreProdStack(_x) {
|
|
54
|
+
return _ref.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}();
|
|
57
|
+
var _getAutomationKeyFromLocalStorage = function _getAutomationKeyFromLocalStorage(key) {
|
|
58
|
+
return window.localStorage.getItem("".concat(AUTOMATION_LOCAL_STORAGE_PREFIX, ":").concat(key));
|
|
59
|
+
};
|
|
60
|
+
var getAutomationDevStackFromLocalServer = /*#__PURE__*/function () {
|
|
61
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
62
|
+
var devStackResponse, devStack;
|
|
63
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
64
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
65
|
+
case 0:
|
|
66
|
+
_context2.prev = 0;
|
|
67
|
+
_context2.next = 3;
|
|
68
|
+
return fetch(AUTOMATION_DEV_STACK_URL);
|
|
69
|
+
case 3:
|
|
70
|
+
devStackResponse = _context2.sent;
|
|
71
|
+
_context2.next = 6;
|
|
72
|
+
return devStackResponse.json();
|
|
73
|
+
case 6:
|
|
74
|
+
devStack = _context2.sent;
|
|
75
|
+
return _context2.abrupt("return", devStack.name);
|
|
76
|
+
case 10:
|
|
77
|
+
_context2.prev = 10;
|
|
78
|
+
_context2.t0 = _context2["catch"](0);
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console.warn("Failed to fetch dev stack from ".concat(AUTOMATION_DEV_STACK_URL, " with error: ").concat(_context2.t0));
|
|
81
|
+
return _context2.abrupt("return", null);
|
|
82
|
+
case 14:
|
|
83
|
+
case "end":
|
|
84
|
+
return _context2.stop();
|
|
85
|
+
}
|
|
86
|
+
}, _callee2, null, [[0, 10]]);
|
|
87
|
+
}));
|
|
88
|
+
return function getAutomationDevStackFromLocalServer() {
|
|
89
|
+
return _ref4.apply(this, arguments);
|
|
90
|
+
};
|
|
91
|
+
}();
|
|
92
|
+
var getAutomationStackFromLocalStorage = exports.getAutomationStackFromLocalStorage = function getAutomationStackFromLocalStorage() {
|
|
93
|
+
return _getAutomationKeyFromLocalStorage(AUTOMATION_LOCAL_STORAGE_STACK);
|
|
94
|
+
};
|
|
95
|
+
var getAutomationStack = exports.getAutomationStack = /*#__PURE__*/function () {
|
|
96
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(env, cloudId) {
|
|
97
|
+
var stack, stackOverride;
|
|
98
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
99
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
100
|
+
case 0:
|
|
101
|
+
if (!(env === 'prod')) {
|
|
102
|
+
_context3.next = 2;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
return _context3.abrupt("return", 'pro');
|
|
106
|
+
case 2:
|
|
107
|
+
if (!(env === 'pre-prod')) {
|
|
108
|
+
_context3.next = 7;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
_context3.next = 5;
|
|
112
|
+
return getLatestPreProdStack(cloudId);
|
|
113
|
+
case 5:
|
|
114
|
+
stack = _context3.sent;
|
|
115
|
+
return _context3.abrupt("return", stack !== null && stack !== void 0 ? stack : 'pro');
|
|
116
|
+
case 7:
|
|
117
|
+
_context3.next = 9;
|
|
118
|
+
return getAutomationDevStackFromLocalServer();
|
|
119
|
+
case 9:
|
|
120
|
+
_context3.t0 = _context3.sent;
|
|
121
|
+
if (_context3.t0) {
|
|
122
|
+
_context3.next = 12;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
_context3.t0 = getAutomationStackFromLocalStorage();
|
|
126
|
+
case 12:
|
|
127
|
+
stackOverride = _context3.t0;
|
|
128
|
+
return _context3.abrupt("return", stackOverride || 'staging');
|
|
129
|
+
case 14:
|
|
130
|
+
case "end":
|
|
131
|
+
return _context3.stop();
|
|
132
|
+
}
|
|
133
|
+
}, _callee3);
|
|
134
|
+
}));
|
|
135
|
+
return function getAutomationStack(_x2, _x3) {
|
|
136
|
+
return _ref5.apply(this, arguments);
|
|
137
|
+
};
|
|
138
|
+
}();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ManualRulesContainer", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _main.ManualRulesContainer;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "getBaseAutomationUrl", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _utils.getBaseAutomationUrl;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "invokeManuallyTriggeredRule", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _services.invokeManuallyTriggeredRule;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "searchManuallyTriggeredRules", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _services.searchManuallyTriggeredRules;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "useManualRules", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _main.useManualRules;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _services = require("./services");
|
|
37
|
+
var _utils = require("./common/utils");
|
|
38
|
+
var _main = require("./main");
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useManualRules = exports.ManualRulesContainer = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _reactMagneticDi = require("react-magnetic-di");
|
|
15
|
+
var _modalDialog = require("@atlaskit/modal-dialog");
|
|
16
|
+
var _services = require("./services");
|
|
17
|
+
var _main = _interopRequireDefault(require("./manual-triggers-form/main"));
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
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; }
|
|
21
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
+
/**
|
|
23
|
+
* React hook that implements the fetch and invoke actions for manual triggers.
|
|
24
|
+
* Can be used standalone or in the HOC provided below.
|
|
25
|
+
* @param env - The environment to retrieve rules from
|
|
26
|
+
* @param site - The site to filter on. We map this to just a cloudId to resolve the manual rules API path
|
|
27
|
+
* @param query - Query object containing filter props (container, object(s))
|
|
28
|
+
*/
|
|
29
|
+
var useManualRules = exports.useManualRules = function useManualRules(env, site, query) {
|
|
30
|
+
var _useState = (0, _react.useState)(false),
|
|
31
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
32
|
+
initialised = _useState2[0],
|
|
33
|
+
setInitialised = _useState2[1];
|
|
34
|
+
var _useState3 = (0, _react.useState)(null),
|
|
35
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
36
|
+
error = _useState4[0],
|
|
37
|
+
setError = _useState4[1];
|
|
38
|
+
var _useState5 = (0, _react.useState)([]),
|
|
39
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
40
|
+
rules = _useState6[0],
|
|
41
|
+
setRules = _useState6[1];
|
|
42
|
+
var transformRules = function transformRules(ruleResponse) {
|
|
43
|
+
var rulesUnsorted = Object.values(ruleResponse);
|
|
44
|
+
return rulesUnsorted.sort(function (rule1, rule2) {
|
|
45
|
+
return rule1.name.localeCompare(rule2.name);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
var triggerFetch = /*#__PURE__*/function () {
|
|
49
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
50
|
+
var fetchedRules;
|
|
51
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
52
|
+
while (1) switch (_context.prev = _context.next) {
|
|
53
|
+
case 0:
|
|
54
|
+
setInitialised(false);
|
|
55
|
+
_context.prev = 1;
|
|
56
|
+
_context.next = 4;
|
|
57
|
+
return (0, _services.searchManuallyTriggeredRules)(env, site, query);
|
|
58
|
+
case 4:
|
|
59
|
+
fetchedRules = _context.sent;
|
|
60
|
+
setError(null);
|
|
61
|
+
setRules(transformRules(fetchedRules));
|
|
62
|
+
_context.next = 13;
|
|
63
|
+
break;
|
|
64
|
+
case 9:
|
|
65
|
+
_context.prev = 9;
|
|
66
|
+
_context.t0 = _context["catch"](1);
|
|
67
|
+
setError(_context.t0);
|
|
68
|
+
setRules([]);
|
|
69
|
+
case 13:
|
|
70
|
+
_context.prev = 13;
|
|
71
|
+
setInitialised(true);
|
|
72
|
+
return _context.finish(13);
|
|
73
|
+
case 16:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context.stop();
|
|
76
|
+
}
|
|
77
|
+
}, _callee, null, [[1, 9, 13, 16]]);
|
|
78
|
+
}));
|
|
79
|
+
return function triggerFetch() {
|
|
80
|
+
return _ref.apply(this, arguments);
|
|
81
|
+
};
|
|
82
|
+
}();
|
|
83
|
+
return [triggerFetch, initialised, error, rules];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* Container HOC that implements the above hook and behaviours.
|
|
88
|
+
*
|
|
89
|
+
* This HOC uses rendered props to allow the use of any render instructions
|
|
90
|
+
* for manual rules, while still maintaining the behaviour of invoking rules.
|
|
91
|
+
*
|
|
92
|
+
* The HOC also appends a dialog that is displayed when the {@code invokeRuleOrShowDialog}
|
|
93
|
+
* prop is called, if the underlying rule has user inputs.
|
|
94
|
+
*
|
|
95
|
+
* The component exposes the "invokingRuleId" property to the child hierarchy,
|
|
96
|
+
* because the children might care about the invocation state. It does not expose
|
|
97
|
+
* the "selected" state, or any information about the dialog, as the children
|
|
98
|
+
* should not care about this, only how to trigger invocation and understand
|
|
99
|
+
* the invocation lifecycle.
|
|
100
|
+
*
|
|
101
|
+
* @param props - environment, cloudId, projectId, children
|
|
102
|
+
*/
|
|
103
|
+
var ManualRulesContainer = exports.ManualRulesContainer = function ManualRulesContainer(props) {
|
|
104
|
+
var env = props.env,
|
|
105
|
+
site = props.site,
|
|
106
|
+
query = props.query,
|
|
107
|
+
children = props.children,
|
|
108
|
+
onInputsModalOpened = props.onInputsModalOpened,
|
|
109
|
+
onInputsModalClosed = props.onInputsModalClosed,
|
|
110
|
+
onRuleInvocationLifecycleStarted = props.onRuleInvocationLifecycleStarted,
|
|
111
|
+
onRuleInvocationSuccess = props.onRuleInvocationSuccess,
|
|
112
|
+
onRuleInvocationFailure = props.onRuleInvocationFailure,
|
|
113
|
+
onRuleInvocationLifecycleDone = props.onRuleInvocationLifecycleDone;
|
|
114
|
+
// Initial data loading state
|
|
115
|
+
var _useManualRules = useManualRules(env, site, query),
|
|
116
|
+
_useManualRules2 = (0, _slicedToArray2.default)(_useManualRules, 4),
|
|
117
|
+
triggerFetch = _useManualRules2[0],
|
|
118
|
+
initialised = _useManualRules2[1],
|
|
119
|
+
error = _useManualRules2[2],
|
|
120
|
+
rules = _useManualRules2[3];
|
|
121
|
+
// We store a rule in state here if and only if a rule has user inputs, and thus
|
|
122
|
+
// we need to preserve state while the input dialog is open.
|
|
123
|
+
var _useState7 = (0, _react.useState)(null),
|
|
124
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
125
|
+
selectedRule = _useState8[0],
|
|
126
|
+
setSelectedRule = _useState8[1];
|
|
127
|
+
var clearSelectedRule = function clearSelectedRule() {
|
|
128
|
+
setSelectedRule(null);
|
|
129
|
+
};
|
|
130
|
+
// Value set when a rule is invoking, either from the dialog or without dialog
|
|
131
|
+
var _useState9 = (0, _react.useState)(null),
|
|
132
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
133
|
+
invokingRuleId = _useState10[0],
|
|
134
|
+
setInvokingRuleId = _useState10[1];
|
|
135
|
+
|
|
136
|
+
// Memoized projection of rules by id
|
|
137
|
+
var rulesById = (0, _react.useMemo)(function () {
|
|
138
|
+
return rules.reduce(function (acc, rule) {
|
|
139
|
+
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, rule.id, rule));
|
|
140
|
+
}, {});
|
|
141
|
+
}, [rules]);
|
|
142
|
+
var getRule = function getRule(id) {
|
|
143
|
+
return rulesById[id];
|
|
144
|
+
};
|
|
145
|
+
var ruleHasInputs = function ruleHasInputs(rule) {
|
|
146
|
+
var _rule$userInputPrompt;
|
|
147
|
+
return (rule === null || rule === void 0 || (_rule$userInputPrompt = rule.userInputPrompts) === null || _rule$userInputPrompt === void 0 ? void 0 : _rule$userInputPrompt.length) > 0;
|
|
148
|
+
};
|
|
149
|
+
var getFailedObjects = function getFailedObjects(response) {
|
|
150
|
+
return Object.keys(response).filter(function (object) {
|
|
151
|
+
return response[object] !== 'SUCCESS';
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
var getSuccessfulObjects = function getSuccessfulObjects(response) {
|
|
155
|
+
return Object.keys(response).filter(function (object) {
|
|
156
|
+
return response[object] === 'SUCCESS';
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
var handleInvocationFailure = function handleInvocationFailure(ruleId, successfulObjects, failedObjects) {
|
|
160
|
+
if (onRuleInvocationFailure) {
|
|
161
|
+
onRuleInvocationFailure(ruleId, successfulObjects, failedObjects);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var invokeRule = /*#__PURE__*/function () {
|
|
165
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(ruleId, objects, userInputs) {
|
|
166
|
+
var rule, response, _failedObjects, successfulObjects;
|
|
167
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
168
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
169
|
+
case 0:
|
|
170
|
+
rule = getRule(ruleId);
|
|
171
|
+
if (!rule) {
|
|
172
|
+
_context2.next = 19;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
setInvokingRuleId(ruleId);
|
|
176
|
+
_context2.prev = 3;
|
|
177
|
+
if (onRuleInvocationLifecycleStarted) {
|
|
178
|
+
onRuleInvocationLifecycleStarted(ruleId, objects, userInputs);
|
|
179
|
+
}
|
|
180
|
+
_context2.next = 7;
|
|
181
|
+
return (0, _services.invokeManuallyTriggeredRule)(env, site, ruleId, objects, userInputs);
|
|
182
|
+
case 7:
|
|
183
|
+
response = _context2.sent;
|
|
184
|
+
_failedObjects = getFailedObjects(response);
|
|
185
|
+
setInvokingRuleId(null);
|
|
186
|
+
if (_failedObjects.length === 0) {
|
|
187
|
+
if (onRuleInvocationSuccess) {
|
|
188
|
+
onRuleInvocationSuccess(ruleId, objects);
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
successfulObjects = getSuccessfulObjects(response);
|
|
192
|
+
handleInvocationFailure(ruleId, successfulObjects, _failedObjects);
|
|
193
|
+
}
|
|
194
|
+
_context2.next = 17;
|
|
195
|
+
break;
|
|
196
|
+
case 13:
|
|
197
|
+
_context2.prev = 13;
|
|
198
|
+
_context2.t0 = _context2["catch"](3);
|
|
199
|
+
handleInvocationFailure(ruleId, [], objects);
|
|
200
|
+
setInvokingRuleId(null);
|
|
201
|
+
case 17:
|
|
202
|
+
_context2.next = 20;
|
|
203
|
+
break;
|
|
204
|
+
case 19:
|
|
205
|
+
handleInvocationFailure(ruleId, [], objects);
|
|
206
|
+
case 20:
|
|
207
|
+
clearSelectedRule();
|
|
208
|
+
if (onRuleInvocationLifecycleDone) {
|
|
209
|
+
onRuleInvocationLifecycleDone(ruleId, objects);
|
|
210
|
+
}
|
|
211
|
+
case 22:
|
|
212
|
+
case "end":
|
|
213
|
+
return _context2.stop();
|
|
214
|
+
}
|
|
215
|
+
}, _callee2, null, [[3, 13]]);
|
|
216
|
+
}));
|
|
217
|
+
return function invokeRule(_x, _x2, _x3) {
|
|
218
|
+
return _ref2.apply(this, arguments);
|
|
219
|
+
};
|
|
220
|
+
}();
|
|
221
|
+
var invokeRuleOrShowDialog = function invokeRuleOrShowDialog(ruleId, objects) {
|
|
222
|
+
var rule = getRule(ruleId);
|
|
223
|
+
if (!rule) {
|
|
224
|
+
return handleInvocationFailure(ruleId, [], objects);
|
|
225
|
+
}
|
|
226
|
+
if (ruleHasInputs(rule)) {
|
|
227
|
+
setSelectedRule({
|
|
228
|
+
rule: rule,
|
|
229
|
+
objects: objects
|
|
230
|
+
});
|
|
231
|
+
} else {
|
|
232
|
+
invokeRule(ruleId, objects);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children({
|
|
236
|
+
triggerFetch: triggerFetch,
|
|
237
|
+
initialised: initialised,
|
|
238
|
+
error: error,
|
|
239
|
+
rules: rules,
|
|
240
|
+
invokingRuleId: invokingRuleId,
|
|
241
|
+
invokeRuleOrShowDialog: invokeRuleOrShowDialog
|
|
242
|
+
}), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTransition, null, selectedRule && /*#__PURE__*/_react.default.createElement(_main.default, {
|
|
243
|
+
onInputsModalOpened: onInputsModalOpened,
|
|
244
|
+
onInputsModalClosed: onInputsModalClosed,
|
|
245
|
+
clearSelectedRule: clearSelectedRule,
|
|
246
|
+
selectedRule: selectedRule,
|
|
247
|
+
invokeRule: invokeRule
|
|
248
|
+
})));
|
|
249
|
+
};
|