@bigbinary/neeto-message-templates-frontend 0.7.3 → 0.7.5
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.cjs.js +27 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { hyphenate, noop, isNotEmpty, renameKeys, findBy, capitalize, nullSafe } from '@bigbinary/neeto-cist';
|
|
2
|
+
import { hyphenate, noop, isNotEmpty, renameKeys, findBy, capitalize, nullSafe, isPresent } from '@bigbinary/neeto-cist';
|
|
3
3
|
import { buildFiltersFromURL, Bar } from '@bigbinary/neeto-filters-frontend';
|
|
4
4
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
5
5
|
import NeetoHeader from '@bigbinary/neeto-molecules/Header';
|
|
@@ -19,7 +19,7 @@ import require$$0 from 'util';
|
|
|
19
19
|
import { create } from 'zustand';
|
|
20
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
21
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
22
|
-
import
|
|
22
|
+
import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
|
|
23
23
|
import NeetoUIForm from '@bigbinary/neetoui/formik/Form';
|
|
24
24
|
import Input from '@bigbinary/neetoui/formik/Input';
|
|
25
25
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
@@ -4012,13 +4012,16 @@ var KeyValuePairs = withT(function (_ref) {
|
|
|
4012
4012
|
className: "flex h-8 space-x-3",
|
|
4013
4013
|
children: [/*#__PURE__*/jsx(Input, {
|
|
4014
4014
|
className: "w-2/5",
|
|
4015
|
+
"data-cy": "key-input-".concat(index),
|
|
4015
4016
|
name: "".concat(name, ".").concat(index, ".key"),
|
|
4016
4017
|
placeholder: t("neetoMessageTemplate.api.key")
|
|
4017
4018
|
}), /*#__PURE__*/jsx(Input, {
|
|
4018
4019
|
className: "w-3/5",
|
|
4020
|
+
"data-cy": "value-input-".concat(index),
|
|
4019
4021
|
name: "".concat(name, ".").concat(index, ".value"),
|
|
4020
4022
|
placeholder: t("neetoMessageTemplate.api.value"),
|
|
4021
4023
|
suffix: showDeleteButton && /*#__PURE__*/jsx(Button, {
|
|
4024
|
+
"data-cy": "delete-key-value-pair-".concat(index),
|
|
4022
4025
|
icon: Delete,
|
|
4023
4026
|
size: "small",
|
|
4024
4027
|
style: "text",
|
|
@@ -4034,6 +4037,7 @@ var KeyValuePairs = withT(function (_ref) {
|
|
|
4034
4037
|
}, index);
|
|
4035
4038
|
}), /*#__PURE__*/jsx(Button, {
|
|
4036
4039
|
className: "w-full justify-center",
|
|
4040
|
+
"data-cy": "add-key-value-pair-button",
|
|
4037
4041
|
label: t("neetoMessageTemplate.api.addKeyValuePair"),
|
|
4038
4042
|
style: "secondary",
|
|
4039
4043
|
onClick: function onClick() {
|
|
@@ -4074,30 +4078,37 @@ var buildTableColumnData = function buildTableColumnData(_ref) {
|
|
|
4074
4078
|
return /*#__PURE__*/jsxs("div", {
|
|
4075
4079
|
className: "flex items-center justify-between gap-x-3",
|
|
4076
4080
|
children: [/*#__PURE__*/jsx(Button, {
|
|
4081
|
+
"data-cy": "api-template-name-link",
|
|
4077
4082
|
label: name,
|
|
4078
4083
|
style: "link",
|
|
4079
4084
|
onClick: function onClick() {
|
|
4080
4085
|
return handleOpenEditPane(apiTemplate);
|
|
4081
4086
|
}
|
|
4082
4087
|
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
4088
|
+
dropdownButtonProps: {
|
|
4089
|
+
"data-cy": "api-template-dropdown"
|
|
4090
|
+
},
|
|
4083
4091
|
dropdownProps: {
|
|
4084
4092
|
strategy: "fixed"
|
|
4085
4093
|
},
|
|
4086
4094
|
menuItems: [{
|
|
4087
4095
|
key: "edit",
|
|
4088
4096
|
label: t$1("neetoMessageTemplate.template.edit"),
|
|
4097
|
+
"data-cy": "api-template-button-edit-button",
|
|
4089
4098
|
onClick: function onClick() {
|
|
4090
4099
|
return handleOpenEditPane(apiTemplate);
|
|
4091
4100
|
}
|
|
4092
4101
|
}, {
|
|
4093
4102
|
key: "status",
|
|
4094
4103
|
label: equals(apiTemplate.status, TEMPLATE_STATUS.ACTIVE) ? t$1("neetoMessageTemplate.template.markAsInactive") : t$1("neetoMessageTemplate.template.markAsActive"),
|
|
4104
|
+
"data-cy": "api-template-button-status-button",
|
|
4095
4105
|
onClick: function onClick() {
|
|
4096
4106
|
return handleMarkAsActiveOrInactive(apiTemplate);
|
|
4097
4107
|
}
|
|
4098
4108
|
}, {
|
|
4099
4109
|
key: "delete",
|
|
4100
4110
|
label: t$1("neetoMessageTemplate.template.delete"),
|
|
4111
|
+
"data-cy": "api-template-button-delete-button",
|
|
4101
4112
|
onClick: function onClick() {
|
|
4102
4113
|
return handleOpenDeleteAlert(apiTemplate);
|
|
4103
4114
|
}
|
|
@@ -4341,13 +4352,15 @@ var ApiTemplates = function ApiTemplates(_ref) {
|
|
|
4341
4352
|
breadcrumbs: breadcrumbs,
|
|
4342
4353
|
size: "small",
|
|
4343
4354
|
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
4355
|
+
"data-cy": "add-api-templates-button",
|
|
4344
4356
|
label: t("neetoMessageTemplate.api.addApiTemplate"),
|
|
4345
4357
|
onClick: function onClick() {
|
|
4346
4358
|
return setIsFormPaneOpen(true);
|
|
4347
4359
|
}
|
|
4348
4360
|
}),
|
|
4349
4361
|
searchProps: {
|
|
4350
|
-
placeholder: t("neetoMessageTemplate.template.searchApiTemplates")
|
|
4362
|
+
placeholder: t("neetoMessageTemplate.template.searchApiTemplates"),
|
|
4363
|
+
"data-cy": "api-templates-search-input"
|
|
4351
4364
|
},
|
|
4352
4365
|
title: /*#__PURE__*/jsxs("span", {
|
|
4353
4366
|
className: "flex",
|
|
@@ -4453,6 +4466,10 @@ var SEND_TO_API_FORM_VALIDATION_SCHEMA = yup.object({
|
|
|
4453
4466
|
}))
|
|
4454
4467
|
});
|
|
4455
4468
|
|
|
4469
|
+
var formatAdditionalData = function formatAdditionalData(additionalData) {
|
|
4470
|
+
return isPresent(additionalData) ? additionalData : [ADDITIONAL_DATA_INITIAL_VALUE];
|
|
4471
|
+
};
|
|
4472
|
+
|
|
4456
4473
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4457
4474
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4458
4475
|
var SendToApiPane = function SendToApiPane(props) {
|
|
@@ -4489,7 +4506,7 @@ var SendToApiForm = function SendToApiForm(_ref) {
|
|
|
4489
4506
|
isLoadingTemplates = _useFetchTemplates.isLoading;
|
|
4490
4507
|
var handleTemplateChange = function handleTemplateChange(setFieldValue, template) {
|
|
4491
4508
|
setFieldValue("endpoint", template.endpoint);
|
|
4492
|
-
setFieldValue("additionalData", template.additionalData);
|
|
4509
|
+
setFieldValue("additionalData", formatAdditionalData(template.additionalData));
|
|
4493
4510
|
};
|
|
4494
4511
|
var handleSubmit = function handleSubmit(formValues) {
|
|
4495
4512
|
var additionalDataModifiedFormValues = modify("additionalData", rejectEmptyKeyValuePairs, formValues);
|
|
@@ -4546,10 +4563,12 @@ var SendToApiForm = function SendToApiForm(_ref) {
|
|
|
4546
4563
|
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
4547
4564
|
isSubmitting: isSubmitting,
|
|
4548
4565
|
cancelButtonProps: {
|
|
4549
|
-
onClick: onClose
|
|
4566
|
+
onClick: onClose,
|
|
4567
|
+
"data-cy": "api-template-cancel-button"
|
|
4550
4568
|
},
|
|
4551
4569
|
submitButtonProps: {
|
|
4552
|
-
label: t("neetoMessageTemplate.template.send")
|
|
4570
|
+
label: t("neetoMessageTemplate.template.send"),
|
|
4571
|
+
"data-cy": "api-template-send-button"
|
|
4553
4572
|
}
|
|
4554
4573
|
})
|
|
4555
4574
|
})]
|