@zohodesk/library-platform 1.1.13 → 1.2.0-exp.2
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/column-chooser/EventHandlers.js +1 -2
- package/es/bc/zform/Properties.js +20 -0
- package/es/bc/zform/Symbol.js +3 -0
- package/es/bc/zrecord/Constants.js +2 -0
- package/es/cc/action-band/Properties.js +37 -0
- package/es/cc/action-band/constants/ExternalConstants.js +3 -1
- package/es/cc/component/LifeCycleEventsEnum.js +1 -0
- package/es/cc/fields/currency/Properties.js +9 -0
- package/es/cc/fields/decimal/Properties.js +9 -0
- package/es/cc/fields/email/Properties.js +9 -0
- package/es/cc/fields/lookup/Properties.js +10 -26
- package/es/cc/fields/multi-line/Properties.js +1 -0
- package/es/cc/fields/number/Properties.js +10 -1
- package/es/cc/fields/phone/Properties.js +9 -0
- package/es/cc/fields/text/Properties.js +2 -2
- package/es/cc/fields/url/Properties.js +9 -0
- package/es/cc/table-column-chooser/Constants.js +2 -1
- package/es/cc/table-connected/SdkContract.js +22 -0
- package/es/cc/text/Properties.js +100 -0
- package/es/cc/textbox/Properties.js +1 -1
- package/es/index.js +7 -2
- package/es/library/behaviours/clip-wrap/applications/usecases/ClipWrapUpdateUseCase.js +19 -0
- package/es/library/behaviours/search/adapters/controllers/UpdatePropertiesController.js +9 -4
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +4 -3
- package/es/library/custom-component/applications/usecases/DispatchUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/InitializeUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/MountUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/SetRefUseCase.js +7 -0
- package/es/library/custom-component/applications/usecases/UnmountUseCase.js +1 -0
- package/es/library/custom-component/applications/usecases/UpdatePropertyUseCase.js +1 -0
- package/es/library/custom-component/domain/entities/Component.js +1 -0
- package/es/library/custom-component/domain/entities/Logger.js +4 -9
- package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +2 -0
- package/es/library/dot/components/form-fields/decimal/frameworks/ui/DecimalView.js +2 -0
- package/es/library/dot/components/form-fields/email/frameworks/ui/Email.js +1 -1
- package/es/library/dot/components/form-fields/email/frameworks/ui/EmailView.js +2 -0
- package/es/library/dot/components/form-fields/number/frameworks/ui/NumberView.js +2 -0
- package/es/library/dot/components/form-fields/phone/frameworks/ui/PhoneView.js +2 -0
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextArea.js +1 -1
- package/es/library/dot/components/form-fields/textarea/frameworks/ui/TextAreaView.js +4 -2
- package/es/library/dot/components/form-fields/textbox/frameworks/ui/TextBoxView.js +2 -0
- package/es/library/dot/components/form-fields/url/frameworks/ui/UrlView.js +2 -0
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js +1 -1
- package/es/library/dot/legacy-to-new-arch/table-field-components/text-field/frameworks/ui/TextFieldView.js +20 -0
- package/es/library/dot/legacy-to-new-arch/text/frameworks/ui/Text.js +2 -2
- package/es/library/dot/legacy-to-new-arch/text/frameworks/ui/TextView.js +22 -1
- package/es/platform/.DS_Store +0 -0
- package/es/platform/app-context-behaviour/adapters/controllers/AbstractController.js +9 -0
- package/es/platform/app-context-behaviour/adapters/controllers/UpdatePropertiesController.js +32 -0
- package/es/platform/app-context-behaviour/adapters/gateway/Repository.js +22 -0
- package/es/platform/app-context-behaviour/adapters/gateway/Service.js +10 -0
- package/es/platform/app-context-behaviour/adapters/presenter/Presenter.js +16 -0
- package/es/platform/app-context-behaviour/applications/interfaces/UseCaseDependencies.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/gateways/IRepository.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/gateways/IService.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/input/UpdatePropertiesInputModel.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/output/BehaviourOutputModel.js +1 -0
- package/es/platform/app-context-behaviour/applications/interfaces/output/IPresenter.js +1 -0
- package/es/platform/app-context-behaviour/applications/usecases/AbstractUseCase.js +17 -0
- package/es/platform/app-context-behaviour/applications/usecases/UpdatePropertiesUsecase.js +25 -0
- package/es/platform/app-context-behaviour/domain/entities/AppContext.js +44 -0
- package/es/platform/app-context-behaviour/domain/entities/interfaces/IAppContext.js +1 -0
- package/es/platform/app-context-behaviour/frameworks/AppContextBehaviourFactory.js +2 -2
- package/es/platform/app-context-behaviour/frameworks/EventHandlerFactory.js +22 -0
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/presenters/FilterUtils.js +11 -0
- package/es/platform/client-actions/behaviour/zclient-actions/adapters/resources/ClientActionsFetchSDK.js +76 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/ClientActionsAPIGatewayParams.js +1 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/ClientActionsFetchSDKParams.js +10 -0
- package/es/platform/client-actions/behaviour/zclient-actions/applications/interfaces/IClientActionsFetchSDK.js +0 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/adapters/resources/ClientScriptsFetchSDK.js +43 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/ClientScriptsAPIGatewayParams.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/ClientScriptsSDKFetchParams.js +1 -0
- package/es/platform/client-scripts/behaviour/zclient-scripts-fetch/applications/interfaces/IClientScriptsFetchSDK.js +0 -0
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserOpenController.js +14 -6
- package/es/platform/column-chooser/adapters/controllers/ColumnChooserUpdateController.js +22 -0
- package/es/platform/column-chooser/adapters/gateways/Repository.js +12 -1
- package/es/platform/column-chooser/adapters/gateways/Service.js +2 -0
- package/es/platform/column-chooser/applications/interfaces/input/ColumnChooserUpdateInput.js +1 -0
- package/es/platform/column-chooser/applications/usecases/ColumnChooserSaveUseCase.js +8 -1
- package/es/platform/column-chooser/applications/usecases/ColumnChooserUpdateUseCase.js +35 -0
- package/es/platform/column-chooser/domain/entities/ColumnChooserImp.js +6 -0
- package/es/platform/column-chooser/frameworks/EventHandlersFactory.js +6 -4
- package/es/platform/components/smart-action-band/adapters/presenters/ActionBandTranslator.js +70 -8
- package/es/platform/components/smart-action-band/adapters/presenters/utils/DefaultClientActions.js +32 -0
- package/es/platform/components/smart-action-band/frameworks/EventHandlersFactory.js +42 -1
- package/es/platform/components/smart-action-band/frameworks/SmartActionBandFactory.js +4 -1
- package/es/platform/components/table-connected/adapters/resources/SmartTableResource.js +52 -0
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +1 -7
- package/es/platform/components/table-connected/frameworks/ListSdkFactory.js +4 -2
- package/es/platform/data-source/http-template/fetchLookupFields.js +0 -6
- package/es/platform/data-source/http-template/getPageClientActions.js +23 -0
- package/es/platform/data-source/http-template/getSingleRecord.js +51 -0
- package/es/platform/data-source/index.js +2 -0
- package/es/platform/data-source/utils/validation-rules/FieldConditions.js +1 -1
- package/es/platform/sdk-behaviour/adapters/controllers/InitializeController.js +7 -2
- package/es/platform/sdk-behaviour/applications/usecases/CreateResourceInstanceUseCase.js +10 -1
- package/es/platform/zform/adapters/controllers/GetInitialRecordSuccessController.js +31 -0
- package/es/platform/zform/adapters/gateway/FormRepository.js +10 -2
- package/es/platform/zform/adapters/gateway/Service.js +2 -0
- package/es/platform/zform/adapters/presenter/FormTranslator.js +27 -15
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +1 -1
- package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/DecimalFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/EmailFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/LookUpFieldTranslator.js +11 -7
- package/es/platform/zform/adapters/presenter/translators/fields/NumberFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/PhoneFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextAreaFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/TextFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/translators/fields/URLFieldTranslator.js +1 -0
- package/es/platform/zform/adapters/presenter/utils/sanitizeHtmlString.js +2 -2
- package/es/platform/zform/applications/interfaces/input/GetInitialRecordSuccessUseCaseInputModel.js +1 -0
- package/es/platform/zform/applications/usecases/GetInitialRecordSuccessUseCase.js +132 -0
- package/es/platform/zform/applications/usecases/InitializeUseCase.js +54 -30
- package/es/platform/zform/applications/usecases/LookupFieldSuccessUseCase.js +5 -0
- package/es/platform/zform/applications/usecases/MyFormSuccessUseCase.js +12 -11
- package/es/platform/zform/applications/usecases/SubmitValidationCompletedUseCase.js +21 -8
- package/es/platform/zform/domain/ZField.js +7 -5
- package/es/platform/zform/domain/ZForm.js +97 -20
- package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +23 -5
- package/es/platform/zform/frameworks/ui/ZFormBehaviourFactory.js +2 -0
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +5 -4
- package/es/platform/zrecord/adapters/controllers/UpdateRecordController.js +30 -0
- package/es/platform/zrecord/adapters/gateways/Service.js +2 -0
- package/es/platform/zrecord/applications/interfaces/input/UpdateRecordInputModel.js +0 -0
- package/es/platform/zrecord/applications/usecases/UpdateRecordUseCase.js +30 -0
- package/es/platform/zrecord/frameworks/ActionsHandlersFactory.js +4 -1
- package/package.json +9 -12
- package/es/platform/components/table-connected/adapters/controllers/ColumnChooserOpenedController.js +0 -28
- package/es/platform/components/table-connected/adapters/controllers/ColumnChooserUpdateController.js +0 -31
|
@@ -18,6 +18,7 @@ function CurrencyView(_ref, ref) {
|
|
|
18
18
|
label,
|
|
19
19
|
value,
|
|
20
20
|
placeholder,
|
|
21
|
+
maxLength,
|
|
21
22
|
errorMessage,
|
|
22
23
|
disabled,
|
|
23
24
|
readonly,
|
|
@@ -54,6 +55,7 @@ function CurrencyView(_ref, ref) {
|
|
|
54
55
|
id: id,
|
|
55
56
|
value: formattedValue,
|
|
56
57
|
placeholder: placeholder,
|
|
58
|
+
maxLength: maxLength,
|
|
57
59
|
disabled: disabled,
|
|
58
60
|
readonly: readonly,
|
|
59
61
|
required: required,
|
|
@@ -13,6 +13,7 @@ function DecimalView(_ref, ref) {
|
|
|
13
13
|
label,
|
|
14
14
|
value,
|
|
15
15
|
placeholder,
|
|
16
|
+
maxLength,
|
|
16
17
|
errorMessage,
|
|
17
18
|
disabled,
|
|
18
19
|
readonly,
|
|
@@ -42,6 +43,7 @@ function DecimalView(_ref, ref) {
|
|
|
42
43
|
id: id,
|
|
43
44
|
placeholder: placeholder,
|
|
44
45
|
value: value,
|
|
46
|
+
maxLength: maxLength,
|
|
45
47
|
required: required,
|
|
46
48
|
disabled: disabled,
|
|
47
49
|
readonly: readonly,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
-
import EmailProperties from "../../../../../../../cc/fields/
|
|
2
|
+
import EmailProperties from "../../../../../../../cc/fields/email/Properties";
|
|
3
3
|
import EmailView from "./EmailView";
|
|
4
4
|
import EventHandlersFactory from "./EventHandlerFactory";
|
|
5
5
|
import FocusFieldBehaviourFactory from "../../../../../../behaviours/field-focus/frameworks/ui/FocusFieldBehaviourFactory";
|
|
@@ -13,6 +13,7 @@ function EmailView(_ref, ref) {
|
|
|
13
13
|
label,
|
|
14
14
|
value,
|
|
15
15
|
placeholder,
|
|
16
|
+
maxLength,
|
|
16
17
|
disabled,
|
|
17
18
|
readonly,
|
|
18
19
|
errorMessage,
|
|
@@ -42,6 +43,7 @@ function EmailView(_ref, ref) {
|
|
|
42
43
|
id: id,
|
|
43
44
|
placeholder: placeholder,
|
|
44
45
|
value: value,
|
|
46
|
+
maxLength: maxLength,
|
|
45
47
|
disabled: disabled,
|
|
46
48
|
readonly: readonly,
|
|
47
49
|
required: required,
|
|
@@ -13,6 +13,7 @@ function NumberView(_ref, ref) {
|
|
|
13
13
|
label,
|
|
14
14
|
value,
|
|
15
15
|
placeholder,
|
|
16
|
+
maxLength,
|
|
16
17
|
errorMessage,
|
|
17
18
|
disabled,
|
|
18
19
|
readonly,
|
|
@@ -42,6 +43,7 @@ function NumberView(_ref, ref) {
|
|
|
42
43
|
id: id,
|
|
43
44
|
placeholder: placeholder,
|
|
44
45
|
value: value,
|
|
46
|
+
maxLength: maxLength,
|
|
45
47
|
disabled: disabled,
|
|
46
48
|
readonly: readonly,
|
|
47
49
|
required: required,
|
|
@@ -13,6 +13,7 @@ function PhoneView(_ref, ref) {
|
|
|
13
13
|
label,
|
|
14
14
|
value,
|
|
15
15
|
placeholder,
|
|
16
|
+
maxLength,
|
|
16
17
|
errorMessage,
|
|
17
18
|
disabled,
|
|
18
19
|
readonly,
|
|
@@ -42,6 +43,7 @@ function PhoneView(_ref, ref) {
|
|
|
42
43
|
id: id,
|
|
43
44
|
placeholder: placeholder,
|
|
44
45
|
value: value,
|
|
46
|
+
maxLength: maxLength,
|
|
45
47
|
disabled: disabled,
|
|
46
48
|
readonly: readonly,
|
|
47
49
|
required: required,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
-
import TextAreaProperties from "../../../../../../../cc/fields/
|
|
2
|
+
import TextAreaProperties from "../../../../../../../cc/fields/multi-line/Properties";
|
|
3
3
|
import TextAreaView from "./TextAreaView";
|
|
4
4
|
import EventHandlerFactory from "./EventHandlerFactory";
|
|
5
5
|
import FocusFieldBehaviourFactory from "../../../../../../behaviours/field-focus/frameworks/ui/FocusFieldBehaviourFactory";
|
|
@@ -20,7 +20,8 @@ function TextAreaView(_ref, ref) {
|
|
|
20
20
|
uiConfig,
|
|
21
21
|
labelActions,
|
|
22
22
|
actions,
|
|
23
|
-
clientScripts
|
|
23
|
+
clientScripts,
|
|
24
|
+
maxLength
|
|
24
25
|
} = state.properties;
|
|
25
26
|
const {
|
|
26
27
|
size,
|
|
@@ -46,7 +47,8 @@ function TextAreaView(_ref, ref) {
|
|
|
46
47
|
disabled: disabled,
|
|
47
48
|
readonly: readonly,
|
|
48
49
|
actions: actions,
|
|
49
|
-
clientScripts: clientScripts
|
|
50
|
+
clientScripts: clientScripts,
|
|
51
|
+
maxLength: maxLength
|
|
50
52
|
})));
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -13,6 +13,7 @@ function TextBoxView(_ref, ref) {
|
|
|
13
13
|
label,
|
|
14
14
|
value,
|
|
15
15
|
placeholder,
|
|
16
|
+
maxLength,
|
|
16
17
|
errorMessage,
|
|
17
18
|
disabled,
|
|
18
19
|
readonly,
|
|
@@ -42,6 +43,7 @@ function TextBoxView(_ref, ref) {
|
|
|
42
43
|
id: id,
|
|
43
44
|
placeholder: placeholder,
|
|
44
45
|
value: value,
|
|
46
|
+
maxLength: maxLength,
|
|
45
47
|
required: required,
|
|
46
48
|
disabled: disabled,
|
|
47
49
|
readonly: readonly,
|
|
@@ -13,6 +13,7 @@ function UrlView(_ref, ref) {
|
|
|
13
13
|
label,
|
|
14
14
|
value,
|
|
15
15
|
placeholder,
|
|
16
|
+
maxLength,
|
|
16
17
|
uiConfig,
|
|
17
18
|
errorMessage,
|
|
18
19
|
disabled,
|
|
@@ -42,6 +43,7 @@ function UrlView(_ref, ref) {
|
|
|
42
43
|
id: id,
|
|
43
44
|
placeholder: placeholder,
|
|
44
45
|
value: value,
|
|
46
|
+
maxLength: maxLength,
|
|
45
47
|
disabled: disabled,
|
|
46
48
|
readonly: readonly,
|
|
47
49
|
required: required,
|
package/es/library/dot/components/table-list/frameworks/ui/sub-components/header/HeaderData.js
CHANGED
|
@@ -41,7 +41,7 @@ function HeaderData(_ref) {
|
|
|
41
41
|
},
|
|
42
42
|
$customProps_container: hasActions ? {
|
|
43
43
|
$ui_displayMode: 'flex',
|
|
44
|
-
$ui_alignItems: 'center',
|
|
44
|
+
$ui_alignItems: isMultiline ? 'baseline' : 'center',
|
|
45
45
|
$ui_justifyContent: AlignmentOfFlex[alignment]
|
|
46
46
|
} : null,
|
|
47
47
|
customStyle: hasActions ? {
|
|
@@ -6,6 +6,16 @@ export default function TextFieldView(_ref, ref) {
|
|
|
6
6
|
} = _ref;
|
|
7
7
|
const {
|
|
8
8
|
text,
|
|
9
|
+
size,
|
|
10
|
+
display,
|
|
11
|
+
decoration,
|
|
12
|
+
textAlign,
|
|
13
|
+
lineClamp,
|
|
14
|
+
lineHeight,
|
|
15
|
+
transform,
|
|
16
|
+
whiteSpace,
|
|
17
|
+
wordWrap,
|
|
18
|
+
wordBreak,
|
|
9
19
|
weight,
|
|
10
20
|
isDotted,
|
|
11
21
|
tooltip
|
|
@@ -13,6 +23,16 @@ export default function TextFieldView(_ref, ref) {
|
|
|
13
23
|
return /*#__PURE__*/React.createElement(Text, {
|
|
14
24
|
getRef: ref,
|
|
15
25
|
text: text,
|
|
26
|
+
size: size,
|
|
27
|
+
display: display,
|
|
28
|
+
decoration: decoration,
|
|
29
|
+
textAlign: textAlign,
|
|
30
|
+
lineClamp: lineClamp,
|
|
31
|
+
lineHeight: lineHeight,
|
|
32
|
+
transform: transform,
|
|
33
|
+
whiteSpace: whiteSpace,
|
|
34
|
+
wordWrap: wordWrap,
|
|
35
|
+
wordBreak: isDotted ? wordBreak : 'breakWord',
|
|
16
36
|
tooltip: tooltip,
|
|
17
37
|
weight: weight,
|
|
18
38
|
isDotted: isDotted
|
|
@@ -12,7 +12,18 @@ function TextView(_ref, ref) {
|
|
|
12
12
|
} = helpers;
|
|
13
13
|
let {
|
|
14
14
|
text,
|
|
15
|
+
size,
|
|
16
|
+
display,
|
|
17
|
+
decoration,
|
|
18
|
+
textAlign,
|
|
19
|
+
lineClamp,
|
|
20
|
+
lineHeight,
|
|
21
|
+
letterSpacing,
|
|
22
|
+
transform,
|
|
23
|
+
whiteSpace,
|
|
24
|
+
wordWrap,
|
|
15
25
|
weight,
|
|
26
|
+
wordBreak,
|
|
16
27
|
tooltip,
|
|
17
28
|
isDotted
|
|
18
29
|
} = state.properties;
|
|
@@ -27,9 +38,19 @@ function TextView(_ref, ref) {
|
|
|
27
38
|
});
|
|
28
39
|
}
|
|
29
40
|
},
|
|
30
|
-
$ui_size:
|
|
41
|
+
$ui_size: size,
|
|
31
42
|
$flag_dotted: isDotted,
|
|
43
|
+
$ui_display: display,
|
|
44
|
+
$ui_decoration: decoration,
|
|
32
45
|
$ui_weight: weight,
|
|
46
|
+
$ui_textAlign: textAlign,
|
|
47
|
+
$ui_wordBreak: wordBreak,
|
|
48
|
+
$ui_lineClamp: lineClamp,
|
|
49
|
+
$ui_letterSpacing: letterSpacing,
|
|
50
|
+
$ui_lineHeight: lineHeight,
|
|
51
|
+
$ui_transform: transform,
|
|
52
|
+
$ui_whiteSpace: whiteSpace,
|
|
53
|
+
$ui_wordWrap: wordWrap,
|
|
33
54
|
$i18n_dataTitle: tooltip || text
|
|
34
55
|
}, text);
|
|
35
56
|
}
|
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import AbstractController from "./AbstractController";
|
|
2
|
+
|
|
3
|
+
class UpdatePropertiesController extends AbstractController {
|
|
4
|
+
handle(event) {
|
|
5
|
+
const {
|
|
6
|
+
updatePropertiesUsecase
|
|
7
|
+
} = this.service;
|
|
8
|
+
const {
|
|
9
|
+
state,
|
|
10
|
+
updateState,
|
|
11
|
+
action
|
|
12
|
+
} = event;
|
|
13
|
+
const {
|
|
14
|
+
currentProperties,
|
|
15
|
+
previousProperties
|
|
16
|
+
} = action.payload;
|
|
17
|
+
const {
|
|
18
|
+
context
|
|
19
|
+
} = previousProperties;
|
|
20
|
+
const {
|
|
21
|
+
context: newContext
|
|
22
|
+
} = currentProperties;
|
|
23
|
+
updatePropertiesUsecase.updateDependencies(state, updateState);
|
|
24
|
+
updatePropertiesUsecase.execute({
|
|
25
|
+
context,
|
|
26
|
+
newContext
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default UpdatePropertiesController;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { platformSDK } from "../../../sdk/frameworks/Sdk";
|
|
2
|
+
import ResourceNamesEnum from "../../../../bc/sdk/ResourceNamesEnum";
|
|
3
|
+
import AppContext from "../../domain/entities/AppContext";
|
|
4
|
+
const EMPTY_OBJ = {};
|
|
5
|
+
export default class Repository {
|
|
6
|
+
init(state) {
|
|
7
|
+
this.state = state;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
getAppContextEntity() {
|
|
11
|
+
const {
|
|
12
|
+
context
|
|
13
|
+
} = this.state.properties;
|
|
14
|
+
const appResource = platformSDK[ResourceNamesEnum.APP];
|
|
15
|
+
const headers = appResource ? appResource.getApiHeader() : EMPTY_OBJ;
|
|
16
|
+
const appContext = appResource ? appResource.getContext() : EMPTY_OBJ;
|
|
17
|
+
return new AppContext({ ...appContext,
|
|
18
|
+
...context
|
|
19
|
+
}, headers);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default class Presenter {
|
|
2
|
+
updateDependencies(state, updateState) {
|
|
3
|
+
this.state = state;
|
|
4
|
+
this.updateState = updateState;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
updateBehaviourState(data) {
|
|
8
|
+
this.state = { ...this.state,
|
|
9
|
+
behaviours: { ...this.state.behaviours,
|
|
10
|
+
appContext: data
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
this.updateState(this.state);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/platform/app-context-behaviour/applications/interfaces/output/BehaviourOutputModel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class AbstractUseCase {
|
|
2
|
+
constructor(dependencies) {
|
|
3
|
+
this.dependencies = dependencies;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
updateDependencies(state, updateState) {
|
|
7
|
+
const {
|
|
8
|
+
repository,
|
|
9
|
+
presenter
|
|
10
|
+
} = this.dependencies;
|
|
11
|
+
repository.init(state);
|
|
12
|
+
presenter.updateDependencies(state, updateState);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default AbstractUseCase;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import AbstractUseCase from "./AbstractUseCase";
|
|
2
|
+
|
|
3
|
+
class UpdatePropertiesUsecase extends AbstractUseCase {
|
|
4
|
+
execute(input) {
|
|
5
|
+
const {
|
|
6
|
+
repository,
|
|
7
|
+
presenter
|
|
8
|
+
} = this.dependencies;
|
|
9
|
+
const {
|
|
10
|
+
context,
|
|
11
|
+
newContext
|
|
12
|
+
} = input;
|
|
13
|
+
const appContext = repository.getAppContextEntity();
|
|
14
|
+
|
|
15
|
+
if (appContext.isEqualContext(context, newContext)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
appContext.updateContext(newContext);
|
|
20
|
+
presenter.updateBehaviourState(appContext.toObject());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default UpdatePropertiesUsecase;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class AppContext {
|
|
2
|
+
constructor(context, headers) {
|
|
3
|
+
this.context = context;
|
|
4
|
+
this.headers = headers;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
updateContext(context) {
|
|
8
|
+
this.context = { ...this.context,
|
|
9
|
+
...context
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getContext() {
|
|
14
|
+
return this.context;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
isEqualContext(context1, context2) {
|
|
18
|
+
// shallow comparison
|
|
19
|
+
const keys1 = Object.keys(context1);
|
|
20
|
+
const keys2 = Object.keys(context2);
|
|
21
|
+
|
|
22
|
+
if (keys1.length !== keys2.length) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (const key of keys1) {
|
|
27
|
+
if (context1[key] !== context2[key]) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
toObject() {
|
|
36
|
+
return {
|
|
37
|
+
context: this.context,
|
|
38
|
+
headers: this.headers
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default AppContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import AppContextProperties from "../../../bc/app-context/Properties";
|
|
2
2
|
import { platformSDK } from "../../sdk/frameworks/Sdk";
|
|
3
3
|
import ResourceNamesEnum from "../../../bc/sdk/ResourceNamesEnum";
|
|
4
|
+
import EventHandlersFactory from "./EventHandlerFactory";
|
|
4
5
|
|
|
5
6
|
class AppContextBehaviourFactory {
|
|
6
7
|
static create() {
|
|
@@ -20,8 +21,7 @@ class AppContextBehaviourFactory {
|
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
eventHandlers: {},
|
|
24
|
+
eventHandlers: EventHandlersFactory.create(),
|
|
25
25
|
properties: AppContextProperties
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import LifeCycleAction from "../../../cc/architecture/LifeCycleActionEnum";
|
|
2
|
+
import Repository from "../adapters/gateway/Repository";
|
|
3
|
+
import Service from "../adapters/gateway/Service";
|
|
4
|
+
import Presenter from "../adapters/presenter/Presenter";
|
|
5
|
+
import UpdatePropertiesController from "../adapters/controllers/UpdatePropertiesController";
|
|
6
|
+
|
|
7
|
+
class EventHandlersFactory {
|
|
8
|
+
static create() {
|
|
9
|
+
const presenter = new Presenter();
|
|
10
|
+
const repository = new Repository();
|
|
11
|
+
const service = new Service({
|
|
12
|
+
presenter,
|
|
13
|
+
repository
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
[LifeCycleAction.UPDATE_PROPERTIES]: new UpdatePropertiesController(service).handle
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default EventHandlersFactory;
|
package/es/platform/client-actions/behaviour/zclient-actions/adapters/presenters/FilterUtils.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function validateClientActionLocation(actualLocation, expectedLocation) {
|
|
2
|
+
return actualLocation === expectedLocation || actualLocation.endsWith(`.${expectedLocation}`);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function validateClientAction(clientAction, location) {
|
|
6
|
+
return clientAction.location && validateClientActionLocation(clientAction.location, location);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function filterClientActionsByLocation(clientActions, location) {
|
|
10
|
+
return clientActions.filter(clientAction => clientAction && validateClientAction(clientAction, location));
|
|
11
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import FetchGateWay from "../../../../../zhttp/adapters/gateway/FetchGateWay";
|
|
2
|
+
import APITemplate from "../../../../../zdata-source/domain/entities/APITemplate";
|
|
3
|
+
import getClientActions from "../../../../../data-source/http-template/getPageClientActions";
|
|
4
|
+
import TemplateHelpers from "../../../../../zdata-source/adapters/gateways/TemplateHelpers";
|
|
5
|
+
|
|
6
|
+
//TODO: Remove this SDK when smart page is ready for production
|
|
7
|
+
// Use this SDK only for fetching client actions at page level in desk_client_app until smart page is ready
|
|
8
|
+
class ClientActionsFetchSDK {
|
|
9
|
+
getClientActionsAPIDetails(args) {
|
|
10
|
+
const apiTemplate = new APITemplate(getClientActions, new TemplateHelpers());
|
|
11
|
+
const apiArgs = { ...args,
|
|
12
|
+
servicePrefix: 'supportapi/zd',
|
|
13
|
+
// @ts-ignore - custom property
|
|
14
|
+
orgName: window.currentOrg.portalName
|
|
15
|
+
};
|
|
16
|
+
const apiDetailsModel = apiTemplate.getApiDetails(apiArgs);
|
|
17
|
+
return { ...apiDetailsModel,
|
|
18
|
+
options: {
|
|
19
|
+
headers: {
|
|
20
|
+
// @ts-ignore - custom property
|
|
21
|
+
orgId: window.currentOrg.id
|
|
22
|
+
},
|
|
23
|
+
method: apiDetailsModel.method
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
mapClientActionsByInstanceLocation(clientActions) {
|
|
29
|
+
const filteredClientActionsMap = new Map();
|
|
30
|
+
|
|
31
|
+
for (const clientAction of clientActions) {
|
|
32
|
+
const {
|
|
33
|
+
location,
|
|
34
|
+
component
|
|
35
|
+
} = clientAction;
|
|
36
|
+
const locationPathArr = location.split('.');
|
|
37
|
+
const instanceName = locationPathArr[1] || component;
|
|
38
|
+
const locationName = locationPathArr[2] || location;
|
|
39
|
+
|
|
40
|
+
if (!instanceName || !locationName) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!filteredClientActionsMap.has(instanceName)) {
|
|
45
|
+
filteredClientActionsMap.set(instanceName, {});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const instanceActions = filteredClientActionsMap.get(instanceName);
|
|
49
|
+
|
|
50
|
+
if (!instanceActions[locationName]) {
|
|
51
|
+
instanceActions[locationName] = [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
instanceActions[locationName].push(clientAction);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return filteredClientActionsMap;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async fetchClientActions(params) {
|
|
61
|
+
const apiDetails = this.getClientActionsAPIDetails(params);
|
|
62
|
+
const fetchGateway = new FetchGateWay(window.fetch.bind(window));
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
fetchGateway.fetch(apiDetails.url, apiDetails.options).then(response => response.json()).then(clientActions => {
|
|
65
|
+
this.clientActions = clientActions;
|
|
66
|
+
const filteredClientActionsMap = this.mapClientActionsByInstanceLocation(this.clientActions);
|
|
67
|
+
return resolve(filteredClientActionsMap);
|
|
68
|
+
}).catch(err => {
|
|
69
|
+
reject(err);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default ClientActionsFetchSDK;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var ClientActionPage = /*#__PURE__*/function (ClientActionPage) {
|
|
2
|
+
ClientActionPage["LIST"] = "list";
|
|
3
|
+
ClientActionPage["DETAILS"] = "details";
|
|
4
|
+
ClientActionPage["CREATE_PAGE"] = "createPage";
|
|
5
|
+
ClientActionPage["EDIT_PAGE"] = "editPage";
|
|
6
|
+
ClientActionPage["ALL_PAGES"] = "allPages";
|
|
7
|
+
return ClientActionPage;
|
|
8
|
+
}(ClientActionPage || {});
|
|
9
|
+
|
|
10
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import APITemplate from "../../../../../zdata-source/domain/entities/APITemplate";
|
|
2
|
+
import TemplateHelpers from "../../../../../zdata-source/adapters/gateways/TemplateHelpers";
|
|
3
|
+
import FetchGateWay from "../../../../../zhttp/adapters/gateway/FetchGateWay";
|
|
4
|
+
import getClientScripts from "../../../../../data-source/http-template/getClientScripts";
|
|
5
|
+
|
|
6
|
+
//TODO: Remove this SDK when smart page is ready for production
|
|
7
|
+
// Use this SDK only for fetching client actions at page level in desk_client_app until smart page is ready
|
|
8
|
+
class ClientScriptsFetchSDK {
|
|
9
|
+
getClientScriptsAPIDetails(args) {
|
|
10
|
+
const apiTemplate = new APITemplate(getClientScripts, new TemplateHelpers());
|
|
11
|
+
const apiArgs = { ...args,
|
|
12
|
+
servicePrefix: 'supportapi/zd',
|
|
13
|
+
// @ts-ignore - custom property
|
|
14
|
+
orgName: window.currentOrg.portalName
|
|
15
|
+
};
|
|
16
|
+
const apiDetailsModel = apiTemplate.getApiDetails(apiArgs);
|
|
17
|
+
return { ...apiDetailsModel,
|
|
18
|
+
options: {
|
|
19
|
+
headers: {
|
|
20
|
+
// @ts-ignore - custom property
|
|
21
|
+
orgId: window.currentOrg.id
|
|
22
|
+
},
|
|
23
|
+
method: apiDetailsModel.method
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async fetchClientScripts(params) {
|
|
29
|
+
const apiDetails = this.getClientScriptsAPIDetails(params);
|
|
30
|
+
const fetchGateway = new FetchGateWay(window.fetch.bind(window));
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
fetchGateway.fetch(apiDetails.url, apiDetails.options).then(response => response.json()).then(clientScripts => {
|
|
33
|
+
this.clientScripts = clientScripts;
|
|
34
|
+
return resolve(clientScripts);
|
|
35
|
+
}).catch(err => {
|
|
36
|
+
reject(err);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default ClientScriptsFetchSDK;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|