@cognigy/rest-api-client 0.13.1 → 0.13.2
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/.eslintConfig.json +117 -0
- package/.eslintrc.json +2 -2
- package/CHANGELOG.md +7 -0
- package/build/apigroups/ResourcesAPIGroup_2_0.js +10 -1
- package/build/shared/charts/descriptors/allFields.js +8 -0
- package/build/shared/charts/descriptors/apps/getAppSessionPin.js +9 -9
- package/build/shared/charts/descriptors/apps/initAppSession.js +36 -53
- package/build/shared/charts/descriptors/apps/setAdaptiveCardAppState.js +5 -18
- package/build/shared/charts/descriptors/apps/setAppState.js +6 -6
- package/build/shared/charts/descriptors/apps/setHtmlAppState.js +3 -3
- package/build/shared/charts/descriptors/apps/utils/buildAppUrl.js +12 -0
- package/build/shared/charts/descriptors/index.js +1 -1
- package/build/shared/charts/descriptors/logic/switch/switch.js +3 -2
- package/build/shared/charts/descriptors/message/question/optionalQuestion.js +8 -1
- package/build/shared/charts/descriptors/message/question/question.js +7 -3
- package/build/shared/charts/descriptors/message/question/utils/evaluateQuestionAnswer.js +6 -0
- package/build/shared/charts/descriptors/service/handoverV2.js +1 -1
- package/build/shared/charts/descriptors/voice/mappers/setSessionConfig.mapper.js +28 -25
- package/build/shared/charts/descriptors/voice/nodes/bargeIn.js +53 -0
- package/build/shared/charts/descriptors/voice/nodes/dtmf.js +5 -3
- package/build/shared/charts/descriptors/voice/nodes/play.js +10 -3
- package/build/shared/charts/descriptors/voice/nodes/transfer.js +4 -0
- package/build/shared/charts/descriptors/voicegateway/nodes/handover.js +5 -1
- package/build/shared/charts/descriptors/voicegateway2/nodes/play.js +17 -5
- package/build/shared/charts/descriptors/voicegateway2/nodes/setSessionConfig.js +27 -9
- package/build/shared/charts/descriptors/voicegateway2/nodes/transfer.js +5 -1
- package/build/shared/errors/BadGatewayError.js +2 -1
- package/build/shared/errors/BadRequestError.js +2 -1
- package/build/shared/errors/ForbiddenError.js +2 -1
- package/build/shared/errors/GatewayTimeoutError.js +2 -1
- package/build/shared/errors/MethodNotAllowedError.js +2 -1
- package/build/shared/errors/NetworkError.js +2 -1
- package/build/shared/errors/PayloadTooLargeError.js +2 -1
- package/build/shared/errors/PaymentRequiredError.js +2 -1
- package/build/shared/errors/ServiceUnavailableError.js +2 -1
- package/build/shared/errors/UnauthorizedError.js +2 -1
- package/build/shared/errors/baseError.js +27 -4
- package/build/shared/errors/conflict.js +2 -1
- package/build/shared/errors/databaseConnectError.js +2 -2
- package/build/shared/errors/databaseQueryError.js +2 -2
- package/build/shared/errors/databaseRead.js +2 -2
- package/build/shared/errors/databaseWrite.js +2 -2
- package/build/shared/errors/exportError.js +2 -2
- package/build/shared/errors/fileRead.js +2 -2
- package/build/shared/errors/fileWrite.js +2 -2
- package/build/shared/errors/importError.js +1 -1
- package/build/shared/errors/inputOutputError.js +2 -2
- package/build/shared/errors/internalServerError.js +2 -1
- package/build/shared/errors/invalidArgument.js +2 -2
- package/build/shared/errors/missingArgument.js +2 -2
- package/build/shared/errors/notImplementedError.js +2 -1
- package/build/shared/errors/process.js +2 -2
- package/build/shared/errors/resourceNotFound.js +5 -1
- package/build/shared/errors/smtpConnectError.js +2 -2
- package/build/shared/errors/timeoutError.js +2 -2
- package/build/shared/interfaces/handover.js +1 -0
- package/build/shared/interfaces/resources/IAgentAssistConfig.js +56 -0
- package/build/shared/interfaces/resources/ILocale.js +25 -3
- package/build/shared/interfaces/resources/INodeDescriptorSet.js +1 -0
- package/build/shared/interfaces/resources/TResourceType.js +3 -0
- package/build/shared/interfaces/resources/settings/ISharedSettings.js +1 -1
- package/build/shared/interfaces/resources/yesNoIntent/IYesNoItem.js +5 -5
- package/build/shared/interfaces/restAPI/administration/liveAgent/v2.0/ICognigyLiveAgentMiddleware_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IAgentAssistConfig_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/ICreateAgentAssistConfigRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IDeleteAgentAssistConfigRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IIndexAgentAssistConfigsRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IReadAgentAssistConfigRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/IUpdateAgentAssistConfigRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/agentAssist/v2.0/index.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/ITrainYesNoIntentsProjectRest_2_0.js +3 -0
- package/build/shared/interfaces/restAPI/resources/locales/v2.0/yesNoIntents/IYesNoIntents_2_0.js +4 -4
- package/build/shared/interfaces/security/IACL.js +1 -1
- package/build/shared/interfaces/security/IPermission.js +2 -0
- package/build/shared/interfaces/security/IRole.js +4 -0
- package/package.json +2 -2
- package/types/index.d.ts +218 -66
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"eslint:recommended",
|
|
4
|
+
"plugin:node/recommended"
|
|
5
|
+
],
|
|
6
|
+
"plugins": [
|
|
7
|
+
"node",
|
|
8
|
+
"@typescript-eslint"
|
|
9
|
+
],
|
|
10
|
+
"rules": {
|
|
11
|
+
"block-scoped-var": "error",
|
|
12
|
+
"eqeqeq": "error",
|
|
13
|
+
"no-var": "error",
|
|
14
|
+
"prefer-const": "error",
|
|
15
|
+
"prefer-arrow-callback": "error",
|
|
16
|
+
"no-trailing-spaces": "error",
|
|
17
|
+
"quotes": [
|
|
18
|
+
"warn",
|
|
19
|
+
"double",
|
|
20
|
+
{
|
|
21
|
+
"avoidEscape": true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"no-restricted-properties": [
|
|
25
|
+
"error",
|
|
26
|
+
{
|
|
27
|
+
"object": "describe",
|
|
28
|
+
"property": "only"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"object": "it",
|
|
32
|
+
"property": "only"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"object-curly-newline": [
|
|
36
|
+
"warn",
|
|
37
|
+
{
|
|
38
|
+
"ObjectPattern": {
|
|
39
|
+
"multiline": true,
|
|
40
|
+
"minProperties": 2
|
|
41
|
+
},
|
|
42
|
+
"ImportDeclaration": {
|
|
43
|
+
"multiline": true,
|
|
44
|
+
"minProperties": 3
|
|
45
|
+
},
|
|
46
|
+
"ExportDeclaration": {
|
|
47
|
+
"multiline": true,
|
|
48
|
+
"minProperties": 3
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"overrides": [
|
|
54
|
+
{
|
|
55
|
+
"files": [
|
|
56
|
+
"**/*.ts",
|
|
57
|
+
"**/*.tsx"
|
|
58
|
+
],
|
|
59
|
+
"parser": "@typescript-eslint/parser",
|
|
60
|
+
"extends": [
|
|
61
|
+
"plugin:@typescript-eslint/recommended"
|
|
62
|
+
],
|
|
63
|
+
"rules": {
|
|
64
|
+
"no-empty": [
|
|
65
|
+
"warn",
|
|
66
|
+
{
|
|
67
|
+
"allowEmptyCatch": true
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"brace-style": "off",
|
|
71
|
+
"@typescript-eslint/brace-style": [
|
|
72
|
+
"warn"
|
|
73
|
+
],
|
|
74
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
75
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
76
|
+
"@typescript-eslint/no-warning-comments": "off",
|
|
77
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
78
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
79
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
80
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
81
|
+
"@typescript-eslint/ban-types": "off",
|
|
82
|
+
"@typescript-eslint/camelcase": "off",
|
|
83
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
84
|
+
"node/no-missing-import": "off",
|
|
85
|
+
"node/no-empty-function": "off",
|
|
86
|
+
"node/no-unpublished-import": "off",
|
|
87
|
+
"node/no-unsupported-features/es-syntax": "off",
|
|
88
|
+
"node/no-missing-require": "off",
|
|
89
|
+
"node/shebang": "off",
|
|
90
|
+
"no-dupe-class-members": "off",
|
|
91
|
+
"require-atomic-updates": "off",
|
|
92
|
+
"node/no-extraneous-import": "off",
|
|
93
|
+
/* https://eslint.org/docs/rules/no-process-exit */
|
|
94
|
+
"no-process-exit": "error",
|
|
95
|
+
"indent": [
|
|
96
|
+
"error",
|
|
97
|
+
"tab",
|
|
98
|
+
{
|
|
99
|
+
"SwitchCase": 1
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"semi": [
|
|
103
|
+
"error",
|
|
104
|
+
"always"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"parserOptions": {
|
|
108
|
+
"ecmaVersion": 2020,
|
|
109
|
+
"sourceType": "module"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"ignorePatterns": [
|
|
114
|
+
"src/shared/*",
|
|
115
|
+
"build/*"
|
|
116
|
+
]
|
|
117
|
+
}
|
package/.eslintrc.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
3
|
"prettier",
|
|
4
|
-
"
|
|
4
|
+
"./.eslintConfig"
|
|
5
5
|
],
|
|
6
6
|
"plugins": [
|
|
7
7
|
"prettier"
|
|
8
8
|
],
|
|
9
9
|
"rules": {
|
|
10
|
-
|
|
10
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
11
11
|
"prettier/prettier": [
|
|
12
12
|
"error",
|
|
13
13
|
{
|
package/CHANGELOG.md
CHANGED
|
@@ -478,6 +478,7 @@ const ResourcesAPIGroup_2_0 = (instance) => {
|
|
|
478
478
|
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/locales/${localeId}/yesnointents`, "GET", self)(args, options);
|
|
479
479
|
},
|
|
480
480
|
trainYesNoIntents: ({ localeId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/locales/${localeId}/yesnointents/train`, "POST", self)(undefined, options),
|
|
481
|
+
trainYesNoIntentsProject: ({ projectId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/projects/${projectId}/locales/yesnointents/train`, "POST", self)(undefined, options),
|
|
481
482
|
updateYesNoIntents: (_a, options) => {
|
|
482
483
|
var { localeId, intentId } = _a, args = __rest(_a, ["localeId", "intentId"]);
|
|
483
484
|
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/locales/${localeId}/yesnointents/${intentId}`, "PATCH", self)(args, options);
|
|
@@ -506,7 +507,15 @@ const ResourcesAPIGroup_2_0 = (instance) => {
|
|
|
506
507
|
testTranslationSettings: (_a, options) => {
|
|
507
508
|
var { projectId } = _a, args = __rest(_a, ["projectId"]);
|
|
508
509
|
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/projects/${projectId}/settings/translation/test`, "POST", self)(args, options);
|
|
509
|
-
}
|
|
510
|
+
},
|
|
511
|
+
indexAgentAssistConfigs: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/agentassistconfigs?${(0, query_1.stringifyQuery)(args)}`, "GET", self)(undefined, options),
|
|
512
|
+
createAgentAssistConfig: (args, options) => (0, GenericAPIFn_1.GenericAPIFn)("/new/v2.0/agentassistconfigs", "POST", self)(args, options),
|
|
513
|
+
readAgentAssistConfig: ({ configId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/agentassistconfigs/${configId}`, "GET", self)(undefined, options),
|
|
514
|
+
updateAgentAssistConfig: (_a, options) => {
|
|
515
|
+
var { configId } = _a, args = __rest(_a, ["configId"]);
|
|
516
|
+
return (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/agentassistconfigs/${configId}`, "PATCH", self)(args, options);
|
|
517
|
+
},
|
|
518
|
+
deleteAgentAssistConfig: ({ configId }, options) => (0, GenericAPIFn_1.GenericAPIFn)(`/new/v2.0/agentassistconfigs/${configId}`, "DELETE", self)(undefined, options)
|
|
510
519
|
};
|
|
511
520
|
};
|
|
512
521
|
exports.ResourcesAPIGroup_2_0 = ResourcesAPIGroup_2_0;
|
|
@@ -18,6 +18,13 @@ exports.ALL_FIELDS = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
18
18
|
description: "Lorem Ipsum Dolor Sit Amet lkj afsdlkj dfsalkj;sdf alkjdfs lkjdf salkjdf slkj; sdflkjsdf lkj;sd flkjdf sljksdf alk;j adsjlk; sdflkj;sdf lkj; fsadlkjsdflk;jsdf alkj; sdflkj;d sflk;j sdflkj;sdf lkj;",
|
|
19
19
|
params: { required: true },
|
|
20
20
|
},
|
|
21
|
+
{
|
|
22
|
+
key: "adaptivecard",
|
|
23
|
+
type: "adaptivecard",
|
|
24
|
+
label: "Adaptive Card",
|
|
25
|
+
description: "Create an Adaptive Card using this JSON editor",
|
|
26
|
+
defaultValue: '{"$schema":"http://adaptivecards.io/schemas/adaptive-card.json","type":"AdaptiveCard","version":"1.0","body":[]}'
|
|
27
|
+
},
|
|
21
28
|
{
|
|
22
29
|
key: "date",
|
|
23
30
|
type: "date",
|
|
@@ -192,6 +199,7 @@ exports.ALL_FIELDS = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
192
199
|
],
|
|
193
200
|
form: [
|
|
194
201
|
{ type: "field", key: "text" },
|
|
202
|
+
{ type: "field", key: "adaptivecard" },
|
|
195
203
|
{ type: "field", key: "select" },
|
|
196
204
|
{ type: "section", key: "dateFields" },
|
|
197
205
|
{ type: "section", key: "codeEditors" },
|
|
@@ -11,8 +11,8 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
|
11
11
|
*/
|
|
12
12
|
exports.GET_APP_SESSION_PIN = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
13
13
|
type: "getAppSessionPin",
|
|
14
|
-
defaultLabel: "Get
|
|
15
|
-
summary: "Get a new
|
|
14
|
+
defaultLabel: "Get xApp Session PIN",
|
|
15
|
+
summary: "Get a new xApp Session PIN.",
|
|
16
16
|
appearance: {
|
|
17
17
|
showIcon: false,
|
|
18
18
|
},
|
|
@@ -21,17 +21,17 @@ exports.GET_APP_SESSION_PIN = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
21
21
|
tokens: [
|
|
22
22
|
{
|
|
23
23
|
type: "input",
|
|
24
|
-
label: "
|
|
25
|
-
script: "input.
|
|
24
|
+
label: "xApp Session PIN",
|
|
25
|
+
script: "input.apps.session.pin || ''"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
type: "input",
|
|
29
|
-
label: "
|
|
29
|
+
label: "xApp PIN Page URL",
|
|
30
30
|
script: `
|
|
31
31
|
(() => {
|
|
32
|
-
if (!input.
|
|
33
|
-
const overrides = input.
|
|
34
|
-
return [input.
|
|
32
|
+
if (!input.apps.baseUrl) return '';
|
|
33
|
+
const overrides = input.apps.customization ? \`?overrides=\${encodeURIComponent(JSON.stringify(input.apps.customization))}\` : '';
|
|
34
|
+
return [input.apps.baseUrl, overrides].join('');
|
|
35
35
|
})()`
|
|
36
36
|
.split("\n")
|
|
37
37
|
.join(" "),
|
|
@@ -40,7 +40,7 @@ exports.GET_APP_SESSION_PIN = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
40
40
|
function: async ({ cognigy }) => {
|
|
41
41
|
const { api } = cognigy;
|
|
42
42
|
const appSessionPin = await api.getAppSessionPin();
|
|
43
|
-
api.addToInput("
|
|
43
|
+
api.addToInput("apps.session.pin", appSessionPin);
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
46
|
//# sourceMappingURL=getAppSessionPin.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.INIT_APP_SESSION = void 0;
|
|
4
4
|
/* Custom modules */
|
|
5
5
|
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
6
|
+
const buildAppUrl_1 = require("./utils/buildAppUrl");
|
|
6
7
|
/**
|
|
7
8
|
* Node name: 'initAppSession'
|
|
8
9
|
*
|
|
@@ -11,8 +12,8 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
|
11
12
|
*/
|
|
12
13
|
exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
13
14
|
type: "initAppSession",
|
|
14
|
-
defaultLabel: "Init
|
|
15
|
-
summary: "Initializes a new
|
|
15
|
+
defaultLabel: "Init xApp Session",
|
|
16
|
+
summary: "Initializes a new xApp Session.",
|
|
16
17
|
appearance: {
|
|
17
18
|
showIcon: false,
|
|
18
19
|
},
|
|
@@ -68,7 +69,7 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
68
69
|
type: "cognigyText",
|
|
69
70
|
key: "pinEnterPinText",
|
|
70
71
|
label: "'Enter PIN' Text",
|
|
71
|
-
description: "This text asks the user to enter the
|
|
72
|
+
description: "This text asks the user to enter the xApp Session PIN.",
|
|
72
73
|
},
|
|
73
74
|
{
|
|
74
75
|
type: "cognigyText",
|
|
@@ -88,20 +89,26 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
88
89
|
key: "appSectionDescription",
|
|
89
90
|
label: " ",
|
|
90
91
|
params: {
|
|
91
|
-
text: "This section is used to customize content related to the '
|
|
92
|
+
text: "This section is used to customize content related to the 'xApp Screen' sections (Active xApp + xApp Overrides).",
|
|
92
93
|
},
|
|
93
94
|
},
|
|
94
95
|
{
|
|
95
96
|
type: "cognigyText",
|
|
96
97
|
key: "appLoadingText",
|
|
97
98
|
label: "'Loading' Text",
|
|
98
|
-
description: "This text is shown on the 'Loading Screen' when an
|
|
99
|
+
description: "This text is shown on the 'Loading Screen' when an xApp Page is launched.",
|
|
99
100
|
},
|
|
100
101
|
{
|
|
101
102
|
type: "cognigyText",
|
|
102
103
|
key: "appLaunchErrorText",
|
|
103
104
|
label: "'Launch Error' Text",
|
|
104
|
-
description: "This text is shown when an
|
|
105
|
+
description: "This text is shown when an xApp Page fails to load for any reason.",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "cognigyText",
|
|
109
|
+
key: "appErrorText",
|
|
110
|
+
label: "'xApp Error' Text",
|
|
111
|
+
description: "This text is shown when an xApp Page encounters an Error and is halted.",
|
|
105
112
|
},
|
|
106
113
|
// Intermediate Screen
|
|
107
114
|
{
|
|
@@ -127,7 +134,7 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
127
134
|
value: "override",
|
|
128
135
|
},
|
|
129
136
|
{
|
|
130
|
-
label: "Replace with
|
|
137
|
+
label: "Replace with xApp",
|
|
131
138
|
value: "app",
|
|
132
139
|
},
|
|
133
140
|
],
|
|
@@ -150,8 +157,8 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
150
157
|
{
|
|
151
158
|
type: "cognigyText",
|
|
152
159
|
key: "intermediateScreenAppTemplateId",
|
|
153
|
-
label: "
|
|
154
|
-
description: "Select which
|
|
160
|
+
label: "xApp Template",
|
|
161
|
+
description: "Select which xApp Template should be used to replace the intermediate screen",
|
|
155
162
|
defaultValue: "",
|
|
156
163
|
condition: {
|
|
157
164
|
key: "intermediateScreenCustomizationType",
|
|
@@ -164,8 +171,8 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
164
171
|
{
|
|
165
172
|
type: "json",
|
|
166
173
|
key: "intermediateScreenAppTemplateData",
|
|
167
|
-
label: "
|
|
168
|
-
description: "Select which data should be provided to the
|
|
174
|
+
label: "xApp Template Data",
|
|
175
|
+
description: "Select which data should be provided to the xApp Template which replaces the intermediate screen",
|
|
169
176
|
defaultValue: "{}",
|
|
170
177
|
condition: {
|
|
171
178
|
key: "intermediateScreenCustomizationType",
|
|
@@ -196,7 +203,7 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
196
203
|
value: "override",
|
|
197
204
|
},
|
|
198
205
|
{
|
|
199
|
-
label: "Replace with
|
|
206
|
+
label: "Replace with xApp",
|
|
200
207
|
value: "app",
|
|
201
208
|
},
|
|
202
209
|
],
|
|
@@ -241,8 +248,8 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
241
248
|
{
|
|
242
249
|
type: "cognigyText",
|
|
243
250
|
key: "connectionScreenAppTemplateId",
|
|
244
|
-
label: "
|
|
245
|
-
description: "Select which
|
|
251
|
+
label: "xApp Template",
|
|
252
|
+
description: "Select which xApp Template should be used to replace the connection screen",
|
|
246
253
|
defaultValue: "",
|
|
247
254
|
condition: {
|
|
248
255
|
key: "connectionScreenCustomizationType",
|
|
@@ -255,22 +262,14 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
255
262
|
{
|
|
256
263
|
type: "json",
|
|
257
264
|
key: "connectionScreenAppTemplateData",
|
|
258
|
-
label: "
|
|
259
|
-
description: "Select which data should be provided to the
|
|
265
|
+
label: "xApp Template Data",
|
|
266
|
+
description: "Select which data should be provided to the xApp Template which replaces the connection screen",
|
|
260
267
|
defaultValue: "{}",
|
|
261
268
|
condition: {
|
|
262
269
|
key: "connectionScreenCustomizationType",
|
|
263
270
|
value: "app",
|
|
264
271
|
},
|
|
265
272
|
},
|
|
266
|
-
// OTHER
|
|
267
|
-
{
|
|
268
|
-
type: "cognigyText",
|
|
269
|
-
label: "App Shell Page Base URL",
|
|
270
|
-
description: "This field exists during development until this value is automatically assigned",
|
|
271
|
-
defaultValue: "http://static.test/",
|
|
272
|
-
key: "shellPageBaseURL",
|
|
273
|
-
},
|
|
274
273
|
],
|
|
275
274
|
sections: [
|
|
276
275
|
{
|
|
@@ -292,9 +291,9 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
292
291
|
defaultCollapsed: false,
|
|
293
292
|
},
|
|
294
293
|
{
|
|
295
|
-
label: "
|
|
294
|
+
label: "xApp Screens",
|
|
296
295
|
key: "appScreensSection",
|
|
297
|
-
fields: ["appLoadingText", "appLaunchErrorText"],
|
|
296
|
+
fields: ["appLoadingText", "appLaunchErrorText", "appErrorText"],
|
|
298
297
|
defaultCollapsed: false,
|
|
299
298
|
},
|
|
300
299
|
{
|
|
@@ -345,43 +344,25 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
345
344
|
type: "section",
|
|
346
345
|
key: "connectionScreenSection",
|
|
347
346
|
},
|
|
348
|
-
{
|
|
349
|
-
type: "field",
|
|
350
|
-
key: "shellPageBaseURL",
|
|
351
|
-
},
|
|
352
347
|
],
|
|
353
348
|
tags: ["basic", "apps"],
|
|
354
349
|
tokens: [
|
|
355
350
|
{
|
|
356
351
|
type: "input",
|
|
357
|
-
label: "
|
|
358
|
-
script: "input.
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
type: "input",
|
|
362
|
-
label: "App Session URL",
|
|
363
|
-
script: `
|
|
364
|
-
(() => {
|
|
365
|
-
if (!input.shellPageBaseURL) return '';
|
|
366
|
-
if (!input.appSessionToken) return '';
|
|
367
|
-
const overrides = input.shellPageOverrides ? \`&overrides=\${encodeURIComponent(JSON.stringify(input.shellPageOverrides))}\` : '';
|
|
368
|
-
return [input.shellPageBaseURL, '?token=', input.appSessionToken, overrides].join('');
|
|
369
|
-
})()`
|
|
370
|
-
.split("\n")
|
|
371
|
-
.join(" "),
|
|
352
|
+
label: "xApp Session URL",
|
|
353
|
+
script: "input.apps.url || ''"
|
|
372
354
|
},
|
|
373
355
|
],
|
|
374
356
|
function: async ({ cognigy, config }) => {
|
|
357
|
+
var _a;
|
|
375
358
|
const { api, input } = cognigy;
|
|
376
359
|
const {
|
|
377
|
-
// general
|
|
378
|
-
shellPageBaseURL,
|
|
379
360
|
// styling
|
|
380
361
|
backgroundColor, textColor, errorTextColor, logo, logoUrl,
|
|
381
362
|
// pin screen
|
|
382
363
|
pinEnterPinText, pinIncorrectText, pinUnavailableText,
|
|
383
364
|
// apps screen
|
|
384
|
-
appLoadingText, appLaunchErrorText,
|
|
365
|
+
appLoadingText, appLaunchErrorText, appErrorText,
|
|
385
366
|
// intermediate screen
|
|
386
367
|
intermediateScreenCustomizationType, intermediateScreenOverrideText, intermediateScreenAppTemplateId, intermediateScreenAppTemplateData,
|
|
387
368
|
// status screen
|
|
@@ -420,6 +401,7 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
420
401
|
const appScreenCustomization = {
|
|
421
402
|
loadingText: appLoadingText,
|
|
422
403
|
launchErrorText: appLaunchErrorText,
|
|
404
|
+
appErrorText: appErrorText,
|
|
423
405
|
};
|
|
424
406
|
const intermediateScreenCustomization = (() => {
|
|
425
407
|
switch (intermediateScreenCustomizationType) {
|
|
@@ -477,12 +459,13 @@ exports.INIT_APP_SESSION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
477
459
|
appScreen: appScreenCustomization,
|
|
478
460
|
};
|
|
479
461
|
})();
|
|
480
|
-
if (!input.
|
|
481
|
-
const appSessionToken = await api.initAppSession(
|
|
482
|
-
api.addToInput("
|
|
462
|
+
if (!input.apps.session.token) {
|
|
463
|
+
const appSessionToken = await api.initAppSession();
|
|
464
|
+
api.addToInput("apps.session.token", appSessionToken);
|
|
483
465
|
}
|
|
484
|
-
|
|
485
|
-
api.addToInput("
|
|
466
|
+
const finalUrl = (0, buildAppUrl_1.buildAppUrl)(input.apps.baseUrl, (_a = input.apps.session) === null || _a === void 0 ? void 0 : _a.token, customization);
|
|
467
|
+
api.addToInput("apps.url", finalUrl);
|
|
468
|
+
api.addToInput("apps.customization", customization || null);
|
|
486
469
|
},
|
|
487
470
|
});
|
|
488
471
|
//# sourceMappingURL=initAppSession.js.map
|
|
@@ -11,8 +11,8 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
|
11
11
|
*/
|
|
12
12
|
exports.SET_ADAPTIVE_CARD_APP_STATE = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
13
13
|
type: "setAdaptiveCardAppState",
|
|
14
|
-
defaultLabel: "Set AdaptiveCard
|
|
15
|
-
summary: "Shows an AdaptiveCard via an
|
|
14
|
+
defaultLabel: "Set AdaptiveCard xApp State",
|
|
15
|
+
summary: "Shows an AdaptiveCard via an xApp",
|
|
16
16
|
appearance: {
|
|
17
17
|
showIcon: false,
|
|
18
18
|
},
|
|
@@ -38,14 +38,6 @@ exports.SET_ADAPTIVE_CARD_APP_STATE = (0, createNodeDescriptor_1.createNodeDescr
|
|
|
38
38
|
description: "Alters the color of text that is rendered on the 'Primary Color' (e.g. button labels). Has to be a CSS-compatible color",
|
|
39
39
|
defaultValue: "",
|
|
40
40
|
},
|
|
41
|
-
// OTHER
|
|
42
|
-
{
|
|
43
|
-
type: "cognigyText",
|
|
44
|
-
label: "AdaptiveCard Template URL",
|
|
45
|
-
description: "This field exists during development until this value is automatically assigned",
|
|
46
|
-
defaultValue: "http://static.test/apps/adaptivecards/",
|
|
47
|
-
key: "appTemplateURL",
|
|
48
|
-
},
|
|
49
41
|
],
|
|
50
42
|
sections: [
|
|
51
43
|
{
|
|
@@ -58,17 +50,12 @@ exports.SET_ADAPTIVE_CARD_APP_STATE = (0, createNodeDescriptor_1.createNodeDescr
|
|
|
58
50
|
form: [
|
|
59
51
|
{ type: "field", key: "card" },
|
|
60
52
|
{ type: "section", key: "overrideSection" },
|
|
61
|
-
{ type: "field", key: "appTemplateURL" },
|
|
62
53
|
],
|
|
63
54
|
tags: ["basic", "apps"],
|
|
64
55
|
function: async ({ cognigy, config }) => {
|
|
65
|
-
const { api } = cognigy;
|
|
66
|
-
const { card, primaryColor, primaryContrastColor,
|
|
67
|
-
const appTemplateURL =
|
|
68
|
-
if (!!_appTemplateURL)
|
|
69
|
-
return _appTemplateURL;
|
|
70
|
-
return "http://static.test/apps/adaptivecards/";
|
|
71
|
-
})();
|
|
56
|
+
const { api, input } = cognigy;
|
|
57
|
+
const { card, primaryColor, primaryContrastColor, } = config;
|
|
58
|
+
const appTemplateURL = `${input.apps.baseUrl}/apps/adaptivecards/`;
|
|
72
59
|
api.setAppState(appTemplateURL, {
|
|
73
60
|
card,
|
|
74
61
|
primaryColor: primaryColor || undefined,
|
|
@@ -11,8 +11,8 @@ const createNodeDescriptor_1 = require("../../createNodeDescriptor");
|
|
|
11
11
|
*/
|
|
12
12
|
exports.SET_APP_STATE = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
13
13
|
type: "setAppState",
|
|
14
|
-
defaultLabel: "Set
|
|
15
|
-
summary: "Set the state of an
|
|
14
|
+
defaultLabel: "Set xApp State",
|
|
15
|
+
summary: "Set the state of an xApp Template.",
|
|
16
16
|
appearance: {
|
|
17
17
|
showIcon: false,
|
|
18
18
|
},
|
|
@@ -20,8 +20,8 @@ exports.SET_APP_STATE = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
20
20
|
{
|
|
21
21
|
key: "appTemplateId",
|
|
22
22
|
type: "cognigyText",
|
|
23
|
-
label: "
|
|
24
|
-
description: "Select which
|
|
23
|
+
label: "xApp Template",
|
|
24
|
+
description: "Select which xApp Template should be used",
|
|
25
25
|
params: {
|
|
26
26
|
required: true,
|
|
27
27
|
},
|
|
@@ -29,8 +29,8 @@ exports.SET_APP_STATE = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
29
29
|
{
|
|
30
30
|
key: "appTemplateData",
|
|
31
31
|
type: "json",
|
|
32
|
-
label: "
|
|
33
|
-
description: "Select which data should be provided to the
|
|
32
|
+
label: "xApp Template Data",
|
|
33
|
+
description: "Select which data should be provided to the xApp Template",
|
|
34
34
|
defaultValue: "{}",
|
|
35
35
|
},
|
|
36
36
|
],
|
|
@@ -7,7 +7,7 @@ const getEasyHtmlValue = (body) => `<!DOCTYPE html>
|
|
|
7
7
|
<html lang="en">
|
|
8
8
|
<head>
|
|
9
9
|
<script>
|
|
10
|
-
var
|
|
10
|
+
var c=Object.defineProperty;var u=(a,e,t)=>e in a?c(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var s=(a,e,t)=>(u(a,typeof e!="symbol"?e+"":e,t),t);const h=a=>({__INTER_FRAME_SOCKET_MESSAGE:!0,appEvent:a}),l=(a,e)=>({type:a,payload:e}),p=a=>{var e;return!!((e=a.data)!=null&&e.__INTER_FRAME_SOCKET_MESSAGE)};class m{constructor(e,t){s(this,"unsubscribers",new Set);s(this,"emit",(e,t)=>{const i=l(e,t),n=h(i);this.targetWindow.postMessage(n,"*")});s(this,"on",(e,t)=>{const i=r=>{if(r.source===this.targetWindow&&!!p(r)&&r.data.appEvent.type===e)try{t(r.data.appEvent)}catch{}};this.sourceWindow.addEventListener("message",i);const n=()=>{this.sourceWindow.removeEventListener("message",i),this.unsubscribers.delete(n)};return this.unsubscribers.add(n),n});s(this,"once",(e,t)=>{const i=this.on(e,n=>{t(n),i()});return i});s(this,"cleanup",()=>{for(const e of this.unsubscribers)e()});this.sourceWindow=e,this.targetWindow=t}}class o{constructor(){s(this,"appTemplateData");s(this,"_ready",!1);s(this,"_loaded",!1);s(this,"_customReadyCheckRequested",!1);s(this,"_customReadyCheckDone",!1);s(this,"_appTemplateDataInitialized",!1);s(this,"socket",new m(window,window.parent));s(this,"sendReady",()=>{this._ready||(this.socket.emit("ready"),o.log("ready!"),this._ready=!0)});s(this,"doReadinessCheck",()=>{if(!this._ready){if(!this._appTemplateDataInitialized){o.log("not yet ready: initial app template data missing");return}if(!this._customReadyCheckRequested&&!this._loaded){o.log("not yet ready: page not loaded, yet");return}if(this._customReadyCheckRequested&&!this._customReadyCheckDone){o.log("not yet ready: custom readiness check not called");return}this.sendReady()}});s(this,"getCustomReadyHandler",()=>(o.log("switching to 'manual ready check'"),this._customReadyCheckRequested=!0,()=>{o.log("'manual ready check' done"),this._customReadyCheckDone=!0,this.doReadinessCheck()}));s(this,"onAppTemplateData",e=>this.socket.on("appTemplateData",t=>{e(t.payload)}));s(this,"getAppTemplateData",async()=>this._appTemplateDataInitialized?this.appTemplateData:new Promise(e=>{const t=this.onAppTemplateData(i=>{t(),e(i)})}));s(this,"submit",e=>new Promise((t,i)=>{const n=[],r=()=>{n.forEach(d=>{d()})};n.push(this.socket.once("submit-accepted",()=>{r(),t()})),n.push(this.socket.once("submit-rejected",()=>{r(),i()})),this.socket.emit("submit",e)}));window.addEventListener("load",()=>{this._loaded=!0,this.doReadinessCheck()}),this.onAppTemplateData(e=>{this._appTemplateDataInitialized=!0,this.appTemplateData=e,o.log("received data from shell page",e),this.doReadinessCheck()}),this.socket.emit("sdk-loaded"),o.log("initialized")}static log(...e){console.log("[AppPageSDK]",...e)}}window.SDK=new o;
|
|
11
11
|
</script>
|
|
12
12
|
<script>
|
|
13
13
|
window.addEventListener("load", () => {
|
|
@@ -46,8 +46,8 @@ const defaultFullHTMLDocument = getEasyHtmlValue("");
|
|
|
46
46
|
*/
|
|
47
47
|
exports.SET_HTML_APP_STATE = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
48
48
|
type: "setHTMLAppState",
|
|
49
|
-
defaultLabel: "Set HTML
|
|
50
|
-
summary: "Set the HTML Code of a Generic HTML
|
|
49
|
+
defaultLabel: "Set HTML xApp State",
|
|
50
|
+
summary: "Set the HTML Code of a Generic HTML xApp.",
|
|
51
51
|
appearance: {
|
|
52
52
|
showIcon: false,
|
|
53
53
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAppUrl = void 0;
|
|
4
|
+
function buildAppUrl(baseUrl, appSessionToken, customization) {
|
|
5
|
+
let finalUrl = `${baseUrl}?token=${appSessionToken}`;
|
|
6
|
+
if (customization) {
|
|
7
|
+
finalUrl = `${finalUrl}&overrides=${encodeURIComponent(JSON.stringify(customization))}`;
|
|
8
|
+
}
|
|
9
|
+
return finalUrl;
|
|
10
|
+
}
|
|
11
|
+
exports.buildAppUrl = buildAppUrl;
|
|
12
|
+
//# sourceMappingURL=buildAppUrl.js.map
|
|
@@ -189,11 +189,12 @@ exports.SWITCH = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
const matchedCase = children === null || children === void 0 ? void 0 : children.find((child) => {
|
|
192
|
+
var _a, _b;
|
|
192
193
|
if (child.type !== "case") {
|
|
193
194
|
return;
|
|
194
195
|
}
|
|
195
196
|
if (useStrict) {
|
|
196
|
-
return api.parseCognigyScriptText(`${child.config.case.value}`) === parsedOperator;
|
|
197
|
+
return api.parseCognigyScriptText(`${(_a = child.config.case.value) === null || _a === void 0 ? void 0 : _a.trim()}`) === parsedOperator;
|
|
197
198
|
}
|
|
198
199
|
else {
|
|
199
200
|
/**
|
|
@@ -203,7 +204,7 @@ exports.SWITCH = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
203
204
|
* operator is a number. We do not support switching on
|
|
204
205
|
* objects
|
|
205
206
|
*/
|
|
206
|
-
return `${api.parseCognigyScriptText(`${child.config.case.value}`)}` === `${parsedOperator}`;
|
|
207
|
+
return `${api.parseCognigyScriptText(`${(_b = child.config.case.value) === null || _b === void 0 ? void 0 : _b.trim()}`)}` === `${parsedOperator}`;
|
|
207
208
|
}
|
|
208
209
|
});
|
|
209
210
|
if (matchedCase) {
|
|
@@ -77,11 +77,15 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
77
77
|
label: "Regex",
|
|
78
78
|
value: "regex",
|
|
79
79
|
},
|
|
80
|
+
process.env.FEATURE_USE_COGNIGY_APPS && {
|
|
81
|
+
label: "xApp",
|
|
82
|
+
value: "app",
|
|
83
|
+
},
|
|
80
84
|
{
|
|
81
85
|
label: "Data",
|
|
82
86
|
value: "data",
|
|
83
87
|
},
|
|
84
|
-
],
|
|
88
|
+
].filter(option => !!option),
|
|
85
89
|
},
|
|
86
90
|
defaultValue: "yesNo",
|
|
87
91
|
},
|
|
@@ -275,6 +279,9 @@ exports.OPTIONAL_QUESTION = (0, createNodeDescriptor_1.createNodeDescriptor)({
|
|
|
275
279
|
condition = (usePositiveOnly) ? `input.slots['${keyphraseTag}'] && !!input.slots['${keyphraseTag}'].find(k => k.neg === false)` : `!!input.slots['${keyphraseTag}']`;
|
|
276
280
|
break;
|
|
277
281
|
}
|
|
282
|
+
case "app": {
|
|
283
|
+
condition = `input.data?._cognigy?._app?.type === "submit"`;
|
|
284
|
+
}
|
|
278
285
|
}
|
|
279
286
|
const addConditionalEntrypointParams = {
|
|
280
287
|
entrypoint: nodeId,
|