@vgip/meta-ui 1.9.9 → 2.1.0
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/fesm2022/vgip-meta-ui.mjs +5614 -78
- package/fesm2022/vgip-meta-ui.mjs.map +1 -1
- package/index.d.ts +709 -5
- package/package.json +5 -8
- package/vendor/volta3/README.md +1 -0
- package/vendor/volta3/fonts/Spezia-Regular.eot +0 -0
- package/vendor/volta3/fonts/Spezia-Regular.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-Regular.woff +0 -0
- package/vendor/volta3/fonts/Spezia-Regular.woff2 +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.eot +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.woff +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.woff2 +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.eot +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.woff +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.woff2 +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.eot +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.woff +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.woff2 +0 -0
- package/vendor/volta3/scss/components/_accordions.scss +165 -0
- package/vendor/volta3/scss/components/_badge.scss +325 -0
- package/vendor/volta3/scss/components/_blockquote.scss +35 -0
- package/vendor/volta3/scss/components/_boxes.scss +113 -0
- package/vendor/volta3/scss/components/_buttons.scss +794 -0
- package/vendor/volta3/scss/components/_callouts.scss +427 -0
- package/vendor/volta3/scss/components/_card.scss +421 -0
- package/vendor/volta3/scss/components/_color-classes.scss +186 -0
- package/vendor/volta3/scss/components/_dialpad.scss +224 -0
- package/vendor/volta3/scss/components/_dropdowns.scss +495 -0
- package/vendor/volta3/scss/components/_empties.scss +77 -0
- package/vendor/volta3/scss/components/_flash-messages.scss +39 -0
- package/vendor/volta3/scss/components/_form-elements.scss +879 -0
- package/vendor/volta3/scss/components/_lists.scss +427 -0
- package/vendor/volta3/scss/components/_modals.scss +227 -0
- package/vendor/volta3/scss/components/_popups.scss +173 -0
- package/vendor/volta3/scss/components/_progress.scss +28 -0
- package/vendor/volta3/scss/components/_spinner.scss +105 -0
- package/vendor/volta3/scss/components/_steps.scss +242 -0
- package/vendor/volta3/scss/components/_switch.scss +353 -0
- package/vendor/volta3/scss/components/_tables.scss +739 -0
- package/vendor/volta3/scss/components/_tabs.scss +296 -0
- package/vendor/volta3/scss/components/_text-separator.scss +61 -0
- package/vendor/volta3/scss/components/_tooltips.scss +152 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--aqua.scss +179 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--collapsible.scss +381 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--dark.scss +196 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--light.scss +174 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--structure.scss +631 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--tabs.scss +88 -0
- package/vendor/volta3/scss/flatpickr/_flatpickr-volta.scss +407 -0
- package/vendor/volta3/scss/flatpickr/_flatpickr.css +785 -0
- package/vendor/volta3/scss/layout/_article.scss +119 -0
- package/vendor/volta3/scss/layout/_utils.scss +174 -0
- package/vendor/volta3/scss/lib/_grid.scss +374 -0
- package/vendor/volta3/scss/lib/_mediaqueries.scss +52 -0
- package/vendor/volta3/scss/lib/_reset.scss +110 -0
- package/vendor/volta3/scss/lib/_type.scss +345 -0
- package/vendor/volta3/scss/lib/_utils.scss +26 -0
- package/vendor/volta3/scss/lib/_variables.scss +115 -0
- package/vendor/volta3/scss/prism/_prism-volta.scss +390 -0
- package/vendor/volta3/scss/prism/_prism.css +326 -0
- package/vendor/volta3/scss/templates/volta-error-page.scss +57 -0
- package/vendor/volta3/scss/templates/volta-templates.scss +114 -0
- package/vendor/volta3/scss/volta-flatpickr.scss +10 -0
- package/vendor/volta3/scss/volta-prism.scss +7 -0
- package/vendor/volta3/scss/volta.scss +39 -0
- package/vendor/volta3/symbol/volta-brand-icons.svg +1 -0
- package/vendor/volta3/symbol/volta-flag-icons.svg +1 -0
- package/vendor/volta3/symbol/volta-icons.svg +1 -0
- package/esm2022/lib/common/fieldNormalizer/boolean.mjs +0 -12
- package/esm2022/lib/common/fieldNormalizer/datetime.mjs +0 -9
- package/esm2022/lib/common/fieldNormalizer/index.mjs +0 -183
- package/esm2022/lib/common/fieldNormalizer/number.mjs +0 -14
- package/esm2022/lib/common/fieldNormalizer/options.mjs +0 -50
- package/esm2022/lib/common/fieldNormalizer/radio.mjs +0 -30
- package/esm2022/lib/common/fieldNormalizer/reference.mjs +0 -36
- package/esm2022/lib/common/fieldNormalizer/richtext.mjs +0 -15
- package/esm2022/lib/common/fieldNormalizer/string.mjs +0 -24
- package/esm2022/lib/common/fieldNormalizer/text.mjs +0 -18
- package/esm2022/lib/common/fieldNormalizer/uniqueNameFilter.mjs +0 -23
- package/esm2022/lib/common/metaAutofocus.directive.mjs +0 -35
- package/esm2022/lib/common/metaIcons.pipe.mjs +0 -29
- package/esm2022/lib/common/metaModel.pipe.mjs +0 -23
- package/esm2022/lib/common/metaNormalizer.mjs +0 -375
- package/esm2022/lib/common/metaStripHtml.pipe.mjs +0 -22
- package/esm2022/lib/common/utils/colorThemes.mjs +0 -77
- package/esm2022/lib/common/utils/indexedDbStore/index.mjs +0 -228
- package/esm2022/lib/common/utils/relativeTimeBuilder.mjs +0 -49
- package/esm2022/lib/common/utils/resourceCardLabel.mjs +0 -24
- package/esm2022/lib/common/utils/smartProp.mjs +0 -31
- package/esm2022/lib/common/utils/templateBuilder.mjs +0 -103
- package/esm2022/lib/fieldAbstract.mjs +0 -291
- package/esm2022/lib/fieldBoolean/index.mjs +0 -53
- package/esm2022/lib/fieldComposite/index.mjs +0 -82
- package/esm2022/lib/fieldDatetime/index.mjs +0 -365
- package/esm2022/lib/fieldHidden/index.mjs +0 -18
- package/esm2022/lib/fieldInput/index.mjs +0 -475
- package/esm2022/lib/fieldList/index.mjs +0 -74
- package/esm2022/lib/fieldRadio/index.mjs +0 -88
- package/esm2022/lib/fieldReference/index.mjs +0 -834
- package/esm2022/lib/fieldRichtext/index.mjs +0 -93
- package/esm2022/lib/fieldSelect/index.mjs +0 -568
- package/esm2022/lib/fieldText/index.mjs +0 -83
- package/esm2022/lib/fieldUnknown/index.mjs +0 -19
- package/esm2022/lib/index.mjs +0 -163
- package/esm2022/lib/layout/index.mjs +0 -212
- package/esm2022/lib/metaField/index.mjs +0 -148
- package/esm2022/lib/refDialog/index.mjs +0 -135
- package/esm2022/lib/resource/index.mjs +0 -525
- package/esm2022/lib/resourceCard/index.mjs +0 -40
- package/esm2022/lib/services/metaContext/index.mjs +0 -52
- package/esm2022/lib/services/metaMsg/index.mjs +0 -84
- package/esm2022/lib/services/metaReference/index.mjs +0 -94
- package/esm2022/lib/services/metaResource/index.mjs +0 -139
- package/esm2022/lib/services/metaResource/metaHttpClient.mjs +0 -64
- package/esm2022/lib/services/metaTracker/index.mjs +0 -31
- package/esm2022/lib/services/resourceDrafts/index.mjs +0 -69
- package/esm2022/public-api.mjs +0 -5
- package/esm2022/vgip-meta-ui.mjs +0 -5
- package/fesm2022/vgip-meta-ui-fieldAbstract-baeaf24d.mjs +0 -399
- package/fesm2022/vgip-meta-ui-fieldAbstract-baeaf24d.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-0184d5ec.mjs +0 -478
- package/fesm2022/vgip-meta-ui-index-0184d5ec.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-050d4a8c.mjs +0 -87
- package/fesm2022/vgip-meta-ui-index-050d4a8c.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-1ddfcce0.mjs +0 -86
- package/fesm2022/vgip-meta-ui-index-1ddfcce0.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-37358620.mjs +0 -158
- package/fesm2022/vgip-meta-ui-index-37358620.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-4e9c383f.mjs +0 -95
- package/fesm2022/vgip-meta-ui-index-4e9c383f.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-70d40f26.mjs +0 -79
- package/fesm2022/vgip-meta-ui-index-70d40f26.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-7741951a.mjs +0 -23
- package/fesm2022/vgip-meta-ui-index-7741951a.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-80ab405f.mjs +0 -93
- package/fesm2022/vgip-meta-ui-index-80ab405f.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-86d5c4b7.mjs +0 -575
- package/fesm2022/vgip-meta-ui-index-86d5c4b7.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-926ae006.mjs +0 -58
- package/fesm2022/vgip-meta-ui-index-926ae006.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-ac6d744b.mjs +0 -867
- package/fesm2022/vgip-meta-ui-index-ac6d744b.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-c943b7c0.mjs +0 -24
- package/fesm2022/vgip-meta-ui-index-c943b7c0.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-f2a08550.mjs +0 -2058
- package/fesm2022/vgip-meta-ui-index-f2a08550.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-f8b00f06.mjs +0 -370
- package/fesm2022/vgip-meta-ui-index-f8b00f06.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-fa271433.mjs +0 -151
- package/fesm2022/vgip-meta-ui-index-fa271433.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-metaModel.pipe-6b803e66.mjs +0 -26
- package/fesm2022/vgip-meta-ui-metaModel.pipe-6b803e66.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs +0 -51
- package/fesm2022/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs.map +0 -1
- package/lib/common/fieldNormalizer/boolean.d.ts +0 -1
- package/lib/common/fieldNormalizer/datetime.d.ts +0 -1
- package/lib/common/fieldNormalizer/index.d.ts +0 -1
- package/lib/common/fieldNormalizer/number.d.ts +0 -1
- package/lib/common/fieldNormalizer/options.d.ts +0 -1
- package/lib/common/fieldNormalizer/radio.d.ts +0 -1
- package/lib/common/fieldNormalizer/reference.d.ts +0 -1
- package/lib/common/fieldNormalizer/richtext.d.ts +0 -1
- package/lib/common/fieldNormalizer/string.d.ts +0 -1
- package/lib/common/fieldNormalizer/text.d.ts +0 -1
- package/lib/common/fieldNormalizer/uniqueNameFilter.d.ts +0 -1
- package/lib/common/metaAutofocus.directive.d.ts +0 -10
- package/lib/common/metaIcons.pipe.d.ts +0 -10
- package/lib/common/metaModel.pipe.d.ts +0 -7
- package/lib/common/metaNormalizer.d.ts +0 -1
- package/lib/common/metaStripHtml.pipe.d.ts +0 -7
- package/lib/common/utils/colorThemes.d.ts +0 -8
- package/lib/common/utils/indexedDbStore/index.d.ts +0 -25
- package/lib/common/utils/relativeTimeBuilder.d.ts +0 -1
- package/lib/common/utils/resourceCardLabel.d.ts +0 -1
- package/lib/common/utils/smartProp.d.ts +0 -2
- package/lib/common/utils/templateBuilder.d.ts +0 -1
- package/lib/fieldAbstract.d.ts +0 -60
- package/lib/fieldBoolean/index.d.ts +0 -10
- package/lib/fieldComposite/index.d.ts +0 -14
- package/lib/fieldDatetime/index.d.ts +0 -26
- package/lib/fieldHidden/index.d.ts +0 -6
- package/lib/fieldInput/index.d.ts +0 -35
- package/lib/fieldList/index.d.ts +0 -15
- package/lib/fieldRadio/index.d.ts +0 -14
- package/lib/fieldReference/index.d.ts +0 -73
- package/lib/fieldRichtext/index.d.ts +0 -27
- package/lib/fieldSelect/index.d.ts +0 -49
- package/lib/fieldText/index.d.ts +0 -15
- package/lib/fieldUnknown/index.d.ts +0 -6
- package/lib/index.d.ts +0 -65
- package/lib/layout/index.d.ts +0 -46
- package/lib/metaField/index.d.ts +0 -28
- package/lib/refDialog/index.d.ts +0 -33
- package/lib/resource/index.d.ts +0 -68
- package/lib/resourceCard/index.d.ts +0 -17
- package/lib/services/metaContext/index.d.ts +0 -32
- package/lib/services/metaMsg/index.d.ts +0 -14
- package/lib/services/metaReference/index.d.ts +0 -11
- package/lib/services/metaResource/index.d.ts +0 -31
- package/lib/services/metaResource/metaHttpClient.d.ts +0 -15
- package/lib/services/metaTracker/index.d.ts +0 -19
- package/lib/services/resourceDrafts/index.d.ts +0 -26
- package/public-api.d.ts +0 -1
|
@@ -1,2058 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Component, Input, Directive, EventEmitter, Output, ViewChild } from '@angular/core';
|
|
3
|
-
import { a as metaDark, m as metaLight } from './vgip-meta-ui-fieldAbstract-baeaf24d.mjs';
|
|
4
|
-
import * as i1$2 from '@angular/common';
|
|
5
|
-
import { M as MetaContextService, t as templateBuilder } from './vgip-meta-ui-index-37358620.mjs';
|
|
6
|
-
import { Observable, Subject } from 'rxjs';
|
|
7
|
-
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
8
|
-
import * as i1 from '@angular/common/http';
|
|
9
|
-
import { HttpParams, HttpHeaders } from '@angular/common/http';
|
|
10
|
-
import * as i2 from '@angular/forms';
|
|
11
|
-
import * as i1$1 from '@angular/router';
|
|
12
|
-
import { M as MetaField } from './vgip-meta-ui-index-fa271433.mjs';
|
|
13
|
-
|
|
14
|
-
const numberFieldNormalizer = (field) => {
|
|
15
|
-
const f = {
|
|
16
|
-
label: field.label,
|
|
17
|
-
name: field.name
|
|
18
|
-
};
|
|
19
|
-
f.type = field.name ? 'number' : 'missing name';
|
|
20
|
-
if (field.type === 'float' || field.subtype === 'float') {
|
|
21
|
-
f.validations = {
|
|
22
|
-
step: field.step || '0.01'
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
return f;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const optionsFieldNormalizer = (field) => {
|
|
29
|
-
const f = {
|
|
30
|
-
label: field.label,
|
|
31
|
-
name: field.name,
|
|
32
|
-
options: field.options || []
|
|
33
|
-
};
|
|
34
|
-
if (field.dependentPicklist && field.controllerName) {
|
|
35
|
-
const enabled = {};
|
|
36
|
-
enabled[field.controllerName] = true;
|
|
37
|
-
f.enabled = enabled;
|
|
38
|
-
}
|
|
39
|
-
if (field.picklist) {
|
|
40
|
-
for (const o of field.picklist) {
|
|
41
|
-
const opt = {
|
|
42
|
-
id: o.name || o.id,
|
|
43
|
-
label: o.label
|
|
44
|
-
};
|
|
45
|
-
if (field.for) {
|
|
46
|
-
opt.for = field.for;
|
|
47
|
-
}
|
|
48
|
-
if (o.validFor && field.controllerName) {
|
|
49
|
-
const validFor = {};
|
|
50
|
-
validFor[field.controllerName] = o.validFor;
|
|
51
|
-
opt.for = validFor;
|
|
52
|
-
}
|
|
53
|
-
f.options.push(opt);
|
|
54
|
-
if (o.defaultValue && !field.default) {
|
|
55
|
-
f.default = opt.id;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
f.type = field.name ? 'select' : 'missing name';
|
|
60
|
-
if (field.type === 'multipicklist') {
|
|
61
|
-
f.multiple = true;
|
|
62
|
-
}
|
|
63
|
-
if (field.reference) {
|
|
64
|
-
f.reference = field.reference;
|
|
65
|
-
}
|
|
66
|
-
if (field.searchUrl || field.searchParams) {
|
|
67
|
-
f.search = {
|
|
68
|
-
url: field.searchUrl,
|
|
69
|
-
params: field.searchParams
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
else if (field.search) {
|
|
73
|
-
f.search = field.search;
|
|
74
|
-
}
|
|
75
|
-
return f;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const stringFieldNormalizer = (field) => {
|
|
79
|
-
const f = {
|
|
80
|
-
label: field.label,
|
|
81
|
-
name: field.name
|
|
82
|
-
};
|
|
83
|
-
f.type = field.name ? 'string' : 'missing name';
|
|
84
|
-
if (field.subtype) {
|
|
85
|
-
f.subtype = field.subtype;
|
|
86
|
-
}
|
|
87
|
-
if (field.picklist || field.options) {
|
|
88
|
-
f.suggestions = (field.picklist || field.options || []).map((s) => {
|
|
89
|
-
if (s.defaultValue) {
|
|
90
|
-
f.default = s.label || s.name || s.id || s;
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
id: s.id,
|
|
94
|
-
label: s.label,
|
|
95
|
-
name: s.name
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
return f;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const booleanFieldNormalizer = (field) => {
|
|
103
|
-
const f = {
|
|
104
|
-
label: field.label,
|
|
105
|
-
name: field.name
|
|
106
|
-
};
|
|
107
|
-
if (field.subtype) {
|
|
108
|
-
f.subtype = field.subtype;
|
|
109
|
-
}
|
|
110
|
-
f.type = field.name ? 'boolean' : 'missing name';
|
|
111
|
-
return f;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/*
|
|
115
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
116
|
-
* @Date: 2021-03-22 17:09:52
|
|
117
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
118
|
-
* @Last Modified time: 2021-03-22 17:09:52
|
|
119
|
-
*/
|
|
120
|
-
const textFieldNormalizer = (field) => {
|
|
121
|
-
const f = {
|
|
122
|
-
label: field.label,
|
|
123
|
-
name: field.name
|
|
124
|
-
};
|
|
125
|
-
f.type = field.name ? 'text' : 'missing name';
|
|
126
|
-
if (field.rows) {
|
|
127
|
-
f.rows = field.rows;
|
|
128
|
-
}
|
|
129
|
-
return f;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const datetimeFieldNormalizer = (field) => {
|
|
133
|
-
const f = {
|
|
134
|
-
label: field.label,
|
|
135
|
-
name: field.name
|
|
136
|
-
};
|
|
137
|
-
f.type = field.name ? (field.type || '').toLowerCase() : 'missing name';
|
|
138
|
-
return f;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const referenceFieldNormalizer = (field) => {
|
|
142
|
-
const f = {
|
|
143
|
-
type: field.name ? 'reference' : 'missing name',
|
|
144
|
-
label: field.label,
|
|
145
|
-
name: field.name
|
|
146
|
-
};
|
|
147
|
-
f.type = field.name ? 'reference' : 'missing name';
|
|
148
|
-
if (field.reference) {
|
|
149
|
-
if (field.reference instanceof Array && field.reference.length === 1) {
|
|
150
|
-
f.reference = field.reference[0];
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
f.reference = field.reference;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else if (field.references) {
|
|
157
|
-
f.references = field.references;
|
|
158
|
-
}
|
|
159
|
-
if (field.acceptNew) {
|
|
160
|
-
f.acceptNew = field.acceptNew;
|
|
161
|
-
}
|
|
162
|
-
if (field.searchLabel) {
|
|
163
|
-
f.searchLabel = field.searchLabel;
|
|
164
|
-
}
|
|
165
|
-
if (field.searchUrl || field.searchParams) {
|
|
166
|
-
f.search = {
|
|
167
|
-
url: field.searchUrl,
|
|
168
|
-
params: field.searchParams
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
else if (field.search) {
|
|
172
|
-
f.search = field.search;
|
|
173
|
-
}
|
|
174
|
-
return f;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const radioFieldNormalizer = (field) => {
|
|
178
|
-
const f = {
|
|
179
|
-
label: field.label,
|
|
180
|
-
name: field.name,
|
|
181
|
-
options: field.options || []
|
|
182
|
-
};
|
|
183
|
-
f.type = field.name ? 'radio' : 'missing name';
|
|
184
|
-
if (field.picklist) {
|
|
185
|
-
for (const o of field.picklist) {
|
|
186
|
-
const opt = {
|
|
187
|
-
id: o.name || o.id,
|
|
188
|
-
label: o.label
|
|
189
|
-
};
|
|
190
|
-
if (field.for) {
|
|
191
|
-
opt.for = field.for;
|
|
192
|
-
}
|
|
193
|
-
if (o.validFor && field.controllerName) {
|
|
194
|
-
const validFor = {};
|
|
195
|
-
validFor[field.controllerName] = o.validFor;
|
|
196
|
-
opt.for = validFor;
|
|
197
|
-
}
|
|
198
|
-
f.options.push(opt);
|
|
199
|
-
if (o.defaultValue && !field.default) {
|
|
200
|
-
f.default = opt.id;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return f;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
/*
|
|
208
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
209
|
-
* @Date: 2019-09-19 17:34:34
|
|
210
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
211
|
-
* @Last Modified time: 2021-03-22 17:11:01
|
|
212
|
-
*/
|
|
213
|
-
const richtextFieldNormalizer = (field) => {
|
|
214
|
-
const f = {
|
|
215
|
-
label: field.label,
|
|
216
|
-
name: field.name
|
|
217
|
-
};
|
|
218
|
-
f.type = field.name ? 'richtext' : 'missing name';
|
|
219
|
-
return f;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
/*
|
|
223
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
224
|
-
* @Date: 2021-03-22 17:09:12
|
|
225
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
226
|
-
* @Last Modified time: 2021-03-22 17:09:12
|
|
227
|
-
*/
|
|
228
|
-
const uniqueNameFilter = (fields, uniqFieldNames, allowDuplicates = false) => {
|
|
229
|
-
if (fields instanceof Array) {
|
|
230
|
-
return allowDuplicates ? fields : fields.filter((f) => {
|
|
231
|
-
if (f.name) {
|
|
232
|
-
if (uniqFieldNames.indexOf(f.name) !== -1) {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
uniqFieldNames.push(f.name);
|
|
236
|
-
}
|
|
237
|
-
return true;
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
return fields;
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
/*
|
|
246
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
247
|
-
* @Date: 2019-09-19 17:34:34
|
|
248
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
249
|
-
* @Last Modified time: 2021-03-22 17:13:53
|
|
250
|
-
*/
|
|
251
|
-
const fieldNormalizer = (field, uniqFieldNames) => {
|
|
252
|
-
if (!field) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
const f = {
|
|
256
|
-
validations: {}
|
|
257
|
-
};
|
|
258
|
-
const fieldType = (field.type || '').toLowerCase();
|
|
259
|
-
if (['int', 'integer', 'number', 'double', 'float', 'bigdecimal', 'percent', 'currency'].indexOf(fieldType) !== -1) {
|
|
260
|
-
Object.assign(f, numberFieldNormalizer(field));
|
|
261
|
-
}
|
|
262
|
-
else if (['picklist', 'select', 'multipicklist', 'options'].indexOf(fieldType) !== -1) {
|
|
263
|
-
Object.assign(f, optionsFieldNormalizer(field));
|
|
264
|
-
}
|
|
265
|
-
else if (['string', null, undefined, '', 'email', 'phone', 'url', 'combobox'].indexOf(fieldType) !== -1) {
|
|
266
|
-
Object.assign(f, stringFieldNormalizer(field));
|
|
267
|
-
}
|
|
268
|
-
else if (['bool', 'boolean', 'checkbox', 'switch'].indexOf(fieldType) !== -1) {
|
|
269
|
-
Object.assign(f, booleanFieldNormalizer(field));
|
|
270
|
-
}
|
|
271
|
-
else if (['text', 'textarea'].indexOf(fieldType) !== -1) {
|
|
272
|
-
Object.assign(f, textFieldNormalizer(field));
|
|
273
|
-
}
|
|
274
|
-
else if (['richtext'].indexOf(fieldType) !== -1) {
|
|
275
|
-
Object.assign(f, richtextFieldNormalizer(field));
|
|
276
|
-
}
|
|
277
|
-
else if (['date', 'time', 'datetime', 'datetime-local'].indexOf(fieldType) !== -1) {
|
|
278
|
-
Object.assign(f, datetimeFieldNormalizer(field));
|
|
279
|
-
}
|
|
280
|
-
else if (['reference', 'references', 'multireference'].indexOf(fieldType) !== -1) {
|
|
281
|
-
Object.assign(f, referenceFieldNormalizer(field));
|
|
282
|
-
}
|
|
283
|
-
else if (['radio'].indexOf(fieldType) !== -1) {
|
|
284
|
-
Object.assign(f, radioFieldNormalizer(field));
|
|
285
|
-
}
|
|
286
|
-
else if (fieldType === 'composite') {
|
|
287
|
-
Object.assign(f, {
|
|
288
|
-
type: 'composite',
|
|
289
|
-
label: field.label,
|
|
290
|
-
name: field.name,
|
|
291
|
-
fields: uniqueNameFilter(field.fields || field.reference || [], uniqFieldNames, (typeof (field.name) !== 'undefined')).map((v) => fieldNormalizer(v, uniqFieldNames))
|
|
292
|
-
});
|
|
293
|
-
if (field.subtype) {
|
|
294
|
-
f.subtype = field.subtype;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
else if (fieldType === 'list') {
|
|
298
|
-
const list = field.list || field.reference;
|
|
299
|
-
Object.assign(f, {
|
|
300
|
-
type: field.name ? 'list' : 'missing name',
|
|
301
|
-
label: field.label,
|
|
302
|
-
name: field.name,
|
|
303
|
-
list: fieldNormalizer(uniqueNameFilter(list, uniqFieldNames), field.name ? [] : uniqFieldNames)
|
|
304
|
-
});
|
|
305
|
-
if (field.selectable) {
|
|
306
|
-
f.selectable = field.selectable;
|
|
307
|
-
}
|
|
308
|
-
if (field.resourceType) {
|
|
309
|
-
f.resourceType = field.resourceType;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
else if (fieldType === 'hidden') {
|
|
313
|
-
Object.assign(f, {
|
|
314
|
-
name: field.name,
|
|
315
|
-
type: 'hidden'
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
Object.assign(f, {
|
|
320
|
-
label: field.label,
|
|
321
|
-
name: field.name,
|
|
322
|
-
type: `@v2 ${fieldType}`
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
if (field.validations) {
|
|
326
|
-
Object.assign(f.validations, field.validations);
|
|
327
|
-
}
|
|
328
|
-
if (field.auto) {
|
|
329
|
-
f.auto = field.auto;
|
|
330
|
-
}
|
|
331
|
-
if ((field.default || field.defaultValue) && !f.default) {
|
|
332
|
-
const d = field.default || field.defaultValue;
|
|
333
|
-
if (Array.isArray(d)) {
|
|
334
|
-
f.default = [];
|
|
335
|
-
for (const v of d) {
|
|
336
|
-
if (typeof (v) === 'object' && v !== null) {
|
|
337
|
-
const o = {
|
|
338
|
-
id: v.id || v.value || v.name || v.label,
|
|
339
|
-
label: v.label || 'N/A'
|
|
340
|
-
};
|
|
341
|
-
if (v.type) {
|
|
342
|
-
o.type = v.type;
|
|
343
|
-
}
|
|
344
|
-
if (!v.type && f.reference && f.reference.name) { // Bullhorn CAND PT bad metadata
|
|
345
|
-
o.type = f.reference.name;
|
|
346
|
-
}
|
|
347
|
-
f.default.push(o);
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
f.default = v;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
else if (typeof (d) === 'object' && d !== null) {
|
|
355
|
-
if (field.type === 'boolean' && typeof (d.value) === 'boolean') {
|
|
356
|
-
f.default = d.value;
|
|
357
|
-
}
|
|
358
|
-
else if (Object.keys(d).length) {
|
|
359
|
-
const id = d.id || d.value || d.name || d.label;
|
|
360
|
-
if (id) {
|
|
361
|
-
f.default = {
|
|
362
|
-
id: d.id || d.value || d.name || d.label,
|
|
363
|
-
label: d.label || 'N/A'
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
if (d.type) {
|
|
367
|
-
f.default.type = d.type;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
f.default = d;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (field.visible || field.alwaysVisible) {
|
|
376
|
-
f.visible = field.visible || field.alwaysVisible;
|
|
377
|
-
}
|
|
378
|
-
if (field.hidden) {
|
|
379
|
-
f.hidden = field.hidden;
|
|
380
|
-
}
|
|
381
|
-
if (field.hint || field.helpText) {
|
|
382
|
-
f.hint = field.hint || field.helpText;
|
|
383
|
-
}
|
|
384
|
-
if (field.valueType) {
|
|
385
|
-
f.valueType = field.valueType;
|
|
386
|
-
}
|
|
387
|
-
if (field.multiple) {
|
|
388
|
-
f.multiple = field.multiple;
|
|
389
|
-
}
|
|
390
|
-
if (field.suggestions && field.suggestions.length) {
|
|
391
|
-
f.suggestions = field.suggestions;
|
|
392
|
-
}
|
|
393
|
-
if (field.updateable === false || field.updatable === false) {
|
|
394
|
-
if (!f.flags) {
|
|
395
|
-
f.flags = { updatable: false };
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
f.flags.updatable = false;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
if (field.createable === false || field.creatable === false) {
|
|
402
|
-
if (!f.flags) {
|
|
403
|
-
f.flags = { creatable: false };
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
f.flags.creatable = false;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
if (typeof (field.enabled) !== 'undefined') {
|
|
410
|
-
f.enabled = field.enabled;
|
|
411
|
-
}
|
|
412
|
-
if (typeof (field.disabled) !== 'undefined') {
|
|
413
|
-
f.disabled = field.disabled;
|
|
414
|
-
}
|
|
415
|
-
return f;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
/*
|
|
419
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
420
|
-
* @Date: 2019-09-19 17:34:49
|
|
421
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
422
|
-
* @Last Modified time: 2023-02-10 09:44:59
|
|
423
|
-
*/
|
|
424
|
-
const sortObj = (obj) => {
|
|
425
|
-
if (typeof (obj) !== 'object' || obj === null) {
|
|
426
|
-
return obj;
|
|
427
|
-
}
|
|
428
|
-
if (Array.isArray(obj)) {
|
|
429
|
-
return obj.map((e) => sortObj(e)).sort();
|
|
430
|
-
}
|
|
431
|
-
return Object.keys(obj).sort().reduce((sorted, k) => {
|
|
432
|
-
sorted[k] = sortObj(obj[k]);
|
|
433
|
-
return sorted;
|
|
434
|
-
}, {});
|
|
435
|
-
};
|
|
436
|
-
const metaNormalizer = (meta, integration, resourceType) => {
|
|
437
|
-
const uniqFieldNames = [];
|
|
438
|
-
const integrationCode = (integration || '').toUpperCase();
|
|
439
|
-
const metaV3 = {
|
|
440
|
-
integration,
|
|
441
|
-
resourceType,
|
|
442
|
-
availableLayouts: meta.availableLayouts,
|
|
443
|
-
layout: {
|
|
444
|
-
id: meta.layout.id,
|
|
445
|
-
name: meta.layout.name,
|
|
446
|
-
label: meta.layout.label,
|
|
447
|
-
version: '3.0.0',
|
|
448
|
-
sections: (meta.layout.sections || []).map((s) => {
|
|
449
|
-
const section = {
|
|
450
|
-
label: s.label,
|
|
451
|
-
fields: uniqueNameFilter(s.fields || [], uniqFieldNames).map((v) => fieldNormalizer(v, uniqFieldNames)) // VIST-424
|
|
452
|
-
};
|
|
453
|
-
if (s.visible || s.alwaysVisible) {
|
|
454
|
-
section.visible = s.visible || s.alwaysVisible;
|
|
455
|
-
}
|
|
456
|
-
return section;
|
|
457
|
-
})
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
if (meta.layout.origLayoutId) {
|
|
461
|
-
metaV3.layout.origLayoutId = meta.layout.origLayoutId;
|
|
462
|
-
}
|
|
463
|
-
if (meta.drafts) {
|
|
464
|
-
metaV3.drafts = meta.drafts;
|
|
465
|
-
}
|
|
466
|
-
if (meta.layout.children) {
|
|
467
|
-
metaV3.layout.children = meta.layout.children;
|
|
468
|
-
}
|
|
469
|
-
const fieldFixesByIntegration = (f) => {
|
|
470
|
-
if (f.type === 'boolean' && ((typeof (f.default) !== 'boolean') && f.default && !f.default.value)) {
|
|
471
|
-
delete f.default;
|
|
472
|
-
}
|
|
473
|
-
else if (f.type === 'reference') {
|
|
474
|
-
const references = (f.reference instanceof Array) ? f.reference : [f.reference];
|
|
475
|
-
for (const r of references) {
|
|
476
|
-
if (r && r.creatable === false && typeof (r.updatable) === 'undefined') {
|
|
477
|
-
r.updatable = false; // User missing updatable, may be other too
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
switch (integrationCode) {
|
|
482
|
-
case 'BULLHORN': {
|
|
483
|
-
if (resourceType === 'Appointment') {
|
|
484
|
-
if (['dateBegin', 'dateEnd'].indexOf(f.name) !== -1) {
|
|
485
|
-
if (!f.validations) {
|
|
486
|
-
f.validations = { step: 1800 };
|
|
487
|
-
}
|
|
488
|
-
else {
|
|
489
|
-
f.validations.step = 1800;
|
|
490
|
-
}
|
|
491
|
-
f.default = f.name === 'dateBegin' ? 'now' : '30.minutes';
|
|
492
|
-
if (!f.auto) {
|
|
493
|
-
f.auto = {};
|
|
494
|
-
}
|
|
495
|
-
f.auto[f.name === 'dateBegin' ? 'lt' : 'gt'] = {
|
|
496
|
-
against: f.name === 'dateBegin' ? 'dateEnd' : 'dateBegin',
|
|
497
|
-
offset: `${f.name === 'dateBegin' ? '-30' : '30'}.minutes`
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
if (f.name === 'comments') {
|
|
502
|
-
if (!f.validations) {
|
|
503
|
-
f.valudations = { required: true };
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
f.validations.required = true;
|
|
507
|
-
}
|
|
508
|
-
if (resourceType === 'Note') {
|
|
509
|
-
f.type = 'richtext';
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
if (f.name === 'address.state') {
|
|
513
|
-
f.creatable = false;
|
|
514
|
-
f.updatable = false;
|
|
515
|
-
}
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
case 'GOOGLE': {
|
|
519
|
-
if (f.name === 'contactId') {
|
|
520
|
-
f.label = 'Contact';
|
|
521
|
-
}
|
|
522
|
-
else if (['start', 'end'].indexOf(f.name) !== -1) {
|
|
523
|
-
if (!f.auto) {
|
|
524
|
-
f.auto = {};
|
|
525
|
-
}
|
|
526
|
-
f.auto[f.name === 'start' ? 'lt' : 'gt'] = {
|
|
527
|
-
against: f.name === 'start' ? 'end' : 'start',
|
|
528
|
-
offset: `${f.name === 'start' ? '-30' : '30'}.minutes`
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
break;
|
|
532
|
-
}
|
|
533
|
-
case 'OFFICE365': {
|
|
534
|
-
if (resourceType === 'Events') {
|
|
535
|
-
if (['start', 'end'].indexOf(f.name) !== -1) {
|
|
536
|
-
if (!f.validations) {
|
|
537
|
-
f.validations = { step: 1800 };
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
f.validations.step = 1800;
|
|
541
|
-
}
|
|
542
|
-
f.default = f.name === 'start' ? 'now' : '30.minutes';
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
if (resourceType === 'Tasks' && f.name === 'checklist') {
|
|
546
|
-
f.creatable = false;
|
|
547
|
-
}
|
|
548
|
-
if (f.name === 'description' && resourceType !== 'Tasks') {
|
|
549
|
-
f.type = 'richtext';
|
|
550
|
-
}
|
|
551
|
-
else if (f.name === 'content') {
|
|
552
|
-
f.type = 'text';
|
|
553
|
-
}
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
case 'SALESFORCE': {
|
|
557
|
-
if (resourceType === 'Task' && f.name === 'WhatId') {
|
|
558
|
-
f.disabled = {
|
|
559
|
-
'WhoId.type': 'Lead'
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
if (['Description', 'ParentId'].indexOf(f.name) !== -1) {
|
|
563
|
-
if (!f.visible) {
|
|
564
|
-
f.visible = true;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
if (f.type === 'reference') {
|
|
568
|
-
const references = (f.reference instanceof Array) ? f.reference : [f.reference];
|
|
569
|
-
for (const r of references) {
|
|
570
|
-
if (r && ['Account'].indexOf(r.name) !== -1) { // force creatable
|
|
571
|
-
r.creatable = true;
|
|
572
|
-
r.updatable = true;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
break;
|
|
577
|
-
}
|
|
578
|
-
case 'SUGAR': {
|
|
579
|
-
if (['description', 'parent_id', 'contact_id', 'contacts'].indexOf(f.name) !== -1) {
|
|
580
|
-
if (!f.visible) {
|
|
581
|
-
f.visible = true;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
if (f.type === 'reference') {
|
|
585
|
-
const references = (f.reference instanceof Array) ? f.reference : [f.reference];
|
|
586
|
-
for (const r of references) {
|
|
587
|
-
if (r && ['Accounts', 'Contacts', 'Leads'].indexOf(r.name) !== -1) {
|
|
588
|
-
r.label = r.name.slice(0, -1); // Use singular labels
|
|
589
|
-
r.creatable = true;
|
|
590
|
-
r.updatable = true;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
break;
|
|
595
|
-
}
|
|
596
|
-
case 'ZENDESK': {
|
|
597
|
-
if (resourceType === 'Ticket' && f.name === 'assignee') {
|
|
598
|
-
f.reference.updatable = false;
|
|
599
|
-
}
|
|
600
|
-
if (resourceType === 'Comment' && f.name === 'body') {
|
|
601
|
-
f.visible = true;
|
|
602
|
-
}
|
|
603
|
-
break;
|
|
604
|
-
}
|
|
605
|
-
case 'HUBSPOT': {
|
|
606
|
-
if ((resourceType === 'LogCall' && ['body', 'hs_call_body'].indexOf(f.name) !== -1) ||
|
|
607
|
-
(resourceType === 'LogSMS' && f.name === 'hs_communication_body')) {
|
|
608
|
-
f.type = 'richtext';
|
|
609
|
-
}
|
|
610
|
-
break;
|
|
611
|
-
}
|
|
612
|
-
case 'NETSUITE': {
|
|
613
|
-
if (f.name === 'company' && !f.auto) {
|
|
614
|
-
f.auto = {
|
|
615
|
-
search: {
|
|
616
|
-
params: {
|
|
617
|
-
contactId: 'contact.id'
|
|
618
|
-
},
|
|
619
|
-
url: '../Contact/${contactId}?expand=company',
|
|
620
|
-
extract: 'company'
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
case 'ZOHO': {
|
|
627
|
-
if (['Calls', 'Tasks', 'Events'].indexOf(resourceType) !== -1 && ['Who_Id', 'What_Id'].indexOf(f.name) !== -1) {
|
|
628
|
-
if (f.name === 'What_Id') {
|
|
629
|
-
f.visible = true;
|
|
630
|
-
f.disabled = {
|
|
631
|
-
'Who_Id.type': 'Leads'
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
if (f.reference instanceof Array) {
|
|
635
|
-
f.reference.forEach((r) => {
|
|
636
|
-
r.creatable = true;
|
|
637
|
-
r.updatable = true;
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
if (resourceType === 'Calls' && f.name === 'Description') {
|
|
642
|
-
f.label = 'Description';
|
|
643
|
-
f.visible = true;
|
|
644
|
-
f.hidden = {
|
|
645
|
-
"Call_Type": "Missed"
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
break;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
if (f.type === 'composite' && f.fields) {
|
|
652
|
-
for (const ff of f.fields) {
|
|
653
|
-
fieldFixesByIntegration(ff);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
// common fixes for all integrations
|
|
658
|
-
if (metaV3.layout.sections.length) {
|
|
659
|
-
for (const s of (metaV3.layout.sections)) {
|
|
660
|
-
if (!s || !s.fields) {
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
for (const f of s.fields) {
|
|
664
|
-
fieldFixesByIntegration(f);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
// Google Gmail children enhancement
|
|
669
|
-
if (integrationCode === 'GOOGLE') {
|
|
670
|
-
if (resourceType === 'Mail') {
|
|
671
|
-
metaV3.layout.editable = false;
|
|
672
|
-
if (!metaV3.layout.children) {
|
|
673
|
-
metaV3.layout.children = [{
|
|
674
|
-
label: 'Comments',
|
|
675
|
-
name: 'comments',
|
|
676
|
-
reference: {
|
|
677
|
-
resourceType: 'Comment',
|
|
678
|
-
label: 'Comment',
|
|
679
|
-
editable: false
|
|
680
|
-
}
|
|
681
|
-
}];
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
else if (resourceType === 'Task') {
|
|
685
|
-
if (!metaV3.layout.children) {
|
|
686
|
-
metaV3.layout.children = [{
|
|
687
|
-
label: 'Subtasks',
|
|
688
|
-
name: 'subTasks',
|
|
689
|
-
reference: {
|
|
690
|
-
resourceType: 'Subtask',
|
|
691
|
-
label: 'Subtask'
|
|
692
|
-
}
|
|
693
|
-
}];
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
else if (resourceType === 'Comment') {
|
|
697
|
-
metaV3.layout.editable = false;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
else if (integrationCode === 'ZENDESK') {
|
|
701
|
-
if (resourceType === 'Ticket') {
|
|
702
|
-
if (!metaV3.layout.children) {
|
|
703
|
-
metaV3.layout.children = [{
|
|
704
|
-
label: 'Comments',
|
|
705
|
-
name: 'comments',
|
|
706
|
-
reference: {
|
|
707
|
-
resourceType: 'Comment',
|
|
708
|
-
label: 'Comment',
|
|
709
|
-
editable: false
|
|
710
|
-
}
|
|
711
|
-
}];
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
else if (resourceType === 'Comment') {
|
|
715
|
-
metaV3.layout.editable = false;
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
else if (integrationCode === 'MSDYNAMICS' && !metaV3.fieldsMap) {
|
|
719
|
-
if (resourceType === 'phonecall') {
|
|
720
|
-
metaV3.fieldsMap = {
|
|
721
|
-
contactables: ['from', 'to'],
|
|
722
|
-
subject: 'subject',
|
|
723
|
-
phoneNumber: 'phonenumber',
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
else if (resourceType === 'contact') {
|
|
727
|
-
metaV3.fieldsMap = {
|
|
728
|
-
phoneNumber: 'telephone1',
|
|
729
|
-
firstName: 'firstname',
|
|
730
|
-
lastName: 'lastname'
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
else if (resourceType === 'account') {
|
|
734
|
-
metaV3.fieldsMap = {
|
|
735
|
-
phoneNumber: 'telephone1',
|
|
736
|
-
displayName: 'name'
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
else if (integrationCode === 'OFFICE365') {
|
|
741
|
-
if (resourceType === 'Conversations') {
|
|
742
|
-
metaV3.layout.editable = false;
|
|
743
|
-
metaV3.layout.children = [{
|
|
744
|
-
label: 'Comments',
|
|
745
|
-
name: 'comments',
|
|
746
|
-
reference: {
|
|
747
|
-
resourceType: 'Comment',
|
|
748
|
-
label: 'Comment',
|
|
749
|
-
editable: false
|
|
750
|
-
}
|
|
751
|
-
}];
|
|
752
|
-
}
|
|
753
|
-
else if (resourceType === 'Comment') {
|
|
754
|
-
metaV3.layout.editable = false;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
else if (integrationCode === 'JOBDIVA') {
|
|
758
|
-
if (resourceType === 'CandidateNote' || resourceType === 'ContactNote') {
|
|
759
|
-
metaV3.layout.editable = false;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
else if (integrationCode === 'CLIO' && resourceType === 'Contact') {
|
|
763
|
-
metaV3.layout.sections[0].fields.push({
|
|
764
|
-
name: 'custom_field_values',
|
|
765
|
-
type: 'hidden'
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
else if (integrationCode === 'CONNECTWISE' && ['companies', 'contacts'].indexOf(resourceType) !== -1) {
|
|
769
|
-
metaV3.layout.sections[0].fields.push({
|
|
770
|
-
name: 'billToCompany',
|
|
771
|
-
type: 'hidden'
|
|
772
|
-
});
|
|
773
|
-
metaV3.layout.sections[0].fields.push({
|
|
774
|
-
name: 'identifier',
|
|
775
|
-
type: 'hidden'
|
|
776
|
-
});
|
|
777
|
-
metaV3.layout.sections[0].fields.push({
|
|
778
|
-
name: 'status',
|
|
779
|
-
type: 'hidden'
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
else if (integrationCode === 'ZOHO' && resourceType === 'Tasks') {
|
|
783
|
-
metaV3.layout.sections[0].fields.push({
|
|
784
|
-
name: 'module',
|
|
785
|
-
type: 'hidden'
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
return sortObj(metaV3);
|
|
789
|
-
};
|
|
790
|
-
|
|
791
|
-
/*
|
|
792
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
793
|
-
* @Date: 2019-09-19 17:35:19
|
|
794
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
795
|
-
* @Last Modified time: 2019-11-22 14:57:07
|
|
796
|
-
*/
|
|
797
|
-
class MetaHttpClient {
|
|
798
|
-
constructor(httpClient) {
|
|
799
|
-
this.httpClient = httpClient;
|
|
800
|
-
}
|
|
801
|
-
delete(url, queryParams = {}) {
|
|
802
|
-
const options = this.prepareOptions(queryParams);
|
|
803
|
-
return this.httpClient.delete(`${this.constructUrl(url)}`, options);
|
|
804
|
-
}
|
|
805
|
-
get(url, queryParams = {}) {
|
|
806
|
-
const options = this.prepareOptions(queryParams);
|
|
807
|
-
return this.httpClient.get(`${this.constructUrl(url)}`, options);
|
|
808
|
-
}
|
|
809
|
-
post(url, body, queryParams = {}) {
|
|
810
|
-
const options = this.prepareOptions(queryParams);
|
|
811
|
-
return this.httpClient.post(`${this.constructUrl(url)}`, body, options);
|
|
812
|
-
}
|
|
813
|
-
put(url, body, queryParams = {}) {
|
|
814
|
-
const options = this.prepareOptions(queryParams);
|
|
815
|
-
return this.httpClient.put(`${this.constructUrl(url)}`, body, options);
|
|
816
|
-
}
|
|
817
|
-
patch(url, body, queryParams = {}) {
|
|
818
|
-
const options = this.prepareOptions(queryParams);
|
|
819
|
-
return this.httpClient.patch(`${this.constructUrl(url)}`, body, options);
|
|
820
|
-
}
|
|
821
|
-
constructUrl(path) {
|
|
822
|
-
return /^http/.test(path) ? path : `${path}`;
|
|
823
|
-
}
|
|
824
|
-
prepareOptions(queryParams) {
|
|
825
|
-
Object.keys(queryParams).forEach(key => {
|
|
826
|
-
if (queryParams[key] == null || queryParams[key] === '') {
|
|
827
|
-
delete queryParams[key];
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
const params = new HttpParams({
|
|
831
|
-
fromObject: queryParams
|
|
832
|
-
});
|
|
833
|
-
const options = {
|
|
834
|
-
headers: new HttpHeaders({
|
|
835
|
-
Accept: 'application/json'
|
|
836
|
-
}),
|
|
837
|
-
params
|
|
838
|
-
};
|
|
839
|
-
return options;
|
|
840
|
-
}
|
|
841
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaHttpClient, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
842
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaHttpClient, providedIn: 'root' }); }
|
|
843
|
-
}
|
|
844
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaHttpClient, decorators: [{
|
|
845
|
-
type: Injectable,
|
|
846
|
-
args: [{
|
|
847
|
-
providedIn: 'root'
|
|
848
|
-
}]
|
|
849
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
850
|
-
|
|
851
|
-
/*
|
|
852
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
853
|
-
* @Date: 2019-09-19 17:35:19
|
|
854
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
855
|
-
* @Last Modified time: 2020-08-10 22:35:31
|
|
856
|
-
*/
|
|
857
|
-
const STORAGE_PARAMS_REGEXES = {
|
|
858
|
-
localStorage: /^localStorage\.(.*)/,
|
|
859
|
-
sessionStorage: /^sessionStorage\.(.*)/,
|
|
860
|
-
};
|
|
861
|
-
const INTEGRATION_URL_TEMPLATE = '/extensions/v2/accounts/${localStorage.vgis.accountId}/users/${localStorage.vgis.userId}/connectors/${integrationCode}';
|
|
862
|
-
const RESOURCE_URL_TEMPLATE = INTEGRATION_URL_TEMPLATE + '${parentsPath}/${resourceType}';
|
|
863
|
-
const NEW_RESOURCE_URL_TEMPLATE = INTEGRATION_URL_TEMPLATE + '${parentsPath}/resources/${resourceType}';
|
|
864
|
-
class IMetaParentConfig {
|
|
865
|
-
}
|
|
866
|
-
class IMetaResourceConfig {
|
|
867
|
-
}
|
|
868
|
-
class MetaResourceService {
|
|
869
|
-
constructor(httpClient) {
|
|
870
|
-
this.httpClient = httpClient;
|
|
871
|
-
}
|
|
872
|
-
setConfig(config) {
|
|
873
|
-
this.baseIntegrationUrl = INTEGRATION_URL_TEMPLATE.replace(/\${\s*([\w.]+)\s*}/g, (m, value) => {
|
|
874
|
-
for (const storage of Object.keys(STORAGE_PARAMS_REGEXES)) {
|
|
875
|
-
const match = value.match(STORAGE_PARAMS_REGEXES[storage]);
|
|
876
|
-
if (match) {
|
|
877
|
-
return window[storage].getItem(match[1]) || window[storage].getItem(`cti.${match[1]}`);
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
return config[value];
|
|
881
|
-
});
|
|
882
|
-
this.baseResourceUrl = RESOURCE_URL_TEMPLATE.replace(/\${\s*([\w.]+)\s*}/g, (m, value) => {
|
|
883
|
-
for (const storage of Object.keys(STORAGE_PARAMS_REGEXES)) {
|
|
884
|
-
const match = value.match(STORAGE_PARAMS_REGEXES[storage]);
|
|
885
|
-
if (match) {
|
|
886
|
-
return window[storage].getItem(match[1]) || window[storage].getItem(`cti.${match[1]}`);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
if (value === 'parentsPath') {
|
|
890
|
-
let parentsPath = '';
|
|
891
|
-
if (config.parent) { // config.parent: { resourceType: '...', id: '...', parent: {...} }
|
|
892
|
-
let rootParent = config.parent;
|
|
893
|
-
while (rootParent) {
|
|
894
|
-
parentsPath += `/${rootParent.resourceType || rootParent.type}/${rootParent.externalId || rootParent.id}`;
|
|
895
|
-
rootParent = rootParent.parent;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return parentsPath;
|
|
899
|
-
}
|
|
900
|
-
else {
|
|
901
|
-
return config[value];
|
|
902
|
-
}
|
|
903
|
-
});
|
|
904
|
-
this.newResourceUrl = NEW_RESOURCE_URL_TEMPLATE.replace(/\${\s*([\w.]+)\s*}/g, (m, value) => {
|
|
905
|
-
for (const storage of Object.keys(STORAGE_PARAMS_REGEXES)) {
|
|
906
|
-
const match = value.match(STORAGE_PARAMS_REGEXES[storage]);
|
|
907
|
-
if (match) {
|
|
908
|
-
return window[storage].getItem(match[1]);
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
if (value === 'parentsPath') {
|
|
912
|
-
let parentsPath = '';
|
|
913
|
-
if (config.parent) { // config.parent: { resourceType: '...', id: '...', parent: {...} }
|
|
914
|
-
let rootParent = config.parent;
|
|
915
|
-
while (rootParent) {
|
|
916
|
-
parentsPath += `/${rootParent.resourceType || rootParent.type}/${rootParent.externalId || rootParent.id}`;
|
|
917
|
-
rootParent = rootParent.parent;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
return parentsPath;
|
|
921
|
-
}
|
|
922
|
-
else {
|
|
923
|
-
return config[value];
|
|
924
|
-
}
|
|
925
|
-
});
|
|
926
|
-
this.id = config.externalId;
|
|
927
|
-
}
|
|
928
|
-
new(config) {
|
|
929
|
-
const s = new MetaResourceService(this.httpClient);
|
|
930
|
-
s.setConfig(config);
|
|
931
|
-
return s;
|
|
932
|
-
}
|
|
933
|
-
searchIntegration(query, scope) {
|
|
934
|
-
let searchUrl = `${this.baseIntegrationUrl}/search?q=${encodeURIComponent(query)}`;
|
|
935
|
-
if (scope) {
|
|
936
|
-
searchUrl += `&scope=${encodeURIComponent(scope)}`;
|
|
937
|
-
}
|
|
938
|
-
return this.httpClient.get(searchUrl);
|
|
939
|
-
}
|
|
940
|
-
getMetadata(layoutId, refresh) {
|
|
941
|
-
let url = `${this.baseResourceUrl.replace('/v2/', '/v3/')}/metadata`;
|
|
942
|
-
// url += `?t=${new Date().getTime()}`;
|
|
943
|
-
if (refresh) {
|
|
944
|
-
url += `${url.indexOf('?') === -1 ? '?' : '&'}refresh=true`;
|
|
945
|
-
}
|
|
946
|
-
if (layoutId) {
|
|
947
|
-
url += `${url.indexOf('?') === -1 ? '?' : '&'}layoutId=${layoutId}`;
|
|
948
|
-
}
|
|
949
|
-
return this.httpClient.get(url);
|
|
950
|
-
}
|
|
951
|
-
getDetails(externalId, extraParams) {
|
|
952
|
-
let params = 'referenceDetails=true';
|
|
953
|
-
if (extraParams) {
|
|
954
|
-
for (const p in extraParams) {
|
|
955
|
-
if (extraParams[p]) {
|
|
956
|
-
params += `&${p}=${extraParams[p]}`;
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
return this.httpClient.get(`${this.baseResourceUrl}/${externalId}?${params}`);
|
|
961
|
-
}
|
|
962
|
-
getByPath(path) {
|
|
963
|
-
let fullPath = `${this.newResourceUrl}${path}`;
|
|
964
|
-
if (/^..\//.test(path)) {
|
|
965
|
-
fullPath = `${this.baseIntegrationUrl}${path.substring(2)}`;
|
|
966
|
-
}
|
|
967
|
-
return this.httpClient.get(fullPath);
|
|
968
|
-
}
|
|
969
|
-
save(payload) {
|
|
970
|
-
if (this.id) {
|
|
971
|
-
return this.httpClient.put(`${this.baseResourceUrl}/${this.id}`, payload);
|
|
972
|
-
}
|
|
973
|
-
else {
|
|
974
|
-
return this.httpClient.post(`${this.baseResourceUrl}`, payload);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaResourceService, deps: [{ token: MetaHttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
978
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaResourceService, providedIn: 'root' }); }
|
|
979
|
-
}
|
|
980
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaResourceService, decorators: [{
|
|
981
|
-
type: Injectable,
|
|
982
|
-
args: [{
|
|
983
|
-
providedIn: 'root'
|
|
984
|
-
}]
|
|
985
|
-
}], ctorParameters: function () { return [{ type: MetaHttpClient }]; } });
|
|
986
|
-
|
|
987
|
-
/*
|
|
988
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
989
|
-
* @Date: 2019-09-19 17:35:19
|
|
990
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
991
|
-
* @Last Modified time: 2020-05-03 21:31:16
|
|
992
|
-
*/
|
|
993
|
-
class MetaMsgService {
|
|
994
|
-
constructor(metaContext) {
|
|
995
|
-
this.metaContext = metaContext;
|
|
996
|
-
this.msgCallbacks = {}; // message subscribers holder
|
|
997
|
-
this.msgListeneres = []; // ensure listener is registerd only once
|
|
998
|
-
this.workerMsgListener = (msg) => {
|
|
999
|
-
if (msg && msg.data && msg.data.action && msg.data.$state) {
|
|
1000
|
-
const state = msg.data.$state;
|
|
1001
|
-
const callback = this.msgCallbacks[state]; // original requester callback
|
|
1002
|
-
if (callback) {
|
|
1003
|
-
delete msg.data.$state;
|
|
1004
|
-
callback(msg.data);
|
|
1005
|
-
}
|
|
1006
|
-
delete this.msgCallbacks[state]; // get rid of the listener callback when done
|
|
1007
|
-
}
|
|
1008
|
-
this.removeExpiredListeners(); // wipe out the expired listeners if any
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
sendMessage(provider, msg, callback, isLong = false) {
|
|
1012
|
-
provider = (provider || '').toUpperCase();
|
|
1013
|
-
const providerWorker = this.metaContext.workers[provider];
|
|
1014
|
-
if (providerWorker) {
|
|
1015
|
-
if (this.msgListeneres.indexOf(provider)) {
|
|
1016
|
-
this.msgListeneres.push(provider);
|
|
1017
|
-
providerWorker.addEventListener('message', this.workerMsgListener, false); // register a short time listener
|
|
1018
|
-
}
|
|
1019
|
-
let state; // message unique identifier
|
|
1020
|
-
do {
|
|
1021
|
-
state = new Date().getTime();
|
|
1022
|
-
} while (this.msgCallbacks[state]);
|
|
1023
|
-
this.msgCallbacks[state] = callback; // register message callback
|
|
1024
|
-
msg.$state = state;
|
|
1025
|
-
providerWorker.postMessage(msg);
|
|
1026
|
-
setTimeout(() => {
|
|
1027
|
-
this.cancelMsgListener(msg.action, state); // give up, worker does not replied on time
|
|
1028
|
-
const listenerIndex = this.msgListeneres.indexOf(provider);
|
|
1029
|
-
if (listenerIndex !== -1) {
|
|
1030
|
-
this.msgListeneres.splice(listenerIndex, 1);
|
|
1031
|
-
}
|
|
1032
|
-
providerWorker.removeEventListener('message', this.workerMsgListener); // remove listener when done
|
|
1033
|
-
}, isLong ? 60000 : 2000);
|
|
1034
|
-
}
|
|
1035
|
-
else {
|
|
1036
|
-
callback({ action: msg.action, error: `Worker ${provider} is not registered` });
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
cancelMsgListener(action, storedState) {
|
|
1040
|
-
const storedCallback = this.msgCallbacks[storedState];
|
|
1041
|
-
if (storedCallback) {
|
|
1042
|
-
storedCallback({ action, error: 'Timeout', state: storedState }); // always reply with something
|
|
1043
|
-
}
|
|
1044
|
-
delete this.msgCallbacks[storedState];
|
|
1045
|
-
}
|
|
1046
|
-
removeExpiredListeners() {
|
|
1047
|
-
const now = new Date();
|
|
1048
|
-
for (const state in this.msgCallbacks) { // cleanup expired listeners (< 1 min ago);
|
|
1049
|
-
if (parseInt(state, 10) < now.setMinutes(now.getMinutes() - 1)) {
|
|
1050
|
-
delete this.msgCallbacks[state];
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaMsgService, deps: [{ token: MetaContextService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1055
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaMsgService, providedIn: 'root' }); }
|
|
1056
|
-
}
|
|
1057
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaMsgService, decorators: [{
|
|
1058
|
-
type: Injectable,
|
|
1059
|
-
args: [{
|
|
1060
|
-
providedIn: 'root'
|
|
1061
|
-
}]
|
|
1062
|
-
}], ctorParameters: function () { return [{ type: MetaContextService }]; } });
|
|
1063
|
-
|
|
1064
|
-
/*
|
|
1065
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
1066
|
-
* @Date: 2023-02-08 12:41:56
|
|
1067
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
1068
|
-
* @Last Modified time: 2023-02-08 14:04:46
|
|
1069
|
-
*/
|
|
1070
|
-
const pad2Digit = (t) => t < 10 ? '0' + t : t;
|
|
1071
|
-
const resourceCardLabel = (r) => {
|
|
1072
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
1073
|
-
if (r._vgis && r._vgis.connector === 'CLIO' && r._vgis.resourceType === 'PhoneCommunicationTimer') {
|
|
1074
|
-
const duration = r.quantity || 0; // in seconds
|
|
1075
|
-
let durationText = '00:00';
|
|
1076
|
-
if (duration > 0) {
|
|
1077
|
-
const hours = Math.floor(duration / 3600);
|
|
1078
|
-
const minutes = Math.floor((duration % 3600) / 60);
|
|
1079
|
-
const seconds = Math.round(duration % 60);
|
|
1080
|
-
const checkHours = hours ? pad2Digit(hours) + ':' : '';
|
|
1081
|
-
durationText = checkHours + pad2Digit(minutes) + ':' + pad2Digit(seconds);
|
|
1082
|
-
}
|
|
1083
|
-
return `⏱ ${durationText} | $${(Math.round(r.price) * 100) / 100} | ${r.non_billable ? 'Non-billable' : 'Billable'}`;
|
|
1084
|
-
}
|
|
1085
|
-
return r.Subject || r.subject || r.summary || r.title || r.CaseNumber || r.comment || r.body || r.name || r.topic || r.content || '...';
|
|
1086
|
-
};
|
|
1087
|
-
|
|
1088
|
-
/*
|
|
1089
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
1090
|
-
* @Date: 2019-09-19 17:35:19
|
|
1091
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
1092
|
-
* @Last Modified time: 2020-05-03 21:31:44
|
|
1093
|
-
*/
|
|
1094
|
-
class MetaReferenceService {
|
|
1095
|
-
constructor(router) {
|
|
1096
|
-
this.router = router;
|
|
1097
|
-
this.dialogs = [];
|
|
1098
|
-
this.router.events.subscribe(() => {
|
|
1099
|
-
if (this.dialogs.length) {
|
|
1100
|
-
for (let d = (this.dialogs.length - 1); d >= 0; d--) {
|
|
1101
|
-
this.dialogs[d].onComplete();
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1106
|
-
openDialog(componentRef, metaResource, integrationCode, reference, resource, preview, preferResourceType, theme, overlayContainer) {
|
|
1107
|
-
const references = !(reference instanceof Array) ? [reference] : reference.filter((r) => r.creatable !== false);
|
|
1108
|
-
if (resource && resource.type) {
|
|
1109
|
-
if (!references.find((f) => (f.name || f.resourceType) === (resource.resourceType || resource.type))) {
|
|
1110
|
-
references.push({
|
|
1111
|
-
name: resource.resourceType || resource.type,
|
|
1112
|
-
resourceType: resource.resourceType || resource.type,
|
|
1113
|
-
label: resource.label || resource.resourceType || resource.type
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
const modalObservable = new Observable(observer => {
|
|
1118
|
-
const refDialog = componentRef.instance;
|
|
1119
|
-
refDialog.integrationCode = integrationCode;
|
|
1120
|
-
refDialog.reference = references;
|
|
1121
|
-
refDialog.resource = resource;
|
|
1122
|
-
refDialog.metaResource = metaResource;
|
|
1123
|
-
refDialog.edit = !preview;
|
|
1124
|
-
refDialog.preferResourceType = preferResourceType;
|
|
1125
|
-
refDialog.theme = theme;
|
|
1126
|
-
const domElem = componentRef.hostView.rootNodes[0];
|
|
1127
|
-
const dialogIndex = this.dialogs.push(refDialog);
|
|
1128
|
-
if (dialogIndex > 1) {
|
|
1129
|
-
const modalPanel = domElem.querySelector('.Vlt-modal__panel');
|
|
1130
|
-
if (modalPanel) {
|
|
1131
|
-
modalPanel.style.marginLeft = `${(dialogIndex * 5)}px`;
|
|
1132
|
-
modalPanel.style.marginTop = `${(dialogIndex * 10)}px`;
|
|
1133
|
-
modalPanel.style.marginBottom = `${((dialogIndex - 1) * 8)}px`;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
if (overlayContainer && overlayContainer.appendChild) {
|
|
1137
|
-
overlayContainer.appendChild(domElem);
|
|
1138
|
-
}
|
|
1139
|
-
else {
|
|
1140
|
-
document.body.appendChild(domElem);
|
|
1141
|
-
}
|
|
1142
|
-
refDialog.onComplete = (result) => {
|
|
1143
|
-
if (result) {
|
|
1144
|
-
/* eslint-disable no-underscore-dangle */
|
|
1145
|
-
if (result._vgis) {
|
|
1146
|
-
observer.next({
|
|
1147
|
-
id: result._vgis.externalId || result._vgis.id,
|
|
1148
|
-
label: result._vgis.label,
|
|
1149
|
-
type: result._vgis.resourceType,
|
|
1150
|
-
raw: result
|
|
1151
|
-
});
|
|
1152
|
-
}
|
|
1153
|
-
else {
|
|
1154
|
-
console.log('onComplete non VGIS result', result);
|
|
1155
|
-
}
|
|
1156
|
-
/* eslint-enable no-underscore-dangle */
|
|
1157
|
-
}
|
|
1158
|
-
else {
|
|
1159
|
-
observer.next();
|
|
1160
|
-
}
|
|
1161
|
-
observer.complete();
|
|
1162
|
-
componentRef.destroy();
|
|
1163
|
-
this.dialogs.splice(dialogIndex - 1, 1);
|
|
1164
|
-
};
|
|
1165
|
-
});
|
|
1166
|
-
return modalObservable;
|
|
1167
|
-
}
|
|
1168
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaReferenceService, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1169
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaReferenceService, providedIn: 'root' }); }
|
|
1170
|
-
}
|
|
1171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaReferenceService, decorators: [{
|
|
1172
|
-
type: Injectable,
|
|
1173
|
-
args: [{
|
|
1174
|
-
providedIn: 'root'
|
|
1175
|
-
}]
|
|
1176
|
-
}], ctorParameters: function () { return [{ type: i1$1.Router }]; } });
|
|
1177
|
-
|
|
1178
|
-
class MetaLayout {
|
|
1179
|
-
constructor(viewContainerRef, ref, el, metaResource, referenceService, metaMsgService, metaContext) {
|
|
1180
|
-
this.viewContainerRef = viewContainerRef;
|
|
1181
|
-
this.ref = ref;
|
|
1182
|
-
this.el = el;
|
|
1183
|
-
this.metaResource = metaResource;
|
|
1184
|
-
this.referenceService = referenceService;
|
|
1185
|
-
this.metaMsgService = metaMsgService;
|
|
1186
|
-
this.metaContext = metaContext;
|
|
1187
|
-
this.optionalFields = {};
|
|
1188
|
-
this.showAll = false;
|
|
1189
|
-
this.fieldsVisibilityChanged = new Subject();
|
|
1190
|
-
this.childResourceCardLabel = resourceCardLabel;
|
|
1191
|
-
// console.log('MetaLayout', this.meta);
|
|
1192
|
-
this.overlayContainer = el.nativeElement;
|
|
1193
|
-
}
|
|
1194
|
-
get isPersistedResource() {
|
|
1195
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
1196
|
-
return (this.resource &&
|
|
1197
|
-
this.resource._vgis &&
|
|
1198
|
-
(this.resource._vgis.externalId || this.resource._vgis.id));
|
|
1199
|
-
}
|
|
1200
|
-
ngOnInit() {
|
|
1201
|
-
this.integrationCode = this.meta.integrationCode || this.integration;
|
|
1202
|
-
this.resourceType = this.meta.resourceType || this.type;
|
|
1203
|
-
this.parentForm = this.el.nativeElement.closest("form");
|
|
1204
|
-
this.configureOptionalSections();
|
|
1205
|
-
this.fieldsVisibilityChanged
|
|
1206
|
-
.pipe(debounceTime(100), distinctUntilChanged())
|
|
1207
|
-
.subscribe(() => {
|
|
1208
|
-
this.countOptionalFields();
|
|
1209
|
-
});
|
|
1210
|
-
setTimeout(() => {
|
|
1211
|
-
this.countOptionalFields();
|
|
1212
|
-
}, 0);
|
|
1213
|
-
if (this.parentForm) {
|
|
1214
|
-
this.parentForm.addEventListener("change", () => {
|
|
1215
|
-
setTimeout(() => {
|
|
1216
|
-
this.fieldsVisibilityChanged.next(JSON.stringify(this.resource));
|
|
1217
|
-
this.countOptionalFields();
|
|
1218
|
-
}, 0);
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
if (this.theme !== "inherit") {
|
|
1222
|
-
this.applyTheme();
|
|
1223
|
-
}
|
|
1224
|
-
if (this.isPersistedResource && this.meta.children && this.preview) {
|
|
1225
|
-
this.procChildrenExternalLinks();
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
ngDoCheck() {
|
|
1229
|
-
this.countOptionalFields();
|
|
1230
|
-
}
|
|
1231
|
-
ngOnChanges(changes) {
|
|
1232
|
-
if (changes.meta) {
|
|
1233
|
-
this.configureOptionalSections();
|
|
1234
|
-
setTimeout(() => {
|
|
1235
|
-
this.countOptionalFields();
|
|
1236
|
-
}, 0);
|
|
1237
|
-
}
|
|
1238
|
-
if (changes.theme) {
|
|
1239
|
-
this.theme = changes.theme.currentValue;
|
|
1240
|
-
this.applyTheme();
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
countOptionalFields() {
|
|
1244
|
-
let count = 0;
|
|
1245
|
-
const countSectionFields = (s) => {
|
|
1246
|
-
for (const f of s.fields || []) {
|
|
1247
|
-
if (f.fields?.length && !f.visible) {
|
|
1248
|
-
countSectionFields(f);
|
|
1249
|
-
}
|
|
1250
|
-
else {
|
|
1251
|
-
if (f.$optional && !f.$hidden) {
|
|
1252
|
-
count++;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
};
|
|
1257
|
-
for (const s of this.meta.sections) {
|
|
1258
|
-
const notOptionalAny = s.fields?.find((f) => !f.$optional);
|
|
1259
|
-
s.$optional = !notOptionalAny;
|
|
1260
|
-
if (!s.visible) {
|
|
1261
|
-
countSectionFields(s);
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
this.optionalFieldsCount = count;
|
|
1265
|
-
}
|
|
1266
|
-
configureOptionalSections() {
|
|
1267
|
-
if (this.meta?.sections) {
|
|
1268
|
-
for (const s of this.meta.sections) {
|
|
1269
|
-
Object.defineProperty(s, "$optional", {
|
|
1270
|
-
value: true,
|
|
1271
|
-
writable: true,
|
|
1272
|
-
configurable: true,
|
|
1273
|
-
enumerable: false,
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
ngAfterContentChecked() {
|
|
1279
|
-
this.ref.detectChanges();
|
|
1280
|
-
}
|
|
1281
|
-
toggleOptionalFields() {
|
|
1282
|
-
this.showAll = !this.showAll;
|
|
1283
|
-
this.ngAfterContentChecked();
|
|
1284
|
-
}
|
|
1285
|
-
buildExternalLinkForChild(child) {
|
|
1286
|
-
if (child?.externalId || child.id) {
|
|
1287
|
-
this.metaMsgService.sendMessage(this.integrationCode.toUpperCase(), {
|
|
1288
|
-
action: "buildExternalLink",
|
|
1289
|
-
integrationCode: this.integrationCode.toLowerCase(),
|
|
1290
|
-
ref: {
|
|
1291
|
-
parentRefId: this.resource._vgis.externalId || this.resource._vgis.id,
|
|
1292
|
-
parentResourceType: this.resource._vgis.resourceType,
|
|
1293
|
-
...child
|
|
1294
|
-
},
|
|
1295
|
-
profile: this.metaContext.profiles[this.integrationCode.toUpperCase()]
|
|
1296
|
-
}, (response) => {
|
|
1297
|
-
if (!response.error) {
|
|
1298
|
-
child.externalLink = response.externalLink;
|
|
1299
|
-
}
|
|
1300
|
-
else {
|
|
1301
|
-
console.warn("No external link support for", this.integrationCode, child.resourceType);
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
procChildrenExternalLinks() {
|
|
1307
|
-
for (const child of this.meta.children) {
|
|
1308
|
-
let childrenValue = this.resource[child.name];
|
|
1309
|
-
Object.defineProperty(this.resource, child.name, {
|
|
1310
|
-
set: (children) => {
|
|
1311
|
-
childrenValue = children;
|
|
1312
|
-
if (children instanceof Array) {
|
|
1313
|
-
childrenValue = children;
|
|
1314
|
-
for (const c in children) {
|
|
1315
|
-
if (children[c]?._vgis && !children[c]._vgis.externalLink) { // some day BE will start providing it
|
|
1316
|
-
this.buildExternalLinkForChild(children[c]._vgis);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
},
|
|
1321
|
-
get: () => childrenValue,
|
|
1322
|
-
enumerable: true,
|
|
1323
|
-
configurable: true
|
|
1324
|
-
});
|
|
1325
|
-
if (childrenValue) {
|
|
1326
|
-
this.resource[child.name] = childrenValue;
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
async openChild(childResource, childModel) {
|
|
1331
|
-
const metaRefDialog = await Promise.resolve().then(function () { return index; }).then((m) => m.MetaRefDialog);
|
|
1332
|
-
childResource.reference.parent = this.resource._vgis; // eslint-disable-line no-underscore-dangle
|
|
1333
|
-
const refDialogComponent = this.viewContainerRef.createComponent(metaRefDialog);
|
|
1334
|
-
this.referenceService
|
|
1335
|
-
.openDialog(refDialogComponent, this.metaResource, this.integrationCode, childResource.reference, childModel, childModel && childResource.reference.editable === false // is preview mode
|
|
1336
|
-
)
|
|
1337
|
-
.subscribe((result) => {
|
|
1338
|
-
if (result?.raw) {
|
|
1339
|
-
if (!this.resource[childResource.name]) {
|
|
1340
|
-
this.resource[childResource.name] = [];
|
|
1341
|
-
}
|
|
1342
|
-
if (childModel) {
|
|
1343
|
-
Object.assign(childModel, result.raw);
|
|
1344
|
-
}
|
|
1345
|
-
else {
|
|
1346
|
-
this.buildExternalLinkForChild(result.raw._vgis);
|
|
1347
|
-
this.resource[childResource.name].push(result.raw);
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
applyTheme() {
|
|
1353
|
-
const metaTheme = this.theme === "dark" ? metaDark : metaLight;
|
|
1354
|
-
for (const key of Object.keys(metaTheme.properties)) {
|
|
1355
|
-
this.el.nativeElement.style.setProperty(key, metaTheme.properties[key]);
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaLayout, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: MetaResourceService }, { token: MetaReferenceService }, { token: MetaMsgService }, { token: MetaContextService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1359
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.11", type: MetaLayout, selector: "vgip-meta-layout", inputs: { meta: "meta", resource: "resource", integration: "integration", type: "type", preview: "preview", theme: "theme" }, usesOnChanges: true, ngImport: i0, template: "<div *ngFor='let section of meta.sections' class='Vlt-section' [ngClass]=\"{ shown: showAll || section.visible || (!meta.oneTimeOptional && !section.$optional) || (meta.oneTimeOptional && !optionalFieldsCount) }\">\n\t<h5 *ngIf='section.label' class=\"Vlt-section__title\">{{section.label}}</h5>\n\t<div style='overflow: visible;' [ngClass]=\"{ 'for-preview': preview }\">\n\t\t<small *ngIf='section.description' class=\"Vlt-form__element__hint\">{{section.description}}</small>\n\t\t<div>\n\t\t\t<ng-container *ngFor='let field of section.fields'>\n\t\t\t\t<vgip-meta-field *ngIf='!field.$hidden && (showAll || section.visible || !field.$optional)' [meta]='field' [parent]='resource' [integrationCode]='integrationCode' [resourceType]='resourceType' [preview]='preview' [ngClass]=\"{ shown: !field.$invisible && (showAll || true) }\" theme='inherit' [attr.data-theme]='theme'></vgip-meta-field>\n\t\t\t</ng-container>\n\t\t</div>\n\t</div>\n</div>\n<div *ngIf='isPersistedResource && meta.children && preview'>\n\t<div *ngFor='let child of meta.children'>\n\t\t<h5 class='Vlt-children__title'>\n\t\t\t<svg class=\"Vlt-icon\"><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-stack\" /></svg> \n\t\t\t{{child.label}} <span class='Vlt-grey'>({{(resource[child.name] || []).length}})</span>\n\t\t</h5>\n\t\t<div *ngFor=\"let c of resource[child.name]\" style='position: relative;'>\n\n\t\t\t<div class=\"Vlt-card Vlt-bg-white\">\n\t\t\t\t<div class=\"Vlt-card__content Vlt-btn-on-hover\">\n\t\t\t\t\t<h5>{{childResourceCardLabel(c)}}</h5>\n\t\t\t\t\t<div style='font-size: 12px; line-height: 16px;'>\n\t\t\t\t\t\tCreated: <span class='Vlt-black'>{{c._vgis.createdDate | date:'mediumDate'}}</span>\n\t\t\t\t\t\tEdited: <span class='Vlt-black'>{{c._vgis.modifiedDate | date:'medium'}}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"Vlt-badge Vlt-badge--app Vlt-badge--purple Vlt-badge--small\">{{c._vgis.resourceType}}</div>\n\t\t\t\t\t<div class=\"Vlt-btn-group Vlt-btn-group--hover\">\n\t\t\t\t\t\t<a *ngIf='c._vgis.externalLink' attr.href='{{c._vgis.externalLink}}' target='_blank' rel='noopener' rel='noopener' class=\"Vlt-btn Vlt-btn--tertiary Vlt-btn--icon\" aria-label='Open external'><svg style='margin-left: 0; margin-right: 0;'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-open\"/></svg></a>\n\t\t\t\t\t\t<button type='button' (click)='openChild(child, c)' class=\"Vlt-btn Vlt-btn--tertiary Vlt-btn--icon\"><svg style='margin-left: 0; margin-right: 0;'><use attr.xlink:href=\"volta/volta-icons.svg#Vlt-icon-{{ child.reference.editable ? 'edit' : 'eye-negative' }}\"/></svg></button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<button style='width: 100%; margin-top: 0; max-width: 100%;' type='button' (click)='openChild(child)' class=\"Vlt-btn Vlt-btn--small Vlt-btn--secondary\" [disabled]='child.creatable === false'>\n\t\t\t<svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-plus\"/></svg>{{child.reference.label}}\n\t\t</button>\n\t</div>\n</div>\n<div *ngIf='!(meta.oneTimeOptional && showAll)' [ngClass]='{ centered: !meta.oneTimeOptional }'>\n\t<button *ngIf='!preview && optionalFieldsCount' type='button' (click)='toggleOptionalFields()' class=\"Vlt-btn Vlt-btn--small Vlt-btn--link more-button\" style='margin: 0; margin-bottom: 10px;'>\n\t\t<svg><use attr.xlink:href=\"volta/volta-icons.svg#Vlt-icon-chevron-{{ showAll ? 'up' : 'down' }}\"/></svg>\n\t\t{{ showAll ? 'Hide' : 'Show' }} Optional Fields ({{optionalFieldsCount}})\n\t</button>\n</div>\n", styles: ["vgip-meta-field{display:none}vgip-meta-field.shown{display:initial}.Vlt-section__title{line-height:14px;padding:16px 16px 14px 3px;margin:-9px -1px 8px;background-color:var(--vgip-meta-resource-bg-color);color:var(--vgip-meta-resource-color);position:sticky;top:-9px;z-index:3;border-bottom:1px solid var(--vgip-meta-separator-color)}.Vlt-section{margin:0;padding-bottom:8px;display:none}.Vlt-section.shown{display:block}.Vlt-btn.vlt-add-child:hover{transform:scale(1.02)}.for-preview{margin-top:-6px}.Vlt-card{margin-bottom:16px;padding:16px}.Vlt-card .Vlt-btn-group.Vlt-btn-group--hover{right:-8px}button.more-button:focus{font-weight:700}.centered{text-align:center}.Vlt-btn--link{color:var(--vgip-meta-link-color)}.Vlt-btn--link:hover{color:var(--vgip-meta-link-hover-color)}.Vlt-btn--link svg{fill:var(--vgip-meta-link-color)}\n"], dependencies: [{ kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MetaField, selector: "vgip-meta-field", inputs: ["meta", "parent", "integrationCode", "resourceType", "index", "scope", "preview", "theme", "overlayContainer"], outputs: ["onChange", "onLeave"] }, { kind: "pipe", type: i1$2.DatePipe, name: "date" }] }); }
|
|
1360
|
-
}
|
|
1361
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaLayout, decorators: [{
|
|
1362
|
-
type: Component,
|
|
1363
|
-
args: [{ selector: "vgip-meta-layout", template: "<div *ngFor='let section of meta.sections' class='Vlt-section' [ngClass]=\"{ shown: showAll || section.visible || (!meta.oneTimeOptional && !section.$optional) || (meta.oneTimeOptional && !optionalFieldsCount) }\">\n\t<h5 *ngIf='section.label' class=\"Vlt-section__title\">{{section.label}}</h5>\n\t<div style='overflow: visible;' [ngClass]=\"{ 'for-preview': preview }\">\n\t\t<small *ngIf='section.description' class=\"Vlt-form__element__hint\">{{section.description}}</small>\n\t\t<div>\n\t\t\t<ng-container *ngFor='let field of section.fields'>\n\t\t\t\t<vgip-meta-field *ngIf='!field.$hidden && (showAll || section.visible || !field.$optional)' [meta]='field' [parent]='resource' [integrationCode]='integrationCode' [resourceType]='resourceType' [preview]='preview' [ngClass]=\"{ shown: !field.$invisible && (showAll || true) }\" theme='inherit' [attr.data-theme]='theme'></vgip-meta-field>\n\t\t\t</ng-container>\n\t\t</div>\n\t</div>\n</div>\n<div *ngIf='isPersistedResource && meta.children && preview'>\n\t<div *ngFor='let child of meta.children'>\n\t\t<h5 class='Vlt-children__title'>\n\t\t\t<svg class=\"Vlt-icon\"><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-stack\" /></svg> \n\t\t\t{{child.label}} <span class='Vlt-grey'>({{(resource[child.name] || []).length}})</span>\n\t\t</h5>\n\t\t<div *ngFor=\"let c of resource[child.name]\" style='position: relative;'>\n\n\t\t\t<div class=\"Vlt-card Vlt-bg-white\">\n\t\t\t\t<div class=\"Vlt-card__content Vlt-btn-on-hover\">\n\t\t\t\t\t<h5>{{childResourceCardLabel(c)}}</h5>\n\t\t\t\t\t<div style='font-size: 12px; line-height: 16px;'>\n\t\t\t\t\t\tCreated: <span class='Vlt-black'>{{c._vgis.createdDate | date:'mediumDate'}}</span>\n\t\t\t\t\t\tEdited: <span class='Vlt-black'>{{c._vgis.modifiedDate | date:'medium'}}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"Vlt-badge Vlt-badge--app Vlt-badge--purple Vlt-badge--small\">{{c._vgis.resourceType}}</div>\n\t\t\t\t\t<div class=\"Vlt-btn-group Vlt-btn-group--hover\">\n\t\t\t\t\t\t<a *ngIf='c._vgis.externalLink' attr.href='{{c._vgis.externalLink}}' target='_blank' rel='noopener' rel='noopener' class=\"Vlt-btn Vlt-btn--tertiary Vlt-btn--icon\" aria-label='Open external'><svg style='margin-left: 0; margin-right: 0;'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-open\"/></svg></a>\n\t\t\t\t\t\t<button type='button' (click)='openChild(child, c)' class=\"Vlt-btn Vlt-btn--tertiary Vlt-btn--icon\"><svg style='margin-left: 0; margin-right: 0;'><use attr.xlink:href=\"volta/volta-icons.svg#Vlt-icon-{{ child.reference.editable ? 'edit' : 'eye-negative' }}\"/></svg></button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<button style='width: 100%; margin-top: 0; max-width: 100%;' type='button' (click)='openChild(child)' class=\"Vlt-btn Vlt-btn--small Vlt-btn--secondary\" [disabled]='child.creatable === false'>\n\t\t\t<svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-plus\"/></svg>{{child.reference.label}}\n\t\t</button>\n\t</div>\n</div>\n<div *ngIf='!(meta.oneTimeOptional && showAll)' [ngClass]='{ centered: !meta.oneTimeOptional }'>\n\t<button *ngIf='!preview && optionalFieldsCount' type='button' (click)='toggleOptionalFields()' class=\"Vlt-btn Vlt-btn--small Vlt-btn--link more-button\" style='margin: 0; margin-bottom: 10px;'>\n\t\t<svg><use attr.xlink:href=\"volta/volta-icons.svg#Vlt-icon-chevron-{{ showAll ? 'up' : 'down' }}\"/></svg>\n\t\t{{ showAll ? 'Hide' : 'Show' }} Optional Fields ({{optionalFieldsCount}})\n\t</button>\n</div>\n", styles: ["vgip-meta-field{display:none}vgip-meta-field.shown{display:initial}.Vlt-section__title{line-height:14px;padding:16px 16px 14px 3px;margin:-9px -1px 8px;background-color:var(--vgip-meta-resource-bg-color);color:var(--vgip-meta-resource-color);position:sticky;top:-9px;z-index:3;border-bottom:1px solid var(--vgip-meta-separator-color)}.Vlt-section{margin:0;padding-bottom:8px;display:none}.Vlt-section.shown{display:block}.Vlt-btn.vlt-add-child:hover{transform:scale(1.02)}.for-preview{margin-top:-6px}.Vlt-card{margin-bottom:16px;padding:16px}.Vlt-card .Vlt-btn-group.Vlt-btn-group--hover{right:-8px}button.more-button:focus{font-weight:700}.centered{text-align:center}.Vlt-btn--link{color:var(--vgip-meta-link-color)}.Vlt-btn--link:hover{color:var(--vgip-meta-link-hover-color)}.Vlt-btn--link svg{fill:var(--vgip-meta-link-color)}\n"] }]
|
|
1364
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: MetaResourceService }, { type: MetaReferenceService }, { type: MetaMsgService }, { type: MetaContextService }]; }, propDecorators: { meta: [{
|
|
1365
|
-
type: Input
|
|
1366
|
-
}], resource: [{
|
|
1367
|
-
type: Input
|
|
1368
|
-
}], integration: [{
|
|
1369
|
-
type: Input
|
|
1370
|
-
}], type: [{
|
|
1371
|
-
type: Input
|
|
1372
|
-
}], preview: [{
|
|
1373
|
-
type: Input
|
|
1374
|
-
}], theme: [{
|
|
1375
|
-
type: Input
|
|
1376
|
-
}] } });
|
|
1377
|
-
|
|
1378
|
-
/*
|
|
1379
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
1380
|
-
* @Date: 2021-02-11 17:25:09
|
|
1381
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
1382
|
-
* @Last Modified time: 2021-02-11 17:33:57
|
|
1383
|
-
*/
|
|
1384
|
-
class MetaAutofocusDirective {
|
|
1385
|
-
constructor(elementRef) {
|
|
1386
|
-
this.elementRef = elementRef;
|
|
1387
|
-
}
|
|
1388
|
-
ngAfterContentInit() {
|
|
1389
|
-
if (this.vgipMetaFormAutofocus) {
|
|
1390
|
-
setTimeout(() => {
|
|
1391
|
-
const firstInput = this.elementRef.nativeElement.querySelector('.Vlt-form__element:not(.has-value) .main:not(.standalone):not([value])');
|
|
1392
|
-
if (firstInput) {
|
|
1393
|
-
firstInput.focus();
|
|
1394
|
-
}
|
|
1395
|
-
}, 300);
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaAutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1399
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.11", type: MetaAutofocusDirective, selector: "[vgipMetaFormAutofocus]", inputs: { vgipMetaFormAutofocus: "vgipMetaFormAutofocus" }, ngImport: i0 }); }
|
|
1400
|
-
}
|
|
1401
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaAutofocusDirective, decorators: [{
|
|
1402
|
-
type: Directive,
|
|
1403
|
-
args: [{
|
|
1404
|
-
// eslint-disable-next-line
|
|
1405
|
-
selector: '[vgipMetaFormAutofocus]'
|
|
1406
|
-
}]
|
|
1407
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { vgipMetaFormAutofocus: [{
|
|
1408
|
-
type: Input
|
|
1409
|
-
}] } });
|
|
1410
|
-
|
|
1411
|
-
class MetaResource {
|
|
1412
|
-
constructor(ref, el, metaResourceService, metaContext, metaMsgService) {
|
|
1413
|
-
this.ref = ref;
|
|
1414
|
-
this.el = el;
|
|
1415
|
-
this.metaResourceService = metaResourceService;
|
|
1416
|
-
this.metaContext = metaContext;
|
|
1417
|
-
this.metaMsgService = metaMsgService;
|
|
1418
|
-
this.editMode = true;
|
|
1419
|
-
this.done = new EventEmitter();
|
|
1420
|
-
this.resourceChange = new EventEmitter();
|
|
1421
|
-
this.edit = true;
|
|
1422
|
-
this.contactsSuggestionsDone = false;
|
|
1423
|
-
this.resourceChanged = new Subject();
|
|
1424
|
-
this.onMenuClickout = () => {
|
|
1425
|
-
delete this.resourceMenuVisible;
|
|
1426
|
-
document.removeEventListener('click', this.onMenuClickout);
|
|
1427
|
-
};
|
|
1428
|
-
}
|
|
1429
|
-
get niceFields() {
|
|
1430
|
-
if (!this.resource.niceFields
|
|
1431
|
-
&& this.resource.meta
|
|
1432
|
-
&& this.resource.meta.layout
|
|
1433
|
-
&& this.resource.meta.layout.sections) {
|
|
1434
|
-
const extractSectionFields = (s) => {
|
|
1435
|
-
for (const f of s.fields) {
|
|
1436
|
-
if (f.name) {
|
|
1437
|
-
this.resource.niceFields[f.name] = f;
|
|
1438
|
-
}
|
|
1439
|
-
if (f.fields && f.fields.length) {
|
|
1440
|
-
extractSectionFields(f);
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
};
|
|
1444
|
-
this.resource.niceFields = {};
|
|
1445
|
-
for (const s of this.resource.meta.layout.sections) {
|
|
1446
|
-
extractSectionFields(s);
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
return this.resource.niceFields;
|
|
1450
|
-
}
|
|
1451
|
-
get fieldNames() {
|
|
1452
|
-
const names = Object.keys(this.niceFields);
|
|
1453
|
-
if (this.resource.meta.layout.children) {
|
|
1454
|
-
for (const child of this.resource.meta.layout.children) {
|
|
1455
|
-
names.push(child.name);
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
return names;
|
|
1459
|
-
}
|
|
1460
|
-
ngOnInit() {
|
|
1461
|
-
this.integrationCode = (this.resource.integrationCode || '').toUpperCase();
|
|
1462
|
-
this.resourceType = this.resource.resourceType;
|
|
1463
|
-
this.service = (this.metaResourceServiceDelegated || this.metaResourceService).new(this.resource);
|
|
1464
|
-
if (!this.model) {
|
|
1465
|
-
this.model = {};
|
|
1466
|
-
}
|
|
1467
|
-
this.isPersistent = this.resource?.externalId;
|
|
1468
|
-
if (this.isPersistent) {
|
|
1469
|
-
this.resourceVrn = `vrn:vgis:${this.integrationCode.toLowerCase()}:${this.resource.resourceType}:${this.resource.externalId}`;
|
|
1470
|
-
}
|
|
1471
|
-
if (this.resource.activity && this.resource.ref.editable === false && !this.resource.externalId) {
|
|
1472
|
-
this.resource.externalId = 'MISSING_EXTERNAL_ID';
|
|
1473
|
-
}
|
|
1474
|
-
if (!this.resource.meta) {
|
|
1475
|
-
this.loadMetadata(this.resource.layoutId);
|
|
1476
|
-
}
|
|
1477
|
-
else {
|
|
1478
|
-
// if (this.isPersistent && (!this.isEditable || this.resources[ref.name].meta.layout.children)) {
|
|
1479
|
-
// this.edit = false;
|
|
1480
|
-
// }
|
|
1481
|
-
this.meta = this.resource.meta;
|
|
1482
|
-
this.isEditable = this.meta.layout && this.meta.layout.editable !== false;
|
|
1483
|
-
if (this.isPersistent && (!this.isEditable || this.editMode === false || this.meta.layout.children)) {
|
|
1484
|
-
this.edit = false;
|
|
1485
|
-
}
|
|
1486
|
-
this.currentLayoutId = this.meta.layout.id;
|
|
1487
|
-
this.getDetails();
|
|
1488
|
-
this.getFieldsMap();
|
|
1489
|
-
}
|
|
1490
|
-
if (this.theme !== 'inherit') {
|
|
1491
|
-
this.applyTheme();
|
|
1492
|
-
}
|
|
1493
|
-
this.resourceChanged.pipe(debounceTime(400), distinctUntilChanged()).subscribe((value) => {
|
|
1494
|
-
this.resourceChange.emit(value);
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
ngOnChanges(changes) {
|
|
1498
|
-
if (changes.theme) {
|
|
1499
|
-
this.theme = changes.theme.currentValue;
|
|
1500
|
-
if (this.theme !== 'inherit') {
|
|
1501
|
-
this.applyTheme();
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
setEditMode() {
|
|
1506
|
-
this.edit = true;
|
|
1507
|
-
}
|
|
1508
|
-
loadMetadata(layoutId, refresh = false, ev) {
|
|
1509
|
-
const layoutStoreKey = `vgis.layout_${this.metaContext.vgipUserId}_${this.integrationCode}_${this.resource.resourceType}`;
|
|
1510
|
-
if (!layoutId) {
|
|
1511
|
-
layoutId = localStorage.getItem(layoutStoreKey);
|
|
1512
|
-
}
|
|
1513
|
-
this.busy = true;
|
|
1514
|
-
setTimeout(() => {
|
|
1515
|
-
this.metaLoading = true;
|
|
1516
|
-
}, 0);
|
|
1517
|
-
delete this.resource.niceFields;
|
|
1518
|
-
this.service.getMetadata(layoutId, refresh).subscribe({
|
|
1519
|
-
next: (meta) => {
|
|
1520
|
-
this.currentLayoutId = meta.layout.id || '';
|
|
1521
|
-
if (this.currentLayoutId.indexOf(this.lockedLayoutId) === -1) {
|
|
1522
|
-
delete this.lockedLayoutId;
|
|
1523
|
-
}
|
|
1524
|
-
if (layoutId !== meta.layout.id && !this.isPersistent) {
|
|
1525
|
-
localStorage.removeItem(layoutStoreKey);
|
|
1526
|
-
}
|
|
1527
|
-
this.meta = metaNormalizer(meta, this.integrationCode, this.resource.resourceType);
|
|
1528
|
-
this.isEditable = this.meta.layout && this.meta.layout.editable !== false;
|
|
1529
|
-
this.resource.meta = this.meta;
|
|
1530
|
-
if (!refresh && this.isPersistent && (!this.isEditable || this.editMode === false || this.meta.layout.children)) {
|
|
1531
|
-
this.edit = false;
|
|
1532
|
-
}
|
|
1533
|
-
delete this.busy;
|
|
1534
|
-
this.getDetails();
|
|
1535
|
-
this.getFieldsMap();
|
|
1536
|
-
},
|
|
1537
|
-
error: (metaError) => {
|
|
1538
|
-
delete this.busy;
|
|
1539
|
-
this.generalError = `Error loading resource metadata (${metaError.statusText})`;
|
|
1540
|
-
localStorage.removeItem(layoutStoreKey);
|
|
1541
|
-
},
|
|
1542
|
-
complete: () => {
|
|
1543
|
-
delete this.metaLoading;
|
|
1544
|
-
this.forceUiUpdate();
|
|
1545
|
-
}
|
|
1546
|
-
});
|
|
1547
|
-
if (ev) {
|
|
1548
|
-
ev.preventDefault();
|
|
1549
|
-
ev.stopPropagation();
|
|
1550
|
-
return false;
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
changeLayout() {
|
|
1554
|
-
localStorage.setItem(`vgis.layout_${this.metaContext.vgipUserId}_${this.integrationCode}_${this.resource.resourceType}`, this.currentLayoutId);
|
|
1555
|
-
this.loadMetadata(this.currentLayoutId);
|
|
1556
|
-
}
|
|
1557
|
-
getDetails() {
|
|
1558
|
-
delete this.lockedLayoutId;
|
|
1559
|
-
if (this.resource && (this.resource.externalId || this.resource.id)) {
|
|
1560
|
-
if (this.resource.parent && this.resource.activity // skip fetch
|
|
1561
|
-
&& this.meta.layout.editable === false && !this.meta.layout.children) {
|
|
1562
|
-
for (const p in this.resource.activity) {
|
|
1563
|
-
if (this.resource.activity[p] && this.fieldNames.indexOf(p) !== -1) {
|
|
1564
|
-
this.model[p] = this.resource.activity[p];
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
else {
|
|
1569
|
-
this.busy = true;
|
|
1570
|
-
this.service.getDetails((this.resource.externalId || this.resource.id), {
|
|
1571
|
-
eventId: this.resource.eventId !== 'NO_EVENT' ? this.resource.eventId : null, layoutId: this.resource.layoutId
|
|
1572
|
-
}).subscribe({
|
|
1573
|
-
next: (resource) => {
|
|
1574
|
-
/* eslint-disable no-underscore-dangle */
|
|
1575
|
-
if (resource._vgis) {
|
|
1576
|
-
if (resource._vgis.eventId) {
|
|
1577
|
-
this.metaContext.vgipEventId = resource._vgis.eventId;
|
|
1578
|
-
}
|
|
1579
|
-
this.lockedLayoutId = resource._vgis.layoutId || resource._vgis.recordTypeId;
|
|
1580
|
-
// sample orig layoutId: 012000000000000AAA, custom layoutId: 66ccbb3d1810985aa3a16202:012000000000000AAA
|
|
1581
|
-
// so if the current layout is not inherited from the original one, reload the orig meta
|
|
1582
|
-
// CCOMNI-155 - allow form layout change (*unless we are certain that the current and locked match)
|
|
1583
|
-
if (!this.skipLayoutMatchCheck && this.lockedLayoutId && (this.currentLayoutId || '').indexOf(this.lockedLayoutId) === -1) {
|
|
1584
|
-
this.skipLayoutMatchCheck = true; // ensure prevent HPBR-8782 loop condition
|
|
1585
|
-
if ((this.meta.availableLayouts || []).find((l) => (l.id || '').indexOf(this.lockedLayoutId) !== -1)) { // if it's not available, don't even try
|
|
1586
|
-
this.loadMetadata(this.lockedLayoutId);
|
|
1587
|
-
}
|
|
1588
|
-
else {
|
|
1589
|
-
console.warn('Unable to match layout Ids', this.lockedLayoutId, this.currentLayoutId);
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
/* eslint-enable no-underscore-dangle */
|
|
1594
|
-
for (const p in resource) {
|
|
1595
|
-
if ((typeof (resource[p]) !== 'undefined') && (this.fieldNames.indexOf(p) !== -1 || p === '_vgis')) {
|
|
1596
|
-
this.model[p] = resource[p];
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
delete this.busy;
|
|
1600
|
-
},
|
|
1601
|
-
error: (resourceError) => {
|
|
1602
|
-
this.generalError = resourceError.error ? resourceError.error.message || resourceError.message : resourceError.message;
|
|
1603
|
-
delete this.busy;
|
|
1604
|
-
},
|
|
1605
|
-
complete: () => {
|
|
1606
|
-
this.forceUiUpdate();
|
|
1607
|
-
}
|
|
1608
|
-
});
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
else {
|
|
1612
|
-
if (this.resource.ref && this.resource.ref.activity) { // reuse failed autoactivities data
|
|
1613
|
-
for (const p in this.resource.ref.activity) {
|
|
1614
|
-
if (this.resource.ref.activity && this.fieldNames.indexOf(p) !== -1) {
|
|
1615
|
-
this.model[p] = this.resource.ref.activity[p]; // VGIS-7215 (copy only valid fields)
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
this.performAutoFill();
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
performAutoFill() {
|
|
1623
|
-
this.metaMsgService.sendMessage(this.integrationCode, {
|
|
1624
|
-
action: 'autoFill',
|
|
1625
|
-
integration: this.integrationCode,
|
|
1626
|
-
resourceType: this.resourceType,
|
|
1627
|
-
resource: JSON.parse(JSON.stringify(this.model)),
|
|
1628
|
-
fields: this.niceFields,
|
|
1629
|
-
event: this.metaContext.context,
|
|
1630
|
-
profile: this.metaContext.profiles[this.integrationCode]
|
|
1631
|
-
}, (response) => {
|
|
1632
|
-
if (!response.error) {
|
|
1633
|
-
for (const afp in response.autoFill) {
|
|
1634
|
-
if (!this.model[afp]) {
|
|
1635
|
-
this.model[afp] = response.autoFill[afp];
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
});
|
|
1640
|
-
}
|
|
1641
|
-
getFieldsMap() {
|
|
1642
|
-
if (this.meta.fieldsMap) {
|
|
1643
|
-
this.fieldsMap = this.meta.fieldsMap;
|
|
1644
|
-
this.markContactables();
|
|
1645
|
-
this.buildContactsSuggestions();
|
|
1646
|
-
if (!this.resource.externalId) {
|
|
1647
|
-
this.buildSubjectTemplate();
|
|
1648
|
-
this.execTransformer();
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
else {
|
|
1652
|
-
this.metaMsgService.sendMessage(this.integrationCode, { action: 'fieldsMap', integration: this.integrationCode, resourceType: this.resourceType }, (response) => {
|
|
1653
|
-
if (!response.error) {
|
|
1654
|
-
this.fieldsMap = response.fieldsMap;
|
|
1655
|
-
this.markContactables();
|
|
1656
|
-
this.buildContactsSuggestions();
|
|
1657
|
-
if (!this.resource.externalId) {
|
|
1658
|
-
this.buildSubjectTemplate();
|
|
1659
|
-
this.execTransformer();
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
else {
|
|
1663
|
-
console.log('No fields map', this.integrationCode, this.resourceType, response.error);
|
|
1664
|
-
}
|
|
1665
|
-
});
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
openResourceMenu() {
|
|
1669
|
-
this.resourceMenuVisible = true;
|
|
1670
|
-
setTimeout(() => {
|
|
1671
|
-
document.addEventListener('click', this.onMenuClickout);
|
|
1672
|
-
}, 10);
|
|
1673
|
-
}
|
|
1674
|
-
close(result) {
|
|
1675
|
-
this.done.emit(result);
|
|
1676
|
-
}
|
|
1677
|
-
showParsedError(resourceForm, parsedError) {
|
|
1678
|
-
this.formErrors = parsedError.message || 'There is a problem with one or more fields';
|
|
1679
|
-
if (parsedError.errors && parsedError.errors.length) {
|
|
1680
|
-
this.formErrors += ` (${parsedError.errors.map(e => e.message).join(', ')})`;
|
|
1681
|
-
for (const pe of parsedError.errors) {
|
|
1682
|
-
if (resourceForm.controls[pe.field]) {
|
|
1683
|
-
resourceForm.controls[pe.field].setErrors({ invalid: true, custom: pe.message });
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
setTimeout(() => {
|
|
1687
|
-
const firstInvalid = this.el.nativeElement.querySelector('.Vlt-form__element--error .main:not(.standalone)');
|
|
1688
|
-
if (firstInvalid) {
|
|
1689
|
-
firstInvalid.focus();
|
|
1690
|
-
}
|
|
1691
|
-
});
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
submit(resourceForm) {
|
|
1695
|
-
delete this.formErrors;
|
|
1696
|
-
resourceForm.form.submitted = true;
|
|
1697
|
-
if (resourceForm.valid) {
|
|
1698
|
-
this.busy = true;
|
|
1699
|
-
/* eslint-disable no-underscore-dangle */
|
|
1700
|
-
if (!this.model._vgis) {
|
|
1701
|
-
this.model._vgis = {
|
|
1702
|
-
connector: this.integrationCode,
|
|
1703
|
-
resourceType: this.resourceType
|
|
1704
|
-
};
|
|
1705
|
-
}
|
|
1706
|
-
this.model._vgis.layoutId = this.currentLayoutId;
|
|
1707
|
-
if (this.metaContext.vgipEventId) {
|
|
1708
|
-
this.model._vgis.eventId = this.metaContext.vgipEventId;
|
|
1709
|
-
}
|
|
1710
|
-
/* eslint-enable no-underscore-dangle */
|
|
1711
|
-
this.service.save(this.model).subscribe((result) => {
|
|
1712
|
-
this.model = result;
|
|
1713
|
-
this.resource.externalId = result._vgis.externalId; // eslint-disable-line no-underscore-dangle
|
|
1714
|
-
this.resourceVrn = `vrn:vgis:${this.integrationCode.toLowerCase()}:${this.resource.resourceType}:${this.resource.externalId}`;
|
|
1715
|
-
this.isPersistent = true;
|
|
1716
|
-
this.close(result);
|
|
1717
|
-
this.edit = false;
|
|
1718
|
-
delete this.busy;
|
|
1719
|
-
}, (errorResult) => {
|
|
1720
|
-
if ((errorResult.status === 422 && errorResult.error && !errorResult.error.errors && errorResult.error.integrationError)
|
|
1721
|
-
|| (errorResult.error && errorResult.error.errors && errorResult.error.errors.length && !errorResult.error.errors[0].field)
|
|
1722
|
-
// backend implemented error parsing but broken VGIS-7366
|
|
1723
|
-
) {
|
|
1724
|
-
this.formErrors = 'There is a problem with one or more fields';
|
|
1725
|
-
try {
|
|
1726
|
-
this.metaMsgService.sendMessage(this.integrationCode, {
|
|
1727
|
-
action: 'parseErrorMessage',
|
|
1728
|
-
integrationCode: this.integrationCode,
|
|
1729
|
-
resourceType: errorResult.error.resourceType,
|
|
1730
|
-
rawError: errorResult.error.integrationError,
|
|
1731
|
-
profile: this.metaContext.profiles[this.integrationCode.toUpperCase()]
|
|
1732
|
-
}, (response) => {
|
|
1733
|
-
if (response.parsedError) {
|
|
1734
|
-
this.showParsedError(resourceForm, response.parsedError);
|
|
1735
|
-
}
|
|
1736
|
-
else {
|
|
1737
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
1738
|
-
console.error('No error parser for', this.integrationCode, errorResult.error.integrationError);
|
|
1739
|
-
this.formErrors = errorResult.error;
|
|
1740
|
-
}
|
|
1741
|
-
});
|
|
1742
|
-
}
|
|
1743
|
-
catch (err) {
|
|
1744
|
-
console.log('....', err);
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
else if (errorResult.status === 422) {
|
|
1748
|
-
this.showParsedError(resourceForm, errorResult.error);
|
|
1749
|
-
}
|
|
1750
|
-
else {
|
|
1751
|
-
this.formErrors = errorResult.error;
|
|
1752
|
-
}
|
|
1753
|
-
delete this.busy;
|
|
1754
|
-
});
|
|
1755
|
-
}
|
|
1756
|
-
else {
|
|
1757
|
-
this.formErrors = Object.keys(resourceForm.controls)
|
|
1758
|
-
.filter((c) => resourceForm.controls[c].invalid)
|
|
1759
|
-
.map((f) => (this.niceFields[f] ? (this.niceFields[f].label || f) : f)).join(', ');
|
|
1760
|
-
setTimeout(() => {
|
|
1761
|
-
const selector = `form[name="${this.resourceType}"] .Vlt-form__element--error .main:not(.standalone)`;
|
|
1762
|
-
const firstInvalid = this.el.nativeElement.querySelector(selector);
|
|
1763
|
-
if (firstInvalid) {
|
|
1764
|
-
firstInvalid.focus();
|
|
1765
|
-
}
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
clearFormErrors() {
|
|
1770
|
-
delete this.formErrors;
|
|
1771
|
-
}
|
|
1772
|
-
onFormChange() {
|
|
1773
|
-
this.resourceChanged.next(JSON.stringify(this.model));
|
|
1774
|
-
}
|
|
1775
|
-
suggestFieldProperty(key, value) {
|
|
1776
|
-
if (key && value) {
|
|
1777
|
-
const fieldNames = this.fieldNames;
|
|
1778
|
-
if (this.model) {
|
|
1779
|
-
const nestMatch = key.match(/(\S+)\[\d\]\.(\S+)/);
|
|
1780
|
-
if (nestMatch && fieldNames.indexOf(nestMatch[1]) !== -1) {
|
|
1781
|
-
const nestKeys = {};
|
|
1782
|
-
nestKeys[nestMatch[2]] = value;
|
|
1783
|
-
this.model[nestMatch[1]] = [nestKeys];
|
|
1784
|
-
}
|
|
1785
|
-
else if (fieldNames.indexOf(key) !== -1) {
|
|
1786
|
-
this.model[key] = value;
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
execTransformer() {
|
|
1792
|
-
if (this.metaContext && this.fieldsMap) {
|
|
1793
|
-
setTimeout(() => {
|
|
1794
|
-
this.suggestFieldProperty(this.fieldsMap.phoneNumber, this.metaContext.phoneNumber);
|
|
1795
|
-
if (this.fieldsMap.firstName || this.fieldsMap.lastName) {
|
|
1796
|
-
const names = (this.metaContext.displayName || '').split(' ');
|
|
1797
|
-
this.suggestFieldProperty(this.fieldsMap.firstName, names[0]);
|
|
1798
|
-
this.suggestFieldProperty(this.fieldsMap.lastName, names[1]);
|
|
1799
|
-
}
|
|
1800
|
-
else if (this.fieldsMap.displayName) {
|
|
1801
|
-
this.suggestFieldProperty(this.fieldsMap.displayName, this.metaContext.displayName);
|
|
1802
|
-
}
|
|
1803
|
-
}, 100);
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
markContactables() {
|
|
1807
|
-
if (this.fieldsMap.contactables && this.fieldsMap.contactables.length) {
|
|
1808
|
-
for (const c of this.fieldsMap.contactables) {
|
|
1809
|
-
const field = this.niceFields[c];
|
|
1810
|
-
if (field) {
|
|
1811
|
-
Object.defineProperty(field, '$isContactable', {
|
|
1812
|
-
value: true,
|
|
1813
|
-
configurable: true,
|
|
1814
|
-
enumerable: false
|
|
1815
|
-
});
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
buildSubjectTemplate() {
|
|
1821
|
-
if (!this.model[this.fieldsMap.subject] && this.fieldsMap.subject && this.niceFields[this.fieldsMap.subject]) {
|
|
1822
|
-
let subjectTemplate;
|
|
1823
|
-
if (this.niceFields[this.fieldsMap.subject].default) {
|
|
1824
|
-
subjectTemplate = this.niceFields[this.fieldsMap.subject].default.id || this.niceFields[this.fieldsMap.subject].default;
|
|
1825
|
-
}
|
|
1826
|
-
else if (this.metaContext.profiles[this.integrationCode]) {
|
|
1827
|
-
const profile = this.metaContext.profiles[this.integrationCode] || {};
|
|
1828
|
-
subjectTemplate = profile.defaultSubject ?
|
|
1829
|
-
(profile.defaultSubject[(this.metaContext.context?.type || 'CALL').toUpperCase()] || profile.defaultSubject.CALL) :
|
|
1830
|
-
profile.activityDefaultSubjectTemplate;
|
|
1831
|
-
}
|
|
1832
|
-
if (subjectTemplate) {
|
|
1833
|
-
this.model[this.fieldsMap.subject] = templateBuilder(this.metaContext, subjectTemplate);
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
buildContactsSuggestions() {
|
|
1838
|
-
// let hasDefaultContact = false;
|
|
1839
|
-
if (this.metaContext.contactables[this.integrationCode] && this.meta.layout && this.meta.layout.sections) {
|
|
1840
|
-
for (const s of this.meta.layout.sections) {
|
|
1841
|
-
for (const f of (s.fields || [])) {
|
|
1842
|
-
if (f.type === 'reference') {
|
|
1843
|
-
if (!f.suggestions) {
|
|
1844
|
-
f.suggestions = [];
|
|
1845
|
-
}
|
|
1846
|
-
else {
|
|
1847
|
-
f.suggestions = f.suggestions.filter(sg => !sg.auto); // keep meta suggestions if any
|
|
1848
|
-
}
|
|
1849
|
-
const refTypes = (f.reference.length ? f.reference : [f.reference]).map(r => r.name);
|
|
1850
|
-
for (const c of this.metaContext.contactables[this.integrationCode]) {
|
|
1851
|
-
if (refTypes.indexOf(c.resourceType || c.type) !== -1) {
|
|
1852
|
-
let tLabel = c.displayName || c.name;
|
|
1853
|
-
if (c.phoneNumbers) {
|
|
1854
|
-
tLabel += (' ✆' + c.phoneNumbers.map(p => p.phoneNumber).join(','));
|
|
1855
|
-
}
|
|
1856
|
-
f.suggestions.push({
|
|
1857
|
-
id: c.externalId || c.identifier || c.id,
|
|
1858
|
-
label: tLabel,
|
|
1859
|
-
type: c.resourceType || c.type,
|
|
1860
|
-
auto: true
|
|
1861
|
-
});
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
if ((this.fieldsMap.contactables || []).indexOf(f.name) !== -1) { // evaluate usability?
|
|
1865
|
-
f.alwaysVisible = true;
|
|
1866
|
-
}
|
|
1867
|
-
// if (
|
|
1868
|
-
// !hasDefaultContact && this.metaContext.defaultContactables[this.integrationCode]
|
|
1869
|
-
// && refTypes.indexOf(this.metaContext.defaultContactables[this.integrationCode].type) !== -1
|
|
1870
|
-
// ) {
|
|
1871
|
-
// this.resource[f.name] = this.metaContext.defaultContactables[this.integrationCode];
|
|
1872
|
-
// hasDefaultContact = true;
|
|
1873
|
-
// } else if (!hasDefaultContact && this.fieldsMap.contactables && f.suggestions && f.suggestions.length === 1) {
|
|
1874
|
-
// if (this.fieldsMap.contactables.indexOf(f.name) !== -1 && !f.default) {
|
|
1875
|
-
// f.default = f.suggestions[0];
|
|
1876
|
-
// hasDefaultContact = true;
|
|
1877
|
-
// }
|
|
1878
|
-
// }
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
this.contactsSuggestionsDone = true;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
applyTheme() {
|
|
1886
|
-
const metaTheme = this.theme === 'dark' ? metaDark : metaLight;
|
|
1887
|
-
for (const key of Object.keys(metaTheme.properties)) {
|
|
1888
|
-
this.el.nativeElement.style.setProperty(key, metaTheme.properties[key]);
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
forceUiUpdate() {
|
|
1892
|
-
// this.ref.detectChanges();
|
|
1893
|
-
const e = document.createEvent('Events');
|
|
1894
|
-
e.initEvent('click', true, false);
|
|
1895
|
-
this.el.nativeElement.dispatchEvent(e);
|
|
1896
|
-
}
|
|
1897
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaResource, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: MetaResourceService }, { token: MetaContextService }, { token: MetaMsgService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1898
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.11", type: MetaResource, selector: "vgip-meta-resource", inputs: { resource: "resource", model: "model", metaResourceServiceDelegated: "metaResourceServiceDelegated", theme: "theme", editMode: "editMode" }, outputs: { done: "done", resourceChange: "resourceChange" }, viewQueries: [{ propertyName: "resourceForm", first: true, predicate: ["resourceForm"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf='generalError' class=\"Vlt-callout Vlt-callout--critical\" style='overflow: auto; margin: 20px;'>\n\t<i></i>\n\t<div class=\"Vlt-callout__content\">\n\t\t<p>{{generalError}}</p>\n\t</div>\n</div>\n<div *ngIf='!meta' class=\"Vlt-progress\">\n\t<div class=\"Vlt-progress__bar\" [ngClass]=\"{ loading: metaLoading }\" role=\"progressbar\" aria-valuemin=\"0\" aria-valuetext=\"Loading Metadata\" aria-valuemax=\"100\"></div>\n</div>\n<form [vgipMetaFormAutofocus]='!resource || !resource.externalId' *ngIf='meta && !generalError' #resourceForm=\"ngForm\" [name]='resource.resourceType' (ngSubmit)='submit(resourceForm)' (change)='onFormChange()' novalidate>\n\t<div class='form-content' style='overflow: hidden;'>\n\t\t<div [ngClass]=\"{ 'Vlt-callout--dismissed': !formErrors }\" class=\"Vlt-callout Vlt-callout--banner Vlt-callout--critical\">\n\t\t\t<i></i>\n\t\t\t<div class=\"Vlt-callout__content\" style=\"margin-top: auto;\">\n\t\t\t\t<p>There is a problem with one or more fields</p>\n\t\t\t\t<small style='font-weight: 600; font-size: 1.0em;' *ngIf='formErrors'>{{ formErrors.message || formErrors }}</small>\n\t\t\t</div>\n\t\t\t<button type='button' class=\"Vlt-callout__dismiss\" (click)='clearFormErrors()' aria-label=\"Dismiss\"></button>\n\t\t</div>\n\t\t<div class=\"Vlt-card__content\" style='min-height: 40px;'>\n\t\t\t<vgip-meta-layout *ngIf='edit' [meta]='meta.layout' [resource]='model' [preview]='false' [integration]='meta.integration' [type]='resource.resourceType' theme='inherit'></vgip-meta-layout>\n\t\t\t<vgip-meta-layout *ngIf='!edit' [meta]='meta.layout' [resource]='model' [preview]='true' [integration]='meta.integration' [type]='resource.resourceType' theme='inherit' [attr.data-vrn]='resourceVrn'></vgip-meta-layout>\n\t\t</div>\n\t</div>\n\t<div class=\"Vlt-card__footer\">\n\t\t<button class=\"Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--outline\" type='button' aria-label='Cancel' (click)='close()'>\n\t\t\t{{ edit ? 'Cancel' : 'Close' }}\n\t\t</button>\n\t\t<button *ngIf='edit' class=\"Vlt-btn Vlt-btn--app\" [ngClass]=\"{ 'Vlt-btn--primary': isPersistent, 'Vlt-btn--secondary': !isPersistent }\" type='submit'>\n\t\t\t{{ (resource && resource.externalId) ? 'Update' : 'Create' }}\n\t\t</button>\n\t\t<button (click)='setEditMode()' *ngIf='!edit && isEditable' [disabled]='!isEditable' class=\"Vlt-btn Vlt-btn--app Vlt-btn--primary\" type='button' aria-label='Edit'>\n\t\t\tEdit\n\t\t</button>\n\t\t<div style='margin-right: 8px; flex: 1;'>\n\t\t\t<div *ngIf='meta.availableLayouts && meta.availableLayouts.length' class=\"Vlt-form__element Vlt-form__element--big\" style='padding: 0; margin: -8px -18px -8px 0;'>\n\t\t\t\t<div class=\"Vlt-select\">\n\t\t\t\t\t<label style='all: inherit;'>\n\t\t\t\t\t\t<select style='border: 0; margin-top: 3px; background: transparent;' (change)='changeLayout()' [(ngModel)]='currentLayoutId' [ngModelOptions]='{ standalone: true }' [disabled]='lockedLayoutId === currentLayoutId'>\n\t\t\t\t\t\t\t<option selected disabled>Select layout</option>\n\t\t\t\t\t\t\t<option *ngFor='let layout of meta.availableLayouts' [ngValue]='layout.id'>{{layout.name}}</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t<label>Layout</label> <!-- eslint-disable-line @angular-eslint/template/label-has-associated-control -->\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"Vlt-dropdown resource-menu\" [ngClass]=\"{ 'Vlt-dropdown--expanded': resourceMenuVisible }\" style='margin-left: 2px;'>\n\t\t\t<div class=\"Vlt-dropdown__panel\" style='bottom: 40px; right: -4px; top: initial;'>\n\t\t\t\t<div class=\"Vlt-dropdown__panel__content\">\n\t\t\t\t\t<a href='#' class=\"Vlt-dropdown__link\" (click)='loadMetadata(currentLayoutId, true, $event)'>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<svg class='Vlt-icon Vlt-icon--smaller'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-refresh\"/></svg> Refresh metadata\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=\"Vlt-dropdown__trigger\">\n\t\t\t\t<button type='button' (click)='openResourceMenu()' class=\"Vlt-btn Vlt-btn--link\" aria-label='Resource menu'>\n\t\t\t\t\t<svg class='Vlt-icon Vlt-icon--small' style='margin: 0;'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-more-v-negative\"/></svg>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</form>\n<div class='busy-mask' [ngClass]=\"{ active: busy }\">\n\t<div style='height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;'>\n\t\t<div class=\"Vlt-spinner\"></div>\n\t</div>\n</div>\n", styles: [":host{flex:1;display:flex;flex-direction:column;min-height:0;color:var(--vgip-meta-resource-color)}.Vlt-callout--banner{justify-content:initial;text-align:initial;overflow-y:auto}.Vlt-callout--banner.Vlt-callout--dismissed{padding:0}.Vlt-callout--banner:not(.Vlt-callout--dismissed){min-height:78px}.Vlt-spinner:before,.Vlt-spinner:after{border:6px solid #616266;border-color:#616266 transparent transparent}.Vlt-card__content{padding:8px 8px 8px 16px;display:flex;flex-direction:column;min-height:0;flex:1;overflow-y:scroll;overflow-x:hidden;background-color:var(--vgip-meta-resource-bg-color)}@media (hover: none){.Vlt-card__content{padding-right:16px}}.Vlt-card__content::-webkit-scrollbar{width:8px}.Vlt-card__content::-webkit-scrollbar-thumb{background-color:var(--vgip-meta-scrollbar-color);border:2px solid transparent;border-radius:6px;background-clip:content-box}.Vlt-card__footer{background:var(--vgip-meta-resource-bar-color);border-top:1px solid var(--vgip-meta-separator-color);display:flex;flex-direction:row;margin:16px -24px -24px;padding:8px 8px 8px 16px;box-shadow:0 0 4px #00000040;z-index:1}.Vlt-card__footer .Vlt-select select{color:var(--vgip-meta-input-color)}.Vlt-card__footer .Vlt-select select:disabled{background:initial;cursor:not-allowed}.Vlt-card__footer .Vlt-select:after{background-image:var(--vgip-meta-dropdown-icon)}.Vlt-card__footer .resource-menu .Vlt-icon:not(:hover){fill:var(--vgip-meta-input-label-color)}.Vlt-card__footer button.Vlt-btn--secondary{border:none;box-shadow:inset 0 0 0 1px var(--vgip-meta-button-border-color)}.Vlt-card__footer button.Vlt-btn--secondary:not([type=submit]){color:var(--vgip-meta-input-color)}.Vlt-card__footer button.Vlt-btn--secondary:hover{box-shadow:inset 0 0 0 1px var(--vgip-meta-input-accent-color)}.Vlt-card__footer button.Vlt-btn--secondary:hover[type=submit]{background-color:var(--vgip-meta-submit-hover-bg-color)}.Vlt-progress{margin:0;position:sticky}.Vlt-progress .Vlt-progress__bar{width:0;transition:width 5s}.Vlt-progress .Vlt-progress__bar.loading{width:100%}form{border-radius:6px;padding:24px;display:flex;flex-direction:column;min-height:0;flex:1}form .form-content{margin:-24px -24px -16px;padding-bottom:0;flex:1;display:flex;flex-direction:column}.busy-mask{position:absolute;inset:0;background:rgba(0,0,0,.32);opacity:1;z-index:898;display:none;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:1px;cursor:progress}.busy-mask.active{display:block}\n"], dependencies: [{ kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MetaLayout, selector: "vgip-meta-layout", inputs: ["meta", "resource", "integration", "type", "preview", "theme"] }, { kind: "directive", type: MetaAutofocusDirective, selector: "[vgipMetaFormAutofocus]", inputs: ["vgipMetaFormAutofocus"] }] }); }
|
|
1899
|
-
}
|
|
1900
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaResource, decorators: [{
|
|
1901
|
-
type: Component,
|
|
1902
|
-
args: [{ selector: 'vgip-meta-resource', template: "<div *ngIf='generalError' class=\"Vlt-callout Vlt-callout--critical\" style='overflow: auto; margin: 20px;'>\n\t<i></i>\n\t<div class=\"Vlt-callout__content\">\n\t\t<p>{{generalError}}</p>\n\t</div>\n</div>\n<div *ngIf='!meta' class=\"Vlt-progress\">\n\t<div class=\"Vlt-progress__bar\" [ngClass]=\"{ loading: metaLoading }\" role=\"progressbar\" aria-valuemin=\"0\" aria-valuetext=\"Loading Metadata\" aria-valuemax=\"100\"></div>\n</div>\n<form [vgipMetaFormAutofocus]='!resource || !resource.externalId' *ngIf='meta && !generalError' #resourceForm=\"ngForm\" [name]='resource.resourceType' (ngSubmit)='submit(resourceForm)' (change)='onFormChange()' novalidate>\n\t<div class='form-content' style='overflow: hidden;'>\n\t\t<div [ngClass]=\"{ 'Vlt-callout--dismissed': !formErrors }\" class=\"Vlt-callout Vlt-callout--banner Vlt-callout--critical\">\n\t\t\t<i></i>\n\t\t\t<div class=\"Vlt-callout__content\" style=\"margin-top: auto;\">\n\t\t\t\t<p>There is a problem with one or more fields</p>\n\t\t\t\t<small style='font-weight: 600; font-size: 1.0em;' *ngIf='formErrors'>{{ formErrors.message || formErrors }}</small>\n\t\t\t</div>\n\t\t\t<button type='button' class=\"Vlt-callout__dismiss\" (click)='clearFormErrors()' aria-label=\"Dismiss\"></button>\n\t\t</div>\n\t\t<div class=\"Vlt-card__content\" style='min-height: 40px;'>\n\t\t\t<vgip-meta-layout *ngIf='edit' [meta]='meta.layout' [resource]='model' [preview]='false' [integration]='meta.integration' [type]='resource.resourceType' theme='inherit'></vgip-meta-layout>\n\t\t\t<vgip-meta-layout *ngIf='!edit' [meta]='meta.layout' [resource]='model' [preview]='true' [integration]='meta.integration' [type]='resource.resourceType' theme='inherit' [attr.data-vrn]='resourceVrn'></vgip-meta-layout>\n\t\t</div>\n\t</div>\n\t<div class=\"Vlt-card__footer\">\n\t\t<button class=\"Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--outline\" type='button' aria-label='Cancel' (click)='close()'>\n\t\t\t{{ edit ? 'Cancel' : 'Close' }}\n\t\t</button>\n\t\t<button *ngIf='edit' class=\"Vlt-btn Vlt-btn--app\" [ngClass]=\"{ 'Vlt-btn--primary': isPersistent, 'Vlt-btn--secondary': !isPersistent }\" type='submit'>\n\t\t\t{{ (resource && resource.externalId) ? 'Update' : 'Create' }}\n\t\t</button>\n\t\t<button (click)='setEditMode()' *ngIf='!edit && isEditable' [disabled]='!isEditable' class=\"Vlt-btn Vlt-btn--app Vlt-btn--primary\" type='button' aria-label='Edit'>\n\t\t\tEdit\n\t\t</button>\n\t\t<div style='margin-right: 8px; flex: 1;'>\n\t\t\t<div *ngIf='meta.availableLayouts && meta.availableLayouts.length' class=\"Vlt-form__element Vlt-form__element--big\" style='padding: 0; margin: -8px -18px -8px 0;'>\n\t\t\t\t<div class=\"Vlt-select\">\n\t\t\t\t\t<label style='all: inherit;'>\n\t\t\t\t\t\t<select style='border: 0; margin-top: 3px; background: transparent;' (change)='changeLayout()' [(ngModel)]='currentLayoutId' [ngModelOptions]='{ standalone: true }' [disabled]='lockedLayoutId === currentLayoutId'>\n\t\t\t\t\t\t\t<option selected disabled>Select layout</option>\n\t\t\t\t\t\t\t<option *ngFor='let layout of meta.availableLayouts' [ngValue]='layout.id'>{{layout.name}}</option>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t\t<label>Layout</label> <!-- eslint-disable-line @angular-eslint/template/label-has-associated-control -->\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"Vlt-dropdown resource-menu\" [ngClass]=\"{ 'Vlt-dropdown--expanded': resourceMenuVisible }\" style='margin-left: 2px;'>\n\t\t\t<div class=\"Vlt-dropdown__panel\" style='bottom: 40px; right: -4px; top: initial;'>\n\t\t\t\t<div class=\"Vlt-dropdown__panel__content\">\n\t\t\t\t\t<a href='#' class=\"Vlt-dropdown__link\" (click)='loadMetadata(currentLayoutId, true, $event)'>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<svg class='Vlt-icon Vlt-icon--smaller'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-refresh\"/></svg> Refresh metadata\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class=\"Vlt-dropdown__trigger\">\n\t\t\t\t<button type='button' (click)='openResourceMenu()' class=\"Vlt-btn Vlt-btn--link\" aria-label='Resource menu'>\n\t\t\t\t\t<svg class='Vlt-icon Vlt-icon--small' style='margin: 0;'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-more-v-negative\"/></svg>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</form>\n<div class='busy-mask' [ngClass]=\"{ active: busy }\">\n\t<div style='height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;'>\n\t\t<div class=\"Vlt-spinner\"></div>\n\t</div>\n</div>\n", styles: [":host{flex:1;display:flex;flex-direction:column;min-height:0;color:var(--vgip-meta-resource-color)}.Vlt-callout--banner{justify-content:initial;text-align:initial;overflow-y:auto}.Vlt-callout--banner.Vlt-callout--dismissed{padding:0}.Vlt-callout--banner:not(.Vlt-callout--dismissed){min-height:78px}.Vlt-spinner:before,.Vlt-spinner:after{border:6px solid #616266;border-color:#616266 transparent transparent}.Vlt-card__content{padding:8px 8px 8px 16px;display:flex;flex-direction:column;min-height:0;flex:1;overflow-y:scroll;overflow-x:hidden;background-color:var(--vgip-meta-resource-bg-color)}@media (hover: none){.Vlt-card__content{padding-right:16px}}.Vlt-card__content::-webkit-scrollbar{width:8px}.Vlt-card__content::-webkit-scrollbar-thumb{background-color:var(--vgip-meta-scrollbar-color);border:2px solid transparent;border-radius:6px;background-clip:content-box}.Vlt-card__footer{background:var(--vgip-meta-resource-bar-color);border-top:1px solid var(--vgip-meta-separator-color);display:flex;flex-direction:row;margin:16px -24px -24px;padding:8px 8px 8px 16px;box-shadow:0 0 4px #00000040;z-index:1}.Vlt-card__footer .Vlt-select select{color:var(--vgip-meta-input-color)}.Vlt-card__footer .Vlt-select select:disabled{background:initial;cursor:not-allowed}.Vlt-card__footer .Vlt-select:after{background-image:var(--vgip-meta-dropdown-icon)}.Vlt-card__footer .resource-menu .Vlt-icon:not(:hover){fill:var(--vgip-meta-input-label-color)}.Vlt-card__footer button.Vlt-btn--secondary{border:none;box-shadow:inset 0 0 0 1px var(--vgip-meta-button-border-color)}.Vlt-card__footer button.Vlt-btn--secondary:not([type=submit]){color:var(--vgip-meta-input-color)}.Vlt-card__footer button.Vlt-btn--secondary:hover{box-shadow:inset 0 0 0 1px var(--vgip-meta-input-accent-color)}.Vlt-card__footer button.Vlt-btn--secondary:hover[type=submit]{background-color:var(--vgip-meta-submit-hover-bg-color)}.Vlt-progress{margin:0;position:sticky}.Vlt-progress .Vlt-progress__bar{width:0;transition:width 5s}.Vlt-progress .Vlt-progress__bar.loading{width:100%}form{border-radius:6px;padding:24px;display:flex;flex-direction:column;min-height:0;flex:1}form .form-content{margin:-24px -24px -16px;padding-bottom:0;flex:1;display:flex;flex-direction:column}.busy-mask{position:absolute;inset:0;background:rgba(0,0,0,.32);opacity:1;z-index:898;display:none;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:1px;cursor:progress}.busy-mask.active{display:block}\n"] }]
|
|
1903
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: MetaResourceService }, { type: MetaContextService }, { type: MetaMsgService }]; }, propDecorators: { resource: [{
|
|
1904
|
-
type: Input
|
|
1905
|
-
}], model: [{
|
|
1906
|
-
type: Input
|
|
1907
|
-
}], metaResourceServiceDelegated: [{
|
|
1908
|
-
type: Input
|
|
1909
|
-
}], theme: [{
|
|
1910
|
-
type: Input
|
|
1911
|
-
}], editMode: [{
|
|
1912
|
-
type: Input
|
|
1913
|
-
}], done: [{
|
|
1914
|
-
type: Output
|
|
1915
|
-
}], resourceChange: [{
|
|
1916
|
-
type: Output
|
|
1917
|
-
}], resourceForm: [{
|
|
1918
|
-
type: ViewChild,
|
|
1919
|
-
args: ['resourceForm']
|
|
1920
|
-
}] } });
|
|
1921
|
-
|
|
1922
|
-
class MetaRefDialog {
|
|
1923
|
-
constructor(el) {
|
|
1924
|
-
this.el = el;
|
|
1925
|
-
this.resources = {};
|
|
1926
|
-
this.models = {};
|
|
1927
|
-
this.services = {};
|
|
1928
|
-
this.keepOrder = (a) => a;
|
|
1929
|
-
this.keyEventListener = (event) => {
|
|
1930
|
-
if (event && event.key === 'Escape') {
|
|
1931
|
-
document.removeEventListener('keydown', this.keyEventListener);
|
|
1932
|
-
this.dismiss();
|
|
1933
|
-
}
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
get isEditable() {
|
|
1937
|
-
return this.resources[this.currentResource].meta.layout.editable !== false;
|
|
1938
|
-
}
|
|
1939
|
-
get isPersistent() {
|
|
1940
|
-
return this.resource && (this.resource.externalId || this.resource.id);
|
|
1941
|
-
}
|
|
1942
|
-
ngOnInit() {
|
|
1943
|
-
let references = (this.reference instanceof Array) ? this.reference : [this.reference];
|
|
1944
|
-
/* eslint-disable no-underscore-dangle */
|
|
1945
|
-
if (this.resource && this.resource._vgis) {
|
|
1946
|
-
this.fullResource = this.resource;
|
|
1947
|
-
this.resource = this.resource._vgis;
|
|
1948
|
-
}
|
|
1949
|
-
/* eslint-enable no-underscore-dangle */
|
|
1950
|
-
if (this.resource) {
|
|
1951
|
-
references = references.filter((r) => {
|
|
1952
|
-
const resType = r.name || r.resourceType || '';
|
|
1953
|
-
// comparing case insensitive, because of Zendesk comment vs Comment
|
|
1954
|
-
return (resType.id || resType || '').toLowerCase() === (this.resource.resourceType || this.resource.type || '').toLowerCase();
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1957
|
-
for (const ref of references) {
|
|
1958
|
-
if (!ref.name) {
|
|
1959
|
-
ref.name = ref.resourceType; // when the resource comes from resources API, not from metadata
|
|
1960
|
-
}
|
|
1961
|
-
if (!this.currentResource) {
|
|
1962
|
-
this.currentResource = ref.name;
|
|
1963
|
-
}
|
|
1964
|
-
if (ref.name === this.preferResourceType) {
|
|
1965
|
-
this.currentResource = this.preferResourceType;
|
|
1966
|
-
}
|
|
1967
|
-
const rs = {
|
|
1968
|
-
integrationCode: this.integrationCode,
|
|
1969
|
-
resourceType: ref.resourceType || ref.name,
|
|
1970
|
-
ref
|
|
1971
|
-
};
|
|
1972
|
-
if (this.resource) {
|
|
1973
|
-
rs.externalId = this.resource.id || this.resource.externalId;
|
|
1974
|
-
if (this.resource.eventId) {
|
|
1975
|
-
rs.eventId = this.resource.eventId;
|
|
1976
|
-
}
|
|
1977
|
-
if (this.fullResource) {
|
|
1978
|
-
rs.activity = this.fullResource;
|
|
1979
|
-
}
|
|
1980
|
-
if (this.resource.layoutId) {
|
|
1981
|
-
rs.layoutId = this.resource.layoutId;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
rs.parent = ref.parent;
|
|
1985
|
-
this.resources[ref.name] = rs;
|
|
1986
|
-
this.models[ref.name] = {};
|
|
1987
|
-
if (this.resource) {
|
|
1988
|
-
this.models[ref.name]._vgis = this.resource; // eslint-disable-line no-underscore-dangle
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
this.modal = this.el.nativeElement.childNodes[0];
|
|
1992
|
-
this.modal.classList.remove('Vlt-modal--out');
|
|
1993
|
-
this.modal.classList.add('Vlt-modal_visible');
|
|
1994
|
-
document.addEventListener('keydown', this.keyEventListener);
|
|
1995
|
-
if (this.integrationCode === 'mocks') {
|
|
1996
|
-
this.integrationIcon = 'Brand-icon-vonage';
|
|
1997
|
-
}
|
|
1998
|
-
else {
|
|
1999
|
-
switch (this.integrationCode.toLowerCase()) {
|
|
2000
|
-
case 'office365':
|
|
2001
|
-
this.integrationIcon = 'Brand-icon-office-color';
|
|
2002
|
-
break;
|
|
2003
|
-
case 'sugar':
|
|
2004
|
-
this.integrationIcon = 'Brand-icon-sugarcrm-color';
|
|
2005
|
-
break;
|
|
2006
|
-
case 'msdynamics':
|
|
2007
|
-
this.integrationIcon = 'Brand-icon-dynamics-color';
|
|
2008
|
-
break;
|
|
2009
|
-
default:
|
|
2010
|
-
this.integrationIcon = `Brand-icon-${(this.integrationCode || '').toLowerCase()}-color`;
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
this.applyTheme();
|
|
2014
|
-
}
|
|
2015
|
-
close() {
|
|
2016
|
-
this.modal.classList.remove('Vlt-modal_visible');
|
|
2017
|
-
this.modal.classList.add('Vlt-modal--out');
|
|
2018
|
-
}
|
|
2019
|
-
dismiss(ev) {
|
|
2020
|
-
this.close();
|
|
2021
|
-
this.onComplete(null);
|
|
2022
|
-
if (ev) {
|
|
2023
|
-
ev.preventDefault();
|
|
2024
|
-
ev.stopPropagation();
|
|
2025
|
-
return false;
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
onResourceDone(result) {
|
|
2029
|
-
this.close();
|
|
2030
|
-
this.onComplete(result);
|
|
2031
|
-
}
|
|
2032
|
-
selectResource(ev, resource) {
|
|
2033
|
-
this.currentResource = resource;
|
|
2034
|
-
ev.preventDefault();
|
|
2035
|
-
ev.stopPropagation();
|
|
2036
|
-
return false;
|
|
2037
|
-
}
|
|
2038
|
-
applyTheme() {
|
|
2039
|
-
const metaTheme = this.theme === 'dark' ? metaDark : metaLight;
|
|
2040
|
-
for (const key of Object.keys(metaTheme.properties)) {
|
|
2041
|
-
this.el.nativeElement.style.setProperty(key, metaTheme.properties[key]);
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaRefDialog, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2045
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.11", type: MetaRefDialog, selector: "ng-component", ngImport: i0, template: "<div class='Vlt-modal Vlt-modal--large'>\n <div class=\"Vlt-modal__panel\">\n <div class=\"Vlt-tabs\">\n <div class='Vlt-tabs__header--background'>\n <div class=\"Vlt-tabs__header Vlt-tabs__header--shadow\">\n <svg class=\"Vlt-icon\" [ngStyle]=\"{fill: integrationIcon === 'Brand-icon-vonage' ? 'var(--vgip-meta-input-color)' : ''}\"><use attr.xlink:href=\"volta/volta-brand-icons.svg#{{integrationIcon}}\" /></svg>\n <a href='#' *ngFor='let r of resources | keyvalue: keepOrder' (click)='selectResource($event, r.key)' class=\"Vlt-tabs__link\" [ngClass]=\"{ 'Vlt-tabs__link_active': currentResource === r.key}\">\n {{r.key}}\n </a>\n <a href='#' class=\"Vlt-modal__dismiss\" (click)=\"dismiss($event)\">\n <svg class=\"Vlt-icon\"><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-cross\" /></svg>\n </a>\n </div>\n </div>\n <div class=\"Vlt-tabs__content\" style='min-height: 90px;'>\n <ng-container *ngFor='let r of resources | keyvalue: keepOrder'>\n <div *ngIf='currentResource === r.key' class=\"Vlt-tabs__panel Vlt-tabs__panel_active\">\n <vgip-meta-resource [resource]='r.value' [model]='models[r.key]' [metaResourceServiceDelegated]='metaResource' (done)='onResourceDone($event)' theme='inherit' [attr.data-theme]='theme'></vgip-meta-resource>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n</div>\n", styles: [".Vlt-modal_visible{background:var(--vgip-meta-overlay-background)}.Vlt-modal__panel{padding:0;background:var(--vgip-meta-resource-bg-color);overflow:hidden}@media only screen and (max-width: 575px){.Vlt-modal__panel{height:100%;width:100%;max-height:none;border-bottom-left-radius:0;border-bottom-right-radius:0;margin:10px 6px 0}.Vlt-modal__panel ::ng-deep .busy-mask{min-height:calc(100vh - 58px)}}.Vlt-modal__panel .Vlt-tabs__header--background{border-top-left-radius:5px;border-top-right-radius:5px}.Vlt-modal__panel .Vlt-tabs__header{background:var(--vgip-meta-resource-bar-color);padding-left:52px;padding-right:45px;border-bottom:0;flex-wrap:wrap;min-height:52px;max-height:52px;align-items:center}.Vlt-modal__panel .Vlt-tabs__header>.Vlt-icon{position:absolute;left:14px}.Vlt-modal__panel .Vlt-tabs__header h5{margin-bottom:0;font-weight:initial}.Vlt-modal__panel .Vlt-tabs__header .Vlt-tabs__link{padding-top:4px;padding-bottom:2px;color:var(--vgip-meta-input-label-color);text-transform:capitalize}.Vlt-modal__panel .Vlt-tabs__header .Vlt-tabs__link_active{color:var(--vgip-meta-input-accent-color)}.Vlt-modal__panel .Vlt-tabs__header .Vlt-tabs__link_active:after{background:var(--vgip-meta-input-accent-color)}.Vlt-modal__panel .Vlt-tabs__header .Vlt-modal__dismiss{background-image:none;width:18px;height:18px;opacity:initial}.Vlt-modal__panel .Vlt-tabs__header .Vlt-modal__dismiss svg{width:16px;height:16px;fill:var(--vgip-meta-input-label-color)}.Vlt-modal__panel .Vlt-tabs__header .Vlt-modal__dismiss:hover svg{fill:var(--vgip-meta-input-accent-color)}.Vlt-modal__panel .Vlt-tabs__header::-webkit-scrollbar{width:8px}.Vlt-modal__panel .Vlt-tabs__header::-webkit-scrollbar-thumb{background-color:var(--vgip-meta-scrollbar-color);border:2px solid transparent;border-radius:6px;background-clip:content-box}.Vlt-modal__panel .Vlt-tabs__content{margin-top:0}.Vlt-modal__panel .Vlt-tabs__content .Vlt-tabs__link{font-size:1.8rem}.Vlt-modal__panel .Vlt-callout--banner{justify-content:initial;text-align:initial;overflow-y:auto}.Vlt-modal__panel .Vlt-callout--banner.Vlt-callout--dismissed{padding:0}.Vlt-modal__panel .Vlt-callout--banner:not(.Vlt-callout--dismissed){min-height:78px}.Vlt-modal__panel .Vlt-modal__cancel{z-index:899}.Vlt-modal__panel .Vlt-modal__dismiss{right:16px;top:14px}.Vlt-modal__panel .Vlt-card__footer button{margin-top:0;margin-bottom:0}.Vlt-modal__panel .Vlt-select select:disabled{background:initial;cursor:not-allowed}.Vlt-modal__panel ::ng-deep .form-content{min-height:0;max-height:calc(95vh - 172px)}@media only screen and (max-width: 575px){.Vlt-modal__panel ::ng-deep .form-content{min-height:calc(100vh - 113px)}}.resource-menu button{margin:0 -10px}.resource-menu button:not(:hover) .Vlt-icon{color:#616266;fill:#616266}.busy-mask{position:absolute;inset:0;background:rgba(0,0,0,.32);opacity:1;z-index:898;display:none;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:1px;cursor:progress}.busy-mask.active{display:block}\n"], dependencies: [{ kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: MetaResource, selector: "vgip-meta-resource", inputs: ["resource", "model", "metaResourceServiceDelegated", "theme", "editMode"], outputs: ["done", "resourceChange"] }, { kind: "pipe", type: i1$2.KeyValuePipe, name: "keyvalue" }] }); }
|
|
2046
|
-
}
|
|
2047
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaRefDialog, decorators: [{
|
|
2048
|
-
type: Component,
|
|
2049
|
-
args: [{ template: "<div class='Vlt-modal Vlt-modal--large'>\n <div class=\"Vlt-modal__panel\">\n <div class=\"Vlt-tabs\">\n <div class='Vlt-tabs__header--background'>\n <div class=\"Vlt-tabs__header Vlt-tabs__header--shadow\">\n <svg class=\"Vlt-icon\" [ngStyle]=\"{fill: integrationIcon === 'Brand-icon-vonage' ? 'var(--vgip-meta-input-color)' : ''}\"><use attr.xlink:href=\"volta/volta-brand-icons.svg#{{integrationIcon}}\" /></svg>\n <a href='#' *ngFor='let r of resources | keyvalue: keepOrder' (click)='selectResource($event, r.key)' class=\"Vlt-tabs__link\" [ngClass]=\"{ 'Vlt-tabs__link_active': currentResource === r.key}\">\n {{r.key}}\n </a>\n <a href='#' class=\"Vlt-modal__dismiss\" (click)=\"dismiss($event)\">\n <svg class=\"Vlt-icon\"><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-cross\" /></svg>\n </a>\n </div>\n </div>\n <div class=\"Vlt-tabs__content\" style='min-height: 90px;'>\n <ng-container *ngFor='let r of resources | keyvalue: keepOrder'>\n <div *ngIf='currentResource === r.key' class=\"Vlt-tabs__panel Vlt-tabs__panel_active\">\n <vgip-meta-resource [resource]='r.value' [model]='models[r.key]' [metaResourceServiceDelegated]='metaResource' (done)='onResourceDone($event)' theme='inherit' [attr.data-theme]='theme'></vgip-meta-resource>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n</div>\n", styles: [".Vlt-modal_visible{background:var(--vgip-meta-overlay-background)}.Vlt-modal__panel{padding:0;background:var(--vgip-meta-resource-bg-color);overflow:hidden}@media only screen and (max-width: 575px){.Vlt-modal__panel{height:100%;width:100%;max-height:none;border-bottom-left-radius:0;border-bottom-right-radius:0;margin:10px 6px 0}.Vlt-modal__panel ::ng-deep .busy-mask{min-height:calc(100vh - 58px)}}.Vlt-modal__panel .Vlt-tabs__header--background{border-top-left-radius:5px;border-top-right-radius:5px}.Vlt-modal__panel .Vlt-tabs__header{background:var(--vgip-meta-resource-bar-color);padding-left:52px;padding-right:45px;border-bottom:0;flex-wrap:wrap;min-height:52px;max-height:52px;align-items:center}.Vlt-modal__panel .Vlt-tabs__header>.Vlt-icon{position:absolute;left:14px}.Vlt-modal__panel .Vlt-tabs__header h5{margin-bottom:0;font-weight:initial}.Vlt-modal__panel .Vlt-tabs__header .Vlt-tabs__link{padding-top:4px;padding-bottom:2px;color:var(--vgip-meta-input-label-color);text-transform:capitalize}.Vlt-modal__panel .Vlt-tabs__header .Vlt-tabs__link_active{color:var(--vgip-meta-input-accent-color)}.Vlt-modal__panel .Vlt-tabs__header .Vlt-tabs__link_active:after{background:var(--vgip-meta-input-accent-color)}.Vlt-modal__panel .Vlt-tabs__header .Vlt-modal__dismiss{background-image:none;width:18px;height:18px;opacity:initial}.Vlt-modal__panel .Vlt-tabs__header .Vlt-modal__dismiss svg{width:16px;height:16px;fill:var(--vgip-meta-input-label-color)}.Vlt-modal__panel .Vlt-tabs__header .Vlt-modal__dismiss:hover svg{fill:var(--vgip-meta-input-accent-color)}.Vlt-modal__panel .Vlt-tabs__header::-webkit-scrollbar{width:8px}.Vlt-modal__panel .Vlt-tabs__header::-webkit-scrollbar-thumb{background-color:var(--vgip-meta-scrollbar-color);border:2px solid transparent;border-radius:6px;background-clip:content-box}.Vlt-modal__panel .Vlt-tabs__content{margin-top:0}.Vlt-modal__panel .Vlt-tabs__content .Vlt-tabs__link{font-size:1.8rem}.Vlt-modal__panel .Vlt-callout--banner{justify-content:initial;text-align:initial;overflow-y:auto}.Vlt-modal__panel .Vlt-callout--banner.Vlt-callout--dismissed{padding:0}.Vlt-modal__panel .Vlt-callout--banner:not(.Vlt-callout--dismissed){min-height:78px}.Vlt-modal__panel .Vlt-modal__cancel{z-index:899}.Vlt-modal__panel .Vlt-modal__dismiss{right:16px;top:14px}.Vlt-modal__panel .Vlt-card__footer button{margin-top:0;margin-bottom:0}.Vlt-modal__panel .Vlt-select select:disabled{background:initial;cursor:not-allowed}.Vlt-modal__panel ::ng-deep .form-content{min-height:0;max-height:calc(95vh - 172px)}@media only screen and (max-width: 575px){.Vlt-modal__panel ::ng-deep .form-content{min-height:calc(100vh - 113px)}}.resource-menu button{margin:0 -10px}.resource-menu button:not(:hover) .Vlt-icon{color:#616266;fill:#616266}.busy-mask{position:absolute;inset:0;background:rgba(0,0,0,.32);opacity:1;z-index:898;display:none;border-bottom-left-radius:6px;border-bottom-right-radius:6px;margin:1px;cursor:progress}.busy-mask.active{display:block}\n"] }]
|
|
2050
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
2051
|
-
|
|
2052
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
2053
|
-
__proto__: null,
|
|
2054
|
-
MetaRefDialog: MetaRefDialog
|
|
2055
|
-
});
|
|
2056
|
-
|
|
2057
|
-
export { MetaRefDialog as M, MetaResourceService as a, MetaReferenceService as b, MetaLayout as c, MetaResource as d, MetaAutofocusDirective as e, MetaMsgService as f, MetaHttpClient as g, metaNormalizer as m };
|
|
2058
|
-
//# sourceMappingURL=vgip-meta-ui-index-f2a08550.mjs.map
|