@bigbinary/neeto-message-templates-frontend 0.7.2 → 0.7.3
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/README.md +2 -0
- package/app/javascript/src/translations/en.json +1 -0
- package/dist/index.cjs.js +90 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +89 -33
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/types.d.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { hyphenate, noop, isNotEmpty, renameKeys, findBy, capitalize, nullSafe }
|
|
|
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';
|
|
6
|
+
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
6
7
|
import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
|
|
7
8
|
import Button from '@bigbinary/neetoui/Button';
|
|
8
9
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
@@ -3291,7 +3292,8 @@ var List = function List(_ref) {
|
|
|
3291
3292
|
isFilterApplied = _ref.isFilterApplied,
|
|
3292
3293
|
ownerId = _ref.ownerId,
|
|
3293
3294
|
type = _ref.type,
|
|
3294
|
-
onMutationSuccess = _ref.onMutationSuccess
|
|
3295
|
+
onMutationSuccess = _ref.onMutationSuccess,
|
|
3296
|
+
helpDocUrl = _ref.helpDocUrl;
|
|
3295
3297
|
var _useTranslation = useTranslation(),
|
|
3296
3298
|
t = _useTranslation.t;
|
|
3297
3299
|
var _useDeleteTemplate = useDeleteTemplate(ownerId),
|
|
@@ -3306,6 +3308,34 @@ var List = function List(_ref) {
|
|
|
3306
3308
|
var isSms = type === "sms";
|
|
3307
3309
|
var typeLabelSingular = isSms ? labelSingular : labelSingular.toLowerCase();
|
|
3308
3310
|
var emptyStateLabel = isSms ? label : label.toLowerCase();
|
|
3311
|
+
var noDataProps = _objectSpread$7(_objectSpread$7({}, !isFilterApplied && {
|
|
3312
|
+
primaryButtonProps: {
|
|
3313
|
+
label: addText,
|
|
3314
|
+
onClick: function onClick() {
|
|
3315
|
+
return setManageTemplatePane(assoc("isOpen", true));
|
|
3316
|
+
}
|
|
3317
|
+
},
|
|
3318
|
+
helpText: /*#__PURE__*/jsx(Trans, {
|
|
3319
|
+
i18nKey: "neetoMessageTemplate.template.linkToHelpArticle",
|
|
3320
|
+
values: {
|
|
3321
|
+
entity: label
|
|
3322
|
+
},
|
|
3323
|
+
components: {
|
|
3324
|
+
Link: /*#__PURE__*/jsx(Button, {
|
|
3325
|
+
className: "underline",
|
|
3326
|
+
href: helpDocUrl,
|
|
3327
|
+
style: "link",
|
|
3328
|
+
target: "_blank"
|
|
3329
|
+
})
|
|
3330
|
+
}
|
|
3331
|
+
})
|
|
3332
|
+
}), {}, {
|
|
3333
|
+
title: isFilterApplied ? t("neetoMessageTemplate.template.filtersEmptyState", {
|
|
3334
|
+
type: emptyStateLabel
|
|
3335
|
+
}) : t("neetoMessageTemplate.template.emptyState", {
|
|
3336
|
+
type: emptyStateLabel
|
|
3337
|
+
})
|
|
3338
|
+
});
|
|
3309
3339
|
var handleDelete = function handleDelete() {
|
|
3310
3340
|
deleteTemplate(template.id, {
|
|
3311
3341
|
onSuccess: onMutationSuccess,
|
|
@@ -3337,20 +3367,7 @@ var List = function List(_ref) {
|
|
|
3337
3367
|
})
|
|
3338
3368
|
}) : /*#__PURE__*/jsx("div", {
|
|
3339
3369
|
className: "flex h-full w-full items-center justify-center",
|
|
3340
|
-
children: /*#__PURE__*/jsx(NoData, _objectSpread$7(
|
|
3341
|
-
primaryButtonProps: {
|
|
3342
|
-
label: addText,
|
|
3343
|
-
onClick: function onClick() {
|
|
3344
|
-
return setManageTemplatePane(assoc("isOpen", true));
|
|
3345
|
-
}
|
|
3346
|
-
}
|
|
3347
|
-
}), {}, {
|
|
3348
|
-
title: isFilterApplied ? t("neetoMessageTemplate.template.filtersEmptyState", {
|
|
3349
|
-
type: emptyStateLabel
|
|
3350
|
-
}) : t("neetoMessageTemplate.template.emptyState", {
|
|
3351
|
-
type: emptyStateLabel
|
|
3352
|
-
})
|
|
3353
|
-
}))
|
|
3370
|
+
children: /*#__PURE__*/jsx(NoData, _objectSpread$7({}, noDataProps))
|
|
3354
3371
|
}), /*#__PURE__*/jsx(Alert, {
|
|
3355
3372
|
isOpen: isDelete,
|
|
3356
3373
|
isSubmitting: isDeleting,
|
|
@@ -3394,7 +3411,9 @@ var MessageTemplates = function MessageTemplates(_ref) {
|
|
|
3394
3411
|
_ref$manageTemplatesP = _ref.manageTemplatesPaneCustomFields,
|
|
3395
3412
|
manageTemplatesPaneCustomFields = _ref$manageTemplatesP === void 0 ? null : _ref$manageTemplatesP,
|
|
3396
3413
|
_ref$onMutationSucces = _ref.onMutationSuccess,
|
|
3397
|
-
onMutationSuccess = _ref$onMutationSucces === void 0 ? noop : _ref$onMutationSucces
|
|
3414
|
+
onMutationSuccess = _ref$onMutationSucces === void 0 ? noop : _ref$onMutationSucces,
|
|
3415
|
+
_ref$helpDocUrl = _ref.helpDocUrl,
|
|
3416
|
+
helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl;
|
|
3398
3417
|
var _useState = useState(MESSAGE_TEMPLATE_INITIAL_STATE),
|
|
3399
3418
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3400
3419
|
manageTemplatePane = _useState2[0],
|
|
@@ -3450,11 +3469,20 @@ var MessageTemplates = function MessageTemplates(_ref) {
|
|
|
3450
3469
|
breadcrumbs: breadcrumbs,
|
|
3451
3470
|
searchProps: renderSearchProps(label, value),
|
|
3452
3471
|
size: "small",
|
|
3453
|
-
title: label,
|
|
3454
3472
|
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
3455
3473
|
"data-cy": "add-".concat(hyphenate(value), "-button"),
|
|
3456
3474
|
label: addText,
|
|
3457
3475
|
onClick: handleActionClick
|
|
3476
|
+
}),
|
|
3477
|
+
title: /*#__PURE__*/jsxs("span", {
|
|
3478
|
+
className: "flex",
|
|
3479
|
+
children: [label, /*#__PURE__*/jsx(HelpPopover, {
|
|
3480
|
+
className: "ml-2 self-center",
|
|
3481
|
+
helpLinkProps: {
|
|
3482
|
+
href: helpDocUrl
|
|
3483
|
+
},
|
|
3484
|
+
title: label
|
|
3485
|
+
})]
|
|
3458
3486
|
})
|
|
3459
3487
|
}), /*#__PURE__*/jsx(SubHeader, {
|
|
3460
3488
|
leftActionBlock: /*#__PURE__*/jsx(Typography, {
|
|
@@ -3483,6 +3511,7 @@ var MessageTemplates = function MessageTemplates(_ref) {
|
|
|
3483
3511
|
onChange: handleChange
|
|
3484
3512
|
}), /*#__PURE__*/jsx(List, {
|
|
3485
3513
|
addText: addText,
|
|
3514
|
+
helpDocUrl: helpDocUrl,
|
|
3486
3515
|
isFilterApplied: isFilterApplied,
|
|
3487
3516
|
isLoading: isLoading,
|
|
3488
3517
|
label: label,
|
|
@@ -4180,6 +4209,8 @@ var ApiTemplates = function ApiTemplates(_ref) {
|
|
|
4180
4209
|
var ownerId = _ref.ownerId,
|
|
4181
4210
|
_ref$breadcrumbs = _ref.breadcrumbs,
|
|
4182
4211
|
breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
|
|
4212
|
+
_ref$helpDocUrl = _ref.helpDocUrl,
|
|
4213
|
+
helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
|
|
4183
4214
|
_ref$onMutationSucces = _ref.onMutationSuccess,
|
|
4184
4215
|
onMutationSuccess = _ref$onMutationSucces === void 0 ? noop : _ref$onMutationSucces;
|
|
4185
4216
|
var _useTranslation = useTranslation(),
|
|
@@ -4231,6 +4262,7 @@ var ApiTemplates = function ApiTemplates(_ref) {
|
|
|
4231
4262
|
totalCount = _useFetchTemplates$da2.totalCount,
|
|
4232
4263
|
isLoading = _useFetchTemplates.isLoading,
|
|
4233
4264
|
isFetching = _useFetchTemplates.isFetching;
|
|
4265
|
+
var title = t("neetoMessageTemplate.template.apiTemplates");
|
|
4234
4266
|
var isFilterApplied = isNotEmpty(filters);
|
|
4235
4267
|
var handleFiltersChange = function handleFiltersChange(filters) {
|
|
4236
4268
|
setFilters(filters);
|
|
@@ -4276,11 +4308,38 @@ var ApiTemplates = function ApiTemplates(_ref) {
|
|
|
4276
4308
|
}
|
|
4277
4309
|
});
|
|
4278
4310
|
};
|
|
4311
|
+
var noDataProps = _objectSpread$1(_objectSpread$1({}, !isFilterApplied && {
|
|
4312
|
+
primaryButtonProps: {
|
|
4313
|
+
label: t("neetoMessageTemplate.api.addApiTemplate"),
|
|
4314
|
+
onClick: function onClick() {
|
|
4315
|
+
return setIsFormPaneOpen(true);
|
|
4316
|
+
}
|
|
4317
|
+
},
|
|
4318
|
+
helpText: /*#__PURE__*/jsx(Trans, {
|
|
4319
|
+
i18nKey: "neetoMessageTemplate.template.linkToHelpArticle",
|
|
4320
|
+
values: {
|
|
4321
|
+
entity: title
|
|
4322
|
+
},
|
|
4323
|
+
components: {
|
|
4324
|
+
Link: /*#__PURE__*/jsx(Button, {
|
|
4325
|
+
className: "underline",
|
|
4326
|
+
href: helpDocUrl,
|
|
4327
|
+
style: "link",
|
|
4328
|
+
target: "_blank"
|
|
4329
|
+
})
|
|
4330
|
+
}
|
|
4331
|
+
})
|
|
4332
|
+
}), {}, {
|
|
4333
|
+
title: isFilterApplied ? t("neetoMessageTemplate.template.filtersEmptyState", {
|
|
4334
|
+
type: title
|
|
4335
|
+
}) : t("neetoMessageTemplate.template.emptyState", {
|
|
4336
|
+
type: title
|
|
4337
|
+
})
|
|
4338
|
+
});
|
|
4279
4339
|
return /*#__PURE__*/jsxs(Container, {
|
|
4280
4340
|
children: [/*#__PURE__*/jsx(NeetoHeader, {
|
|
4281
4341
|
breadcrumbs: breadcrumbs,
|
|
4282
4342
|
size: "small",
|
|
4283
|
-
title: t("neetoMessageTemplate.template.apiTemplates"),
|
|
4284
4343
|
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
4285
4344
|
label: t("neetoMessageTemplate.api.addApiTemplate"),
|
|
4286
4345
|
onClick: function onClick() {
|
|
@@ -4289,7 +4348,17 @@ var ApiTemplates = function ApiTemplates(_ref) {
|
|
|
4289
4348
|
}),
|
|
4290
4349
|
searchProps: {
|
|
4291
4350
|
placeholder: t("neetoMessageTemplate.template.searchApiTemplates")
|
|
4292
|
-
}
|
|
4351
|
+
},
|
|
4352
|
+
title: /*#__PURE__*/jsxs("span", {
|
|
4353
|
+
className: "flex",
|
|
4354
|
+
children: [title, /*#__PURE__*/jsx(HelpPopover, {
|
|
4355
|
+
title: title,
|
|
4356
|
+
className: "ml-2 self-center",
|
|
4357
|
+
helpLinkProps: {
|
|
4358
|
+
href: helpDocUrl
|
|
4359
|
+
}
|
|
4360
|
+
})]
|
|
4361
|
+
})
|
|
4293
4362
|
}), /*#__PURE__*/jsx(SubHeader, {
|
|
4294
4363
|
leftActionBlock: /*#__PURE__*/jsx(Typography, {
|
|
4295
4364
|
component: "h4",
|
|
@@ -4341,20 +4410,7 @@ var ApiTemplates = function ApiTemplates(_ref) {
|
|
|
4341
4410
|
})
|
|
4342
4411
|
}) : /*#__PURE__*/jsx("div", {
|
|
4343
4412
|
className: "flex h-full w-full items-center justify-center",
|
|
4344
|
-
children: /*#__PURE__*/jsx(NoData, _objectSpread$1(
|
|
4345
|
-
primaryButtonProps: {
|
|
4346
|
-
label: t("neetoMessageTemplate.api.addApiTemplate"),
|
|
4347
|
-
onClick: function onClick() {
|
|
4348
|
-
return setIsFormPaneOpen(true);
|
|
4349
|
-
}
|
|
4350
|
-
}
|
|
4351
|
-
}), {}, {
|
|
4352
|
-
title: isFilterApplied ? t("neetoMessageTemplate.template.filtersEmptyState", {
|
|
4353
|
-
type: t("neetoMessageTemplate.template.apiTemplates")
|
|
4354
|
-
}) : t("neetoMessageTemplate.template.emptyState", {
|
|
4355
|
-
type: t("neetoMessageTemplate.template.apiTemplates")
|
|
4356
|
-
})
|
|
4357
|
-
}))
|
|
4413
|
+
children: /*#__PURE__*/jsx(NoData, _objectSpread$1({}, noDataProps))
|
|
4358
4414
|
}), /*#__PURE__*/jsx(Pane, {
|
|
4359
4415
|
isOpen: isFormPaneOpen,
|
|
4360
4416
|
onClose: handleCloseDeleteAlertAndFormPane,
|