@telia-ace/knowledge-data-client-flamingo 1.1.2 → 1.1.3
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/create-serviceclient.d.ts +2 -0
- package/data-client.d.ts +93 -0
- package/index-373df3a5.js +6 -0
- package/index-5c9c2abf.mjs +883 -0
- package/index.js +1 -0
- package/index.mjs +1743 -0
- package/legacy-conversion.d.ts +71 -0
- package/package.json +1 -1
- package/plugin.d.ts +2 -0
- package/.eslintrc.json +0 -30
- package/README.md +0 -11
- package/project.json +0 -48
- package/src/create-serviceclient.ts +0 -68
- package/src/data-client.ts +0 -585
- package/src/legacy-conversion.ts +0 -497
- package/src/plugin.ts +0 -8
- package/tsconfig.json +0 -23
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -19
- package/vite.config.ts +0 -57
- /package/{src/index.ts → index.d.ts} +0 -0
package/src/legacy-conversion.ts
DELETED
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CategoryApiResponse,
|
|
3
|
-
ContactApiResponse,
|
|
4
|
-
ContactCategoriesApiResponse,
|
|
5
|
-
ContactMethodApiResponse,
|
|
6
|
-
GuideApiResponse,
|
|
7
|
-
GuideCategoriesApiResponse,
|
|
8
|
-
GuideMatchApiResponse,
|
|
9
|
-
GuideViewApiResponse,
|
|
10
|
-
NoticeApiResponse,
|
|
11
|
-
NoticeListApiResponse,
|
|
12
|
-
TagListApiResponse,
|
|
13
|
-
ValidationApiResult,
|
|
14
|
-
} from '@telia-ace/knowledge-serviceclient';
|
|
15
|
-
// import { ContactMethodType as ContactMethod } from '@telia-ace/knowledge-widget-adapters';
|
|
16
|
-
// import {
|
|
17
|
-
// Category,
|
|
18
|
-
// DialogItem,
|
|
19
|
-
// DialogItemType,
|
|
20
|
-
// Guide,
|
|
21
|
-
// Notification,
|
|
22
|
-
// NotificationList,
|
|
23
|
-
// Symbol,
|
|
24
|
-
// Tag,
|
|
25
|
-
// } from '@telia-ace/widget-core';
|
|
26
|
-
// import { FormBuilder } from '@telia-ace/widget-forms';
|
|
27
|
-
import { DataError, ServiceClientQueryType } from './data-client';
|
|
28
|
-
|
|
29
|
-
type Category = any;
|
|
30
|
-
type DialogItem = any;
|
|
31
|
-
type Guide = any;
|
|
32
|
-
type Notification = any;
|
|
33
|
-
type NotificationList = any;
|
|
34
|
-
type SymbolType = any;
|
|
35
|
-
type Tag = any;
|
|
36
|
-
|
|
37
|
-
type ContactMethod = any;
|
|
38
|
-
|
|
39
|
-
enum DialogItemType {
|
|
40
|
-
guide = 'guide',
|
|
41
|
-
link = 'link',
|
|
42
|
-
default = 'default',
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type MatchResult = {
|
|
46
|
-
guides: Guide[];
|
|
47
|
-
matches: number;
|
|
48
|
-
topNotifications: Notification[];
|
|
49
|
-
middleNotifications: Notification[];
|
|
50
|
-
bottomNotifications: Notification[];
|
|
51
|
-
notificationLists: NotificationList[];
|
|
52
|
-
tags: Tag[];
|
|
53
|
-
byCategory: { id: string; guides: Guide[]; matches: number }[];
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type TagsResult = Tag[];
|
|
57
|
-
|
|
58
|
-
export type CategoriesResult = {
|
|
59
|
-
categories: Category[];
|
|
60
|
-
matches: number;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export type NotificationResults = Pick<
|
|
64
|
-
MatchResult,
|
|
65
|
-
| 'topNotifications'
|
|
66
|
-
| 'middleNotifications'
|
|
67
|
-
| 'bottomNotifications'
|
|
68
|
-
| 'notificationLists'
|
|
69
|
-
>;
|
|
70
|
-
|
|
71
|
-
export type GuideResult = {
|
|
72
|
-
guide: {
|
|
73
|
-
id: string;
|
|
74
|
-
title: string;
|
|
75
|
-
body: string;
|
|
76
|
-
modified: string;
|
|
77
|
-
modifiedBy: string | null;
|
|
78
|
-
publishedBy: string | null;
|
|
79
|
-
published: string;
|
|
80
|
-
connection: string;
|
|
81
|
-
categories: number[];
|
|
82
|
-
hasHandover: boolean;
|
|
83
|
-
allowFeedback: boolean;
|
|
84
|
-
seoMetaDescription: string | null;
|
|
85
|
-
seoAllowIndex: boolean | null;
|
|
86
|
-
perspective: string | null;
|
|
87
|
-
perspectives: { [key: string]: string };
|
|
88
|
-
translations?: { [key: string]: string };
|
|
89
|
-
};
|
|
90
|
-
related: Guide[];
|
|
91
|
-
dialog: DialogItem[];
|
|
92
|
-
contactMethods: ContactMethod[];
|
|
93
|
-
tags: Tag[];
|
|
94
|
-
error?: DataError;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export type ContactsResult = {
|
|
98
|
-
categories: Category[];
|
|
99
|
-
contactMethods: ContactMethod[];
|
|
100
|
-
topNotifications: Notification[];
|
|
101
|
-
middleNotifications: Notification[];
|
|
102
|
-
bottomNotifications: Notification[];
|
|
103
|
-
notificationLists: NotificationList[];
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export type SubmissionResult = {
|
|
107
|
-
contactMethod?: ContactMethod;
|
|
108
|
-
valid: boolean;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const convertLegacySymbol = (symbol?: {
|
|
112
|
-
Type: string;
|
|
113
|
-
Content: string;
|
|
114
|
-
}): SymbolType | undefined => {
|
|
115
|
-
if (symbol) {
|
|
116
|
-
const { Type, Content } = symbol;
|
|
117
|
-
if (Type && Content) {
|
|
118
|
-
return { type: Type, content: Content };
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const mapLegacyCategoriesRecursively = (
|
|
124
|
-
categories: CategoryApiResponse[]
|
|
125
|
-
): Category[] => {
|
|
126
|
-
return categories.map((c) => {
|
|
127
|
-
const category: Category = {
|
|
128
|
-
id: c.Id.toString(),
|
|
129
|
-
title: c.Name,
|
|
130
|
-
symbol: convertLegacySymbol(c.DefaultIcon),
|
|
131
|
-
activeSymbol: c.ActiveIcon && convertLegacySymbol(c.ActiveIcon),
|
|
132
|
-
description:
|
|
133
|
-
c.Description || (c.Attributes && c.Attributes.description) || '',
|
|
134
|
-
matches: c.GuidesCount,
|
|
135
|
-
};
|
|
136
|
-
if (c.Children && c.Children.length) {
|
|
137
|
-
category.items = mapLegacyCategoriesRecursively(c.Children);
|
|
138
|
-
}
|
|
139
|
-
return category;
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const mapNotices = (
|
|
144
|
-
source: NoticeApiResponse[],
|
|
145
|
-
type: string
|
|
146
|
-
): Notification[] => {
|
|
147
|
-
return source
|
|
148
|
-
.filter(({ Type }) => Type === type)
|
|
149
|
-
.map(({ Id, Title, Body }) => ({
|
|
150
|
-
id: Id.toString(),
|
|
151
|
-
title: Title,
|
|
152
|
-
body: Body,
|
|
153
|
-
}));
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const mapNotificationLists = (
|
|
157
|
-
source: NoticeListApiResponse[]
|
|
158
|
-
): NotificationList[] => {
|
|
159
|
-
return source.map(({ Id, Title, DefaultIcon, ListNotices, Notices }) => ({
|
|
160
|
-
id: Id.toString(),
|
|
161
|
-
title: Title,
|
|
162
|
-
symbol: convertLegacySymbol(DefaultIcon),
|
|
163
|
-
defaultHeaderOptions: {
|
|
164
|
-
visible: !!ListNotices.length,
|
|
165
|
-
},
|
|
166
|
-
notifications: (ListNotices || [])
|
|
167
|
-
.concat(Notices || [])
|
|
168
|
-
.map(({ Id, Title, Body, Type, Modified }) => ({
|
|
169
|
-
id: Id.toString(),
|
|
170
|
-
title: Title,
|
|
171
|
-
body: Body,
|
|
172
|
-
modified: Modified,
|
|
173
|
-
expandable: Type === 'listNotice',
|
|
174
|
-
})),
|
|
175
|
-
}));
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const mapContactMethodSettings = (
|
|
179
|
-
{
|
|
180
|
-
Id,
|
|
181
|
-
Title,
|
|
182
|
-
DefaultIcon,
|
|
183
|
-
Exits: [Exit],
|
|
184
|
-
ExitType,
|
|
185
|
-
ConfirmationText,
|
|
186
|
-
Description,
|
|
187
|
-
}: ContactApiResponse,
|
|
188
|
-
_Validation?: ValidationApiResult
|
|
189
|
-
): ContactMethod => {
|
|
190
|
-
const { Adapter } = Exit || { Adapter: {} };
|
|
191
|
-
const { ClientName = '', Settings = {}, CustomClientName = '' } = Adapter;
|
|
192
|
-
|
|
193
|
-
const settings: ContactMethod = {
|
|
194
|
-
id: Id.toString(),
|
|
195
|
-
title: Title,
|
|
196
|
-
description: Description,
|
|
197
|
-
symbol: convertLegacySymbol(DefaultIcon),
|
|
198
|
-
clientName: ClientName === 'custom.adapter' ? CustomClientName : ClientName,
|
|
199
|
-
expanded: true,
|
|
200
|
-
inline: true,
|
|
201
|
-
body: {},
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
if (ClientName.indexOf('phone') > -1 || ClientName.indexOf('freetext') > -1) {
|
|
205
|
-
const { displayTextBeforeClick, textBeforeClick } = Settings;
|
|
206
|
-
if (displayTextBeforeClick === 'true') {
|
|
207
|
-
settings.expanded = false;
|
|
208
|
-
settings.title = textBeforeClick;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (ClientName.indexOf('phone.text') > -1) {
|
|
212
|
-
settings.body.phoneNumber = Settings.phoneNumber;
|
|
213
|
-
} else {
|
|
214
|
-
settings.body.freetext = Settings.freetext;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (
|
|
219
|
-
ClientName.indexOf('chat.popup') > -1 ||
|
|
220
|
-
ClientName.indexOf('link') > -1 ||
|
|
221
|
-
(ClientName === 'custom.adapter' && ExitType === 'custom')
|
|
222
|
-
) {
|
|
223
|
-
settings.body = Settings;
|
|
224
|
-
settings.body.confirmationFallback = ConfirmationText;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (ClientName.indexOf('ace') > -1) {
|
|
228
|
-
settings.body = Settings;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// if (Form && Form.HasValueComponents) { // TODO:
|
|
232
|
-
// if (Validation) {
|
|
233
|
-
// settings.body.form = FormBuilder.fromLegacyForm(
|
|
234
|
-
// Id.toString(),
|
|
235
|
-
// Form,
|
|
236
|
-
// Validation
|
|
237
|
-
// ).get();
|
|
238
|
-
// } else {
|
|
239
|
-
// settings.body.form = FormBuilder.fromLegacyForm(
|
|
240
|
-
// Id.toString(),
|
|
241
|
-
// Form
|
|
242
|
-
// ).get();
|
|
243
|
-
// }
|
|
244
|
-
// if (!ExpandFormAutomatically) {
|
|
245
|
-
// settings.expanded = settings.inline = false;
|
|
246
|
-
// }
|
|
247
|
-
// }
|
|
248
|
-
|
|
249
|
-
return settings;
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
253
|
-
type ExtendedGuideMatchApiResponse = Modify<
|
|
254
|
-
GuideMatchApiResponse,
|
|
255
|
-
{
|
|
256
|
-
ByCategory: {
|
|
257
|
-
Id: string;
|
|
258
|
-
Matches: GuideApiResponse[];
|
|
259
|
-
TotalMatches: number;
|
|
260
|
-
}[];
|
|
261
|
-
}
|
|
262
|
-
>;
|
|
263
|
-
|
|
264
|
-
const mapTags = (tags: TagListApiResponse[] = []): Tag[] => {
|
|
265
|
-
return tags.map(
|
|
266
|
-
({ Id, Title, TotalMatches, Symbol, DefaultIcon, ActiveIcon }) => ({
|
|
267
|
-
id: Id.toString(),
|
|
268
|
-
title: Title,
|
|
269
|
-
matches: TotalMatches,
|
|
270
|
-
symbol: convertLegacySymbol(DefaultIcon || Symbol),
|
|
271
|
-
defaultIcon: convertLegacySymbol(DefaultIcon),
|
|
272
|
-
activeIcon: convertLegacySymbol(ActiveIcon),
|
|
273
|
-
})
|
|
274
|
-
);
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const mapGuides = (guides: GuideApiResponse[]) => {
|
|
278
|
-
return guides.map(({ Id, Title, Tags, FirstPublishedDate, Modified }) => ({
|
|
279
|
-
id: Id.toString(),
|
|
280
|
-
title: Title,
|
|
281
|
-
tags: mapTags(Tags),
|
|
282
|
-
published: FirstPublishedDate,
|
|
283
|
-
modified: Modified,
|
|
284
|
-
}));
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
export const formatLegacyData = (type: ServiceClientQueryType, data: any) => {
|
|
288
|
-
switch (type) {
|
|
289
|
-
case ServiceClientQueryType.MatchByCategory:
|
|
290
|
-
case ServiceClientQueryType.Match: {
|
|
291
|
-
const result: MatchResult = {
|
|
292
|
-
guides: [],
|
|
293
|
-
matches: 0,
|
|
294
|
-
topNotifications: [],
|
|
295
|
-
middleNotifications: [],
|
|
296
|
-
bottomNotifications: [],
|
|
297
|
-
notificationLists: [],
|
|
298
|
-
tags: [],
|
|
299
|
-
byCategory: [],
|
|
300
|
-
};
|
|
301
|
-
const {
|
|
302
|
-
Matches,
|
|
303
|
-
TotalMatches,
|
|
304
|
-
Notices,
|
|
305
|
-
NoticeLists,
|
|
306
|
-
Tags,
|
|
307
|
-
ByCategory,
|
|
308
|
-
}: ExtendedGuideMatchApiResponse = data;
|
|
309
|
-
|
|
310
|
-
result.guides = mapGuides(Matches);
|
|
311
|
-
|
|
312
|
-
result.matches = TotalMatches;
|
|
313
|
-
|
|
314
|
-
result.byCategory = (ByCategory || []).map(
|
|
315
|
-
({ Id, Matches, TotalMatches }) => ({
|
|
316
|
-
id: Id,
|
|
317
|
-
guides: mapGuides(Matches),
|
|
318
|
-
matches: TotalMatches,
|
|
319
|
-
})
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
result.tags = mapTags(Tags);
|
|
323
|
-
|
|
324
|
-
result.notificationLists = mapNotificationLists(NoticeLists || []);
|
|
325
|
-
|
|
326
|
-
result.topNotifications = mapNotices(Notices || [], 'noticeRowTop');
|
|
327
|
-
|
|
328
|
-
result.middleNotifications = mapNotices(Notices || [], 'noticeRowMiddle');
|
|
329
|
-
|
|
330
|
-
result.bottomNotifications = mapNotices(Notices || [], 'footerNotice');
|
|
331
|
-
|
|
332
|
-
return result;
|
|
333
|
-
}
|
|
334
|
-
case ServiceClientQueryType.Categories: {
|
|
335
|
-
const { Children, GuidesCountTotal }: GuideCategoriesApiResponse = data;
|
|
336
|
-
|
|
337
|
-
const result: CategoriesResult = {
|
|
338
|
-
categories: mapLegacyCategoriesRecursively(Children || []),
|
|
339
|
-
matches: GuidesCountTotal,
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
return result;
|
|
343
|
-
}
|
|
344
|
-
case ServiceClientQueryType.Guide: {
|
|
345
|
-
const {
|
|
346
|
-
Id,
|
|
347
|
-
Title,
|
|
348
|
-
Body,
|
|
349
|
-
Related,
|
|
350
|
-
Options,
|
|
351
|
-
ConnectionId,
|
|
352
|
-
ContactMethods,
|
|
353
|
-
EnableFeedback,
|
|
354
|
-
HandoverExists,
|
|
355
|
-
FirstPublishedDate,
|
|
356
|
-
Modified,
|
|
357
|
-
ModifiedByDisplayName,
|
|
358
|
-
FirstPublishedByDisplayName,
|
|
359
|
-
Categories,
|
|
360
|
-
Tags,
|
|
361
|
-
SeoMetaDescription,
|
|
362
|
-
SeoAllowIndex,
|
|
363
|
-
Perspectives,
|
|
364
|
-
PerspectiveKey,
|
|
365
|
-
Translations,
|
|
366
|
-
}: GuideViewApiResponse = data;
|
|
367
|
-
|
|
368
|
-
/*
|
|
369
|
-
PerspectiveKey is always null when on the "top level" of a dialog tree
|
|
370
|
-
OR when navigating down a dialog tree in the "Default answer version"
|
|
371
|
-
Note: The "Default answer version" is not the same as a given guides
|
|
372
|
-
default answer version. The "Default answer version" is always the answer
|
|
373
|
-
version in Perspectives with the key "Default".
|
|
374
|
-
*/
|
|
375
|
-
const perspective =
|
|
376
|
-
PerspectiveKey ||
|
|
377
|
-
Object.values(Perspectives).find(
|
|
378
|
-
(connection) => connection === ConnectionId
|
|
379
|
-
) ||
|
|
380
|
-
Perspectives['Default'] ||
|
|
381
|
-
null;
|
|
382
|
-
|
|
383
|
-
const result: GuideResult = {
|
|
384
|
-
guide: {
|
|
385
|
-
id: Id.toString(),
|
|
386
|
-
title: Title,
|
|
387
|
-
body: Body,
|
|
388
|
-
modified: Modified,
|
|
389
|
-
published: FirstPublishedDate,
|
|
390
|
-
modifiedBy: ModifiedByDisplayName,
|
|
391
|
-
publishedBy: FirstPublishedByDisplayName,
|
|
392
|
-
connection: ConnectionId,
|
|
393
|
-
categories: Categories,
|
|
394
|
-
hasHandover: HandoverExists,
|
|
395
|
-
allowFeedback: EnableFeedback,
|
|
396
|
-
seoMetaDescription: SeoMetaDescription,
|
|
397
|
-
seoAllowIndex: SeoAllowIndex,
|
|
398
|
-
perspectives: Perspectives,
|
|
399
|
-
perspective,
|
|
400
|
-
translations: Object.keys(Translations || {}).reduce<{
|
|
401
|
-
[key: string]: string;
|
|
402
|
-
}>((acc, key) => {
|
|
403
|
-
acc[key] = Translations[key].toString();
|
|
404
|
-
return acc;
|
|
405
|
-
}, {}),
|
|
406
|
-
},
|
|
407
|
-
related: mapGuides(Related || []),
|
|
408
|
-
dialog: [],
|
|
409
|
-
contactMethods: (ContactMethods || []).map((cm) =>
|
|
410
|
-
mapContactMethodSettings(cm)
|
|
411
|
-
),
|
|
412
|
-
tags: mapTags(Tags),
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
(Options || []).forEach(
|
|
416
|
-
({ CanAccess, Description, ConnectionId, Properties }) => {
|
|
417
|
-
if (!CanAccess) {
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
const item: DialogItem = {
|
|
422
|
-
id: Id.toString(),
|
|
423
|
-
title: Description,
|
|
424
|
-
connection: ConnectionId,
|
|
425
|
-
connectionKey: (Properties as any).ConnectionKey,
|
|
426
|
-
type: DialogItemType.default,
|
|
427
|
-
parent: {
|
|
428
|
-
id: Id.toString(),
|
|
429
|
-
title: Title,
|
|
430
|
-
tags: mapTags(Tags),
|
|
431
|
-
},
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
if (Properties.Type === 'Guide' || Properties.Type === 'Link') {
|
|
435
|
-
Properties.Id && (item.id = Properties.Id.toString());
|
|
436
|
-
Properties.Uri && (item.href = Properties.Uri);
|
|
437
|
-
Properties.Target && (item.target = Properties.Target);
|
|
438
|
-
switch (Properties.Type) {
|
|
439
|
-
case 'Guide':
|
|
440
|
-
item.type = DialogItemType.guide;
|
|
441
|
-
break;
|
|
442
|
-
case 'Link':
|
|
443
|
-
item.type = DialogItemType.link;
|
|
444
|
-
break;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
result.dialog.push(item);
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
|
|
452
|
-
return result;
|
|
453
|
-
}
|
|
454
|
-
case ServiceClientQueryType.Contacts: {
|
|
455
|
-
const {
|
|
456
|
-
Children,
|
|
457
|
-
Matches,
|
|
458
|
-
Notices,
|
|
459
|
-
NoticeLists,
|
|
460
|
-
}: ContactCategoriesApiResponse = data;
|
|
461
|
-
|
|
462
|
-
const result: ContactsResult = {
|
|
463
|
-
contactMethods: (Matches || []).map((cm) =>
|
|
464
|
-
mapContactMethodSettings(cm)
|
|
465
|
-
),
|
|
466
|
-
categories: mapLegacyCategoriesRecursively(Children || []),
|
|
467
|
-
topNotifications: mapNotices(Notices || [], 'noticeRowTop'),
|
|
468
|
-
middleNotifications: mapNotices(Notices || [], 'noticeRowMiddle'),
|
|
469
|
-
bottomNotifications: mapNotices(Notices || [], 'footerNotice'),
|
|
470
|
-
notificationLists: mapNotificationLists(NoticeLists || []),
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
return result;
|
|
474
|
-
}
|
|
475
|
-
case ServiceClientQueryType.ContactMethod: {
|
|
476
|
-
const { ContactMethod }: ContactMethodApiResponse = data;
|
|
477
|
-
|
|
478
|
-
return mapContactMethodSettings(ContactMethod || {});
|
|
479
|
-
}
|
|
480
|
-
case ServiceClientQueryType.Tags:
|
|
481
|
-
case ServiceClientQueryType.TagsOnGuides: {
|
|
482
|
-
return mapTags(data || []);
|
|
483
|
-
}
|
|
484
|
-
case ServiceClientQueryType.Notifications: {
|
|
485
|
-
const { Notices, NoticeLists } = data;
|
|
486
|
-
|
|
487
|
-
return {
|
|
488
|
-
topNotifications: mapNotices(Notices || [], 'noticeRowTop'),
|
|
489
|
-
middleNotifications: mapNotices(Notices || [], 'noticeRowMiddle'),
|
|
490
|
-
bottomNotifications: mapNotices(Notices || [], 'footerNotice'),
|
|
491
|
-
notificationLists: mapNotificationLists(NoticeLists || []),
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
default:
|
|
495
|
-
return {};
|
|
496
|
-
}
|
|
497
|
-
};
|
package/src/plugin.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import DataClient from './data-client';
|
|
3
|
-
|
|
4
|
-
export const KnowledgeDataClientPlugin = async (container: Container) => {
|
|
5
|
-
container.registerAsync('dataClient', () => {
|
|
6
|
-
return DataClient.create(container);
|
|
7
|
-
});
|
|
8
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"forceConsistentCasingInFileNames": true,
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noImplicitOverride": true,
|
|
8
|
-
"noPropertyAccessFromIndexSignature": false,
|
|
9
|
-
"noImplicitReturns": false,
|
|
10
|
-
"noFallthroughCasesInSwitch": true,
|
|
11
|
-
"types": ["vitest"]
|
|
12
|
-
},
|
|
13
|
-
"files": [],
|
|
14
|
-
"include": [],
|
|
15
|
-
"references": [
|
|
16
|
-
{
|
|
17
|
-
"path": "./tsconfig.lib.json"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "./tsconfig.spec.json"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|
package/tsconfig.lib.json
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
|
|
6
|
-
},
|
|
7
|
-
"include": [
|
|
8
|
-
"vite.config.ts",
|
|
9
|
-
"src/**/*.test.ts",
|
|
10
|
-
"src/**/*.spec.ts",
|
|
11
|
-
"src/**/*.test.tsx",
|
|
12
|
-
"src/**/*.spec.tsx",
|
|
13
|
-
"src/**/*.test.js",
|
|
14
|
-
"src/**/*.spec.js",
|
|
15
|
-
"src/**/*.test.jsx",
|
|
16
|
-
"src/**/*.spec.jsx",
|
|
17
|
-
"src/**/*.d.ts"
|
|
18
|
-
]
|
|
19
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
|
|
4
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
5
|
-
import dts from 'vite-plugin-dts';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
// import packageJson from './package.json';
|
|
8
|
-
|
|
9
|
-
export default defineConfig({
|
|
10
|
-
cacheDir:
|
|
11
|
-
'../../node_modules/.vite/@telia-ace/knowledge-data-client-flamingo',
|
|
12
|
-
|
|
13
|
-
plugins: [
|
|
14
|
-
dts({
|
|
15
|
-
entryRoot: 'src',
|
|
16
|
-
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
17
|
-
skipDiagnostics: true,
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
nxViteTsPaths(),
|
|
21
|
-
],
|
|
22
|
-
|
|
23
|
-
// Uncomment this if you are using workers.
|
|
24
|
-
// worker: {
|
|
25
|
-
// plugins: [ nxViteTsPaths() ],
|
|
26
|
-
// },
|
|
27
|
-
|
|
28
|
-
// Configuration for building your library.
|
|
29
|
-
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
30
|
-
build: {
|
|
31
|
-
lib: {
|
|
32
|
-
// Could also be a dictionary or array of multiple entry points.
|
|
33
|
-
entry: 'src/index.ts',
|
|
34
|
-
name: '@telia-ace/knowledge-data-client-flamingo',
|
|
35
|
-
fileName: 'index',
|
|
36
|
-
// Change this to the formats you want to support.
|
|
37
|
-
// Don't forget to update your package.json as well.
|
|
38
|
-
formats: ['es', 'cjs'],
|
|
39
|
-
},
|
|
40
|
-
rollupOptions: {
|
|
41
|
-
// External packages that should not be bundled into your library.
|
|
42
|
-
external: [
|
|
43
|
-
// ...Object.keys((packageJson as any).dependencies || {}),
|
|
44
|
-
// ...Object.keys((packageJson as any).peerDependencies || {}),
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
test: {
|
|
50
|
-
globals: true,
|
|
51
|
-
cache: {
|
|
52
|
-
dir: '../../node_modules/.vitest',
|
|
53
|
-
},
|
|
54
|
-
environment: 'node',
|
|
55
|
-
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
56
|
-
},
|
|
57
|
-
});
|
|
File without changes
|