@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.cjs.js CHANGED
@@ -7817,7 +7817,7 @@ const HISTORY_TABLE_COLUMNS = [{
7817
7817
  title: t$1("common.id"),
7818
7818
  render: (approvalLabel, _ref) => {
7819
7819
  let requestableUrl = _ref.requestableUrl;
7820
- const url = new URL(requestableUrl);
7820
+ const url = new URL(requestableUrl || window.location.origin);
7821
7821
  return /*#__PURE__*/t__default["default"].createElement(neetoui.Button, {
7822
7822
  to: url.pathname,
7823
7823
  label: approvalLabel,
@@ -8317,10 +8317,7 @@ const Templates = _ref => {
8317
8317
  label: t("common.add_", {
8318
8318
  what: t("common.approvalTemplate").toLocaleLowerCase()
8319
8319
  }),
8320
- onClick: () => {
8321
- setIsMenubarOpen(false);
8322
- history.push(`${approvalsPath}${routes.templates.new}`);
8323
- }
8320
+ onClick: () => history.push(`${approvalsPath}${routes.templates.new}`)
8324
8321
  });
8325
8322
  if (isTemplateLoading) {
8326
8323
  return /*#__PURE__*/t__default["default"].createElement("div", {
@@ -8385,7 +8382,6 @@ const TEMPLATE_FORM_INITIAL_VALUES = {
8385
8382
  };
8386
8383
  const TEMPLATE_FORM_VALIDATION_SCHEMA = yup__namespace.object().shape({
8387
8384
  name: yup__namespace.string().trim().required(t$1("validations.name")),
8388
- description: yup__namespace.string().trim().required(t$1("validations.description")),
8389
8385
  recipient: yup__namespace.object().required(t$1("validations.recipient")),
8390
8386
  message: yup__namespace.string().test("message", t$1("validations.message"), content => !fr(content)),
8391
8387
  variables: yup__namespace.array().of(yup__namespace.object().shape({
@@ -8412,11 +8408,12 @@ const DynamicBlock = () => {
8412
8408
  const _useFormikContext = formik$1.useFormikContext(),
8413
8409
  _useFormikContext$val = _useFormikContext.values.variables,
8414
8410
  variables = _useFormikContext$val === void 0 ? [] : _useFormikContext$val;
8415
- const editorVariables = variables.map(_ref => {
8411
+ const editorVariables = variables.map((_ref, index) => {
8416
8412
  let variable = _ref.variable;
8413
+ const variableValue = variable || `variable_${index + 1}`;
8417
8414
  return {
8418
- key: variable,
8419
- label: variable
8415
+ key: variableValue,
8416
+ label: variableValue
8420
8417
  };
8421
8418
  });
8422
8419
  return /*#__PURE__*/t__default["default"].createElement(t__default["default"].Fragment, null, /*#__PURE__*/t__default["default"].createElement("div", {
@@ -8510,7 +8507,7 @@ const Form$1 = _ref => {
8510
8507
  label: t("common.visibility"),
8511
8508
  options: VISIBILITY_OPTIONS
8512
8509
  })), /*#__PURE__*/t__default["default"].createElement(DynamicBlock, null), /*#__PURE__*/t__default["default"].createElement("div", {
8513
- className: "space-x-4"
8510
+ className: "space-x-4 pb-6"
8514
8511
  }, /*#__PURE__*/t__default["default"].createElement(neetoui.Button, {
8515
8512
  label: t("buttons.saveChanges"),
8516
8513
  type: "submit",
@@ -8657,7 +8654,7 @@ const Menu = _ref => {
8657
8654
  const _useTranslation = useTranslation(),
8658
8655
  t = _useTranslation.t;
8659
8656
  const category = (_pathname$split$ = pathname.split(routes.approvals)[1]) === null || _pathname$split$ === void 0 ? void 0 : _pathname$split$.toLocaleUpperCase();
8660
- const isActive = filter => approvalFilterKeys.includes(category) && ramda.identical(filter, category);
8657
+ const isActive = filter => category.includes(filter);
8661
8658
  const getRoute = filter => `${approvalsPath}${filter.toLowerCase()}`;
8662
8659
  return /*#__PURE__*/t__default["default"].createElement(layouts.MenuBar, {
8663
8660
  showMenu: isMenuOpen,
@@ -8674,7 +8671,7 @@ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if
8674
8671
  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; }
8675
8672
  const Approvals = _ref => {
8676
8673
  let config = _ref.config;
8677
- const _useState = t$2.useState(false),
8674
+ const _useState = t$2.useState(true),
8678
8675
  _useState2 = _slicedToArray$2(_useState, 2),
8679
8676
  isMenubarOpen = _useState2[0],
8680
8677
  setIsMenubarOpen = _useState2[1];
@@ -8772,7 +8769,7 @@ const Form = _ref => {
8772
8769
  }, variables.map(variable => /*#__PURE__*/t__default["default"].createElement(neetoui.Input, {
8773
8770
  className: "w-full",
8774
8771
  key: variable,
8775
- label: capitalize$1(variable),
8772
+ label: variable,
8776
8773
  value: variableValues[variable],
8777
8774
  onChange: event => {
8778
8775
  setVariableValues(ramda.assoc(variable, event.target.value));