@bigbinary/neeto-approvals-frontend 0.1.0 → 0.1.1

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
@@ -5453,6 +5453,36 @@ var Field = function Field(_ref) {
5453
5453
  };
5454
5454
  var Field$1 = /*#__PURE__*/React.memo(Field);
5455
5455
 
5456
+ var VALID_VARIABLE_NAME_REGEX = /^[a-z](?:\w*[a-z0-9])*$/i;
5457
+ var TEMPLATE_FORM_INITIAL_VALUES = {
5458
+ name: "",
5459
+ description: "",
5460
+ visibility: "",
5461
+ approver: "",
5462
+ variables: [],
5463
+ message: ""
5464
+ };
5465
+ var TEMPLATE_FORM_VALIDATION_SCHEMA = yup.object().shape({
5466
+ name: yup.string().trim().required(t$2("validations.required", {
5467
+ what: t$2("common.name")
5468
+ })),
5469
+ approver: yup.object().required(t$2("validations.approver")),
5470
+ message: yup.string().test("message", t$2("validations.required", {
5471
+ what: t$2("inputs.labels.message")
5472
+ }), function (content) {
5473
+ return !isEditorEmpty(content);
5474
+ }),
5475
+ variables: yup.array().of(yup.object().shape({
5476
+ variable: yup.string().trim().required(t$2("validations.pleaseEnter_", {
5477
+ what: t$2("common.variable").toLocaleLowerCase()
5478
+ })).matches(VALID_VARIABLE_NAME_REGEX, t$2("validations.variableName"))
5479
+ }))
5480
+ });
5481
+ var EVERYONE_VISIBILITY = {
5482
+ label: t$2("select.visibility.everyone"),
5483
+ value: "everyone"
5484
+ };
5485
+
5456
5486
  var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
5457
5487
  var TemplateDetails = function TemplateDetails(_ref) {
5458
5488
  var _Object$entries;
@@ -5487,7 +5517,7 @@ var TemplateDetails = function TemplateDetails(_ref) {
5487
5517
  value: approverName
5488
5518
  }), /*#__PURE__*/React.createElement(Field$1, {
5489
5519
  label: t("common.visibility"),
5490
- value: accessible === null || accessible === void 0 ? void 0 : accessible.label
5520
+ value: (accessible === null || accessible === void 0 ? void 0 : accessible.label) || EVERYONE_VISIBILITY.label
5491
5521
  }), (_Object$entries = Object.entries(variables || {})) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(function (_ref2) {
5492
5522
  var _ref3 = _slicedToArray(_ref2, 2),
5493
5523
  variable = _ref3[0],
@@ -5507,36 +5537,6 @@ var TemplateDetails = function TemplateDetails(_ref) {
5507
5537
  }))));
5508
5538
  };
5509
5539
 
5510
- var VALID_VARIABLE_NAME_REGEX = /^[a-z](?:\w*[a-z0-9])*$/i;
5511
- var TEMPLATE_FORM_INITIAL_VALUES = {
5512
- name: "",
5513
- description: "",
5514
- visibility: "",
5515
- approver: "",
5516
- variables: [],
5517
- message: ""
5518
- };
5519
- var TEMPLATE_FORM_VALIDATION_SCHEMA = yup.object().shape({
5520
- name: yup.string().trim().required(t$2("validations.required", {
5521
- what: t$2("common.name")
5522
- })),
5523
- approver: yup.object().required(t$2("validations.approver")),
5524
- message: yup.string().test("message", t$2("validations.required", {
5525
- what: t$2("inputs.labels.message")
5526
- }), function (content) {
5527
- return !isEditorEmpty(content);
5528
- }),
5529
- variables: yup.array().of(yup.object().shape({
5530
- variable: yup.string().trim().required(t$2("validations.pleaseEnter_", {
5531
- what: t$2("common.variable").toLocaleLowerCase()
5532
- })).matches(VALID_VARIABLE_NAME_REGEX, t$2("validations.variableName"))
5533
- }))
5534
- });
5535
- var EVERYONE_VISIBILITY = {
5536
- label: t$2("select.visibility.everyone"),
5537
- value: "everyone"
5538
- };
5539
-
5540
5540
  var Menu$1 = Dropdown.Menu,
5541
5541
  MenuItem = Dropdown.MenuItem;
5542
5542
  var columnData = function columnData(_ref) {