@webuildbots/webuildbots-sdk 9.1.1 → 9.2.1

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.
@@ -0,0 +1,8 @@
1
+ import { RulesLogic } from 'json-logic-js';
2
+ import BlockBuilder from './block-builder';
3
+ export default class LogicBB extends BlockBuilder {
4
+ constructor();
5
+ formId(formId: string): this;
6
+ defaultMappingBlockId(blockId: string): this;
7
+ condition(condition: RulesLogic, blockId: string): this;
8
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ var block_enums_1 = require("../../const/block-enums");
20
+ var block_builder_1 = __importDefault(require("./block-builder"));
21
+ var LogicBB = /** @class */ (function (_super) {
22
+ __extends(LogicBB, _super);
23
+ function LogicBB() {
24
+ var _this = _super.call(this) || this;
25
+ _this.block.type = block_enums_1.BlockTypes.FUNCTION;
26
+ _this.block.function = {};
27
+ _this.block.function.type = block_enums_1.FunctionTypes.LOGIC_BLOCK;
28
+ _this.block.function.logic = { expressions: [] };
29
+ return _this;
30
+ }
31
+ LogicBB.prototype.formId = function (formId) {
32
+ this.block.function.logic.formId = formId;
33
+ return this;
34
+ };
35
+ LogicBB.prototype.defaultMappingBlockId = function (blockId) {
36
+ this.block.function.logic.defaultMappingBlockId = blockId;
37
+ return this;
38
+ };
39
+ LogicBB.prototype.condition = function (condition, blockId) {
40
+ this.block.function.logic.expressions.push({ condition: condition, blockId: blockId });
41
+ return this;
42
+ };
43
+ return LogicBB;
44
+ }(block_builder_1.default));
45
+ exports.default = LogicBB;
@@ -12,14 +12,14 @@ var ResponseBuilder = /** @class */ (function () {
12
12
  ResponseBuilder.prototype.pushBlock = function (block) {
13
13
  this.resp.botResponse.push({
14
14
  type: __1.ResponseUnitType.BLOCK,
15
- block: block instanceof block_builder_1.default ? block.build() : block,
15
+ block: block instanceof block_builder_1.default ? block.build() : block
16
16
  });
17
17
  return this;
18
18
  };
19
19
  ResponseBuilder.prototype.pushBlockPointer = function (blockPointer) {
20
20
  this.resp.botResponse.push({
21
21
  type: __1.ResponseUnitType.BLOCK_POINTER,
22
- blockPointer: blockPointer,
22
+ blockPointer: blockPointer
23
23
  });
24
24
  return this;
25
25
  };
@@ -42,5 +42,6 @@ export declare enum VoiceAction {
42
42
  }
43
43
  export declare enum FunctionTypes {
44
44
  EMAIL_FORM_AS_TABLE = "email-form-as-table",
45
- UNSET_FORM = "unset-form"
45
+ UNSET_FORM = "unset-form",
46
+ LOGIC_BLOCK = "logic-block"
46
47
  }
@@ -55,4 +55,5 @@ var FunctionTypes;
55
55
  (function (FunctionTypes) {
56
56
  FunctionTypes["EMAIL_FORM_AS_TABLE"] = "email-form-as-table";
57
57
  FunctionTypes["UNSET_FORM"] = "unset-form";
58
+ FunctionTypes["LOGIC_BLOCK"] = "logic-block";
58
59
  })(FunctionTypes = exports.FunctionTypes || (exports.FunctionTypes = {}));
package/lib/index.d.ts CHANGED
@@ -21,4 +21,5 @@ import ItemBuilder from './builder/item-builder';
21
21
  import DefinedIB from './builder/defined-ib';
22
22
  import ResponseBuilder from './builder/response-builder';
23
23
  import { WebhookRequest, WebhookResponse, ResponseUnitType, ResponseUnit, BlockPointer, Client, JWTPayload } from './interfaces/webhook';
24
- export { BlockBuilder, ComplexBB, FunctionBB, EmailFormTableBB, UnsetFormBB, ImageBB, SelectBB, TextBB, VideoBB, DevSwitchBB, BlockCB, ChoiceBuilder, DefinedCB, DefinedIB, ExtensionCB, LocationCB, PhoneCB, UrlCB, GalleryBB, BasicBB, ItemBuilder, WebhookResponse, WebhookRequest, ResponseUnit, ResponseUnitType, BlockPointer, ResponseBuilder, Client, JWTPayload };
24
+ import LogicBB from './builder/block/logic-bb';
25
+ export { BlockBuilder, ComplexBB, FunctionBB, EmailFormTableBB, UnsetFormBB, ImageBB, SelectBB, TextBB, VideoBB, DevSwitchBB, LogicBB, BlockCB, ChoiceBuilder, DefinedCB, DefinedIB, ExtensionCB, LocationCB, PhoneCB, UrlCB, GalleryBB, BasicBB, ItemBuilder, WebhookResponse, WebhookRequest, ResponseUnit, ResponseUnitType, BlockPointer, ResponseBuilder, Client, JWTPayload };
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ResponseBuilder = exports.ResponseUnitType = exports.ItemBuilder = exports.BasicBB = exports.GalleryBB = exports.UrlCB = exports.PhoneCB = exports.LocationCB = exports.ExtensionCB = exports.DefinedIB = exports.DefinedCB = exports.ChoiceBuilder = exports.BlockCB = exports.DevSwitchBB = exports.VideoBB = exports.TextBB = exports.SelectBB = exports.ImageBB = exports.UnsetFormBB = exports.EmailFormTableBB = exports.FunctionBB = exports.ComplexBB = exports.BlockBuilder = void 0;
6
+ exports.ResponseBuilder = exports.ResponseUnitType = exports.ItemBuilder = exports.BasicBB = exports.GalleryBB = exports.UrlCB = exports.PhoneCB = exports.LocationCB = exports.ExtensionCB = exports.DefinedIB = exports.DefinedCB = exports.ChoiceBuilder = exports.BlockCB = exports.LogicBB = exports.DevSwitchBB = exports.VideoBB = exports.TextBB = exports.SelectBB = exports.ImageBB = exports.UnsetFormBB = exports.EmailFormTableBB = exports.FunctionBB = exports.ComplexBB = exports.BlockBuilder = void 0;
7
7
  var block_builder_1 = __importDefault(require("./builder/block/block-builder"));
8
8
  exports.BlockBuilder = block_builder_1.default;
9
9
  var basic_bb_1 = __importDefault(require("./builder/block/basic-bb"));
@@ -50,3 +50,5 @@ var response_builder_1 = __importDefault(require("./builder/response-builder"));
50
50
  exports.ResponseBuilder = response_builder_1.default;
51
51
  var webhook_1 = require("./interfaces/webhook");
52
52
  Object.defineProperty(exports, "ResponseUnitType", { enumerable: true, get: function () { return webhook_1.ResponseUnitType; } });
53
+ var logic_bb_1 = __importDefault(require("./builder/block/logic-bb"));
54
+ exports.LogicBB = logic_bb_1.default;
@@ -1,5 +1,7 @@
1
1
  export default interface Block {
2
+ _id?: any;
2
3
  version: number;
4
+ clientDbId?: any;
3
5
  created: Date;
4
6
  deleted?: boolean;
5
7
  delay?: number;
@@ -10,6 +12,7 @@ export default interface Block {
10
12
  next?: string;
11
13
  onReply?: {
12
14
  blockId: string;
15
+ module?: string;
13
16
  args?: any;
14
17
  };
15
18
  formFieldCallback?: {
@@ -71,11 +74,12 @@ export default interface Block {
71
74
  value?: any;
72
75
  };
73
76
  profile?: any;
77
+ formValue?: string;
74
78
  userStatus?: string;
75
- formField?: boolean;
76
79
  session?: any;
77
80
  functionArgs?: any;
78
81
  persistentMenu?: boolean;
82
+ next?: string;
79
83
  selectBlock?: {
80
84
  id: string;
81
85
  };
@@ -95,26 +99,57 @@ export default interface Block {
95
99
  value?: any;
96
100
  };
97
101
  profile?: any;
102
+ formValue?: string;
98
103
  userStatus?: string;
99
- formField?: boolean;
100
104
  session?: any;
101
105
  functionArgs?: any;
102
106
  persistentMenu?: boolean;
107
+ next?: string;
103
108
  selectBlock?: {
104
109
  id: string;
105
110
  };
106
111
  };
112
+ serialized?: string;
107
113
  }>;
108
114
  };
109
115
  function?: {
110
116
  name?: string;
111
117
  handlerName?: string;
112
118
  type?: string;
119
+ logic?: {
120
+ formId: string;
121
+ defaultMappingBlockId: string;
122
+ expressions?: Array<{
123
+ condition: any;
124
+ blockId: string;
125
+ }>;
126
+ };
113
127
  emailFormAsTable?: {
114
128
  toEmail: string;
115
129
  fromEmail?: string;
116
130
  subject: string;
117
131
  };
132
+ argosLabsExecuteScenario?: {
133
+ apiScenarioId: string;
134
+ apiPamId: string;
135
+ botParameters?: any;
136
+ startedMessage: {
137
+ any?: string;
138
+ en?: string;
139
+ nl?: string;
140
+ cy?: string;
141
+ it?: string;
142
+ de?: string;
143
+ };
144
+ finishedMessage: {
145
+ any?: string;
146
+ en?: string;
147
+ nl?: string;
148
+ cy?: string;
149
+ it?: string;
150
+ de?: string;
151
+ };
152
+ };
118
153
  args: any;
119
154
  formId?: string;
120
155
  todo?: boolean;
@@ -141,11 +176,12 @@ export default interface Block {
141
176
  value?: any;
142
177
  };
143
178
  profile?: any;
179
+ formValue?: string;
144
180
  userStatus?: string;
145
- formField?: boolean;
146
181
  session?: any;
147
182
  functionArgs?: any;
148
183
  persistentMenu?: boolean;
184
+ next?: string;
149
185
  selectBlock?: {
150
186
  id: string;
151
187
  };
@@ -171,5 +207,4 @@ export default interface Block {
171
207
  jovoFollowUpState?: string;
172
208
  alexaPermissionRequired?: string;
173
209
  };
174
- _id?: any;
175
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webuildbots/webuildbots-sdk",
3
- "version": "9.1.1",
3
+ "version": "9.2.1",
4
4
  "description": "webuildbots sdk",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -52,6 +52,7 @@
52
52
  "typescript": "^4.0.3"
53
53
  },
54
54
  "dependencies": {
55
+ "@types/json-logic-js": "^1.2.1",
55
56
  "bson-objectid": "^1.3.1",
56
57
  "deep-equal": "^2.0.4",
57
58
  "flatted": "^3.1.0",
@@ -60,4 +61,4 @@
60
61
  "md5": "^2.3.0",
61
62
  "wbb-logger": "^1.1.0"
62
63
  }
63
- }
64
+ }