truflow 0.0.191 → 0.0.193
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/dist/Classes/IRoute.d.ts +1 -1
- package/dist/IAutomation.d.ts +24 -1
- package/dist/IEmailTemplate.d.ts +47 -0
- package/dist/IEmailTemplate.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
- package/src/Classes/IRoute.ts +1 -1
- package/src/IAutomation.ts +29 -4
- package/src/IEmailTemplate.ts +26 -0
- package/src/index.ts +1 -0
package/dist/Classes/IRoute.d.ts
CHANGED
package/dist/IAutomation.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import mongoose, { Document } from "mongoose";
|
|
26
|
-
export type AutomationTriggerType = "order.created" | "order.updated" | "order.
|
|
26
|
+
export type AutomationTriggerType = "order.created" | "order.updated" | "order.statusChanged" | "schedule.entryAdded" | "schedule.fieldChanged" | "measurement.added" | "measurement.completed" | "walkthrough.submitted" | "walkthrough.arrived";
|
|
27
27
|
export type AutomationActionType = "webhook" | "email" | "notification" | "sms" | "slack" | "update_field" | "add_note";
|
|
28
28
|
export type AutomationConditionOperator = "equals" | "notEquals" | "contains" | "notContains" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "exists" | "notExists" | "in" | "notIn";
|
|
29
29
|
export interface IAutomationCondition {
|
|
@@ -69,6 +69,8 @@ export interface IAutomationEmailAction {
|
|
|
69
69
|
body: string;
|
|
70
70
|
cc?: string[];
|
|
71
71
|
bcc?: string[];
|
|
72
|
+
useTemplate?: boolean;
|
|
73
|
+
templateId?: string;
|
|
72
74
|
}
|
|
73
75
|
export interface IAutomationNotificationAction {
|
|
74
76
|
type: "notification";
|
|
@@ -169,6 +171,27 @@ export interface IAutomationContext {
|
|
|
169
171
|
oldValue: any;
|
|
170
172
|
newValue: any;
|
|
171
173
|
};
|
|
174
|
+
walkthrough?: {
|
|
175
|
+
id: string;
|
|
176
|
+
templateId: string;
|
|
177
|
+
templateName: string;
|
|
178
|
+
submittedBy: {
|
|
179
|
+
id: string;
|
|
180
|
+
firstName: string;
|
|
181
|
+
lastName: string;
|
|
182
|
+
email?: string;
|
|
183
|
+
};
|
|
184
|
+
submittedAt: string;
|
|
185
|
+
comments?: string;
|
|
186
|
+
fields: Array<{
|
|
187
|
+
fieldId: string;
|
|
188
|
+
label: string;
|
|
189
|
+
type: "number" | "yesno" | "comment";
|
|
190
|
+
value: any;
|
|
191
|
+
status?: string;
|
|
192
|
+
}>;
|
|
193
|
+
[key: string]: any;
|
|
194
|
+
};
|
|
172
195
|
triggeredBy?: {
|
|
173
196
|
userId?: string;
|
|
174
197
|
userName?: string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import { Document } from "mongoose";
|
|
26
|
+
export interface IEmailTemplateVariable {
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
description: string;
|
|
30
|
+
example?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ILeanEmailTemplate {
|
|
33
|
+
_id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
triggerType: string;
|
|
37
|
+
subject: string;
|
|
38
|
+
bodyHtml: string;
|
|
39
|
+
bodyText?: string;
|
|
40
|
+
isDefault: boolean;
|
|
41
|
+
isEditable: boolean;
|
|
42
|
+
variables: IEmailTemplateVariable[];
|
|
43
|
+
previewData?: any;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
updatedAt: Date;
|
|
46
|
+
}
|
|
47
|
+
export type IEmailTemplate = ILeanEmailTemplate & Document;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "truflow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.193",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/node": "^24.10.1",
|
|
24
24
|
"express": "^5.2.1",
|
|
25
25
|
"luxon": "^3.7.2",
|
|
26
|
-
"
|
|
26
|
+
"mongoose": "^9.1.4",
|
|
27
27
|
"typescript": "5.3.3"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/src/Classes/IRoute.ts
CHANGED
package/src/IAutomation.ts
CHANGED
|
@@ -4,11 +4,13 @@ import mongoose, { Document } from "mongoose";
|
|
|
4
4
|
export type AutomationTriggerType =
|
|
5
5
|
| "order.created" // When a new order is created
|
|
6
6
|
| "order.updated" // When an order is updated
|
|
7
|
-
| "order.
|
|
8
|
-
| "schedule.
|
|
9
|
-
| "schedule.
|
|
7
|
+
| "order.statusChanged" // When order status changes
|
|
8
|
+
| "schedule.entryAdded" // When order matches schedule filters and is added
|
|
9
|
+
| "schedule.fieldChanged" // When a custom schedule field value changes
|
|
10
10
|
| "measurement.added" // When a measurement is added to an order product
|
|
11
|
-
| "measurement.completed"
|
|
11
|
+
| "measurement.completed" // When all measurements are completed for an order
|
|
12
|
+
| "walkthrough.submitted" // When a walkthrough template is submitted
|
|
13
|
+
| "walkthrough.arrived"; // When a walkthrough template is submitted (alias for notifications)
|
|
12
14
|
|
|
13
15
|
// Action types that can be executed
|
|
14
16
|
export type AutomationActionType =
|
|
@@ -95,6 +97,8 @@ export interface IAutomationEmailAction {
|
|
|
95
97
|
body: string; // Email body (can use template variables)
|
|
96
98
|
cc?: string[]; // Optional CC addresses
|
|
97
99
|
bcc?: string[]; // Optional BCC addresses
|
|
100
|
+
useTemplate?: boolean; // Whether to use an email template
|
|
101
|
+
templateId?: string; // ID of the email template to use
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
// Notification action configuration
|
|
@@ -230,6 +234,27 @@ export interface IAutomationContext {
|
|
|
230
234
|
oldValue: any; // Previous value
|
|
231
235
|
newValue: any; // New value
|
|
232
236
|
};
|
|
237
|
+
walkthrough?: {
|
|
238
|
+
id: string; // Submission ID
|
|
239
|
+
templateId: string; // Template ID
|
|
240
|
+
templateName: string; // Template name
|
|
241
|
+
submittedBy: {
|
|
242
|
+
id: string;
|
|
243
|
+
firstName: string;
|
|
244
|
+
lastName: string;
|
|
245
|
+
email?: string;
|
|
246
|
+
};
|
|
247
|
+
submittedAt: string; // ISO date string
|
|
248
|
+
comments?: string; // Optional general comments
|
|
249
|
+
fields: Array<{ // All field values from the submission
|
|
250
|
+
fieldId: string;
|
|
251
|
+
label: string;
|
|
252
|
+
type: "number" | "yesno" | "comment";
|
|
253
|
+
value: any;
|
|
254
|
+
status?: string; // Buffer zone status if applicable
|
|
255
|
+
}>;
|
|
256
|
+
[key: string]: any; // Allow dynamic field access
|
|
257
|
+
};
|
|
233
258
|
triggeredBy?: {
|
|
234
259
|
userId?: string;
|
|
235
260
|
userName?: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import mongoose, { Document } from "mongoose";
|
|
2
|
+
|
|
3
|
+
export interface IEmailTemplateVariable {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description: string;
|
|
7
|
+
example?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ILeanEmailTemplate {
|
|
11
|
+
_id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
triggerType: string; // Single trigger type this template is for (e.g., "walkthrough.submitted", "order.created")
|
|
15
|
+
subject: string;
|
|
16
|
+
bodyHtml: string;
|
|
17
|
+
bodyText?: string; // Optional plain text version
|
|
18
|
+
isDefault: boolean; // Whether this is a system-provided default template
|
|
19
|
+
isEditable: boolean; // Whether users can edit this template
|
|
20
|
+
variables: IEmailTemplateVariable[]; // Available variables for this template
|
|
21
|
+
previewData?: any; // Sample data for preview
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type IEmailTemplate = ILeanEmailTemplate & Document;
|
package/src/index.ts
CHANGED