@zohodesk/library-platform 1.1.10-exp.1 → 1.1.10-exp.3
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/es/.DS_Store +0 -0
- package/es/bc/app-context/Properties.js +12 -2
- package/es/bc/sdk/ResourceNamesEnum.js +1 -0
- package/es/bc/zform/Constants.js +11 -1
- package/es/bc/zform/Properties.js +29 -33
- package/es/bc/zform/Symbol.js +1 -3
- package/es/bc/zlist/Properties.js +0 -51
- package/es/bc/zrecord/Constants.js +1 -0
- package/es/cc/fields/currency/Properties.js +2 -1
- package/es/cc/fields/field/Properties.js +14 -8
- package/es/cc/fields/lookup/Properties.js +34 -1
- package/es/cc/fields/text/Properties.js +0 -9
- package/es/cc/form/Properties.js +8 -0
- package/es/cc/form-connected/ExternalConstants.js +3 -0
- package/es/cc/form-connected/Properties.js +19 -11
- package/es/cc/table-connected/SdkContract.js +14 -0
- package/es/cc/table-connected/constants/Events.js +2 -1
- package/es/cc/table-list/row/Properties.js +8 -0
- package/es/index.js +13 -3
- package/es/library/analytics/Analytics.js +36 -0
- package/es/library/analytics/AnalyticsContract.js +13 -0
- package/es/library/analytics/index.js +2 -0
- package/es/library/custom-component/adapters/controllers/Controller.js +9 -0
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +4 -0
- package/es/library/custom-component/adapters/gateways/service/Service.js +2 -0
- package/es/library/custom-component/applications/entities-factory/ComponentFactory.js +12 -9
- package/es/library/custom-component/applications/usecases/DispatchUseCase.js +28 -5
- package/es/library/custom-component/applications/usecases/InitializeUseCase.js +5 -4
- package/es/library/custom-component/applications/usecases/MountUseCase.js +10 -6
- package/es/library/custom-component/applications/usecases/UnmountUseCase.js +6 -5
- package/es/library/custom-component/applications/usecases/UpdatePropertyUseCase.js +23 -18
- package/es/library/custom-component/applications/usecases/UpdateStateUseCase.js +4 -3
- package/es/library/custom-component/domain/entities/Behaviour.js +4 -0
- package/es/library/custom-component/domain/entities/Component.js +89 -83
- package/es/library/custom-component/domain/entities/Properties.js +10 -137
- package/es/library/custom-component/domain/entities/Property.js +29 -0
- package/es/library/custom-component/frameworks/json-schema-validator/Validator.js +65 -28
- package/es/library/custom-component/frameworks/ui/CreateCustomComponent.js +26 -13
- package/es/library/custom-component/frameworks/ui/DependencyFactory.js +1 -2
- package/es/library/dot/components/action-location/frameworks/ui/ActionComponentMapping.js +2 -1
- package/es/library/dot/components/form/adapters/presenter/TransformState.js +3 -1
- package/es/library/dot/components/form/frameworks/ui/DefaultComponentRegister.js +10 -2
- package/es/library/dot/components/form/frameworks/ui/Form.js +2 -0
- package/es/library/dot/components/form/frameworks/ui/FormView.js +8 -4
- package/es/library/dot/components/form/frameworks/ui/sub-components/Footer.js +7 -4
- package/es/library/dot/components/form/frameworks/ui/sub-components/Header.js +7 -4
- package/es/library/dot/components/form-fields/currency/frameworks/ui/Currency.js +3 -3
- package/es/library/dot/components/form-fields/lookup/frameworks/ui/Lookup.js +1 -1
- package/es/library/dot/components/section/frameworks/ui/SectionView.js +12 -4
- package/es/library/dot/components/section/frameworks/ui/css/Section.module.css +3 -0
- package/es/library/dot/components/table-list/frameworks/ui/TableListView.js +14 -7
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/ErrorState.js +4 -7
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Header.js +9 -6
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/Rows.js +6 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +6 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/Headers.js +4 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/MassAction.js +6 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Columns.js +4 -2
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/Row.js +14 -7
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowActions.js +5 -4
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowData.js +5 -3
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/row/RowSelection.js +32 -7
- package/es/library/dot/legacy-to-new-arch/breadcrumb/frameworks/ui/sub-components/BreadcrumbItem.js +1 -1
- package/es/library/dot/legacy-to-new-arch/button/frameworks/ui/ButtonView.js +2 -2
- package/es/library/dot/legacy-to-new-arch/date/frameworks/ui/DateView.js +4 -4
- package/es/library/dot/legacy-to-new-arch/label/frameworks/ui/LabelView.js +2 -2
- package/es/library/dot/legacy-to-new-arch/multi-select/frameworks/ui/MultiSelectView.js +2 -2
- package/es/library/dot/legacy-to-new-arch/select/frameworks/ui/SelectView.js +2 -2
- package/es/library/dot/legacy-to-new-arch/table-field-components/index.js +1 -0
- package/es/library/dot/legacy-to-new-arch/text/frameworks/ui/TextView.js +1 -1
- package/es/library/dot/legacy-to-new-arch/text-area/frameworks/ui/TextAreaView.js +2 -2
- package/es/library/dot/legacy-to-new-arch/textbox/frameworks/ui/TextBoxView.js +2 -2
- package/es/platform/.DS_Store +0 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/usecases/SetClientActionsUseCase.js +6 -1
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActionManager.js +58 -19
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/ClientActions.js +8 -8
- package/es/platform/client-actions/behaviour/zclient-actions/domain/entities/interfaces/IClientActionFetchResponse.js +0 -0
- package/es/platform/client-actions/cc/action-event-mediator/Properties.js +75 -3
- package/es/platform/client-actions/components/action-event-mediator/adapters/controllers/MountController.js +1 -1
- package/es/platform/client-actions/components/action-event-mediator/adapters/controllers/PropertiesChangeController.js +2 -2
- package/es/platform/client-actions/components/action-event-mediator/adapters/gateway/Repository.js +2 -2
- package/es/platform/client-actions/components/action-event-mediator/applications/usecases/InitializeUseCase.js +15 -1
- package/es/platform/client-actions/components/action-event-mediator/applications/usecases/PropertiesChangeUseCase.js +3 -3
- package/es/platform/client-actions/components/action-event-mediator/domain/entities/ActionEventMediatorEntity.js +41 -24
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediator.js +3 -1
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ActionEventMediatorView.js +31 -14
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/ClientActionsAdapter.js +2 -48
- package/es/platform/client-actions/components/action-event-mediator/frameworks/ui/EventHandlersFactory.js +3 -11
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/AdaptiveRowActions/AdaptiveRowActionsRenderer.js +12 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/AdaptiveRowActions/AdaptiveRowActionsRendererView.js +42 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/MoreActions/MoreActionsRenderer.js +10 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/MoreActions/MoreActionsRendererView.js +79 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRenderer.js +12 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRenderer.module.css +19 -0
- package/es/platform/client-actions/components/row-actions-renderer/frameworks/ui/RowActions/RowActionsRendererView.js +37 -0
- package/es/platform/client-actions/translators/client-actions-translator/index.js +14 -2
- package/es/platform/client-actions/translators/condition-resolver/index.js +6 -1
- package/es/platform/client-scripts/bc/zclient-scripts-execution/Constants.js +11 -0
- package/es/platform/client-scripts/bc/zclient-scripts-execution/EventHandlers.js +1 -0
- package/es/platform/client-scripts/bc/zclient-scripts-fetch/Constants.js +11 -0
- package/es/platform/client-scripts/bc/zclient-scripts-fetch/EventHandlers.js +1 -0
- package/es/platform/{app-context-behaviour → client-scripts/behaviour/zclient-scripts-execution}/adapters/controllers/AbstractController.js +2 -1
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/adapters/controllers/ClientScriptExecutionController.js +10 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/adapters/controllers/SetClientScriptsMappingController.js +10 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/adapters/gateways/Repository.js +24 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/adapters/gateways/Service.js +9 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/adapters/presenters/Presenter.js +21 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/applications/interfaces/gateways/IService.js +0 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/applications/usecases/AbstractUseCase.js +15 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/applications/usecases/ExecuteClientScriptsUseCase.js +23 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/applications/usecases/SetClientScriptsMappingUseCase.js +16 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/domain/entities/ClientScriptExecutor.js +142 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/domain/entities/types/ClientScriptExectionTypeDefintions.js +7 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/frameworks/ClientScriptsExecutionBehaviourFactory.js +12 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/frameworks/ClientScriptsExecutionHandlersFactory.js +30 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-execution/frameworks/ClientScriptsUtils.js +25 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/AbstractController.js +8 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/FetchClientScriptsController.js +27 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/FetchClientScriptsFailureController.js +28 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/FetchClientScriptsNoContentController.js +23 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/FetchClientScriptsStopController.js +21 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/FetchClientScriptsSuccessController.js +28 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/MountController.js +22 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/controllers/SetClientScriptsController.js +24 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/gateways/Repository.js +22 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/gateways/Service.js +19 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/presenters/Presenter.js +16 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/entities-factory/ClientScriptsFactory.js +11 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/entities-factory/ClientScriptsManagerFactory.js +10 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/gateways/IService.js +0 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/AbstractUseCase.js +17 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/FetchClientScriptUseCase.js +33 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/FetchClientScriptsFailureUseCase.js +22 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/FetchClientScriptsNoContentUseCase.js +27 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/FetchClientScriptsStopUseCase.js +25 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/FetchClientScriptsSuccessUseCase.js +22 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/InitializeUseCase.js +17 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/usecases/SetClientScriptsUseCase.js +21 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/ClientScript.js +24 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/ClientScripts.js +41 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/GetClientScriptsStrategy.js +44 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/State.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/interfaces/ClientScriptEventMappingState.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/interfaces/ClientScriptModel.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/interfaces/ClientScriptsModel.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/interfaces/IClientScript.js +0 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/interfaces/IClientScripts.js +0 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/domain/entities/interfaces/IEvent.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/frameworks/ClientScriptsBehaviourFactory.js +12 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/frameworks/ClientScriptsHandlersFactory.js +47 -0
- package/es/platform/client-scripts/cc/zclient-scripts-execution/clientScriptsSchema.js +15 -0
- package/es/platform/components/app/adapters/resources/AppResource.js +13 -3
- package/es/platform/components/form-connected/frameworks/FormConnectedFactory.js +7 -1
- package/es/platform/components/form-connected/frameworks/FormConnectedView.js +4 -2
- package/es/platform/components/table-connected/adapters/controllers/ColumnChooserUpdateController.js +7 -1
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +50 -0
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +216 -2
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +4 -2
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +6 -2
- package/es/platform/data-source/http-template/getClientScripts.js +23 -0
- package/es/platform/data-source/http-template/updateSelectedFields.js +1 -1
- package/es/platform/data-source/index.js +14 -11
- package/es/platform/data-source/utils/validation-rules/TransFormValidationRules.js +1 -0
- package/es/platform/sdk/frameworks/Sdk.js +1 -1
- package/es/platform/zdata-source/domain/entities/APITemplate.js +2 -1
- package/es/platform/zfield/domain/entities/fields-manager/FieldsManager.js +6 -1
- package/es/platform/zform/adapters/controllers/IntializeController.js +4 -2
- package/es/platform/zform/adapters/controllers/MyLayoutSuccessController.js +4 -2
- package/es/platform/zform/adapters/controllers/SubmitValidationCompletedController.js +5 -1
- package/es/platform/zform/adapters/gateway/FormRepository.js +4 -2
- package/es/platform/zform/adapters/gateway/Service.js +2 -0
- package/es/platform/zform/adapters/presenter/FormTranslator.js +21 -15
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +5 -3
- package/es/platform/zform/applications/usecases/InitializeUseCase.js +54 -26
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +7 -7
- package/es/platform/zform/applications/usecases/MyLayoutSuccessUseCase.js +60 -36
- package/es/platform/zform/applications/usecases/SubmitValidationCompletedUseCase.js +12 -8
- package/es/platform/zform/domain/ZForm.js +65 -0
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +11 -2
- package/es/platform/zhttp/adapters/controllers/FetchController.js +5 -1
- package/es/platform/zlist/adapters/gateways/Repository.js +4 -2
- package/es/platform/zlist/adapters/presenters/SelectionTranslator.js +6 -3
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +15 -6
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +30 -19
- package/es/platform/zlist/adapters/presenters/translators/Header.js +5 -6
- package/es/platform/zlist/adapters/presenters/translators/HeadersTranslator.js +4 -2
- package/es/platform/zlist/adapters/presenters/translators/Row.js +5 -3
- package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +6 -2
- package/es/platform/zlist/adapters/presenters/utils/DefaultClientActions.js +1 -1
- package/es/platform/zlist/domain/entities/List.js +17 -2
- package/package.json +3 -3
- package/es/library/custom-component/applications/usecases/MountUseCase copy.js +0 -28
- package/es/platform/app-context-behaviour/adapters/controllers/InitializeController.js +0 -19
- package/es/platform/app-context-behaviour/adapters/gateways/Service.js +0 -7
- package/es/platform/app-context-behaviour/adapters/presenters/Presenter.js +0 -18
- package/es/platform/app-context-behaviour/adapters/resources/AppResource.js +0 -25
- package/es/platform/app-context-behaviour/applications/AbstractUseCase.js +0 -6
- package/es/platform/app-context-behaviour/applications/usecases/InitializeUseCase.js +0 -15
- package/es/platform/app-context-behaviour/frameworks/EventHandlerFactory.js +0 -25
- package/es/platform/components/form-connected/frameworks/FallbackView.js +0 -23
- package/es/platform/components/form-connected/frameworks/FormFallbackView.js +0 -23
- /package/es/platform/{app-context-behaviour/applications/interfaces/UsecaseDependencies.js → client-actions/behaviour/zclient-actions/domain/entities/interfaces/ClientActionResponse.js} +0 -0
- /package/es/platform/{app-context-behaviour/applications/interfaces/gateways/IService.js → client-scripts/behaviour/zclient-scripts-execution/applications/interfaces/InputDependencies.js} +0 -0
- /package/es/platform/{app-context-behaviour/applications/interfaces/input/InitializeUseCaseInputModel.js → client-scripts/behaviour/zclient-scripts-execution/applications/interfaces/gateways/IRepository.js} +0 -0
- /package/es/platform/{app-context-behaviour → client-scripts/behaviour/zclient-scripts-execution}/applications/interfaces/output/IPresenter.js +0 -0
- /package/es/platform/{app-context-behaviour/applications/interfaces/output/BehaviourState.js → client-scripts/behaviour/zclient-scripts-execution/domain/entities/State.js} +0 -0
- /package/es/platform/{app-context-behaviour/applications/interfaces/resources/ApiHeaderContract.js → client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/InputDependencies.js} +0 -0
- /package/es/platform/{app-context-behaviour/applications/interfaces/resources/ContextContract.js → client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/gateways/IRepository.js} +0 -0
- /package/es/platform/{app-context-behaviour/applications/interfaces/resources/IAppResource.js → client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/output/IPresenter.js} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
3
|
+
import { ActionViewGap } from "../../../../interfaces/ActionViewModel";
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import style from "./RowActionsRenderer.module.css";
|
|
6
|
+
import ActionEventMediator from "../../../../action-event-mediator/frameworks/ui/ActionEventMediator";
|
|
7
|
+
import { findMappedClientScripts } from "../../../../../../client-scripts/behaviour/zclient-scripts-execution/frameworks/ClientScriptsUtils";
|
|
8
|
+
|
|
9
|
+
function RowActionsRendererView(_ref, ref) {
|
|
10
|
+
let {
|
|
11
|
+
state
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
actions,
|
|
15
|
+
gap,
|
|
16
|
+
clientScripts,
|
|
17
|
+
testId
|
|
18
|
+
} = state.properties;
|
|
19
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
testId: testId ? testId : "",
|
|
22
|
+
$ui_displayMode: "inline",
|
|
23
|
+
$ui_alignItems: "center",
|
|
24
|
+
$ui_className: `${gap !== ActionViewGap.NONE ? style[`gap_${gap}`] : ''}`
|
|
25
|
+
}, actions.map((action, index) => {
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
return /*#__PURE__*/React.createElement(ActionEventMediator, {
|
|
28
|
+
action: action,
|
|
29
|
+
clientScripts: findMappedClientScripts(action, clientScripts),
|
|
30
|
+
key: index,
|
|
31
|
+
instanceName: action.instanceName
|
|
32
|
+
});
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
;
|
|
37
|
+
export default RowActionsRendererView;
|
|
@@ -8,6 +8,8 @@ export default class ClientActionsTranslator {
|
|
|
8
8
|
id: action.id,
|
|
9
9
|
component: action.uiComponentMapping.component,
|
|
10
10
|
properties: action.uiComponentMapping.propertiesValueMapping,
|
|
11
|
+
instanceName: action.instanceName,
|
|
12
|
+
moduleName: action.moduleName,
|
|
11
13
|
eventMappings: action.uiComponentMapping.eventMappings.map(eventMapping => {
|
|
12
14
|
return {
|
|
13
15
|
sourceEvent: eventMapping.sourceEvent,
|
|
@@ -19,11 +21,21 @@ export default class ClientActionsTranslator {
|
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
static
|
|
24
|
+
static appendComponentMetaToActions(actions, instanceName, moduleName) {
|
|
25
|
+
return actions.map(action => {
|
|
26
|
+
return { ...action,
|
|
27
|
+
instanceName,
|
|
28
|
+
moduleName
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static transform(actions, instanceName, moduleName, context) {
|
|
23
34
|
const replacementContext = {
|
|
24
35
|
"@context": context
|
|
25
36
|
};
|
|
26
|
-
const
|
|
37
|
+
const actionsWithInstanceName = ClientActionsTranslator.appendComponentMetaToActions(actions, instanceName, moduleName);
|
|
38
|
+
const resolvedActions = ActionContextResolver.resolveActions(actionsWithInstanceName, replacementContext);
|
|
27
39
|
const evaluatedActions = resolvedActions.filter(action => ConditionResolver.evaluateCondition(action.conditions, replacementContext, action.id));
|
|
28
40
|
const finalTransformedActions = evaluatedActions.map(action => this.transformToActionViewModel(action));
|
|
29
41
|
return finalTransformedActions;
|
|
@@ -3,6 +3,11 @@ import { evaluateConditionsFields } from "./field-evaluators";
|
|
|
3
3
|
import { evaluateExpression, parse } from "./pattern-evaluator";
|
|
4
4
|
export class ConditionResolver {
|
|
5
5
|
static evaluateCondition(condition, context, id) {
|
|
6
|
+
if (!condition) {
|
|
7
|
+
console.warn(`Client Action : Invalid value '${condition}' passed as condition in client action id : ${id}`);
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
const {
|
|
7
12
|
fields = [],
|
|
8
13
|
pattern = ''
|
|
@@ -16,7 +21,7 @@ export class ConditionResolver {
|
|
|
16
21
|
} = patternValidate(pattern, fields.length);
|
|
17
22
|
|
|
18
23
|
if (!isValid) {
|
|
19
|
-
console.error(`Error in client action id ${id} - condition pattern`, errorMessage);
|
|
24
|
+
console.error(`Client Action : Error in client action id : ${id} - condition pattern.\nError: `, errorMessage);
|
|
20
25
|
return false;
|
|
21
26
|
}
|
|
22
27
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const CLIENT_SCRIPT_TIMOUT_LIMIT = 10000;
|
|
2
|
+
export const EXECUTE_CLIENT_SCRIPTS = 'EXECUTE_CLIENT_SCRIPTS';
|
|
3
|
+
export const SET_CLIENT_SCRIPTS = 'SET_CLIENT_SCRIPTS';
|
|
4
|
+
export const CLIENT_SCRIPT_ARGUMENT = 'context';
|
|
5
|
+
export const CLIENT_SCRIPT_PREFIX = 'Client Script';
|
|
6
|
+
export const CLIENT_SCRIPT_ERROR = 'Error';
|
|
7
|
+
export const CLIENT_SCRIPT_RUNTIME_ERROR_MESSAGE = `${CLIENT_SCRIPT_PREFIX} : Script execution runtime error.\n${CLIENT_SCRIPT_ERROR}: `;
|
|
8
|
+
export const CLIENT_SCRIPT_ERROR_MESSAGE = `${CLIENT_SCRIPT_PREFIX} : Script execution failed due to error in script.\n${CLIENT_SCRIPT_ERROR}:`;
|
|
9
|
+
export const CLIENT_SCRIPT_EXECUTION_TIMED_OUT_ERROR_MESSAGE = `${CLIENT_SCRIPT_PREFIX} : Script execution exceeded ${CLIENT_SCRIPT_TIMOUT_LIMIT / 1000}s time limit.`;
|
|
10
|
+
export const CLIENT_SCRIPT_INVALID_SCRIPT_ERROR_MESSAGE = `${CLIENT_SCRIPT_PREFIX} : Error while constructing client script function.\n${CLIENT_SCRIPT_ERROR}:`;
|
|
11
|
+
export const CLIENT_SCRIPT_NO_MAPPING_FOUND_ERROR_MESSAGE = `${CLIENT_SCRIPT_PREFIX} : No client script mapping found for target event.Event handler support for defining client scripts will be removed in future versions.Please define client action event handlers as client script to avoid breakage.Warning shown for target event: `;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const SET_CLIENTSCRIPTS = 'CLIENTSCRIPT#SET_CLIENTSCRIPTS';
|
|
2
|
+
export const CLIENTSCRIPT_FETCH = 'CLIENTSCRIPT_BEHAVIOUR#EXECUTE';
|
|
3
|
+
export const CLIENTSCRIPT_FETCH_SUCCESS = 'CLIENTSCRIPT#EXECUTE_SUCCEEDED';
|
|
4
|
+
export const CLIENTSCRIPT_FETCH_FAILURE = 'CLIENTSCRIPT#EXECUTE_FAILED';
|
|
5
|
+
export const CLIENTSCRIPT_FETCH_SUCCESS_NO_CONTENT = 'CLIENTSCRIPT#EXECUTE_SUCCEEDED_NO_CONTENT';
|
|
6
|
+
export const CLIENTSCRIPT_FETCH_SUCCESS_CALLBACK = 'CLIENTSCRIPT#EXECUTE_SUCCESS_CALLBACK';
|
|
7
|
+
export const CLIENTSCRIPT_FETCH_SUCCESS_NO_CONTENT_CALLBACK = 'CLIENTSCRIPT#EXECUTE_SUCCESS_NO_CONTENT_CALLBACK';
|
|
8
|
+
export const CLIENTSCRIPT_FETCH_FAILURE_CALLBACK = 'CLIENTSCRIPT#EXECUTE_FAIL_CALLBACK';
|
|
9
|
+
export const ClientScriptAPIs = {
|
|
10
|
+
GET_CLIENTSCRIPTS: "getClientScripts"
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class ClientScriptExecutionController extends AbstractController {
|
|
3
|
+
handle(input) {
|
|
4
|
+
const {
|
|
5
|
+
executeClientScriptsUseCase
|
|
6
|
+
} = this.service;
|
|
7
|
+
executeClientScriptsUseCase.execute(input);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class SetClientScriptsMappingController extends AbstractController {
|
|
3
|
+
handle(input) {
|
|
4
|
+
const {
|
|
5
|
+
setClientScriptsMappingUseCase
|
|
6
|
+
} = this.service;
|
|
7
|
+
setClientScriptsMappingUseCase.execute(input);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ClientScriptExecutor from "../../domain/entities/ClientScriptExecutor";
|
|
2
|
+
export default class Repository {
|
|
3
|
+
init(state) {
|
|
4
|
+
this.state = state;
|
|
5
|
+
this.element = null;
|
|
6
|
+
|
|
7
|
+
this.dispatch = () => {};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
updateDependencies(element, state, dispatch) {
|
|
11
|
+
this.element = element;
|
|
12
|
+
this.dispatch = dispatch;
|
|
13
|
+
this.state = state;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getClientScriptExecutor() {
|
|
17
|
+
const {
|
|
18
|
+
clientScriptsMapping,
|
|
19
|
+
context
|
|
20
|
+
} = this.state;
|
|
21
|
+
return new ClientScriptExecutor(clientScriptsMapping, context);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
package/es/platform/client-scripts/behaviour/zclient-scripts-execution/adapters/gateways/Service.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import ExecuteClientScriptsUseCase from "../../applications/usecases/ExecuteClientScriptsUseCase";
|
|
2
|
+
import SetClientScriptsMappingUseCase from "../../applications/usecases/SetClientScriptsMappingUseCase";
|
|
3
|
+
export default class Service {
|
|
4
|
+
constructor(dependencies) {
|
|
5
|
+
this.executeClientScriptsUseCase = new ExecuteClientScriptsUseCase(dependencies);
|
|
6
|
+
this.setClientScriptsMappingUseCase = new SetClientScriptsMappingUseCase(dependencies);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default class Presenter {
|
|
2
|
+
updateDependencies(state, updateState) {
|
|
3
|
+
this.updateState = updateState;
|
|
4
|
+
this.state = state;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
updateClientScriptsMapping(clientScriptsMapping) {
|
|
8
|
+
this.state = { ...this.state,
|
|
9
|
+
clientScriptsMapping
|
|
10
|
+
};
|
|
11
|
+
this.updateState(this.state);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
updateContext(context) {
|
|
15
|
+
this.state = { ...this.state,
|
|
16
|
+
context
|
|
17
|
+
};
|
|
18
|
+
this.updateState(this.state);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class AbstractUseCase {
|
|
2
|
+
constructor(dependencies) {
|
|
3
|
+
this.dependencies = dependencies;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
updateDependencies(element, state, dispatch, updateState) {
|
|
7
|
+
const {
|
|
8
|
+
repository,
|
|
9
|
+
presenter
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
repository.updateDependencies(element, state, dispatch);
|
|
12
|
+
presenter.updateDependencies(state, updateState);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AbstractUseCase } from "./AbstractUseCase";
|
|
2
|
+
export default class ExecuteClientScriptsUseCase extends AbstractUseCase {
|
|
3
|
+
execute(input) {
|
|
4
|
+
const {
|
|
5
|
+
repository
|
|
6
|
+
} = this.dependencies;
|
|
7
|
+
const {
|
|
8
|
+
host,
|
|
9
|
+
state,
|
|
10
|
+
dispatch
|
|
11
|
+
} = input;
|
|
12
|
+
const {
|
|
13
|
+
clientScripts
|
|
14
|
+
} = state.properties;
|
|
15
|
+
repository.updateDependencies(host, {
|
|
16
|
+
clientScriptsMapping: clientScripts,
|
|
17
|
+
context: input
|
|
18
|
+
}, dispatch);
|
|
19
|
+
const clientScriptExecutor = repository.getClientScriptExecutor();
|
|
20
|
+
clientScriptExecutor.executeTargetAction();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractUseCase } from "./AbstractUseCase";
|
|
2
|
+
export default class SetClientScriptsMappingUseCase extends AbstractUseCase {
|
|
3
|
+
execute(input) {
|
|
4
|
+
const {
|
|
5
|
+
presenter
|
|
6
|
+
} = this.dependencies;
|
|
7
|
+
const {
|
|
8
|
+
clientScripts,
|
|
9
|
+
state,
|
|
10
|
+
updateState
|
|
11
|
+
} = input;
|
|
12
|
+
presenter.updateDependencies(state, updateState);
|
|
13
|
+
presenter.updateClientScriptsMapping(clientScripts);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { CLIENT_SCRIPT_ARGUMENT, CLIENT_SCRIPT_ERROR_MESSAGE, CLIENT_SCRIPT_EXECUTION_TIMED_OUT_ERROR_MESSAGE, CLIENT_SCRIPT_INVALID_SCRIPT_ERROR_MESSAGE, CLIENT_SCRIPT_NO_MAPPING_FOUND_ERROR_MESSAGE, CLIENT_SCRIPT_RUNTIME_ERROR_MESSAGE, CLIENT_SCRIPT_TIMOUT_LIMIT } from "../../../../bc/zclient-scripts-execution/Constants";
|
|
2
|
+
import { platformSDK } from "../../../../../sdk/frameworks/Sdk";
|
|
3
|
+
import { ClientScriptExecutionStatus } from "./types/ClientScriptExectionTypeDefintions";
|
|
4
|
+
export default class ClientScriptExecutor {
|
|
5
|
+
constructor(clientScriptsMapping, context) {
|
|
6
|
+
this.clientScriptsMapping = clientScriptsMapping;
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
findClientScriptMapping(targetEvent) {
|
|
11
|
+
return this.clientScriptsMapping.find(clientScript => clientScript.targetEvent === targetEvent);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
findClientActionPayload(targetEvent) {
|
|
15
|
+
const {
|
|
16
|
+
clientScriptsEventContext
|
|
17
|
+
} = this.context.action.payload;
|
|
18
|
+
const targetActionEventContext = clientScriptsEventContext.find(eventContext => eventContext.targetEvent === targetEvent);
|
|
19
|
+
return targetActionEventContext ? targetActionEventContext.resolvedPayload : {};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getClientScriptArguments(targetEvent) {
|
|
23
|
+
const payload = this.findClientActionPayload(targetEvent);
|
|
24
|
+
const action = {
|
|
25
|
+
metaData: { ...this.context.action.metaData,
|
|
26
|
+
targetEvent
|
|
27
|
+
},
|
|
28
|
+
payload
|
|
29
|
+
};
|
|
30
|
+
return { ...this.context,
|
|
31
|
+
platformSDK: platformSDK,
|
|
32
|
+
action
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
handleClientScriptExecutionResult(result) {
|
|
37
|
+
const {
|
|
38
|
+
status
|
|
39
|
+
} = result;
|
|
40
|
+
|
|
41
|
+
switch (status) {
|
|
42
|
+
case ClientScriptExecutionStatus.FAILURE:
|
|
43
|
+
const {
|
|
44
|
+
error: {
|
|
45
|
+
message
|
|
46
|
+
}
|
|
47
|
+
} = result;
|
|
48
|
+
console.error(CLIENT_SCRIPT_ERROR_MESSAGE, message);
|
|
49
|
+
break;
|
|
50
|
+
|
|
51
|
+
case ClientScriptExecutionStatus.TIMEDOUT:
|
|
52
|
+
console.error(CLIENT_SCRIPT_EXECUTION_TIMED_OUT_ERROR_MESSAGE);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getClientScriptExecutionPromise(clientScript, clientScriptArguments) {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
try {
|
|
60
|
+
clientScript(clientScriptArguments);
|
|
61
|
+
resolve({
|
|
62
|
+
status: ClientScriptExecutionStatus.SUCCESS
|
|
63
|
+
});
|
|
64
|
+
} catch (e) {
|
|
65
|
+
resolve({
|
|
66
|
+
status: ClientScriptExecutionStatus.FAILURE,
|
|
67
|
+
error: e
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getClientScriptTimeoutPromise(timeout) {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
resolve({
|
|
77
|
+
status: ClientScriptExecutionStatus.TIMEDOUT
|
|
78
|
+
});
|
|
79
|
+
}, timeout);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async executeClientScript(clientScript, clientScriptArguments, timeout) {
|
|
84
|
+
const clientScriptExecutionPromise = this.getClientScriptExecutionPromise(clientScript, clientScriptArguments);
|
|
85
|
+
const clientScriptTimeoutPromise = this.getClientScriptTimeoutPromise(timeout);
|
|
86
|
+
return Promise.race([clientScriptTimeoutPromise, clientScriptExecutionPromise]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
constructClientScriptFunction(clientScriptFnBody) {
|
|
90
|
+
try {
|
|
91
|
+
const clientScriptFn = new Function(CLIENT_SCRIPT_ARGUMENT, `${clientScriptFnBody}`);
|
|
92
|
+
return clientScriptFn;
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.error(CLIENT_SCRIPT_INVALID_SCRIPT_ERROR_MESSAGE, e.message);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
handleClientScriptExecution(targetEvent, clientScript) {
|
|
99
|
+
if (!clientScript) return;
|
|
100
|
+
const dynamicFunction = this.constructClientScriptFunction(clientScript);
|
|
101
|
+
const clientScriptArguments = this.getClientScriptArguments(targetEvent);
|
|
102
|
+
this.executeClientScript(dynamicFunction, clientScriptArguments, CLIENT_SCRIPT_TIMOUT_LIMIT).then(result => {
|
|
103
|
+
this.handleClientScriptExecutionResult(result);
|
|
104
|
+
}).catch(error => {
|
|
105
|
+
console.error(CLIENT_SCRIPT_RUNTIME_ERROR_MESSAGE, error);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
executeTargetAction() {
|
|
110
|
+
const {
|
|
111
|
+
clientScriptsEventContext
|
|
112
|
+
} = this.context.action.payload;
|
|
113
|
+
clientScriptsEventContext.forEach(clientScriptEventContext => {
|
|
114
|
+
const {
|
|
115
|
+
targetEvent
|
|
116
|
+
} = clientScriptEventContext;
|
|
117
|
+
const clientScriptMapping = this.findClientScriptMapping(targetEvent);
|
|
118
|
+
|
|
119
|
+
if (clientScriptMapping) {
|
|
120
|
+
const {
|
|
121
|
+
clientScript
|
|
122
|
+
} = clientScriptMapping;
|
|
123
|
+
this.handleClientScriptExecution(targetEvent, clientScript);
|
|
124
|
+
} else {
|
|
125
|
+
console.warn(CLIENT_SCRIPT_NO_MAPPING_FOUND_ERROR_MESSAGE, `'${targetEvent}'`);
|
|
126
|
+
const {
|
|
127
|
+
dispatch
|
|
128
|
+
} = this.context;
|
|
129
|
+
const {
|
|
130
|
+
payload,
|
|
131
|
+
metaData
|
|
132
|
+
} = this.getClientScriptArguments(targetEvent)?.action;
|
|
133
|
+
dispatch({
|
|
134
|
+
type: targetEvent,
|
|
135
|
+
payload,
|
|
136
|
+
metaData
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export let ClientScriptExecutionStatus = /*#__PURE__*/function (ClientScriptExecutionStatus) {
|
|
2
|
+
ClientScriptExecutionStatus["SUCCESS"] = "CLIENTSCRIPT#EXECUTION_SUCCESS";
|
|
3
|
+
ClientScriptExecutionStatus["FAILURE"] = "CLIENTSCRIPT#EXECUTION_FAILURE";
|
|
4
|
+
ClientScriptExecutionStatus["TIMEDOUT"] = "CLIENTSCRIPT#EXECUTION_TIMEDOUT";
|
|
5
|
+
return ClientScriptExecutionStatus;
|
|
6
|
+
}({});
|
|
7
|
+
;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ClientScriptsExecutionHandlersFactory from "./ClientScriptsExecutionHandlersFactory";
|
|
2
|
+
export default class ClientScriptsExecutionBehaviourFactory {
|
|
3
|
+
static create() {
|
|
4
|
+
return {
|
|
5
|
+
name: 'zclientScriptsEventMapping',
|
|
6
|
+
eventHandlers: ClientScriptsExecutionHandlersFactory.create(),
|
|
7
|
+
properties: {},
|
|
8
|
+
setInitialState: () => ({})
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EXECUTE_CLIENT_SCRIPTS, SET_CLIENT_SCRIPTS } from "../../../bc/zclient-scripts-execution/Constants";
|
|
2
|
+
import Service from "../adapters/gateways/Service";
|
|
3
|
+
import Presenter from "../adapters/presenters/Presenter";
|
|
4
|
+
import Repository from "../adapters/gateways/Repository";
|
|
5
|
+
import ClientScriptExecutionController from "../adapters/controllers/ClientScriptExecutionController";
|
|
6
|
+
import SetClientScriptsMappingController from "../adapters/controllers/SetClientScriptsMappingController";
|
|
7
|
+
export default class ClientScriptsExecutionHandlersFactory {
|
|
8
|
+
static getClientScriptsControllerHandles(service) {
|
|
9
|
+
return {
|
|
10
|
+
executeClientScript: new ClientScriptExecutionController(service).handle,
|
|
11
|
+
setClientScriptsMapping: new SetClientScriptsMappingController(service).handle
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static create() {
|
|
16
|
+
const presenter = new Presenter();
|
|
17
|
+
const repository = new Repository();
|
|
18
|
+
const dependencies = {
|
|
19
|
+
presenter,
|
|
20
|
+
repository
|
|
21
|
+
};
|
|
22
|
+
const service = new Service(dependencies);
|
|
23
|
+
const clientScriptControllerHandle = ClientScriptsExecutionHandlersFactory.getClientScriptsControllerHandles(service);
|
|
24
|
+
return {
|
|
25
|
+
[EXECUTE_CLIENT_SCRIPTS]: clientScriptControllerHandle.executeClientScript,
|
|
26
|
+
[SET_CLIENT_SCRIPTS]: clientScriptControllerHandle.setClientScriptsMapping
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function findMappedClientScripts(action, clientScripts) {
|
|
2
|
+
if (!clientScripts || clientScripts.length === 0) return [];
|
|
3
|
+
const {
|
|
4
|
+
eventMappings
|
|
5
|
+
} = action;
|
|
6
|
+
const targetEvents = eventMappings.map(event => {
|
|
7
|
+
const {
|
|
8
|
+
targetEvent
|
|
9
|
+
} = event;
|
|
10
|
+
return targetEvent;
|
|
11
|
+
});
|
|
12
|
+
return clientScripts.filter(clientScript => clientScript.targetEvent && targetEvents.includes(clientScript.targetEvent));
|
|
13
|
+
}
|
|
14
|
+
export function getClientScriptMockInterceptorProperties() {
|
|
15
|
+
return {
|
|
16
|
+
name: 'uiActions',
|
|
17
|
+
api: `/supportapi/zd/{{orgName}}/api/v1/clientScripts`,
|
|
18
|
+
parameters: `{
|
|
19
|
+
"modules": "{{moduleName}}"
|
|
20
|
+
}`,
|
|
21
|
+
type: 'GET',
|
|
22
|
+
transformer: data => data,
|
|
23
|
+
properties: {}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class FetchClientScriptsController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
action,
|
|
8
|
+
dispatch
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
actionName,
|
|
12
|
+
props,
|
|
13
|
+
apiName
|
|
14
|
+
} = action.payload;
|
|
15
|
+
const {
|
|
16
|
+
fetchClientScriptsUseCase
|
|
17
|
+
} = this.service;
|
|
18
|
+
fetchClientScriptsUseCase.updateDependency(state, updateState);
|
|
19
|
+
fetchClientScriptsUseCase.execute({
|
|
20
|
+
dispatch,
|
|
21
|
+
apiName,
|
|
22
|
+
actionName,
|
|
23
|
+
props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class FetchClientScriptsFailureController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
action,
|
|
8
|
+
dispatch
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
metaData,
|
|
12
|
+
payload
|
|
13
|
+
} = action;
|
|
14
|
+
const {
|
|
15
|
+
error
|
|
16
|
+
} = payload;
|
|
17
|
+
const {
|
|
18
|
+
fetchClientScriptsFailureUseCase
|
|
19
|
+
} = this.service;
|
|
20
|
+
fetchClientScriptsFailureUseCase.updateDependency(state, updateState);
|
|
21
|
+
fetchClientScriptsFailureUseCase.execute({
|
|
22
|
+
dispatch,
|
|
23
|
+
error,
|
|
24
|
+
metaData
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class FetchClientScriptsNoContentController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
action,
|
|
8
|
+
dispatch
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
metaData
|
|
12
|
+
} = action;
|
|
13
|
+
const {
|
|
14
|
+
fetchClientScriptsNoContentUseCase
|
|
15
|
+
} = this.service;
|
|
16
|
+
fetchClientScriptsNoContentUseCase.updateDependency(state, updateState);
|
|
17
|
+
fetchClientScriptsNoContentUseCase.execute({
|
|
18
|
+
dispatch,
|
|
19
|
+
metaData
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class FetchClientScriptsStopController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
action
|
|
8
|
+
} = event;
|
|
9
|
+
const {
|
|
10
|
+
metaData
|
|
11
|
+
} = action;
|
|
12
|
+
const {
|
|
13
|
+
fetchClientScriptsStopUseCase
|
|
14
|
+
} = this.service;
|
|
15
|
+
fetchClientScriptsStopUseCase.updateDependency(state, updateState);
|
|
16
|
+
fetchClientScriptsStopUseCase.execute({
|
|
17
|
+
metaData
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
export default class FetchClientScriptsSuccessController extends AbstractController {
|
|
3
|
+
handle(event) {
|
|
4
|
+
const {
|
|
5
|
+
state,
|
|
6
|
+
updateState,
|
|
7
|
+
action,
|
|
8
|
+
dispatch
|
|
9
|
+
} = event;
|
|
10
|
+
const {
|
|
11
|
+
metaData,
|
|
12
|
+
payload
|
|
13
|
+
} = action;
|
|
14
|
+
const {
|
|
15
|
+
response
|
|
16
|
+
} = payload;
|
|
17
|
+
const {
|
|
18
|
+
fetchClientScriptsSuccessUseCase
|
|
19
|
+
} = this.service;
|
|
20
|
+
fetchClientScriptsSuccessUseCase.updateDependency(state, updateState);
|
|
21
|
+
fetchClientScriptsSuccessUseCase.execute({
|
|
22
|
+
dispatch,
|
|
23
|
+
response,
|
|
24
|
+
metaData
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default class MountController {
|
|
2
|
+
constructor(recordApis, service) {
|
|
3
|
+
this.recordApis = recordApis;
|
|
4
|
+
this.service = service;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
handle = event => {
|
|
8
|
+
const {
|
|
9
|
+
state,
|
|
10
|
+
updateState,
|
|
11
|
+
dispatch
|
|
12
|
+
} = event;
|
|
13
|
+
const {
|
|
14
|
+
initializeUseCase
|
|
15
|
+
} = this.service;
|
|
16
|
+
initializeUseCase.updateDependency(state, updateState);
|
|
17
|
+
initializeUseCase.execute({
|
|
18
|
+
dispatch,
|
|
19
|
+
apiTemplates: this.recordApis
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
}
|