@dawntech/dwntbots-models 0.0.26 → 0.0.28
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/package.json +3 -3
- package/src/index.d.ts +3 -2
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/blip.d.ts +360 -0
- package/src/lib/blip.js +74 -0
- package/src/lib/blip.js.map +1 -0
- package/src/lib/vnd.d.ts +101 -10
- package/src/lib/vnd.js +9 -0
- package/src/lib/vnd.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dawntech/dwntbots-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"dependencies": {},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"lodash": "4.17.21",
|
|
27
|
-
"@dawntech/dwntbots-utils": "0.0.
|
|
27
|
+
"@dawntech/dwntbots-utils": "0.0.27",
|
|
28
28
|
"rxjs": "7.6.0",
|
|
29
|
-
"@dawntech/dwntbots-logger": "0.0.
|
|
29
|
+
"@dawntech/dwntbots-logger": "0.0.27",
|
|
30
30
|
"micromatch": "4.0.5",
|
|
31
31
|
"date-fns": "2.29.3",
|
|
32
32
|
"chalk": "4.1.2"
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./lib/dawntech";
|
|
2
|
+
export * from "./lib/vnd";
|
|
3
|
+
export * from "./lib/blip";
|
package/src/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./lib/dawntech"), exports);
|
|
18
18
|
__exportStar(require("./lib/vnd"), exports);
|
|
19
|
+
__exportStar(require("./lib/blip"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/models/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/models/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,4CAA0B;AAC1B,6CAA2B"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { Vnd } from "./vnd";
|
|
2
|
+
export declare namespace Builder {
|
|
3
|
+
type ID = string;
|
|
4
|
+
type Type = string;
|
|
5
|
+
type Position = "right" | "left";
|
|
6
|
+
type ConditionSource = "context" | "input";
|
|
7
|
+
type TypeOfStateId = "state" | "variable";
|
|
8
|
+
type TypeOfContent = "" | "chat-state" | "text" | "select-immediate" | "raw-content" | "web-link";
|
|
9
|
+
type MessageContentType = "SendMessage" | "SendRawMessage";
|
|
10
|
+
type InputValidationRule = "regex" | "date" | "text" | "number" | "type";
|
|
11
|
+
type BlockPosition = {
|
|
12
|
+
top: string;
|
|
13
|
+
left: string;
|
|
14
|
+
};
|
|
15
|
+
type Expiration = string;
|
|
16
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
17
|
+
type CommandMethod = "get" | "set" | "merge" | "delete" | "subscribe" | "unsubscribe" | "observe";
|
|
18
|
+
type CommandType = string;
|
|
19
|
+
type CommandFrom = string;
|
|
20
|
+
type CommandTo = string;
|
|
21
|
+
type ManageListAction = "Add" | "Remove";
|
|
22
|
+
type ConditionComparsion = "equals" | "notEquals" | "contains" | "greaterThanOrEquals" | "lessThanOrEquals" | "greaterThan" | "lessThan" | "matches" | "exists" | "notExists";
|
|
23
|
+
type CustomActionType = "ProcessHttp" | "TrackEvent" | "MergeContact" | "Redirect" | "ManageList" | "ExecuteScript" | "SetVariable" | "ProcessCommand" | "ForwardToDesk" | "LeavingFromDesk" | "ForwardMessageToDesk";
|
|
24
|
+
interface Tag {
|
|
25
|
+
background: string;
|
|
26
|
+
label: string;
|
|
27
|
+
id: ID;
|
|
28
|
+
canChangeBackground: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface Condition {
|
|
31
|
+
source: ConditionSource;
|
|
32
|
+
variable?: string;
|
|
33
|
+
comparison: ConditionComparsion;
|
|
34
|
+
values: Array<string>;
|
|
35
|
+
}
|
|
36
|
+
interface ConditionOutput {
|
|
37
|
+
$id: ID;
|
|
38
|
+
stateId: ID;
|
|
39
|
+
typeOfStateId: TypeOfStateId;
|
|
40
|
+
conditions: Array<Condition>;
|
|
41
|
+
$isDeskOutput?: boolean;
|
|
42
|
+
$isDeskCustomOutput?: boolean;
|
|
43
|
+
$isDeskDefaultOutput?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface InputValidation {
|
|
46
|
+
rule: InputValidationRule;
|
|
47
|
+
error: string;
|
|
48
|
+
regex?: string;
|
|
49
|
+
type: CommandType;
|
|
50
|
+
}
|
|
51
|
+
interface CardContent {
|
|
52
|
+
id: ID;
|
|
53
|
+
type: Type;
|
|
54
|
+
content: string | Object;
|
|
55
|
+
metadata: Record<string, string>;
|
|
56
|
+
}
|
|
57
|
+
interface RawContent {
|
|
58
|
+
id: ID;
|
|
59
|
+
type: Type;
|
|
60
|
+
rawContent: string;
|
|
61
|
+
metadata: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
interface InputContentActionPayload {
|
|
64
|
+
bypass: boolean;
|
|
65
|
+
conditions: Array<Condition>;
|
|
66
|
+
$cardContent: {
|
|
67
|
+
document: CardContent;
|
|
68
|
+
editable: boolean;
|
|
69
|
+
deletable: boolean;
|
|
70
|
+
position: Position;
|
|
71
|
+
};
|
|
72
|
+
expiration?: Expiration;
|
|
73
|
+
validation?: InputValidation;
|
|
74
|
+
variable?: string;
|
|
75
|
+
}
|
|
76
|
+
interface InputContentAction {
|
|
77
|
+
input: InputContentActionPayload;
|
|
78
|
+
}
|
|
79
|
+
interface MessageContentActionPayload {
|
|
80
|
+
$id: ID;
|
|
81
|
+
type: "SendMessage";
|
|
82
|
+
$typeOfContent: TypeOfContent;
|
|
83
|
+
conditions: Array<Condition>;
|
|
84
|
+
settings: CardContent;
|
|
85
|
+
$cardContent: {
|
|
86
|
+
document: CardContent;
|
|
87
|
+
editable: boolean;
|
|
88
|
+
deletable: boolean;
|
|
89
|
+
position: Position;
|
|
90
|
+
editing?: boolean;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
interface MessageContentAction {
|
|
94
|
+
action: MessageContentActionPayload;
|
|
95
|
+
}
|
|
96
|
+
interface RawMessageContentActionPayload {
|
|
97
|
+
$id: ID;
|
|
98
|
+
type: "SendRawMessage";
|
|
99
|
+
$typeOfContent: TypeOfContent;
|
|
100
|
+
conditions: Array<Condition>;
|
|
101
|
+
settings: RawContent;
|
|
102
|
+
}
|
|
103
|
+
interface RawMessageContentAction {
|
|
104
|
+
action: RawMessageContentActionPayload;
|
|
105
|
+
}
|
|
106
|
+
type ContentAction = InputContentAction | MessageContentAction | RawMessageContentAction;
|
|
107
|
+
interface CustomActionBuilder<T extends CustomActionType, S = {}> {
|
|
108
|
+
$id: ID;
|
|
109
|
+
$typeOfContent: TypeOfContent;
|
|
110
|
+
$title: string;
|
|
111
|
+
type: T;
|
|
112
|
+
conditions: Array<Condition>;
|
|
113
|
+
settings: S;
|
|
114
|
+
continueOnError?: boolean;
|
|
115
|
+
}
|
|
116
|
+
type ProcessHttpCustomAction = CustomActionBuilder<"ProcessHttp", {
|
|
117
|
+
method: HttpMethod;
|
|
118
|
+
uri: string;
|
|
119
|
+
headers: Record<string, string>;
|
|
120
|
+
body?: string;
|
|
121
|
+
responseStatusVariable: string;
|
|
122
|
+
responseBodyVariable: string;
|
|
123
|
+
}>;
|
|
124
|
+
type TrackEventCustomAction = CustomActionBuilder<"TrackEvent", {
|
|
125
|
+
category: string;
|
|
126
|
+
action: string;
|
|
127
|
+
extras: Record<string, string>;
|
|
128
|
+
}>;
|
|
129
|
+
type MergeContactCustomAction = CustomActionBuilder<"MergeContact", Partial<Vnd.Iris.Contact>>;
|
|
130
|
+
type RedirectCustomAction = CustomActionBuilder<"Redirect", {
|
|
131
|
+
context?: {
|
|
132
|
+
type: Type;
|
|
133
|
+
value: string;
|
|
134
|
+
};
|
|
135
|
+
address: string;
|
|
136
|
+
}>;
|
|
137
|
+
type ManageListCustomAction = CustomActionBuilder<"ManageList", {
|
|
138
|
+
listName: string;
|
|
139
|
+
action: ManageListAction;
|
|
140
|
+
}>;
|
|
141
|
+
type SetVariableCustomAction = CustomActionBuilder<"SetVariable", {
|
|
142
|
+
variable: string;
|
|
143
|
+
value: string;
|
|
144
|
+
}>;
|
|
145
|
+
type ExecuteScriptCustomAction = CustomActionBuilder<"ExecuteScript", {
|
|
146
|
+
function: string;
|
|
147
|
+
source: string;
|
|
148
|
+
inputVariables: Array<string>;
|
|
149
|
+
outputVariable: string;
|
|
150
|
+
LocalTimeZoneEnabled: boolean;
|
|
151
|
+
}>;
|
|
152
|
+
type ProcessCommandCustomAction = CustomActionBuilder<"ProcessCommand", {
|
|
153
|
+
from?: CommandFrom;
|
|
154
|
+
type?: CommandType;
|
|
155
|
+
to: CommandTo;
|
|
156
|
+
resource?: Object;
|
|
157
|
+
method: CommandMethod;
|
|
158
|
+
uri: string;
|
|
159
|
+
metadata: Record<string, any>;
|
|
160
|
+
variable?: string;
|
|
161
|
+
}>;
|
|
162
|
+
type ForwardToDeskAction = CustomActionBuilder<"ForwardToDesk", {}>;
|
|
163
|
+
type LeavingFromDeskAction = CustomActionBuilder<"LeavingFromDesk", {}>;
|
|
164
|
+
type ForwardMessageToDeskkAction = CustomActionBuilder<"ForwardMessageToDesk", {}>;
|
|
165
|
+
type CustomAction = ProcessHttpCustomAction | TrackEventCustomAction | MergeContactCustomAction | RedirectCustomAction | ManageListCustomAction | ExecuteScriptCustomAction | ProcessCommandCustomAction | SetVariableCustomAction | ForwardToDeskAction | LeavingFromDeskAction | ForwardMessageToDeskkAction;
|
|
166
|
+
function isCustomAction(action: CustomAction | ContentAction): action is CustomAction;
|
|
167
|
+
function isContentAction(action: CustomAction | ContentAction): action is ContentAction;
|
|
168
|
+
function isInputContentAction(action: ContentAction): action is InputContentAction;
|
|
169
|
+
function isMessageContentAction(action: ContentAction): action is MessageContentAction;
|
|
170
|
+
function isRawMessageContentAction(action: ContentAction): action is RawMessageContentAction;
|
|
171
|
+
interface Block {
|
|
172
|
+
id: ID;
|
|
173
|
+
$title: string;
|
|
174
|
+
$tags: Array<Tag>;
|
|
175
|
+
$contentActions: Array<ContentAction>;
|
|
176
|
+
$conditionOutputs: Array<ConditionOutput>;
|
|
177
|
+
$afterStateChangedActions?: Array<CustomAction>;
|
|
178
|
+
$enteringCustomActions: Array<CustomAction>;
|
|
179
|
+
$leavingCustomActions: Array<CustomAction>;
|
|
180
|
+
$inputSuggestions: Array<string>;
|
|
181
|
+
$defaultOutput: {
|
|
182
|
+
stateId: ID;
|
|
183
|
+
typeOfStateId?: TypeOfStateId;
|
|
184
|
+
};
|
|
185
|
+
$position: BlockPosition;
|
|
186
|
+
root: boolean;
|
|
187
|
+
}
|
|
188
|
+
type Flow = Record<ID, Block>;
|
|
189
|
+
type GlobalActions = Block;
|
|
190
|
+
type Configuration = Record<string, string>;
|
|
191
|
+
interface Bot {
|
|
192
|
+
flow: Flow;
|
|
193
|
+
globalActions: GlobalActions;
|
|
194
|
+
configuration: Configuration;
|
|
195
|
+
}
|
|
196
|
+
namespace Unsanitized {
|
|
197
|
+
interface Condition extends Partial<Builder.Condition> {
|
|
198
|
+
$$hashKey?: string;
|
|
199
|
+
}
|
|
200
|
+
interface ConditionOutput extends Partial<Builder.ConditionOutput> {
|
|
201
|
+
stateId: ID;
|
|
202
|
+
$invalid?: boolean;
|
|
203
|
+
$connId?: string;
|
|
204
|
+
$$hashKey?: string;
|
|
205
|
+
}
|
|
206
|
+
interface InputValidation extends Partial<Builder.InputValidation> {
|
|
207
|
+
}
|
|
208
|
+
interface CardContent extends Partial<Builder.CardContent> {
|
|
209
|
+
type: Type;
|
|
210
|
+
textContent?: string;
|
|
211
|
+
}
|
|
212
|
+
interface RawContent extends Partial<Builder.RawContent> {
|
|
213
|
+
type: Type;
|
|
214
|
+
rawContent: string;
|
|
215
|
+
}
|
|
216
|
+
interface InputContentActionPayload extends Partial<Omit<Builder.InputContentActionPayload, "$cardContent" | "validation">> {
|
|
217
|
+
bypass: boolean;
|
|
218
|
+
$cardContent: {
|
|
219
|
+
document: CardContent;
|
|
220
|
+
editable?: boolean;
|
|
221
|
+
deletable?: boolean;
|
|
222
|
+
position?: Position;
|
|
223
|
+
editing?: boolean;
|
|
224
|
+
};
|
|
225
|
+
validation?: InputValidation;
|
|
226
|
+
$invalid?: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface InputContentAction extends Omit<Builder.InputContentAction, "input"> {
|
|
229
|
+
input: InputContentActionPayload;
|
|
230
|
+
$invalid?: boolean;
|
|
231
|
+
$$hashKey?: string;
|
|
232
|
+
}
|
|
233
|
+
interface MessageContentActionPayload extends Partial<Omit<Builder.MessageContentActionPayload, "settings" | "$cardContent">> {
|
|
234
|
+
type: "SendMessage";
|
|
235
|
+
$cardContent: {
|
|
236
|
+
document: CardContent;
|
|
237
|
+
editable: boolean;
|
|
238
|
+
deletable: boolean;
|
|
239
|
+
position: Position;
|
|
240
|
+
editing?: boolean;
|
|
241
|
+
};
|
|
242
|
+
settings: CardContent;
|
|
243
|
+
}
|
|
244
|
+
interface MessageContentAction extends Partial<Omit<Builder.MessageContentAction, "action">> {
|
|
245
|
+
action: MessageContentActionPayload;
|
|
246
|
+
$invalid?: boolean;
|
|
247
|
+
$$hashKey?: string;
|
|
248
|
+
}
|
|
249
|
+
interface RawMessageContentActionPayload extends Partial<Omit<Builder.RawMessageContentActionPayload, "settings">> {
|
|
250
|
+
type: "SendRawMessage";
|
|
251
|
+
settings: RawContent;
|
|
252
|
+
}
|
|
253
|
+
interface RawMessageContentAction extends Partial<Omit<Builder.RawMessageContentAction, "action">> {
|
|
254
|
+
action: RawMessageContentActionPayload;
|
|
255
|
+
$invalid?: boolean;
|
|
256
|
+
$$hashKey?: string;
|
|
257
|
+
}
|
|
258
|
+
interface AnyMessageContentAction {
|
|
259
|
+
action: {
|
|
260
|
+
$id?: ID;
|
|
261
|
+
type: "SendRawMessage" | "SendMessage";
|
|
262
|
+
settings: RawContent | CardContent;
|
|
263
|
+
$cardContent?: {
|
|
264
|
+
document: CardContent;
|
|
265
|
+
editable: boolean;
|
|
266
|
+
deletable: boolean;
|
|
267
|
+
position: Position;
|
|
268
|
+
editing?: boolean;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
$invalid?: boolean;
|
|
272
|
+
$$hashKey?: string;
|
|
273
|
+
}
|
|
274
|
+
type ContentAction = InputContentAction | MessageContentAction | RawMessageContentAction | AnyMessageContentAction;
|
|
275
|
+
interface CustomActionBuilder<T extends CustomActionType, S = {}> {
|
|
276
|
+
type: T;
|
|
277
|
+
settings: S;
|
|
278
|
+
$id?: ID;
|
|
279
|
+
$typeOfContent?: TypeOfContent;
|
|
280
|
+
$title?: string;
|
|
281
|
+
$invalid?: boolean;
|
|
282
|
+
conditions?: Array<Condition>;
|
|
283
|
+
continueOnError?: boolean;
|
|
284
|
+
$$hashKey?: string;
|
|
285
|
+
}
|
|
286
|
+
type ProcessHttpCustomAction = CustomActionBuilder<"ProcessHttp", {
|
|
287
|
+
method?: HttpMethod;
|
|
288
|
+
uri: string;
|
|
289
|
+
headers?: Record<string, string>;
|
|
290
|
+
body?: string;
|
|
291
|
+
responseStatusVariable?: string;
|
|
292
|
+
responseBodyVariable?: string;
|
|
293
|
+
}>;
|
|
294
|
+
type TrackEventCustomAction = CustomActionBuilder<"TrackEvent", {
|
|
295
|
+
category: string;
|
|
296
|
+
action: string;
|
|
297
|
+
extras?: Record<string, string>;
|
|
298
|
+
}>;
|
|
299
|
+
type MergeContactCustomAction = CustomActionBuilder<"MergeContact", Partial<Vnd.Iris.Contact>>;
|
|
300
|
+
type RedirectCustomAction = CustomActionBuilder<"Redirect", {
|
|
301
|
+
context?: {
|
|
302
|
+
type: Type;
|
|
303
|
+
value: string;
|
|
304
|
+
};
|
|
305
|
+
address: string;
|
|
306
|
+
}>;
|
|
307
|
+
type ManageListCustomAction = CustomActionBuilder<"ManageList", {
|
|
308
|
+
listName: string;
|
|
309
|
+
action: ManageListAction;
|
|
310
|
+
}>;
|
|
311
|
+
type SetVariableCustomAction = CustomActionBuilder<"SetVariable", {
|
|
312
|
+
variable: string;
|
|
313
|
+
value: string;
|
|
314
|
+
$invalid?: boolean;
|
|
315
|
+
}>;
|
|
316
|
+
type ExecuteScriptCustomAction = CustomActionBuilder<"ExecuteScript", {
|
|
317
|
+
function: string;
|
|
318
|
+
source: string;
|
|
319
|
+
inputVariables: Array<string>;
|
|
320
|
+
outputVariable: string;
|
|
321
|
+
LocalTimeZoneEnabled?: boolean;
|
|
322
|
+
}>;
|
|
323
|
+
type ProcessCommandCustomAction = CustomActionBuilder<"ProcessCommand", {
|
|
324
|
+
from?: CommandFrom;
|
|
325
|
+
to: CommandTo;
|
|
326
|
+
type?: CommandType;
|
|
327
|
+
method?: CommandMethod;
|
|
328
|
+
uri: string;
|
|
329
|
+
variable: string;
|
|
330
|
+
resource?: Object;
|
|
331
|
+
metadata?: Record<string, any>;
|
|
332
|
+
}>;
|
|
333
|
+
type ForwardToDeskAction = CustomActionBuilder<"ForwardToDesk", {}>;
|
|
334
|
+
type LeavingFromDeskAction = CustomActionBuilder<"LeavingFromDesk", {}>;
|
|
335
|
+
type ForwardMessageToDeskkAction = CustomActionBuilder<"ForwardMessageToDesk", {}>;
|
|
336
|
+
type CustomAction = ProcessHttpCustomAction | TrackEventCustomAction | MergeContactCustomAction | RedirectCustomAction | ManageListCustomAction | ExecuteScriptCustomAction | ProcessCommandCustomAction | SetVariableCustomAction | ForwardToDeskAction | LeavingFromDeskAction | ForwardMessageToDeskkAction;
|
|
337
|
+
interface Block extends Omit<Partial<Builder.Block>, "$defaultOutput" | "$conditionOutputs" | "$contentActions" | "$enteringCustomActions" | "$leavingCustomActions"> {
|
|
338
|
+
$defaultOutput: {
|
|
339
|
+
stateId: ID;
|
|
340
|
+
typeOfStateId?: TypeOfStateId;
|
|
341
|
+
$invalid?: boolean;
|
|
342
|
+
};
|
|
343
|
+
$conditionOutputs: Array<ConditionOutput>;
|
|
344
|
+
$contentActions: Array<ContentAction>;
|
|
345
|
+
$enteringCustomActions: Array<CustomAction>;
|
|
346
|
+
$leavingCustomActions: Array<CustomAction>;
|
|
347
|
+
$invalidContentActions?: boolean;
|
|
348
|
+
$invalidOutputs?: boolean;
|
|
349
|
+
$invalidCustomActions?: boolean;
|
|
350
|
+
$invalid?: boolean;
|
|
351
|
+
deskStateVersion?: string;
|
|
352
|
+
}
|
|
353
|
+
type Flow = Record<ID, Block>;
|
|
354
|
+
function isCustomAction(action: CustomAction | ContentAction): action is CustomAction;
|
|
355
|
+
function isContentAction(action: CustomAction | ContentAction): action is ContentAction;
|
|
356
|
+
function isInputContentAction(action: ContentAction): action is InputContentAction;
|
|
357
|
+
function isMessageContentAction(action: ContentAction): action is MessageContentAction;
|
|
358
|
+
function isRawMessageContentAction(action: ContentAction): action is RawMessageContentAction;
|
|
359
|
+
}
|
|
360
|
+
}
|
package/src/lib/blip.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Builder = void 0;
|
|
4
|
+
var Builder;
|
|
5
|
+
(function (Builder) {
|
|
6
|
+
function isCustomAction(action) {
|
|
7
|
+
const props = Object.keys(action);
|
|
8
|
+
return !(props.length < 5 &&
|
|
9
|
+
(props.includes("action") || props.includes("input")));
|
|
10
|
+
}
|
|
11
|
+
Builder.isCustomAction = isCustomAction;
|
|
12
|
+
function isContentAction(action) {
|
|
13
|
+
const props = Object.keys(action);
|
|
14
|
+
return (props.length < 5 &&
|
|
15
|
+
(props.includes("action") || props.includes("input")));
|
|
16
|
+
}
|
|
17
|
+
Builder.isContentAction = isContentAction;
|
|
18
|
+
function isInputContentAction(action) {
|
|
19
|
+
return Object.keys(action).includes("input");
|
|
20
|
+
}
|
|
21
|
+
Builder.isInputContentAction = isInputContentAction;
|
|
22
|
+
function isMessageContentAction(action) {
|
|
23
|
+
if (Object.keys(action).includes("action")) {
|
|
24
|
+
const act = action;
|
|
25
|
+
return act.action.type === "SendMessage";
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
Builder.isMessageContentAction = isMessageContentAction;
|
|
30
|
+
function isRawMessageContentAction(action) {
|
|
31
|
+
if (Object.keys(action).includes("action")) {
|
|
32
|
+
const act = action;
|
|
33
|
+
return act.action.type === "SendRawMessage";
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
Builder.isRawMessageContentAction = isRawMessageContentAction;
|
|
38
|
+
let Unsanitized;
|
|
39
|
+
(function (Unsanitized) {
|
|
40
|
+
function isCustomAction(action) {
|
|
41
|
+
const props = Object.keys(action);
|
|
42
|
+
return !(props.length < 5 &&
|
|
43
|
+
(props.includes("action") || props.includes("input")));
|
|
44
|
+
}
|
|
45
|
+
Unsanitized.isCustomAction = isCustomAction;
|
|
46
|
+
function isContentAction(action) {
|
|
47
|
+
const props = Object.keys(action);
|
|
48
|
+
return (props.length < 5 &&
|
|
49
|
+
(props.includes("action") || props.includes("input")));
|
|
50
|
+
}
|
|
51
|
+
Unsanitized.isContentAction = isContentAction;
|
|
52
|
+
function isInputContentAction(action) {
|
|
53
|
+
return Object.keys(action).includes("input");
|
|
54
|
+
}
|
|
55
|
+
Unsanitized.isInputContentAction = isInputContentAction;
|
|
56
|
+
function isMessageContentAction(action) {
|
|
57
|
+
if (Object.keys(action).includes("action")) {
|
|
58
|
+
const act = action;
|
|
59
|
+
return act.action.type === "SendMessage";
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
Unsanitized.isMessageContentAction = isMessageContentAction;
|
|
64
|
+
function isRawMessageContentAction(action) {
|
|
65
|
+
if (Object.keys(action).includes("action")) {
|
|
66
|
+
const act = action;
|
|
67
|
+
return act.action.type === "SendRawMessage";
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
Unsanitized.isRawMessageContentAction = isRawMessageContentAction;
|
|
72
|
+
})(Unsanitized = Builder.Unsanitized || (Builder.Unsanitized = {}));
|
|
73
|
+
})(Builder = exports.Builder || (exports.Builder = {}));
|
|
74
|
+
//# sourceMappingURL=blip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blip.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/blip.ts"],"names":[],"mappings":";;;AAEA,IAAiB,OAAO,CA2pBvB;AA3pBD,WAAiB,OAAO;IAgRvB,SAAgB,cAAc,CAC7B,MAAoC;QAEpC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CAAC,CACP,KAAK,CAAC,MAAM,GAAG,CAAC;YAChB,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CACrD,CAAC;IACH,CAAC;IARe,sBAAc,iBAQ7B,CAAA;IAED,SAAgB,eAAe,CAC9B,MAAoC;QAEpC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CACN,KAAK,CAAC,MAAM,GAAG,CAAC;YAChB,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,C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ired, ISODate } from "@dawntech/dwntbots-utils/types";
|
|
2
2
|
export declare namespace Vnd {
|
|
3
3
|
enum ContenType {
|
|
4
4
|
UNKNOWN = "",
|
|
@@ -78,7 +78,9 @@ export declare namespace Vnd {
|
|
|
78
78
|
type Message<T = string> = PartiallyOptional<Lime.Message<T>, Lime.BaseProps>;
|
|
79
79
|
type Notification = PartiallyOptional<Lime.Notification, Lime.BaseProps>;
|
|
80
80
|
type Request<T = any> = PartiallyOptional<Lime.Command.Request<T>, Lime.BaseProps>;
|
|
81
|
-
type Response<T = any> = PartiallyOptional<Lime.Command.Response<T
|
|
81
|
+
type Response<T = any> = PartiallyOptional<Lime.Command.Response<T> & {
|
|
82
|
+
resource: T;
|
|
83
|
+
}, Lime.BaseProps>;
|
|
82
84
|
}
|
|
83
85
|
namespace WS {
|
|
84
86
|
type Metadata = Record<string, string>;
|
|
@@ -90,10 +92,10 @@ export declare namespace Vnd {
|
|
|
90
92
|
metadata?: Metadata;
|
|
91
93
|
channel: Channel;
|
|
92
94
|
}
|
|
93
|
-
type Message<T = string> =
|
|
94
|
-
type Notification =
|
|
95
|
-
type Request<T = any> =
|
|
96
|
-
type Response<T = any> =
|
|
95
|
+
type Message<T = string> = PartiallyRequired<Lime.Transport.Payload.Message<T>, "id"> & Base;
|
|
96
|
+
type Notification = PartiallyRequired<Lime.Transport.Payload.Notification, "id"> & Base;
|
|
97
|
+
type Request<T = any> = PartiallyRequired<Lime.Transport.Payload.Request<T>, "id"> & Base;
|
|
98
|
+
type Response<T = any> = PartiallyRequired<Lime.Transport.Payload.Response<T>, "id"> & PartiallyRequired<Base, "metadata">;
|
|
97
99
|
type Payload = Message<any> | Notification | Request<any> | Response<any>;
|
|
98
100
|
function isMessage(payload: Payload): payload is Message;
|
|
99
101
|
function isNotification(payload: Payload): payload is Notification;
|
|
@@ -101,10 +103,10 @@ export declare namespace Vnd {
|
|
|
101
103
|
function isResponse(payload: Payload): payload is Response;
|
|
102
104
|
}
|
|
103
105
|
namespace HTTP {
|
|
104
|
-
type Notification =
|
|
105
|
-
type Message<T = string> =
|
|
106
|
-
type Request<T = any> =
|
|
107
|
-
type Response<T = any> =
|
|
106
|
+
type Notification = Lime.Transport.Payload.Notification;
|
|
107
|
+
type Message<T = string> = Lime.Transport.Payload.Message<T>;
|
|
108
|
+
type Request<T = any> = Lime.Transport.Payload.Request<T>;
|
|
109
|
+
type Response<T = any> = Lime.Transport.Payload.Response<T>;
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -199,6 +201,95 @@ export declare namespace Vnd {
|
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
203
|
namespace WhatsApp {
|
|
204
|
+
export namespace Template {
|
|
205
|
+
enum Language {
|
|
206
|
+
pt_BR = "pt_BR",
|
|
207
|
+
en_US = "en_US",
|
|
208
|
+
es = "es"
|
|
209
|
+
}
|
|
210
|
+
namespace Definition {
|
|
211
|
+
namespace Component {
|
|
212
|
+
interface Button {
|
|
213
|
+
type: "QUICK_REPLY" | "PHONE_NUMBER" | "URL";
|
|
214
|
+
text: string;
|
|
215
|
+
phoneNumber?: string;
|
|
216
|
+
url?: string;
|
|
217
|
+
example?: Array<string>;
|
|
218
|
+
}
|
|
219
|
+
interface Buttons {
|
|
220
|
+
type: "BUTTONS";
|
|
221
|
+
buttons: Array<Button>;
|
|
222
|
+
}
|
|
223
|
+
interface Body {
|
|
224
|
+
type: "BODY";
|
|
225
|
+
text: string;
|
|
226
|
+
example?: {
|
|
227
|
+
body_text: Array<string>;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
interface Header {
|
|
231
|
+
type: "HEADER";
|
|
232
|
+
format: "VIDEO" | "IMAGE" | "DOCUMENT";
|
|
233
|
+
example?: {
|
|
234
|
+
header_handle: string;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
interface Footer {
|
|
238
|
+
type: "FOOTER";
|
|
239
|
+
text: string;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
type Components = Component.Header | Component.Body | Component.Buttons | Component.Footer;
|
|
243
|
+
interface Payload {
|
|
244
|
+
id: string;
|
|
245
|
+
name: string;
|
|
246
|
+
category: string;
|
|
247
|
+
language: Language;
|
|
248
|
+
components: Array<Components>;
|
|
249
|
+
last_updated_time: ISODate.String;
|
|
250
|
+
rejected_reason: "NONE" | "TO_BE_FILLED";
|
|
251
|
+
status: "APPROVED" | "REJECTED" | "TO_BE_FILLED";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
namespace Message {
|
|
255
|
+
namespace Component {
|
|
256
|
+
export namespace Parameter {
|
|
257
|
+
interface Text {
|
|
258
|
+
type: "text";
|
|
259
|
+
text: string;
|
|
260
|
+
}
|
|
261
|
+
interface Video {
|
|
262
|
+
type: "video";
|
|
263
|
+
video: {
|
|
264
|
+
link: string;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
export type Parameters = Parameter.Text | Parameter.Video;
|
|
269
|
+
interface Component<R, S> {
|
|
270
|
+
type: R;
|
|
271
|
+
parameters: Array<S>;
|
|
272
|
+
}
|
|
273
|
+
export type Body = Component<"body", Parameter.Text>;
|
|
274
|
+
export type Buttons = Component<"buttons", Parameter.Text>;
|
|
275
|
+
export type Header = Component<"header", Parameter.Video>;
|
|
276
|
+
export {};
|
|
277
|
+
}
|
|
278
|
+
type Components = Component.Body | Component.Buttons | Component.Header;
|
|
279
|
+
interface Payload {
|
|
280
|
+
name: string;
|
|
281
|
+
language: {
|
|
282
|
+
policy: "deterministic" | "to_be_filled";
|
|
283
|
+
code: Language;
|
|
284
|
+
};
|
|
285
|
+
components: Array<Components>;
|
|
286
|
+
}
|
|
287
|
+
interface Content {
|
|
288
|
+
type: "template";
|
|
289
|
+
template: Payload;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
202
293
|
export interface ProductItem {
|
|
203
294
|
product_retailer_id: string;
|
|
204
295
|
}
|
package/src/lib/vnd.js
CHANGED
|
@@ -70,6 +70,15 @@ var Vnd;
|
|
|
70
70
|
})(Lime = Vnd.Lime || (Vnd.Lime = {}));
|
|
71
71
|
let WhatsApp;
|
|
72
72
|
(function (WhatsApp) {
|
|
73
|
+
let Template;
|
|
74
|
+
(function (Template) {
|
|
75
|
+
let Language;
|
|
76
|
+
(function (Language) {
|
|
77
|
+
Language["pt_BR"] = "pt_BR";
|
|
78
|
+
Language["en_US"] = "en_US";
|
|
79
|
+
Language["es"] = "es";
|
|
80
|
+
})(Language = Template.Language || (Template.Language = {}));
|
|
81
|
+
})(Template = WhatsApp.Template || (WhatsApp.Template = {}));
|
|
73
82
|
let InteractiveType;
|
|
74
83
|
(function (InteractiveType) {
|
|
75
84
|
InteractiveType["PRODUCT_LIST"] = "product_list";
|
package/src/lib/vnd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vnd.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/vnd.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;
|
|
1
|
+
{"version":3,"file":"vnd.js","sourceRoot":"","sources":["../../../../../libs/models/src/lib/vnd.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAO7B,IAAiB,GAAG,CA2fnB;AA3fD,WAAiB,GAAG;IACnB,IAAY,UASX;IATD,WAAY,UAAU;QACrB,0BAAY,CAAA;QACZ,uCAAyB,CAAA;QACzB,uCAAyB,CAAA;QACzB,kEAAoD,CAAA;QACpD,kEAAoD,CAAA;QACpD,oEAAsD,CAAA;QACtD,uEAAyD,CAAA;QACzD,sEAAwD,CAAA;IACzD,CAAC,EATW,UAAU,GAAV,cAAU,KAAV,cAAU,QASrB;IAOD,IAAiB,IAAI,CA8KpB;IA9KD,WAAiB,IAAI;QAQpB,IAAY,MAIX;QAJD,WAAY,MAAM;YACjB,qBAAW,CAAA;YACX,qBAAW,CAAA;YACX,yBAAe,CAAA;QAChB,CAAC,EAJW,MAAM,GAAN,WAAM,KAAN,WAAM,QAIjB;QAED,I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