@telia-ace/knowledge-widget-bot-provider 0.0.1-alpha.3 → 0.0.1-alpha.30

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.
Files changed (129) hide show
  1. package/LICENSE.txt +5 -5
  2. package/README.md +12 -12
  3. package/lib/client/chat.client.d.ts +16 -15
  4. package/lib/client/chat.client.js +79 -80
  5. package/lib/client/contact-method.client.d.ts +25 -22
  6. package/lib/client/contact-method.client.js +283 -276
  7. package/lib/client/http.client.d.ts +23 -22
  8. package/lib/client/http.client.js +115 -115
  9. package/lib/client/middleware.client.d.ts +14 -13
  10. package/lib/client/middleware.client.js +104 -60
  11. package/lib/contract/custom-component/contact-method-item.d.ts +8 -8
  12. package/lib/contract/custom-component/contact-method-item.js +54 -76
  13. package/lib/contract/custom-component/contact-method-list.d.ts +7 -7
  14. package/lib/contract/custom-component/contact-method-list.js +13 -41
  15. package/lib/contract/custom-component/contact-method.d.ts +3 -3
  16. package/lib/contract/custom-component/contact-method.js +34 -38
  17. package/lib/contract/enum/server-entry-type.enum.d.ts +7 -6
  18. package/lib/contract/enum/server-entry-type.enum.js +8 -10
  19. package/lib/contract/model/conversation-api-model/list.model.d.ts +5 -5
  20. package/lib/contract/model/conversation-api-model/list.model.js +0 -2
  21. package/lib/contract/model/conversation-api-model/message.model.d.ts +7 -7
  22. package/lib/contract/model/conversation-api-model/message.model.js +0 -2
  23. package/lib/contract/model/http/action.model.d.ts +3 -3
  24. package/lib/contract/model/http/action.model.js +0 -2
  25. package/lib/contract/model/http/client-action.model.d.ts +4 -4
  26. package/lib/contract/model/http/client-action.model.js +1 -3
  27. package/lib/contract/model/http/client-envelope.model.d.ts +9 -9
  28. package/lib/contract/model/http/client-envelope.model.js +0 -2
  29. package/lib/contract/model/http/connect-options.model.d.ts +5 -5
  30. package/lib/contract/model/http/connect-options.model.js +0 -2
  31. package/lib/contract/model/http/global-state.model.d.ts +8 -8
  32. package/lib/contract/model/http/global-state.model.js +0 -2
  33. package/lib/contract/model/http/http-client-options.model.d.ts +5 -5
  34. package/lib/contract/model/http/http-client-options.model.js +0 -2
  35. package/lib/contract/model/http/server-entry.model.d.ts +11 -11
  36. package/lib/contract/model/http/server-entry.model.js +0 -2
  37. package/lib/contract/model/http/server-envelope.model.d.ts +10 -10
  38. package/lib/contract/model/http/server-envelope.model.js +0 -2
  39. package/lib/contract/model/middleware/aggregator-state.model.d.ts +4 -4
  40. package/lib/contract/model/middleware/aggregator-state.model.js +1 -3
  41. package/lib/contract/model/shared/loose-object.model.d.ts +3 -3
  42. package/lib/contract/model/shared/loose-object.model.js +0 -2
  43. package/lib/helper/chat.helper.d.ts +8 -8
  44. package/lib/helper/chat.helper.js +18 -21
  45. package/lib/helper/http.helper.d.ts +13 -13
  46. package/lib/helper/http.helper.js +28 -33
  47. package/lib/helper/middleware.helper.d.ts +12 -12
  48. package/lib/helper/middleware.helper.js +67 -72
  49. package/lib/helper/store.helper.d.ts +22 -22
  50. package/lib/helper/store.helper.js +77 -80
  51. package/lib/index.d.ts +2 -2
  52. package/lib/index.js +2 -8
  53. package/lib/interface/_mocked-contact-method.json +375 -0
  54. package/lib/interface/convert.d.ts +1 -0
  55. package/lib/interface/convert.js +68 -0
  56. package/lib/interface/entry.interface.d.ts +20 -17
  57. package/lib/interface/entry.interface.js +262 -139
  58. package/lib/interface/middleware/paging.interface.d.ts +4 -4
  59. package/lib/interface/middleware/paging.interface.js +53 -55
  60. package/lib/interface/middleware/processor.interface.d.ts +10 -10
  61. package/lib/interface/middleware/processor.interface.js +118 -120
  62. package/lib/plugin.d.ts +3 -3
  63. package/lib/plugin.js +139 -169
  64. package/lib-esm/client/chat.client.d.ts +16 -15
  65. package/lib-esm/client/chat.client.js +79 -75
  66. package/lib-esm/client/contact-method.client.d.ts +25 -22
  67. package/lib-esm/client/contact-method.client.js +283 -270
  68. package/lib-esm/client/http.client.d.ts +23 -22
  69. package/lib-esm/client/http.client.js +115 -109
  70. package/lib-esm/client/middleware.client.d.ts +14 -13
  71. package/lib-esm/client/middleware.client.js +104 -55
  72. package/lib-esm/contract/custom-component/contact-method-item.d.ts +8 -8
  73. package/lib-esm/contract/custom-component/contact-method-item.js +54 -51
  74. package/lib-esm/contract/custom-component/contact-method-list.d.ts +7 -7
  75. package/lib-esm/contract/custom-component/contact-method-list.js +13 -13
  76. package/lib-esm/contract/custom-component/contact-method.d.ts +3 -3
  77. package/lib-esm/contract/custom-component/contact-method.js +34 -33
  78. package/lib-esm/contract/enum/server-entry-type.enum.d.ts +7 -6
  79. package/lib-esm/contract/enum/server-entry-type.enum.js +8 -7
  80. package/lib-esm/contract/model/conversation-api-model/list.model.d.ts +5 -5
  81. package/lib-esm/contract/model/conversation-api-model/list.model.js +0 -1
  82. package/lib-esm/contract/model/conversation-api-model/message.model.d.ts +7 -7
  83. package/lib-esm/contract/model/conversation-api-model/message.model.js +0 -1
  84. package/lib-esm/contract/model/http/action.model.d.ts +3 -3
  85. package/lib-esm/contract/model/http/action.model.js +0 -1
  86. package/lib-esm/contract/model/http/client-action.model.d.ts +4 -4
  87. package/lib-esm/contract/model/http/client-action.model.js +1 -2
  88. package/lib-esm/contract/model/http/client-envelope.model.d.ts +9 -9
  89. package/lib-esm/contract/model/http/client-envelope.model.js +0 -1
  90. package/lib-esm/contract/model/http/connect-options.model.d.ts +5 -5
  91. package/lib-esm/contract/model/http/connect-options.model.js +0 -1
  92. package/lib-esm/contract/model/http/global-state.model.d.ts +8 -8
  93. package/lib-esm/contract/model/http/global-state.model.js +0 -1
  94. package/lib-esm/contract/model/http/http-client-options.model.d.ts +5 -5
  95. package/lib-esm/contract/model/http/http-client-options.model.js +0 -1
  96. package/lib-esm/contract/model/http/server-entry.model.d.ts +11 -11
  97. package/lib-esm/contract/model/http/server-entry.model.js +0 -1
  98. package/lib-esm/contract/model/http/server-envelope.model.d.ts +10 -10
  99. package/lib-esm/contract/model/http/server-envelope.model.js +0 -1
  100. package/lib-esm/contract/model/middleware/aggregator-state.model.d.ts +4 -4
  101. package/lib-esm/contract/model/middleware/aggregator-state.model.js +1 -2
  102. package/lib-esm/contract/model/shared/loose-object.model.d.ts +3 -3
  103. package/lib-esm/contract/model/shared/loose-object.model.js +0 -1
  104. package/lib-esm/helper/chat.helper.d.ts +8 -8
  105. package/lib-esm/helper/chat.helper.js +18 -18
  106. package/lib-esm/helper/http.helper.d.ts +13 -13
  107. package/lib-esm/helper/http.helper.js +28 -30
  108. package/lib-esm/helper/middleware.helper.d.ts +12 -12
  109. package/lib-esm/helper/middleware.helper.js +67 -69
  110. package/lib-esm/helper/store.helper.d.ts +22 -22
  111. package/lib-esm/helper/store.helper.js +77 -77
  112. package/lib-esm/index.d.ts +2 -2
  113. package/lib-esm/index.js +2 -2
  114. package/lib-esm/interface/_mocked-contact-method.json +375 -0
  115. package/lib-esm/interface/convert.d.ts +1 -0
  116. package/lib-esm/interface/convert.js +68 -0
  117. package/lib-esm/interface/entry.interface.d.ts +20 -17
  118. package/lib-esm/interface/entry.interface.js +262 -137
  119. package/lib-esm/interface/middleware/paging.interface.d.ts +4 -4
  120. package/lib-esm/interface/middleware/paging.interface.js +53 -53
  121. package/lib-esm/interface/middleware/processor.interface.d.ts +10 -10
  122. package/lib-esm/interface/middleware/processor.interface.js +118 -118
  123. package/lib-esm/plugin.d.ts +3 -3
  124. package/lib-esm/plugin.js +139 -141
  125. package/package.json +54 -45
  126. package/lib/interface/middleware/contact-expanded.interface.d.ts +0 -0
  127. package/lib/interface/middleware/contact-expanded.interface.js +0 -50
  128. package/lib/interface/middleware/legacy-contact-methods.interface.d.ts +0 -0
  129. package/lib/interface/middleware/legacy-contact-methods.interface.js +0 -394
@@ -1,22 +1,22 @@
1
- import { Message } from '../contract/model/conversation-api-model/message.model';
2
- import { ClientAction } from '../contract/model/http/client-action.model';
3
- import { GlobalState } from '../contract/model/http/global-state.model';
4
- import { ServerEntry } from '../contract/model/http/server-entry.model';
5
- import { LooseObject } from '../contract/model/shared/loose-object.model';
6
- export declare class StoreHelper {
7
- private static messageStore;
8
- private static globalState;
9
- constructor();
10
- static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any): void;
11
- private static insertMessageToStore;
12
- private static updateMessageInStore;
13
- static checkIdInMessageStore(id: string): boolean;
14
- static getLocalState(action: string): LooseObject | undefined;
15
- static getGlobalState(): GlobalState;
16
- static setGlobalState(state: GlobalState): void;
17
- static getAction(action: string): ClientAction;
18
- static getCommand(text: string): LooseObject;
19
- static getEntry(action: string): ServerEntry | undefined;
20
- static getMessage(id: string): Message | undefined;
21
- static getEntryStore(): ServerEntry[];
22
- }
1
+ import { Message } from '../contract/model/conversation-api-model/message.model';
2
+ import { ClientAction } from '../contract/model/http/client-action.model';
3
+ import { GlobalState } from '../contract/model/http/global-state.model';
4
+ import { ServerEntry } from '../contract/model/http/server-entry.model';
5
+ import { LooseObject } from '../contract/model/shared/loose-object.model';
6
+ export declare class StoreHelper {
7
+ private static messageStore;
8
+ private static globalState;
9
+ constructor();
10
+ static insertOrUpdateMessageArrayStore(messageArray: Message[], entry?: any): void;
11
+ private static insertMessageToStore;
12
+ private static updateMessageInStore;
13
+ static checkIdInMessageStore(id: string): boolean;
14
+ static getLocalState(action: string): LooseObject | undefined;
15
+ static getGlobalState(): GlobalState;
16
+ static setGlobalState(state: GlobalState): void;
17
+ static getAction(action: string): ClientAction;
18
+ static getCommand(text: string): LooseObject;
19
+ static getEntry(action: string): ServerEntry | undefined;
20
+ static getMessage(id: string): Message | undefined;
21
+ static getEntryStore(): ServerEntry[];
22
+ }
@@ -1,77 +1,77 @@
1
- import { MiddlewareHelper } from './middleware.helper';
2
- var StoreHelper = /** @class */ (function () {
3
- function StoreHelper() {
4
- StoreHelper.globalState = {
5
- completedInteractionsCount: 0,
6
- lastBotGuide: 0,
7
- site: 'https://localhost:8080/',
8
- invincibleParameters: {},
9
- };
10
- }
11
- StoreHelper.insertOrUpdateMessageArrayStore = function (messageArray, entry) {
12
- var _this = this;
13
- messageArray
14
- .filter(function (o) { return !!o; })
15
- .forEach(function (t) {
16
- if (!_this.messageStore.find(function (o) { return o.id == t.id; }))
17
- _this.insertMessageToStore(t);
18
- else {
19
- _this.updateMessageInStore(t, entry);
20
- }
21
- });
22
- MiddlewareHelper.setEntrySessionStorage(this.messageStore);
23
- };
24
- StoreHelper.insertMessageToStore = function (message) {
25
- this.messageStore.push(message);
26
- };
27
- StoreHelper.updateMessageInStore = function (message, entry) {
28
- message.conversationEntry = entry;
29
- var index = this.messageStore.findIndex(function (o) { return o.id == message.id; });
30
- this.messageStore[index] = message;
31
- };
32
- StoreHelper.checkIdInMessageStore = function (id) {
33
- return this.messageStore.find(function (o) { return o.id == id; }) === undefined;
34
- };
35
- StoreHelper.getLocalState = function (action) {
36
- var entry = this.getEntry(action);
37
- return entry === null || entry === void 0 ? void 0 : entry.localState;
38
- };
39
- StoreHelper.getGlobalState = function () {
40
- return StoreHelper.globalState;
41
- };
42
- StoreHelper.setGlobalState = function (state) {
43
- StoreHelper.globalState = state;
44
- };
45
- StoreHelper.getAction = function (action) {
46
- var entry = this.getEntry(action);
47
- return {
48
- key: action,
49
- content: entry === null || entry === void 0 ? void 0 : entry.actions[action],
50
- };
51
- };
52
- StoreHelper.getCommand = function (text) {
53
- return { phrase: text };
54
- };
55
- StoreHelper.getEntry = function (action) {
56
- var entry = undefined;
57
- this.getEntryStore().forEach(function (o) {
58
- if (o.actions[action]) {
59
- entry = o;
60
- }
61
- });
62
- return entry;
63
- };
64
- StoreHelper.getMessage = function (id) {
65
- return this.messageStore.find(function (o) { return o.id == id; });
66
- };
67
- StoreHelper.getEntryStore = function () {
68
- return this.messageStore
69
- .filter(function (o) { return !!o.entry; })
70
- .map(function (o) {
71
- return o.entry;
72
- });
73
- };
74
- StoreHelper.messageStore = [];
75
- return StoreHelper;
76
- }());
77
- export { StoreHelper };
1
+ import { MiddlewareHelper } from './middleware.helper';
2
+ var StoreHelper = /** @class */ (function () {
3
+ function StoreHelper() {
4
+ StoreHelper.globalState = {
5
+ completedInteractionsCount: 0,
6
+ lastBotGuide: 0,
7
+ site: 'https://localhost:8080/',
8
+ invincibleParameters: {},
9
+ };
10
+ }
11
+ StoreHelper.insertOrUpdateMessageArrayStore = function (messageArray, entry) {
12
+ var _this = this;
13
+ messageArray
14
+ .filter(function (o) { return !!o; })
15
+ .forEach(function (t) {
16
+ if (!_this.messageStore.find(function (o) { return o.id == t.id; }))
17
+ _this.insertMessageToStore(t);
18
+ else {
19
+ _this.updateMessageInStore(t, entry);
20
+ }
21
+ });
22
+ MiddlewareHelper.setEntrySessionStorage(this.messageStore);
23
+ };
24
+ StoreHelper.insertMessageToStore = function (message) {
25
+ this.messageStore.push(message);
26
+ };
27
+ StoreHelper.updateMessageInStore = function (message, entry) {
28
+ message.conversationEntry = entry;
29
+ var index = this.messageStore.findIndex(function (o) { return o.id == message.id; });
30
+ this.messageStore[index] = message;
31
+ };
32
+ StoreHelper.checkIdInMessageStore = function (id) {
33
+ return this.messageStore.find(function (o) { return o.id == id; }) === undefined;
34
+ };
35
+ StoreHelper.getLocalState = function (action) {
36
+ var entry = this.getEntry(action);
37
+ return entry === null || entry === void 0 ? void 0 : entry.localState;
38
+ };
39
+ StoreHelper.getGlobalState = function () {
40
+ return StoreHelper.globalState;
41
+ };
42
+ StoreHelper.setGlobalState = function (state) {
43
+ StoreHelper.globalState = state;
44
+ };
45
+ StoreHelper.getAction = function (action) {
46
+ var entry = this.getEntry(action);
47
+ return {
48
+ key: action,
49
+ content: entry === null || entry === void 0 ? void 0 : entry.actions[action],
50
+ };
51
+ };
52
+ StoreHelper.getCommand = function (text) {
53
+ return { phrase: text };
54
+ };
55
+ StoreHelper.getEntry = function (action) {
56
+ var entry = undefined;
57
+ this.getEntryStore().forEach(function (o) {
58
+ if (o.actions[action]) {
59
+ entry = o;
60
+ }
61
+ });
62
+ return entry;
63
+ };
64
+ StoreHelper.getMessage = function (id) {
65
+ return this.messageStore.find(function (o) { return o.id == id; });
66
+ };
67
+ StoreHelper.getEntryStore = function () {
68
+ return this.messageStore
69
+ .filter(function (o) { return !!o.entry; })
70
+ .map(function (o) {
71
+ return o.entry;
72
+ });
73
+ };
74
+ StoreHelper.messageStore = [];
75
+ return StoreHelper;
76
+ }());
77
+ export { StoreHelper };
@@ -1,2 +1,2 @@
1
- import ConversationPlugin from './plugin';
2
- export { ConversationPlugin };
1
+ import ConversationPlugin from './plugin';
2
+ export { ConversationPlugin };
package/lib-esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import ConversationPlugin from './plugin';
2
- export { ConversationPlugin };
1
+ import ConversationPlugin from './plugin';
2
+ export { ConversationPlugin };
@@ -0,0 +1,375 @@
1
+ {
2
+ "ContactMethod": {
3
+ "Form": {
4
+ "Groups": [
5
+ {
6
+ "Components": [
7
+ {
8
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
9
+ "Name": "customer-id",
10
+ "HasCustomName": false,
11
+ "Type": "text/number",
12
+ "Value": "",
13
+ "Constraints": {
14
+ "Required": true,
15
+ "Regex": null,
16
+ "VerifyValue": false
17
+ },
18
+ "HasDependencies": false,
19
+ "Title": "Customer ID",
20
+ "Description": null,
21
+ "Hints": [],
22
+ "Visible": true,
23
+ "VisibilityCriteria": {
24
+ "Value": true,
25
+ "Negated": true,
26
+ "Description": null,
27
+ "Criteria": [],
28
+ "Operator": "And"
29
+ },
30
+ "HasDependants": false
31
+ },
32
+ {
33
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormGroupComponent, Humany.KnowledgeBase",
34
+ "Children": [
35
+ {
36
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
37
+ "Name": "first-name",
38
+ "HasCustomName": false,
39
+ "Type": "text/sentence",
40
+ "Value": "",
41
+ "Constraints": {
42
+ "Required": false,
43
+ "Regex": null,
44
+ "VerifyValue": false
45
+ },
46
+ "HasDependencies": false,
47
+ "Title": "First name",
48
+ "Description": null,
49
+ "Hints": ["firstname", "verifyLabel=Confirm First name"],
50
+ "Visible": true,
51
+ "VisibilityCriteria": {
52
+ "Value": true,
53
+ "Negated": true,
54
+ "Description": null,
55
+ "Criteria": [],
56
+ "Operator": "And"
57
+ },
58
+ "HasDependants": false
59
+ },
60
+ {
61
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
62
+ "Name": "last-name",
63
+ "HasCustomName": false,
64
+ "Type": "text/sentence",
65
+ "Value": "",
66
+ "Constraints": {
67
+ "Required": false,
68
+ "Regex": null,
69
+ "VerifyValue": false
70
+ },
71
+ "HasDependencies": false,
72
+ "Title": "Last name",
73
+ "Description": null,
74
+ "Hints": ["lastname"],
75
+ "Visible": true,
76
+ "VisibilityCriteria": {
77
+ "Value": true,
78
+ "Negated": true,
79
+ "Description": null,
80
+ "Criteria": [],
81
+ "Operator": "And"
82
+ },
83
+ "HasDependants": false
84
+ }
85
+ ],
86
+ "Title": "Name",
87
+ "Description": null,
88
+ "Hints": ["fullname"],
89
+ "Visible": true,
90
+ "VisibilityCriteria": {
91
+ "Value": true,
92
+ "Negated": true,
93
+ "Description": null,
94
+ "Criteria": [],
95
+ "Operator": "And"
96
+ },
97
+ "HasDependants": false
98
+ },
99
+ {
100
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormChoiceComponent, Humany.KnowledgeBase",
101
+ "UseCustomValues": false,
102
+ "Options": [
103
+ {
104
+ "Title": "CheckBox 1",
105
+ "Value": "CheckBox 1",
106
+ "Selected": false
107
+ },
108
+ {
109
+ "Title": "CheckBox 2",
110
+ "Value": "CheckBox 2",
111
+ "Selected": false
112
+ }
113
+ ],
114
+ "Name": "checkboxes",
115
+ "HasCustomName": false,
116
+ "Type": "choice",
117
+ "Value": "",
118
+ "Constraints": {
119
+ "Required": true,
120
+ "Regex": null,
121
+ "VerifyValue": false
122
+ },
123
+ "HasDependencies": true,
124
+ "Title": "Checkboxes",
125
+ "Description": null,
126
+ "Hints": ["checkbox", "multiple"],
127
+ "Visible": true,
128
+ "VisibilityCriteria": {
129
+ "Value": true,
130
+ "Negated": true,
131
+ "Description": null,
132
+ "Criteria": [],
133
+ "Operator": "And"
134
+ },
135
+ "HasDependants": false
136
+ },
137
+ {
138
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormChoiceComponent, Humany.KnowledgeBase",
139
+ "UseCustomValues": false,
140
+ "Options": [
141
+ {
142
+ "Title": "Test 1",
143
+ "Value": "Test 1",
144
+ "Selected": false
145
+ },
146
+ {
147
+ "Title": "Test 2",
148
+ "Value": "Test 2",
149
+ "Selected": false
150
+ }
151
+ ],
152
+ "Name": "select-one",
153
+ "HasCustomName": false,
154
+ "Type": "choice",
155
+ "Value": "",
156
+ "Constraints": {
157
+ "Required": true,
158
+ "Regex": null,
159
+ "VerifyValue": false
160
+ },
161
+ "HasDependencies": true,
162
+ "Title": "Select one",
163
+ "Description": null,
164
+ "Hints": ["dropdown"],
165
+ "Visible": true,
166
+ "VisibilityCriteria": {
167
+ "Value": true,
168
+ "Negated": true,
169
+ "Description": null,
170
+ "Criteria": [],
171
+ "Operator": "And"
172
+ },
173
+ "HasDependants": false
174
+ },
175
+ {
176
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
177
+ "Name": "e-mail",
178
+ "HasCustomName": false,
179
+ "Type": "text/sentence",
180
+ "Value": "",
181
+ "Constraints": {
182
+ "Required": true,
183
+ "Regex": "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$",
184
+ "VerifyValue": false
185
+ },
186
+ "HasDependencies": false,
187
+ "Title": "E-mail",
188
+ "Description": null,
189
+ "Hints": ["email"],
190
+ "Visible": true,
191
+ "VisibilityCriteria": {
192
+ "Value": true,
193
+ "Negated": true,
194
+ "Description": null,
195
+ "Criteria": [],
196
+ "Operator": "And"
197
+ },
198
+ "HasDependants": false
199
+ },
200
+ {
201
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormGroupComponent, Humany.KnowledgeBase",
202
+ "Children": [
203
+ {
204
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
205
+ "Name": "street",
206
+ "HasCustomName": false,
207
+ "Type": "text/sentence",
208
+ "Value": "",
209
+ "Constraints": {
210
+ "Required": false,
211
+ "Regex": null,
212
+ "VerifyValue": false
213
+ },
214
+ "HasDependencies": false,
215
+ "Title": "Street",
216
+ "Description": null,
217
+ "Hints": ["street"],
218
+ "Visible": true,
219
+ "VisibilityCriteria": {
220
+ "Value": true,
221
+ "Negated": true,
222
+ "Description": null,
223
+ "Criteria": [],
224
+ "Operator": "And"
225
+ },
226
+ "HasDependants": false
227
+ },
228
+ {
229
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
230
+ "Name": "number",
231
+ "HasCustomName": false,
232
+ "Type": "text/word",
233
+ "Value": "",
234
+ "Constraints": {
235
+ "Required": false,
236
+ "Regex": null,
237
+ "VerifyValue": false
238
+ },
239
+ "HasDependencies": false,
240
+ "Title": "Number",
241
+ "Description": null,
242
+ "Hints": ["number"],
243
+ "Visible": true,
244
+ "VisibilityCriteria": {
245
+ "Value": true,
246
+ "Negated": true,
247
+ "Description": null,
248
+ "Criteria": [],
249
+ "Operator": "And"
250
+ },
251
+ "HasDependants": false
252
+ },
253
+ {
254
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
255
+ "Name": "postcode",
256
+ "HasCustomName": false,
257
+ "Type": "text/word",
258
+ "Value": "",
259
+ "Constraints": {
260
+ "Required": false,
261
+ "Regex": null,
262
+ "VerifyValue": false
263
+ },
264
+ "HasDependencies": false,
265
+ "Title": "Postcode",
266
+ "Description": null,
267
+ "Hints": ["zipcode"],
268
+ "Visible": true,
269
+ "VisibilityCriteria": {
270
+ "Value": true,
271
+ "Negated": true,
272
+ "Description": null,
273
+ "Criteria": [],
274
+ "Operator": "And"
275
+ },
276
+ "HasDependants": false
277
+ },
278
+ {
279
+ "$type": "Humany.KnowledgeBase.ContactMethods.FormTextComponent, Humany.KnowledgeBase",
280
+ "Name": "city",
281
+ "HasCustomName": false,
282
+ "Type": "text/sentence",
283
+ "Value": "",
284
+ "Constraints": {
285
+ "Required": false,
286
+ "Regex": null,
287
+ "VerifyValue": false
288
+ },
289
+ "HasDependencies": false,
290
+ "Title": "City",
291
+ "Description": null,
292
+ "Hints": ["city"],
293
+ "Visible": true,
294
+ "VisibilityCriteria": {
295
+ "Value": true,
296
+ "Negated": true,
297
+ "Description": null,
298
+ "Criteria": [],
299
+ "Operator": "And"
300
+ },
301
+ "HasDependants": false
302
+ }
303
+ ],
304
+ "Title": "Address",
305
+ "Description": null,
306
+ "Hints": ["address"],
307
+ "Visible": true,
308
+ "VisibilityCriteria": {
309
+ "Value": true,
310
+ "Negated": true,
311
+ "Description": null,
312
+ "Criteria": [],
313
+ "Operator": "And"
314
+ },
315
+ "HasDependants": false
316
+ }
317
+ ],
318
+ "Title": "",
319
+ "Description": null,
320
+ "Hints": null,
321
+ "Visible": true,
322
+ "VisibilityCriteria": {
323
+ "Value": true,
324
+ "Negated": true,
325
+ "Description": null,
326
+ "Criteria": [],
327
+ "Operator": "And"
328
+ },
329
+ "HasDependants": false
330
+ }
331
+ ],
332
+ "HasValueComponents": true,
333
+ "Extra": {}
334
+ },
335
+ "Exits": [
336
+ {
337
+ "Name": "email1",
338
+ "Type": "email",
339
+ "Adapter": {
340
+ "Id": "6973ff0a-b1a9-4f01-cd87-e7547f1384c0",
341
+ "ClientName": "email.form",
342
+ "CustomClientName": null,
343
+ "Uri": "/interfaces/widgets/adapters/email.form.js",
344
+ "Settings": {}
345
+ }
346
+ }
347
+ ],
348
+ "ConfirmationText": "<h1>Thank you!</h1><p>Your message has been sent.</p>",
349
+ "Id": 942,
350
+ "Title": "Report a problem",
351
+ "Description": "<p>Use this contact form to send us the relevant information.</p>\n",
352
+ "UriName": "report-a-problem",
353
+ "Attributes": [],
354
+ "Translations": {
355
+ "en": 942
356
+ },
357
+ "MatchQuestion": false,
358
+ "ExitType": "email",
359
+ "ExitConfiguration": "email.form",
360
+ "Highlighted": false,
361
+ "HighlightedInStart": false,
362
+ "ExecuteImmediately": false,
363
+ "ExpandFormAutomatically": false,
364
+ "DefaultIcon": {
365
+ "Type": "FontAwesome",
366
+ "Content": "envelope"
367
+ },
368
+ "ActiveIcon": {
369
+ "Type": null,
370
+ "Content": null
371
+ },
372
+ "LastModified": "2022-04-07T11:14:20.5582864Z",
373
+ "Parents": [808]
374
+ }
375
+ }
@@ -0,0 +1 @@
1
+ export declare const toContactMethod: ({ Id, Title, DefaultIcon, Exits: [Exit], ExitType, ConfirmationText, ExpandFormAutomatically, Form, Description, }: any, Validation?: any) => any;
@@ -0,0 +1,68 @@
1
+ // TODO: remove this file
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ import { FormBuilder } from '@humany/widget-forms';
19
+ export var toContactMethod = function (_a, Validation) {
20
+ var Id = _a.Id, Title = _a.Title, DefaultIcon = _a.DefaultIcon, _b = __read(_a.Exits, 1), Exit = _b[0], ExitType = _a.ExitType, ConfirmationText = _a.ConfirmationText, ExpandFormAutomatically = _a.ExpandFormAutomatically, Form = _a.Form, Description = _a.Description;
21
+ var Adapter = (Exit || { Adapter: {} }).Adapter;
22
+ var _c = Adapter.ClientName, ClientName = _c === void 0 ? '' : _c, _d = Adapter.Settings, Settings = _d === void 0 ? {} : _d, _e = Adapter.CustomClientName, CustomClientName = _e === void 0 ? '' : _e;
23
+ var settings = {
24
+ id: Id.toString(),
25
+ title: Title,
26
+ description: Description,
27
+ // symbol: convertLegacySymbol(DefaultIcon), // TODO:
28
+ symbol: null,
29
+ clientName: ClientName === 'custom.adapter' ? CustomClientName : ClientName,
30
+ expanded: true,
31
+ inline: true,
32
+ body: {},
33
+ };
34
+ if (ClientName.indexOf('phone') > -1 || ClientName.indexOf('freetext') > -1) {
35
+ var displayTextBeforeClick = Settings.displayTextBeforeClick, textBeforeClick = Settings.textBeforeClick;
36
+ if (displayTextBeforeClick === 'true') {
37
+ settings.expanded = false;
38
+ settings.title = textBeforeClick;
39
+ }
40
+ if (ClientName.indexOf('phone.text') > -1) {
41
+ settings.body.phoneNumber = Settings.phoneNumber;
42
+ }
43
+ else {
44
+ settings.body.freetext = Settings.freetext;
45
+ }
46
+ }
47
+ if (ClientName.indexOf('chat.popup') > -1 ||
48
+ ClientName.indexOf('link') > -1 ||
49
+ (ClientName === 'custom.adapter' && ExitType === 'custom')) {
50
+ settings.body = Settings;
51
+ settings.body.confirmationFallback = ConfirmationText;
52
+ }
53
+ if (ClientName.indexOf('ace') > -1) {
54
+ settings.body = Settings;
55
+ }
56
+ if (Form && Form.HasValueComponents) {
57
+ if (Validation) {
58
+ settings.body.form = FormBuilder.fromLegacyForm(Id.toString(), Form, Validation).get();
59
+ }
60
+ else {
61
+ settings.body.form = FormBuilder.fromLegacyForm(Id.toString(), Form).get();
62
+ }
63
+ if (!ExpandFormAutomatically) {
64
+ settings.expanded = settings.inline = false;
65
+ }
66
+ }
67
+ return settings;
68
+ };