@fayz-ai/plugin-automations 0.2.0
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/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/index.cjs +150 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +144 -0
- package/dist/index.js.map +1 -0
- package/dist/views/AutomationsHome.d.ts +3 -0
- package/dist/views/AutomationsHome.d.ts.map +1 -0
- package/package.json +52 -0
- package/src/index.ts +52 -0
- package/src/views/AutomationsHome.tsx +112 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Faya Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @fayz-ai/plugin-automations
|
|
2
|
+
|
|
3
|
+
> Visual trigger → action workflows, native to your app's own events.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@fayz-ai/plugin-automations)
|
|
6
|
+
[](https://github.com/FayaLabs/fayz-sdk/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
The best automations don't live in a third-party tool watching webhooks from the outside — they live inside the app, listening to its own events. plugin-automations is the GoHighLevel "Automation" surface for Fayz: when a form is submitted, a call is missed, or a deal is won, fan out into SMS, email, waits, tags, and tasks. Because it's a plugin in the same `defineSaas` app, it can react to real domain events instead of guessing from polling.
|
|
9
|
+
|
|
10
|
+
We're honest about where it is. M1 ships a polished `/automations` home — real workflow cards with triggers, multi-step sequences, and enrollment stats — to lock the model and UX. The trigger→action execution engine (over the core event bus + scheduler) is the next milestone.
|
|
11
|
+
|
|
12
|
+
## What's inside
|
|
13
|
+
- **`/automations` route + nav entry** (icon `Zap`), permission-gated on `automations:read`
|
|
14
|
+
- **Automations home view** — workflows with triggers, step sequences (SMS, email, wait, tag, task), and enrollment counts
|
|
15
|
+
- **Universal scope** — works across every vertical
|
|
16
|
+
- **Configurable nav** — `navPosition`, `navSection`, `navLabel`
|
|
17
|
+
- **Declared feature** — `automations` (in the "Automate" group) for permissions and feature gating
|
|
18
|
+
|
|
19
|
+
> Status: M1 mock home. The execution engine over the event bus + scheduler is on the roadmap.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
```bash
|
|
23
|
+
npm install @fayz-ai/plugin-automations
|
|
24
|
+
```
|
|
25
|
+
Peer deps: `react`, `react-dom`. Runtime deps: `@fayz-ai/core`, `@fayz-ai/ui`.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
```tsx
|
|
29
|
+
import { defineSaas } from '@fayz-ai/saas'
|
|
30
|
+
import { createAutomationsPlugin } from '@fayz-ai/plugin-automations'
|
|
31
|
+
|
|
32
|
+
export const app = defineSaas({
|
|
33
|
+
// ...
|
|
34
|
+
plugins: [
|
|
35
|
+
createAutomationsPlugin({
|
|
36
|
+
navLabel: 'Automations',
|
|
37
|
+
navPosition: 6,
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Part of the Fayz SDK
|
|
44
|
+
One of the composable plugins for `@fayz-ai/saas` — this one owns the automate surface: workflows that react to your app's events.
|
|
45
|
+
|
|
46
|
+
## Roadmap & contributing
|
|
47
|
+
Built and evolving in the open. See the [Fayz SDK roadmap](../../docs/ROADMAP.md#plugin-automations) for current gaps, missing features, and good first issues.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var lucideReact = require('lucide-react');
|
|
5
|
+
var ui = require('@fayz-ai/ui');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
11
|
+
|
|
12
|
+
// src/index.ts
|
|
13
|
+
var WORKFLOWS = [
|
|
14
|
+
{
|
|
15
|
+
id: "1",
|
|
16
|
+
name: "New lead \u2192 nurture",
|
|
17
|
+
trigger: "Form submitted",
|
|
18
|
+
enrolled: 342,
|
|
19
|
+
active: true,
|
|
20
|
+
steps: [
|
|
21
|
+
{ icon: lucideReact.MessageSquare, label: "Send SMS" },
|
|
22
|
+
{ icon: lucideReact.Clock, label: "Wait 1 day" },
|
|
23
|
+
{ icon: lucideReact.Mail, label: "Send email" },
|
|
24
|
+
{ icon: lucideReact.Tag, label: 'Tag "nurtured"' }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "2",
|
|
29
|
+
name: "Missed call text-back",
|
|
30
|
+
trigger: "Call missed",
|
|
31
|
+
enrolled: 128,
|
|
32
|
+
active: true,
|
|
33
|
+
steps: [
|
|
34
|
+
{ icon: lucideReact.MessageSquare, label: "Text back" },
|
|
35
|
+
{ icon: lucideReact.Tag, label: "Create task" }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "3",
|
|
40
|
+
name: "Appointment reminder",
|
|
41
|
+
trigger: "Appointment booked",
|
|
42
|
+
enrolled: 87,
|
|
43
|
+
active: true,
|
|
44
|
+
steps: [
|
|
45
|
+
{ icon: lucideReact.Clock, label: "Wait until 24h before" },
|
|
46
|
+
{ icon: lucideReact.MessageSquare, label: "WhatsApp reminder" }
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "4",
|
|
51
|
+
name: "Won deal \u2192 review request",
|
|
52
|
+
trigger: "Deal marked Won",
|
|
53
|
+
enrolled: 41,
|
|
54
|
+
active: false,
|
|
55
|
+
steps: [
|
|
56
|
+
{ icon: lucideReact.Clock, label: "Wait 2 days" },
|
|
57
|
+
{ icon: lucideReact.Mail, label: "Ask for review" }
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
function Stat({ label, value }) {
|
|
62
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-card border border-border bg-card p-4", children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: label }),
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-2xl font-semibold text-foreground", children: value })
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
function AutomationsHome() {
|
|
68
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto max-w-6xl p-6", children: [
|
|
69
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.PageHeaderActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { children: [
|
|
70
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "mr-1.5 h-4 w-4" }),
|
|
71
|
+
" New workflow"
|
|
72
|
+
] }) }),
|
|
73
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4", children: [
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stat, { label: "Active workflows", value: "3" }),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stat, { label: "Contacts enrolled", value: "598" }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stat, { label: "Actions run (30d)", value: "2,140" }),
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stat, { label: "Success rate", value: "98.6%" })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 space-y-3", children: WORKFLOWS.map((w) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-card border border-border bg-card p-4", children: [
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
82
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-amber-100 text-amber-600", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { className: "h-4 w-4" }) }),
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: w.name }),
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "h-3 w-3" }),
|
|
87
|
+
" When: ",
|
|
88
|
+
w.trigger,
|
|
89
|
+
" \xB7 ",
|
|
90
|
+
w.enrolled,
|
|
91
|
+
" enrolled"
|
|
92
|
+
] })
|
|
93
|
+
] })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${w.active ? "bg-emerald-100 text-emerald-700" : "bg-muted text-muted-foreground"}`, children: w.active ? "Active" : "Paused" }),
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outline", size: "icon", children: w.active ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pause, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "h-4 w-4" }) })
|
|
98
|
+
] })
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 flex flex-wrap items-center gap-2 rounded-md bg-muted/40 p-3", children: w.steps.map((s, i) => /* @__PURE__ */ jsxRuntime.jsxs(React__default.default.Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground", children: [
|
|
102
|
+
/* @__PURE__ */ jsxRuntime.jsx(s.icon, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
103
|
+
" ",
|
|
104
|
+
s.label
|
|
105
|
+
] }),
|
|
106
|
+
i < w.steps.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRight, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
107
|
+
] }, i)) })
|
|
108
|
+
] }, w.id)) }),
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 text-center text-xs text-muted-foreground", children: "Mock preview \xB7 the visual builder + execution engine (event bus, scheduler) ships in a later milestone." })
|
|
110
|
+
] });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/index.ts
|
|
114
|
+
function createAutomationsPlugin(options) {
|
|
115
|
+
const PageComponent = () => React__default.default.createElement(AutomationsHome);
|
|
116
|
+
PageComponent.displayName = "AutomationsHome";
|
|
117
|
+
return {
|
|
118
|
+
id: "automations",
|
|
119
|
+
name: options?.navLabel ?? "Automations",
|
|
120
|
+
icon: "Zap",
|
|
121
|
+
version: "1.0.0",
|
|
122
|
+
scope: options?.scope ?? "universal",
|
|
123
|
+
verticalId: options?.verticalId,
|
|
124
|
+
defaultEnabled: true,
|
|
125
|
+
dependencies: [],
|
|
126
|
+
declaredFeatures: [{ id: "automations", label: "Automations", group: "Automate" }],
|
|
127
|
+
navigation: [
|
|
128
|
+
{
|
|
129
|
+
section: options?.navSection ?? "main",
|
|
130
|
+
position: options?.navPosition ?? 6,
|
|
131
|
+
label: options?.navLabel ?? "Automations",
|
|
132
|
+
route: "/automations",
|
|
133
|
+
icon: "Zap",
|
|
134
|
+
permission: { feature: "automations", action: "read" }
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
routes: [
|
|
138
|
+
{
|
|
139
|
+
path: "/automations",
|
|
140
|
+
component: PageComponent,
|
|
141
|
+
permission: { feature: "automations", action: "read" }
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
widgets: []
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
exports.createAutomationsPlugin = createAutomationsPlugin;
|
|
149
|
+
//# sourceMappingURL=index.cjs.map
|
|
150
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/views/AutomationsHome.tsx","../src/index.ts"],"names":["MessageSquare","Clock","Mail","Tag","jsxs","jsx","PageHeaderActions","Button","Plus","Zap","Filter","P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, Plus, Play, Pause, ArrowRight, Filter, Mail, Tag, MessageSquare, Clock } from 'lucide-react'\nimport { Button, PageHeaderActions } from '@fayz-ai/ui'\n\ninterface Workflow {\n id: string\n name: string\n trigger: string\n steps: Array<{ icon: React.ComponentType<{ className?: string }>; label: string }>\n enrolled: number\n active: boolean\n}\n\nconst WORKFLOWS: Workflow[] = [\n {\n id: '1', name: 'New lead → nurture', trigger: 'Form submitted', enrolled: 342, active: true,\n steps: [\n { icon: MessageSquare, label: 'Send SMS' },\n { icon: Clock, label: 'Wait 1 day' },\n { icon: Mail, label: 'Send email' },\n { icon: Tag, label: 'Tag \"nurtured\"' },\n ],\n },\n {\n id: '2', name: 'Missed call text-back', trigger: 'Call missed', enrolled: 128, active: true,\n steps: [\n { icon: MessageSquare, label: 'Text back' },\n { icon: Tag, label: 'Create task' },\n ],\n },\n {\n id: '3', name: 'Appointment reminder', trigger: 'Appointment booked', enrolled: 87, active: true,\n steps: [\n { icon: Clock, label: 'Wait until 24h before' },\n { icon: MessageSquare, label: 'WhatsApp reminder' },\n ],\n },\n {\n id: '4', name: 'Won deal → review request', trigger: 'Deal marked Won', enrolled: 41, active: false,\n steps: [\n { icon: Clock, label: 'Wait 2 days' },\n { icon: Mail, label: 'Ask for review' },\n ],\n },\n]\n\nfunction Stat({ label, value }: { label: string; value: string }) {\n return (\n <div className=\"rounded-card border border-border bg-card p-4\">\n <p className=\"text-xs font-medium text-muted-foreground\">{label}</p>\n <p className=\"mt-2 text-2xl font-semibold text-foreground\">{value}</p>\n </div>\n )\n}\n\nexport function AutomationsHome() {\n return (\n <div className=\"mx-auto max-w-6xl p-6\">\n <PageHeaderActions>\n <Button><Plus className=\"mr-1.5 h-4 w-4\" /> New workflow</Button>\n </PageHeaderActions>\n\n <div className=\"mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4\">\n <Stat label=\"Active workflows\" value=\"3\" />\n <Stat label=\"Contacts enrolled\" value=\"598\" />\n <Stat label=\"Actions run (30d)\" value=\"2,140\" />\n <Stat label=\"Success rate\" value=\"98.6%\" />\n </div>\n\n <div className=\"mt-6 space-y-3\">\n {WORKFLOWS.map((w) => (\n <div key={w.id} className=\"rounded-card border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2.5\">\n <div className=\"flex h-9 w-9 items-center justify-center rounded-lg bg-amber-100 text-amber-600\">\n <Zap className=\"h-4 w-4\" />\n </div>\n <div>\n <p className=\"text-sm font-semibold text-foreground\">{w.name}</p>\n <p className=\"flex items-center gap-1 text-xs text-muted-foreground\">\n <Filter className=\"h-3 w-3\" /> When: {w.trigger} · {w.enrolled} enrolled\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <span className={`rounded-full px-2 py-0.5 text-xs font-medium ${w.active ? 'bg-emerald-100 text-emerald-700' : 'bg-muted text-muted-foreground'}`}>\n {w.active ? 'Active' : 'Paused'}\n </span>\n <Button variant=\"outline\" size=\"icon\">{w.active ? <Pause className=\"h-4 w-4\" /> : <Play className=\"h-4 w-4\" />}</Button>\n </div>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2 rounded-md bg-muted/40 p-3\">\n {w.steps.map((s, i) => (\n <React.Fragment key={i}>\n <span className=\"inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground\">\n <s.icon className=\"h-3.5 w-3.5 text-muted-foreground\" /> {s.label}\n </span>\n {i < w.steps.length - 1 && <ArrowRight className=\"h-3.5 w-3.5 text-muted-foreground\" />}\n </React.Fragment>\n ))}\n </div>\n </div>\n ))}\n </div>\n\n <p className=\"mt-4 text-center text-xs text-muted-foreground\">\n Mock preview · the visual builder + execution engine (event bus, scheduler) ships in a later milestone.\n </p>\n </div>\n )\n}\n","import React from 'react'\nimport type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core'\nimport { AutomationsHome } from './views/AutomationsHome'\n\n// ---------------------------------------------------------------------------\n// @fayz-ai/plugin-automations — visual workflows (GoHighLevel \"Automation\").\n// Universal plugin. M1 ships a rich mock home; the trigger→action execution\n// engine over the core event bus + scheduler comes in a later milestone.\n// ---------------------------------------------------------------------------\n\nexport interface AutomationsPluginOptions {\n navPosition?: number\n navSection?: 'main' | 'secondary' | 'settings'\n navLabel?: string\n scope?: PluginScope\n verticalId?: VerticalId\n}\n\nexport function createAutomationsPlugin(options?: AutomationsPluginOptions): PluginManifest {\n const PageComponent: React.ComponentType<unknown> = () => React.createElement(AutomationsHome)\n PageComponent.displayName = 'AutomationsHome'\n\n return {\n id: 'automations',\n name: options?.navLabel ?? 'Automations',\n icon: 'Zap',\n version: '1.0.0',\n scope: options?.scope ?? 'universal',\n verticalId: options?.verticalId,\n defaultEnabled: true,\n dependencies: [],\n declaredFeatures: [{ id: 'automations', label: 'Automations', group: 'Automate' }],\n navigation: [\n {\n section: options?.navSection ?? 'main',\n position: options?.navPosition ?? 6,\n label: options?.navLabel ?? 'Automations',\n route: '/automations',\n icon: 'Zap',\n permission: { feature: 'automations', action: 'read' as const },\n },\n ],\n routes: [\n {\n path: '/automations',\n component: PageComponent,\n permission: { feature: 'automations', action: 'read' as const },\n },\n ],\n widgets: [],\n }\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core';
|
|
2
|
+
export interface AutomationsPluginOptions {
|
|
3
|
+
navPosition?: number;
|
|
4
|
+
navSection?: 'main' | 'secondary' | 'settings';
|
|
5
|
+
navLabel?: string;
|
|
6
|
+
scope?: PluginScope;
|
|
7
|
+
verticalId?: VerticalId;
|
|
8
|
+
}
|
|
9
|
+
export declare function createAutomationsPlugin(options?: AutomationsPluginOptions): PluginManifest;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAS5E,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,CAAA;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAED,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,cAAc,CAiC1F"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Plus, MessageSquare, Clock, Mail, Tag, Zap, Filter, Pause, Play, ArrowRight } from 'lucide-react';
|
|
3
|
+
import { PageHeaderActions, Button } from '@fayz-ai/ui';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/index.ts
|
|
7
|
+
var WORKFLOWS = [
|
|
8
|
+
{
|
|
9
|
+
id: "1",
|
|
10
|
+
name: "New lead \u2192 nurture",
|
|
11
|
+
trigger: "Form submitted",
|
|
12
|
+
enrolled: 342,
|
|
13
|
+
active: true,
|
|
14
|
+
steps: [
|
|
15
|
+
{ icon: MessageSquare, label: "Send SMS" },
|
|
16
|
+
{ icon: Clock, label: "Wait 1 day" },
|
|
17
|
+
{ icon: Mail, label: "Send email" },
|
|
18
|
+
{ icon: Tag, label: 'Tag "nurtured"' }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "2",
|
|
23
|
+
name: "Missed call text-back",
|
|
24
|
+
trigger: "Call missed",
|
|
25
|
+
enrolled: 128,
|
|
26
|
+
active: true,
|
|
27
|
+
steps: [
|
|
28
|
+
{ icon: MessageSquare, label: "Text back" },
|
|
29
|
+
{ icon: Tag, label: "Create task" }
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "3",
|
|
34
|
+
name: "Appointment reminder",
|
|
35
|
+
trigger: "Appointment booked",
|
|
36
|
+
enrolled: 87,
|
|
37
|
+
active: true,
|
|
38
|
+
steps: [
|
|
39
|
+
{ icon: Clock, label: "Wait until 24h before" },
|
|
40
|
+
{ icon: MessageSquare, label: "WhatsApp reminder" }
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "4",
|
|
45
|
+
name: "Won deal \u2192 review request",
|
|
46
|
+
trigger: "Deal marked Won",
|
|
47
|
+
enrolled: 41,
|
|
48
|
+
active: false,
|
|
49
|
+
steps: [
|
|
50
|
+
{ icon: Clock, label: "Wait 2 days" },
|
|
51
|
+
{ icon: Mail, label: "Ask for review" }
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
function Stat({ label, value }) {
|
|
56
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-card border border-border bg-card p-4", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground", children: label }),
|
|
58
|
+
/* @__PURE__ */ jsx("p", { className: "mt-2 text-2xl font-semibold text-foreground", children: value })
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
function AutomationsHome() {
|
|
62
|
+
return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-6xl p-6", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsxs(Button, { children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Plus, { className: "mr-1.5 h-4 w-4" }),
|
|
65
|
+
" New workflow"
|
|
66
|
+
] }) }),
|
|
67
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Stat, { label: "Active workflows", value: "3" }),
|
|
69
|
+
/* @__PURE__ */ jsx(Stat, { label: "Contacts enrolled", value: "598" }),
|
|
70
|
+
/* @__PURE__ */ jsx(Stat, { label: "Actions run (30d)", value: "2,140" }),
|
|
71
|
+
/* @__PURE__ */ jsx(Stat, { label: "Success rate", value: "98.6%" })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsx("div", { className: "mt-6 space-y-3", children: WORKFLOWS.map((w) => /* @__PURE__ */ jsxs("div", { className: "rounded-card border border-border bg-card p-4", children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
76
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-amber-100 text-amber-600", children: /* @__PURE__ */ jsx(Zap, { className: "h-4 w-4" }) }),
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
78
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: w.name }),
|
|
79
|
+
/* @__PURE__ */ jsxs("p", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
80
|
+
/* @__PURE__ */ jsx(Filter, { className: "h-3 w-3" }),
|
|
81
|
+
" When: ",
|
|
82
|
+
w.trigger,
|
|
83
|
+
" \xB7 ",
|
|
84
|
+
w.enrolled,
|
|
85
|
+
" enrolled"
|
|
86
|
+
] })
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${w.active ? "bg-emerald-100 text-emerald-700" : "bg-muted text-muted-foreground"}`, children: w.active ? "Active" : "Paused" }),
|
|
91
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", children: w.active ? /* @__PURE__ */ jsx(Pause, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Play, { className: "h-4 w-4" }) })
|
|
92
|
+
] })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap items-center gap-2 rounded-md bg-muted/40 p-3", children: w.steps.map((s, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
95
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground", children: [
|
|
96
|
+
/* @__PURE__ */ jsx(s.icon, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
97
|
+
" ",
|
|
98
|
+
s.label
|
|
99
|
+
] }),
|
|
100
|
+
i < w.steps.length - 1 && /* @__PURE__ */ jsx(ArrowRight, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
101
|
+
] }, i)) })
|
|
102
|
+
] }, w.id)) }),
|
|
103
|
+
/* @__PURE__ */ jsx("p", { className: "mt-4 text-center text-xs text-muted-foreground", children: "Mock preview \xB7 the visual builder + execution engine (event bus, scheduler) ships in a later milestone." })
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/index.ts
|
|
108
|
+
function createAutomationsPlugin(options) {
|
|
109
|
+
const PageComponent = () => React.createElement(AutomationsHome);
|
|
110
|
+
PageComponent.displayName = "AutomationsHome";
|
|
111
|
+
return {
|
|
112
|
+
id: "automations",
|
|
113
|
+
name: options?.navLabel ?? "Automations",
|
|
114
|
+
icon: "Zap",
|
|
115
|
+
version: "1.0.0",
|
|
116
|
+
scope: options?.scope ?? "universal",
|
|
117
|
+
verticalId: options?.verticalId,
|
|
118
|
+
defaultEnabled: true,
|
|
119
|
+
dependencies: [],
|
|
120
|
+
declaredFeatures: [{ id: "automations", label: "Automations", group: "Automate" }],
|
|
121
|
+
navigation: [
|
|
122
|
+
{
|
|
123
|
+
section: options?.navSection ?? "main",
|
|
124
|
+
position: options?.navPosition ?? 6,
|
|
125
|
+
label: options?.navLabel ?? "Automations",
|
|
126
|
+
route: "/automations",
|
|
127
|
+
icon: "Zap",
|
|
128
|
+
permission: { feature: "automations", action: "read" }
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
routes: [
|
|
132
|
+
{
|
|
133
|
+
path: "/automations",
|
|
134
|
+
component: PageComponent,
|
|
135
|
+
permission: { feature: "automations", action: "read" }
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
widgets: []
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { createAutomationsPlugin };
|
|
143
|
+
//# sourceMappingURL=index.js.map
|
|
144
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/views/AutomationsHome.tsx","../src/index.ts"],"names":["React"],"mappings":";;;;;;AAaA,IAAM,SAAA,GAAwB;AAAA,EAC5B;AAAA,IACE,EAAA,EAAI,GAAA;AAAA,IAAK,IAAA,EAAM,yBAAA;AAAA,IAAsB,OAAA,EAAS,gBAAA;AAAA,IAAkB,QAAA,EAAU,GAAA;AAAA,IAAK,MAAA,EAAQ,IAAA;AAAA,IACvF,KAAA,EAAO;AAAA,MACL,EAAE,IAAA,EAAM,aAAA,EAAe,KAAA,EAAO,UAAA,EAAW;AAAA,MACzC,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,YAAA,EAAa;AAAA,MACnC,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,YAAA,EAAa;AAAA,MAClC,EAAE,IAAA,EAAM,GAAA,EAAK,KAAA,EAAO,gBAAA;AAAiB;AACvC,GACF;AAAA,EACA;AAAA,IACE,EAAA,EAAI,GAAA;AAAA,IAAK,IAAA,EAAM,uBAAA;AAAA,IAAyB,OAAA,EAAS,aAAA;AAAA,IAAe,QAAA,EAAU,GAAA;AAAA,IAAK,MAAA,EAAQ,IAAA;AAAA,IACvF,KAAA,EAAO;AAAA,MACL,EAAE,IAAA,EAAM,aAAA,EAAe,KAA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aAAA;AAAA,QAC5B,KAAA,EAAO,cAAA;AAAA,QACP,IAAA,EAAM,KAAA;AAAA,QACN,UAAA,EAAY,EAAE,OAAA,EAAS,aAAA,EAAe,QAAQ,MAAA;AAAgB;AAChE,KACF;AAAA,IACA,MAAA,EAAQ;AAAA,MACN;AAAA,QACE,IAAA,EAAM,cAAA;AAAA,QACN,SAAA,EAAW,aAAA;AAAA,QACX,UAAA,EAAY,EAAE,OAAA,EAAS,aAAA,EAAe,QAAQ,MAAA;AAAgB;AAChE,KACF;AAAA,IACA,SAAS;AAAC,GACZ;AACF","file":"index.js","sourcesContent":["import React from 'react'\nimport { Zap, Plus, Play, Pause, ArrowRight, Filter, Mail, Tag, MessageSquare, Clock } from 'lucide-react'\nimport { Button, PageHeaderActions } from '@fayz-ai/ui'\n\ninterface Workflow {\n id: string\n name: string\n trigger: string\n steps: Array<{ icon: React.ComponentType<{ className?: string }>; label: string }>\n enrolled: number\n active: boolean\n}\n\nconst WORKFLOWS: Workflow[] = [\n {\n id: '1', name: 'New lead → nurture', trigger: 'Form submitted', enrolled: 342, active: true,\n steps: [\n { icon: MessageSquare, label: 'Send SMS' },\n { icon: Clock, label: 'Wait 1 day' },\n { icon: Mail, label: 'Send email' },\n { icon: Tag, label: 'Tag \"nurtured\"' },\n ],\n },\n {\n id: '2', name: 'Missed call text-back', trigger: 'Call missed', enrolled: 128, active: true,\n steps: [\n { icon: MessageSquare, label: 'Text back' },\n { icon: Tag, label: 'Create task' },\n ],\n },\n {\n id: '3', name: 'Appointment reminder', trigger: 'Appointment booked', enrolled: 87, active: true,\n steps: [\n { icon: Clock, label: 'Wait until 24h before' },\n { icon: MessageSquare, label: 'WhatsApp reminder' },\n ],\n },\n {\n id: '4', name: 'Won deal → review request', trigger: 'Deal marked Won', enrolled: 41, active: false,\n steps: [\n { icon: Clock, label: 'Wait 2 days' },\n { icon: Mail, label: 'Ask for review' },\n ],\n },\n]\n\nfunction Stat({ label, value }: { label: string; value: string }) {\n return (\n <div className=\"rounded-card border border-border bg-card p-4\">\n <p className=\"text-xs font-medium text-muted-foreground\">{label}</p>\n <p className=\"mt-2 text-2xl font-semibold text-foreground\">{value}</p>\n </div>\n )\n}\n\nexport function AutomationsHome() {\n return (\n <div className=\"mx-auto max-w-6xl p-6\">\n <PageHeaderActions>\n <Button><Plus className=\"mr-1.5 h-4 w-4\" /> New workflow</Button>\n </PageHeaderActions>\n\n <div className=\"mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4\">\n <Stat label=\"Active workflows\" value=\"3\" />\n <Stat label=\"Contacts enrolled\" value=\"598\" />\n <Stat label=\"Actions run (30d)\" value=\"2,140\" />\n <Stat label=\"Success rate\" value=\"98.6%\" />\n </div>\n\n <div className=\"mt-6 space-y-3\">\n {WORKFLOWS.map((w) => (\n <div key={w.id} className=\"rounded-card border border-border bg-card p-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2.5\">\n <div className=\"flex h-9 w-9 items-center justify-center rounded-lg bg-amber-100 text-amber-600\">\n <Zap className=\"h-4 w-4\" />\n </div>\n <div>\n <p className=\"text-sm font-semibold text-foreground\">{w.name}</p>\n <p className=\"flex items-center gap-1 text-xs text-muted-foreground\">\n <Filter className=\"h-3 w-3\" /> When: {w.trigger} · {w.enrolled} enrolled\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <span className={`rounded-full px-2 py-0.5 text-xs font-medium ${w.active ? 'bg-emerald-100 text-emerald-700' : 'bg-muted text-muted-foreground'}`}>\n {w.active ? 'Active' : 'Paused'}\n </span>\n <Button variant=\"outline\" size=\"icon\">{w.active ? <Pause className=\"h-4 w-4\" /> : <Play className=\"h-4 w-4\" />}</Button>\n </div>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2 rounded-md bg-muted/40 p-3\">\n {w.steps.map((s, i) => (\n <React.Fragment key={i}>\n <span className=\"inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground\">\n <s.icon className=\"h-3.5 w-3.5 text-muted-foreground\" /> {s.label}\n </span>\n {i < w.steps.length - 1 && <ArrowRight className=\"h-3.5 w-3.5 text-muted-foreground\" />}\n </React.Fragment>\n ))}\n </div>\n </div>\n ))}\n </div>\n\n <p className=\"mt-4 text-center text-xs text-muted-foreground\">\n Mock preview · the visual builder + execution engine (event bus, scheduler) ships in a later milestone.\n </p>\n </div>\n )\n}\n","import React from 'react'\nimport type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core'\nimport { AutomationsHome } from './views/AutomationsHome'\n\n// ---------------------------------------------------------------------------\n// @fayz-ai/plugin-automations — visual workflows (GoHighLevel \"Automation\").\n// Universal plugin. M1 ships a rich mock home; the trigger→action execution\n// engine over the core event bus + scheduler comes in a later milestone.\n// ---------------------------------------------------------------------------\n\nexport interface AutomationsPluginOptions {\n navPosition?: number\n navSection?: 'main' | 'secondary' | 'settings'\n navLabel?: string\n scope?: PluginScope\n verticalId?: VerticalId\n}\n\nexport function createAutomationsPlugin(options?: AutomationsPluginOptions): PluginManifest {\n const PageComponent: React.ComponentType<unknown> = () => React.createElement(AutomationsHome)\n PageComponent.displayName = 'AutomationsHome'\n\n return {\n id: 'automations',\n name: options?.navLabel ?? 'Automations',\n icon: 'Zap',\n version: '1.0.0',\n scope: options?.scope ?? 'universal',\n verticalId: options?.verticalId,\n defaultEnabled: true,\n dependencies: [],\n declaredFeatures: [{ id: 'automations', label: 'Automations', group: 'Automate' }],\n navigation: [\n {\n section: options?.navSection ?? 'main',\n position: options?.navPosition ?? 6,\n label: options?.navLabel ?? 'Automations',\n route: '/automations',\n icon: 'Zap',\n permission: { feature: 'automations', action: 'read' as const },\n },\n ],\n routes: [\n {\n path: '/automations',\n component: PageComponent,\n permission: { feature: 'automations', action: 'read' as const },\n },\n ],\n widgets: [],\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutomationsHome.d.ts","sourceRoot":"","sources":["../../src/views/AutomationsHome.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAuDzB,wBAAgB,eAAe,sBAwD9B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fayz-ai/plugin-automations",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Fayz SDK — workflows & automations plugin",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"source": "./src/index.ts",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"src"
|
|
20
|
+
],
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
23
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"lucide-react": "^0.400.0",
|
|
27
|
+
"@fayz-ai/core": "^0.2.0",
|
|
28
|
+
"@fayz-ai/ui": "^0.2.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/react": "^18.3.0",
|
|
32
|
+
"react": "^18.3.0",
|
|
33
|
+
"tsup": "^8.2.0",
|
|
34
|
+
"typescript": "^5.5.0",
|
|
35
|
+
"@types/react-dom": "^18.3.0"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"keywords": [
|
|
39
|
+
"fayz",
|
|
40
|
+
"fayz-plugin",
|
|
41
|
+
"fayz-sdk"
|
|
42
|
+
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
|
|
48
|
+
"dev": "tsup --watch",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"clean": "rm -rf dist"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core'
|
|
3
|
+
import { AutomationsHome } from './views/AutomationsHome'
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// @fayz-ai/plugin-automations — visual workflows (GoHighLevel "Automation").
|
|
7
|
+
// Universal plugin. M1 ships a rich mock home; the trigger→action execution
|
|
8
|
+
// engine over the core event bus + scheduler comes in a later milestone.
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
export interface AutomationsPluginOptions {
|
|
12
|
+
navPosition?: number
|
|
13
|
+
navSection?: 'main' | 'secondary' | 'settings'
|
|
14
|
+
navLabel?: string
|
|
15
|
+
scope?: PluginScope
|
|
16
|
+
verticalId?: VerticalId
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createAutomationsPlugin(options?: AutomationsPluginOptions): PluginManifest {
|
|
20
|
+
const PageComponent: React.ComponentType<unknown> = () => React.createElement(AutomationsHome)
|
|
21
|
+
PageComponent.displayName = 'AutomationsHome'
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
id: 'automations',
|
|
25
|
+
name: options?.navLabel ?? 'Automations',
|
|
26
|
+
icon: 'Zap',
|
|
27
|
+
version: '1.0.0',
|
|
28
|
+
scope: options?.scope ?? 'universal',
|
|
29
|
+
verticalId: options?.verticalId,
|
|
30
|
+
defaultEnabled: true,
|
|
31
|
+
dependencies: [],
|
|
32
|
+
declaredFeatures: [{ id: 'automations', label: 'Automations', group: 'Automate' }],
|
|
33
|
+
navigation: [
|
|
34
|
+
{
|
|
35
|
+
section: options?.navSection ?? 'main',
|
|
36
|
+
position: options?.navPosition ?? 6,
|
|
37
|
+
label: options?.navLabel ?? 'Automations',
|
|
38
|
+
route: '/automations',
|
|
39
|
+
icon: 'Zap',
|
|
40
|
+
permission: { feature: 'automations', action: 'read' as const },
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
routes: [
|
|
44
|
+
{
|
|
45
|
+
path: '/automations',
|
|
46
|
+
component: PageComponent,
|
|
47
|
+
permission: { feature: 'automations', action: 'read' as const },
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
widgets: [],
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Zap, Plus, Play, Pause, ArrowRight, Filter, Mail, Tag, MessageSquare, Clock } from 'lucide-react'
|
|
3
|
+
import { Button, PageHeaderActions } from '@fayz-ai/ui'
|
|
4
|
+
|
|
5
|
+
interface Workflow {
|
|
6
|
+
id: string
|
|
7
|
+
name: string
|
|
8
|
+
trigger: string
|
|
9
|
+
steps: Array<{ icon: React.ComponentType<{ className?: string }>; label: string }>
|
|
10
|
+
enrolled: number
|
|
11
|
+
active: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const WORKFLOWS: Workflow[] = [
|
|
15
|
+
{
|
|
16
|
+
id: '1', name: 'New lead → nurture', trigger: 'Form submitted', enrolled: 342, active: true,
|
|
17
|
+
steps: [
|
|
18
|
+
{ icon: MessageSquare, label: 'Send SMS' },
|
|
19
|
+
{ icon: Clock, label: 'Wait 1 day' },
|
|
20
|
+
{ icon: Mail, label: 'Send email' },
|
|
21
|
+
{ icon: Tag, label: 'Tag "nurtured"' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: '2', name: 'Missed call text-back', trigger: 'Call missed', enrolled: 128, active: true,
|
|
26
|
+
steps: [
|
|
27
|
+
{ icon: MessageSquare, label: 'Text back' },
|
|
28
|
+
{ icon: Tag, label: 'Create task' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: '3', name: 'Appointment reminder', trigger: 'Appointment booked', enrolled: 87, active: true,
|
|
33
|
+
steps: [
|
|
34
|
+
{ icon: Clock, label: 'Wait until 24h before' },
|
|
35
|
+
{ icon: MessageSquare, label: 'WhatsApp reminder' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: '4', name: 'Won deal → review request', trigger: 'Deal marked Won', enrolled: 41, active: false,
|
|
40
|
+
steps: [
|
|
41
|
+
{ icon: Clock, label: 'Wait 2 days' },
|
|
42
|
+
{ icon: Mail, label: 'Ask for review' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
function Stat({ label, value }: { label: string; value: string }) {
|
|
48
|
+
return (
|
|
49
|
+
<div className="rounded-card border border-border bg-card p-4">
|
|
50
|
+
<p className="text-xs font-medium text-muted-foreground">{label}</p>
|
|
51
|
+
<p className="mt-2 text-2xl font-semibold text-foreground">{value}</p>
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function AutomationsHome() {
|
|
57
|
+
return (
|
|
58
|
+
<div className="mx-auto max-w-6xl p-6">
|
|
59
|
+
<PageHeaderActions>
|
|
60
|
+
<Button><Plus className="mr-1.5 h-4 w-4" /> New workflow</Button>
|
|
61
|
+
</PageHeaderActions>
|
|
62
|
+
|
|
63
|
+
<div className="mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4">
|
|
64
|
+
<Stat label="Active workflows" value="3" />
|
|
65
|
+
<Stat label="Contacts enrolled" value="598" />
|
|
66
|
+
<Stat label="Actions run (30d)" value="2,140" />
|
|
67
|
+
<Stat label="Success rate" value="98.6%" />
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<div className="mt-6 space-y-3">
|
|
71
|
+
{WORKFLOWS.map((w) => (
|
|
72
|
+
<div key={w.id} className="rounded-card border border-border bg-card p-4">
|
|
73
|
+
<div className="flex items-center justify-between">
|
|
74
|
+
<div className="flex items-center gap-2.5">
|
|
75
|
+
<div className="flex h-9 w-9 items-center justify-center rounded-lg bg-amber-100 text-amber-600">
|
|
76
|
+
<Zap className="h-4 w-4" />
|
|
77
|
+
</div>
|
|
78
|
+
<div>
|
|
79
|
+
<p className="text-sm font-semibold text-foreground">{w.name}</p>
|
|
80
|
+
<p className="flex items-center gap-1 text-xs text-muted-foreground">
|
|
81
|
+
<Filter className="h-3 w-3" /> When: {w.trigger} · {w.enrolled} enrolled
|
|
82
|
+
</p>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div className="flex items-center gap-2">
|
|
86
|
+
<span className={`rounded-full px-2 py-0.5 text-xs font-medium ${w.active ? 'bg-emerald-100 text-emerald-700' : 'bg-muted text-muted-foreground'}`}>
|
|
87
|
+
{w.active ? 'Active' : 'Paused'}
|
|
88
|
+
</span>
|
|
89
|
+
<Button variant="outline" size="icon">{w.active ? <Pause className="h-4 w-4" /> : <Play className="h-4 w-4" />}</Button>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div className="mt-3 flex flex-wrap items-center gap-2 rounded-md bg-muted/40 p-3">
|
|
94
|
+
{w.steps.map((s, i) => (
|
|
95
|
+
<React.Fragment key={i}>
|
|
96
|
+
<span className="inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground">
|
|
97
|
+
<s.icon className="h-3.5 w-3.5 text-muted-foreground" /> {s.label}
|
|
98
|
+
</span>
|
|
99
|
+
{i < w.steps.length - 1 && <ArrowRight className="h-3.5 w-3.5 text-muted-foreground" />}
|
|
100
|
+
</React.Fragment>
|
|
101
|
+
))}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
))}
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<p className="mt-4 text-center text-xs text-muted-foreground">
|
|
108
|
+
Mock preview · the visual builder + execution engine (event bus, scheduler) ships in a later milestone.
|
|
109
|
+
</p>
|
|
110
|
+
</div>
|
|
111
|
+
)
|
|
112
|
+
}
|