@botonic/plugin-flow-builder 0.58.0-alpha.0 → 0.58.0-alpha.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.
- package/lib/cjs/action/first-interaction.js +1 -1
- package/lib/cjs/action/first-interaction.js.map +1 -1
- package/lib/cjs/action/get-contents.d.ts +2 -3
- package/lib/cjs/action/get-contents.js +6 -13
- package/lib/cjs/action/get-contents.js.map +1 -1
- package/lib/cjs/action/index.d.ts +0 -2
- package/lib/cjs/action/index.js +6 -16
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/action/payload.d.ts +2 -2
- package/lib/cjs/action/payload.js +28 -12
- package/lib/cjs/action/payload.js.map +1 -1
- package/lib/cjs/api.d.ts +1 -1
- package/lib/cjs/api.js +2 -7
- package/lib/cjs/api.js.map +1 -1
- package/lib/cjs/content-fields/flow-do-nothing.js +1 -1
- package/lib/cjs/content-fields/flow-do-nothing.js.map +1 -1
- package/lib/cjs/content-fields/flow-update-variables.d.ts +15 -0
- package/lib/cjs/content-fields/flow-update-variables.js +137 -0
- package/lib/cjs/content-fields/flow-update-variables.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +2 -1
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/cjs/content-fields/hubtype-fields/update-variables.d.ts +9 -0
- package/lib/{esm/action/contents-result.js → cjs/content-fields/hubtype-fields/update-variables.js} +1 -1
- package/lib/cjs/content-fields/hubtype-fields/update-variables.js.map +1 -0
- package/lib/cjs/content-fields/index.d.ts +3 -2
- package/lib/cjs/content-fields/index.js +3 -1
- package/lib/cjs/content-fields/index.js.map +1 -1
- package/lib/cjs/flow-factory.js +2 -0
- package/lib/cjs/flow-factory.js.map +1 -1
- package/lib/cjs/services/contact-info-fields-api.d.ts +7 -0
- package/lib/cjs/services/contact-info-fields-api.js +28 -0
- package/lib/cjs/services/contact-info-fields-api.js.map +1 -0
- package/lib/esm/action/first-interaction.js +1 -1
- package/lib/esm/action/first-interaction.js.map +1 -1
- package/lib/esm/action/get-contents.d.ts +2 -3
- package/lib/esm/action/get-contents.js +6 -13
- package/lib/esm/action/get-contents.js.map +1 -1
- package/lib/esm/action/index.d.ts +0 -2
- package/lib/esm/action/index.js +6 -16
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/action/payload.d.ts +2 -2
- package/lib/esm/action/payload.js +28 -12
- package/lib/esm/action/payload.js.map +1 -1
- package/lib/esm/api.d.ts +1 -1
- package/lib/esm/api.js +2 -7
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/content-fields/flow-do-nothing.js +1 -1
- package/lib/esm/content-fields/flow-do-nothing.js.map +1 -1
- package/lib/esm/content-fields/flow-update-variables.d.ts +15 -0
- package/lib/esm/content-fields/flow-update-variables.js +137 -0
- package/lib/esm/content-fields/flow-update-variables.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +2 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/esm/content-fields/hubtype-fields/update-variables.d.ts +9 -0
- package/lib/{cjs/action/contents-result.js → esm/content-fields/hubtype-fields/update-variables.js} +1 -1
- package/lib/esm/content-fields/hubtype-fields/update-variables.js.map +1 -0
- package/lib/esm/content-fields/index.d.ts +3 -2
- package/lib/esm/content-fields/index.js +3 -1
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/flow-factory.js +2 -0
- package/lib/esm/flow-factory.js.map +1 -1
- package/lib/esm/services/contact-info-fields-api.d.ts +7 -0
- package/lib/esm/services/contact-info-fields-api.js +28 -0
- package/lib/esm/services/contact-info-fields-api.js.map +1 -0
- package/package.json +2 -2
- package/src/action/first-interaction.ts +6 -7
- package/src/action/get-contents.ts +8 -17
- package/src/action/index.tsx +6 -40
- package/src/action/payload.ts +46 -16
- package/src/api.ts +3 -13
- package/src/content-fields/flow-do-nothing.tsx +1 -1
- package/src/content-fields/flow-update-variables.tsx +182 -0
- package/src/content-fields/hubtype-fields/node-types.ts +1 -0
- package/src/content-fields/hubtype-fields/nodes.ts +2 -0
- package/src/content-fields/hubtype-fields/update-variables.ts +10 -0
- package/src/content-fields/index.ts +3 -0
- package/src/flow-factory.ts +7 -0
- package/src/services/contact-info-fields-api.ts +36 -0
- package/lib/cjs/action/contents-result.d.ts +0 -5
- package/lib/cjs/action/contents-result.js.map +0 -1
- package/lib/cjs/action/push-flow-resolver.d.ts +0 -22
- package/lib/cjs/action/push-flow-resolver.js +0 -66
- package/lib/cjs/action/push-flow-resolver.js.map +0 -1
- package/lib/esm/action/contents-result.d.ts +0 -5
- package/lib/esm/action/contents-result.js.map +0 -1
- package/lib/esm/action/push-flow-resolver.d.ts +0 -22
- package/lib/esm/action/push-flow-resolver.js +0 -66
- package/lib/esm/action/push-flow-resolver.js.map +0 -1
- package/src/action/contents-result.ts +0 -6
- package/src/action/push-flow-resolver.ts +0 -101
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-update-variables.js","sourceRoot":"","sources":["../../../src/content-fields/flow-update-variables.tsx"],"names":[],"mappings":";;;;AAAA,wCAKsB;AAEtB,4CAAwD;AACxD,iFAA6E;AAC7E,0CAGoB;AACpB,8EAAuE;AACvE,+DAAyD;AAGzD,MAAM,2BAA2B,GAAG,4BAA4B,CAAA;AAEhE,MAAa,mBAAoB,SAAQ,uCAAiB;IAA1D;;QACS,iBAAY,GAA8C,EAAE,CAAA;QAC5D,mBAAc,GAAa,EAAE,CAAA;IAgKtC,CAAC;IA9JC,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,kBAAyC,EACzC,UAAsB;QAEtB,MAAM,kBAAkB,GAAG,IAAI,mBAAmB,CAAC,kBAAkB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ING = "do-nothing",
|
|
24
|
-
CONTACT_REASONS_CONDITION = "contact-reasons-condition"
|
|
24
|
+
CONTACT_REASONS_CONDITION = "contact-reasons-condition",
|
|
25
|
+
UPDATE_VARIABLES = "update-variables"
|
|
25
26
|
}
|
|
26
27
|
export declare enum HtNodeWithoutContentType {
|
|
27
28
|
URL = "url",
|
|
@@ -26,6 +26,7 @@ var HtNodeWithContentType;
|
|
|
26
26
|
HtNodeWithContentType["CUSTOM_CONDITION"] = "custom-condition";
|
|
27
27
|
HtNodeWithContentType["DO_NOTHING"] = "do-nothing";
|
|
28
28
|
HtNodeWithContentType["CONTACT_REASONS_CONDITION"] = "contact-reasons-condition";
|
|
29
|
+
HtNodeWithContentType["UPDATE_VARIABLES"] = "update-variables";
|
|
29
30
|
})(HtNodeWithContentType || (exports.HtNodeWithContentType = HtNodeWithContentType = {}));
|
|
30
31
|
var HtNodeWithoutContentType;
|
|
31
32
|
(function (HtNodeWithoutContentType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAyBX;AAzBD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,wCAAe,CAAA;IACf,sCAAa,CAAA;IACb,4CAAmB,CAAA;IACnB,sDAA6B,CAAA;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,sEAA6C,CAAA;IAC7C,4EAAmD,CAAA;IACnD,wFAA+D,CAAA;IAC/D,gEAAuC,CAAA;IACvC,kDAAyB,CAAA;IACzB,8CAAqB,CAAA;IACrB,4DAAmC,CAAA;IACnC,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;IACnB,kDAAyB,CAAA;IACzB,kEAAyC,CAAA;IACzC,8DAAqC,CAAA;IACrC,kDAAyB,CAAA;IACzB,gFAAuD,CAAA;IACvD,8DAAqC,CAAA;AACvC,CAAC,EAzBW,qBAAqB,qCAArB,qBAAqB,QAyBhC;AAED,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,uCAAW,CAAA;IACX,+CAAmB,CAAA;AACrB,CAAC,EAHW,wBAAwB,wCAAxB,wBAAwB,QAGnC;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;AAC7B,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"}
|
|
@@ -16,6 +16,7 @@ import type { HtPayloadNode } from './payload';
|
|
|
16
16
|
import type { HtRatingNode } from './rating';
|
|
17
17
|
import type { HtSmartIntentNode } from './smart-intent';
|
|
18
18
|
import type { HtTextNode } from './text';
|
|
19
|
+
import type { HtUpdateVariablesNode } from './update-variables';
|
|
19
20
|
import type { HtUrlNode } from './url';
|
|
20
21
|
import type { HtVideoNode } from './video';
|
|
21
22
|
import type { HtWebviewNode } from './webview';
|
|
@@ -23,6 +24,6 @@ import type { HtWhatsappButtonListNode } from './whatsapp-button-list';
|
|
|
23
24
|
import type { HtWhatsappCTAUrlButtonNode } from './whatsapp-cta-url-button';
|
|
24
25
|
import type { HtWhatsappRequestContactInfoNode } from './whatsapp-request-contact-info';
|
|
25
26
|
import type { HtWhatsappTemplateNode } from './whatsapp-template';
|
|
26
|
-
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode | HtWhatsappCTAUrlButtonNode | HtWhatsappRequestContactInfoNode | HtSmartIntentNode | HtBotActionNode | HtAiAgentNode | HtAiAgentRouterNode | HtRatingNode | HtWebviewNode | HtGoToFlow | HtWhatsappTemplateNode | HtCaptureUserInputNode | HtCustomConditionalV2Node | HtDoNothingNode | HtContactReasonsNode;
|
|
27
|
+
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode | HtWhatsappCTAUrlButtonNode | HtWhatsappRequestContactInfoNode | HtSmartIntentNode | HtBotActionNode | HtAiAgentNode | HtAiAgentRouterNode | HtRatingNode | HtWebviewNode | HtGoToFlow | HtWhatsappTemplateNode | HtCaptureUserInputNode | HtCustomConditionalV2Node | HtDoNothingNode | HtContactReasonsNode | HtUpdateVariablesNode;
|
|
27
28
|
export type HtNodeWithoutContent = HtUrlNode | HtPayloadNode;
|
|
28
29
|
export type HtNodeComponent = HtNodeWithContent | HtNodeWithoutContent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HtBaseNode } from './common';
|
|
2
|
+
import type { HtNodeWithContentType } from './node-types';
|
|
3
|
+
export interface HtUpdateVariablesNode extends HtBaseNode {
|
|
4
|
+
type: HtNodeWithContentType.UPDATE_VARIABLES;
|
|
5
|
+
content: {
|
|
6
|
+
set_variables: Record<string, string | number | boolean>;
|
|
7
|
+
unset_variables: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-variables.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/update-variables.ts"],"names":[],"mappings":""}
|
|
@@ -15,6 +15,7 @@ import { FlowImage } from './flow-image';
|
|
|
15
15
|
import { FlowQueueStatusConditional } from './flow-queue-status-conditional';
|
|
16
16
|
import { FlowRating } from './flow-rating';
|
|
17
17
|
import { FlowText } from './flow-text';
|
|
18
|
+
import { FlowUpdateVariables } from './flow-update-variables';
|
|
18
19
|
import { FlowVideo } from './flow-video';
|
|
19
20
|
import { FlowWhatsappCtaUrlButtonNode } from './flow-whatsapp-cta-url-button';
|
|
20
21
|
import { FlowWhatsappRequestContactInfoNode } from './flow-whatsapp-request-contact-info';
|
|
@@ -23,5 +24,5 @@ import { FlowWhatsappButtonList, FlowWhatsappButtonListRow, FlowWhatsappButtonLi
|
|
|
23
24
|
export { ContentFieldsBase } from './content-fields-base';
|
|
24
25
|
export { FlowButton } from './flow-button';
|
|
25
26
|
export { FlowElement } from './flow-element';
|
|
26
|
-
export { FlowAiAgent, FlowAiAgentRouter, FlowBotAction, FlowCaptureUserInput, FlowCarousel, FlowChannelConditional, FlowContactReasonsConditional, FlowCountryConditional, FlowCustomConditional, FlowCustomConditionalV2, FlowDoNothing, FlowGoToFlow, FlowHandoff, FlowImage, FlowQueueStatusConditional, FlowRating, FlowText, FlowVideo, FlowWhatsappButtonList, FlowWhatsappButtonListRow, FlowWhatsappButtonListSection, FlowWhatsappCtaUrlButtonNode, FlowWhatsappRequestContactInfoNode, FlowWhatsappTemplate, };
|
|
27
|
-
export type FlowContent = FlowCarousel | FlowImage | FlowText | FlowVideo | FlowWhatsappButtonList | FlowWhatsappCtaUrlButtonNode | FlowWhatsappRequestContactInfoNode | FlowWhatsappTemplate | FlowHandoff | FlowBotAction | FlowAiAgent | FlowRating | FlowCountryConditional | FlowChannelConditional | FlowQueueStatusConditional | FlowCustomConditional | FlowGoToFlow | FlowCaptureUserInput | FlowAiAgentRouter | FlowCustomConditionalV2 | FlowDoNothing | FlowContactReasonsConditional;
|
|
27
|
+
export { FlowAiAgent, FlowAiAgentRouter, FlowBotAction, FlowCaptureUserInput, FlowCarousel, FlowChannelConditional, FlowContactReasonsConditional, FlowCountryConditional, FlowCustomConditional, FlowCustomConditionalV2, FlowDoNothing, FlowGoToFlow, FlowHandoff, FlowImage, FlowQueueStatusConditional, FlowRating, FlowText, FlowUpdateVariables, FlowVideo, FlowWhatsappButtonList, FlowWhatsappButtonListRow, FlowWhatsappButtonListSection, FlowWhatsappCtaUrlButtonNode, FlowWhatsappRequestContactInfoNode, FlowWhatsappTemplate, };
|
|
28
|
+
export type FlowContent = FlowCarousel | FlowImage | FlowText | FlowVideo | FlowWhatsappButtonList | FlowWhatsappCtaUrlButtonNode | FlowWhatsappRequestContactInfoNode | FlowWhatsappTemplate | FlowHandoff | FlowBotAction | FlowAiAgent | FlowRating | FlowCountryConditional | FlowChannelConditional | FlowQueueStatusConditional | FlowCustomConditional | FlowGoToFlow | FlowCaptureUserInput | FlowAiAgentRouter | FlowCustomConditionalV2 | FlowDoNothing | FlowUpdateVariables | FlowContactReasonsConditional;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowWhatsappTemplate = exports.FlowWhatsappRequestContactInfoNode = exports.FlowWhatsappCtaUrlButtonNode = exports.FlowWhatsappButtonListSection = exports.FlowWhatsappButtonListRow = exports.FlowWhatsappButtonList = exports.FlowVideo = exports.FlowText = exports.FlowRating = exports.FlowQueueStatusConditional = exports.FlowImage = exports.FlowHandoff = exports.FlowGoToFlow = exports.FlowDoNothing = exports.FlowCustomConditionalV2 = exports.FlowCustomConditional = exports.FlowCountryConditional = exports.FlowContactReasonsConditional = exports.FlowChannelConditional = exports.FlowCarousel = exports.FlowCaptureUserInput = exports.FlowBotAction = exports.FlowAiAgentRouter = exports.FlowAiAgent = exports.FlowElement = exports.FlowButton = exports.ContentFieldsBase = void 0;
|
|
3
|
+
exports.FlowWhatsappTemplate = exports.FlowWhatsappRequestContactInfoNode = exports.FlowWhatsappCtaUrlButtonNode = exports.FlowWhatsappButtonListSection = exports.FlowWhatsappButtonListRow = exports.FlowWhatsappButtonList = exports.FlowVideo = exports.FlowUpdateVariables = exports.FlowText = exports.FlowRating = exports.FlowQueueStatusConditional = exports.FlowImage = exports.FlowHandoff = exports.FlowGoToFlow = exports.FlowDoNothing = exports.FlowCustomConditionalV2 = exports.FlowCustomConditional = exports.FlowCountryConditional = exports.FlowContactReasonsConditional = exports.FlowChannelConditional = exports.FlowCarousel = exports.FlowCaptureUserInput = exports.FlowBotAction = exports.FlowAiAgentRouter = exports.FlowAiAgent = exports.FlowElement = exports.FlowButton = exports.ContentFieldsBase = void 0;
|
|
4
4
|
const flow_custom_condition_v2_1 = require("./custom-conditional/flow-custom-condition-v2");
|
|
5
5
|
Object.defineProperty(exports, "FlowCustomConditionalV2", { enumerable: true, get: function () { return flow_custom_condition_v2_1.FlowCustomConditionalV2; } });
|
|
6
6
|
const flow_ai_agent_1 = require("./flow-ai-agent");
|
|
@@ -35,6 +35,8 @@ const flow_rating_1 = require("./flow-rating");
|
|
|
35
35
|
Object.defineProperty(exports, "FlowRating", { enumerable: true, get: function () { return flow_rating_1.FlowRating; } });
|
|
36
36
|
const flow_text_1 = require("./flow-text");
|
|
37
37
|
Object.defineProperty(exports, "FlowText", { enumerable: true, get: function () { return flow_text_1.FlowText; } });
|
|
38
|
+
const flow_update_variables_1 = require("./flow-update-variables");
|
|
39
|
+
Object.defineProperty(exports, "FlowUpdateVariables", { enumerable: true, get: function () { return flow_update_variables_1.FlowUpdateVariables; } });
|
|
38
40
|
const flow_video_1 = require("./flow-video");
|
|
39
41
|
Object.defineProperty(exports, "FlowVideo", { enumerable: true, get: function () { return flow_video_1.FlowVideo; } });
|
|
40
42
|
const flow_whatsapp_cta_url_button_1 = require("./flow-whatsapp-cta-url-button");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,4FAAuF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,4FAAuF;AAyCrF,wGAzCO,kDAAuB,OAyCP;AAxCzB,mDAA6C;AA+B3C,4FA/BO,2BAAW,OA+BP;AA9Bb,iEAA0D;AA+BxD,kGA/BO,wCAAiB,OA+BP;AA9BnB,uDAAiD;AA+B/C,8FA/BO,+BAAa,OA+BP;AA9Bf,uEAAgE;AA+B9D,qGA/BO,8CAAoB,OA+BP;AA9BtB,mDAA8C;AA+B5C,6FA/BO,4BAAY,OA+BP;AA9Bd,yEAAmE;AA+BjE,uGA/BO,iDAAsB,OA+BP;AA9BxB,yFAAkF;AA+BhF,8GA/BO,gEAA6B,OA+BP;AA9B/B,yEAAmE;AA+BjE,uGA/BO,iDAAsB,OA+BP;AA9BxB,uEAAiE;AA+B/D,sGA/BO,+CAAqB,OA+BP;AA9BvB,uDAAiD;AAgC/C,8FAhCO,+BAAa,OAgCP;AA/Bf,uDAAgD;AAgC9C,6FAhCO,8BAAY,OAgCP;AA/Bd,iDAA4C;AAgC1C,4FAhCO,0BAAW,OAgCP;AA/Bb,6CAAwC;AAgCtC,0FAhCO,sBAAS,OAgCP;AA/BX,mFAA4E;AAgC1E,2GAhCO,0DAA0B,OAgCP;AA/B5B,+CAA0C;AAgCxC,2FAhCO,wBAAU,OAgCP;AA/BZ,2CAAsC;AAgCpC,yFAhCO,oBAAQ,OAgCP;AA/BV,mEAA6D;AAgC3D,oGAhCO,2CAAmB,OAgCP;AA/BrB,6CAAwC;AAgCtC,0FAhCO,sBAAS,OAgCP;AA/BX,iFAA6E;AAmC3E,6GAnCO,2DAA4B,OAmCP;AAlC9B,6FAAyF;AAmCvF,mHAnCO,uEAAkC,OAmCP;AAlCpC,qEAA+D;AAmC7D,qGAnCO,6CAAoB,OAmCP;AAlCtB,iEAI+B;AAyB7B,uGA5BA,6CAAsB,OA4BA;AACtB,0GA5BA,gDAAyB,OA4BA;AACzB,8GA5BA,oDAA6B,OA4BA;AAzB/B,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AACnB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA"}
|
package/lib/esm/flow-factory.js
CHANGED
|
@@ -48,6 +48,8 @@ class FlowFactory {
|
|
|
48
48
|
return content_fields_1.FlowCustomConditionalV2.fromHubtypeCMS(hubtypeContent, this.botContext);
|
|
49
49
|
case hubtype_fields_1.HtNodeWithContentType.DO_NOTHING:
|
|
50
50
|
return content_fields_1.FlowDoNothing.fromHubtypeCMS(hubtypeContent);
|
|
51
|
+
case hubtype_fields_1.HtNodeWithContentType.UPDATE_VARIABLES:
|
|
52
|
+
return content_fields_1.FlowUpdateVariables.fromHubtypeCMS(hubtypeContent, this.botContext);
|
|
51
53
|
case hubtype_fields_1.HtNodeWithContentType.CONTACT_REASONS_CONDITION:
|
|
52
54
|
return content_fields_1.FlowContactReasonsConditional.fromHubtypeCMS(hubtypeContent, this.botContext);
|
|
53
55
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-factory.js","sourceRoot":"","sources":["../../src/flow-factory.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"flow-factory.js","sourceRoot":"","sources":["../../src/flow-factory.ts"],"names":[],"mappings":";;;AAGA,qDAwByB;AACzB,sFAA+E;AAC/E,oEAIwC;AAExC,MAAa,WAAW;IAKtB,YAAY,UAAsB,EAAE,MAAsB,EAAE,MAAc;QACxE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,cAA+B;QAE/B,QAAQ,cAAc,CAAC,IAAI,EAAE,CAAC;YAC5B,KAAK,sCAAqB,CAAC,IAAI;gBAC7B,OAAO,yBAAQ,CAAC,cAAc,CAC5B,cAAc,EACd,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU,CAChB,CAAA;YACH,KAAK,sCAAqB,CAAC,KAAK;gBAC9B,OAAO,0BAAS,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;YAC9D,KAAK,sCAAqB,CAAC,QAAQ;gBACjC,OAAO,6BAAY,CAAC,cAAc,CAChC,cAAc,EACd,IAAI,CAAC,MAAM,EACX,IAAI,CAAC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Z,CAAA;YACH,KAAK,oBAAoB;gBACvB,OAAO,sCAAqB,CAAC,cAAc,CACzC,cAAc,EACd,IAAI,CAAC,UAAU,CAChB,CAAA;YACH;gBACE,OAAO,SAAS,CAAA;QACpB,CAAC;IACH,CAAC;CACF;AAxID,kCAwIC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class ContactInfoFieldsClient {
|
|
2
|
+
private readonly hubtypeApiUrl;
|
|
3
|
+
private readonly accessToken;
|
|
4
|
+
constructor(hubtypeApiUrl: string, accessToken: string);
|
|
5
|
+
update(chatId: string, fieldName: string, value: string | number | boolean): Promise<void>;
|
|
6
|
+
delete(chatId: string, fieldName: string): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContactInfoFieldsClient = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
class ContactInfoFieldsClient {
|
|
7
|
+
constructor(hubtypeApiUrl, accessToken) {
|
|
8
|
+
this.hubtypeApiUrl = hubtypeApiUrl;
|
|
9
|
+
this.accessToken = accessToken;
|
|
10
|
+
}
|
|
11
|
+
async update(chatId, fieldName, value) {
|
|
12
|
+
await axios_1.default.put(`${this.hubtypeApiUrl}/external/v1/chats/${chatId}/contact_info_fields/${encodeURIComponent(fieldName)}/`, { value }, {
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async delete(chatId, fieldName) {
|
|
20
|
+
await axios_1.default.delete(`${this.hubtypeApiUrl}/external/v1/chats/${chatId}/contact_info_fields/${encodeURIComponent(fieldName)}/`, {
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ContactInfoFieldsClient = ContactInfoFieldsClient;
|
|
28
|
+
//# sourceMappingURL=contact-info-fields-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-info-fields-api.js","sourceRoot":"","sources":["../../../src/services/contact-info-fields-api.ts"],"names":[],"mappings":";;;;AAAA,0DAAyB;AAEzB,MAAa,uBAAuB;IAClC,YACmB,aAAqB,EACrB,WAAmB;QADnB,kBAAa,GAAb,aAAa,CAAQ;QACrB,gBAAW,GAAX,WAAW,CAAQ;IACnC,CAAC;IAEJ,KAAK,CAAC,MAAM,CACV,MAAc,EACd,SAAiB,EACjB,KAAgC;QAEhC,MAAM,eAAK,CAAC,GAAG,CACb,GAAG,IAAI,CAAC,aAAa,sBAAsB,MAAM,wBAAwB,kBAAkB,CAAC,SAAS,CAAC,GAAG,EACzG,EAAE,KAAK,EAAE,EACT;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;aAC5C;SACF,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,SAAiB;QAC5C,MAAM,eAAK,CAAC,MAAM,CAChB,GAAG,IAAI,CAAC,aAAa,sBAAsB,MAAM,wBAAwB,kBAAkB,CAAC,SAAS,CAAC,GAAG,EACzG;YACE,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;aAC5C;SACF,CACF,CAAA;IACH,CAAC;CACF;AAjCD,0DAiCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-flow-builder",
|
|
3
|
-
"version": "0.58.0-alpha.
|
|
3
|
+
"version": "0.58.0-alpha.1",
|
|
4
4
|
"main": "./lib/cjs/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use Flow Builder to show your contents",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"format": "biome format --write src/ tests/"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@botonic/react": "0.58.0-alpha.
|
|
18
|
+
"@botonic/react": "0.58.0-alpha.1",
|
|
19
19
|
"axios": "^1.18.1",
|
|
20
20
|
"uuid": "^10.0.0"
|
|
21
21
|
},
|
|
@@ -89,13 +89,12 @@ async function getContentsByUserInput(
|
|
|
89
89
|
return []
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
})
|
|
92
|
+
const contentsByKeywordsOrIntents = await getContentsByPayload({
|
|
93
|
+
cmsApi,
|
|
94
|
+
flowBuilderPlugin,
|
|
95
|
+
request,
|
|
96
|
+
resolvedLocale,
|
|
97
|
+
})
|
|
99
98
|
|
|
100
99
|
const hasRepeatedContent = await checkRepeatedContents(
|
|
101
100
|
flowBuilderPlugin,
|
|
@@ -5,31 +5,26 @@ import {
|
|
|
5
5
|
WhatsappInputOrigin,
|
|
6
6
|
} from '@botonic/core'
|
|
7
7
|
import { EMPTY_PAYLOAD } from '../constants'
|
|
8
|
-
|
|
8
|
+
import type { FlowContent } from '../content-fields'
|
|
9
9
|
import { inputHasTextOrTranscript } from '../utils/input'
|
|
10
10
|
import { getContentsByAiAgentFromUserInput } from './ai-agent-from-user-input'
|
|
11
|
-
import type { FlowBuilderContentsResult } from './contents-result'
|
|
12
11
|
import { getFlowBuilderActionContext } from './context'
|
|
13
12
|
import { getContentsByFallback } from './fallback'
|
|
14
13
|
import { getContentsByFirstInteraction } from './first-interaction'
|
|
15
14
|
import { getContentsByPayload } from './payload'
|
|
16
15
|
|
|
17
|
-
export type { FlowBuilderContentsResult } from './contents-result'
|
|
18
|
-
|
|
19
16
|
export async function getContents(
|
|
20
17
|
botContext: BotContext,
|
|
21
18
|
contentID?: string
|
|
22
|
-
): Promise<
|
|
19
|
+
): Promise<FlowContent[]> {
|
|
23
20
|
const context = getFlowBuilderActionContext(botContext, contentID)
|
|
24
21
|
|
|
25
22
|
if (botContext.session.is_first_interaction) {
|
|
26
|
-
return
|
|
27
|
-
contents: await getContentsByFirstInteraction(context),
|
|
28
|
-
}
|
|
23
|
+
return await getContentsByFirstInteraction(context)
|
|
29
24
|
}
|
|
30
25
|
// TODO: Add needed logic when we can define contents for multi locale queue position message
|
|
31
26
|
if (botContext.input.type === INPUT.EVENT_QUEUE_POSITION_CHANGED) {
|
|
32
|
-
return
|
|
27
|
+
return []
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
if (botContext.input.payload?.startsWith(EMPTY_PAYLOAD)) {
|
|
@@ -38,13 +33,11 @@ export async function getContents(
|
|
|
38
33
|
|
|
39
34
|
if (botContext.input.payload || contentID) {
|
|
40
35
|
const contentsByPayload = await getContentsByPayload(context)
|
|
41
|
-
if (contentsByPayload.
|
|
36
|
+
if (contentsByPayload.length > 0) {
|
|
42
37
|
return contentsByPayload
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
return
|
|
46
|
-
contents: await getContentsByFallback(context),
|
|
47
|
-
}
|
|
40
|
+
return await getContentsByFallback(context)
|
|
48
41
|
}
|
|
49
42
|
|
|
50
43
|
if (
|
|
@@ -53,13 +46,11 @@ export async function getContents(
|
|
|
53
46
|
) {
|
|
54
47
|
const aiAgentContents = await getContentsByAiAgentFromUserInput(context)
|
|
55
48
|
if (aiAgentContents.length > 0) {
|
|
56
|
-
return
|
|
49
|
+
return aiAgentContents
|
|
57
50
|
}
|
|
58
51
|
}
|
|
59
52
|
|
|
60
|
-
return
|
|
61
|
-
contents: await getContentsByFallback(context),
|
|
62
|
-
}
|
|
53
|
+
return await getContentsByFallback(context)
|
|
63
54
|
}
|
|
64
55
|
|
|
65
56
|
function isContactRequested(input: Input) {
|
package/src/action/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type BotContext, isDev, isWebchat } from '@botonic/core'
|
|
2
2
|
import {
|
|
3
|
-
CampaignMessageAttributesProvider,
|
|
4
3
|
Multichannel,
|
|
5
4
|
RequestContext,
|
|
6
5
|
WebchatSettings,
|
|
@@ -22,7 +21,6 @@ import { getContents } from './get-contents'
|
|
|
22
21
|
|
|
23
22
|
export type FlowBuilderActionProps = {
|
|
24
23
|
contents: FlowContent[]
|
|
25
|
-
campaignFirstMessageId?: string
|
|
26
24
|
webchatSettingsParams?: WebchatSettingsProps
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -48,20 +46,14 @@ export class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
|
48
46
|
botContext: BotContext,
|
|
49
47
|
contentID?: string
|
|
50
48
|
): Promise<FlowBuilderActionProps> {
|
|
51
|
-
const
|
|
52
|
-
botContext,
|
|
53
|
-
contentID
|
|
54
|
-
)
|
|
49
|
+
const contents = await getContents(botContext, contentID)
|
|
55
50
|
|
|
56
51
|
const contentsToRender = await FlowBuilderAction.prepareContentsToRender(
|
|
57
52
|
botContext,
|
|
58
53
|
contents
|
|
59
54
|
)
|
|
60
55
|
|
|
61
|
-
return {
|
|
62
|
-
contents: contentsToRender,
|
|
63
|
-
campaignFirstMessageId,
|
|
64
|
-
}
|
|
56
|
+
return { contents: contentsToRender }
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
static async prepareContentsToRender(
|
|
@@ -145,7 +137,7 @@ export class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
|
145
137
|
}
|
|
146
138
|
|
|
147
139
|
render(): JSX.Element | JSX.Element[] {
|
|
148
|
-
const { contents
|
|
140
|
+
const { contents } = this.props
|
|
149
141
|
const botContext = this.context as BotContext
|
|
150
142
|
const { shouldSendWebchatSettings, webchatSettingsParams } =
|
|
151
143
|
this.getWebchatSettingsParams(botContext)
|
|
@@ -155,37 +147,15 @@ export class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
|
155
147
|
{shouldSendWebchatSettings && (
|
|
156
148
|
<WebchatSettings {...webchatSettingsParams} />
|
|
157
149
|
)}
|
|
158
|
-
{
|
|
159
|
-
contents,
|
|
160
|
-
botContext,
|
|
161
|
-
campaignFirstMessageId
|
|
162
|
-
)}
|
|
150
|
+
{contents.map(content => content.toBotonic(botContext))}
|
|
163
151
|
</>
|
|
164
152
|
)
|
|
165
153
|
}
|
|
166
|
-
|
|
167
|
-
protected static renderContents(
|
|
168
|
-
contents: FlowContent[],
|
|
169
|
-
botContext: BotContext,
|
|
170
|
-
campaignFirstMessageId?: string
|
|
171
|
-
): JSX.Element | JSX.Element[] {
|
|
172
|
-
const rendered = contents.map(content => content.toBotonic(botContext))
|
|
173
|
-
|
|
174
|
-
if (!campaignFirstMessageId) {
|
|
175
|
-
return rendered
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<CampaignMessageAttributesProvider campaignId={campaignFirstMessageId}>
|
|
180
|
-
{rendered}
|
|
181
|
-
</CampaignMessageAttributesProvider>
|
|
182
|
-
)
|
|
183
|
-
}
|
|
184
154
|
}
|
|
185
155
|
|
|
186
156
|
export class FlowBuilderMultichannelAction extends FlowBuilderAction {
|
|
187
157
|
render(): JSX.Element | JSX.Element[] {
|
|
188
|
-
const { contents
|
|
158
|
+
const { contents } = this.props
|
|
189
159
|
const botContext = this.context as BotContext
|
|
190
160
|
const { shouldSendWebchatSettings, webchatSettingsParams } =
|
|
191
161
|
this.getWebchatSettingsParams(botContext)
|
|
@@ -195,11 +165,7 @@ export class FlowBuilderMultichannelAction extends FlowBuilderAction {
|
|
|
195
165
|
{shouldSendWebchatSettings && (
|
|
196
166
|
<WebchatSettings {...webchatSettingsParams} />
|
|
197
167
|
)}
|
|
198
|
-
{
|
|
199
|
-
contents,
|
|
200
|
-
botContext,
|
|
201
|
-
campaignFirstMessageId
|
|
202
|
-
)}
|
|
168
|
+
{contents.map(content => content.toBotonic(botContext))}
|
|
203
169
|
</Multichannel>
|
|
204
170
|
)
|
|
205
171
|
}
|
package/src/action/payload.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { EventAction, type EventFeedback, storeCaseRating } from '@botonic/core'
|
|
2
2
|
import { v7 as uuid } from 'uuid'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AGENT_RATING_PAYLOAD,
|
|
6
|
+
PUSH_FLOW_PAYLOAD,
|
|
7
|
+
SEPARATOR,
|
|
8
|
+
} from '../constants'
|
|
9
|
+
import type { FlowContent } from '../content-fields'
|
|
4
10
|
import type { HtNodeWithContent } from '../content-fields/hubtype-fields'
|
|
5
11
|
import { trackEvent } from '../tracking'
|
|
6
|
-
import type { FlowBuilderContentsResult } from './contents-result'
|
|
7
12
|
import type { FlowBuilderContext } from './context'
|
|
8
|
-
import { PushFlowResolver } from './push-flow-resolver'
|
|
9
13
|
|
|
10
14
|
export async function getContentsByPayload(
|
|
11
15
|
context: FlowBuilderContext
|
|
12
|
-
): Promise<
|
|
16
|
+
): Promise<FlowContent[]> {
|
|
13
17
|
const { cmsApi, flowBuilderPlugin, request, contentID } = context
|
|
14
18
|
if (request.input.payload?.startsWith(AGENT_RATING_PAYLOAD)) {
|
|
15
19
|
return await resolveRatingPayload(context)
|
|
16
20
|
}
|
|
17
21
|
if (request.input.payload?.startsWith(PUSH_FLOW_PAYLOAD)) {
|
|
18
|
-
|
|
19
|
-
return await pushFlow.getContents()
|
|
22
|
+
return await resolvePushFlowPayload(context)
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
const id = contentID
|
|
@@ -25,21 +28,19 @@ export async function getContentsByPayload(
|
|
|
25
28
|
const targetNode = id ? cmsApi.getNodeById<HtNodeWithContent>(id) : undefined
|
|
26
29
|
|
|
27
30
|
if (targetNode) {
|
|
28
|
-
return
|
|
29
|
-
contents: await flowBuilderPlugin.getContentsByNode(targetNode),
|
|
30
|
-
}
|
|
31
|
+
return await flowBuilderPlugin.getContentsByNode(targetNode)
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
return
|
|
34
|
+
return []
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
async function resolveRatingPayload(
|
|
37
38
|
context: FlowBuilderContext
|
|
38
|
-
): Promise<
|
|
39
|
+
): Promise<FlowContent[]> {
|
|
39
40
|
const { cmsApi, flowBuilderPlugin, request } = context
|
|
40
41
|
|
|
41
42
|
if (!request.input.payload) {
|
|
42
|
-
return
|
|
43
|
+
return []
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
const { target, text, value, possibleOptions, possibleValues } =
|
|
@@ -65,10 +66,39 @@ async function resolveRatingPayload(
|
|
|
65
66
|
: undefined
|
|
66
67
|
|
|
67
68
|
if (targetNode) {
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
return await flowBuilderPlugin.getContentsByNode(targetNode)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return []
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function resolvePushFlowPayload(
|
|
76
|
+
context: FlowBuilderContext
|
|
77
|
+
): Promise<FlowContent[]> {
|
|
78
|
+
const { cmsApi, flowBuilderPlugin, request } = context
|
|
79
|
+
|
|
80
|
+
if (!request.input.payload) {
|
|
81
|
+
return []
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const parts = request.input.payload.split(SEPARATOR)
|
|
85
|
+
const pushFlowId = parts.length > 1 ? parts[1] : ''
|
|
86
|
+
|
|
87
|
+
if (!pushFlowId) {
|
|
88
|
+
return []
|
|
71
89
|
}
|
|
72
90
|
|
|
73
|
-
|
|
91
|
+
try {
|
|
92
|
+
const pushFlowNode =
|
|
93
|
+
cmsApi.getNodeByCampaignId<HtNodeWithContent>(pushFlowId)
|
|
94
|
+
|
|
95
|
+
if (!pushFlowNode) {
|
|
96
|
+
return []
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return await flowBuilderPlugin.getContentsByNode(pushFlowNode)
|
|
100
|
+
} catch {
|
|
101
|
+
// Campaign not found - return empty to trigger fallback
|
|
102
|
+
return []
|
|
103
|
+
}
|
|
74
104
|
}
|
package/src/api.ts
CHANGED
|
@@ -82,22 +82,12 @@ export class FlowBuilderApi {
|
|
|
82
82
|
return this.getNodeById<HtNodeWithContent>(subFlow.start_node_id)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
getNodeByCampaignId<T extends HtNodeComponent>(id: string): T
|
|
85
|
+
getNodeByCampaignId<T extends HtNodeComponent>(id: string): T {
|
|
86
86
|
const campaign = this.flow.campaigns.find(campaign => campaign.id === id)
|
|
87
87
|
if (!campaign) {
|
|
88
|
-
|
|
88
|
+
throw Error(`Campaign with id: '${id}' not found`)
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
const node = this.flow.nodes.find(
|
|
92
|
-
flowNode => flowNode.id === campaign.start_node_id
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
if (!node) {
|
|
96
|
-
console.error(`Node with id: '${campaign.start_node_id}' not found`)
|
|
97
|
-
return undefined
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return node as T
|
|
90
|
+
return this.getNodeById<T>(campaign.start_node_id)
|
|
101
91
|
}
|
|
102
92
|
|
|
103
93
|
getNodeById<T extends HtNodeComponent>(id: string): T {
|
|
@@ -8,7 +8,7 @@ export class FlowDoNothing extends ContentFieldsBase {
|
|
|
8
8
|
static fromHubtypeCMS(cmsDoNothing: HtDoNothingNode): FlowDoNothing {
|
|
9
9
|
const newDoNothing = new FlowDoNothing(cmsDoNothing.id)
|
|
10
10
|
newDoNothing.code = cmsDoNothing.code
|
|
11
|
-
newDoNothing.followUp =
|
|
11
|
+
newDoNothing.followUp = cmsDoNothing.follow_up
|
|
12
12
|
|
|
13
13
|
return newDoNothing
|
|
14
14
|
}
|