@dawntech/dwntbots-services 0.0.64 → 0.0.66
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 +4 -4
- package/src/lib/blip/BlipBuilder/BlipBuilder.d.ts +61 -0
- package/src/lib/blip/BlipBuilder/BlipBuilder.js +195 -0
- package/src/lib/blip/BlipBuilder/BlipBuilder.js.map +1 -0
- package/src/lib/blip/BlipBuilder/BlipBuilderTranspilation.d.ts +30 -0
- package/src/lib/blip/BlipBuilder/BlipBuilderTranspilation.js +73 -0
- package/src/lib/blip/BlipBuilder/BlipBuilderTranspilation.js.map +1 -0
- package/src/lib/blip/BlipBuilder/BlipBuilderTranspile.d.ts +1 -0
- package/src/lib/blip/BlipBuilder/BlipBuilderTranspile.js +15 -2
- package/src/lib/blip/BlipBuilder/BlipBuilderTranspile.js.map +1 -1
- package/src/lib/blip/BlipBuilder/features/CommonFeature.d.ts +18 -0
- package/src/lib/blip/BlipBuilder/features/CommonFeature.js +77 -0
- package/src/lib/blip/BlipBuilder/features/CommonFeature.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/Feature.d.ts +31 -0
- package/src/lib/blip/BlipBuilder/features/Feature.js +45 -0
- package/src/lib/blip/BlipBuilder/features/Feature.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/InactivityFeature.d.ts +25 -0
- package/src/lib/blip/BlipBuilder/features/InactivityFeature.js +143 -0
- package/src/lib/blip/BlipBuilder/features/InactivityFeature.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/LintFeature.d.ts +5 -0
- package/src/lib/blip/BlipBuilder/features/LintFeature.js +14 -0
- package/src/lib/blip/BlipBuilder/features/LintFeature.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/PositionFeature.d.ts +71 -0
- package/src/lib/blip/BlipBuilder/features/PositionFeature.js +143 -0
- package/src/lib/blip/BlipBuilder/features/PositionFeature.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/SDKFeature.d.ts +40 -0
- package/src/lib/blip/BlipBuilder/features/SDKFeature.js +210 -0
- package/src/lib/blip/BlipBuilder/features/SDKFeature.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/TagsFeature.d.ts +20 -0
- package/src/lib/blip/BlipBuilder/features/TagsFeature.js +90 -0
- package/src/lib/blip/BlipBuilder/features/TagsFeature.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/actions/content.d.ts +4 -0
- package/src/lib/blip/BlipBuilder/features/actions/content.js +81 -0
- package/src/lib/blip/BlipBuilder/features/actions/content.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/actions/ctwa.d.ts +3 -0
- package/src/lib/blip/BlipBuilder/features/actions/ctwa.js +43 -0
- package/src/lib/blip/BlipBuilder/features/actions/ctwa.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/actions/entrypoint.d.ts +5 -0
- package/src/lib/blip/BlipBuilder/features/actions/entrypoint.js +87 -0
- package/src/lib/blip/BlipBuilder/features/actions/entrypoint.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/actions/fallback.d.ts +5 -0
- package/src/lib/blip/BlipBuilder/features/actions/fallback.js +79 -0
- package/src/lib/blip/BlipBuilder/features/actions/fallback.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/actions/global.d.ts +3 -0
- package/src/lib/blip/BlipBuilder/features/actions/global.js +52 -0
- package/src/lib/blip/BlipBuilder/features/actions/global.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/actions/onboarding.d.ts +2 -0
- package/src/lib/blip/BlipBuilder/features/actions/onboarding.js +27 -0
- package/src/lib/blip/BlipBuilder/features/actions/onboarding.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/blocks/debugger.d.ts +2 -0
- package/src/lib/blip/BlipBuilder/features/blocks/debugger.js +653 -0
- package/src/lib/blip/BlipBuilder/features/blocks/debugger.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/blocks/error.d.ts +3 -0
- package/src/lib/blip/BlipBuilder/features/blocks/error.js +234 -0
- package/src/lib/blip/BlipBuilder/features/blocks/error.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/blocks/inactivity.d.ts +2 -0
- package/src/lib/blip/BlipBuilder/features/blocks/inactivity.js +128 -0
- package/src/lib/blip/BlipBuilder/features/blocks/inactivity.js.map +1 -0
- package/src/lib/blip/BlipBuilder/features/index.d.ts +6 -0
- package/src/lib/blip/BlipBuilder/features/index.js +23 -0
- package/src/lib/blip/BlipBuilder/features/index.js.map +1 -0
- package/src/lib/blip/BlipBuilder/index.d.ts +3 -0
- package/src/lib/blip/BlipBuilder/index.js +3 -2
- package/src/lib/blip/BlipBuilder/index.js.map +1 -1
- package/src/lib/blip/BlipBuilder/models/commom.d.ts +2 -0
- package/src/lib/blip/BlipBuilder/models/commom.js +3 -1
- package/src/lib/blip/BlipBuilder/models/commom.js.map +1 -1
- package/src/lib/blip/BlipBuilder/models/debug.d.ts +2 -0
- package/src/lib/blip/BlipBuilder/models/debug.js +631 -0
- package/src/lib/blip/BlipBuilder/models/debug.js.map +1 -0
- package/src/lib/blip/BlipService.d.ts +11 -1
- package/src/lib/blip/BlipService.js +164 -0
- package/src/lib/blip/BlipService.js.map +1 -1
- package/src/lib/blip/index.d.ts +1 -0
- package/src/lib/blip/index.js +1 -0
- package/src/lib/blip/index.js.map +1 -1
- package/src/lib/new-relic/NewRelicIngest.d.ts +2 -2
- package/src/lib/new-relic/NewRelicIngest.js +2 -2
- package/src/lib/new-relic/NewRelicIngest.js.map +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearErrorTypeAction = exports.trackErrorAction = exports.createErrorSDKScriptAction = exports.createErrorProcessScriptAction = void 0;
|
|
4
|
+
const createErrorProcessScriptAction = ($id) => {
|
|
5
|
+
return {
|
|
6
|
+
$id,
|
|
7
|
+
$typeOfContent: "",
|
|
8
|
+
type: "ExecuteScript",
|
|
9
|
+
$title: "Processa error",
|
|
10
|
+
settings: {
|
|
11
|
+
function: "run",
|
|
12
|
+
source: '/**\n * Decodifica o erro registrado em informações de:\n * - Mensagem que será mostrada\n * - Necessidade de parada do fluxo\n * - Id de retorno caso em caso de reentrada\n * \n * @param {string} errorType Tipo do erro registrado.\n * @param {{type: string, content: string, group: string}} input Informações de entrada de dados.\n * @param {{id: string, name: string}} state Informações de estado.\n * \n * @returns {{type: string, message: string, halt?: boolean, id?: string, bot?: string}} Informações do erro\n */\nfunction process_error(error) {\n\n\tswitch(error.type) {\n\t\tcase "INACTIVITY":\n\t\t\terror["message"] = "Vejo que você não está mais por aqui e por isso vou encerrar o atendimento.Se precisar de mim é só dar um \\"Oi\\" 😉\\n\\nAté mais 👋";\n\t\t\terror["halt"] = true;\n\t\t\tbreak;\n\t\tcase "API":\n\t\t\terror["message"] = "Desculpe, aconteceu alguma coisa em nosso sistema. <b>Tente novamente em alguns minutos.</b>";\n\t\t\tbreak;\n\t\tdefault: \n\t\t\terror["message"] = "Desculpe, não consegui entender!";\n\t\t\tbreak;\n\t}\n\n\treturn error;\n}\n\nfunction run(DWNT, errorType, inputContent, inputType, stateId, stateName) {\n\tlet error = {};\n\ttry {\n\t\tDWNT = JSON.parse(DWNT || \'\');\n\t\terror["type"] = errorType;\n\t\terror["halt"] = false;\n\t\terror["state"] = {\n\t\t\t"id": stateId,\n\t\t\t"type": stateName\n\t\t};\n\t\terror["return"] = {\n\t\t\t"id": stateId,\n\t\t\t"bot": DWNT.current_bot\n\t\t};\n\t\terror = process_error(error);\n\t} catch(err) {\n\t\terror = {\n\t\t\t"type": "UNEXPECTED_INPUT",\n\t\t\t"message": "Desculpe, não consegui compreender.",\n\t\t\t"state":{ \n\t\t\t\t"id": stateId,\n\t\t\t\t"name": stateName\n\t\t\t},\n\t\t\t"return": {\n\t\t\t\t"id": stateId,\n\t\t\t\t"bot": null,\n\t\t\t},\n\t\t\t"recurrency": {\n\t\t\t\t"state": 1,\n\t\t\t\t"type": 1\n\t\t\t}\n\t\t};\n\t}\n\t\n\n\treturn JSON.stringify(error);\n}\n\n',
|
|
13
|
+
inputVariables: [
|
|
14
|
+
"DWNT",
|
|
15
|
+
"errorType",
|
|
16
|
+
"state.previous.id",
|
|
17
|
+
"state.previous.name",
|
|
18
|
+
],
|
|
19
|
+
outputVariable: "error",
|
|
20
|
+
LocalTimeZoneEnabled: false,
|
|
21
|
+
},
|
|
22
|
+
conditions: [],
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.createErrorProcessScriptAction = createErrorProcessScriptAction;
|
|
26
|
+
const createErrorSDKScriptAction = ($id) => {
|
|
27
|
+
return {
|
|
28
|
+
$id,
|
|
29
|
+
$typeOfContent: "",
|
|
30
|
+
type: "ExecuteScript",
|
|
31
|
+
$title: "Atualiza SDK (fallback)",
|
|
32
|
+
settings: {
|
|
33
|
+
function: "run",
|
|
34
|
+
source: "\nfunction run(DWNT, error) {\n\ttry {\n\t\tDWNT = JSON.parse(DWNT);\n\t\terror = JSON.parse(error);\n\t\tDWNT.errors.push(error);\n\t\tDWNT.error = error;\n\t} catch(err) {\n\t\tDWNT = {};\n\t}\n\treturn JSON.stringify(DWNT);\n}\n\n",
|
|
35
|
+
inputVariables: ["DWNT", "error"],
|
|
36
|
+
outputVariable: "DWNT",
|
|
37
|
+
LocalTimeZoneEnabled: false,
|
|
38
|
+
},
|
|
39
|
+
conditions: [],
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.createErrorSDKScriptAction = createErrorSDKScriptAction;
|
|
43
|
+
const trackErrorAction = ($id) => {
|
|
44
|
+
return {
|
|
45
|
+
$id,
|
|
46
|
+
$typeOfContent: "",
|
|
47
|
+
type: "TrackEvent",
|
|
48
|
+
$title: "Registra Error",
|
|
49
|
+
settings: {
|
|
50
|
+
extras: {
|
|
51
|
+
type: "{{error@type}}",
|
|
52
|
+
bot: "{{error@bot}}",
|
|
53
|
+
stateName: "{{error@state.name}}",
|
|
54
|
+
stateId: "{{error@state.id}}",
|
|
55
|
+
},
|
|
56
|
+
category: "ERROR",
|
|
57
|
+
action: "{{DWNT@datetime}} | {{contact.identity}} | {{error@type}} | {{error@bot}} | {{error@state.name}} | input.content",
|
|
58
|
+
},
|
|
59
|
+
conditions: [],
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.trackErrorAction = trackErrorAction;
|
|
63
|
+
const clearErrorTypeAction = ($id) => {
|
|
64
|
+
return {
|
|
65
|
+
$id,
|
|
66
|
+
$typeOfContent: "",
|
|
67
|
+
type: "ProcessCommand",
|
|
68
|
+
$title: "Deleta 'ErrorType'",
|
|
69
|
+
settings: {
|
|
70
|
+
to: "postmaster@msging.net",
|
|
71
|
+
method: "delete",
|
|
72
|
+
uri: "/contexts/{{contact.identity}}/errorType",
|
|
73
|
+
variable: "deleteErrorTypeCmdResp",
|
|
74
|
+
},
|
|
75
|
+
conditions: [],
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
exports.clearErrorTypeAction = clearErrorTypeAction;
|
|
79
|
+
//# sourceMappingURL=fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../../../../../../../libs/services/src/lib/blip/BlipBuilder/features/actions/fallback.ts"],"names":[],"mappings":";;;AAEO,MAAM,8BAA8B,GAAG,CAC7C,GAAW,EACyB,EAAE;IACtC,OAAO;QACN,GAAG;QACH,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE;YACT,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,02DAA02D;YACl3D,cAAc,EAAE;gBACf,MAAM;gBACN,WAAW;gBACX,mBAAmB;gBACnB,qBAAqB;aACrB;YACD,cAAc,EAAE,OAAO;YACvB,oBAAoB,EAAE,KAAK;SAC3B;QACD,UAAU,EAAE,EAAE;KACd,CAAC;AACH,CAAC,CAAC;AAtBW,QAAA,8BAA8B,kCAsBzC;AAEK,MAAM,0BAA0B,GAAG,CACzC,GAAW,EACyB,EAAE;IACtC,OAAO;QACN,GAAG;QACH,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,yBAAyB;QACjC,QAAQ,EAAE;YACT,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,2OAA2O;YACnP,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YACjC,cAAc,EAAE,MAAM;YACtB,oBAAoB,EAAE,KAAK;SAC3B;QACD,UAAU,EAAE,EAAE;KACd,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,0BAA0B,8BAiBrC;AAEK,MAAM,gBAAgB,GAAG,CAC/B,GAAW,EACsB,EAAE;IACnC,OAAO;QACN,GAAG;QACH,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE;YACT,MAAM,EAAE;gBACP,IAAI,EAAE,gBAAgB;gBACtB,GAAG,EAAE,eAAe;gBACpB,SAAS,EAAE,sBAAsB;gBACjC,OAAO,EAAE,oBAAoB;aAC7B;YACD,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,kHAAkH;SAC1H;QACD,UAAU,EAAE,EAAE;KACd,CAAC;AACH,CAAC,CAAC;AApBW,QAAA,gBAAgB,oBAoB3B;AAEK,MAAM,oBAAoB,GAAG,CACnC,GAAW,EAC0B,EAAE;IACvC,OAAO;QACN,GAAG;QACH,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,oBAAoB;QAC5B,QAAQ,EAAE;YACT,EAAE,EAAE,uBAAuB;YAC3B,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,0CAA0C;YAC/C,QAAQ,EAAE,wBAAwB;SAClC;QACD,UAAU,EAAE,EAAE;KACd,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,oBAAoB,wBAgB/B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setErrorTypeWhenInactive = exports.createGlobalScriptAction = void 0;
|
|
4
|
+
const createGlobalScriptAction = ($id) => {
|
|
5
|
+
return {
|
|
6
|
+
$id,
|
|
7
|
+
$typeOfContent: "",
|
|
8
|
+
type: "ExecuteScript",
|
|
9
|
+
$title: "Atualiza SDK (global)",
|
|
10
|
+
settings: {
|
|
11
|
+
function: "run",
|
|
12
|
+
source: 'function run(DWNT, tunnel_destination, input_content, input_type, intents) {\n try {\n DWNT = JSON.parse(DWNT|| "{}");\n \n const now = new Date();\n DWNT.datetime = datetime__to_string(now);\n\n DWNT.current_bot = info__bot_id(tunnel_destination);\n\n DWNT.input = {};\n DWNT.input.type = null;\n DWNT.input.intent = null;\n\n \n } catch(err) {\n DWNT = {};\n }\n return JSON.stringify(DWNT);\n}\n\n\nfunction datetime__to_string(date, tzOffset){\n tzOffset = tzOffset || -3;\n const dateTz = new Date(new Date(date).getTime() + tzOffset * 60 * 60 * 1000) ;\n return dateTz.toISOString().replace("T", " ").split(".")[0];\n}\n\n\nfunction contact__source(contactIdentity) {\n contactIdentity = String(contactIdentity);\n if (contactIdentity.includes("wa")) {\n return "WHATSAPP";\n } else if (contactIdentity.includes("messenger")) {\n return "FACEBOOK";\n } else if (contactIdentity.includes("instagram")) {\n return "INSTAGRAM";\n } else if (contactIdentity.includes("businessmessages")) {\n return "GOOGLE_BUSINESS_MESSAGE";\n } else if (contactIdentity.includes("mailgun")) {\n return "E_MAIL";\n } else if (contactIdentity.includes("0mn") || contactIdentity.includes("blip")) {\n return "BLIP_CHAT";\n } else {\n return "OUTRO";\n }\n}\n\nfunction info__bot_id(completeRef) {\n try {\n const parts = String(completeRef).split("@");\n if (parts.length === 1) {\n throw new Error("Not a reference")\n }\n return parts[0];\n } catch(err) {\n return "Indefinido";\n } \n}\n\nfunction contact__phone(contactIdentity) {\n contactIdentity = String(contactIdentity);\n try {\n if (!contactIdentity.includes("wa")) {\n throw new Error("Not a whatsapp contact");\n }\n return String(contactIdentity).split("@")[0];\n } catch(err) {\n return "Indefinido";\n } \n}\nfunction contact__DDD(contactIdentity) {\n contactIdentity = String(contactIdentity);\n try {\n if (!contactIdentity.includes("wa")) {\n throw new Error("Not a whatsapp contact");\n }\n return String(contactIdentity).split("@")[0].substring(2, 4);\n } catch(err) {\n return "Indefinido";\n } \n}\n\n\n',
|
|
13
|
+
inputVariables: [
|
|
14
|
+
"DWNT",
|
|
15
|
+
"tunnel.destination",
|
|
16
|
+
"input.content",
|
|
17
|
+
"input.type",
|
|
18
|
+
"intents",
|
|
19
|
+
],
|
|
20
|
+
outputVariable: "DWNT",
|
|
21
|
+
},
|
|
22
|
+
conditions: [],
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.createGlobalScriptAction = createGlobalScriptAction;
|
|
26
|
+
const setErrorTypeWhenInactive = ($id) => {
|
|
27
|
+
return {
|
|
28
|
+
$id,
|
|
29
|
+
$typeOfContent: "",
|
|
30
|
+
type: "SetVariable",
|
|
31
|
+
$title: "Salva inatividade",
|
|
32
|
+
settings: {
|
|
33
|
+
variable: "errorType",
|
|
34
|
+
value: "INACTIVITY",
|
|
35
|
+
},
|
|
36
|
+
conditions: [
|
|
37
|
+
{
|
|
38
|
+
values: [],
|
|
39
|
+
variable: "errorType",
|
|
40
|
+
source: "context",
|
|
41
|
+
comparison: "notExists",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
values: [],
|
|
45
|
+
source: "input",
|
|
46
|
+
comparison: "notExists",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.setErrorTypeWhenInactive = setErrorTypeWhenInactive;
|
|
52
|
+
//# sourceMappingURL=global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../../../../../../../../libs/services/src/lib/blip/BlipBuilder/features/actions/global.ts"],"names":[],"mappings":";;;AAEO,MAAM,wBAAwB,GAAG,CACvC,GAAW,EACyB,EAAE;IACtC,OAAO;QACN,GAAG;QACH,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,uBAAuB;QAC/B,QAAQ,EAAE;YACT,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,s1EAAs1E;YAC91E,cAAc,EAAE;gBACf,MAAM;gBACN,oBAAoB;gBACpB,eAAe;gBACf,YAAY;gBACZ,SAAS;aACT;YACD,cAAc,EAAE,MAAM;SACtB;QACD,UAAU,EAAE,EAAE;KACd,CAAC;AACH,CAAC,CAAC;AAtBW,QAAA,wBAAwB,4BAsBnC;AAEK,MAAM,wBAAwB,GAAG,CACvC,GAAW,EACuB,EAAE;IACpC,OAAO;QACN,GAAG;QACH,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,mBAAmB;QAC3B,QAAQ,EAAE;YACT,QAAQ,EAAE,WAAW;YACrB,KAAK,EAAE,YAAY;SACnB;QACD,UAAU,EAAE;YACX;gBACC,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,WAAW;gBACrB,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,WAAW;aACvB;YACD;gBACC,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,OAAO;gBACf,UAAU,EAAE,WAAW;aACvB;SACD;KACD,CAAC;AACH,CAAC,CAAC;AA1BW,QAAA,wBAAwB,4BA0BnC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOnboardingScriptAction = void 0;
|
|
4
|
+
const createOnboardingScriptAction = ($id) => {
|
|
5
|
+
return {
|
|
6
|
+
$id,
|
|
7
|
+
$typeOfContent: "",
|
|
8
|
+
type: "ExecuteScript",
|
|
9
|
+
$title: "Atualiza SDK (main)",
|
|
10
|
+
settings: {
|
|
11
|
+
function: "run",
|
|
12
|
+
source: 'function run(DWNT, contact_identity, tunnel_originator, tunnel_owner) {\n try {\n DWNT = JSON.parse(DWNT|| "{}");\n\n DWNT.main_bot = info__bot_id(tunnel_destination);\n DWNT.router = info__bot_id(tunnel_owner);\n\n if (DWNT.contact === undefined) DWNT.contact = {};\n if (DWNT.contact.source === undefined) DWNT.contact.source = contact__source(contact_identity);\n if (DWNT.contact.phone === undefined) DWNT.contact.phone = contact__phone(contact_identity);\n if (DWNT.contact.DDD === undefined) DWNT.contact.DDD = contact__DDD(contact_identity);\n if (DWNT.contact.id === undefined) DWNT.contact.id = tunnel_originator ? tunnel_originator : contact_identity;\n DWNT.contact.new = DWNT.contact.new === undefined;\n\n\t\tDWNT.errors = [];\n\n if (DWNT.checkpoints === undefined) DWNT.checkpoints = [];\n\n } catch(err) {}\n return JSON.stringify(DWNT);\n}\n\nfunction contact__source(contactIdentity) {\n contactIdentity = String(contactIdentity);\n if (contactIdentity.includes("wa")) {\n return "WHATSAPP";\n } else if (contactIdentity.includes("messenger")) {\n return "FACEBOOK";\n } else if (contactIdentity.includes("instagram")) {\n return "INSTAGRAM";\n } else if (contactIdentity.includes("businessmessages")) {\n return "GOOGLE_BUSINESS_MESSAGE";\n } else if (contactIdentity.includes("mailgun")) {\n return "E_MAIL";\n } else if (contactIdentity.includes("0mn") || contactIdentity.includes("blip")) {\n return "BLIP_CHAT";\n } else {\n return "OUTRO";\n }\n}\n\nfunction info__bot_id(completeRef) {\n try {\n const parts = String(completeRef).split("@");\n if (parts.length === 1) {\n throw new Error("Not a reference")\n }\n return parts[0];\n } catch(err) {\n return "Indefinido";\n } \n}\n\n\nfunction contact__phone(contactIdentity) {\n contactIdentity = String(contactIdentity);\n try {\n if (!contactIdentity.includes("wa")) {\n throw new Error("Not a whatsapp contact");\n }\n return String(contactIdentity).split("@")[0];\n } catch(err) {\n return "Indefinido";\n } \n}\n\nfunction contact__DDD(contactIdentity) {\n contactIdentity = String(contactIdentity);\n try {\n if (!contactIdentity.includes("wa")) {\n throw new Error("Not a whatsapp contact");\n }\n return String(contactIdentity).split("@")[0].substring(2, 4);\n } catch(err) {\n return "Indefinido";\n } \n}\n',
|
|
13
|
+
inputVariables: [
|
|
14
|
+
"DWNT",
|
|
15
|
+
"contact.identity",
|
|
16
|
+
"tunnel.originator",
|
|
17
|
+
"tunnel.destination",
|
|
18
|
+
"tunnel.owner",
|
|
19
|
+
],
|
|
20
|
+
outputVariable: "DWNT",
|
|
21
|
+
LocalTimeZoneEnabled: false,
|
|
22
|
+
},
|
|
23
|
+
conditions: [],
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.createOnboardingScriptAction = createOnboardingScriptAction;
|
|
27
|
+
//# sourceMappingURL=onboarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../../../../../../../../libs/services/src/lib/blip/BlipBuilder/features/actions/onboarding.ts"],"names":[],"mappings":";;;AAEO,MAAM,4BAA4B,GAAG,CAC3C,GAAW,EACyB,EAAE;IACtC,OAAO;QACN,GAAG;QACH,cAAc,EAAE,EAAE;QAClB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,qBAAqB;QAC7B,QAAQ,EAAE;YACT,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,+iFAA+iF;YACvjF,cAAc,EAAE;gBACf,MAAM;gBACN,kBAAkB;gBAClB,mBAAmB;gBACnB,oBAAoB;gBACpB,cAAc;aACd;YACD,cAAc,EAAE,MAAM;YACtB,oBAAoB,EAAE,KAAK;SAC3B;QACD,UAAU,EAAE,EAAE;KACd,CAAC;AACH,CAAC,CAAC;AAvBW,QAAA,4BAA4B,gCAuBvC"}
|