Add Activepieces integration for workflow automation

- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-18 22:59:37 -05:00
parent 9848268d34
commit 3aa7199503
16292 changed files with 1284892 additions and 4708 deletions

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "All-in-one-Mitgliedschaftssoftware",
"API Key": "API-Schlüssel",
"Instance Url": "Instanz Url",
"The api key of the brilliant directories account account": "Der api Schlüssel des brillanten Verzeichniskontos",
"The url of the brilliant directories instance.": "Die Url der genialen Verzeichnisse Instanz.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Brilliant Directories Authentifizierung.\n\n Bitte geben Sie Ihren API-Schlüssel ein, der hier generiert werden kann: https://ww2.managemydirectory. om/admin/apiSettings\n\n Geben Sie dann Ihre brillante URL der Website-Instanz ein, die mit /api wie das Beispiel angehängt wurde.\n ",
"Create new User": "Neuen Benutzer erstellen",
"Custom API Call": "Eigener API-Aufruf",
"Creates a new user in your brilliant directories site": "Erstellt einen neuen Benutzer in deiner brillanten Verzeichnisseite",
"Make a custom API call to a specific endpoint": "Einen benutzerdefinierten API-Aufruf an einen bestimmten Endpunkt machen",
"Email": "E-Mail",
"Password": "Kennwort",
"Subscription ID": "Abonnement-ID",
"Meta": "Meta",
"Method": "Methode",
"Headers": "Kopfzeilen",
"Query Parameters": "Abfrageparameter",
"Body": "Körper",
"Response is Binary ?": "Antwort ist binär?",
"No Error on Failure": "Kein Fehler bei Fehler",
"Timeout (in seconds)": "Timeout (in Sekunden)",
"Email address for the users account": "E-Mail-Adresse für das Benutzerkonto",
"Password for the new user account": "Passwort für das neue Benutzerkonto",
"The subscription ID from your website": "Die Abonnement-ID von Ihrer Website",
"Additional fields for the new user account": "Zusätzliche Felder für das neue Benutzerkonto",
"Authorization headers are injected automatically from your connection.": "Autorisierungs-Header werden automatisch von Ihrer Verbindung injiziert.",
"Enable for files like PDFs, images, etc..": "Aktivieren für Dateien wie PDFs, Bilder, etc..",
"GET": "ERHALTEN",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "LÖSCHEN",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "Software de membresía Todo en uno",
"API Key": "Clave API",
"Instance Url": "Url de Instancia",
"The api key of the brilliant directories account account": "La clave api de la cuenta de los directorios brillantes",
"The url of the brilliant directories instance.": "La url de la instancia de los directorios brillantes.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Autenticación de Directorios Brillantes.\n\n Por favor, introduzca su clave API que puede ser generada desde aquí: https://ww2.managemydirectory. om/admin/apiSettings\n\n Luego ingresa la URL de la instancia del sitio web de tus directorios anexada con /api como el ejemplo.\n ",
"Create new User": "Crear nuevo usuario",
"Custom API Call": "Llamada API personalizada",
"Creates a new user in your brilliant directories site": "Crea un nuevo usuario en tu sitio de directorios brillantes",
"Make a custom API call to a specific endpoint": "Hacer una llamada API personalizada a un extremo específico",
"Email": "E-mail",
"Password": "Contraseña",
"Subscription ID": "ID de suscripción",
"Meta": "Meta",
"Method": "Método",
"Headers": "Encabezados",
"Query Parameters": "Parámetros de consulta",
"Body": "Cuerpo",
"Response is Binary ?": "¿Respuesta es binaria?",
"No Error on Failure": "No hay ningún error en fallo",
"Timeout (in seconds)": "Tiempo de espera (en segundos)",
"Email address for the users account": "Dirección de correo para la cuenta de usuarios",
"Password for the new user account": "Contraseña para la nueva cuenta de usuario",
"The subscription ID from your website": "El ID de suscripción de su sitio web",
"Additional fields for the new user account": "Campos adicionales para la nueva cuenta de usuario",
"Authorization headers are injected automatically from your connection.": "Las cabeceras de autorización se inyectan automáticamente desde tu conexión.",
"Enable for files like PDFs, images, etc..": "Activar para archivos como PDFs, imágenes, etc.",
"GET": "RECOGER",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "BORRAR",
"HEAD": "LIMPIO"
}

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "Logiciel d'abonnement tout-en-un",
"API Key": "Clé API",
"Instance Url": "Url de l'instance",
"The api key of the brilliant directories account account": "La clé api du compte des répertoires brillants",
"The url of the brilliant directories instance.": "L'url de l'instance de répertoires brillants.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Authentification des répertoires brillants.\n\n Veuillez entrer votre clé API qui peut être générée ici: https://ww2.managemydirectory. om/admin/apiSettings\n\n Entrez ensuite l'URL de l'instance de votre site web avec /api comme l'exemple.\n ",
"Create new User": "Créer un nouvel utilisateur",
"Custom API Call": "Appel API personnalisé",
"Creates a new user in your brilliant directories site": "Crée un nouvel utilisateur dans votre brillant site de répertoires",
"Make a custom API call to a specific endpoint": "Passez un appel API personnalisé à un point de terminaison spécifique",
"Email": "Courriel",
"Password": "Password",
"Subscription ID": "ID de l'abonnement",
"Meta": "Meta",
"Method": "Méthode",
"Headers": "En-têtes",
"Query Parameters": "Paramètres de requête",
"Body": "Corps",
"Response is Binary ?": "La réponse est Binaire ?",
"No Error on Failure": "Aucune erreur en cas d'échec",
"Timeout (in seconds)": "Délai d'attente (en secondes)",
"Email address for the users account": "Adresse e-mail pour le compte des utilisateurs",
"Password for the new user account": "Mot de passe pour le nouveau compte utilisateur",
"The subscription ID from your website": "L'ID d'abonnement de votre site web",
"Additional fields for the new user account": "Champs supplémentaires pour le nouveau compte utilisateur",
"Authorization headers are injected automatically from your connection.": "Les en-têtes d'autorisation sont injectés automatiquement à partir de votre connexion.",
"Enable for files like PDFs, images, etc..": "Activer pour les fichiers comme les PDFs, les images, etc.",
"GET": "OBTENIR",
"POST": "POSTER",
"PATCH": "PATCH",
"PUT": "EFFACER",
"DELETE": "SUPPRIMER",
"HEAD": "TÊTE"
}

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "オールインワンメンバーシップソフトウェア",
"API Key": "API キー",
"Instance Url": "インスタンスURL",
"The api key of the brilliant directories account account": "素晴らしいディレクトリアカウントのAPIキー",
"The url of the brilliant directories instance.": "華麗なディレクトリインスタンスのURL。",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ",
"Create new User": "新しいユーザーを作成",
"Custom API Call": "カスタムAPI通話",
"Creates a new user in your brilliant directories site": "素晴らしいディレクトリサイトに新しいユーザーを作成します",
"Make a custom API call to a specific endpoint": "特定のエンドポイントへのカスタム API コールを実行します。",
"Email": "Eメールアドレス",
"Password": "パスワード",
"Subscription ID": "サブスクリプションID",
"Meta": "Meta",
"Method": "方法",
"Headers": "ヘッダー",
"Query Parameters": "クエリパラメータ",
"Body": "本文",
"Response is Binary ?": "応答はバイナリですか?",
"No Error on Failure": "失敗時にエラーはありません",
"Timeout (in seconds)": "タイムアウト(秒)",
"Email address for the users account": "ユーザーアカウントのメールアドレス",
"Password for the new user account": "新しいユーザーアカウントのパスワード",
"The subscription ID from your website": "あなたのウェブサイトからのサブスクリプションID",
"Additional fields for the new user account": "新規ユーザーアカウントの追加項目",
"Authorization headers are injected automatically from your connection.": "認証ヘッダは接続から自動的に注入されます。",
"Enable for files like PDFs, images, etc..": "PDF、画像などのファイルを有効にします。",
"GET": "取得",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "削除",
"HEAD": "頭"
}

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "Alles-in-één lidmaatschap software",
"API Key": "API Sleutel",
"Instance Url": "Instantie URL",
"The api key of the brilliant directories account account": "De API sleutel van de briljante mappen account",
"The url of the brilliant directories instance.": "De url van de briljante mappen instantie.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Briljante Directories Authenticatie.\n\n Vul uw API-sleutel in die hier kan worden gegenereerd: https://ww2.managemydirectory. om/admin/apiSettings\n\n Vul dan uw briljante directory website instantie URL in, toegevoegd met /api zoals de voorbeeld.\n ",
"Create new User": "Nieuwe gebruiker aanmaken",
"Custom API Call": "Custom API Call",
"Creates a new user in your brilliant directories site": "Maakt een nieuwe gebruiker aan in uw briljante map site",
"Make a custom API call to a specific endpoint": "Maak een aangepaste API call naar een specifiek eindpunt",
"Email": "E-mail",
"Password": "Wachtwoord",
"Subscription ID": "Abonnement ID",
"Meta": "Meta",
"Method": "Methode",
"Headers": "Kopteksten",
"Query Parameters": "Query parameters",
"Body": "Lichaam",
"Response is Binary ?": "Antwoord is binair?",
"No Error on Failure": "Geen fout bij fout",
"Timeout (in seconds)": "Time-out (in seconden)",
"Email address for the users account": "E-mailadres voor het gebruikersaccount",
"Password for the new user account": "Wachtwoord voor het nieuwe gebruikersaccount",
"The subscription ID from your website": "Het abonnement-ID van uw website",
"Additional fields for the new user account": "Extra velden voor het nieuwe gebruikersaccount",
"Authorization headers are injected automatically from your connection.": "Autorisatie headers worden automatisch geïnjecteerd vanuit uw verbinding.",
"Enable for files like PDFs, images, etc..": "Inschakelen voor bestanden zoals PDF's, afbeeldingen etc..",
"GET": "KRIJG",
"POST": "POSTE",
"PATCH": "BEKIJK",
"PUT": "PUT",
"DELETE": "VERWIJDEREN",
"HEAD": "HOOFD"
}

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "Software de adesão All-in-one",
"API Key": "Chave de API",
"Instance Url": "URL da Instância",
"The api key of the brilliant directories account account": "A chave da conta da API dos diretórios brilhantes",
"The url of the brilliant directories instance.": "A url dos diretórios brilhantes.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Autenticação de Diretórios Brilhantes.\n\n Por favor, digite sua chave de API que pode ser gerada aqui: https://ww2.managemydirectory. Um/admin/apiSettings\n\n Em seguida, digite o URL de instância de site dos seus brilhantes diretórios anexado com /api como o exemplo.\n ",
"Create new User": "Criar novo Usuário",
"Custom API Call": "Chamada de API personalizada",
"Creates a new user in your brilliant directories site": "Cria um novo usuário em seu site de diretórios brilhantes",
"Make a custom API call to a specific endpoint": "Faça uma chamada de API personalizada para um ponto de extremidade específico",
"Email": "e-mail",
"Password": "Senha",
"Subscription ID": "ID de assinatura",
"Meta": "Meta",
"Method": "Método",
"Headers": "Cabeçalhos",
"Query Parameters": "Parâmetros da consulta",
"Body": "Conteúdo",
"Response is Binary ?": "A resposta é binária ?",
"No Error on Failure": "Nenhum erro no Failure",
"Timeout (in seconds)": "Tempo limite (em segundos)",
"Email address for the users account": "Endereço de email para a conta dos usuários",
"Password for the new user account": "Senha para a nova conta de usuário",
"The subscription ID from your website": "O ID de assinatura do seu site",
"Additional fields for the new user account": "Campos adicionais para a nova conta de usuário",
"Authorization headers are injected automatically from your connection.": "Os cabeçalhos de autorização são inseridos automaticamente a partir da sua conexão.",
"Enable for files like PDFs, images, etc..": "Habilitar para arquivos como PDFs, imagens, etc..",
"GET": "OBTER",
"POST": "POSTAR",
"PATCH": "COMPRAR",
"PUT": "COLOCAR",
"DELETE": "EXCLUIR",
"HEAD": "CABEÇA"
}

View File

@@ -0,0 +1,34 @@
{
"Brilliant Directories": "Бриллиантовые Каталоги",
"All-in-one membership software": "Программное обеспечение для всех в одном членстве",
"API Key": "Ключ API",
"Instance Url": "Ссылка экземпляра",
"The api key of the brilliant directories account account": "Ключ api аккаунта блестящей директории",
"The url of the brilliant directories instance.": "Ссылка на экземпляр блестящих каталогов.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Гениальная Аутентификация Директорий.\n\n Пожалуйста, введите ваш API ключ, который можно сгенерировать здесь: https://ww2.managemydirectory. om/admin/apiSettings\n\n Затем введите ваш блестящий URL сайта с ссылкой на /api, как на пример.\n ",
"Create new User": "Создать нового пользователя",
"Custom API Call": "Пользовательский вызов API",
"Creates a new user in your brilliant directories site": "Создает нового пользователя в ваших блестящих каталогах",
"Make a custom API call to a specific endpoint": "Сделать пользовательский API вызов к определенной конечной точке",
"Email": "Почта",
"Password": "Пароль",
"Subscription ID": "ID подписки",
"Meta": "Meta",
"Method": "Метод",
"Headers": "Заголовки",
"Query Parameters": "Параметры запроса",
"Body": "Тело",
"No Error on Failure": "Нет ошибок при ошибке",
"Timeout (in seconds)": "Таймаут (в секундах)",
"Email address for the users account": "Адрес электронной почты для учетной записи пользователей",
"Password for the new user account": "Пароль для новой учетной записи пользователя",
"The subscription ID from your website": "Идентификатор подписки с вашего сайта",
"Additional fields for the new user account": "Дополнительные поля для новой учетной записи пользователя",
"Authorization headers are injected automatically from your connection.": "Заголовки авторизации включаются автоматически из вашего соединения.",
"GET": "ПОЛУЧИТЬ",
"POST": "ПОСТ",
"PATCH": "ПАТЧ",
"PUT": "ПОКУПИТЬ",
"DELETE": "УДАЛИТЬ",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "All-in-one membership software",
"API Key": "API Key",
"Instance Url": "Instance Url",
"The api key of the brilliant directories account account": "The api key of the brilliant directories account account",
"The url of the brilliant directories instance.": "The url of the brilliant directories instance.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ",
"Create new User": "Create new User",
"Custom API Call": "Custom API Call",
"Creates a new user in your brilliant directories site": "Creates a new user in your brilliant directories site",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Email": "Email",
"Password": "Password",
"Subscription ID": "Subscription ID",
"Meta": "Meta",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Email address for the users account": "Email address for the users account",
"Password for the new user account": "Password for the new user account",
"The subscription ID from your website": "The subscription ID from your website",
"Additional fields for the new user account": "Additional fields for the new user account",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,34 @@
{
"Brilliant Directories": "Brilliant Directories",
"All-in-one membership software": "All-in-one membership software",
"API Key": "API Key",
"Instance Url": "Instance Url",
"The api key of the brilliant directories account account": "The api key of the brilliant directories account account",
"The url of the brilliant directories instance.": "The url of the brilliant directories instance.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ",
"Create new User": "Create new User",
"Custom API Call": "Custom API Call",
"Creates a new user in your brilliant directories site": "Creates a new user in your brilliant directories site",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Email": "Email",
"Password": "Password",
"Subscription ID": "Subscription ID",
"Meta": "Meta",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
"Body": "Body",
"No Error on Failure": "No Error on Failure",
"Timeout (in seconds)": "Timeout (in seconds)",
"Email address for the users account": "Email address for the users account",
"Password for the new user account": "Password for the new user account",
"The subscription ID from your website": "The subscription ID from your website",
"Additional fields for the new user account": "Additional fields for the new user account",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD"
}

View File

@@ -0,0 +1,35 @@
{
"All-in-one membership software": "All-in-one membership software",
"API Key": "API 密钥",
"Instance Url": "Instance Url",
"The api key of the brilliant directories account account": "The api key of the brilliant directories account account",
"The url of the brilliant directories instance.": "The url of the brilliant directories instance.",
"\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ": "\n Brilliant Directories Authentication.\n\n Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings\n\n Then enter your brilliant directories website instance URL appended with /api like the example.\n ",
"Create new User": "Create new User",
"Custom API Call": "自定义 API 呼叫",
"Creates a new user in your brilliant directories site": "Creates a new user in your brilliant directories site",
"Make a custom API call to a specific endpoint": "将一个自定义 API 调用到一个特定的终点",
"Email": "电子邮件地址",
"Password": "密码",
"Subscription ID": "Subscription ID",
"Meta": "Meta",
"Method": "方法",
"Headers": "信头",
"Query Parameters": "查询参数",
"Body": "正文内容",
"Response is Binary ?": "Response is Binary ?",
"No Error on Failure": "失败时没有错误",
"Timeout (in seconds)": "超时(秒)",
"Email address for the users account": "Email address for the users account",
"Password for the new user account": "Password for the new user account",
"The subscription ID from your website": "The subscription ID from your website",
"Additional fields for the new user account": "Additional fields for the new user account",
"Authorization headers are injected automatically from your connection.": "授权头自动从您的连接中注入。",
"Enable for files like PDFs, images, etc..": "Enable for files like PDFs, images, etc..",
"GET": "获取",
"POST": "帖子",
"PATCH": "PATCH",
"PUT": "弹出",
"DELETE": "删除",
"HEAD": "黑色"
}

View File

@@ -0,0 +1,54 @@
import { createCustomApiCallAction } from '@activepieces/pieces-common';
import {
createPiece,
PieceAuth,
Property,
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { createNewUser } from './lib/actions/create-new-user';
export const brilliantDirectoriesAuth = PieceAuth.CustomAuth({
required: true,
description: `
Brilliant Directories Authentication.
Please enter your API key which can be generated from here: https://ww2.managemydirectory.com/admin/apiSettings
Then enter your brilliant directories website instance URL appended with /api like the example.
`,
props: {
api_key: PieceAuth.SecretText({
displayName: 'API Key',
description: 'The api key of the brilliant directories account account',
required: true,
}),
site_url: Property.ShortText({
displayName: 'Instance Url',
description: 'The url of the brilliant directories instance.',
required: true,
defaultValue: 'https://yoursitehere.com/api',
}),
},
});
export const brilliantDirectories = createPiece({
displayName: 'Brilliant Directories',
description: 'All-in-one membership software',
auth: brilliantDirectoriesAuth,
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/brilliant-directories.png',
categories: [],
authors: ["ShayPunter","dennisrongo","kishanprmr","MoShizzle","abuaboud"],
actions: [
createNewUser,
createCustomApiCallAction({
baseUrl: (auth) => auth?.props?.site_url || '',
auth: brilliantDirectoriesAuth,
authMapping: async (auth) => ({
'X-Api-Key': `${auth.props.api_key}`,
}),
}),
],
triggers: [],
});

View File

@@ -0,0 +1,62 @@
import { createAction, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { brilliantDirectoriesAuth } from '../..';
import { parseDirectoryURL } from '../common/brilliant-directories-common';
export const createNewUser = createAction({
name: 'create_new_user',
auth: brilliantDirectoriesAuth,
displayName: 'Create new User',
description: 'Creates a new user in your brilliant directories site',
props: {
email: Property.ShortText({
displayName: 'Email',
description: 'Email address for the users account',
required: true,
}),
password: Property.ShortText({
displayName: 'Password',
description: 'Password for the new user account',
required: true,
}),
subscription: Property.ShortText({
displayName: 'Subscription ID',
description: 'The subscription ID from your website',
required: true,
}),
meta: Property.Json({
displayName: 'Meta',
description: 'Additional fields for the new user account',
required: false,
}),
},
async run(context) {
const siteUrl = parseDirectoryURL(context.auth.props.site_url);
// Compile the request
const CREATE_NEW_USER_URL = siteUrl + '/v2/user/create';
const headers = {
accept: 'application/json',
'X-Api-Key': context.auth.props.api_key,
'Content-Type': 'application/x-www-form-urlencoded',
};
const body = {
email: context.propsValue.email,
password: context.propsValue.password,
subscription_id: context.propsValue.subscription,
...context.propsValue.meta,
};
// send the request
const request = await httpClient.sendRequest<string[]>({
method: HttpMethod.POST,
url: CREATE_NEW_USER_URL,
headers: headers,
body: body,
});
// return the request
return request;
},
});

View File

@@ -0,0 +1,27 @@
/**
* Process the directory URL to ensure proper formatting and requests.
*
* @param {string} url directory site url
* @returns {string} formatted url
*/
export function parseDirectoryURL(url: string) {
let formattedUrl = url;
// Ensure the URL starts with "https://"
if (!formattedUrl.startsWith('https://')) {
// If the URL starts with "http://", replace it with "https://"
// Otherwise, prepend "https://" to the URL
formattedUrl = formattedUrl.startsWith('http://')
? formattedUrl.replace('http://', 'https://')
: 'https://' + formattedUrl;
}
// Ensure the URL ends with "/api"
if (!formattedUrl.endsWith('/api')) {
// If the URL ends with a slash, append "api" to the URL
// Otherwise, append "/api" to the URL
formattedUrl += formattedUrl.endsWith('/') ? 'api' : '/api';
}
return formattedUrl;
}