@veloceapps/api 4.0.21-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/README.md +3 -0
- package/bundles/veloceapps-api.umd.js +2950 -0
- package/bundles/veloceapps-api.umd.js.map +1 -0
- package/esm2015/index.js +25 -0
- package/esm2015/lib/api.module.js +89 -0
- package/esm2015/lib/services/account-api.service.js +50 -0
- package/esm2015/lib/services/catalog-admin-api.service.js +159 -0
- package/esm2015/lib/services/catalog-api.service.js +90 -0
- package/esm2015/lib/services/configuration-api.service.js +73 -0
- package/esm2015/lib/services/configuration-settings-api.service.js +52 -0
- package/esm2015/lib/services/context-api.service.js +26 -0
- package/esm2015/lib/services/delta-api.service.js +27 -0
- package/esm2015/lib/services/document-attachment-api.service.js +66 -0
- package/esm2015/lib/services/document-templates-api.service.js +284 -0
- package/esm2015/lib/services/flows-api.service.js +24 -0
- package/esm2015/lib/services/picklists-api.service.js +38 -0
- package/esm2015/lib/services/price-api.service.js +63 -0
- package/esm2015/lib/services/procedures-api.service.js +93 -0
- package/esm2015/lib/services/product-api.service.js +153 -0
- package/esm2015/lib/services/product-model-api.service.js +232 -0
- package/esm2015/lib/services/quote-api.service.js +48 -0
- package/esm2015/lib/services/ramp-api.service.js +21 -0
- package/esm2015/lib/services/rule-groups-api.service.js +62 -0
- package/esm2015/lib/services/rules-api.service.js +81 -0
- package/esm2015/lib/services/salesforce-api.service.js +40 -0
- package/esm2015/lib/services/scripts-api.service.js +76 -0
- package/esm2015/lib/services/ui-templates-api.service.js +282 -0
- package/esm2015/lib/types/clone-request.types.js +2 -0
- package/esm2015/lib/types/delta-request.types.js +2 -0
- package/esm2015/lib/types/dto/attribute-dto.types.js +21 -0
- package/esm2015/lib/types/dto/charge-group-item-dto.types.js +49 -0
- package/esm2015/lib/types/dto/charge-item-dto.types.js +78 -0
- package/esm2015/lib/types/dto/configuration-dto.types.js +19 -0
- package/esm2015/lib/types/dto/configuration-settings-dto.types.js +22 -0
- package/esm2015/lib/types/dto/domain-type-dto.types.js +27 -0
- package/esm2015/lib/types/dto/line-item-dto.types.js +103 -0
- package/esm2015/lib/types/dto/port-domain-dto.types.js +22 -0
- package/esm2015/lib/types/dto/price-adjustment-dto.types.js +15 -0
- package/esm2015/lib/types/dto/price-dto.types.js +25 -0
- package/esm2015/lib/types/dto/recommended-price-dto.types.js +25 -0
- package/esm2015/lib/types/dto/ui-template-dto.types.js +2 -0
- package/esm2015/lib/types/index.js +5 -0
- package/esm2015/lib/types/price.types.js +2 -0
- package/esm2015/lib/types/ramp-request.types.js +2 -0
- package/esm2015/lib/types/search-request.types.js +2 -0
- package/esm2015/lib/utils/ui-template.utils.js +13 -0
- package/esm2015/veloceapps-api.js +5 -0
- package/fesm2015/veloceapps-api.js +2420 -0
- package/fesm2015/veloceapps-api.js.map +1 -0
- package/index.d.ts +24 -0
- package/lib/api.module.d.ts +7 -0
- package/lib/services/account-api.service.d.ts +22 -0
- package/lib/services/catalog-admin-api.service.d.ts +34 -0
- package/lib/services/catalog-api.service.d.ts +20 -0
- package/lib/services/configuration-api.service.d.ts +18 -0
- package/lib/services/configuration-settings-api.service.d.ts +17 -0
- package/lib/services/context-api.service.d.ts +11 -0
- package/lib/services/delta-api.service.d.ts +12 -0
- package/lib/services/document-attachment-api.service.d.ts +16 -0
- package/lib/services/document-templates-api.service.d.ts +47 -0
- package/lib/services/flows-api.service.d.ts +13 -0
- package/lib/services/picklists-api.service.d.ts +17 -0
- package/lib/services/price-api.service.d.ts +16 -0
- package/lib/services/procedures-api.service.d.ts +27 -0
- package/lib/services/product-api.service.d.ts +31 -0
- package/lib/services/product-model-api.service.d.ts +30 -0
- package/lib/services/quote-api.service.d.ts +25 -0
- package/lib/services/ramp-api.service.d.ts +13 -0
- package/lib/services/rule-groups-api.service.d.ts +18 -0
- package/lib/services/rules-api.service.d.ts +21 -0
- package/lib/services/salesforce-api.service.d.ts +17 -0
- package/lib/services/scripts-api.service.d.ts +21 -0
- package/lib/services/ui-templates-api.service.d.ts +49 -0
- package/lib/types/clone-request.types.d.ts +5 -0
- package/lib/types/delta-request.types.d.ts +5 -0
- package/lib/types/dto/attribute-dto.types.d.ts +11 -0
- package/lib/types/dto/charge-group-item-dto.types.d.ts +26 -0
- package/lib/types/dto/charge-item-dto.types.d.ts +41 -0
- package/lib/types/dto/configuration-dto.types.d.ts +18 -0
- package/lib/types/dto/configuration-settings-dto.types.d.ts +9 -0
- package/lib/types/dto/domain-type-dto.types.d.ts +15 -0
- package/lib/types/dto/line-item-dto.types.d.ts +55 -0
- package/lib/types/dto/port-domain-dto.types.d.ts +13 -0
- package/lib/types/dto/price-adjustment-dto.types.d.ts +8 -0
- package/lib/types/dto/price-dto.types.d.ts +13 -0
- package/lib/types/dto/recommended-price-dto.types.d.ts +14 -0
- package/lib/types/dto/ui-template-dto.types.d.ts +6 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/price.types.d.ts +5 -0
- package/lib/types/ramp-request.types.d.ts +13 -0
- package/lib/types/search-request.types.d.ts +8 -0
- package/lib/utils/ui-template.utils.d.ts +3 -0
- package/package.json +37 -0
- package/veloceapps-api.d.ts +5 -0
@@ -0,0 +1,2420 @@
|
|
1
|
+
import * as i4 from '@angular/common/http';
|
2
|
+
import { HttpParams, HttpErrorResponse, HttpClientModule } from '@angular/common/http';
|
3
|
+
import * as i0 from '@angular/core';
|
4
|
+
import { Injectable, NgModule } from '@angular/core';
|
5
|
+
import * as i1 from '@veloceapps/core';
|
6
|
+
import { ModelTranslatorUtils, ConfigurationContextMode, isLegacyDocumentTemplate, DocxTemplater, QuoteDraft, StringUtils, Expression, ProductModelsContainer, ModelUtils, EntityUtil, BaseHttpService, XrayService } from '@veloceapps/core';
|
7
|
+
import { throwError, of, map as map$1, zip, forkJoin, noop, catchError as catchError$1, switchMap as switchMap$1 } from 'rxjs';
|
8
|
+
import { map, catchError, tap, switchMap, defaultIfEmpty } from 'rxjs/operators';
|
9
|
+
import * as _ from 'lodash';
|
10
|
+
import { transform } from 'lodash';
|
11
|
+
import { CurrencyPipe } from '@angular/common';
|
12
|
+
import * as moment_ from 'moment';
|
13
|
+
import { __rest } from 'tslib';
|
14
|
+
|
15
|
+
class AccountApiService {
|
16
|
+
constructor(httpService) {
|
17
|
+
this.httpService = httpService;
|
18
|
+
this.SERVICE_URL = '/accounts';
|
19
|
+
}
|
20
|
+
getAccounts$(options) {
|
21
|
+
return this.httpService.api(Object.assign({ method: 'get', url: `${this.SERVICE_URL}` }, options));
|
22
|
+
}
|
23
|
+
searchAccounts$(searchParams, options) {
|
24
|
+
const params = new HttpParams({ fromObject: searchParams });
|
25
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}`, params: params }, options));
|
26
|
+
}
|
27
|
+
getAccount$(id, options) {
|
28
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${id}` }, options));
|
29
|
+
}
|
30
|
+
getAssets(accountId, options) {
|
31
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/assets` }, options));
|
32
|
+
}
|
33
|
+
getOrders(accountId, options) {
|
34
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/orders` }, options));
|
35
|
+
}
|
36
|
+
getQuotes(accountId, options) {
|
37
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/quotes` }, options));
|
38
|
+
}
|
39
|
+
getAsset(accountId, assetId, options) {
|
40
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/assets/${assetId}` }, options));
|
41
|
+
}
|
42
|
+
getOrder(accountId, orderId, options) {
|
43
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/orders/${orderId}` }, options));
|
44
|
+
}
|
45
|
+
getQuote(accountId, quoteId, options) {
|
46
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/quotes/${quoteId}` }, options));
|
47
|
+
}
|
48
|
+
quoteToOrder(accountId, quoteId, options) {
|
49
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/quotes/${quoteId}/to-order`, method: 'post', body: { id: quoteId } }, options));
|
50
|
+
}
|
51
|
+
orderToAsset(accountId, orderId, options) {
|
52
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${accountId}/orders/${orderId}/to-asset`, method: 'post', body: { id: orderId } }, options));
|
53
|
+
}
|
54
|
+
}
|
55
|
+
AccountApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AccountApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
56
|
+
AccountApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AccountApiService });
|
57
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AccountApiService, decorators: [{
|
58
|
+
type: Injectable
|
59
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
60
|
+
|
61
|
+
class CatalogAdminApiService {
|
62
|
+
constructor(baseHttpService) {
|
63
|
+
this.baseHttpService = baseHttpService;
|
64
|
+
this.serviceUrl = '/catalogs';
|
65
|
+
this.fetchCatalogs$ = (searchParams) => {
|
66
|
+
const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
|
67
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
|
68
|
+
};
|
69
|
+
this.searchCatalogs$ = (searchParams, expression) => {
|
70
|
+
const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
|
71
|
+
return this.baseHttpService.api({
|
72
|
+
method: 'post',
|
73
|
+
url: `${this.serviceUrl}/search`,
|
74
|
+
params,
|
75
|
+
body: expression || {},
|
76
|
+
});
|
77
|
+
};
|
78
|
+
this.fetchCategories$ = (catalogId) => {
|
79
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories` });
|
80
|
+
};
|
81
|
+
this.searchProducts$ = (catalogId, categoryId) => {
|
82
|
+
return this.baseHttpService.api({
|
83
|
+
method: 'post',
|
84
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
|
85
|
+
body: {},
|
86
|
+
});
|
87
|
+
};
|
88
|
+
this.fetchAttributes$ = (catalogId, categoryId) => {
|
89
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes` });
|
90
|
+
};
|
91
|
+
this.createNewCatalog$ = (catalogData) => {
|
92
|
+
return this.baseHttpService.api({
|
93
|
+
url: `${this.serviceUrl}`,
|
94
|
+
method: 'post',
|
95
|
+
body: catalogData,
|
96
|
+
});
|
97
|
+
};
|
98
|
+
this.duplicateCatalog$ = (cloneRequest) => {
|
99
|
+
return this.baseHttpService.api({
|
100
|
+
url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
|
101
|
+
method: 'post',
|
102
|
+
body: cloneRequest,
|
103
|
+
});
|
104
|
+
};
|
105
|
+
this.updateCatalog$ = (data) => {
|
106
|
+
return this.baseHttpService.api({
|
107
|
+
url: `${this.serviceUrl}/${data.id}`,
|
108
|
+
method: 'put',
|
109
|
+
body: data,
|
110
|
+
});
|
111
|
+
};
|
112
|
+
this.removeCatalog$ = (id) => {
|
113
|
+
return this.baseHttpService.api({
|
114
|
+
url: `${this.serviceUrl}/${id}`,
|
115
|
+
method: 'delete',
|
116
|
+
});
|
117
|
+
};
|
118
|
+
this.restoreCatalog$ = (id) => {
|
119
|
+
return this.baseHttpService.api({
|
120
|
+
url: `${this.serviceUrl}/${id}/restore`,
|
121
|
+
method: 'patch',
|
122
|
+
});
|
123
|
+
};
|
124
|
+
this.createNewCategory$ = (categoryData) => {
|
125
|
+
return this.baseHttpService.api({
|
126
|
+
url: `${this.serviceUrl}/${categoryData.catalogId}/categories`,
|
127
|
+
method: 'post',
|
128
|
+
body: categoryData,
|
129
|
+
});
|
130
|
+
};
|
131
|
+
this.updateCategory$ = (category) => {
|
132
|
+
return this.baseHttpService.api({
|
133
|
+
url: `${this.serviceUrl}/${category.catalogId}/categories/${category.id}`,
|
134
|
+
method: 'put',
|
135
|
+
body: category,
|
136
|
+
});
|
137
|
+
};
|
138
|
+
this.duplicateCategory$ = (catalogId, cloneRequest) => {
|
139
|
+
return this.baseHttpService.api({
|
140
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${cloneRequest.id}/clone`,
|
141
|
+
method: 'post',
|
142
|
+
body: cloneRequest,
|
143
|
+
});
|
144
|
+
};
|
145
|
+
this.removeCategory$ = (id, catalogId) => {
|
146
|
+
return this.baseHttpService.api({
|
147
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${id}`,
|
148
|
+
method: 'delete',
|
149
|
+
});
|
150
|
+
};
|
151
|
+
this.restoreCategory$ = (id, catalogId) => {
|
152
|
+
return this.baseHttpService.api({
|
153
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${id}/restore`,
|
154
|
+
method: 'patch',
|
155
|
+
});
|
156
|
+
};
|
157
|
+
this.removeAttribute$ = ({ catalogId, categoryId, data, }) => {
|
158
|
+
return this.baseHttpService.api({
|
159
|
+
method: 'delete',
|
160
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
|
161
|
+
body: data,
|
162
|
+
});
|
163
|
+
};
|
164
|
+
this.restoreAttribute$ = ({ catalogId, categoryId, data, }) => {
|
165
|
+
return this.baseHttpService.api({
|
166
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}/restore`,
|
167
|
+
method: 'patch',
|
168
|
+
});
|
169
|
+
};
|
170
|
+
this.createNewAttribute$ = ({ catalogId, categoryId, data, }) => {
|
171
|
+
return this.baseHttpService.api({
|
172
|
+
method: 'post',
|
173
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes`,
|
174
|
+
body: data,
|
175
|
+
});
|
176
|
+
};
|
177
|
+
this.updateAttribute$ = ({ catalogId, categoryId, data, }) => {
|
178
|
+
return this.baseHttpService.api({
|
179
|
+
method: 'put',
|
180
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
|
181
|
+
body: data,
|
182
|
+
});
|
183
|
+
};
|
184
|
+
this.searchProductCandidates$ = (catalogId, categoryId, expression, searchParams) => {
|
185
|
+
const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
|
186
|
+
return this.baseHttpService.api({
|
187
|
+
method: 'post',
|
188
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/candidates/search`,
|
189
|
+
params,
|
190
|
+
body: expression,
|
191
|
+
});
|
192
|
+
};
|
193
|
+
this.addProduct$ = (product, catalogId, categoryId) => {
|
194
|
+
return this.baseHttpService.api({
|
195
|
+
method: 'post',
|
196
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
|
197
|
+
body: product,
|
198
|
+
});
|
199
|
+
};
|
200
|
+
this.removeProduct$ = ({ catalogId, categoryId, data }) => {
|
201
|
+
return this.baseHttpService.api({
|
202
|
+
method: 'delete',
|
203
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/${data.id}`,
|
204
|
+
body: data,
|
205
|
+
});
|
206
|
+
};
|
207
|
+
}
|
208
|
+
}
|
209
|
+
CatalogAdminApiService.MAX_RESULTS = 60;
|
210
|
+
CatalogAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CatalogAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
211
|
+
CatalogAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CatalogAdminApiService });
|
212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CatalogAdminApiService, decorators: [{
|
213
|
+
type: Injectable
|
214
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
215
|
+
|
216
|
+
class CatalogApiService {
|
217
|
+
constructor(service) {
|
218
|
+
this.service = service;
|
219
|
+
this.serviceUrl = '/product-catalogs';
|
220
|
+
}
|
221
|
+
fetchCatalogs$() {
|
222
|
+
return this.service.api({
|
223
|
+
method: 'get',
|
224
|
+
url: `${this.serviceUrl}`,
|
225
|
+
});
|
226
|
+
}
|
227
|
+
searchCatalogs$(searchParams, expression) {
|
228
|
+
const params = new HttpParams({ fromObject: searchParams });
|
229
|
+
return this.service.api({
|
230
|
+
method: 'post',
|
231
|
+
url: `${this.serviceUrl}/search`,
|
232
|
+
params,
|
233
|
+
body: expression,
|
234
|
+
});
|
235
|
+
}
|
236
|
+
getCatalog$(id) {
|
237
|
+
return this.service.api({
|
238
|
+
method: 'get',
|
239
|
+
url: `${this.serviceUrl}/${id}`,
|
240
|
+
});
|
241
|
+
}
|
242
|
+
fetchCategories$(catalogId) {
|
243
|
+
return this.service.api({
|
244
|
+
method: 'get',
|
245
|
+
url: `${this.serviceUrl}/${catalogId}/categories`,
|
246
|
+
});
|
247
|
+
}
|
248
|
+
fetchCatalogProducts$(catalogId, searchParams, context) {
|
249
|
+
const params = new HttpParams({ fromObject: searchParams });
|
250
|
+
return this.service.api({
|
251
|
+
method: 'post',
|
252
|
+
url: `${this.serviceUrl}/${catalogId}/products`,
|
253
|
+
params,
|
254
|
+
body: context,
|
255
|
+
});
|
256
|
+
}
|
257
|
+
fetchCategoryProducts$(catalogId, categoryId, searchParams, context) {
|
258
|
+
const params = new HttpParams({ fromObject: searchParams });
|
259
|
+
return this.service.api({
|
260
|
+
method: 'post',
|
261
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
|
262
|
+
params,
|
263
|
+
body: context,
|
264
|
+
});
|
265
|
+
}
|
266
|
+
searchCategoryProducts$(catalogId, categoryId, searchParams, searchCriteria, context) {
|
267
|
+
const params = new HttpParams({ fromObject: searchParams });
|
268
|
+
return this.service.api({
|
269
|
+
method: 'post',
|
270
|
+
url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
|
271
|
+
params,
|
272
|
+
body: {
|
273
|
+
configurationContext: context,
|
274
|
+
request: { searchCriteria },
|
275
|
+
},
|
276
|
+
});
|
277
|
+
}
|
278
|
+
fetchEligibleProducts$(searchParams, context) {
|
279
|
+
const params = new HttpParams({ fromObject: searchParams });
|
280
|
+
return this.service.api({
|
281
|
+
method: 'post',
|
282
|
+
url: `${this.serviceUrl}/products`,
|
283
|
+
params: params,
|
284
|
+
body: context,
|
285
|
+
});
|
286
|
+
}
|
287
|
+
fetchProducts$(searchParams) {
|
288
|
+
const params = new HttpParams({ fromObject: searchParams });
|
289
|
+
return this.service.api({
|
290
|
+
method: 'get',
|
291
|
+
url: `${this.serviceUrl}/products`,
|
292
|
+
params: params,
|
293
|
+
});
|
294
|
+
}
|
295
|
+
}
|
296
|
+
CatalogApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CatalogApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
297
|
+
CatalogApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CatalogApiService });
|
298
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CatalogApiService, decorators: [{
|
299
|
+
type: Injectable
|
300
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
301
|
+
|
302
|
+
class AttributeDTO {
|
303
|
+
constructor(name, type, value, cfgStatus, id, scale) {
|
304
|
+
this.name = name;
|
305
|
+
this.type = type;
|
306
|
+
this.value = value;
|
307
|
+
this.cfgStatus = cfgStatus;
|
308
|
+
this.id = id;
|
309
|
+
this.scale = scale;
|
310
|
+
}
|
311
|
+
static fromDTO(dto) {
|
312
|
+
return {
|
313
|
+
id: dto.id,
|
314
|
+
name: dto.name,
|
315
|
+
type: dto.type,
|
316
|
+
scale: dto.scale,
|
317
|
+
value: dto.value,
|
318
|
+
cfgStatus: dto.cfgStatus,
|
319
|
+
};
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
class PriceAdjustmentDTO {
|
324
|
+
constructor(amount, explanation, type) {
|
325
|
+
this.amount = amount;
|
326
|
+
this.explanation = explanation;
|
327
|
+
this.type = type;
|
328
|
+
}
|
329
|
+
static fromDTO(dto) {
|
330
|
+
return {
|
331
|
+
amount: dto.amount,
|
332
|
+
explanation: dto.explanation,
|
333
|
+
type: dto.type,
|
334
|
+
};
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
class ChargeGroupItemDTO {
|
339
|
+
constructor(chargeType, chargeMethod, properties, id, chargeTypeDisplayValue, frequencyUnit, frequencyDuration, basePrice, currency, sellingTerm, netPrice, listPrice, netUnitPrice, listUnitPrice, cost, priceAdjustment, priceWaterfalls, priceAdjustmentEnabled, listPriceAdjustmentEnabled) {
|
340
|
+
this.chargeType = chargeType;
|
341
|
+
this.chargeMethod = chargeMethod;
|
342
|
+
this.properties = properties;
|
343
|
+
this.id = id;
|
344
|
+
this.chargeTypeDisplayValue = chargeTypeDisplayValue;
|
345
|
+
this.frequencyUnit = frequencyUnit;
|
346
|
+
this.frequencyDuration = frequencyDuration;
|
347
|
+
this.basePrice = basePrice;
|
348
|
+
this.currency = currency;
|
349
|
+
this.sellingTerm = sellingTerm;
|
350
|
+
this.netPrice = netPrice;
|
351
|
+
this.listPrice = listPrice;
|
352
|
+
this.netUnitPrice = netUnitPrice;
|
353
|
+
this.listUnitPrice = listUnitPrice;
|
354
|
+
this.cost = cost;
|
355
|
+
this.priceAdjustment = priceAdjustment;
|
356
|
+
this.priceWaterfalls = priceWaterfalls;
|
357
|
+
this.priceAdjustmentEnabled = priceAdjustmentEnabled;
|
358
|
+
this.listPriceAdjustmentEnabled = listPriceAdjustmentEnabled;
|
359
|
+
}
|
360
|
+
static fromDTO(dto) {
|
361
|
+
var _a;
|
362
|
+
return {
|
363
|
+
id: dto.id,
|
364
|
+
chargeType: dto.chargeType,
|
365
|
+
chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
|
366
|
+
chargeMethod: dto.chargeMethod,
|
367
|
+
frequencyUnit: dto.frequencyUnit,
|
368
|
+
frequencyDuration: dto.frequencyDuration,
|
369
|
+
basePrice: dto.basePrice,
|
370
|
+
currency: dto.currency,
|
371
|
+
sellingTerm: dto.sellingTerm,
|
372
|
+
netPrice: dto.netPrice,
|
373
|
+
listPrice: dto.listPrice,
|
374
|
+
netUnitPrice: dto.netUnitPrice,
|
375
|
+
listUnitPrice: dto.listUnitPrice,
|
376
|
+
cost: dto.cost,
|
377
|
+
priceAdjustment: dto.priceAdjustment && PriceAdjustmentDTO.fromDTO(dto.priceAdjustment),
|
378
|
+
priceWaterfalls: (_a = dto.priceWaterfalls) === null || _a === void 0 ? void 0 : _a.map(PriceAdjustmentDTO.fromDTO),
|
379
|
+
priceAdjustmentEnabled: dto.priceAdjustmentEnabled,
|
380
|
+
listPriceAdjustmentEnabled: dto.listPriceAdjustmentEnabled,
|
381
|
+
properties: dto.properties,
|
382
|
+
};
|
383
|
+
}
|
384
|
+
}
|
385
|
+
|
386
|
+
class ChargeItemDTO {
|
387
|
+
constructor(id, price, unitPrice, baseListPrice, baseListUnitPrice, listPrice, listUnitPrice, netPrice, previousNetPrice, netUnitPrice, chargeId, chargeType, chargeMethod, priceItemId, startDate, priceWaterfalls, quantity, properties, chargeTypeDisplayValue, arr, frequencyUnit, frequencyDuration, endDate, sellingTerm, currency, unitCost, cost, minUnitPrice, minPrice, enablePriceAdjustment, enableListPriceAdjustment, listPriceAdjustment, priceAdjustment, requiresApprovals) {
|
388
|
+
this.id = id;
|
389
|
+
this.price = price;
|
390
|
+
this.unitPrice = unitPrice;
|
391
|
+
this.baseListPrice = baseListPrice;
|
392
|
+
this.baseListUnitPrice = baseListUnitPrice;
|
393
|
+
this.listPrice = listPrice;
|
394
|
+
this.listUnitPrice = listUnitPrice;
|
395
|
+
this.netPrice = netPrice;
|
396
|
+
this.previousNetPrice = previousNetPrice;
|
397
|
+
this.netUnitPrice = netUnitPrice;
|
398
|
+
this.chargeId = chargeId;
|
399
|
+
this.chargeType = chargeType;
|
400
|
+
this.chargeMethod = chargeMethod;
|
401
|
+
this.priceItemId = priceItemId;
|
402
|
+
this.startDate = startDate;
|
403
|
+
this.priceWaterfalls = priceWaterfalls;
|
404
|
+
this.quantity = quantity;
|
405
|
+
this.properties = properties;
|
406
|
+
this.chargeTypeDisplayValue = chargeTypeDisplayValue;
|
407
|
+
this.arr = arr;
|
408
|
+
this.frequencyUnit = frequencyUnit;
|
409
|
+
this.frequencyDuration = frequencyDuration;
|
410
|
+
this.endDate = endDate;
|
411
|
+
this.sellingTerm = sellingTerm;
|
412
|
+
this.currency = currency;
|
413
|
+
this.unitCost = unitCost;
|
414
|
+
this.cost = cost;
|
415
|
+
this.minUnitPrice = minUnitPrice;
|
416
|
+
this.minPrice = minPrice;
|
417
|
+
this.enablePriceAdjustment = enablePriceAdjustment;
|
418
|
+
this.enableListPriceAdjustment = enableListPriceAdjustment;
|
419
|
+
this.listPriceAdjustment = listPriceAdjustment;
|
420
|
+
this.priceAdjustment = priceAdjustment;
|
421
|
+
this.requiresApprovals = requiresApprovals;
|
422
|
+
}
|
423
|
+
static fromDTO(dto) {
|
424
|
+
return {
|
425
|
+
id: dto.id,
|
426
|
+
price: dto.price,
|
427
|
+
unitPrice: dto.unitPrice,
|
428
|
+
baseListPrice: dto.baseListPrice,
|
429
|
+
baseListUnitPrice: dto.baseListUnitPrice,
|
430
|
+
listPrice: dto.listPrice,
|
431
|
+
listUnitPrice: dto.listUnitPrice,
|
432
|
+
netPrice: dto.netPrice,
|
433
|
+
previousNetPrice: dto.previousNetPrice,
|
434
|
+
netUnitPrice: dto.netUnitPrice,
|
435
|
+
chargeId: dto.chargeId,
|
436
|
+
chargeType: dto.chargeType,
|
437
|
+
chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
|
438
|
+
chargeMethod: dto.chargeMethod,
|
439
|
+
priceItemId: dto.priceItemId,
|
440
|
+
startDate: dto.startDate,
|
441
|
+
endDate: dto.endDate,
|
442
|
+
priceWaterfalls: dto.priceWaterfalls.map(PriceAdjustmentDTO.fromDTO),
|
443
|
+
quantity: dto.quantity,
|
444
|
+
properties: dto.properties,
|
445
|
+
arr: dto.arr,
|
446
|
+
frequencyUnit: dto.frequencyUnit,
|
447
|
+
frequencyDuration: dto.frequencyDuration,
|
448
|
+
sellingTerm: dto.sellingTerm,
|
449
|
+
currency: dto.currency,
|
450
|
+
unitCost: dto.unitCost,
|
451
|
+
cost: dto.cost,
|
452
|
+
minUnitPrice: dto.minUnitPrice,
|
453
|
+
minPrice: dto.minPrice,
|
454
|
+
enablePriceAdjustment: dto.enablePriceAdjustment,
|
455
|
+
enableListPriceAdjustment: dto.enableListPriceAdjustment,
|
456
|
+
listPriceAdjustment: dto.listPriceAdjustment && PriceAdjustmentDTO.fromDTO(dto.listPriceAdjustment),
|
457
|
+
priceAdjustment: dto.priceAdjustment && PriceAdjustmentDTO.fromDTO(dto.priceAdjustment),
|
458
|
+
requiresApprovals: dto.requiresApprovals,
|
459
|
+
};
|
460
|
+
}
|
461
|
+
}
|
462
|
+
|
463
|
+
class RecommendedPriceDTO {
|
464
|
+
constructor(netPrice, listPrice, chargeType, chargeMethod, explanation, frequencyDuration, frequencyUnit, properties) {
|
465
|
+
this.netPrice = netPrice;
|
466
|
+
this.listPrice = listPrice;
|
467
|
+
this.chargeType = chargeType;
|
468
|
+
this.chargeMethod = chargeMethod;
|
469
|
+
this.explanation = explanation;
|
470
|
+
this.frequencyDuration = frequencyDuration;
|
471
|
+
this.frequencyUnit = frequencyUnit;
|
472
|
+
this.properties = properties;
|
473
|
+
}
|
474
|
+
static fromDTO(dto) {
|
475
|
+
return {
|
476
|
+
netPrice: dto.netPrice,
|
477
|
+
listPrice: dto.listPrice,
|
478
|
+
chargeType: dto.chargeType,
|
479
|
+
chargeMethod: dto.chargeMethod,
|
480
|
+
frequencyUnit: dto.frequencyUnit,
|
481
|
+
frequencyDuration: dto.frequencyDuration,
|
482
|
+
explanation: dto.explanation,
|
483
|
+
properties: dto.properties,
|
484
|
+
};
|
485
|
+
}
|
486
|
+
}
|
487
|
+
|
488
|
+
class DomainTypeDTO {
|
489
|
+
constructor(name, displayName, minCard, maxCard, recommendedPrices, properties, status, cardinality) {
|
490
|
+
this.name = name;
|
491
|
+
this.displayName = displayName;
|
492
|
+
this.minCard = minCard;
|
493
|
+
this.maxCard = maxCard;
|
494
|
+
this.recommendedPrices = recommendedPrices;
|
495
|
+
this.properties = properties;
|
496
|
+
this.status = status;
|
497
|
+
this.cardinality = cardinality;
|
498
|
+
}
|
499
|
+
static fromDTO(dto) {
|
500
|
+
var _a;
|
501
|
+
return {
|
502
|
+
name: dto.name,
|
503
|
+
displayName: dto.displayName,
|
504
|
+
minCard: dto.minCard,
|
505
|
+
maxCard: dto.maxCard,
|
506
|
+
recommendedPrices: (_a = dto.recommendedPrices) === null || _a === void 0 ? void 0 : _a.map(RecommendedPriceDTO.fromDTO),
|
507
|
+
properties: dto.properties,
|
508
|
+
status: dto.status,
|
509
|
+
cardinality: dto.cardinality,
|
510
|
+
};
|
511
|
+
}
|
512
|
+
}
|
513
|
+
|
514
|
+
class PortDomainDTO {
|
515
|
+
constructor(name, type, minCard, maxCard, domainTypes, properties) {
|
516
|
+
this.name = name;
|
517
|
+
this.type = type;
|
518
|
+
this.minCard = minCard;
|
519
|
+
this.maxCard = maxCard;
|
520
|
+
this.domainTypes = domainTypes;
|
521
|
+
this.properties = properties;
|
522
|
+
}
|
523
|
+
static fromDTO(dto) {
|
524
|
+
return {
|
525
|
+
name: dto.name,
|
526
|
+
type: dto.type,
|
527
|
+
minCard: dto.minCard,
|
528
|
+
maxCard: dto.maxCard,
|
529
|
+
domainTypes: dto.domainTypes.map(DomainTypeDTO.fromDTO),
|
530
|
+
properties: dto.properties,
|
531
|
+
};
|
532
|
+
}
|
533
|
+
}
|
534
|
+
|
535
|
+
class PriceDTO {
|
536
|
+
constructor(netPrice, listPrice, chargeType, chargeTypeDisplayValue, chargeMethod, frequencyUnit, frequencyDuration, sellingTerm) {
|
537
|
+
this.netPrice = netPrice;
|
538
|
+
this.listPrice = listPrice;
|
539
|
+
this.chargeType = chargeType;
|
540
|
+
this.chargeTypeDisplayValue = chargeTypeDisplayValue;
|
541
|
+
this.chargeMethod = chargeMethod;
|
542
|
+
this.frequencyUnit = frequencyUnit;
|
543
|
+
this.frequencyDuration = frequencyDuration;
|
544
|
+
this.sellingTerm = sellingTerm;
|
545
|
+
}
|
546
|
+
static fromDTO(dto) {
|
547
|
+
return {
|
548
|
+
netPrice: dto.netPrice,
|
549
|
+
listPrice: dto.listPrice,
|
550
|
+
chargeType: dto.chargeType,
|
551
|
+
chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
|
552
|
+
chargeMethod: dto.chargeMethod,
|
553
|
+
frequencyUnit: dto.frequencyUnit,
|
554
|
+
frequencyDuration: dto.frequencyDuration,
|
555
|
+
sellingTerm: dto.sellingTerm,
|
556
|
+
};
|
557
|
+
}
|
558
|
+
}
|
559
|
+
|
560
|
+
class LineItemDTO {
|
561
|
+
constructor(id, activated, attributes, attributeDomains, cfgStatus, chargeGroupItems, chargeItems, domainComputations, lineItems, messages, name, optionalCharges, pending, portDomains, properties, qty, totalPrices, type, integrationId, productId, port, parentId, assetId, openOrderLineItemId, productName, rootId, actionCode, serviceStartDate, effectiveDate, effectiveStartDate, startDate, endDate, priceListId, planId, sellingFrequencyUnit, sellingFrequencyDuration, minimalTerm, offeringId, offeringItemId, offeringInstanceId, rampInstanceId, enableRamp, configurable, requiresApprovals) {
|
562
|
+
this.id = id;
|
563
|
+
this.activated = activated;
|
564
|
+
this.attributes = attributes;
|
565
|
+
this.attributeDomains = attributeDomains;
|
566
|
+
this.cfgStatus = cfgStatus;
|
567
|
+
this.chargeGroupItems = chargeGroupItems;
|
568
|
+
this.chargeItems = chargeItems;
|
569
|
+
this.domainComputations = domainComputations;
|
570
|
+
this.lineItems = lineItems;
|
571
|
+
this.messages = messages;
|
572
|
+
this.name = name;
|
573
|
+
this.optionalCharges = optionalCharges;
|
574
|
+
this.pending = pending;
|
575
|
+
this.portDomains = portDomains;
|
576
|
+
this.properties = properties;
|
577
|
+
this.qty = qty;
|
578
|
+
this.totalPrices = totalPrices;
|
579
|
+
this.type = type;
|
580
|
+
this.integrationId = integrationId;
|
581
|
+
this.productId = productId;
|
582
|
+
this.port = port;
|
583
|
+
this.parentId = parentId;
|
584
|
+
this.assetId = assetId;
|
585
|
+
this.openOrderLineItemId = openOrderLineItemId;
|
586
|
+
this.productName = productName;
|
587
|
+
this.rootId = rootId;
|
588
|
+
this.actionCode = actionCode;
|
589
|
+
this.serviceStartDate = serviceStartDate;
|
590
|
+
this.effectiveDate = effectiveDate;
|
591
|
+
this.effectiveStartDate = effectiveStartDate;
|
592
|
+
this.startDate = startDate;
|
593
|
+
this.endDate = endDate;
|
594
|
+
this.priceListId = priceListId;
|
595
|
+
this.planId = planId;
|
596
|
+
this.sellingFrequencyUnit = sellingFrequencyUnit;
|
597
|
+
this.sellingFrequencyDuration = sellingFrequencyDuration;
|
598
|
+
this.minimalTerm = minimalTerm;
|
599
|
+
this.offeringId = offeringId;
|
600
|
+
this.offeringItemId = offeringItemId;
|
601
|
+
this.offeringInstanceId = offeringInstanceId;
|
602
|
+
this.rampInstanceId = rampInstanceId;
|
603
|
+
this.enableRamp = enableRamp;
|
604
|
+
this.configurable = configurable;
|
605
|
+
this.requiresApprovals = requiresApprovals;
|
606
|
+
}
|
607
|
+
static fromDTO(dto) {
|
608
|
+
return {
|
609
|
+
id: dto.id,
|
610
|
+
activated: dto.activated,
|
611
|
+
attributes: dto.attributes.map(AttributeDTO.fromDTO),
|
612
|
+
attributeDomains: dto.attributeDomains,
|
613
|
+
cfgStatus: dto.cfgStatus,
|
614
|
+
chargeGroupItems: dto.chargeGroupItems.map(ChargeGroupItemDTO.fromDTO),
|
615
|
+
chargeItems: dto.chargeItems.map(ChargeItemDTO.fromDTO),
|
616
|
+
domainComputations: dto.domainComputations,
|
617
|
+
lineItems: dto.lineItems.map(LineItemDTO.fromDTO),
|
618
|
+
messages: dto.messages,
|
619
|
+
name: dto.name,
|
620
|
+
optionalCharges: dto.optionalCharges,
|
621
|
+
pending: dto.pending,
|
622
|
+
portDomains: transform(dto.portDomains, (result, value, key) => (result[key] = PortDomainDTO.fromDTO(value))),
|
623
|
+
properties: dto.properties,
|
624
|
+
qty: dto.qty,
|
625
|
+
totalPrices: transform(dto.totalPrices, (result, value, key) => (result[key] = PriceDTO.fromDTO(value))),
|
626
|
+
type: dto.type,
|
627
|
+
productId: dto.productId,
|
628
|
+
port: dto.port,
|
629
|
+
integrationId: dto.integrationId,
|
630
|
+
parentId: dto.parentId,
|
631
|
+
assetId: dto.assetId,
|
632
|
+
openOrderLineItemId: dto.openOrderLineItemId,
|
633
|
+
productName: dto.productName,
|
634
|
+
rootId: dto.rootId,
|
635
|
+
actionCode: dto.actionCode,
|
636
|
+
serviceStartDate: dto.serviceStartDate,
|
637
|
+
effectiveDate: dto.effectiveDate,
|
638
|
+
effectiveStartDate: dto.effectiveStartDate,
|
639
|
+
startDate: dto.startDate,
|
640
|
+
endDate: dto.endDate,
|
641
|
+
priceListId: dto.priceListId,
|
642
|
+
planId: dto.planId,
|
643
|
+
sellingFrequencyUnit: dto.sellingFrequencyUnit,
|
644
|
+
sellingFrequencyDuration: dto.sellingFrequencyDuration,
|
645
|
+
minimalTerm: dto.minimalTerm,
|
646
|
+
offeringId: dto.offeringId,
|
647
|
+
offeringItemId: dto.offeringItemId,
|
648
|
+
offeringInstanceId: dto.offeringInstanceId,
|
649
|
+
rampInstanceId: dto.rampInstanceId,
|
650
|
+
enableRamp: dto.enableRamp,
|
651
|
+
configurable: dto.configurable,
|
652
|
+
requiresApprovals: dto.requiresApprovals,
|
653
|
+
};
|
654
|
+
}
|
655
|
+
}
|
656
|
+
|
657
|
+
class ConfigurePriceDTO {
|
658
|
+
constructor(lineItem, context, charges, pricePlans) {
|
659
|
+
this.lineItem = lineItem;
|
660
|
+
this.context = context;
|
661
|
+
this.charges = charges;
|
662
|
+
this.pricePlans = pricePlans;
|
663
|
+
}
|
664
|
+
static fromDTO(dto) {
|
665
|
+
return {
|
666
|
+
lineItem: LineItemDTO.fromDTO(dto.lineItem),
|
667
|
+
charges: dto.charges,
|
668
|
+
pricePlans: dto.pricePlans,
|
669
|
+
context: dto.context,
|
670
|
+
deletedLineItems: dto.deletedLineItems.map(deletedLineItem => LineItemDTO.fromDTO(deletedLineItem)),
|
671
|
+
};
|
672
|
+
}
|
673
|
+
}
|
674
|
+
|
675
|
+
class ConfigurationApiService {
|
676
|
+
constructor(httpService) {
|
677
|
+
this.httpService = httpService;
|
678
|
+
this.SERVICE_URL = '/configuration';
|
679
|
+
}
|
680
|
+
configureLineItem({ configurationRequest, runtimeModel, pricingEnabled, }) {
|
681
|
+
return this.httpService
|
682
|
+
.api({
|
683
|
+
method: 'post',
|
684
|
+
url: `${this.SERVICE_URL}${pricingEnabled ? '/price' : ''}`,
|
685
|
+
body: configurationRequest,
|
686
|
+
errorHandler: e => throwError(e),
|
687
|
+
})
|
688
|
+
.pipe(map(response => ConfigurePriceDTO.fromDTO(response)), map(configurePrice => {
|
689
|
+
if (runtimeModel) {
|
690
|
+
return Object.assign(Object.assign({}, configurePrice), { lineItem: this.updatePortDomains(configurePrice.lineItem, runtimeModel) });
|
691
|
+
}
|
692
|
+
else {
|
693
|
+
return configurePrice;
|
694
|
+
}
|
695
|
+
}));
|
696
|
+
}
|
697
|
+
getRuntimeDataByProductId(productId, offeringId) {
|
698
|
+
return this.httpService
|
699
|
+
.api({
|
700
|
+
method: 'get',
|
701
|
+
url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
|
702
|
+
})
|
703
|
+
.pipe(map(runtimeData => {
|
704
|
+
runtimeData.uiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
|
705
|
+
runtimeData.uiDefinitions.forEach(uiDefinition => {
|
706
|
+
ModelTranslatorUtils.toLocalUIDefinition(uiDefinition);
|
707
|
+
});
|
708
|
+
return runtimeData;
|
709
|
+
}));
|
710
|
+
}
|
711
|
+
getRuntimeDataByModelId(modelId) {
|
712
|
+
return this.httpService
|
713
|
+
.api({
|
714
|
+
method: 'get',
|
715
|
+
url: `${this.SERVICE_URL}/${modelId}/model-test`,
|
716
|
+
})
|
717
|
+
.pipe(map((runtimeData) => {
|
718
|
+
runtimeData.uiDefinitions = [];
|
719
|
+
return runtimeData;
|
720
|
+
}));
|
721
|
+
}
|
722
|
+
updatePortDomains(lineItem, runtimeModel) {
|
723
|
+
var _a, _b, _c;
|
724
|
+
const type = runtimeModel.components.get(lineItem.type);
|
725
|
+
const portDomains = Object.assign({}, lineItem.portDomains);
|
726
|
+
for (const port of (_a = type === null || type === void 0 ? void 0 : type.ports) !== null && _a !== void 0 ? _a : []) {
|
727
|
+
const portDomain = portDomains[port.name];
|
728
|
+
if (((_b = portDomain === null || portDomain === void 0 ? void 0 : portDomain.properties) === null || _b === void 0 ? void 0 : _b.domainComputation) === 'false') {
|
729
|
+
portDomain.domainTypes = port.domainTypes;
|
730
|
+
}
|
731
|
+
}
|
732
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: (_c = lineItem.lineItems) === null || _c === void 0 ? void 0 : _c.map(i => this.updatePortDomains(i, runtimeModel)), portDomains });
|
733
|
+
}
|
734
|
+
}
|
735
|
+
ConfigurationApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
736
|
+
ConfigurationApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationApiService });
|
737
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationApiService, decorators: [{
|
738
|
+
type: Injectable
|
739
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
740
|
+
|
741
|
+
class ConfigurationSettingsDTO {
|
742
|
+
constructor(id, key, value) {
|
743
|
+
this.id = id;
|
744
|
+
this.key = key;
|
745
|
+
this.value = value;
|
746
|
+
}
|
747
|
+
static fromDTO(dto, key) {
|
748
|
+
return {
|
749
|
+
id: dto === null || dto === void 0 ? void 0 : dto.id,
|
750
|
+
key: (dto === null || dto === void 0 ? void 0 : dto.key) || key || '',
|
751
|
+
value: dto === null || dto === void 0 ? void 0 : dto.value,
|
752
|
+
};
|
753
|
+
}
|
754
|
+
static toDTO(data) {
|
755
|
+
return {
|
756
|
+
id: data.id,
|
757
|
+
key: data.key,
|
758
|
+
value: data.value,
|
759
|
+
};
|
760
|
+
}
|
761
|
+
}
|
762
|
+
|
763
|
+
class ConfigurationSettingsApiService {
|
764
|
+
constructor(httpService) {
|
765
|
+
this.httpService = httpService;
|
766
|
+
this.SERVICE_URL = '/configuration-settings';
|
767
|
+
}
|
768
|
+
fetchSettings(options) {
|
769
|
+
return this.httpService
|
770
|
+
.api(Object.assign({ url: `${this.SERVICE_URL}`, method: 'get' }, options))
|
771
|
+
.pipe(map((settings) => settings.map(setting => ConfigurationSettingsDTO.fromDTO(setting))));
|
772
|
+
}
|
773
|
+
fetchSetting(settingsKey, options) {
|
774
|
+
return this.httpService
|
775
|
+
.api(Object.assign({ url: `${this.SERVICE_URL}/byKey/${settingsKey}`, method: 'get' }, options))
|
776
|
+
.pipe(map((setting) => ConfigurationSettingsDTO.fromDTO(setting, settingsKey)), catchError(err => {
|
777
|
+
if (err instanceof HttpErrorResponse && err.status === 404) {
|
778
|
+
return of(null);
|
779
|
+
}
|
780
|
+
throw err;
|
781
|
+
}));
|
782
|
+
}
|
783
|
+
createSetting(setting, options) {
|
784
|
+
const request = ConfigurationSettingsDTO.toDTO(setting);
|
785
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}`, method: 'post', body: Object.assign({}, request) }, options));
|
786
|
+
}
|
787
|
+
updateSetting(setting, options) {
|
788
|
+
const request = ConfigurationSettingsDTO.toDTO(setting);
|
789
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${request.id}`, method: 'put', body: Object.assign({}, request) }, options));
|
790
|
+
}
|
791
|
+
removeSetting(setting, options) {
|
792
|
+
const request = ConfigurationSettingsDTO.toDTO(setting);
|
793
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${request.id}`, method: 'delete' }, options));
|
794
|
+
}
|
795
|
+
restoreSetting(settingId, options) {
|
796
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${settingId}/restore`, method: 'patch' }, options));
|
797
|
+
}
|
798
|
+
clear(name, options) {
|
799
|
+
return this.httpService.api(Object.assign({ method: 'get', url: '/cache/evict/' + name }, options));
|
800
|
+
}
|
801
|
+
}
|
802
|
+
ConfigurationSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationSettingsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
803
|
+
ConfigurationSettingsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationSettingsApiService });
|
804
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationSettingsApiService, decorators: [{
|
805
|
+
type: Injectable
|
806
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
807
|
+
|
808
|
+
class ContextApiService {
|
809
|
+
constructor(httpService) {
|
810
|
+
this.httpService = httpService;
|
811
|
+
this.SERVICE_URL = '/context';
|
812
|
+
}
|
813
|
+
getContext(headerId, mode) {
|
814
|
+
return this.httpService.api({
|
815
|
+
method: 'post',
|
816
|
+
body: {
|
817
|
+
headerId: headerId,
|
818
|
+
contextMode: ConfigurationContextMode[mode],
|
819
|
+
},
|
820
|
+
url: `${this.SERVICE_URL}`,
|
821
|
+
});
|
822
|
+
}
|
823
|
+
}
|
824
|
+
ContextApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
825
|
+
ContextApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextApiService });
|
826
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextApiService, decorators: [{
|
827
|
+
type: Injectable
|
828
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
829
|
+
|
830
|
+
class DeltaApiService {
|
831
|
+
constructor(httpService) {
|
832
|
+
this.httpService = httpService;
|
833
|
+
this.SERVICE_URL = '/delta';
|
834
|
+
}
|
835
|
+
calculate$(request) {
|
836
|
+
return this.httpService
|
837
|
+
.api({
|
838
|
+
method: 'post',
|
839
|
+
url: `${this.SERVICE_URL}/calculate`,
|
840
|
+
body: request,
|
841
|
+
skipErrorHandler: true,
|
842
|
+
})
|
843
|
+
.pipe(map$1(dtos => dtos.map(dto => LineItemDTO.fromDTO(dto))));
|
844
|
+
}
|
845
|
+
}
|
846
|
+
DeltaApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DeltaApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
847
|
+
DeltaApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DeltaApiService });
|
848
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DeltaApiService, decorators: [{
|
849
|
+
type: Injectable
|
850
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
851
|
+
|
852
|
+
class DocumentAttachmentApiService {
|
853
|
+
constructor(httpService, fileDownloadService) {
|
854
|
+
this.httpService = httpService;
|
855
|
+
this.fileDownloadService = fileDownloadService;
|
856
|
+
this.SERVICE_URL = '/attachments';
|
857
|
+
}
|
858
|
+
getAttachments(searchRequest) {
|
859
|
+
return this.httpService.api({
|
860
|
+
url: `${this.SERVICE_URL}/search`,
|
861
|
+
method: 'post',
|
862
|
+
body: searchRequest,
|
863
|
+
});
|
864
|
+
}
|
865
|
+
createAttachment(attachment, file, reportProgress) {
|
866
|
+
const formData = new FormData();
|
867
|
+
if (file) {
|
868
|
+
formData.append('file', file, file.name);
|
869
|
+
}
|
870
|
+
formData.append('attachment', new Blob([JSON.stringify(attachment)], {
|
871
|
+
type: 'application/json',
|
872
|
+
}));
|
873
|
+
return this.httpService.upload({
|
874
|
+
url: `${this.SERVICE_URL}`,
|
875
|
+
body: formData,
|
876
|
+
method: 'post',
|
877
|
+
observe: reportProgress ? 'events' : undefined,
|
878
|
+
reportProgress,
|
879
|
+
});
|
880
|
+
}
|
881
|
+
updateAttachment(id, attachment) {
|
882
|
+
return this.httpService.api({
|
883
|
+
url: `${this.SERVICE_URL}/${id}`,
|
884
|
+
body: attachment,
|
885
|
+
method: 'put',
|
886
|
+
});
|
887
|
+
}
|
888
|
+
getAttachmentFile(id, isPreventDownload) {
|
889
|
+
return this.httpService
|
890
|
+
.api({
|
891
|
+
url: `${this.SERVICE_URL}/${id}/file`,
|
892
|
+
responseType: isPreventDownload ? 'arraybuffer' : 'blob',
|
893
|
+
observe: isPreventDownload ? 'body' : 'response',
|
894
|
+
})
|
895
|
+
.pipe(tap(response => {
|
896
|
+
if (!isPreventDownload) {
|
897
|
+
this.fileDownloadService.processDownload(response);
|
898
|
+
}
|
899
|
+
}), map(response => (isPreventDownload ? new Blob([response.body || response]) : response.body || response)));
|
900
|
+
}
|
901
|
+
removeAttachment(id) {
|
902
|
+
return this.httpService.api({
|
903
|
+
url: `${this.SERVICE_URL}/${id}`,
|
904
|
+
method: 'delete',
|
905
|
+
});
|
906
|
+
}
|
907
|
+
}
|
908
|
+
DocumentAttachmentApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DocumentAttachmentApiService, deps: [{ token: i1.BaseHttpService }, { token: i1.FileDownloadService }], target: i0.ɵɵFactoryTarget.Injectable });
|
909
|
+
DocumentAttachmentApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DocumentAttachmentApiService });
|
910
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DocumentAttachmentApiService, decorators: [{
|
911
|
+
type: Injectable
|
912
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1.FileDownloadService }]; } });
|
913
|
+
|
914
|
+
class SalesforceApiService {
|
915
|
+
constructor(httpService) {
|
916
|
+
this.httpService = httpService;
|
917
|
+
this.SERVICE_URL = '/proxy';
|
918
|
+
}
|
919
|
+
query(searchRequest, objectName, options) {
|
920
|
+
return this.httpService.api(Object.assign({ method: 'post', body: Object.assign(Object.assign({}, searchRequest), { count: searchRequest.count || 100 }), url: `${this.SERVICE_URL}/query/${objectName}` }, options));
|
921
|
+
}
|
922
|
+
queryObjects(search, options) {
|
923
|
+
let params = new HttpParams();
|
924
|
+
if (search) {
|
925
|
+
params = params.append('search', search);
|
926
|
+
}
|
927
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/query`, params }, options));
|
928
|
+
}
|
929
|
+
describe(objectName, fieldName, options) {
|
930
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
|
931
|
+
return this.httpService.api(Object.assign({ url: methodUrl }, options));
|
932
|
+
}
|
933
|
+
describe2(objectName, fields, options) {
|
934
|
+
const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
|
935
|
+
return this.httpService.api(Object.assign({ method: 'post', url: methodUrl, body: fields }, options));
|
936
|
+
}
|
937
|
+
apexGetRequest(path, params, options) {
|
938
|
+
return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params }, options));
|
939
|
+
}
|
940
|
+
apexPostRequest(path, body, options) {
|
941
|
+
return this.httpService.api(Object.assign({ method: 'post', body, url: `${this.SERVICE_URL}/apex${path}` }, options));
|
942
|
+
}
|
943
|
+
}
|
944
|
+
SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
945
|
+
SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SalesforceApiService });
|
946
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SalesforceApiService, decorators: [{
|
947
|
+
type: Injectable
|
948
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
949
|
+
|
950
|
+
const moment = moment_;
|
951
|
+
class DocumentTemplatesApiService {
|
952
|
+
constructor(service, salesforceApiService, fileDownloadService, documentAttachmentService, http) {
|
953
|
+
this.service = service;
|
954
|
+
this.salesforceApiService = salesforceApiService;
|
955
|
+
this.fileDownloadService = fileDownloadService;
|
956
|
+
this.documentAttachmentService = documentAttachmentService;
|
957
|
+
this.http = http;
|
958
|
+
this.DOCGEN_TAG = 'docgen';
|
959
|
+
this.SERVICE_URL = '/templates';
|
960
|
+
this.DOC_GEN_URL_FALLBACK = 'https://dev-dp1.velocpq.com/docgen';
|
961
|
+
this.mapSfQueryResult = (limit) => map((records) => {
|
962
|
+
if (!records.length) {
|
963
|
+
return { _result: 'No Records Found' };
|
964
|
+
}
|
965
|
+
if (limit === 1) {
|
966
|
+
return records[0];
|
967
|
+
}
|
968
|
+
return records;
|
969
|
+
});
|
970
|
+
this.mapBooleanIfAplicable = (value) => {
|
971
|
+
if (value === 'true') {
|
972
|
+
return true;
|
973
|
+
}
|
974
|
+
if (value === 'false') {
|
975
|
+
return false;
|
976
|
+
}
|
977
|
+
return value;
|
978
|
+
};
|
979
|
+
if (window.VELO_DOCGEN_API) {
|
980
|
+
this.DOC_GEN_URL = window.VELO_DOCGEN_API;
|
981
|
+
}
|
982
|
+
else {
|
983
|
+
console.log(`window.VELO_DOCGEN_API not set, will use fallback "${this.DOC_GEN_URL_FALLBACK}"`);
|
984
|
+
this.DOC_GEN_URL = this.DOC_GEN_URL_FALLBACK;
|
985
|
+
}
|
986
|
+
}
|
987
|
+
getTemplates(tag) {
|
988
|
+
return this.service.api({
|
989
|
+
url: `${this.SERVICE_URL}`,
|
990
|
+
method: 'get',
|
991
|
+
params: Object.assign({}, (tag && { tag })),
|
992
|
+
});
|
993
|
+
}
|
994
|
+
getTemplate(id) {
|
995
|
+
return this.service.api({
|
996
|
+
url: `${this.SERVICE_URL}/${id}`,
|
997
|
+
method: 'get',
|
998
|
+
});
|
999
|
+
}
|
1000
|
+
upsertTemplate(template, file, reportProgress) {
|
1001
|
+
const formData = new FormData();
|
1002
|
+
if (file) {
|
1003
|
+
formData.append('file', file, file.name);
|
1004
|
+
}
|
1005
|
+
formData.append('template', new Blob([JSON.stringify(template)], {
|
1006
|
+
type: 'application/json',
|
1007
|
+
}));
|
1008
|
+
let url = `${this.SERVICE_URL}`;
|
1009
|
+
if (template.id) {
|
1010
|
+
url += `/${template.id}`;
|
1011
|
+
}
|
1012
|
+
return this.service.upload({
|
1013
|
+
url,
|
1014
|
+
body: formData,
|
1015
|
+
method: template.id ? 'put' : 'post',
|
1016
|
+
reportProgress,
|
1017
|
+
});
|
1018
|
+
}
|
1019
|
+
removeTemplate(id) {
|
1020
|
+
return this.service.api({
|
1021
|
+
url: `${this.SERVICE_URL}/${id}`,
|
1022
|
+
method: 'delete',
|
1023
|
+
});
|
1024
|
+
}
|
1025
|
+
restoreTemplate(id) {
|
1026
|
+
return this.service.api({
|
1027
|
+
url: `${this.SERVICE_URL}/${id}/restore`,
|
1028
|
+
method: 'patch',
|
1029
|
+
});
|
1030
|
+
}
|
1031
|
+
cloneTemplate(id, propertiesToOverride = {}) {
|
1032
|
+
return this.service.api({
|
1033
|
+
url: `${this.SERVICE_URL}/clone/${id}`,
|
1034
|
+
method: 'post',
|
1035
|
+
body: {
|
1036
|
+
id,
|
1037
|
+
propertiesToOverride,
|
1038
|
+
},
|
1039
|
+
});
|
1040
|
+
}
|
1041
|
+
getTemplateFile(id) {
|
1042
|
+
return this.service.api({
|
1043
|
+
method: 'get',
|
1044
|
+
url: `${this.SERVICE_URL}/${id}/file`,
|
1045
|
+
responseType: 'arraybuffer',
|
1046
|
+
});
|
1047
|
+
}
|
1048
|
+
downloadTemplateFile(id) {
|
1049
|
+
return this.service
|
1050
|
+
.api({
|
1051
|
+
url: `${this.SERVICE_URL}/${id}/file`,
|
1052
|
+
responseType: 'blob',
|
1053
|
+
observe: 'response',
|
1054
|
+
})
|
1055
|
+
.pipe(tap(response => {
|
1056
|
+
this.fileDownloadService.processDownload(response);
|
1057
|
+
}), map(response => response.body || response));
|
1058
|
+
}
|
1059
|
+
mergeDocuments(document, attachments) {
|
1060
|
+
const body = new FormData();
|
1061
|
+
attachments.forEach(attachment => {
|
1062
|
+
body.append('attachments', new Blob([attachment]));
|
1063
|
+
});
|
1064
|
+
body.append('orderform', document);
|
1065
|
+
return this.http.post(`${this.DOC_GEN_URL}/documents/merge`, body, {
|
1066
|
+
responseType: 'arraybuffer',
|
1067
|
+
});
|
1068
|
+
}
|
1069
|
+
getAttachments(searchRequest) {
|
1070
|
+
return this.documentAttachmentService.getAttachments(searchRequest);
|
1071
|
+
}
|
1072
|
+
getAttachmentFile(id) {
|
1073
|
+
return this.documentAttachmentService.getAttachmentFile(id);
|
1074
|
+
}
|
1075
|
+
createAttachment(attachment, file, reportProgress) {
|
1076
|
+
return this.documentAttachmentService.createAttachment(attachment, file, reportProgress);
|
1077
|
+
}
|
1078
|
+
removeAttachment(id) {
|
1079
|
+
return this.documentAttachmentService.removeAttachment(id);
|
1080
|
+
}
|
1081
|
+
generateDocumentData(template, object, params = {}) {
|
1082
|
+
var _a;
|
1083
|
+
if (isLegacyDocumentTemplate(template)) {
|
1084
|
+
return this.generateDocumentDataLegacy(template, object, params);
|
1085
|
+
}
|
1086
|
+
const templateProperties = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: this.mapBooleanIfAplicable(value) })), {});
|
1087
|
+
/*
|
1088
|
+
Resolve quote and template properties for now
|
1089
|
+
When procedures are ready, whey will replace template scripts.
|
1090
|
+
|
1091
|
+
TODO: run procedure to resolve document data
|
1092
|
+
*/
|
1093
|
+
return of(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object })), templateProperties));
|
1094
|
+
}
|
1095
|
+
generateDocument(template, object, params = {}) {
|
1096
|
+
const documentData$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
|
1097
|
+
return zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(switchMap(([templateFile, data, attachments]) => {
|
1098
|
+
var _a, _b, _c, _d, _e, _f;
|
1099
|
+
const document = DocxTemplater.generate(templateFile, data);
|
1100
|
+
const properties = (_c = (_b = (_a = object === null || object === void 0 ? void 0 : object.context) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : object === null || object === void 0 ? void 0 : object.properties) !== null && _c !== void 0 ? _c : {};
|
1101
|
+
const documentName = properties.Name || template.name;
|
1102
|
+
const documentFormat = (_d = params.documentFormat) !== null && _d !== void 0 ? _d : (_f = (_e = template.properties) === null || _e === void 0 ? void 0 : _e.find(p => p.name === 'documentFormat')) === null || _f === void 0 ? void 0 : _f.value;
|
1103
|
+
if (documentFormat === 'DOCX') {
|
1104
|
+
this.fileDownloadService.processDownload(document, documentName);
|
1105
|
+
return of(document);
|
1106
|
+
}
|
1107
|
+
return this.mergeDocuments(document, attachments).pipe(switchMap(pdf => {
|
1108
|
+
if (params.attachToQuote && QuoteDraft.isQuote(object)) {
|
1109
|
+
const file = new File([pdf], `${documentName}.pdf`);
|
1110
|
+
return this.documentAttachmentService
|
1111
|
+
.createAttachment({
|
1112
|
+
linkedEntityId: object.quoteId,
|
1113
|
+
fileName: documentName,
|
1114
|
+
fileExtension: 'pdf',
|
1115
|
+
tags: this.DOCGEN_TAG,
|
1116
|
+
}, file)
|
1117
|
+
.pipe(map(() => pdf));
|
1118
|
+
}
|
1119
|
+
return of(pdf);
|
1120
|
+
}), map(pdf => {
|
1121
|
+
const blob = new Blob([pdf]);
|
1122
|
+
if (!params.shouldPreventDownload) {
|
1123
|
+
this.fileDownloadService.processDownload(blob, `${documentName}.pdf`);
|
1124
|
+
}
|
1125
|
+
return blob;
|
1126
|
+
}));
|
1127
|
+
}));
|
1128
|
+
}
|
1129
|
+
generateDocumentDataLegacy(template, object, params = {}) {
|
1130
|
+
var _a, _b, _c, _d;
|
1131
|
+
const shouldPreventDownload = params.shouldPreventDownload;
|
1132
|
+
const allQueries = [...((_a = template === null || template === void 0 ? void 0 : template.queries) !== null && _a !== void 0 ? _a : [])];
|
1133
|
+
const properties = (_d = (_c = (_b = object === null || object === void 0 ? void 0 : object.context) === null || _b === void 0 ? void 0 : _b.properties) !== null && _c !== void 0 ? _c : object === null || object === void 0 ? void 0 : object.properties) !== null && _d !== void 0 ? _d : {};
|
1134
|
+
const accountId = properties === null || properties === void 0 ? void 0 : properties.AccountId;
|
1135
|
+
const userId = properties === null || properties === void 0 ? void 0 : properties.UserId;
|
1136
|
+
if (accountId) {
|
1137
|
+
allQueries.push({
|
1138
|
+
queryName: 'QuoteAccountQuery',
|
1139
|
+
objectName: 'Account',
|
1140
|
+
resultObjectName: 'account',
|
1141
|
+
statement: `Id ='${accountId}'`,
|
1142
|
+
fields: [],
|
1143
|
+
});
|
1144
|
+
}
|
1145
|
+
if (userId) {
|
1146
|
+
allQueries.push({
|
1147
|
+
queryName: 'QuoteUserQuery',
|
1148
|
+
objectName: 'User',
|
1149
|
+
resultObjectName: 'agent',
|
1150
|
+
statement: `Id ='${userId}'`,
|
1151
|
+
fields: [],
|
1152
|
+
});
|
1153
|
+
}
|
1154
|
+
const queries = allQueries.map(query => this.queryObject(query, { properties })) || [];
|
1155
|
+
return forkJoin([...queries]).pipe(defaultIfEmpty([]), map(results => {
|
1156
|
+
var _a, _b, _c, _d;
|
1157
|
+
const queriesResult = _.chain(results)
|
1158
|
+
.reduce((acc, r) => {
|
1159
|
+
if (r) {
|
1160
|
+
return Object.assign(Object.assign({}, acc), r);
|
1161
|
+
}
|
1162
|
+
return acc;
|
1163
|
+
}, {})
|
1164
|
+
.value();
|
1165
|
+
const templateProperties = ((template === null || template === void 0 ? void 0 : template.properties) || []).reduce((trunk, { name, value }) => {
|
1166
|
+
return Object.assign(Object.assign({}, trunk), { [name]: this.mapBooleanIfAplicable(value) });
|
1167
|
+
}, {});
|
1168
|
+
const data = Object.assign(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object })), queriesResult), templateProperties);
|
1169
|
+
if (template.script && template.script.trim().length) {
|
1170
|
+
const currencyFormat = ((_b = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.find(({ name }) => name === 'currencyFormat')) === null || _b === void 0 ? void 0 : _b.value) || '1.2-2';
|
1171
|
+
const dateFormat = ((_d = (_c = template.properties) === null || _c === void 0 ? void 0 : _c.find(({ name }) => name === 'dateFormat')) === null || _d === void 0 ? void 0 : _d.value) || 'D/MMM/YYYY';
|
1172
|
+
const formatDate = (value) => {
|
1173
|
+
return value ? moment(value).format(dateFormat) : value;
|
1174
|
+
};
|
1175
|
+
const transform = new Function(`return ${template.script}`)();
|
1176
|
+
const transformedData = transform(Object.assign(Object.assign({}, data), { utils: {
|
1177
|
+
lodash: _,
|
1178
|
+
currency: (value) => new CurrencyPipe('en-US').transform(value, 'USD', 'symbol', currencyFormat),
|
1179
|
+
date: formatDate,
|
1180
|
+
}, ToDay: formatDate(Date.now()) }));
|
1181
|
+
if (!shouldPreventDownload) {
|
1182
|
+
const blob = new Blob([JSON.stringify(transformedData)]);
|
1183
|
+
this.fileDownloadService.processDownload(blob, 'data.json');
|
1184
|
+
}
|
1185
|
+
return transformedData;
|
1186
|
+
}
|
1187
|
+
return data;
|
1188
|
+
}));
|
1189
|
+
}
|
1190
|
+
resolveAttachments$(template) {
|
1191
|
+
var _a, _b;
|
1192
|
+
const attachmentIds = (_b = (_a = template.attachments) === null || _a === void 0 ? void 0 : _a.map(({ id }) => id).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
|
1193
|
+
if (!attachmentIds.length) {
|
1194
|
+
return of([]);
|
1195
|
+
}
|
1196
|
+
return forkJoin(attachmentIds.map(id => this.documentAttachmentService.getAttachmentFile(id, true)));
|
1197
|
+
}
|
1198
|
+
queryObject({ objectName, resultObjectName, fields, statement }, { properties }) {
|
1199
|
+
var _a;
|
1200
|
+
const patternLimit = /(\s*limit\s\d*)/i;
|
1201
|
+
let limit = 1;
|
1202
|
+
if (statement && patternLimit.test(statement)) {
|
1203
|
+
const limitStr = (_a = statement === null || statement === void 0 ? void 0 : statement.match(patternLimit)) === null || _a === void 0 ? void 0 : _a[1].trim().substring(5).trim();
|
1204
|
+
if (limitStr) {
|
1205
|
+
limit = Number.parseInt(limitStr, 10);
|
1206
|
+
}
|
1207
|
+
statement = statement.replace(patternLimit, '');
|
1208
|
+
}
|
1209
|
+
const resolvedStatement = statement
|
1210
|
+
? StringUtils.fillPlaceholders(statement, properties, /:\s*(\w[\w\d_.]+)/i)
|
1211
|
+
: undefined;
|
1212
|
+
const searchRequest = Object.assign({ skip: 0, count: limit, rawCondition: resolvedStatement }, ((fields === null || fields === void 0 ? void 0 : fields.length) && !!fields[0] && { fields }));
|
1213
|
+
return this.salesforceApiService.query(searchRequest, objectName).pipe(this.mapSfQueryResult(limit), map(value => ({ [resultObjectName]: value })));
|
1214
|
+
}
|
1215
|
+
}
|
1216
|
+
DocumentTemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DocumentTemplatesApiService, deps: [{ token: i1.BaseHttpService }, { token: SalesforceApiService }, { token: i1.FileDownloadService }, { token: DocumentAttachmentApiService }, { token: i4.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
1217
|
+
DocumentTemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DocumentTemplatesApiService });
|
1218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DocumentTemplatesApiService, decorators: [{
|
1219
|
+
type: Injectable
|
1220
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: SalesforceApiService }, { type: i1.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i4.HttpClient }]; } });
|
1221
|
+
|
1222
|
+
class FlowsApiService {
|
1223
|
+
constructor(configurationSettingsApiService) {
|
1224
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
1225
|
+
this.flowsKey = 'flows';
|
1226
|
+
}
|
1227
|
+
getFlow(id) {
|
1228
|
+
return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)));
|
1229
|
+
}
|
1230
|
+
fetchFlows() {
|
1231
|
+
return this.configurationSettingsApiService
|
1232
|
+
.fetchSetting(this.flowsKey)
|
1233
|
+
.pipe(map((flow) => ((flow === null || flow === void 0 ? void 0 : flow.value) ? JSON.parse(flow.value) : [])));
|
1234
|
+
}
|
1235
|
+
}
|
1236
|
+
FlowsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1237
|
+
FlowsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowsApiService });
|
1238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowsApiService, decorators: [{
|
1239
|
+
type: Injectable
|
1240
|
+
}], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
|
1241
|
+
|
1242
|
+
class PicklistsApiService {
|
1243
|
+
constructor(baseHttpService) {
|
1244
|
+
this.baseHttpService = baseHttpService;
|
1245
|
+
this.serviceUrl = '/admin';
|
1246
|
+
this.fetchAllPicklists$ = () => this.baseHttpService.api({ url: `${this.serviceUrl}/picklists` });
|
1247
|
+
this.fetchPicklist$ = (code) => this.baseHttpService.api({ url: `${this.serviceUrl}/picklists/${code}` });
|
1248
|
+
this.createPicklist$ = (picklist) => {
|
1249
|
+
return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/picklists`, body: picklist });
|
1250
|
+
};
|
1251
|
+
this.updatePicklist$ = (picklist) => {
|
1252
|
+
return this.baseHttpService.api({
|
1253
|
+
method: 'put',
|
1254
|
+
url: `${this.serviceUrl}/picklists/${picklist.id}`,
|
1255
|
+
body: picklist,
|
1256
|
+
});
|
1257
|
+
};
|
1258
|
+
this.removePicklist$ = (id) => this.baseHttpService.api({ method: 'delete', url: `${this.serviceUrl}/picklists/${id}` });
|
1259
|
+
this.restorePicklist$ = (id) => {
|
1260
|
+
return this.baseHttpService.api({
|
1261
|
+
url: `${this.serviceUrl}/picklists/${id}/restore`,
|
1262
|
+
method: 'patch',
|
1263
|
+
});
|
1264
|
+
};
|
1265
|
+
this.addPicklistValue$ = (picklist, value) => {
|
1266
|
+
const data = Object.assign(Object.assign({}, picklist), { values: [...picklist.values, value] });
|
1267
|
+
return this.baseHttpService.api({ method: 'put', url: `${this.serviceUrl}/picklists/${picklist.id}`, body: data });
|
1268
|
+
};
|
1269
|
+
}
|
1270
|
+
}
|
1271
|
+
PicklistsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PicklistsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1272
|
+
PicklistsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PicklistsApiService });
|
1273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PicklistsApiService, decorators: [{
|
1274
|
+
type: Injectable
|
1275
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1276
|
+
|
1277
|
+
class PriceApiService {
|
1278
|
+
constructor(httpService) {
|
1279
|
+
this.httpService = httpService;
|
1280
|
+
this.SERVICE_URL = '/price';
|
1281
|
+
}
|
1282
|
+
calculate(request) {
|
1283
|
+
return this.httpService.api({
|
1284
|
+
method: 'post',
|
1285
|
+
url: `${this.SERVICE_URL}/calculate`,
|
1286
|
+
body: request,
|
1287
|
+
skipErrorHandler: true,
|
1288
|
+
});
|
1289
|
+
}
|
1290
|
+
getPriceLists() {
|
1291
|
+
return this.httpService.api({
|
1292
|
+
method: 'get',
|
1293
|
+
url: '/price-lists',
|
1294
|
+
});
|
1295
|
+
}
|
1296
|
+
getPriceList(id) {
|
1297
|
+
return this.httpService.api({
|
1298
|
+
method: 'get',
|
1299
|
+
url: `/price-lists/${id}`,
|
1300
|
+
});
|
1301
|
+
}
|
1302
|
+
getSellingTermByEndDate(planId, offeringId, startDate, endDate, frequencyUnit, frequencyDuration) {
|
1303
|
+
return this.httpService.api({
|
1304
|
+
method: 'post',
|
1305
|
+
url: `${this.SERVICE_URL}/selling-term-by-end-date`,
|
1306
|
+
body: {
|
1307
|
+
planId: planId,
|
1308
|
+
offeringId: offeringId,
|
1309
|
+
startDate: startDate,
|
1310
|
+
endDate: endDate,
|
1311
|
+
frequencyUnit: frequencyUnit,
|
1312
|
+
frequencyDuration: frequencyDuration,
|
1313
|
+
},
|
1314
|
+
});
|
1315
|
+
}
|
1316
|
+
getSellingTermByTerm(planId, offeringId, startDate, term, frequencyUnit, frequencyDuration) {
|
1317
|
+
return this.httpService.api({
|
1318
|
+
method: 'post',
|
1319
|
+
url: `${this.SERVICE_URL}/selling-term-by-term`,
|
1320
|
+
body: {
|
1321
|
+
planId: planId,
|
1322
|
+
offeringId: offeringId,
|
1323
|
+
startDate: startDate,
|
1324
|
+
term: term,
|
1325
|
+
frequencyUnit: frequencyUnit,
|
1326
|
+
frequencyDuration: frequencyDuration,
|
1327
|
+
},
|
1328
|
+
});
|
1329
|
+
}
|
1330
|
+
}
|
1331
|
+
PriceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PriceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1332
|
+
PriceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PriceApiService });
|
1333
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PriceApiService, decorators: [{
|
1334
|
+
type: Injectable
|
1335
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1336
|
+
|
1337
|
+
class ProceduresApiService {
|
1338
|
+
constructor(baseHttpService) {
|
1339
|
+
this.baseHttpService = baseHttpService;
|
1340
|
+
this.ADMIN_SERVICE_URL = '/admin/procedures';
|
1341
|
+
this.SERVICE_URL = '/procedures';
|
1342
|
+
this.fetchProcedures$ = () => {
|
1343
|
+
return this.searchProcedures$(new Expression(), 0, 100);
|
1344
|
+
};
|
1345
|
+
this.searchProcedures$ = (expression, skip, count) => {
|
1346
|
+
let params = new HttpParams();
|
1347
|
+
params = params.set('skip', '' + skip);
|
1348
|
+
params = params.set('count', '' + count);
|
1349
|
+
return this.baseHttpService.api({
|
1350
|
+
method: 'post',
|
1351
|
+
url: `${this.ADMIN_SERVICE_URL}/search`,
|
1352
|
+
params,
|
1353
|
+
body: expression,
|
1354
|
+
});
|
1355
|
+
};
|
1356
|
+
this.createProcedure$ = (newProcedure) => {
|
1357
|
+
return this.baseHttpService.api({
|
1358
|
+
url: `${this.ADMIN_SERVICE_URL}`,
|
1359
|
+
method: 'post',
|
1360
|
+
body: newProcedure,
|
1361
|
+
});
|
1362
|
+
};
|
1363
|
+
this.updateProcedure$ = (procedure) => {
|
1364
|
+
return this.baseHttpService.api({
|
1365
|
+
url: `${this.ADMIN_SERVICE_URL}/${procedure.id}`,
|
1366
|
+
method: 'put',
|
1367
|
+
body: procedure,
|
1368
|
+
});
|
1369
|
+
};
|
1370
|
+
this.duplicateProcedure$ = (body) => {
|
1371
|
+
return this.baseHttpService
|
1372
|
+
.api({
|
1373
|
+
url: `${this.ADMIN_SERVICE_URL}/${body.id}/clone`,
|
1374
|
+
method: 'post',
|
1375
|
+
body,
|
1376
|
+
})
|
1377
|
+
.pipe(map(response => response.clonedRecordId));
|
1378
|
+
};
|
1379
|
+
this.removeProcedure$ = (id) => {
|
1380
|
+
return this.baseHttpService.api({
|
1381
|
+
url: `${this.ADMIN_SERVICE_URL}/${id}`,
|
1382
|
+
method: 'delete',
|
1383
|
+
});
|
1384
|
+
};
|
1385
|
+
this.restoreProcedure$ = (id) => {
|
1386
|
+
return this.baseHttpService.api({
|
1387
|
+
url: `${this.ADMIN_SERVICE_URL}/${id}/restore`,
|
1388
|
+
method: 'patch',
|
1389
|
+
});
|
1390
|
+
};
|
1391
|
+
}
|
1392
|
+
fetchProcedure$(id) {
|
1393
|
+
return this.baseHttpService.api({
|
1394
|
+
url: `${this.ADMIN_SERVICE_URL}/${id}`,
|
1395
|
+
method: 'get',
|
1396
|
+
});
|
1397
|
+
}
|
1398
|
+
execute$(body) {
|
1399
|
+
return this.baseHttpService.api({
|
1400
|
+
url: `${this.SERVICE_URL}/execute`,
|
1401
|
+
method: 'post',
|
1402
|
+
body,
|
1403
|
+
});
|
1404
|
+
}
|
1405
|
+
/**
|
1406
|
+
* Run active procedure against QuoteDraft
|
1407
|
+
* @param body
|
1408
|
+
* @returns
|
1409
|
+
*/
|
1410
|
+
apply$(body) {
|
1411
|
+
return this.baseHttpService.api({
|
1412
|
+
url: `${this.SERVICE_URL}/apply`,
|
1413
|
+
method: 'post',
|
1414
|
+
body,
|
1415
|
+
});
|
1416
|
+
}
|
1417
|
+
}
|
1418
|
+
ProceduresApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProceduresApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1419
|
+
ProceduresApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProceduresApiService });
|
1420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProceduresApiService, decorators: [{
|
1421
|
+
type: Injectable
|
1422
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1423
|
+
|
1424
|
+
class ProductApiService {
|
1425
|
+
constructor(baseHttpService) {
|
1426
|
+
this.baseHttpService = baseHttpService;
|
1427
|
+
this.serviceUrl = '/products';
|
1428
|
+
this.fetchProducts$ = (payload) => {
|
1429
|
+
let params = new HttpParams();
|
1430
|
+
params = params.append('count', payload.count);
|
1431
|
+
params = params.append('skip', payload.skip);
|
1432
|
+
if (payload.name) {
|
1433
|
+
params = params.append('name', payload.name);
|
1434
|
+
}
|
1435
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
|
1436
|
+
};
|
1437
|
+
this.searchProducts$ = (expression, skip, count) => {
|
1438
|
+
let params = new HttpParams();
|
1439
|
+
params = params.set('skip', '' + skip);
|
1440
|
+
params = params.set('count', '' + count);
|
1441
|
+
return this.baseHttpService.api({
|
1442
|
+
method: 'post',
|
1443
|
+
url: `${this.serviceUrl}/search`,
|
1444
|
+
params: params,
|
1445
|
+
body: expression,
|
1446
|
+
});
|
1447
|
+
};
|
1448
|
+
this.fetchProduct$ = (id) => this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
|
1449
|
+
this.fetchAttributes$ = () => {
|
1450
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}/attributes/definition` });
|
1451
|
+
};
|
1452
|
+
this.searchAttributes$ = (expression, skip, count) => {
|
1453
|
+
let params = new HttpParams();
|
1454
|
+
params = params.set('skip', '' + skip);
|
1455
|
+
params = params.set('count', '' + count);
|
1456
|
+
return this.baseHttpService.api({
|
1457
|
+
method: 'post',
|
1458
|
+
url: `${this.serviceUrl}/attributes/definition/search`,
|
1459
|
+
params: params,
|
1460
|
+
body: expression,
|
1461
|
+
});
|
1462
|
+
};
|
1463
|
+
this.fetchAttributesByModel = (modelId) => {
|
1464
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}/attributes/definition/forModel/${modelId}` });
|
1465
|
+
};
|
1466
|
+
this.createNewProduct$ = (productData) => {
|
1467
|
+
return this.baseHttpService.api({
|
1468
|
+
url: `${this.serviceUrl}`,
|
1469
|
+
method: 'post',
|
1470
|
+
body: productData,
|
1471
|
+
});
|
1472
|
+
};
|
1473
|
+
this.updateProduct$ = (body) => {
|
1474
|
+
return this.baseHttpService.api({
|
1475
|
+
url: `${this.serviceUrl}/${body.id}`,
|
1476
|
+
method: 'put',
|
1477
|
+
body,
|
1478
|
+
});
|
1479
|
+
};
|
1480
|
+
this.removeProduct$ = (id) => {
|
1481
|
+
return this.baseHttpService.api({
|
1482
|
+
url: `${this.serviceUrl}/${id}`,
|
1483
|
+
method: 'delete',
|
1484
|
+
});
|
1485
|
+
};
|
1486
|
+
this.restoreProduct$ = (id) => {
|
1487
|
+
return this.baseHttpService.api({
|
1488
|
+
url: `${this.serviceUrl}/${id}/restore`,
|
1489
|
+
method: 'patch',
|
1490
|
+
});
|
1491
|
+
};
|
1492
|
+
this.createProductAttribute$ = (attributeData) => {
|
1493
|
+
return this.baseHttpService.api({
|
1494
|
+
url: `${this.serviceUrl}/attributes`,
|
1495
|
+
method: 'post',
|
1496
|
+
body: attributeData,
|
1497
|
+
});
|
1498
|
+
};
|
1499
|
+
this.updateProductAttribute$ = (attributeData) => {
|
1500
|
+
return this.baseHttpService.api({
|
1501
|
+
url: `${this.serviceUrl}/attributes/${attributeData.id}`,
|
1502
|
+
method: 'put',
|
1503
|
+
body: attributeData,
|
1504
|
+
});
|
1505
|
+
};
|
1506
|
+
this.removeProductAttribute$ = (id) => {
|
1507
|
+
return this.baseHttpService.api({
|
1508
|
+
url: `${this.serviceUrl}/attributes/${id}`,
|
1509
|
+
method: 'delete',
|
1510
|
+
});
|
1511
|
+
};
|
1512
|
+
this.createNewAttribute$ = (attributeData) => {
|
1513
|
+
return this.baseHttpService.api({
|
1514
|
+
url: `${this.serviceUrl}/attributes/definition`,
|
1515
|
+
method: 'post',
|
1516
|
+
body: attributeData,
|
1517
|
+
});
|
1518
|
+
};
|
1519
|
+
this.updateAttribute$ = (body) => {
|
1520
|
+
return this.baseHttpService.api({
|
1521
|
+
url: `${this.serviceUrl}/attributes/definition/${body.id}`,
|
1522
|
+
method: 'put',
|
1523
|
+
body,
|
1524
|
+
});
|
1525
|
+
};
|
1526
|
+
this.removeAttribute$ = (id) => {
|
1527
|
+
return this.baseHttpService.api({
|
1528
|
+
url: `${this.serviceUrl}/attributes/definition/${id}`,
|
1529
|
+
method: 'delete',
|
1530
|
+
});
|
1531
|
+
};
|
1532
|
+
this.restoreAttribute$ = (id) => {
|
1533
|
+
return this.baseHttpService.api({
|
1534
|
+
url: `${this.serviceUrl}/attributes/definition/${id}/restore`,
|
1535
|
+
method: 'patch',
|
1536
|
+
});
|
1537
|
+
};
|
1538
|
+
}
|
1539
|
+
attachImage$(productId, file) {
|
1540
|
+
const data = new FormData();
|
1541
|
+
data.append('image', file);
|
1542
|
+
return this.baseHttpService.upload({
|
1543
|
+
method: 'post',
|
1544
|
+
url: `${this.serviceUrl}/${productId}/image`,
|
1545
|
+
body: data,
|
1546
|
+
});
|
1547
|
+
}
|
1548
|
+
removeImage$(productId) {
|
1549
|
+
return this.baseHttpService.api({
|
1550
|
+
method: 'delete',
|
1551
|
+
url: `${this.serviceUrl}/${productId}/image`,
|
1552
|
+
});
|
1553
|
+
}
|
1554
|
+
fetchImage$(productId) {
|
1555
|
+
return this.baseHttpService.api({
|
1556
|
+
url: this.getImageUrl(productId),
|
1557
|
+
method: 'get',
|
1558
|
+
responseType: 'blob',
|
1559
|
+
errorHandler: noop,
|
1560
|
+
});
|
1561
|
+
}
|
1562
|
+
getImageUrl(productId) {
|
1563
|
+
return `${this.serviceUrl}/${productId}/image`;
|
1564
|
+
}
|
1565
|
+
}
|
1566
|
+
ProductApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1567
|
+
ProductApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductApiService });
|
1568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductApiService, decorators: [{
|
1569
|
+
type: Injectable
|
1570
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1571
|
+
|
1572
|
+
class ProductModelApiService {
|
1573
|
+
constructor(httpService) {
|
1574
|
+
this.httpService = httpService;
|
1575
|
+
this.SERVICE_URL = '/models';
|
1576
|
+
}
|
1577
|
+
addModel(model) {
|
1578
|
+
return this.httpService
|
1579
|
+
.api({
|
1580
|
+
method: 'post',
|
1581
|
+
url: this.SERVICE_URL,
|
1582
|
+
body: model,
|
1583
|
+
errorHandler: this.httpService.handleValidationError,
|
1584
|
+
})
|
1585
|
+
.pipe(map(result => {
|
1586
|
+
if (result.successful) {
|
1587
|
+
return result;
|
1588
|
+
}
|
1589
|
+
else {
|
1590
|
+
throw new Error(result.message);
|
1591
|
+
}
|
1592
|
+
}));
|
1593
|
+
}
|
1594
|
+
releaseModel(model) {
|
1595
|
+
return this.httpService
|
1596
|
+
.api({
|
1597
|
+
method: 'put',
|
1598
|
+
url: `${this.SERVICE_URL}/${model.id}/release`,
|
1599
|
+
body: model,
|
1600
|
+
errorHandler: this.httpService.handleValidationError,
|
1601
|
+
})
|
1602
|
+
.pipe(map(result => {
|
1603
|
+
if (result.successful) {
|
1604
|
+
return '';
|
1605
|
+
}
|
1606
|
+
else {
|
1607
|
+
throw new Error(result.message);
|
1608
|
+
}
|
1609
|
+
}));
|
1610
|
+
}
|
1611
|
+
removeModel(modelId, successFn, failureFn) {
|
1612
|
+
const observable = this.httpService
|
1613
|
+
.api({
|
1614
|
+
method: 'delete',
|
1615
|
+
url: `${this.SERVICE_URL}/${modelId}`,
|
1616
|
+
errorHandler: this.httpService.handleValidationError,
|
1617
|
+
})
|
1618
|
+
.pipe(map(result => {
|
1619
|
+
if (result.successful) {
|
1620
|
+
return '';
|
1621
|
+
}
|
1622
|
+
else {
|
1623
|
+
throw new Error(result.message);
|
1624
|
+
}
|
1625
|
+
}));
|
1626
|
+
observable.subscribe(() => {
|
1627
|
+
successFn && successFn.apply();
|
1628
|
+
}, () => {
|
1629
|
+
failureFn && failureFn.apply();
|
1630
|
+
});
|
1631
|
+
}
|
1632
|
+
getModelVersions(modelId, count = 100, skip = 0) {
|
1633
|
+
return this.httpService.api({
|
1634
|
+
method: 'post',
|
1635
|
+
url: `${this.SERVICE_URL}/${modelId}/versions`,
|
1636
|
+
body: {
|
1637
|
+
skipCount: skip,
|
1638
|
+
count: count,
|
1639
|
+
},
|
1640
|
+
});
|
1641
|
+
}
|
1642
|
+
getModel(id, version) {
|
1643
|
+
let url = `${this.SERVICE_URL}/${id}`;
|
1644
|
+
if (version) {
|
1645
|
+
url += `/versions/${version}`;
|
1646
|
+
}
|
1647
|
+
return this.httpService.api({ url });
|
1648
|
+
}
|
1649
|
+
getModels(skipCount, searchText) {
|
1650
|
+
return this.httpService.api({
|
1651
|
+
method: 'post',
|
1652
|
+
url: `${this.SERVICE_URL}/search`,
|
1653
|
+
body: {
|
1654
|
+
nameRegex: searchText,
|
1655
|
+
skipCount: skipCount.toString(),
|
1656
|
+
count: ProductModelApiService.MAX_RESULTS,
|
1657
|
+
},
|
1658
|
+
});
|
1659
|
+
}
|
1660
|
+
getLinkedModels(id, version) {
|
1661
|
+
let url = `${this.SERVICE_URL}/${id}`;
|
1662
|
+
if (version) {
|
1663
|
+
url += `/versions/${version}`;
|
1664
|
+
}
|
1665
|
+
url += '/linked';
|
1666
|
+
return this.httpService.api({ url }).pipe(map((linkedModels) => {
|
1667
|
+
if (linkedModels) {
|
1668
|
+
linkedModels.forEach(model => ModelTranslatorUtils.toLocalModel(model));
|
1669
|
+
}
|
1670
|
+
return linkedModels;
|
1671
|
+
}));
|
1672
|
+
}
|
1673
|
+
load(id, version) {
|
1674
|
+
return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
|
1675
|
+
const container = new ProductModelsContainer(model, linkedModels !== null && linkedModels !== void 0 ? linkedModels : []);
|
1676
|
+
ModelUtils.override(container.main, container.linked);
|
1677
|
+
ModelTranslatorUtils.toLocalModel(container.main, container.linked);
|
1678
|
+
return container;
|
1679
|
+
}));
|
1680
|
+
}
|
1681
|
+
getPML(modelId, version) {
|
1682
|
+
let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
|
1683
|
+
if (version) {
|
1684
|
+
url += `/versions/${version}`;
|
1685
|
+
}
|
1686
|
+
return this.httpService.api({
|
1687
|
+
url,
|
1688
|
+
responseType: 'text',
|
1689
|
+
});
|
1690
|
+
}
|
1691
|
+
savePML(modelId, pml, comment) {
|
1692
|
+
return this.httpService
|
1693
|
+
.api({
|
1694
|
+
method: 'put',
|
1695
|
+
url: `${this.SERVICE_URL}/${modelId}/pml`,
|
1696
|
+
body: {
|
1697
|
+
id: modelId,
|
1698
|
+
pml: pml,
|
1699
|
+
comment: comment,
|
1700
|
+
},
|
1701
|
+
})
|
1702
|
+
.pipe(map(result => {
|
1703
|
+
if (result.successful) {
|
1704
|
+
return '';
|
1705
|
+
}
|
1706
|
+
else {
|
1707
|
+
throw new Error(result.message);
|
1708
|
+
}
|
1709
|
+
}), catchError(this.httpService.handleValidationError));
|
1710
|
+
}
|
1711
|
+
generateProducts(modelId) {
|
1712
|
+
return this.httpService.api({
|
1713
|
+
url: `${this.SERVICE_URL}/${modelId}/generate-products`,
|
1714
|
+
});
|
1715
|
+
}
|
1716
|
+
saveModel(productModel, comment) {
|
1717
|
+
const model = EntityUtil.clone(productModel);
|
1718
|
+
model.comment = comment;
|
1719
|
+
ModelTranslatorUtils.toServerModel(model);
|
1720
|
+
return this.httpService
|
1721
|
+
.api({
|
1722
|
+
method: 'put',
|
1723
|
+
url: `${this.SERVICE_URL}/${model.id}`,
|
1724
|
+
body: model,
|
1725
|
+
})
|
1726
|
+
.pipe(map(result => {
|
1727
|
+
if (result.successful) {
|
1728
|
+
return '';
|
1729
|
+
}
|
1730
|
+
else {
|
1731
|
+
throw new Error(result.message);
|
1732
|
+
}
|
1733
|
+
}), catchError(this.httpService.handleValidationError));
|
1734
|
+
}
|
1735
|
+
validateModel(productModel) {
|
1736
|
+
return this.httpService
|
1737
|
+
.api({
|
1738
|
+
method: 'post',
|
1739
|
+
url: `${this.SERVICE_URL}/validate`,
|
1740
|
+
body: productModel,
|
1741
|
+
errorHandler: this.httpService.handleValidationError,
|
1742
|
+
})
|
1743
|
+
.pipe(map(result => {
|
1744
|
+
if (result.successful) {
|
1745
|
+
return '';
|
1746
|
+
}
|
1747
|
+
else {
|
1748
|
+
throw new Error(result.message);
|
1749
|
+
}
|
1750
|
+
}));
|
1751
|
+
}
|
1752
|
+
renameModel(productModel, name) {
|
1753
|
+
const model = EntityUtil.clone(productModel);
|
1754
|
+
model.name = name;
|
1755
|
+
ModelTranslatorUtils.toServerModel(model);
|
1756
|
+
return this.httpService
|
1757
|
+
.api({
|
1758
|
+
method: 'patch',
|
1759
|
+
url: `${this.SERVICE_URL}/${model.id}`,
|
1760
|
+
body: model,
|
1761
|
+
})
|
1762
|
+
.pipe(catchError(this.httpService.handleValidationError));
|
1763
|
+
}
|
1764
|
+
uploadPmlFile(file, modelId) {
|
1765
|
+
const formData = new FormData();
|
1766
|
+
formData.append('file', file, file.name);
|
1767
|
+
return this.httpService.upload({
|
1768
|
+
url: `${this.SERVICE_URL}/${modelId}/pml/upload`,
|
1769
|
+
body: formData,
|
1770
|
+
});
|
1771
|
+
}
|
1772
|
+
runPml(modelId, pml, rootType, configurationMode) {
|
1773
|
+
return this.httpService.api({
|
1774
|
+
method: 'post',
|
1775
|
+
url: `${this.SERVICE_URL}/${modelId}/pml/run`,
|
1776
|
+
body: {
|
1777
|
+
pml,
|
1778
|
+
rootType,
|
1779
|
+
configurationMode,
|
1780
|
+
},
|
1781
|
+
responseType: 'text',
|
1782
|
+
});
|
1783
|
+
}
|
1784
|
+
evictAllCache() {
|
1785
|
+
return this.httpService.api({
|
1786
|
+
method: 'get',
|
1787
|
+
url: '/cache/evict/environment-variables',
|
1788
|
+
});
|
1789
|
+
}
|
1790
|
+
}
|
1791
|
+
ProductModelApiService.MAX_RESULTS = 200;
|
1792
|
+
ProductModelApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductModelApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1793
|
+
ProductModelApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductModelApiService });
|
1794
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductModelApiService, decorators: [{
|
1795
|
+
type: Injectable
|
1796
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1797
|
+
|
1798
|
+
class QuoteApiService {
|
1799
|
+
constructor(httpService) {
|
1800
|
+
this.httpService = httpService;
|
1801
|
+
this.SERVICE_URL = '/quotes';
|
1802
|
+
/**
|
1803
|
+
* @deprecated
|
1804
|
+
* Will be removed in next major release
|
1805
|
+
* Use `getQuoteDraft` instead
|
1806
|
+
*/
|
1807
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
1808
|
+
this.getQuote = this.getQuoteDraft;
|
1809
|
+
}
|
1810
|
+
// request quoteId | accountId | opportunityId | orderId
|
1811
|
+
getQuoteDraft(objectId, params, errorHandler) {
|
1812
|
+
return this.httpService.api({
|
1813
|
+
method: 'get',
|
1814
|
+
url: `${this.SERVICE_URL}/${objectId}`,
|
1815
|
+
params,
|
1816
|
+
errorHandler,
|
1817
|
+
});
|
1818
|
+
}
|
1819
|
+
upsertQuote(request, options) {
|
1820
|
+
return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}`, body: request }, options));
|
1821
|
+
}
|
1822
|
+
submitQuote(request, options) {
|
1823
|
+
return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/submit`, body: request }, options));
|
1824
|
+
}
|
1825
|
+
attachDocument(id, documentName, data) {
|
1826
|
+
const formData = new FormData();
|
1827
|
+
const blob = new Blob([data]);
|
1828
|
+
formData.append('file', blob, documentName);
|
1829
|
+
return this.httpService.upload({
|
1830
|
+
url: `${this.SERVICE_URL}/${id}/attach-document`,
|
1831
|
+
responseType: 'arraybuffer',
|
1832
|
+
method: 'post',
|
1833
|
+
body: formData,
|
1834
|
+
});
|
1835
|
+
}
|
1836
|
+
}
|
1837
|
+
QuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1838
|
+
QuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteApiService });
|
1839
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteApiService, decorators: [{
|
1840
|
+
type: Injectable
|
1841
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1842
|
+
|
1843
|
+
class RampApiService {
|
1844
|
+
constructor(httpService) {
|
1845
|
+
this.httpService = httpService;
|
1846
|
+
this.SERVICE_URL = '/ramp';
|
1847
|
+
}
|
1848
|
+
next(request, options) {
|
1849
|
+
return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/next`, body: request }, options));
|
1850
|
+
}
|
1851
|
+
renew(request, options) {
|
1852
|
+
return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/renew`, body: request }, options));
|
1853
|
+
}
|
1854
|
+
}
|
1855
|
+
RampApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RampApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1856
|
+
RampApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RampApiService });
|
1857
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RampApiService, decorators: [{
|
1858
|
+
type: Injectable
|
1859
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1860
|
+
|
1861
|
+
class RuleGroupsApiService {
|
1862
|
+
constructor(baseHttpService) {
|
1863
|
+
this.baseHttpService = baseHttpService;
|
1864
|
+
this.serviceUrl = '/admin/rule-groups';
|
1865
|
+
this.fetchRuleGroups$ = () => {
|
1866
|
+
return this.searchRuleGroups$(new Expression(), 0, 100);
|
1867
|
+
};
|
1868
|
+
this.searchRuleGroups$ = (expression, skip, count) => {
|
1869
|
+
let params = new HttpParams();
|
1870
|
+
params = params.set('skip', '' + skip);
|
1871
|
+
params = params.set('count', '' + count);
|
1872
|
+
return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
|
1873
|
+
};
|
1874
|
+
this.createRuleGroup$ = (ruleGroup) => {
|
1875
|
+
return this.baseHttpService.api({
|
1876
|
+
url: `${this.serviceUrl}`,
|
1877
|
+
method: 'post',
|
1878
|
+
body: ruleGroup,
|
1879
|
+
});
|
1880
|
+
};
|
1881
|
+
this.updateRuleGroup$ = (ruleGroup) => {
|
1882
|
+
return this.baseHttpService.api({
|
1883
|
+
url: `${this.serviceUrl}/${ruleGroup.id}`,
|
1884
|
+
method: 'post',
|
1885
|
+
body: ruleGroup,
|
1886
|
+
});
|
1887
|
+
};
|
1888
|
+
this.duplicateRuleGroup$ = (body) => {
|
1889
|
+
return this.baseHttpService
|
1890
|
+
.api({
|
1891
|
+
url: `${this.serviceUrl}/${body.id}/clone`,
|
1892
|
+
method: 'post',
|
1893
|
+
body,
|
1894
|
+
})
|
1895
|
+
.pipe(map$1(response => response.clonedRecordId));
|
1896
|
+
};
|
1897
|
+
this.removeRuleGroup$ = (id) => {
|
1898
|
+
return this.baseHttpService.api({
|
1899
|
+
url: `${this.serviceUrl}/${id}`,
|
1900
|
+
method: 'delete',
|
1901
|
+
});
|
1902
|
+
};
|
1903
|
+
this.restoreRuleGroup$ = (id) => {
|
1904
|
+
return this.baseHttpService.api({
|
1905
|
+
url: `${this.serviceUrl}/${id}/restore`,
|
1906
|
+
method: 'patch',
|
1907
|
+
});
|
1908
|
+
};
|
1909
|
+
}
|
1910
|
+
}
|
1911
|
+
RuleGroupsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuleGroupsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1912
|
+
RuleGroupsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuleGroupsApiService });
|
1913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuleGroupsApiService, decorators: [{
|
1914
|
+
type: Injectable
|
1915
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1916
|
+
|
1917
|
+
class RulesApiService {
|
1918
|
+
constructor(baseHttpService) {
|
1919
|
+
this.baseHttpService = baseHttpService;
|
1920
|
+
this.serviceUrl = '/admin/rules';
|
1921
|
+
this.fetchRules$ = () => {
|
1922
|
+
return this.searchRules$(new Expression(), 0, 100);
|
1923
|
+
};
|
1924
|
+
this.searchRules$ = (expression, skip, count) => {
|
1925
|
+
let params = new HttpParams();
|
1926
|
+
params = params.set('skip', '' + skip);
|
1927
|
+
params = params.set('count', '' + count);
|
1928
|
+
return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
|
1929
|
+
};
|
1930
|
+
this.createRule$ = (rule) => {
|
1931
|
+
return this.baseHttpService.api({
|
1932
|
+
url: `${this.serviceUrl}`,
|
1933
|
+
method: 'post',
|
1934
|
+
body: rule,
|
1935
|
+
});
|
1936
|
+
};
|
1937
|
+
this.updateRule$ = (rule) => {
|
1938
|
+
return this.baseHttpService.api({
|
1939
|
+
url: `${this.serviceUrl}/${rule.id}`,
|
1940
|
+
method: 'put',
|
1941
|
+
body: rule,
|
1942
|
+
});
|
1943
|
+
};
|
1944
|
+
this.duplicateRule$ = (body) => {
|
1945
|
+
return this.baseHttpService
|
1946
|
+
.api({
|
1947
|
+
url: `${this.serviceUrl}/${body.id}/clone`,
|
1948
|
+
method: 'post',
|
1949
|
+
body,
|
1950
|
+
})
|
1951
|
+
.pipe(map(response => response.clonedRecordId));
|
1952
|
+
};
|
1953
|
+
this.removeRule$ = (id) => {
|
1954
|
+
return this.baseHttpService.api({
|
1955
|
+
url: `${this.serviceUrl}/${id}`,
|
1956
|
+
method: 'delete',
|
1957
|
+
});
|
1958
|
+
};
|
1959
|
+
this.restoreRule$ = (id) => {
|
1960
|
+
return this.baseHttpService.api({
|
1961
|
+
url: `${this.serviceUrl}/${id}/restore`,
|
1962
|
+
method: 'patch',
|
1963
|
+
});
|
1964
|
+
};
|
1965
|
+
}
|
1966
|
+
fetchRule$(id) {
|
1967
|
+
return this.baseHttpService.api({
|
1968
|
+
url: `${this.serviceUrl}/${id}`,
|
1969
|
+
method: 'get',
|
1970
|
+
});
|
1971
|
+
}
|
1972
|
+
fetchHeaderFields$() {
|
1973
|
+
return this.baseHttpService.api({
|
1974
|
+
url: `${this.serviceUrl}/describe/Header`,
|
1975
|
+
method: 'get',
|
1976
|
+
});
|
1977
|
+
}
|
1978
|
+
execute$(body) {
|
1979
|
+
return this.baseHttpService.api({
|
1980
|
+
url: `/rules/execute`,
|
1981
|
+
method: 'post',
|
1982
|
+
body,
|
1983
|
+
});
|
1984
|
+
}
|
1985
|
+
}
|
1986
|
+
RulesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RulesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1987
|
+
RulesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RulesApiService });
|
1988
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RulesApiService, decorators: [{
|
1989
|
+
type: Injectable
|
1990
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
1991
|
+
|
1992
|
+
class ScriptsApiService {
|
1993
|
+
constructor(baseHttpService) {
|
1994
|
+
this.baseHttpService = baseHttpService;
|
1995
|
+
this.serviceUrl = '/admin/scripts';
|
1996
|
+
this.fetchScripts$ = () => {
|
1997
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}` });
|
1998
|
+
};
|
1999
|
+
this.searchScripts$ = (expression, skip, count) => {
|
2000
|
+
let params = new HttpParams();
|
2001
|
+
params = params.set('skip', '' + skip);
|
2002
|
+
params = params.set('count', '' + count);
|
2003
|
+
return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
|
2004
|
+
};
|
2005
|
+
this.fetchScript$ = (id) => {
|
2006
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
|
2007
|
+
};
|
2008
|
+
this.createScript$ = (script) => {
|
2009
|
+
return this.baseHttpService.api({
|
2010
|
+
url: `${this.serviceUrl}`,
|
2011
|
+
method: 'post',
|
2012
|
+
body: script,
|
2013
|
+
});
|
2014
|
+
};
|
2015
|
+
this.updateScriptMeta$ = (script) => {
|
2016
|
+
return this.baseHttpService.api({
|
2017
|
+
url: `${this.serviceUrl}/${script.id}`,
|
2018
|
+
method: 'put',
|
2019
|
+
body: script,
|
2020
|
+
});
|
2021
|
+
};
|
2022
|
+
this.updateScriptDetails$ = (script) => {
|
2023
|
+
return this.baseHttpService.api({
|
2024
|
+
url: `${this.serviceUrl}/${script.id}`,
|
2025
|
+
method: 'put',
|
2026
|
+
body: script,
|
2027
|
+
});
|
2028
|
+
};
|
2029
|
+
this.cloneScript$ = (cloneRequest) => {
|
2030
|
+
return this.baseHttpService.api({
|
2031
|
+
url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
|
2032
|
+
method: 'post',
|
2033
|
+
body: cloneRequest,
|
2034
|
+
});
|
2035
|
+
};
|
2036
|
+
this.removeScript$ = (id) => {
|
2037
|
+
return this.baseHttpService.api({
|
2038
|
+
url: `${this.serviceUrl}/${id}`,
|
2039
|
+
method: 'delete',
|
2040
|
+
});
|
2041
|
+
};
|
2042
|
+
this.restoreScript$ = (id) => {
|
2043
|
+
return this.baseHttpService.api({
|
2044
|
+
url: `${this.serviceUrl}/${id}/restore`,
|
2045
|
+
method: 'patch',
|
2046
|
+
});
|
2047
|
+
};
|
2048
|
+
this.execute$ = (body) => {
|
2049
|
+
return this.baseHttpService.api({
|
2050
|
+
url: `/scripts/execute`,
|
2051
|
+
method: 'post',
|
2052
|
+
body,
|
2053
|
+
errorHandler: () => null,
|
2054
|
+
});
|
2055
|
+
};
|
2056
|
+
}
|
2057
|
+
}
|
2058
|
+
ScriptsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ScriptsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2059
|
+
ScriptsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ScriptsApiService });
|
2060
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ScriptsApiService, decorators: [{
|
2061
|
+
type: Injectable
|
2062
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2063
|
+
|
2064
|
+
const fromUIComponentStoryDTO = (dto, attachments) => {
|
2065
|
+
return {
|
2066
|
+
id: dto.id,
|
2067
|
+
name: dto.name,
|
2068
|
+
uiComponentId: dto.uiComponentId,
|
2069
|
+
description: dto.description,
|
2070
|
+
section: attachments.json,
|
2071
|
+
template: attachments.html,
|
2072
|
+
script: attachments.js,
|
2073
|
+
styles: attachments.css,
|
2074
|
+
};
|
2075
|
+
};
|
2076
|
+
|
2077
|
+
class UITemplatesApiService {
|
2078
|
+
constructor(baseHttpService) {
|
2079
|
+
this.baseHttpService = baseHttpService;
|
2080
|
+
this.serviceUrl = '/uitemplates';
|
2081
|
+
this.fetchTemplates$ = (name) => {
|
2082
|
+
let params = new HttpParams();
|
2083
|
+
if (name) {
|
2084
|
+
params = params.append('name', name);
|
2085
|
+
}
|
2086
|
+
return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
|
2087
|
+
};
|
2088
|
+
this.createTemplate$ = (template) => {
|
2089
|
+
return this.baseHttpService.api({
|
2090
|
+
method: 'post',
|
2091
|
+
url: `${this.serviceUrl}`,
|
2092
|
+
body: template,
|
2093
|
+
});
|
2094
|
+
};
|
2095
|
+
this.updateTemplate$ = (template) => {
|
2096
|
+
return this.baseHttpService.api({
|
2097
|
+
method: 'put',
|
2098
|
+
url: `${this.serviceUrl}/${template.id}`,
|
2099
|
+
body: template,
|
2100
|
+
});
|
2101
|
+
};
|
2102
|
+
this.duplicateTemplate$ = (template, cloneRequest) => {
|
2103
|
+
return this.baseHttpService
|
2104
|
+
.api({
|
2105
|
+
url: `${this.serviceUrl}/${template.id}/clone`,
|
2106
|
+
method: 'post',
|
2107
|
+
body: cloneRequest,
|
2108
|
+
})
|
2109
|
+
.pipe(map$1(response => response.clonedRecordId));
|
2110
|
+
};
|
2111
|
+
this.removeTemplate$ = (id) => {
|
2112
|
+
return this.baseHttpService.api({
|
2113
|
+
method: 'delete',
|
2114
|
+
url: `${this.serviceUrl}/${id}`,
|
2115
|
+
});
|
2116
|
+
};
|
2117
|
+
this.restoreTemplate$ = (id) => {
|
2118
|
+
return this.baseHttpService.api({
|
2119
|
+
method: 'patch',
|
2120
|
+
url: `${this.serviceUrl}/${id}`,
|
2121
|
+
});
|
2122
|
+
};
|
2123
|
+
this.searchTemplates$ = (data) => {
|
2124
|
+
return this.baseHttpService.api({
|
2125
|
+
method: 'post',
|
2126
|
+
url: `${this.serviceUrl}/search`,
|
2127
|
+
params: data.params,
|
2128
|
+
body: data.expression,
|
2129
|
+
});
|
2130
|
+
};
|
2131
|
+
this.fetchComponents$ = (templateId, name) => {
|
2132
|
+
let params = new HttpParams();
|
2133
|
+
if (name) {
|
2134
|
+
params = params.append('name', name);
|
2135
|
+
}
|
2136
|
+
return this.baseHttpService.api({
|
2137
|
+
url: `${this.serviceUrl}/${templateId}/components`,
|
2138
|
+
params,
|
2139
|
+
});
|
2140
|
+
};
|
2141
|
+
this.fetchComponent$ = (templateId, componentId) => {
|
2142
|
+
return this.baseHttpService.api({
|
2143
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
|
2144
|
+
});
|
2145
|
+
};
|
2146
|
+
this.createComponent$ = (component) => {
|
2147
|
+
return this.baseHttpService.api({
|
2148
|
+
method: 'post',
|
2149
|
+
url: `${this.serviceUrl}/${component.uiTemplateId}/components`,
|
2150
|
+
body: component,
|
2151
|
+
});
|
2152
|
+
};
|
2153
|
+
this.updateComponent$ = (component) => {
|
2154
|
+
return this.baseHttpService.api({
|
2155
|
+
method: 'put',
|
2156
|
+
url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}`,
|
2157
|
+
body: component,
|
2158
|
+
});
|
2159
|
+
};
|
2160
|
+
this.duplicateComponent$ = (component, cloneRequest) => {
|
2161
|
+
return this.baseHttpService
|
2162
|
+
.api({
|
2163
|
+
url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}/clone`,
|
2164
|
+
method: 'post',
|
2165
|
+
body: cloneRequest,
|
2166
|
+
})
|
2167
|
+
.pipe(map$1(response => response.clonedRecordId));
|
2168
|
+
};
|
2169
|
+
this.removeComponent$ = (templateId, componentId) => {
|
2170
|
+
return this.baseHttpService.api({
|
2171
|
+
method: 'delete',
|
2172
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
|
2173
|
+
});
|
2174
|
+
};
|
2175
|
+
this.restoreComponent$ = (templateId, componentId) => {
|
2176
|
+
return this.baseHttpService.api({
|
2177
|
+
method: 'patch',
|
2178
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
|
2179
|
+
});
|
2180
|
+
};
|
2181
|
+
this.searchComponents$ = (templateId, data) => {
|
2182
|
+
return this.baseHttpService.api({
|
2183
|
+
method: 'post',
|
2184
|
+
url: `${this.serviceUrl}/${templateId}/components/search`,
|
2185
|
+
params: data.params,
|
2186
|
+
body: data.expression,
|
2187
|
+
});
|
2188
|
+
};
|
2189
|
+
this.fetchStoryAttachment = (templateId, componentId, storyId, type) => {
|
2190
|
+
return this.baseHttpService
|
2191
|
+
.api({
|
2192
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments/${type}/file`,
|
2193
|
+
responseType: 'text',
|
2194
|
+
errorHandler: noop,
|
2195
|
+
})
|
2196
|
+
.pipe(catchError$1(() => of('')));
|
2197
|
+
};
|
2198
|
+
this.convertToComponentStory$ = (templateId, componentId, storyDto) => {
|
2199
|
+
return forkJoin([
|
2200
|
+
this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'html'),
|
2201
|
+
this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'js'),
|
2202
|
+
this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'css'),
|
2203
|
+
this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'json'),
|
2204
|
+
]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })), map$1(attachments => fromUIComponentStoryDTO(storyDto, attachments)));
|
2205
|
+
};
|
2206
|
+
this.fetchStories$ = (templateId, componentId, name) => {
|
2207
|
+
let params = new HttpParams();
|
2208
|
+
if (name) {
|
2209
|
+
params = params.append('name', name);
|
2210
|
+
}
|
2211
|
+
return this.baseHttpService
|
2212
|
+
.api({
|
2213
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
|
2214
|
+
params,
|
2215
|
+
})
|
2216
|
+
.pipe(switchMap$1(dtos => {
|
2217
|
+
if (!dtos.length) {
|
2218
|
+
return of([]);
|
2219
|
+
}
|
2220
|
+
return forkJoin(dtos.map(dto => this.convertToComponentStory$(templateId, componentId, dto)));
|
2221
|
+
}));
|
2222
|
+
};
|
2223
|
+
this.fetchStory$ = (templateId, componentId, storyId) => {
|
2224
|
+
return this.baseHttpService
|
2225
|
+
.api({
|
2226
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
|
2227
|
+
})
|
2228
|
+
.pipe(switchMap$1(dto => this.convertToComponentStory$(templateId, componentId, dto)));
|
2229
|
+
};
|
2230
|
+
this.createComponentStory$ = (templateId, story) => {
|
2231
|
+
return this.baseHttpService.api({
|
2232
|
+
method: 'post',
|
2233
|
+
url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories`,
|
2234
|
+
body: story,
|
2235
|
+
});
|
2236
|
+
};
|
2237
|
+
this.updateComponentStory$ = (templateId, story) => {
|
2238
|
+
const { script, template, styles, section } = story, rest = __rest(story, ["script", "template", "styles", "section"]);
|
2239
|
+
return this.baseHttpService
|
2240
|
+
.api({
|
2241
|
+
method: 'put',
|
2242
|
+
url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories/${story.id}`,
|
2243
|
+
body: rest,
|
2244
|
+
})
|
2245
|
+
.pipe(map$1(dto => fromUIComponentStoryDTO(dto, { html: template, js: script, css: styles, json: section })));
|
2246
|
+
};
|
2247
|
+
this.duplicateComponentStory$ = (story, cloneRequest) => {
|
2248
|
+
return this.baseHttpService
|
2249
|
+
.api({
|
2250
|
+
url: `${this.serviceUrl}/${story.template}/components/${story.uiComponentId}/stories/${story.id}/clone`,
|
2251
|
+
method: 'post',
|
2252
|
+
body: cloneRequest,
|
2253
|
+
})
|
2254
|
+
.pipe(map$1(response => response.clonedRecordId));
|
2255
|
+
};
|
2256
|
+
this.deleteComponentStory$ = (templateId, componentId, storyId) => {
|
2257
|
+
return this.baseHttpService.api({
|
2258
|
+
method: 'delete',
|
2259
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
|
2260
|
+
});
|
2261
|
+
};
|
2262
|
+
this.restoreComponentStory$ = (templateId, componentId, storyId) => {
|
2263
|
+
return this.baseHttpService.api({
|
2264
|
+
method: 'patch',
|
2265
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
|
2266
|
+
});
|
2267
|
+
};
|
2268
|
+
this.uploadStoryAttachments$ = (templateId, componentId, storyId, attachments) => {
|
2269
|
+
const formData = new FormData();
|
2270
|
+
if (attachments.html != null) {
|
2271
|
+
formData.append('html', new Blob([attachments.html]), 'story-template.html');
|
2272
|
+
}
|
2273
|
+
if (attachments.css != null) {
|
2274
|
+
formData.append('css', new Blob([attachments.css]), 'story-styles.css');
|
2275
|
+
}
|
2276
|
+
if (attachments.js != null) {
|
2277
|
+
formData.append('js', new Blob([attachments.js]), 'story-script.js');
|
2278
|
+
}
|
2279
|
+
if (attachments.json != null) {
|
2280
|
+
formData.append('json', new Blob([attachments.json]), 'story-section.json');
|
2281
|
+
}
|
2282
|
+
return this.baseHttpService.upload({
|
2283
|
+
method: 'post',
|
2284
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments`,
|
2285
|
+
body: formData,
|
2286
|
+
});
|
2287
|
+
};
|
2288
|
+
this.fetchComponentAttachments$ = (templateId, component) => {
|
2289
|
+
return forkJoin([
|
2290
|
+
this.fetchComponentAttachmentFile$(templateId, component.id, 'html'),
|
2291
|
+
this.fetchComponentAttachmentFile$(templateId, component.id, 'js'),
|
2292
|
+
this.fetchComponentAttachmentFile$(templateId, component.id, 'css'),
|
2293
|
+
this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
|
2294
|
+
]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
|
2295
|
+
};
|
2296
|
+
this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
|
2297
|
+
return this.baseHttpService
|
2298
|
+
.api({
|
2299
|
+
method: 'get',
|
2300
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments/${attachmentType}/file`,
|
2301
|
+
responseType: 'text',
|
2302
|
+
errorHandler: noop,
|
2303
|
+
})
|
2304
|
+
.pipe(catchError$1(() => of('')));
|
2305
|
+
};
|
2306
|
+
this.uploadComponentAttachments$ = (templateId, componentId, attachments) => {
|
2307
|
+
const formData = new FormData();
|
2308
|
+
if (attachments.html != null) {
|
2309
|
+
formData.append('html', new Blob([attachments.html]), 'template.html');
|
2310
|
+
}
|
2311
|
+
if (attachments.css != null) {
|
2312
|
+
formData.append('css', new Blob([attachments.css]), 'styles.css');
|
2313
|
+
}
|
2314
|
+
if (attachments.js != null) {
|
2315
|
+
formData.append('js', new Blob([attachments.js]), 'script.js');
|
2316
|
+
}
|
2317
|
+
if (attachments.json != null) {
|
2318
|
+
formData.append('json', new Blob([attachments.json]), 'section.json');
|
2319
|
+
}
|
2320
|
+
return this.baseHttpService.upload({
|
2321
|
+
method: 'post',
|
2322
|
+
url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments`,
|
2323
|
+
body: formData,
|
2324
|
+
});
|
2325
|
+
};
|
2326
|
+
}
|
2327
|
+
getTemplateThumbnailUrl(templateId) {
|
2328
|
+
return `${this.serviceUrl}/${templateId}/thumbnail/file`;
|
2329
|
+
}
|
2330
|
+
attachTemplateThumbnail$(templateId, file) {
|
2331
|
+
const data = new FormData();
|
2332
|
+
data.append('thumb', file);
|
2333
|
+
return this.baseHttpService.upload({
|
2334
|
+
method: 'post',
|
2335
|
+
url: `${this.serviceUrl}/${templateId}/thumbnail`,
|
2336
|
+
body: data,
|
2337
|
+
});
|
2338
|
+
}
|
2339
|
+
removeTemplateThumbnail$(templateId) {
|
2340
|
+
return this.baseHttpService.api({
|
2341
|
+
method: 'delete',
|
2342
|
+
url: `${this.serviceUrl}/${templateId}/thumbnail`,
|
2343
|
+
});
|
2344
|
+
}
|
2345
|
+
}
|
2346
|
+
UITemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UITemplatesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2347
|
+
UITemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UITemplatesApiService });
|
2348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UITemplatesApiService, decorators: [{
|
2349
|
+
type: Injectable
|
2350
|
+
}], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
|
2351
|
+
|
2352
|
+
class ApiModule {
|
2353
|
+
}
|
2354
|
+
ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2355
|
+
ApiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ApiModule, imports: [HttpClientModule] });
|
2356
|
+
ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ApiModule, providers: [
|
2357
|
+
BaseHttpService,
|
2358
|
+
XrayService,
|
2359
|
+
ConfigurationApiService,
|
2360
|
+
ConfigurationSettingsApiService,
|
2361
|
+
ContextApiService,
|
2362
|
+
DocumentAttachmentApiService,
|
2363
|
+
PriceApiService,
|
2364
|
+
ProductModelApiService,
|
2365
|
+
ProceduresApiService,
|
2366
|
+
QuoteApiService,
|
2367
|
+
DocumentTemplatesApiService,
|
2368
|
+
RampApiService,
|
2369
|
+
SalesforceApiService,
|
2370
|
+
UITemplatesApiService,
|
2371
|
+
ScriptsApiService,
|
2372
|
+
RulesApiService,
|
2373
|
+
RuleGroupsApiService,
|
2374
|
+
FlowsApiService,
|
2375
|
+
ProductApiService,
|
2376
|
+
CatalogAdminApiService,
|
2377
|
+
CatalogApiService,
|
2378
|
+
DeltaApiService,
|
2379
|
+
AccountApiService,
|
2380
|
+
PicklistsApiService,
|
2381
|
+
], imports: [[HttpClientModule]] });
|
2382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ApiModule, decorators: [{
|
2383
|
+
type: NgModule,
|
2384
|
+
args: [{
|
2385
|
+
imports: [HttpClientModule],
|
2386
|
+
providers: [
|
2387
|
+
BaseHttpService,
|
2388
|
+
XrayService,
|
2389
|
+
ConfigurationApiService,
|
2390
|
+
ConfigurationSettingsApiService,
|
2391
|
+
ContextApiService,
|
2392
|
+
DocumentAttachmentApiService,
|
2393
|
+
PriceApiService,
|
2394
|
+
ProductModelApiService,
|
2395
|
+
ProceduresApiService,
|
2396
|
+
QuoteApiService,
|
2397
|
+
DocumentTemplatesApiService,
|
2398
|
+
RampApiService,
|
2399
|
+
SalesforceApiService,
|
2400
|
+
UITemplatesApiService,
|
2401
|
+
ScriptsApiService,
|
2402
|
+
RulesApiService,
|
2403
|
+
RuleGroupsApiService,
|
2404
|
+
FlowsApiService,
|
2405
|
+
ProductApiService,
|
2406
|
+
CatalogAdminApiService,
|
2407
|
+
CatalogApiService,
|
2408
|
+
DeltaApiService,
|
2409
|
+
AccountApiService,
|
2410
|
+
PicklistsApiService,
|
2411
|
+
],
|
2412
|
+
}]
|
2413
|
+
}] });
|
2414
|
+
|
2415
|
+
/**
|
2416
|
+
* Generated bundle index. Do not edit.
|
2417
|
+
*/
|
2418
|
+
|
2419
|
+
export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationSettingsApiService, ContextApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, FlowsApiService, PicklistsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, QuoteApiService, RampApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, ScriptsApiService, UITemplatesApiService };
|
2420
|
+
//# sourceMappingURL=veloceapps-api.js.map
|