@botonic/plugin-flow-builder 0.57.0 → 0.57.1-alpha.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/lib/cjs/content-fields/flow-contact-reasons-conditional.d.ts +4 -1
- package/lib/cjs/content-fields/flow-contact-reasons-conditional.js +27 -4
- package/lib/cjs/content-fields/flow-contact-reasons-conditional.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/contact-reasons-conditional.d.ts +4 -1
- package/lib/esm/content-fields/flow-contact-reasons-conditional.d.ts +4 -1
- package/lib/esm/content-fields/flow-contact-reasons-conditional.js +27 -4
- package/lib/esm/content-fields/flow-contact-reasons-conditional.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/contact-reasons-conditional.d.ts +4 -1
- package/package.json +1 -1
- package/src/content-fields/flow-contact-reasons-conditional.tsx +34 -5
- package/src/content-fields/hubtype-fields/contact-reasons-conditional.ts +4 -1
|
@@ -5,7 +5,10 @@ import type { HtContactReasonBranch, HtContactReasonsNode } from './hubtype-fiel
|
|
|
5
5
|
export declare class FlowContactReasonsConditional extends ContentFieldsBase {
|
|
6
6
|
contactReasons: HtContactReasonBranch[];
|
|
7
7
|
conditionalResult: string;
|
|
8
|
-
defaultTarget
|
|
8
|
+
defaultTarget?: HtNodeLink;
|
|
9
|
+
splitDefault: boolean;
|
|
10
|
+
anyContactReasonTarget?: HtNodeLink;
|
|
11
|
+
noContactReasonTarget?: HtNodeLink;
|
|
9
12
|
static fromHubtypeCMS(component: HtContactReasonsNode, botContext: BotContext): FlowContactReasonsConditional;
|
|
10
13
|
private setFollowUp;
|
|
11
14
|
trackFlow(botContext: BotContext): Promise<void>;
|
|
@@ -6,11 +6,18 @@ const core_1 = require("@botonic/core");
|
|
|
6
6
|
const tracking_1 = require("../tracking");
|
|
7
7
|
const contact_reasons_conditional_matcher_1 = require("./contact-reasons-conditional-matcher");
|
|
8
8
|
const content_fields_base_1 = require("./content-fields-base");
|
|
9
|
+
var ConditionalResult;
|
|
10
|
+
(function (ConditionalResult) {
|
|
11
|
+
ConditionalResult["AnyContactReason"] = "any_contact_reason";
|
|
12
|
+
ConditionalResult["NoContactReason"] = "no_contact_reason";
|
|
13
|
+
ConditionalResult["Default"] = "default";
|
|
14
|
+
})(ConditionalResult || (ConditionalResult = {}));
|
|
9
15
|
class FlowContactReasonsConditional extends content_fields_base_1.ContentFieldsBase {
|
|
10
16
|
constructor() {
|
|
11
17
|
super(...arguments);
|
|
12
18
|
this.contactReasons = [];
|
|
13
19
|
this.conditionalResult = '';
|
|
20
|
+
this.splitDefault = false;
|
|
14
21
|
}
|
|
15
22
|
static fromHubtypeCMS(component, botContext) {
|
|
16
23
|
const newContactReasonsConditional = new FlowContactReasonsConditional(component.id);
|
|
@@ -18,22 +25,38 @@ class FlowContactReasonsConditional extends content_fields_base_1.ContentFieldsB
|
|
|
18
25
|
component.content.contact_reasons;
|
|
19
26
|
newContactReasonsConditional.defaultTarget =
|
|
20
27
|
component.content.default_target;
|
|
28
|
+
newContactReasonsConditional.splitDefault =
|
|
29
|
+
component.content.split_default ?? false;
|
|
30
|
+
newContactReasonsConditional.anyContactReasonTarget =
|
|
31
|
+
component.content.any_contact_reason_target;
|
|
32
|
+
newContactReasonsConditional.noContactReasonTarget =
|
|
33
|
+
component.content.no_contact_reason_target;
|
|
21
34
|
newContactReasonsConditional.setFollowUp(botContext);
|
|
22
35
|
return newContactReasonsConditional;
|
|
23
36
|
}
|
|
24
37
|
setFollowUp(botContext) {
|
|
25
38
|
const sessionContactReasons = botContext.session._hubtype_case_contact_reasons;
|
|
26
|
-
const matchingBranch = sessionContactReasons
|
|
39
|
+
const matchingBranch = sessionContactReasons?.length
|
|
27
40
|
? (0, contact_reasons_conditional_matcher_1.findMatchingContactReasonBranch)(sessionContactReasons, this.contactReasons)
|
|
28
41
|
: undefined;
|
|
29
42
|
if (matchingBranch) {
|
|
30
43
|
this.conditionalResult = matchingBranch.name;
|
|
31
44
|
this.followUp = matchingBranch.target;
|
|
45
|
+
return;
|
|
32
46
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
if (this.splitDefault) {
|
|
48
|
+
const hasSessionContactReasons = (sessionContactReasons?.length ?? 0) > 0;
|
|
49
|
+
if (hasSessionContactReasons) {
|
|
50
|
+
this.conditionalResult = ConditionalResult.AnyContactReason;
|
|
51
|
+
this.followUp = this.anyContactReasonTarget;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.conditionalResult = ConditionalResult.NoContactReason;
|
|
55
|
+
this.followUp = this.noContactReasonTarget;
|
|
56
|
+
return;
|
|
36
57
|
}
|
|
58
|
+
this.conditionalResult = ConditionalResult.Default;
|
|
59
|
+
this.followUp = this.defaultTarget;
|
|
37
60
|
}
|
|
38
61
|
async trackFlow(botContext) {
|
|
39
62
|
const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = (0, tracking_1.getCommonFlowContentEventArgsForContentId)(botContext, this.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-contact-reasons-conditional.js","sourceRoot":"","sources":["../../../src/content-fields/flow-contact-reasons-conditional.tsx"],"names":[],"mappings":";;;;AAAA,wCAIsB;AAEtB,0CAGoB;AACpB,+FAAuF;AACvF,+DAAyD;AAOzD,MAAa,6BAA8B,SAAQ,uCAAiB;IAApE;;QACS,mBAAc,GAA4B,EAAE,CAAA;QAC5C,sBAAiB,GAAW,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-contact-reasons-conditional.js","sourceRoot":"","sources":["../../../src/content-fields/flow-contact-reasons-conditional.tsx"],"names":[],"mappings":";;;;AAAA,wCAIsB;AAEtB,0CAGoB;AACpB,+FAAuF;AACvF,+DAAyD;AAOzD,IAAK,iBAIJ;AAJD,WAAK,iBAAiB;IACpB,4DAAuC,CAAA;IACvC,0DAAqC,CAAA;IACrC,wCAAmB,CAAA;AACrB,CAAC,EAJI,iBAAiB,KAAjB,iBAAi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,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QAC1C,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QAChC,OAAM;IACR,CAAC;IAED,SAAS;QACP,OAAO,kDAAK,CAAA;IACd,CAAC;CACF;AA9FD,sEA8FC"}
|
|
@@ -11,6 +11,9 @@ export interface HtContactReasonsNode extends HtBaseNode {
|
|
|
11
11
|
type: HtNodeWithContentType.CONTACT_REASONS_CONDITION;
|
|
12
12
|
content: {
|
|
13
13
|
contact_reasons: HtContactReasonBranch[];
|
|
14
|
-
|
|
14
|
+
split_default?: boolean;
|
|
15
|
+
default_target?: HtNodeLink;
|
|
16
|
+
any_contact_reason_target?: HtNodeLink;
|
|
17
|
+
no_contact_reason_target?: HtNodeLink;
|
|
15
18
|
};
|
|
16
19
|
}
|
|
@@ -5,7 +5,10 @@ import type { HtContactReasonBranch, HtContactReasonsNode } from './hubtype-fiel
|
|
|
5
5
|
export declare class FlowContactReasonsConditional extends ContentFieldsBase {
|
|
6
6
|
contactReasons: HtContactReasonBranch[];
|
|
7
7
|
conditionalResult: string;
|
|
8
|
-
defaultTarget
|
|
8
|
+
defaultTarget?: HtNodeLink;
|
|
9
|
+
splitDefault: boolean;
|
|
10
|
+
anyContactReasonTarget?: HtNodeLink;
|
|
11
|
+
noContactReasonTarget?: HtNodeLink;
|
|
9
12
|
static fromHubtypeCMS(component: HtContactReasonsNode, botContext: BotContext): FlowContactReasonsConditional;
|
|
10
13
|
private setFollowUp;
|
|
11
14
|
trackFlow(botContext: BotContext): Promise<void>;
|
|
@@ -6,11 +6,18 @@ const core_1 = require("@botonic/core");
|
|
|
6
6
|
const tracking_1 = require("../tracking");
|
|
7
7
|
const contact_reasons_conditional_matcher_1 = require("./contact-reasons-conditional-matcher");
|
|
8
8
|
const content_fields_base_1 = require("./content-fields-base");
|
|
9
|
+
var ConditionalResult;
|
|
10
|
+
(function (ConditionalResult) {
|
|
11
|
+
ConditionalResult["AnyContactReason"] = "any_contact_reason";
|
|
12
|
+
ConditionalResult["NoContactReason"] = "no_contact_reason";
|
|
13
|
+
ConditionalResult["Default"] = "default";
|
|
14
|
+
})(ConditionalResult || (ConditionalResult = {}));
|
|
9
15
|
class FlowContactReasonsConditional extends content_fields_base_1.ContentFieldsBase {
|
|
10
16
|
constructor() {
|
|
11
17
|
super(...arguments);
|
|
12
18
|
this.contactReasons = [];
|
|
13
19
|
this.conditionalResult = '';
|
|
20
|
+
this.splitDefault = false;
|
|
14
21
|
}
|
|
15
22
|
static fromHubtypeCMS(component, botContext) {
|
|
16
23
|
const newContactReasonsConditional = new FlowContactReasonsConditional(component.id);
|
|
@@ -18,22 +25,38 @@ class FlowContactReasonsConditional extends content_fields_base_1.ContentFieldsB
|
|
|
18
25
|
component.content.contact_reasons;
|
|
19
26
|
newContactReasonsConditional.defaultTarget =
|
|
20
27
|
component.content.default_target;
|
|
28
|
+
newContactReasonsConditional.splitDefault =
|
|
29
|
+
component.content.split_default ?? false;
|
|
30
|
+
newContactReasonsConditional.anyContactReasonTarget =
|
|
31
|
+
component.content.any_contact_reason_target;
|
|
32
|
+
newContactReasonsConditional.noContactReasonTarget =
|
|
33
|
+
component.content.no_contact_reason_target;
|
|
21
34
|
newContactReasonsConditional.setFollowUp(botContext);
|
|
22
35
|
return newContactReasonsConditional;
|
|
23
36
|
}
|
|
24
37
|
setFollowUp(botContext) {
|
|
25
38
|
const sessionContactReasons = botContext.session._hubtype_case_contact_reasons;
|
|
26
|
-
const matchingBranch = sessionContactReasons
|
|
39
|
+
const matchingBranch = sessionContactReasons?.length
|
|
27
40
|
? (0, contact_reasons_conditional_matcher_1.findMatchingContactReasonBranch)(sessionContactReasons, this.contactReasons)
|
|
28
41
|
: undefined;
|
|
29
42
|
if (matchingBranch) {
|
|
30
43
|
this.conditionalResult = matchingBranch.name;
|
|
31
44
|
this.followUp = matchingBranch.target;
|
|
45
|
+
return;
|
|
32
46
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
if (this.splitDefault) {
|
|
48
|
+
const hasSessionContactReasons = (sessionContactReasons?.length ?? 0) > 0;
|
|
49
|
+
if (hasSessionContactReasons) {
|
|
50
|
+
this.conditionalResult = ConditionalResult.AnyContactReason;
|
|
51
|
+
this.followUp = this.anyContactReasonTarget;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.conditionalResult = ConditionalResult.NoContactReason;
|
|
55
|
+
this.followUp = this.noContactReasonTarget;
|
|
56
|
+
return;
|
|
36
57
|
}
|
|
58
|
+
this.conditionalResult = ConditionalResult.Default;
|
|
59
|
+
this.followUp = this.defaultTarget;
|
|
37
60
|
}
|
|
38
61
|
async trackFlow(botContext) {
|
|
39
62
|
const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = (0, tracking_1.getCommonFlowContentEventArgsForContentId)(botContext, this.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-contact-reasons-conditional.js","sourceRoot":"","sources":["../../../src/content-fields/flow-contact-reasons-conditional.tsx"],"names":[],"mappings":";;;;AAAA,wCAIsB;AAEtB,0CAGoB;AACpB,+FAAuF;AACvF,+DAAyD;AAOzD,MAAa,6BAA8B,SAAQ,uCAAiB;IAApE;;QACS,mBAAc,GAA4B,EAAE,CAAA;QAC5C,sBAAiB,GAAW,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-contact-reasons-conditional.js","sourceRoot":"","sources":["../../../src/content-fields/flow-contact-reasons-conditional.tsx"],"names":[],"mappings":";;;;AAAA,wCAIsB;AAEtB,0CAGoB;AACpB,+FAAuF;AACvF,+DAAyD;AAOzD,IAAK,iBAIJ;AAJD,WAAK,iBAAiB;IACpB,4DAAuC,CAAA;IACvC,0DAAqC,CAAA;IACrC,wCAAmB,CAAA;AACrB,CAAC,EAJI,iBAAiB,KAAjB,iBAAiB,QAIrB;AAED,MAAa,6BAA8B,SAAQ,uCAAiB;IAApE;;QACS,mBAAc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AC1C,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QAChC,OAAM;IACR,CAAC;IAED,SAAS;QACP,OAAO,kDAAK,CAAA;IACd,CAAC;CACF;AA9FD,sEA8FC"}
|
|
@@ -11,6 +11,9 @@ export interface HtContactReasonsNode extends HtBaseNode {
|
|
|
11
11
|
type: HtNodeWithContentType.CONTACT_REASONS_CONDITION;
|
|
12
12
|
content: {
|
|
13
13
|
contact_reasons: HtContactReasonBranch[];
|
|
14
|
-
|
|
14
|
+
split_default?: boolean;
|
|
15
|
+
default_target?: HtNodeLink;
|
|
16
|
+
any_contact_reason_target?: HtNodeLink;
|
|
17
|
+
no_contact_reason_target?: HtNodeLink;
|
|
15
18
|
};
|
|
16
19
|
}
|
package/package.json
CHANGED
|
@@ -16,10 +16,19 @@ import type {
|
|
|
16
16
|
HtContactReasonsNode,
|
|
17
17
|
} from './hubtype-fields/contact-reasons-conditional'
|
|
18
18
|
|
|
19
|
+
enum ConditionalResult {
|
|
20
|
+
AnyContactReason = 'any_contact_reason',
|
|
21
|
+
NoContactReason = 'no_contact_reason',
|
|
22
|
+
Default = 'default',
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
export class FlowContactReasonsConditional extends ContentFieldsBase {
|
|
20
26
|
public contactReasons: HtContactReasonBranch[] = []
|
|
21
27
|
public conditionalResult: string = ''
|
|
22
|
-
public defaultTarget
|
|
28
|
+
public defaultTarget?: HtNodeLink
|
|
29
|
+
public splitDefault = false
|
|
30
|
+
public anyContactReasonTarget?: HtNodeLink
|
|
31
|
+
public noContactReasonTarget?: HtNodeLink
|
|
23
32
|
|
|
24
33
|
static fromHubtypeCMS(
|
|
25
34
|
component: HtContactReasonsNode,
|
|
@@ -32,6 +41,12 @@ export class FlowContactReasonsConditional extends ContentFieldsBase {
|
|
|
32
41
|
component.content.contact_reasons
|
|
33
42
|
newContactReasonsConditional.defaultTarget =
|
|
34
43
|
component.content.default_target
|
|
44
|
+
newContactReasonsConditional.splitDefault =
|
|
45
|
+
component.content.split_default ?? false
|
|
46
|
+
newContactReasonsConditional.anyContactReasonTarget =
|
|
47
|
+
component.content.any_contact_reason_target
|
|
48
|
+
newContactReasonsConditional.noContactReasonTarget =
|
|
49
|
+
component.content.no_contact_reason_target
|
|
35
50
|
newContactReasonsConditional.setFollowUp(botContext)
|
|
36
51
|
return newContactReasonsConditional
|
|
37
52
|
}
|
|
@@ -40,7 +55,7 @@ export class FlowContactReasonsConditional extends ContentFieldsBase {
|
|
|
40
55
|
const sessionContactReasons =
|
|
41
56
|
botContext.session._hubtype_case_contact_reasons
|
|
42
57
|
|
|
43
|
-
const matchingBranch = sessionContactReasons
|
|
58
|
+
const matchingBranch = sessionContactReasons?.length
|
|
44
59
|
? findMatchingContactReasonBranch(
|
|
45
60
|
sessionContactReasons,
|
|
46
61
|
this.contactReasons
|
|
@@ -50,10 +65,24 @@ export class FlowContactReasonsConditional extends ContentFieldsBase {
|
|
|
50
65
|
if (matchingBranch) {
|
|
51
66
|
this.conditionalResult = matchingBranch.name
|
|
52
67
|
this.followUp = matchingBranch.target
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (this.splitDefault) {
|
|
72
|
+
const hasSessionContactReasons = (sessionContactReasons?.length ?? 0) > 0
|
|
73
|
+
if (hasSessionContactReasons) {
|
|
74
|
+
this.conditionalResult = ConditionalResult.AnyContactReason
|
|
75
|
+
this.followUp = this.anyContactReasonTarget
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.conditionalResult = ConditionalResult.NoContactReason
|
|
80
|
+
this.followUp = this.noContactReasonTarget
|
|
81
|
+
return
|
|
56
82
|
}
|
|
83
|
+
|
|
84
|
+
this.conditionalResult = ConditionalResult.Default
|
|
85
|
+
this.followUp = this.defaultTarget
|
|
57
86
|
}
|
|
58
87
|
|
|
59
88
|
async trackFlow(botContext: BotContext): Promise<void> {
|
|
@@ -13,6 +13,9 @@ export interface HtContactReasonsNode extends HtBaseNode {
|
|
|
13
13
|
type: HtNodeWithContentType.CONTACT_REASONS_CONDITION
|
|
14
14
|
content: {
|
|
15
15
|
contact_reasons: HtContactReasonBranch[]
|
|
16
|
-
|
|
16
|
+
split_default?: boolean
|
|
17
|
+
default_target?: HtNodeLink
|
|
18
|
+
any_contact_reason_target?: HtNodeLink
|
|
19
|
+
no_contact_reason_target?: HtNodeLink
|
|
17
20
|
}
|
|
18
21
|
}
|