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