@bigbinary/neeto-message-templates-frontend 0.5.1 → 0.5.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/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import Container from '@bigbinary/neeto-molecules/Container';
5
5
  import NeetoHeader from '@bigbinary/neeto-molecules/Header';
6
6
  import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
7
7
  import { Typography, Button, Pane, Table, NoData, Alert, Select, Textarea, Label } from '@bigbinary/neetoui';
8
- import { isEmpty, equals, prop, includes, pick, omit, assoc, mergeAll, pluck, whereAny, reject, pipe, toPairs, map, zipObj, values, fromPairs, modify } from 'ramda';
8
+ import { isEmpty, equals, prop, includes, pick, omit, assoc, mergeAll, pluck, whereAny, reject, modify } from 'ramda';
9
9
  import { t } from 'i18next';
10
10
  import { DEFAULT_PAGE_SIZE, DEFAULT_PAGE_INDEX } from '@bigbinary/neeto-commons-frontend/constants';
11
11
  import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
@@ -3821,25 +3821,13 @@ var rejectEmptyKeyValuePairs = reject(whereAny({
3821
3821
  value: isEmpty
3822
3822
  }));
3823
3823
 
3824
- /*
3825
- Usage of transformAdditionalDataToKeyValuePairs:
3826
- { a: 'val1', b: 'val2' } -> [{ key: 'a', value: 'val1' }, { key: 'b', value: 'val2' }]
3827
- */
3828
- var transformAdditionalDataToKeyValuePairs = pipe(toPairs, map(zipObj(["key", "value"])));
3829
-
3830
- /*
3831
- Usage of buildAdditionalDataFromKeyValuePairs:
3832
- [{ key: 'a', value: 'val1' }, { key: 'b', value: 'val2' }] -> { a: 'val1', b: 'val2' }
3833
- */
3834
- var buildAdditionalDataFromKeyValuePairs = pipe(rejectEmptyKeyValuePairs, map(values), fromPairs);
3835
-
3836
3824
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3837
3825
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3838
3826
  var buildApiTemplatePayload = function buildApiTemplatePayload(values) {
3839
3827
  return {
3840
3828
  entity: {
3841
3829
  endpoint: values.endpoint,
3842
- additionalData: buildAdditionalDataFromKeyValuePairs(values.additionalData)
3830
+ additionalData: rejectEmptyKeyValuePairs(values.additionalData)
3843
3831
  },
3844
3832
  templateType: API_TEMPLATE_TYPE,
3845
3833
  name: values.name
@@ -3895,7 +3883,7 @@ var buildTableColumnData = function buildTableColumnData(_ref) {
3895
3883
  };
3896
3884
  var buildApiTemplateInitialValues = function buildApiTemplateInitialValues(isEdit, apiTemplate) {
3897
3885
  if (!isEdit) return API_TEMPLATE_INITIAL_VALUES;
3898
- var additionalData = isEmpty(apiTemplate.additionalData) ? [ADDITIONAL_DATA_INITIAL_VALUE] : transformAdditionalDataToKeyValuePairs(apiTemplate.additionalData);
3886
+ var additionalData = isEmpty(apiTemplate.additionalData) ? [ADDITIONAL_DATA_INITIAL_VALUE] : apiTemplate.additionalData;
3899
3887
  return _objectSpread$1(_objectSpread$1({}, pick(["name", "endpoint"], apiTemplate)), {}, {
3900
3888
  additionalData: additionalData
3901
3889
  });
@@ -4165,7 +4153,7 @@ var SEND_TO_API_FORM_VALIDATION_SCHEMA = yup.object({
4165
4153
 
4166
4154
  var buildSendToApiFormInitialValues = function buildSendToApiFormInitialValues(template) {
4167
4155
  if (isEmpty(template)) return SEND_TO_API_FORM_INITIAL_VALUES;
4168
- var additionalData = isEmpty(template.additionalData) ? [ADDITIONAL_DATA_INITIAL_VALUE] : transformAdditionalDataToKeyValuePairs(template.additionalData);
4156
+ var additionalData = isEmpty(template.additionalData) ? [ADDITIONAL_DATA_INITIAL_VALUE] : template.additionalData;
4169
4157
  return {
4170
4158
  endpoint: template.endpoint,
4171
4159
  additionalData: additionalData
@@ -4209,7 +4197,7 @@ var SendToApiForm = function SendToApiForm(_ref) {
4209
4197
  templates = _useFetchTemplates$da3 === void 0 ? [] : _useFetchTemplates$da3,
4210
4198
  isLoadingTemplates = _useFetchTemplates.isLoading;
4211
4199
  var handleSubmit = function handleSubmit(formValues) {
4212
- var additionalDataModifiedFormValues = modify("additionalData", buildAdditionalDataFromKeyValuePairs, formValues);
4200
+ var additionalDataModifiedFormValues = modify("additionalData", rejectEmptyKeyValuePairs, formValues);
4213
4201
  onSubmit(additionalDataModifiedFormValues);
4214
4202
  };
4215
4203
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {