@bigbinary/neeto-webhooks-frontend 2.2.15 → 2.2.17
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 +1 -0
- package/app/javascript/src/translations/de.json +21 -2
- package/app/javascript/src/translations/en.json +20 -1
- package/app/javascript/src/translations/es.json +21 -2
- package/app/javascript/src/translations/fr.json +21 -2
- package/dist/NeetoWebhooks.js +89 -2
- package/dist/NeetoWebhooks.js.map +1 -1
- package/dist/cjs/NeetoWebhooks.js +89 -2
- package/dist/cjs/NeetoWebhooks.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"edit": "Bearbeiten",
|
|
20
20
|
"viewDetails": "Details anzeigen",
|
|
21
21
|
"regenerate": "Neu generieren",
|
|
22
|
-
"generateSecretKey": "Geheimen Schlüssel generieren"
|
|
22
|
+
"generateSecretKey": "Geheimen Schlüssel generieren",
|
|
23
|
+
"save": "Speichern"
|
|
23
24
|
},
|
|
24
25
|
"errors": {
|
|
25
26
|
"webhook": {
|
|
@@ -72,7 +73,25 @@
|
|
|
72
73
|
"inactive": "Inaktiv"
|
|
73
74
|
},
|
|
74
75
|
"statusActiveHelpDescription": "Das Webhook ist derzeit aktiv. Umschalten, um es inaktiv zu machen.",
|
|
75
|
-
"statusInactiveHelpDescription": "Das Webhook ist derzeit inaktiv. Umschalten, um es aktiv zu machen."
|
|
76
|
+
"statusInactiveHelpDescription": "Das Webhook ist derzeit inaktiv. Umschalten, um es aktiv zu machen.",
|
|
77
|
+
"version": "Version",
|
|
78
|
+
"versionStatus": {
|
|
79
|
+
"expired": {
|
|
80
|
+
"title": "Webhook Abgelaufen",
|
|
81
|
+
"message": "Diese Webhook-Version ist abgelaufen und kann nicht bearbeitet werden. Nur die Löschung ist erlaubt."
|
|
82
|
+
},
|
|
83
|
+
"deprecated": {
|
|
84
|
+
"title": "Webhook Veraltet",
|
|
85
|
+
"message": "Diese Webhook-Version ist veraltet und kann nicht bearbeitet werden. Nur die Löschung ist erlaubt."
|
|
86
|
+
},
|
|
87
|
+
"expiresIn": {
|
|
88
|
+
"days": "Läuft in {{count}} Tag ab",
|
|
89
|
+
"days_other": "Läuft in {{count}} Tagen ab",
|
|
90
|
+
"hoursAndMinutes": "Läuft in {{hours}} Stunde{{hoursPlural}} und {{minutes}} Minute{{minutesPlural}} ab"
|
|
91
|
+
},
|
|
92
|
+
"expiredOn": "Abgelaufen am {{date}}",
|
|
93
|
+
"moreDetails": "Mehr Details."
|
|
94
|
+
}
|
|
76
95
|
},
|
|
77
96
|
"operation": {
|
|
78
97
|
"edit": "Bearbeiten",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"configure": "Configure"
|
|
14
14
|
},
|
|
15
15
|
"buttons": {
|
|
16
|
+
"save": "Save",
|
|
16
17
|
"saveChanges": "Save changes",
|
|
17
18
|
"cancel": "Cancel",
|
|
18
19
|
"delete": "Delete",
|
|
@@ -72,7 +73,25 @@
|
|
|
72
73
|
"inactive": "Inactive"
|
|
73
74
|
},
|
|
74
75
|
"statusActiveHelpDescription": "The webhook is currently active. Toggle to make it inactive.",
|
|
75
|
-
"statusInactiveHelpDescription": "The webhook is currently inactive. Toggle to make it active."
|
|
76
|
+
"statusInactiveHelpDescription": "The webhook is currently inactive. Toggle to make it active.",
|
|
77
|
+
"version": "Version",
|
|
78
|
+
"versionStatus": {
|
|
79
|
+
"expired": {
|
|
80
|
+
"title": "Webhook Expired",
|
|
81
|
+
"message": "This webhook version has expired and cannot be edited. Only deletion is allowed."
|
|
82
|
+
},
|
|
83
|
+
"deprecated": {
|
|
84
|
+
"title": "Webhook Deprecated",
|
|
85
|
+
"message": "This webhook version is deprecated and cannot be edited. Only deletion is allowed."
|
|
86
|
+
},
|
|
87
|
+
"expiresIn": {
|
|
88
|
+
"days": "Expires in {{count}} day",
|
|
89
|
+
"days_other": "Expires in {{count}} days",
|
|
90
|
+
"hoursAndMinutes": "Expires in {{hours}} hour{{hoursPlural}} and {{minutes}} minute{{minutesPlural}}"
|
|
91
|
+
},
|
|
92
|
+
"expiredOn": "Expired on {{date}}",
|
|
93
|
+
"moreDetails": "More details."
|
|
94
|
+
}
|
|
76
95
|
},
|
|
77
96
|
"operation": {
|
|
78
97
|
"edit": "Edit",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"edit": "Editar",
|
|
20
20
|
"viewDetails": "Ver detalles",
|
|
21
21
|
"regenerate": "Regenerar",
|
|
22
|
-
"generateSecretKey": "Generar clave secreta"
|
|
22
|
+
"generateSecretKey": "Generar clave secreta",
|
|
23
|
+
"save": "Guardar"
|
|
23
24
|
},
|
|
24
25
|
"errors": {
|
|
25
26
|
"webhook": {
|
|
@@ -72,7 +73,25 @@
|
|
|
72
73
|
"inactive": "Inactivo"
|
|
73
74
|
},
|
|
74
75
|
"statusActiveHelpDescription": "El webhook está actualmente activo. Cambie para hacerlo inactivo.",
|
|
75
|
-
"statusInactiveHelpDescription": "El webhook está actualmente inactivo. Cambie para hacerlo activo."
|
|
76
|
+
"statusInactiveHelpDescription": "El webhook está actualmente inactivo. Cambie para hacerlo activo.",
|
|
77
|
+
"version": "Versión",
|
|
78
|
+
"versionStatus": {
|
|
79
|
+
"expired": {
|
|
80
|
+
"title": "Webhook Expirado",
|
|
81
|
+
"message": "Esta versión del webhook ha expirado y no se puede editar. Solo se permite la eliminación."
|
|
82
|
+
},
|
|
83
|
+
"deprecated": {
|
|
84
|
+
"title": "Webhook En Desuso",
|
|
85
|
+
"message": "Esta versión del webhook está en desuso y no se puede editar. Solo se permite la eliminación."
|
|
86
|
+
},
|
|
87
|
+
"expiresIn": {
|
|
88
|
+
"days": "Expira en {{count}} día",
|
|
89
|
+
"days_other": "Expira en {{count}} días",
|
|
90
|
+
"hoursAndMinutes": "Expira en {{hours}} hora{{hoursPlural}} y {{minutes}} minuto{{minutesPlural}}"
|
|
91
|
+
},
|
|
92
|
+
"expiredOn": "Expirado el {{date}}",
|
|
93
|
+
"moreDetails": "Más detalles."
|
|
94
|
+
}
|
|
76
95
|
},
|
|
77
96
|
"operation": {
|
|
78
97
|
"edit": "Editar",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"edit": "Modifier",
|
|
20
20
|
"viewDetails": "Voir les détails",
|
|
21
21
|
"regenerate": "Régénérer",
|
|
22
|
-
"generateSecretKey": "Générer une clé secrète"
|
|
22
|
+
"generateSecretKey": "Générer une clé secrète",
|
|
23
|
+
"save": "Enregistrer"
|
|
23
24
|
},
|
|
24
25
|
"errors": {
|
|
25
26
|
"webhook": {
|
|
@@ -72,7 +73,25 @@
|
|
|
72
73
|
"inactive": "Inactif"
|
|
73
74
|
},
|
|
74
75
|
"statusActiveHelpDescription": "Le webhook est actuellement actif. Basculez pour le rendre inactif.",
|
|
75
|
-
"statusInactiveHelpDescription": "Le webhook est actuellement inactif. Basculez pour le rendre actif."
|
|
76
|
+
"statusInactiveHelpDescription": "Le webhook est actuellement inactif. Basculez pour le rendre actif.",
|
|
77
|
+
"version": "Version",
|
|
78
|
+
"versionStatus": {
|
|
79
|
+
"expired": {
|
|
80
|
+
"title": "Webhook expiré",
|
|
81
|
+
"message": "Cette version de webhook a expiré et ne peut pas être modifiée. Seule la suppression est autorisée."
|
|
82
|
+
},
|
|
83
|
+
"deprecated": {
|
|
84
|
+
"title": "Webhook obsolète",
|
|
85
|
+
"message": "Cette version de webhook est obsolète et ne peut pas être modifiée. Seule la suppression est autorisée."
|
|
86
|
+
},
|
|
87
|
+
"expiresIn": {
|
|
88
|
+
"days": "Expire dans {{count}} jour",
|
|
89
|
+
"days_other": "Expire dans {{count}} jours",
|
|
90
|
+
"hoursAndMinutes": "Expire dans {{hours}} heure{{hoursPlural}} et {{minutes}} minute{{minutesPlural}}"
|
|
91
|
+
},
|
|
92
|
+
"expiredOn": "Expiré le {{date}}",
|
|
93
|
+
"moreDetails": "Plus de détails."
|
|
94
|
+
}
|
|
76
95
|
},
|
|
77
96
|
"operation": {
|
|
78
97
|
"edit": "Modifier",
|
package/dist/NeetoWebhooks.js
CHANGED
|
@@ -275,6 +275,7 @@ var TransactionDetails = function TransactionDetails(_ref) {
|
|
|
275
275
|
};
|
|
276
276
|
|
|
277
277
|
var Details = function Details(_ref) {
|
|
278
|
+
var _delivery$webhook;
|
|
278
279
|
var onClose = _ref.onClose,
|
|
279
280
|
deliveryId = _ref.deliveryId,
|
|
280
281
|
webhookSid = _ref.webhookSid;
|
|
@@ -345,7 +346,7 @@ var Details = function Details(_ref) {
|
|
|
345
346
|
}), /*#__PURE__*/jsxs(Pane.Footer, {
|
|
346
347
|
className: "gap-x-2",
|
|
347
348
|
children: [(delivery === null || delivery === void 0 ? void 0 : delivery.eventId) && /*#__PURE__*/jsx(Button, {
|
|
348
|
-
disabled: isRedelivering,
|
|
349
|
+
disabled: isRedelivering || ((_delivery$webhook = delivery.webhook) === null || _delivery$webhook === void 0 ? void 0 : _delivery$webhook.versionExpired),
|
|
349
350
|
label: t("neetoWebhooks.delivery.redeliver"),
|
|
350
351
|
loading: isRedelivering,
|
|
351
352
|
style: "primary",
|
|
@@ -584,6 +585,10 @@ var useUpdateWebhook = function useUpdateWebhook(id, options) {
|
|
|
584
585
|
onSuccess: function onSuccess() {
|
|
585
586
|
var _options$onSuccess2;
|
|
586
587
|
options === null || options === void 0 || (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 || _options$onSuccess2.call(options);
|
|
588
|
+
},
|
|
589
|
+
onError: function onError(error) {
|
|
590
|
+
var _options$onError;
|
|
591
|
+
options === null || options === void 0 || (_options$onError = options.onError) === null || _options$onError === void 0 || _options$onError.call(options, error);
|
|
587
592
|
}
|
|
588
593
|
});
|
|
589
594
|
};
|
|
@@ -722,10 +727,22 @@ var ToggleActiveSwitch = function ToggleActiveSwitch(_ref) {
|
|
|
722
727
|
_useState2 = _slicedToArray(_useState, 2),
|
|
723
728
|
status = _useState2[0],
|
|
724
729
|
setStatus = _useState2[1];
|
|
725
|
-
var
|
|
730
|
+
var previousStatusRef = useRef(isActive);
|
|
731
|
+
var _useUpdateWebhook = useUpdateWebhook(webhookId, {
|
|
732
|
+
onError: function onError() {
|
|
733
|
+
// Revert to the previous state
|
|
734
|
+
setStatus(previousStatusRef.current);
|
|
735
|
+
},
|
|
736
|
+
onSuccess: function onSuccess() {
|
|
737
|
+
// Update the previous status ref on successful update
|
|
738
|
+
previousStatusRef.current = status;
|
|
739
|
+
}
|
|
740
|
+
}),
|
|
726
741
|
updateWebhook = _useUpdateWebhook.mutate;
|
|
727
742
|
var handleToggle = function handleToggle(event) {
|
|
728
743
|
var updatedStatus = event.target.checked;
|
|
744
|
+
// Store the current status as previous before changing
|
|
745
|
+
previousStatusRef.current = status;
|
|
729
746
|
setStatus(updatedStatus);
|
|
730
747
|
updateWebhook({
|
|
731
748
|
id: webhookId,
|
|
@@ -796,6 +813,35 @@ var buildPayload = function buildPayload(_ref2) {
|
|
|
796
813
|
eventsAttributes: [].concat(_toConsumableArray(creatable), _toConsumableArray(deletable))
|
|
797
814
|
});
|
|
798
815
|
};
|
|
816
|
+
var formatTimeUntilExpiration = function formatTimeUntilExpiration(expiresAt) {
|
|
817
|
+
if (!expiresAt) return null;
|
|
818
|
+
var now = new Date();
|
|
819
|
+
var expiry = new Date(expiresAt);
|
|
820
|
+
var diffMs = expiry - now;
|
|
821
|
+
if (diffMs <= 0) return null;
|
|
822
|
+
var diffHours = Math.floor(diffMs / (1000 * 60 * 60));
|
|
823
|
+
var diffDays = Math.floor(diffHours / 24);
|
|
824
|
+
if (diffDays > 0) {
|
|
825
|
+
return t$1("neetoWebhooks.webhook.versionStatus.expiresIn.days", {
|
|
826
|
+
count: diffDays
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
var remainingHours = diffHours;
|
|
830
|
+
var remainingMinutes = Math.floor(diffMs % (1000 * 60 * 60) / (1000 * 60));
|
|
831
|
+
return t$1("neetoWebhooks.webhook.versionStatus.expiresIn.hoursAndMinutes", {
|
|
832
|
+
hours: remainingHours,
|
|
833
|
+
hoursPlural: remainingHours !== 1 ? "s" : "",
|
|
834
|
+
minutes: remainingMinutes,
|
|
835
|
+
minutesPlural: remainingMinutes !== 1 ? "s" : ""
|
|
836
|
+
});
|
|
837
|
+
};
|
|
838
|
+
var formatExpiredDate = function formatExpiredDate(expiresAt) {
|
|
839
|
+
if (!expiresAt) return null;
|
|
840
|
+
var expiry = new Date(expiresAt);
|
|
841
|
+
return t$1("neetoWebhooks.webhook.versionStatus.expiredOn", {
|
|
842
|
+
date: expiry.toLocaleDateString()
|
|
843
|
+
});
|
|
844
|
+
};
|
|
799
845
|
var buildColumns = function buildColumns(_ref6) {
|
|
800
846
|
var handleDelete = _ref6.handleDelete,
|
|
801
847
|
handleEdit = _ref6.handleEdit,
|
|
@@ -840,6 +886,38 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
840
886
|
});
|
|
841
887
|
},
|
|
842
888
|
width: 150
|
|
889
|
+
}, {
|
|
890
|
+
title: t$1("neetoWebhooks.webhook.version"),
|
|
891
|
+
dataIndex: "version",
|
|
892
|
+
key: "version",
|
|
893
|
+
render: function render(version, webhook) {
|
|
894
|
+
var timeMessage = webhook.versionExpired ? formatExpiredDate(webhook.versionExpiresAt) : formatTimeUntilExpiration(webhook.versionExpiresAt);
|
|
895
|
+
return /*#__PURE__*/jsxs("div", {
|
|
896
|
+
className: "flex flex-col space-y-1",
|
|
897
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
898
|
+
className: "flex items-center space-x-2",
|
|
899
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
900
|
+
children: version
|
|
901
|
+
}), webhook.versionExpired && /*#__PURE__*/jsx(Tag, {
|
|
902
|
+
label: "expired",
|
|
903
|
+
style: "danger"
|
|
904
|
+
}), webhook.versionDeprecated && !webhook.versionExpired && /*#__PURE__*/jsx(Tag, {
|
|
905
|
+
label: "deprecated",
|
|
906
|
+
style: "warning"
|
|
907
|
+
})]
|
|
908
|
+
}), timeMessage && /*#__PURE__*/jsxs("div", {
|
|
909
|
+
className: "text-xs neeto-ui-text-gray-600",
|
|
910
|
+
children: [timeMessage, ".", " ", /*#__PURE__*/jsx("a", {
|
|
911
|
+
className: "text-blue-600 hover:text-blue-800 underline",
|
|
912
|
+
href: webhook.defaultVersionPayloadDocUrl,
|
|
913
|
+
rel: "noopener noreferrer",
|
|
914
|
+
target: "_blank",
|
|
915
|
+
children: t$1("neetoWebhooks.webhook.versionStatus.moreDetails")
|
|
916
|
+
}), "."]
|
|
917
|
+
})]
|
|
918
|
+
});
|
|
919
|
+
},
|
|
920
|
+
width: 200
|
|
843
921
|
}, {
|
|
844
922
|
title: t$1("neetoWebhooks.common.event", PLURAL),
|
|
845
923
|
dataIndex: "events",
|
|
@@ -898,7 +976,12 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
898
976
|
var initialValues = editingWebhookId ? _objectSpread$1(_objectSpread$1({}, WEBHOOK_INITIAL_VALUES), webhook) : _objectSpread$1(_objectSpread$1({}, WEBHOOK_INITIAL_VALUES), {}, {
|
|
899
977
|
events: events
|
|
900
978
|
});
|
|
979
|
+
var isWebhookExpiredOrDeprecated = editingWebhookId && (webhook.versionExpired || webhook.versionDeprecated);
|
|
901
980
|
var handleSubmit = function handleSubmit(values) {
|
|
981
|
+
// Check if webhook is expired or deprecated before allowing edit
|
|
982
|
+
if (editingWebhookId && (webhook.versionExpired || webhook.versionDeprecated)) {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
902
985
|
var payload = buildPayload({
|
|
903
986
|
isEditing: editingWebhookId,
|
|
904
987
|
values: values,
|
|
@@ -1041,6 +1124,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
1041
1124
|
values: values
|
|
1042
1125
|
}), touched.events && errors.events && /*#__PURE__*/jsx("div", {
|
|
1043
1126
|
className: "neeto-ui-text-error-800 text-xs mt-1",
|
|
1127
|
+
"data-cy": "event-error-text",
|
|
1044
1128
|
children: errors.events
|
|
1045
1129
|
})]
|
|
1046
1130
|
});
|
|
@@ -1052,6 +1136,9 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
1052
1136
|
children: /*#__PURE__*/jsx(ActionBlock, {
|
|
1053
1137
|
cancelButtonProps: {
|
|
1054
1138
|
onClick: onClose
|
|
1139
|
+
},
|
|
1140
|
+
submitButtonProps: {
|
|
1141
|
+
disabled: isWebhookExpiredOrDeprecated
|
|
1055
1142
|
}
|
|
1056
1143
|
})
|
|
1057
1144
|
})]
|