feature/IO-2433-esignature - Code review fixes
This commit is contained in:
7
client/src/utils/esignature.js
Normal file
7
client/src/utils/esignature.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export const hasDocumensoApiKey = (bodyshop) => {
|
||||
if (typeof bodyshop?.documenso_api_key === "string") {
|
||||
return bodyshop.documenso_api_key.trim().length > 0;
|
||||
}
|
||||
|
||||
return Boolean(bodyshop?.documenso_api_key);
|
||||
};
|
||||
@@ -2,7 +2,7 @@
|
||||
* @description This file contains the scenarios for job notifications.
|
||||
* @type {string[]}
|
||||
*/
|
||||
const notificationScenarios = [
|
||||
const baseNotificationScenarios = [
|
||||
"job-assigned-to-me",
|
||||
"bill-posted",
|
||||
"critical-parts-status-changed",
|
||||
@@ -16,13 +16,21 @@ const notificationScenarios = [
|
||||
"job-added-to-production",
|
||||
"job-status-change",
|
||||
"payment-collected-completed",
|
||||
"alternate-transport-changed",
|
||||
"alternate-transport-changed"
|
||||
// "supplement-imported", // Disabled for now
|
||||
];
|
||||
|
||||
const esignNotificationScenarios = [
|
||||
"esign-document-opened",
|
||||
"esign-document-completed",
|
||||
"esign-document-upload-failed"
|
||||
// "supplement-imported", // Disabled for now
|
||||
];
|
||||
|
||||
const notificationScenarios = [...baseNotificationScenarios, ...esignNotificationScenarios];
|
||||
|
||||
const getNotificationScenarios = ({ includeEsign = true } = {}) =>
|
||||
includeEsign ? notificationScenarios : baseNotificationScenarios;
|
||||
|
||||
/**
|
||||
* Default channel preferences for e-sign document notifications. By default, all e-sign related notifications will be
|
||||
* sent via the app, but not via email or FCM. These defaults can be overridden by user preferences.
|
||||
@@ -34,4 +42,4 @@ const notificationScenarioDefaults = {
|
||||
"esign-document-upload-failed": { app: true, email: false, fcm: false }
|
||||
};
|
||||
|
||||
export { notificationScenarios, notificationScenarioDefaults };
|
||||
export { esignNotificationScenarios, getNotificationScenarios, notificationScenarios, notificationScenarioDefaults };
|
||||
|
||||
Reference in New Issue
Block a user