@bigbinary/neeto-approvals-frontend 0.0.9 → 0.0.10
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 +47 -40
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +47 -40
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -5023,12 +5023,6 @@ var nullSafe$1 = function nullSafe(func) {
|
|
|
5023
5023
|
);
|
|
5024
5024
|
};
|
|
5025
5025
|
var noop = function noop() {};
|
|
5026
|
-
var toLabelAndValue = function toLabelAndValue(string) {
|
|
5027
|
-
return {
|
|
5028
|
-
label: string,
|
|
5029
|
-
value: string
|
|
5030
|
-
};
|
|
5031
|
-
};
|
|
5032
5026
|
var isNotEmpty = /*#__PURE__*/ramda.complement(ramda.isEmpty);
|
|
5033
5027
|
var isNotPresent = /*#__PURE__*/ramda.either(ramda.isNil, ramda.isEmpty);
|
|
5034
5028
|
var isPresent = /*#__PURE__*/ramda.complement(isNotPresent);
|
|
@@ -8140,16 +8134,21 @@ const fetch$1 = params => axios__default["default"].get(`${BASE_URL}/templates`,
|
|
|
8140
8134
|
params
|
|
8141
8135
|
});
|
|
8142
8136
|
const show$1 = id => axios__default["default"].get(`${BASE_URL}/templates/${id}`);
|
|
8143
|
-
const create =
|
|
8144
|
-
|
|
8145
|
-
|
|
8137
|
+
const create = _ref => {
|
|
8138
|
+
let _ref$url = _ref.url,
|
|
8139
|
+
url = _ref$url === void 0 ? BASE_URL : _ref$url,
|
|
8146
8140
|
payload = _ref.payload;
|
|
8147
|
-
return axios__default["default"].
|
|
8148
|
-
template: payload
|
|
8149
|
-
});
|
|
8141
|
+
return axios__default["default"].post(url, payload);
|
|
8150
8142
|
};
|
|
8151
|
-
const
|
|
8152
|
-
let
|
|
8143
|
+
const update = _ref2 => {
|
|
8144
|
+
let id = _ref2.id,
|
|
8145
|
+
payload = _ref2.payload,
|
|
8146
|
+
_ref2$url = _ref2.url,
|
|
8147
|
+
url = _ref2$url === void 0 ? BASE_URL : _ref2$url;
|
|
8148
|
+
return axios__default["default"].put(`${url}/${id}`, payload);
|
|
8149
|
+
};
|
|
8150
|
+
const destroy = _ref3 => {
|
|
8151
|
+
let templateId = _ref3.templateId;
|
|
8153
8152
|
return axios__default["default"].delete(`${BASE_URL}/templates/${templateId}`);
|
|
8154
8153
|
};
|
|
8155
8154
|
const templatesApi = {
|
|
@@ -8226,7 +8225,11 @@ const columnData = _ref => {
|
|
|
8226
8225
|
dataIndex: "visibility",
|
|
8227
8226
|
key: "visibility",
|
|
8228
8227
|
sorter: true,
|
|
8229
|
-
title: instance.t("common.visibility")
|
|
8228
|
+
title: instance.t("common.visibility"),
|
|
8229
|
+
render: (_, _ref2) => {
|
|
8230
|
+
let accessible = _ref2.accessible;
|
|
8231
|
+
return accessible.label;
|
|
8232
|
+
}
|
|
8230
8233
|
}, {
|
|
8231
8234
|
key: "actions",
|
|
8232
8235
|
ellipsis: true,
|
|
@@ -8388,19 +8391,10 @@ const TEMPLATE_FORM_VALIDATION_SCHEMA = yup__namespace.object().shape({
|
|
|
8388
8391
|
variable: yup__namespace.string().trim().required(t$1("validations.variable"))
|
|
8389
8392
|
}))
|
|
8390
8393
|
});
|
|
8391
|
-
const
|
|
8394
|
+
const SELF_VISIBILITY = {
|
|
8392
8395
|
label: t$1("select.visibility.self"),
|
|
8393
|
-
value: "
|
|
8394
|
-
}
|
|
8395
|
-
label: t$1("select.visibility.supportTeam"),
|
|
8396
|
-
value: "Support team"
|
|
8397
|
-
}, {
|
|
8398
|
-
label: t$1("select.visibility.managers"),
|
|
8399
|
-
value: "Managers"
|
|
8400
|
-
}, {
|
|
8401
|
-
label: t$1("select.visibility.financeTeam"),
|
|
8402
|
-
value: "Finance team"
|
|
8403
|
-
}];
|
|
8396
|
+
value: "self"
|
|
8397
|
+
};
|
|
8404
8398
|
|
|
8405
8399
|
const DynamicBlock = () => {
|
|
8406
8400
|
const _useTranslation = useTranslation(),
|
|
@@ -8464,7 +8458,8 @@ const Form$1 = _ref => {
|
|
|
8464
8458
|
_ref$onSubmit = _ref.onSubmit,
|
|
8465
8459
|
onSubmit = _ref$onSubmit === void 0 ? noop : _ref$onSubmit,
|
|
8466
8460
|
_ref$isLoading = _ref.isLoading,
|
|
8467
|
-
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading
|
|
8461
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
8462
|
+
visibilityOptions = _ref.visibilityOptions;
|
|
8468
8463
|
const history = reactRouterDom.useHistory();
|
|
8469
8464
|
const _useTranslation = useTranslation(),
|
|
8470
8465
|
t = _useTranslation.t;
|
|
@@ -8505,7 +8500,7 @@ const Form$1 = _ref => {
|
|
|
8505
8500
|
}), /*#__PURE__*/t__default["default"].createElement(formik.Select, {
|
|
8506
8501
|
name: "visibility",
|
|
8507
8502
|
label: t("common.visibility"),
|
|
8508
|
-
options:
|
|
8503
|
+
options: [...visibilityOptions, SELF_VISIBILITY]
|
|
8509
8504
|
})), /*#__PURE__*/t__default["default"].createElement(DynamicBlock, null), /*#__PURE__*/t__default["default"].createElement("div", {
|
|
8510
8505
|
className: "space-x-4 pb-6"
|
|
8511
8506
|
}, /*#__PURE__*/t__default["default"].createElement(neetoui.Button, {
|
|
@@ -8529,16 +8524,20 @@ const buildTemplatePayload = template => {
|
|
|
8529
8524
|
let variable = _ref.variable;
|
|
8530
8525
|
return [`variable${index + 1}`, variable];
|
|
8531
8526
|
});
|
|
8532
|
-
const payload =
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8527
|
+
const payload = {
|
|
8528
|
+
template: _objectSpread$3(_objectSpread$3({}, template), {}, {
|
|
8529
|
+
accessibleId: visibility.value,
|
|
8530
|
+
approverId: recipient.value,
|
|
8531
|
+
variables: ramda.fromPairs(indexedVariables)
|
|
8532
|
+
})
|
|
8533
|
+
};
|
|
8537
8534
|
return payload;
|
|
8538
8535
|
};
|
|
8539
8536
|
|
|
8540
8537
|
const Create = _ref => {
|
|
8541
|
-
let approvalsPath = _ref.approvalsPath
|
|
8538
|
+
let approvalsPath = _ref.approvalsPath,
|
|
8539
|
+
visibilityOptions = _ref.visibilityOptions,
|
|
8540
|
+
templateUrl = _ref.templateUrl;
|
|
8542
8541
|
const history = reactRouterDom.useHistory();
|
|
8543
8542
|
const _useTranslation = useTranslation(),
|
|
8544
8543
|
t = _useTranslation.t;
|
|
@@ -8547,7 +8546,10 @@ const Create = _ref => {
|
|
|
8547
8546
|
isLoading = _useCreateTemplate.isLoading;
|
|
8548
8547
|
const onSubmit = template => {
|
|
8549
8548
|
const payload = buildTemplatePayload(template);
|
|
8550
|
-
createTemplate(
|
|
8549
|
+
createTemplate({
|
|
8550
|
+
url: templateUrl,
|
|
8551
|
+
payload
|
|
8552
|
+
}, {
|
|
8551
8553
|
onSuccess: () => history.push(`${approvalsPath}${routes.templates.index}`)
|
|
8552
8554
|
});
|
|
8553
8555
|
};
|
|
@@ -8561,7 +8563,8 @@ const Create = _ref => {
|
|
|
8561
8563
|
}]
|
|
8562
8564
|
}), /*#__PURE__*/t__default["default"].createElement(Form$1, {
|
|
8563
8565
|
onSubmit: onSubmit,
|
|
8564
|
-
isLoading: isLoading
|
|
8566
|
+
isLoading: isLoading,
|
|
8567
|
+
visibilityOptions: visibilityOptions
|
|
8565
8568
|
}));
|
|
8566
8569
|
};
|
|
8567
8570
|
|
|
@@ -8569,7 +8572,9 @@ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
8569
8572
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8570
8573
|
const Edit = _ref => {
|
|
8571
8574
|
var _template$recipient, _template$recipient2;
|
|
8572
|
-
let approvalsPath = _ref.approvalsPath
|
|
8575
|
+
let approvalsPath = _ref.approvalsPath,
|
|
8576
|
+
visibilityOptions = _ref.visibilityOptions,
|
|
8577
|
+
templateUrl = _ref.templateUrl;
|
|
8573
8578
|
const _useParams = reactRouterDom.useParams(),
|
|
8574
8579
|
id = _useParams.id;
|
|
8575
8580
|
const history = reactRouterDom.useHistory();
|
|
@@ -8592,7 +8597,8 @@ const Edit = _ref => {
|
|
|
8592
8597
|
const payload = buildTemplatePayload(template);
|
|
8593
8598
|
updateTemplate({
|
|
8594
8599
|
id,
|
|
8595
|
-
payload
|
|
8600
|
+
payload,
|
|
8601
|
+
url: templateUrl
|
|
8596
8602
|
});
|
|
8597
8603
|
};
|
|
8598
8604
|
if (isFetchingTemplate) {
|
|
@@ -8609,10 +8615,11 @@ const Edit = _ref => {
|
|
|
8609
8615
|
text: t("common.templates")
|
|
8610
8616
|
}]
|
|
8611
8617
|
}), /*#__PURE__*/t__default["default"].createElement(Form$1, {
|
|
8618
|
+
visibilityOptions: visibilityOptions,
|
|
8612
8619
|
onSubmit: onSubmit,
|
|
8613
8620
|
isLoading: isUpdating,
|
|
8614
8621
|
initialData: _objectSpread$2(_objectSpread$2({}, template), {}, {
|
|
8615
|
-
visibility:
|
|
8622
|
+
visibility: template.accessible.id,
|
|
8616
8623
|
recipient: {
|
|
8617
8624
|
label: (_template$recipient = template.recipient) === null || _template$recipient === void 0 ? void 0 : _template$recipient.name,
|
|
8618
8625
|
value: (_template$recipient2 = template.recipient) === null || _template$recipient2 === void 0 ? void 0 : _template$recipient2.id
|