@bigbinary/neeto-approvals-frontend 0.0.8 → 0.0.9

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.esm.js CHANGED
@@ -2,7 +2,7 @@ import * as t$2 from 'react';
2
2
  import t__default, { createContext, useContext, useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle, cloneElement, useLayoutEffect } from 'react';
3
3
  import { Header, SubHeader, MenuBar, Container } from '@bigbinary/neetoui/layouts';
4
4
  import { useLocation, useHistory, useParams, Switch, Route, Redirect } from 'react-router-dom';
5
- import { isEmpty, assoc, curryN, isNil, curry, complement, either, toPairs, pipe, omit, fromPairs, keys, identical, modify } from 'ramda';
5
+ import { isEmpty, assoc, curryN, isNil, curry, complement, either, toPairs, pipe, omit, fromPairs, keys, modify } from 'ramda';
6
6
  import classnames from 'classnames';
7
7
  import { Typography, Pane, Button, Dropdown, PageLoader, Table, Alert, Tag, Spinner, Kbd, Avatar, Label, Tooltip, Input as Input$1, Toastr, Modal, Tab, Select as Select$1 } from '@bigbinary/neetoui';
8
8
  import axios from 'axios';
@@ -7778,7 +7778,7 @@ const HISTORY_TABLE_COLUMNS = [{
7778
7778
  title: t$1("common.id"),
7779
7779
  render: (approvalLabel, _ref) => {
7780
7780
  let requestableUrl = _ref.requestableUrl;
7781
- const url = new URL(requestableUrl);
7781
+ const url = new URL(requestableUrl || window.location.origin);
7782
7782
  return /*#__PURE__*/t__default.createElement(Button, {
7783
7783
  to: url.pathname,
7784
7784
  label: approvalLabel,
@@ -8278,10 +8278,7 @@ const Templates = _ref => {
8278
8278
  label: t("common.add_", {
8279
8279
  what: t("common.approvalTemplate").toLocaleLowerCase()
8280
8280
  }),
8281
- onClick: () => {
8282
- setIsMenubarOpen(false);
8283
- history.push(`${approvalsPath}${routes.templates.new}`);
8284
- }
8281
+ onClick: () => history.push(`${approvalsPath}${routes.templates.new}`)
8285
8282
  });
8286
8283
  if (isTemplateLoading) {
8287
8284
  return /*#__PURE__*/t__default.createElement("div", {
@@ -8346,7 +8343,6 @@ const TEMPLATE_FORM_INITIAL_VALUES = {
8346
8343
  };
8347
8344
  const TEMPLATE_FORM_VALIDATION_SCHEMA = yup.object().shape({
8348
8345
  name: yup.string().trim().required(t$1("validations.name")),
8349
- description: yup.string().trim().required(t$1("validations.description")),
8350
8346
  recipient: yup.object().required(t$1("validations.recipient")),
8351
8347
  message: yup.string().test("message", t$1("validations.message"), content => !fr(content)),
8352
8348
  variables: yup.array().of(yup.object().shape({
@@ -8373,11 +8369,12 @@ const DynamicBlock = () => {
8373
8369
  const _useFormikContext = useFormikContext(),
8374
8370
  _useFormikContext$val = _useFormikContext.values.variables,
8375
8371
  variables = _useFormikContext$val === void 0 ? [] : _useFormikContext$val;
8376
- const editorVariables = variables.map(_ref => {
8372
+ const editorVariables = variables.map((_ref, index) => {
8377
8373
  let variable = _ref.variable;
8374
+ const variableValue = variable || `variable_${index + 1}`;
8378
8375
  return {
8379
- key: variable,
8380
- label: variable
8376
+ key: variableValue,
8377
+ label: variableValue
8381
8378
  };
8382
8379
  });
8383
8380
  return /*#__PURE__*/t__default.createElement(t__default.Fragment, null, /*#__PURE__*/t__default.createElement("div", {
@@ -8471,7 +8468,7 @@ const Form$1 = _ref => {
8471
8468
  label: t("common.visibility"),
8472
8469
  options: VISIBILITY_OPTIONS
8473
8470
  })), /*#__PURE__*/t__default.createElement(DynamicBlock, null), /*#__PURE__*/t__default.createElement("div", {
8474
- className: "space-x-4"
8471
+ className: "space-x-4 pb-6"
8475
8472
  }, /*#__PURE__*/t__default.createElement(Button, {
8476
8473
  label: t("buttons.saveChanges"),
8477
8474
  type: "submit",
@@ -8618,7 +8615,7 @@ const Menu = _ref => {
8618
8615
  const _useTranslation = useTranslation(),
8619
8616
  t = _useTranslation.t;
8620
8617
  const category = (_pathname$split$ = pathname.split(routes.approvals)[1]) === null || _pathname$split$ === void 0 ? void 0 : _pathname$split$.toLocaleUpperCase();
8621
- const isActive = filter => approvalFilterKeys.includes(category) && identical(filter, category);
8618
+ const isActive = filter => category.includes(filter);
8622
8619
  const getRoute = filter => `${approvalsPath}${filter.toLowerCase()}`;
8623
8620
  return /*#__PURE__*/t__default.createElement(MenuBar, {
8624
8621
  showMenu: isMenuOpen,
@@ -8635,7 +8632,7 @@ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if
8635
8632
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8636
8633
  const Approvals = _ref => {
8637
8634
  let config = _ref.config;
8638
- const _useState = useState(false),
8635
+ const _useState = useState(true),
8639
8636
  _useState2 = _slicedToArray$2(_useState, 2),
8640
8637
  isMenubarOpen = _useState2[0],
8641
8638
  setIsMenubarOpen = _useState2[1];
@@ -8733,7 +8730,7 @@ const Form = _ref => {
8733
8730
  }, variables.map(variable => /*#__PURE__*/t__default.createElement(Input$1, {
8734
8731
  className: "w-full",
8735
8732
  key: variable,
8736
- label: capitalize$1(variable),
8733
+ label: variable,
8737
8734
  value: variableValues[variable],
8738
8735
  onChange: event => {
8739
8736
  setVariableValues(assoc(variable, event.target.value));