@zohodesk/library-platform 1.1.9-alpha.1 → 1.1.9-exp.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/es/bc/app-context/Constants.js +0 -0
  2. package/es/bc/app-context/Event.js +1 -0
  3. package/es/bc/app-context/EventHandlers.js +0 -0
  4. package/es/bc/app-context/Properties.js +58 -0
  5. package/es/bc/zform/Properties.js +6 -0
  6. package/es/bc/zlist/Properties.js +6 -0
  7. package/es/cc/component/ErrorStructure.js +9 -0
  8. package/es/cc/error-state/ErrorTypes.js +11 -0
  9. package/es/cc/error-state/Properties.js +31 -0
  10. package/es/cc/error-state/index.js +2 -0
  11. package/es/cc/fields/currency/Model.js +2 -0
  12. package/es/cc/fields/text/Properties.js +1 -1
  13. package/es/cc/form-connected/ExternalConstants.js +11 -0
  14. package/es/cc/form-connected/index.js +1 -1
  15. package/es/cc/switch/Properties.js +2 -2
  16. package/es/cc/table-connected/Events.js +1 -1
  17. package/es/cc/table-connected/Properties.js +6 -0
  18. package/es/cc/table-connected/constants/Events.js +1 -8
  19. package/es/cc/table-connected/constants/ExternalConstants.js +9 -0
  20. package/es/cc/table-connected/constants/index.js +2 -1
  21. package/es/index.js +12 -2
  22. package/es/library/custom-component/domain/entities/ComponentProperties.js +121 -0
  23. package/es/library/custom-component/domain/entities/Logger.js +63 -0
  24. package/es/library/custom-component/domain/entities/interfaces/IComponentProperties.js +0 -0
  25. package/es/library/custom-component/frameworks/json-schema-validator/Validator.js +71 -10
  26. package/es/library/dot/components/form/frameworks/ui/FormView.js +3 -1
  27. package/es/library/dot/components/form-fields/currency/frameworks/ui/CurrencyView.js +15 -3
  28. package/es/library/dot/components/form-fields/currency/frameworks/ui/EventHandlerFactory.js +8 -0
  29. package/es/library/dot/components/section/frameworks/ui/SectionView.js +1 -0
  30. package/es/library/dot/components/table-list/adapters/controllers/KeyboardRowClickController.js +1 -1
  31. package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +1 -0
  32. package/es/library/dot/legacy-to-new-arch/error-state/frameworks/ui/ErrorState.js +10 -0
  33. package/es/library/dot/legacy-to-new-arch/error-state/frameworks/ui/ErrorStateView.js +68 -0
  34. package/es/library/dot/legacy-to-new-arch/switch/frameworks/ui/SwitchView.js +5 -5
  35. package/es/library/dot/legacy-to-new-arch/table-field-components/currency-field/frameworks/ui/CurrencyFieldView.js +10 -2
  36. package/es/library/dot/legacy-to-new-arch/table-field-components/switch-field/frameworks/ui/SwitchFieldView.js +0 -1
  37. package/es/library/translator-common/adapters/presenter/formatCurrency.js +42 -0
  38. package/es/library/translator-common/index.js +2 -1
  39. package/es/platform/app-context-behaviour/adapters/controllers/AbstractController.js +7 -0
  40. package/es/platform/app-context-behaviour/adapters/controllers/InitializeController.js +19 -0
  41. package/es/platform/app-context-behaviour/adapters/gateways/Service.js +7 -0
  42. package/es/platform/app-context-behaviour/adapters/presenters/Presenter.js +18 -0
  43. package/es/platform/app-context-behaviour/adapters/resources/AppResource.js +25 -0
  44. package/es/platform/app-context-behaviour/applications/AbstractUseCase.js +6 -0
  45. package/es/platform/app-context-behaviour/applications/interfaces/UsecaseDependencies.js +1 -0
  46. package/es/platform/app-context-behaviour/applications/interfaces/gateways/IService.js +1 -0
  47. package/es/platform/app-context-behaviour/applications/interfaces/input/InitializeUseCaseInputModel.js +1 -0
  48. package/es/platform/app-context-behaviour/applications/interfaces/output/BehaviourState.js +1 -0
  49. package/es/platform/app-context-behaviour/applications/interfaces/output/IPresenter.js +1 -0
  50. package/es/platform/app-context-behaviour/applications/interfaces/resources/ApiHeaderContract.js +1 -0
  51. package/es/platform/app-context-behaviour/applications/interfaces/resources/ContextContract.js +1 -0
  52. package/es/platform/app-context-behaviour/applications/interfaces/resources/IAppResource.js +1 -0
  53. package/es/platform/app-context-behaviour/applications/usecases/InitializeUseCase.js +15 -0
  54. package/es/platform/app-context-behaviour/frameworks/AppContextBehaviourFactory.js +31 -0
  55. package/es/platform/app-context-behaviour/frameworks/EventHandlerFactory.js +25 -0
  56. package/es/platform/components/form-connected/frameworks/EventHandlersFactory.js +1 -1
  57. package/es/platform/components/form-connected/frameworks/FallbackView.js +23 -0
  58. package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +4 -4
  59. package/es/platform/data-source/http-template/getDependencyMappings.js +18 -0
  60. package/es/platform/data-source/http-template/getLayoutRules.js +29 -0
  61. package/es/platform/data-source/http-template/getMyForm.js +19 -0
  62. package/es/platform/data-source/http-template/getMyLayout.js +43 -0
  63. package/es/platform/data-source/http-template/getValidationRules.js +30 -0
  64. package/es/platform/zform/adapters/controllers/ApiFailureController.js +31 -0
  65. package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +7 -2
  66. package/es/platform/zform/adapters/presenter/translators/fields/CurrencyFieldTranslator.js +9 -1
  67. package/es/platform/zform/adapters/presenter/utils/sanitizeHtmlString.js +11 -0
  68. package/es/platform/zform/applications/interfaces/input/ApiFailureInputModel.js +1 -0
  69. package/es/platform/zform/applications/usecases/ApiFailureUseCase.js +30 -0
  70. package/es/platform/zform/domain/ZForm.js +1 -0
  71. package/es/platform/zform/frameworks/ui/EventHandlerFactory.js +1 -1
  72. package/es/platform/zlist/adapters/presenters/TableTranslator.js +1 -1
  73. package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +3 -3
  74. package/es/platform/zlist/adapters/presenters/translators/Row.js +3 -2
  75. package/es/platform/zlist/adapters/presenters/translators/RowsTranslator.js +4 -2
  76. package/es/platform/zlist/adapters/presenters/translators/fields/CurrencyFieldTranslator.js +7 -2
  77. package/es/platform/zlist/adapters/presenters/translators/fields/FormulaFieldTranslator.js +7 -2
  78. package/es/platform/zlist/domain/entities/List.js +2 -2
  79. package/package.json +19 -15
@@ -2,6 +2,7 @@ import { DefaultFormSectionUIType, fieldTypeToUIType } from "../../../../../cc/f
2
2
  import * as FieldTranslators from "./fields";
3
3
  import ClientActionsTranslator from "../../../../client-actions/translators/client-actions-translator";
4
4
  import { getDefaultFieldEphiActionTemplate, getDefaultFieldInfoActionTemplate } from "../utils/DefaultClientActions";
5
+ import sanitizeHtmlString from "../utils/sanitizeHtmlString";
5
6
 
6
7
  function SectionTranslator(_ref) {
7
8
  let {
@@ -24,7 +25,9 @@ function SectionTranslator(_ref) {
24
25
  id: section.id + '',
25
26
  name: section.name,
26
27
  title: section.i18NLabel,
27
- description: section.description,
28
+ description: sanitizeHtmlString({
29
+ htmlString: section.description
30
+ }),
28
31
  isCollapsed: section.isCollapsed,
29
32
  isVisible: section.isVisible && sectionVisibility(section),
30
33
  fields: section.fields.map(field => {
@@ -94,7 +97,9 @@ function SectionTranslator(_ref) {
94
97
  field,
95
98
  type,
96
99
  fieldPreModified,
97
- uiConfig
100
+ uiConfig,
101
+ context,
102
+ preferences
98
103
  });
99
104
  viewModel.isFocused = focusedFieldName === field.apiName;
100
105
  return translator ? translator({
@@ -3,8 +3,14 @@ const CurrencyFieldTranslator = _ref => {
3
3
  field,
4
4
  type,
5
5
  fieldPreModified,
6
- uiConfig
6
+ uiConfig,
7
+ context,
8
+ preferences
7
9
  } = _ref;
10
+ let prefCurrencyLocale = preferences?.fields?.[field.apiName]?.currencyLocale;
11
+ let contextCurrencyLocale = context?.currencyLocale;
12
+ let prefCurrencySymbol = preferences?.fields?.[field.apiName]?.currencySymbol;
13
+ let contextCurrencySymbol = context?.currencySymbol;
8
14
  const fieldModified = {
9
15
  type,
10
16
  uiConfig,
@@ -17,6 +23,8 @@ const CurrencyFieldTranslator = _ref => {
17
23
  required: field.isMandatory,
18
24
  readonly: field.isReadOnly,
19
25
  isVisible: field.isVisible,
26
+ currencyLocale: prefCurrencyLocale || contextCurrencyLocale,
27
+ currencySymbol: prefCurrencySymbol || contextCurrencySymbol,
20
28
  errorMessage: field.errorMessage || ''
21
29
  };
22
30
  return fieldModified;
@@ -0,0 +1,11 @@
1
+ import ZSEC from '@zoho/SecurityJS';
2
+ const currentZSEC = ZSEC['7.2.4'];
3
+ const {
4
+ HTMLPurifier
5
+ } = currentZSEC;
6
+ export default function sanitizeHtmlString(_ref) {
7
+ let {
8
+ htmlString
9
+ } = _ref;
10
+ return HTMLPurifier.sanitize(htmlString);
11
+ }
@@ -0,0 +1,30 @@
1
+ import { ACA_ERROR_OCCURRED } from "../../../../cc/component/ErrorStructure";
2
+ import AbstractUseCase from "./AbstractUseCase";
3
+
4
+ class ApiFailureUseCase extends AbstractUseCase {
5
+ execute(params) {
6
+ const {
7
+ error,
8
+ metaData,
9
+ dispatch
10
+ } = params;
11
+ const {
12
+ actionName
13
+ } = metaData;
14
+ const {
15
+ repository,
16
+ presenter
17
+ } = this.dependencies;
18
+ const zFormEntity = repository.getFormEntity();
19
+ const isBreaking = zFormEntity.stopLoadingAndDecideIsBreaking(actionName);
20
+ const errorStructure = zFormEntity.constructApiErrorEvent(error, actionName, isBreaking);
21
+ presenter.updateFormResponse(zFormEntity.toObject());
22
+ dispatch({
23
+ type: ACA_ERROR_OCCURRED,
24
+ payload: errorStructure
25
+ });
26
+ }
27
+
28
+ }
29
+
30
+ export default ApiFailureUseCase;
@@ -80,6 +80,7 @@ export default class ZForm {
80
80
  module,
81
81
  departmentId: departmentId,
82
82
  orgName,
83
+ ...this.context,
83
84
  servicePrefix: servicePrefix || 'supportapi/zd' // FIX: servicePrefix defaultValue should be available from properties
84
85
 
85
86
  };
@@ -24,7 +24,7 @@ import FormValidator from "../validation-rules/Validator";
24
24
  import SetFieldErrorMessageController from "../../adapters/controllers/SetFieldErrorMessageController";
25
25
  import LayoutRuleApplier from "../layout-rules/LayoutRuleApplier";
26
26
  import { RECORD_EXECUTE_FAIL_CALLBACK, RECORD_EXECUTE_SUCCESS_CALLBACK } from "../../../../bc/zrecord/Constants";
27
- import SmartFormConstants from "../../../../cc/form-connected/Constants";
27
+ import SmartFormConstants from "../../../../cc/form-connected/ExternalConstants";
28
28
  import FieldBlurController from "../../adapters/controllers/FieldBlurController";
29
29
  import SubmitValidationCompletedController from "../../adapters/controllers/SubmitValidationCompletedController";
30
30
  import ValidationRulesExecutionResultController from "../../adapters/controllers/ValidationRulesExecutionResultController";
@@ -100,7 +100,7 @@ export default class TableTranslator {
100
100
  const modifiedWidths = calculateFieldWidths(fields, localStorageFieldWidths, preferences);
101
101
  const recordsForDisplay = isRecordsShouldBeEmptied ? EMPTY_ARRAY : records;
102
102
  const headersTranslator = new HeadersTranslator(fields, headerActions, context, modifiedWidths, sortBy, records);
103
- const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, fieldComponentMapping, rowActionsUiType, fieldActions); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
103
+ const rowsTranslator = new RowsTranslator(recordsForDisplay, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions); // const actionTranslator = new ClientActionsTranslator(clientActions, records, fields, pageContext);
104
104
  // const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator(), actionTranslator.getTranslator()];
105
105
 
106
106
  const translators = [headersTranslator.getTranslator(), rowsTranslator.getTranslator()];
@@ -17,7 +17,7 @@ function getLookupUrlConstructions(_ref) {
17
17
  return `/agent/${orgName}/${departmentName}/${lookupModuleName}/details/${value.id}`;
18
18
  }
19
19
 
20
- function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context) {
20
+ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences) {
21
21
  const {
22
22
  isCustomField,
23
23
  name,
@@ -76,7 +76,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
76
76
  actions,
77
77
  ...fieldTranslator(field, tempValue ? tempValue : finalValue, {
78
78
  recordId: record.id
79
- })
79
+ }, context, preferences)
80
80
  };
81
81
  data.value = fieldEntry.fieldToUIComponentTranslator({
82
82
  field,
@@ -91,7 +91,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
91
91
  actions,
92
92
  ...fieldTranslator(field, finalValue, {
93
93
  recordId: record.id
94
- })
94
+ }, context, preferences)
95
95
  };
96
96
  }
97
97
 
@@ -8,14 +8,15 @@ export default function RowTranslator(_ref) {
8
8
  rowActionsUiType,
9
9
  rowActions,
10
10
  fieldActions,
11
- context
11
+ context,
12
+ preferences
12
13
  } = _ref;
13
14
  const actions = ClientActionsTranslator.transform(rowActions, { ...context,
14
15
  record
15
16
  });
16
17
  return {
17
18
  id: record.id,
18
- columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context)),
19
+ columns: fields.map(field => ColumnTranslator(field, record, fieldComponentMapping, fieldActions, context, preferences)),
19
20
  rowActionLocation: {
20
21
  type: rowActionsUiType,
21
22
  actions
@@ -1,10 +1,11 @@
1
1
  import RowTranslator from "./Row";
2
2
  export default class RowsTranslator {
3
- constructor(records, fields, rowActions, context, fieldComponentMapping, rowActionsUiType, fieldActions) {
3
+ constructor(records, fields, rowActions, context, preferences, fieldComponentMapping, rowActionsUiType, fieldActions) {
4
4
  this.records = records;
5
5
  this.fields = fields;
6
6
  this.rowActions = rowActions;
7
7
  this.context = context;
8
+ this.preferences = preferences;
8
9
  this.fieldComponentMapping = fieldComponentMapping;
9
10
  this.rowActionsUiType = rowActionsUiType;
10
11
  this.fieldActions = fieldActions;
@@ -23,7 +24,8 @@ export default class RowsTranslator {
23
24
  rowActionsUiType: this.rowActionsUiType,
24
25
  rowActions: this.rowActions,
25
26
  fieldActions: this.fieldActions,
26
- context: this.context
27
+ context: this.context,
28
+ preferences: this.preferences
27
29
  }));
28
30
  }
29
31
 
@@ -1,16 +1,21 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
2
  import CurrencyFieldModel from "../../../../../../cc/fields/currency/Model";
3
3
 
4
- const CurrencyFieldTranslator = (field, value, appendToActionPayload) => {
4
+ const CurrencyFieldTranslator = (field, value, appendToActionPayload, context, preferences) => {
5
5
  const {
6
6
  uiType,
7
7
  name
8
8
  } = field;
9
+ let prefCurrencyLocale = preferences?.fields?.[field.apiName]?.currencyLocale;
10
+ let contextCurrencyLocale = context?.currencyLocale;
11
+ let prefCurrencySymbol = preferences?.fields?.[field.apiName]?.currencySymbol;
12
+ let contextCurrencySymbol = context?.currencySymbol;
9
13
  return CurrencyFieldModel({
10
14
  uiType: uiType || FieldTypes.CurrencyField,
11
15
  appendToActionPayload,
12
16
  name,
13
- currencyLocale: "INR",
17
+ currencyLocale: prefCurrencyLocale || contextCurrencyLocale,
18
+ currencySymbol: prefCurrencySymbol || contextCurrencySymbol,
14
19
  value
15
20
  });
16
21
  };
@@ -1,11 +1,15 @@
1
1
  import FieldTypes from "../../../../../../cc/fields/field/Types";
2
2
  import FormulaFieldModel from "../../../../../../cc/fields/formula/Model";
3
3
 
4
- const FormulaFieldTranslator = (field, value, appendToActionPayload) => {
4
+ const FormulaFieldTranslator = (field, value, appendToActionPayload, context, preferences) => {
5
5
  const {
6
6
  uiType,
7
7
  name
8
8
  } = field;
9
+ let prefCurrencyLocale = preferences?.fields?.[field.apiName]?.currencyLocale;
10
+ let contextCurrencyLocale = context?.currencyLocale;
11
+ let prefCurrencySymbol = preferences?.fields?.[field.apiName]?.currencySymbol;
12
+ let contextCurrencySymbol = context?.currencySymbol;
9
13
  const fieldTypeFactory = {
10
14
  STRING: FieldTypes.SingleLineField,
11
15
  BOOLEAN: FieldTypes.CheckboxField,
@@ -20,7 +24,8 @@ const FormulaFieldTranslator = (field, value, appendToActionPayload) => {
20
24
  appendToActionPayload,
21
25
  name,
22
26
  ...(setFieldType === FieldTypes.CurrencyField && {
23
- currencyLocale: "INR"
27
+ currencyLocale: prefCurrencyLocale || contextCurrencyLocale,
28
+ currencySymbol: prefCurrencySymbol || contextCurrencySymbol
24
29
  }),
25
30
  value
26
31
  });
@@ -183,7 +183,7 @@ class List {
183
183
 
184
184
  getDeleteSuccessAction(recordIds) {
185
185
  return {
186
- type: SmartTableConstants.Events.DELETE_RECORDS_SUCCESS,
186
+ type: SmartTableConstants.ExternalConstants.DELETE_RECORDS_SUCCESS,
187
187
  payload: {
188
188
  recordIds: [recordIds]
189
189
  }
@@ -192,7 +192,7 @@ class List {
192
192
 
193
193
  getUpdateSuccessAction(recordId) {
194
194
  return {
195
- type: SmartTableConstants.Events.UPDATE_RECORDS_SUCCESS,
195
+ type: SmartTableConstants.ExternalConstants.UPDATE_RECORDS_SUCCESS,
196
196
  payload: {
197
197
  recordId: recordId
198
198
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/library-platform",
3
- "version": "1.1.9-alpha.1",
3
+ "version": "1.1.9-exp.1",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "files": [
@@ -40,23 +40,25 @@
40
40
  "@testing-library/user-event": "13.0.10",
41
41
  "@types/react": "18.2.55",
42
42
  "@typescript-eslint/parser": "^7.11.0",
43
- "@zoho/SecurityJS": "5.0.2",
43
+ "@zoho/SecurityJS": "7.2.4",
44
44
  "@zohodesk-private/css-variable-migrator": "^1.0.8",
45
- "@zohodesk-private/desk-components": "1.3.10",
45
+ "@zohodesk-private/desk-components": "1.0.0-temp-57.1",
46
+ "@zohodesk-private/dot-registry": "0.0.2",
46
47
  "@zohodesk-private/node-plugins": "1.1.9",
47
- "@zohodesk/a11y": "2.2.6",
48
+ "@zohodesk/a11y": "2.3.6",
48
49
  "@zohodesk/codestandard-analytics": "1.0.2",
49
50
  "@zohodesk/codestandard-validator": "1.0.0",
50
- "@zohodesk/components": "1.2.62",
51
- "@zohodesk/dot": "1.7.8",
51
+ "@zohodesk/components": "1.4.5",
52
+ "@zohodesk/dot": "1.7.17",
53
+ "@zohodesk/dotkit": "1.0.3",
52
54
  "@zohodesk/eslint-plugin-architecturerules": "0.0.6-exp-4",
53
55
  "@zohodesk/eslint-plugin-no-hardcoding": "1.0.6-platform-1",
54
56
  "@zohodesk/hooks": "2.0.5",
55
- "@zohodesk/icons": "1.0.72",
57
+ "@zohodesk/icons": "1.1.0",
56
58
  "@zohodesk/layout": "3.1.0",
57
- "@zohodesk/svg": "1.1.27",
59
+ "@zohodesk/svg": "1.2.1",
58
60
  "@zohodesk/utils": "1.3.14",
59
- "@zohodesk/variables": "1.0.0",
61
+ "@zohodesk/variables": "1.1.0",
60
62
  "@zohodesk/virtualizer": "1.0.13",
61
63
  "babel-jest": "29.7.0",
62
64
  "color": "4.2.3",
@@ -75,15 +77,17 @@
75
77
  "typescript": "4.9.5"
76
78
  },
77
79
  "peerDependencies": {
78
- "@zohodesk-private/desk-components": "1.3.10",
79
- "@zohodesk/a11y": "2.2.6",
80
- "@zohodesk/components": "1.2.62",
81
- "@zohodesk/dot": "1.7.8",
80
+ "@zohodesk-private/desk-components": "1.0.0-temp-57.1",
81
+ "@zohodesk-private/dot-registry": "0.0.2",
82
+ "@zohodesk/a11y": "2.3.6",
83
+ "@zohodesk/components": "1.4.5",
84
+ "@zohodesk/dot": "1.7.17",
85
+ "@zohodesk/dotkit": "1.0.3",
82
86
  "@zohodesk/hooks": "2.0.5",
83
87
  "@zohodesk/i18n": "1.0.0-beta.31",
84
- "@zohodesk/icons": "1.0.72",
88
+ "@zohodesk/icons": "1.1.0",
85
89
  "@zohodesk/layout": "3.1.0",
86
- "@zohodesk/svg": "1.1.27",
90
+ "@zohodesk/svg": "1.2.1",
87
91
  "@zohodesk/utils": "1.3.14",
88
92
  "color": "4.2.3",
89
93
  "react-sortable-hoc": "1.11.0"