budibase/packages/worker/src/constants/index.ts

177 lines
4.8 KiB
TypeScript
Raw Normal View History

2022-11-16 19:13:34 +01:00
import { constants } from "@budibase/backend-core"
2022-11-16 19:13:34 +01:00
export const LOGO_URL =
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg"
2022-11-16 19:13:34 +01:00
export enum UserStatus {
ACTIVE = "active",
INACTIVE = "inactive",
}
2021-04-19 12:34:07 +02:00
2022-11-16 19:13:34 +01:00
export const Config = constants.Config
2021-04-21 19:43:20 +02:00
2022-11-16 19:13:34 +01:00
export enum ConfigUpload {
LOGO = "logo",
OIDC_LOGO = "oidc_logo",
}
2022-11-16 19:13:34 +01:00
export enum TemplateType {
EMAIL = "email",
2021-04-21 19:15:57 +02:00
}
2022-11-16 19:13:34 +01:00
export enum EmailTemplatePurpose {
BASE = "base",
PASSWORD_RECOVERY = "password_recovery",
INVITATION = "invitation",
WELCOME = "welcome",
CUSTOM = "custom",
2021-04-21 19:15:57 +02:00
}
2022-11-16 19:13:34 +01:00
export enum InternalTemplateBinding {
PLATFORM_URL = "platformUrl",
COMPANY = "company",
LOGO_URL = "logoUrl",
EMAIL = "email",
USER = "user",
REQUEST = "request",
DOCS_URL = "docsUrl",
LOGIN_URL = "loginUrl",
CURRENT_YEAR = "currentYear",
CURRENT_DATE = "currentDate",
BODY = "body",
STYLES = "styles",
RESET_URL = "resetUrl",
RESET_CODE = "resetCode",
INVITE_URL = "inviteUrl",
INVITE_CODE = "inviteUrl",
CONTENTS = "contents",
}
2022-11-16 19:13:34 +01:00
export const TemplateBindings = {
2021-05-11 15:44:43 +02:00
PLATFORM_URL: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.PLATFORM_URL,
2021-05-11 15:44:43 +02:00
description: "The URL used to access the budibase platform",
},
COMPANY: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.COMPANY,
2021-05-11 15:44:43 +02:00
description: "The name of your organization",
},
LOGO_URL: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.LOGO_URL,
2021-05-11 15:44:43 +02:00
description: "The URL of your organizations logo.",
},
EMAIL: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.EMAIL,
2021-05-11 15:44:43 +02:00
description: "The recipients email address.",
},
USER: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.USER,
2021-05-11 15:44:43 +02:00
description: "The recipients user object.",
},
REQUEST: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.REQUEST,
2021-05-11 15:44:43 +02:00
description: "Additional request metadata.",
},
DOCS_URL: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.DOCS_URL,
2021-05-11 15:44:43 +02:00
description: "Organization documentation URL.",
},
LOGIN_URL: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.LOGIN_URL,
2021-05-11 15:44:43 +02:00
description: "The URL used to log into the organization budibase instance.",
},
CURRENT_YEAR: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.CURRENT_YEAR,
2021-05-11 15:44:43 +02:00
description: "The current year.",
},
CURRENT_DATE: {
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.CURRENT_DATE,
2021-05-11 15:44:43 +02:00
description: "The current date.",
},
}
2022-11-16 19:13:34 +01:00
export const TemplateMetadata = {
[TemplateType.EMAIL]: [
{
name: "Base format",
2021-07-14 14:18:27 +02:00
description:
"This is the base template, all others are based on it. The {{ body }} will be replaced with another email template.",
category: "miscellaneous",
purpose: EmailTemplatePurpose.BASE,
2021-05-11 15:44:43 +02:00
bindings: [
{
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.BODY,
2021-05-11 15:44:43 +02:00
description: "The main body of another email template.",
},
{
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.STYLES,
2021-05-11 15:44:43 +02:00
description: "The contents of the Styling email template.",
},
],
},
{
name: "Password recovery",
2021-07-14 14:18:27 +02:00
description:
2021-07-14 14:24:46 +02:00
"When a user requests a password reset they will receive an email built with this template.",
category: "user management",
purpose: EmailTemplatePurpose.PASSWORD_RECOVERY,
2021-05-11 15:44:43 +02:00
bindings: [
{
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.RESET_URL,
2021-05-11 15:44:43 +02:00
description:
"The URL the recipient must click to reset their password.",
},
{
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.RESET_CODE,
2021-05-11 15:44:43 +02:00
description:
"The temporary password reset code used in the recipients password reset URL.",
},
],
},
{
name: "User welcome",
2021-07-14 14:18:27 +02:00
description:
2021-07-14 14:24:46 +02:00
"When a new user is added they will be sent a welcome email using this template.",
category: "user management",
purpose: EmailTemplatePurpose.WELCOME,
bindings: [],
},
{
name: "User invitation",
2021-07-14 14:18:27 +02:00
description:
2021-07-14 14:24:46 +02:00
"When inviting a user via the email on-boarding this template will be used.",
category: "user management",
purpose: EmailTemplatePurpose.INVITATION,
2021-05-11 15:44:43 +02:00
bindings: [
{
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.INVITE_URL,
2021-05-11 15:44:43 +02:00
description:
"The URL the recipient must click to accept the invitation and activate their account.",
},
{
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.INVITE_CODE,
2021-05-11 15:44:43 +02:00
description:
"The temporary invite code used in the recipients invitation URL.",
},
],
},
{
name: "Custom",
2021-07-14 14:18:27 +02:00
description:
2021-07-14 14:24:46 +02:00
"A custom template, this is currently used for SMTP email actions in automations.",
category: "automations",
purpose: EmailTemplatePurpose.CUSTOM,
2021-05-11 15:58:55 +02:00
bindings: [
{
2022-11-16 19:13:34 +01:00
name: InternalTemplateBinding.CONTENTS,
2021-05-11 15:58:55 +02:00
description: "Custom content body.",
},
],
2021-04-22 17:06:29 +02:00
},
],
}
2021-04-21 19:15:57 +02:00
// all purpose combined
2022-11-16 19:13:34 +01:00
export { EmailTemplatePurpose as TemplatePurpose }
export const GLOBAL_OWNER = "global"