@veloceapps/api 4.0.21-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +3 -0
  2. package/bundles/veloceapps-api.umd.js +2950 -0
  3. package/bundles/veloceapps-api.umd.js.map +1 -0
  4. package/esm2015/index.js +25 -0
  5. package/esm2015/lib/api.module.js +89 -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 +73 -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 +27 -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/flows-api.service.js +24 -0
  16. package/esm2015/lib/services/picklists-api.service.js +38 -0
  17. package/esm2015/lib/services/price-api.service.js +63 -0
  18. package/esm2015/lib/services/procedures-api.service.js +93 -0
  19. package/esm2015/lib/services/product-api.service.js +153 -0
  20. package/esm2015/lib/services/product-model-api.service.js +232 -0
  21. package/esm2015/lib/services/quote-api.service.js +48 -0
  22. package/esm2015/lib/services/ramp-api.service.js +21 -0
  23. package/esm2015/lib/services/rule-groups-api.service.js +62 -0
  24. package/esm2015/lib/services/rules-api.service.js +81 -0
  25. package/esm2015/lib/services/salesforce-api.service.js +40 -0
  26. package/esm2015/lib/services/scripts-api.service.js +76 -0
  27. package/esm2015/lib/services/ui-templates-api.service.js +282 -0
  28. package/esm2015/lib/types/clone-request.types.js +2 -0
  29. package/esm2015/lib/types/delta-request.types.js +2 -0
  30. package/esm2015/lib/types/dto/attribute-dto.types.js +21 -0
  31. package/esm2015/lib/types/dto/charge-group-item-dto.types.js +49 -0
  32. package/esm2015/lib/types/dto/charge-item-dto.types.js +78 -0
  33. package/esm2015/lib/types/dto/configuration-dto.types.js +19 -0
  34. package/esm2015/lib/types/dto/configuration-settings-dto.types.js +22 -0
  35. package/esm2015/lib/types/dto/domain-type-dto.types.js +27 -0
  36. package/esm2015/lib/types/dto/line-item-dto.types.js +103 -0
  37. package/esm2015/lib/types/dto/port-domain-dto.types.js +22 -0
  38. package/esm2015/lib/types/dto/price-adjustment-dto.types.js +15 -0
  39. package/esm2015/lib/types/dto/price-dto.types.js +25 -0
  40. package/esm2015/lib/types/dto/recommended-price-dto.types.js +25 -0
  41. package/esm2015/lib/types/dto/ui-template-dto.types.js +2 -0
  42. package/esm2015/lib/types/index.js +5 -0
  43. package/esm2015/lib/types/price.types.js +2 -0
  44. package/esm2015/lib/types/ramp-request.types.js +2 -0
  45. package/esm2015/lib/types/search-request.types.js +2 -0
  46. package/esm2015/lib/utils/ui-template.utils.js +13 -0
  47. package/esm2015/veloceapps-api.js +5 -0
  48. package/fesm2015/veloceapps-api.js +2420 -0
  49. package/fesm2015/veloceapps-api.js.map +1 -0
  50. package/index.d.ts +24 -0
  51. package/lib/api.module.d.ts +7 -0
  52. package/lib/services/account-api.service.d.ts +22 -0
  53. package/lib/services/catalog-admin-api.service.d.ts +34 -0
  54. package/lib/services/catalog-api.service.d.ts +20 -0
  55. package/lib/services/configuration-api.service.d.ts +18 -0
  56. package/lib/services/configuration-settings-api.service.d.ts +17 -0
  57. package/lib/services/context-api.service.d.ts +11 -0
  58. package/lib/services/delta-api.service.d.ts +12 -0
  59. package/lib/services/document-attachment-api.service.d.ts +16 -0
  60. package/lib/services/document-templates-api.service.d.ts +47 -0
  61. package/lib/services/flows-api.service.d.ts +13 -0
  62. package/lib/services/picklists-api.service.d.ts +17 -0
  63. package/lib/services/price-api.service.d.ts +16 -0
  64. package/lib/services/procedures-api.service.d.ts +27 -0
  65. package/lib/services/product-api.service.d.ts +31 -0
  66. package/lib/services/product-model-api.service.d.ts +30 -0
  67. package/lib/services/quote-api.service.d.ts +25 -0
  68. package/lib/services/ramp-api.service.d.ts +13 -0
  69. package/lib/services/rule-groups-api.service.d.ts +18 -0
  70. package/lib/services/rules-api.service.d.ts +21 -0
  71. package/lib/services/salesforce-api.service.d.ts +17 -0
  72. package/lib/services/scripts-api.service.d.ts +21 -0
  73. package/lib/services/ui-templates-api.service.d.ts +49 -0
  74. package/lib/types/clone-request.types.d.ts +5 -0
  75. package/lib/types/delta-request.types.d.ts +5 -0
  76. package/lib/types/dto/attribute-dto.types.d.ts +11 -0
  77. package/lib/types/dto/charge-group-item-dto.types.d.ts +26 -0
  78. package/lib/types/dto/charge-item-dto.types.d.ts +41 -0
  79. package/lib/types/dto/configuration-dto.types.d.ts +18 -0
  80. package/lib/types/dto/configuration-settings-dto.types.d.ts +9 -0
  81. package/lib/types/dto/domain-type-dto.types.d.ts +15 -0
  82. package/lib/types/dto/line-item-dto.types.d.ts +55 -0
  83. package/lib/types/dto/port-domain-dto.types.d.ts +13 -0
  84. package/lib/types/dto/price-adjustment-dto.types.d.ts +8 -0
  85. package/lib/types/dto/price-dto.types.d.ts +13 -0
  86. package/lib/types/dto/recommended-price-dto.types.d.ts +14 -0
  87. package/lib/types/dto/ui-template-dto.types.d.ts +6 -0
  88. package/lib/types/index.d.ts +4 -0
  89. package/lib/types/price.types.d.ts +5 -0
  90. package/lib/types/ramp-request.types.d.ts +13 -0
  91. package/lib/types/search-request.types.d.ts +8 -0
  92. package/lib/utils/ui-template.utils.d.ts +3 -0
  93. package/package.json +37 -0
  94. package/veloceapps-api.d.ts +5 -0
@@ -0,0 +1,2950 @@
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('lodash'), require('@angular/common'), require('moment')) :
3
+ typeof define === 'function' && define.amd ? define('@veloceapps/api', ['exports', '@angular/common/http', '@angular/core', '@veloceapps/core', 'rxjs', 'rxjs/operators', 'lodash', '@angular/common', '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.lodash, global.ng.common, 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.17", 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.17", ngImport: i0__namespace, type: AccountApiService });
74
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", 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.17", 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.17", ngImport: i0__namespace, type: CatalogAdminApiService });
236
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", 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.17", 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.17", ngImport: i0__namespace, type: CatalogApiService });
323
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", 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 __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
395
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
396
+ throw new TypeError("Function expected"); return f; }
397
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
398
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
399
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
400
+ var _, done = false;
401
+ for (var i = decorators.length - 1; i >= 0; i--) {
402
+ var context = {};
403
+ for (var p in contextIn)
404
+ context[p] = p === "access" ? {} : contextIn[p];
405
+ for (var p in contextIn.access)
406
+ context.access[p] = contextIn.access[p];
407
+ context.addInitializer = function (f) { if (done)
408
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
409
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
410
+ if (kind === "accessor") {
411
+ if (result === void 0)
412
+ continue;
413
+ if (result === null || typeof result !== "object")
414
+ throw new TypeError("Object expected");
415
+ if (_ = accept(result.get))
416
+ descriptor.get = _;
417
+ if (_ = accept(result.set))
418
+ descriptor.set = _;
419
+ if (_ = accept(result.init))
420
+ initializers.push(_);
421
+ }
422
+ else if (_ = accept(result)) {
423
+ if (kind === "field")
424
+ initializers.push(_);
425
+ else
426
+ descriptor[key] = _;
427
+ }
428
+ }
429
+ if (target)
430
+ Object.defineProperty(target, contextIn.name, descriptor);
431
+ done = true;
432
+ }
433
+ ;
434
+ function __runInitializers(thisArg, initializers, value) {
435
+ var useValue = arguments.length > 2;
436
+ for (var i = 0; i < initializers.length; i++) {
437
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
438
+ }
439
+ return useValue ? value : void 0;
440
+ }
441
+ ;
442
+ function __propKey(x) {
443
+ return typeof x === "symbol" ? x : "".concat(x);
444
+ }
445
+ ;
446
+ function __setFunctionName(f, name, prefix) {
447
+ if (typeof name === "symbol")
448
+ name = name.description ? "[".concat(name.description, "]") : "";
449
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
450
+ }
451
+ ;
452
+ function __metadata(metadataKey, metadataValue) {
453
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
454
+ return Reflect.metadata(metadataKey, metadataValue);
455
+ }
456
+ function __awaiter(thisArg, _arguments, P, generator) {
457
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
458
+ return new (P || (P = Promise))(function (resolve, reject) {
459
+ function fulfilled(value) { try {
460
+ step(generator.next(value));
461
+ }
462
+ catch (e) {
463
+ reject(e);
464
+ } }
465
+ function rejected(value) { try {
466
+ step(generator["throw"](value));
467
+ }
468
+ catch (e) {
469
+ reject(e);
470
+ } }
471
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
472
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
473
+ });
474
+ }
475
+ function __generator(thisArg, body) {
476
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
477
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
478
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
479
+ function verb(n) { return function (v) { return step([n, v]); }; }
480
+ function step(op) {
481
+ if (f)
482
+ throw new TypeError("Generator is already executing.");
483
+ while (g && (g = 0, op[0] && (_ = 0)), _)
484
+ try {
485
+ 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)
486
+ return t;
487
+ if (y = 0, t)
488
+ op = [op[0] & 2, t.value];
489
+ switch (op[0]) {
490
+ case 0:
491
+ case 1:
492
+ t = op;
493
+ break;
494
+ case 4:
495
+ _.label++;
496
+ return { value: op[1], done: false };
497
+ case 5:
498
+ _.label++;
499
+ y = op[1];
500
+ op = [0];
501
+ continue;
502
+ case 7:
503
+ op = _.ops.pop();
504
+ _.trys.pop();
505
+ continue;
506
+ default:
507
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
508
+ _ = 0;
509
+ continue;
510
+ }
511
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
512
+ _.label = op[1];
513
+ break;
514
+ }
515
+ if (op[0] === 6 && _.label < t[1]) {
516
+ _.label = t[1];
517
+ t = op;
518
+ break;
519
+ }
520
+ if (t && _.label < t[2]) {
521
+ _.label = t[2];
522
+ _.ops.push(op);
523
+ break;
524
+ }
525
+ if (t[2])
526
+ _.ops.pop();
527
+ _.trys.pop();
528
+ continue;
529
+ }
530
+ op = body.call(thisArg, _);
531
+ }
532
+ catch (e) {
533
+ op = [6, e];
534
+ y = 0;
535
+ }
536
+ finally {
537
+ f = t = 0;
538
+ }
539
+ if (op[0] & 5)
540
+ throw op[1];
541
+ return { value: op[0] ? op[1] : void 0, done: true };
542
+ }
543
+ }
544
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
545
+ if (k2 === undefined)
546
+ k2 = k;
547
+ var desc = Object.getOwnPropertyDescriptor(m, k);
548
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
549
+ desc = { enumerable: true, get: function () { return m[k]; } };
550
+ }
551
+ Object.defineProperty(o, k2, desc);
552
+ }) : (function (o, m, k, k2) {
553
+ if (k2 === undefined)
554
+ k2 = k;
555
+ o[k2] = m[k];
556
+ });
557
+ function __exportStar(m, o) {
558
+ for (var p in m)
559
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
560
+ __createBinding(o, m, p);
561
+ }
562
+ function __values(o) {
563
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
564
+ if (m)
565
+ return m.call(o);
566
+ if (o && typeof o.length === "number")
567
+ return {
568
+ next: function () {
569
+ if (o && i >= o.length)
570
+ o = void 0;
571
+ return { value: o && o[i++], done: !o };
572
+ }
573
+ };
574
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
575
+ }
576
+ function __read(o, n) {
577
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
578
+ if (!m)
579
+ return o;
580
+ var i = m.call(o), r, ar = [], e;
581
+ try {
582
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
583
+ ar.push(r.value);
584
+ }
585
+ catch (error) {
586
+ e = { error: error };
587
+ }
588
+ finally {
589
+ try {
590
+ if (r && !r.done && (m = i["return"]))
591
+ m.call(i);
592
+ }
593
+ finally {
594
+ if (e)
595
+ throw e.error;
596
+ }
597
+ }
598
+ return ar;
599
+ }
600
+ /** @deprecated */
601
+ function __spread() {
602
+ for (var ar = [], i = 0; i < arguments.length; i++)
603
+ ar = ar.concat(__read(arguments[i]));
604
+ return ar;
605
+ }
606
+ /** @deprecated */
607
+ function __spreadArrays() {
608
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
609
+ s += arguments[i].length;
610
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
611
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
612
+ r[k] = a[j];
613
+ return r;
614
+ }
615
+ function __spreadArray(to, from, pack) {
616
+ if (pack || arguments.length === 2)
617
+ for (var i = 0, l = from.length, ar; i < l; i++) {
618
+ if (ar || !(i in from)) {
619
+ if (!ar)
620
+ ar = Array.prototype.slice.call(from, 0, i);
621
+ ar[i] = from[i];
622
+ }
623
+ }
624
+ return to.concat(ar || Array.prototype.slice.call(from));
625
+ }
626
+ function __await(v) {
627
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
628
+ }
629
+ function __asyncGenerator(thisArg, _arguments, generator) {
630
+ if (!Symbol.asyncIterator)
631
+ throw new TypeError("Symbol.asyncIterator is not defined.");
632
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
633
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
634
+ function verb(n) { if (g[n])
635
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
636
+ function resume(n, v) { try {
637
+ step(g[n](v));
638
+ }
639
+ catch (e) {
640
+ settle(q[0][3], e);
641
+ } }
642
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
643
+ function fulfill(value) { resume("next", value); }
644
+ function reject(value) { resume("throw", value); }
645
+ function settle(f, v) { if (f(v), q.shift(), q.length)
646
+ resume(q[0][0], q[0][1]); }
647
+ }
648
+ function __asyncDelegator(o) {
649
+ var i, p;
650
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
651
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
652
+ }
653
+ function __asyncValues(o) {
654
+ if (!Symbol.asyncIterator)
655
+ throw new TypeError("Symbol.asyncIterator is not defined.");
656
+ var m = o[Symbol.asyncIterator], i;
657
+ 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);
658
+ 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); }); }; }
659
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
660
+ }
661
+ function __makeTemplateObject(cooked, raw) {
662
+ if (Object.defineProperty) {
663
+ Object.defineProperty(cooked, "raw", { value: raw });
664
+ }
665
+ else {
666
+ cooked.raw = raw;
667
+ }
668
+ return cooked;
669
+ }
670
+ ;
671
+ var __setModuleDefault = Object.create ? (function (o, v) {
672
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
673
+ }) : function (o, v) {
674
+ o["default"] = v;
675
+ };
676
+ function __importStar(mod) {
677
+ if (mod && mod.__esModule)
678
+ return mod;
679
+ var result = {};
680
+ if (mod != null)
681
+ for (var k in mod)
682
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
683
+ __createBinding(result, mod, k);
684
+ __setModuleDefault(result, mod);
685
+ return result;
686
+ }
687
+ function __importDefault(mod) {
688
+ return (mod && mod.__esModule) ? mod : { default: mod };
689
+ }
690
+ function __classPrivateFieldGet(receiver, state, kind, f) {
691
+ if (kind === "a" && !f)
692
+ throw new TypeError("Private accessor was defined without a getter");
693
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
694
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
695
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
696
+ }
697
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
698
+ if (kind === "m")
699
+ throw new TypeError("Private method is not writable");
700
+ if (kind === "a" && !f)
701
+ throw new TypeError("Private accessor was defined without a setter");
702
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
703
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
704
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
705
+ }
706
+ function __classPrivateFieldIn(state, receiver) {
707
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
708
+ throw new TypeError("Cannot use 'in' operator on non-object");
709
+ return typeof state === "function" ? receiver === state : state.has(receiver);
710
+ }
711
+
712
+ var AttributeDTO = /** @class */ (function () {
713
+ function AttributeDTO(name, type, value, cfgStatus, id, scale) {
714
+ this.name = name;
715
+ this.type = type;
716
+ this.value = value;
717
+ this.cfgStatus = cfgStatus;
718
+ this.id = id;
719
+ this.scale = scale;
720
+ }
721
+ AttributeDTO.fromDTO = function (dto) {
722
+ return {
723
+ id: dto.id,
724
+ name: dto.name,
725
+ type: dto.type,
726
+ scale: dto.scale,
727
+ value: dto.value,
728
+ cfgStatus: dto.cfgStatus,
729
+ };
730
+ };
731
+ return AttributeDTO;
732
+ }());
733
+
734
+ var PriceAdjustmentDTO = /** @class */ (function () {
735
+ function PriceAdjustmentDTO(amount, explanation, type) {
736
+ this.amount = amount;
737
+ this.explanation = explanation;
738
+ this.type = type;
739
+ }
740
+ PriceAdjustmentDTO.fromDTO = function (dto) {
741
+ return {
742
+ amount: dto.amount,
743
+ explanation: dto.explanation,
744
+ type: dto.type,
745
+ };
746
+ };
747
+ return PriceAdjustmentDTO;
748
+ }());
749
+
750
+ var ChargeGroupItemDTO = /** @class */ (function () {
751
+ function ChargeGroupItemDTO(chargeType, chargeMethod, properties, id, chargeTypeDisplayValue, frequencyUnit, frequencyDuration, basePrice, currency, sellingTerm, netPrice, listPrice, netUnitPrice, listUnitPrice, cost, priceAdjustment, priceWaterfalls, priceAdjustmentEnabled, listPriceAdjustmentEnabled) {
752
+ this.chargeType = chargeType;
753
+ this.chargeMethod = chargeMethod;
754
+ this.properties = properties;
755
+ this.id = id;
756
+ this.chargeTypeDisplayValue = chargeTypeDisplayValue;
757
+ this.frequencyUnit = frequencyUnit;
758
+ this.frequencyDuration = frequencyDuration;
759
+ this.basePrice = basePrice;
760
+ this.currency = currency;
761
+ this.sellingTerm = sellingTerm;
762
+ this.netPrice = netPrice;
763
+ this.listPrice = listPrice;
764
+ this.netUnitPrice = netUnitPrice;
765
+ this.listUnitPrice = listUnitPrice;
766
+ this.cost = cost;
767
+ this.priceAdjustment = priceAdjustment;
768
+ this.priceWaterfalls = priceWaterfalls;
769
+ this.priceAdjustmentEnabled = priceAdjustmentEnabled;
770
+ this.listPriceAdjustmentEnabled = listPriceAdjustmentEnabled;
771
+ }
772
+ ChargeGroupItemDTO.fromDTO = function (dto) {
773
+ var _a;
774
+ return {
775
+ id: dto.id,
776
+ chargeType: dto.chargeType,
777
+ chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
778
+ chargeMethod: dto.chargeMethod,
779
+ frequencyUnit: dto.frequencyUnit,
780
+ frequencyDuration: dto.frequencyDuration,
781
+ basePrice: dto.basePrice,
782
+ currency: dto.currency,
783
+ sellingTerm: dto.sellingTerm,
784
+ netPrice: dto.netPrice,
785
+ listPrice: dto.listPrice,
786
+ netUnitPrice: dto.netUnitPrice,
787
+ listUnitPrice: dto.listUnitPrice,
788
+ cost: dto.cost,
789
+ priceAdjustment: dto.priceAdjustment && PriceAdjustmentDTO.fromDTO(dto.priceAdjustment),
790
+ priceWaterfalls: (_a = dto.priceWaterfalls) === null || _a === void 0 ? void 0 : _a.map(PriceAdjustmentDTO.fromDTO),
791
+ priceAdjustmentEnabled: dto.priceAdjustmentEnabled,
792
+ listPriceAdjustmentEnabled: dto.listPriceAdjustmentEnabled,
793
+ properties: dto.properties,
794
+ };
795
+ };
796
+ return ChargeGroupItemDTO;
797
+ }());
798
+
799
+ var ChargeItemDTO = /** @class */ (function () {
800
+ function ChargeItemDTO(id, price, unitPrice, baseListPrice, baseListUnitPrice, listPrice, listUnitPrice, netPrice, previousNetPrice, netUnitPrice, chargeId, chargeType, chargeMethod, priceItemId, startDate, priceWaterfalls, quantity, properties, chargeTypeDisplayValue, arr, frequencyUnit, frequencyDuration, endDate, sellingTerm, currency, unitCost, cost, minUnitPrice, minPrice, enablePriceAdjustment, enableListPriceAdjustment, listPriceAdjustment, priceAdjustment, requiresApprovals) {
801
+ this.id = id;
802
+ this.price = price;
803
+ this.unitPrice = unitPrice;
804
+ this.baseListPrice = baseListPrice;
805
+ this.baseListUnitPrice = baseListUnitPrice;
806
+ this.listPrice = listPrice;
807
+ this.listUnitPrice = listUnitPrice;
808
+ this.netPrice = netPrice;
809
+ this.previousNetPrice = previousNetPrice;
810
+ this.netUnitPrice = netUnitPrice;
811
+ this.chargeId = chargeId;
812
+ this.chargeType = chargeType;
813
+ this.chargeMethod = chargeMethod;
814
+ this.priceItemId = priceItemId;
815
+ this.startDate = startDate;
816
+ this.priceWaterfalls = priceWaterfalls;
817
+ this.quantity = quantity;
818
+ this.properties = properties;
819
+ this.chargeTypeDisplayValue = chargeTypeDisplayValue;
820
+ this.arr = arr;
821
+ this.frequencyUnit = frequencyUnit;
822
+ this.frequencyDuration = frequencyDuration;
823
+ this.endDate = endDate;
824
+ this.sellingTerm = sellingTerm;
825
+ this.currency = currency;
826
+ this.unitCost = unitCost;
827
+ this.cost = cost;
828
+ this.minUnitPrice = minUnitPrice;
829
+ this.minPrice = minPrice;
830
+ this.enablePriceAdjustment = enablePriceAdjustment;
831
+ this.enableListPriceAdjustment = enableListPriceAdjustment;
832
+ this.listPriceAdjustment = listPriceAdjustment;
833
+ this.priceAdjustment = priceAdjustment;
834
+ this.requiresApprovals = requiresApprovals;
835
+ }
836
+ ChargeItemDTO.fromDTO = function (dto) {
837
+ return {
838
+ id: dto.id,
839
+ price: dto.price,
840
+ unitPrice: dto.unitPrice,
841
+ baseListPrice: dto.baseListPrice,
842
+ baseListUnitPrice: dto.baseListUnitPrice,
843
+ listPrice: dto.listPrice,
844
+ listUnitPrice: dto.listUnitPrice,
845
+ netPrice: dto.netPrice,
846
+ previousNetPrice: dto.previousNetPrice,
847
+ netUnitPrice: dto.netUnitPrice,
848
+ chargeId: dto.chargeId,
849
+ chargeType: dto.chargeType,
850
+ chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
851
+ chargeMethod: dto.chargeMethod,
852
+ priceItemId: dto.priceItemId,
853
+ startDate: dto.startDate,
854
+ endDate: dto.endDate,
855
+ priceWaterfalls: dto.priceWaterfalls.map(PriceAdjustmentDTO.fromDTO),
856
+ quantity: dto.quantity,
857
+ properties: dto.properties,
858
+ arr: dto.arr,
859
+ frequencyUnit: dto.frequencyUnit,
860
+ frequencyDuration: dto.frequencyDuration,
861
+ sellingTerm: dto.sellingTerm,
862
+ currency: dto.currency,
863
+ unitCost: dto.unitCost,
864
+ cost: dto.cost,
865
+ minUnitPrice: dto.minUnitPrice,
866
+ minPrice: dto.minPrice,
867
+ enablePriceAdjustment: dto.enablePriceAdjustment,
868
+ enableListPriceAdjustment: dto.enableListPriceAdjustment,
869
+ listPriceAdjustment: dto.listPriceAdjustment && PriceAdjustmentDTO.fromDTO(dto.listPriceAdjustment),
870
+ priceAdjustment: dto.priceAdjustment && PriceAdjustmentDTO.fromDTO(dto.priceAdjustment),
871
+ requiresApprovals: dto.requiresApprovals,
872
+ };
873
+ };
874
+ return ChargeItemDTO;
875
+ }());
876
+
877
+ var RecommendedPriceDTO = /** @class */ (function () {
878
+ function RecommendedPriceDTO(netPrice, listPrice, chargeType, chargeMethod, explanation, frequencyDuration, frequencyUnit, properties) {
879
+ this.netPrice = netPrice;
880
+ this.listPrice = listPrice;
881
+ this.chargeType = chargeType;
882
+ this.chargeMethod = chargeMethod;
883
+ this.explanation = explanation;
884
+ this.frequencyDuration = frequencyDuration;
885
+ this.frequencyUnit = frequencyUnit;
886
+ this.properties = properties;
887
+ }
888
+ RecommendedPriceDTO.fromDTO = function (dto) {
889
+ return {
890
+ netPrice: dto.netPrice,
891
+ listPrice: dto.listPrice,
892
+ chargeType: dto.chargeType,
893
+ chargeMethod: dto.chargeMethod,
894
+ frequencyUnit: dto.frequencyUnit,
895
+ frequencyDuration: dto.frequencyDuration,
896
+ explanation: dto.explanation,
897
+ properties: dto.properties,
898
+ };
899
+ };
900
+ return RecommendedPriceDTO;
901
+ }());
902
+
903
+ var DomainTypeDTO = /** @class */ (function () {
904
+ function DomainTypeDTO(name, displayName, minCard, maxCard, recommendedPrices, properties, status, cardinality) {
905
+ this.name = name;
906
+ this.displayName = displayName;
907
+ this.minCard = minCard;
908
+ this.maxCard = maxCard;
909
+ this.recommendedPrices = recommendedPrices;
910
+ this.properties = properties;
911
+ this.status = status;
912
+ this.cardinality = cardinality;
913
+ }
914
+ DomainTypeDTO.fromDTO = function (dto) {
915
+ var _a;
916
+ return {
917
+ name: dto.name,
918
+ displayName: dto.displayName,
919
+ minCard: dto.minCard,
920
+ maxCard: dto.maxCard,
921
+ recommendedPrices: (_a = dto.recommendedPrices) === null || _a === void 0 ? void 0 : _a.map(RecommendedPriceDTO.fromDTO),
922
+ properties: dto.properties,
923
+ status: dto.status,
924
+ cardinality: dto.cardinality,
925
+ };
926
+ };
927
+ return DomainTypeDTO;
928
+ }());
929
+
930
+ var PortDomainDTO = /** @class */ (function () {
931
+ function PortDomainDTO(name, type, minCard, maxCard, domainTypes, properties) {
932
+ this.name = name;
933
+ this.type = type;
934
+ this.minCard = minCard;
935
+ this.maxCard = maxCard;
936
+ this.domainTypes = domainTypes;
937
+ this.properties = properties;
938
+ }
939
+ PortDomainDTO.fromDTO = function (dto) {
940
+ return {
941
+ name: dto.name,
942
+ type: dto.type,
943
+ minCard: dto.minCard,
944
+ maxCard: dto.maxCard,
945
+ domainTypes: dto.domainTypes.map(DomainTypeDTO.fromDTO),
946
+ properties: dto.properties,
947
+ };
948
+ };
949
+ return PortDomainDTO;
950
+ }());
951
+
952
+ var PriceDTO = /** @class */ (function () {
953
+ function PriceDTO(netPrice, listPrice, chargeType, chargeTypeDisplayValue, chargeMethod, frequencyUnit, frequencyDuration, sellingTerm) {
954
+ this.netPrice = netPrice;
955
+ this.listPrice = listPrice;
956
+ this.chargeType = chargeType;
957
+ this.chargeTypeDisplayValue = chargeTypeDisplayValue;
958
+ this.chargeMethod = chargeMethod;
959
+ this.frequencyUnit = frequencyUnit;
960
+ this.frequencyDuration = frequencyDuration;
961
+ this.sellingTerm = sellingTerm;
962
+ }
963
+ PriceDTO.fromDTO = function (dto) {
964
+ return {
965
+ netPrice: dto.netPrice,
966
+ listPrice: dto.listPrice,
967
+ chargeType: dto.chargeType,
968
+ chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
969
+ chargeMethod: dto.chargeMethod,
970
+ frequencyUnit: dto.frequencyUnit,
971
+ frequencyDuration: dto.frequencyDuration,
972
+ sellingTerm: dto.sellingTerm,
973
+ };
974
+ };
975
+ return PriceDTO;
976
+ }());
977
+
978
+ var LineItemDTO = /** @class */ (function () {
979
+ function LineItemDTO(id, activated, attributes, attributeDomains, cfgStatus, chargeGroupItems, chargeItems, domainComputations, lineItems, messages, name, optionalCharges, pending, portDomains, properties, qty, totalPrices, type, integrationId, productId, port, parentId, assetId, openOrderLineItemId, productName, rootId, actionCode, serviceStartDate, effectiveDate, effectiveStartDate, startDate, endDate, priceListId, planId, sellingFrequencyUnit, sellingFrequencyDuration, minimalTerm, offeringId, offeringItemId, offeringInstanceId, rampInstanceId, enableRamp, configurable, requiresApprovals) {
980
+ this.id = id;
981
+ this.activated = activated;
982
+ this.attributes = attributes;
983
+ this.attributeDomains = attributeDomains;
984
+ this.cfgStatus = cfgStatus;
985
+ this.chargeGroupItems = chargeGroupItems;
986
+ this.chargeItems = chargeItems;
987
+ this.domainComputations = domainComputations;
988
+ this.lineItems = lineItems;
989
+ this.messages = messages;
990
+ this.name = name;
991
+ this.optionalCharges = optionalCharges;
992
+ this.pending = pending;
993
+ this.portDomains = portDomains;
994
+ this.properties = properties;
995
+ this.qty = qty;
996
+ this.totalPrices = totalPrices;
997
+ this.type = type;
998
+ this.integrationId = integrationId;
999
+ this.productId = productId;
1000
+ this.port = port;
1001
+ this.parentId = parentId;
1002
+ this.assetId = assetId;
1003
+ this.openOrderLineItemId = openOrderLineItemId;
1004
+ this.productName = productName;
1005
+ this.rootId = rootId;
1006
+ this.actionCode = actionCode;
1007
+ this.serviceStartDate = serviceStartDate;
1008
+ this.effectiveDate = effectiveDate;
1009
+ this.effectiveStartDate = effectiveStartDate;
1010
+ this.startDate = startDate;
1011
+ this.endDate = endDate;
1012
+ this.priceListId = priceListId;
1013
+ this.planId = planId;
1014
+ this.sellingFrequencyUnit = sellingFrequencyUnit;
1015
+ this.sellingFrequencyDuration = sellingFrequencyDuration;
1016
+ this.minimalTerm = minimalTerm;
1017
+ this.offeringId = offeringId;
1018
+ this.offeringItemId = offeringItemId;
1019
+ this.offeringInstanceId = offeringInstanceId;
1020
+ this.rampInstanceId = rampInstanceId;
1021
+ this.enableRamp = enableRamp;
1022
+ this.configurable = configurable;
1023
+ this.requiresApprovals = requiresApprovals;
1024
+ }
1025
+ LineItemDTO.fromDTO = function (dto) {
1026
+ return {
1027
+ id: dto.id,
1028
+ activated: dto.activated,
1029
+ attributes: dto.attributes.map(AttributeDTO.fromDTO),
1030
+ attributeDomains: dto.attributeDomains,
1031
+ cfgStatus: dto.cfgStatus,
1032
+ chargeGroupItems: dto.chargeGroupItems.map(ChargeGroupItemDTO.fromDTO),
1033
+ chargeItems: dto.chargeItems.map(ChargeItemDTO.fromDTO),
1034
+ domainComputations: dto.domainComputations,
1035
+ lineItems: dto.lineItems.map(LineItemDTO.fromDTO),
1036
+ messages: dto.messages,
1037
+ name: dto.name,
1038
+ optionalCharges: dto.optionalCharges,
1039
+ pending: dto.pending,
1040
+ portDomains: _.transform(dto.portDomains, function (result, value, key) { return (result[key] = PortDomainDTO.fromDTO(value)); }),
1041
+ properties: dto.properties,
1042
+ qty: dto.qty,
1043
+ totalPrices: _.transform(dto.totalPrices, function (result, value, key) { return (result[key] = PriceDTO.fromDTO(value)); }),
1044
+ type: dto.type,
1045
+ productId: dto.productId,
1046
+ port: dto.port,
1047
+ integrationId: dto.integrationId,
1048
+ parentId: dto.parentId,
1049
+ assetId: dto.assetId,
1050
+ openOrderLineItemId: dto.openOrderLineItemId,
1051
+ productName: dto.productName,
1052
+ rootId: dto.rootId,
1053
+ actionCode: dto.actionCode,
1054
+ serviceStartDate: dto.serviceStartDate,
1055
+ effectiveDate: dto.effectiveDate,
1056
+ effectiveStartDate: dto.effectiveStartDate,
1057
+ startDate: dto.startDate,
1058
+ endDate: dto.endDate,
1059
+ priceListId: dto.priceListId,
1060
+ planId: dto.planId,
1061
+ sellingFrequencyUnit: dto.sellingFrequencyUnit,
1062
+ sellingFrequencyDuration: dto.sellingFrequencyDuration,
1063
+ minimalTerm: dto.minimalTerm,
1064
+ offeringId: dto.offeringId,
1065
+ offeringItemId: dto.offeringItemId,
1066
+ offeringInstanceId: dto.offeringInstanceId,
1067
+ rampInstanceId: dto.rampInstanceId,
1068
+ enableRamp: dto.enableRamp,
1069
+ configurable: dto.configurable,
1070
+ requiresApprovals: dto.requiresApprovals,
1071
+ };
1072
+ };
1073
+ return LineItemDTO;
1074
+ }());
1075
+
1076
+ var ConfigurePriceDTO = /** @class */ (function () {
1077
+ function ConfigurePriceDTO(lineItem, context, charges, pricePlans) {
1078
+ this.lineItem = lineItem;
1079
+ this.context = context;
1080
+ this.charges = charges;
1081
+ this.pricePlans = pricePlans;
1082
+ }
1083
+ ConfigurePriceDTO.fromDTO = function (dto) {
1084
+ return {
1085
+ lineItem: LineItemDTO.fromDTO(dto.lineItem),
1086
+ charges: dto.charges,
1087
+ pricePlans: dto.pricePlans,
1088
+ context: dto.context,
1089
+ deletedLineItems: dto.deletedLineItems.map(function (deletedLineItem) { return LineItemDTO.fromDTO(deletedLineItem); }),
1090
+ };
1091
+ };
1092
+ return ConfigurePriceDTO;
1093
+ }());
1094
+
1095
+ var ConfigurationApiService = /** @class */ (function () {
1096
+ function ConfigurationApiService(httpService) {
1097
+ this.httpService = httpService;
1098
+ this.SERVICE_URL = '/configuration';
1099
+ }
1100
+ ConfigurationApiService.prototype.configureLineItem = function (_d) {
1101
+ var _this = this;
1102
+ var configurationRequest = _d.configurationRequest, runtimeModel = _d.runtimeModel, pricingEnabled = _d.pricingEnabled;
1103
+ return this.httpService
1104
+ .api({
1105
+ method: 'post',
1106
+ url: "" + this.SERVICE_URL + (pricingEnabled ? '/price' : ''),
1107
+ body: configurationRequest,
1108
+ errorHandler: function (e) { return rxjs.throwError(e); },
1109
+ })
1110
+ .pipe(operators.map(function (response) { return ConfigurePriceDTO.fromDTO(response); }), operators.map(function (configurePrice) {
1111
+ if (runtimeModel) {
1112
+ return Object.assign(Object.assign({}, configurePrice), { lineItem: _this.updatePortDomains(configurePrice.lineItem, runtimeModel) });
1113
+ }
1114
+ else {
1115
+ return configurePrice;
1116
+ }
1117
+ }));
1118
+ };
1119
+ ConfigurationApiService.prototype.getRuntimeDataByProductId = function (productId, offeringId) {
1120
+ return this.httpService
1121
+ .api({
1122
+ method: 'get',
1123
+ url: this.SERVICE_URL + "/" + productId + "/model" + ((offeringId && "/" + offeringId) || ''),
1124
+ })
1125
+ .pipe(operators.map(function (runtimeData) {
1126
+ runtimeData.uiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
1127
+ runtimeData.uiDefinitions.forEach(function (uiDefinition) {
1128
+ i1.ModelTranslatorUtils.toLocalUIDefinition(uiDefinition);
1129
+ });
1130
+ return runtimeData;
1131
+ }));
1132
+ };
1133
+ ConfigurationApiService.prototype.getRuntimeDataByModelId = function (modelId) {
1134
+ return this.httpService
1135
+ .api({
1136
+ method: 'get',
1137
+ url: this.SERVICE_URL + "/" + modelId + "/model-test",
1138
+ })
1139
+ .pipe(operators.map(function (runtimeData) {
1140
+ runtimeData.uiDefinitions = [];
1141
+ return runtimeData;
1142
+ }));
1143
+ };
1144
+ ConfigurationApiService.prototype.updatePortDomains = function (lineItem, runtimeModel) {
1145
+ var e_1, _d;
1146
+ var _this = this;
1147
+ var _a, _b, _c;
1148
+ var type = runtimeModel.components.get(lineItem.type);
1149
+ var portDomains = Object.assign({}, lineItem.portDomains);
1150
+ try {
1151
+ 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()) {
1152
+ var port = _f.value;
1153
+ var portDomain = portDomains[port.name];
1154
+ if (((_b = portDomain === null || portDomain === void 0 ? void 0 : portDomain.properties) === null || _b === void 0 ? void 0 : _b.domainComputation) === 'false') {
1155
+ portDomain.domainTypes = port.domainTypes;
1156
+ }
1157
+ }
1158
+ }
1159
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1160
+ finally {
1161
+ try {
1162
+ if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
1163
+ }
1164
+ finally { if (e_1) throw e_1.error; }
1165
+ }
1166
+ 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 });
1167
+ };
1168
+ return ConfigurationApiService;
1169
+ }());
1170
+ ConfigurationApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1171
+ ConfigurationApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationApiService });
1172
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationApiService, decorators: [{
1173
+ type: i0.Injectable
1174
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1175
+
1176
+ var ConfigurationSettingsDTO = /** @class */ (function () {
1177
+ function ConfigurationSettingsDTO(id, key, value) {
1178
+ this.id = id;
1179
+ this.key = key;
1180
+ this.value = value;
1181
+ }
1182
+ ConfigurationSettingsDTO.fromDTO = function (dto, key) {
1183
+ return {
1184
+ id: dto === null || dto === void 0 ? void 0 : dto.id,
1185
+ key: (dto === null || dto === void 0 ? void 0 : dto.key) || key || '',
1186
+ value: dto === null || dto === void 0 ? void 0 : dto.value,
1187
+ };
1188
+ };
1189
+ ConfigurationSettingsDTO.toDTO = function (data) {
1190
+ return {
1191
+ id: data.id,
1192
+ key: data.key,
1193
+ value: data.value,
1194
+ };
1195
+ };
1196
+ return ConfigurationSettingsDTO;
1197
+ }());
1198
+
1199
+ var ConfigurationSettingsApiService = /** @class */ (function () {
1200
+ function ConfigurationSettingsApiService(httpService) {
1201
+ this.httpService = httpService;
1202
+ this.SERVICE_URL = '/configuration-settings';
1203
+ }
1204
+ ConfigurationSettingsApiService.prototype.fetchSettings = function (options) {
1205
+ return this.httpService
1206
+ .api(Object.assign({ url: "" + this.SERVICE_URL, method: 'get' }, options))
1207
+ .pipe(operators.map(function (settings) { return settings.map(function (setting) { return ConfigurationSettingsDTO.fromDTO(setting); }); }));
1208
+ };
1209
+ ConfigurationSettingsApiService.prototype.fetchSetting = function (settingsKey, options) {
1210
+ return this.httpService
1211
+ .api(Object.assign({ url: this.SERVICE_URL + "/byKey/" + settingsKey, method: 'get' }, options))
1212
+ .pipe(operators.map(function (setting) { return ConfigurationSettingsDTO.fromDTO(setting, settingsKey); }), operators.catchError(function (err) {
1213
+ if (err instanceof i4.HttpErrorResponse && err.status === 404) {
1214
+ return rxjs.of(null);
1215
+ }
1216
+ throw err;
1217
+ }));
1218
+ };
1219
+ ConfigurationSettingsApiService.prototype.createSetting = function (setting, options) {
1220
+ var request = ConfigurationSettingsDTO.toDTO(setting);
1221
+ return this.httpService.api(Object.assign({ url: "" + this.SERVICE_URL, method: 'post', body: Object.assign({}, request) }, options));
1222
+ };
1223
+ ConfigurationSettingsApiService.prototype.updateSetting = function (setting, options) {
1224
+ var request = ConfigurationSettingsDTO.toDTO(setting);
1225
+ return this.httpService.api(Object.assign({ url: this.SERVICE_URL + "/" + request.id, method: 'put', body: Object.assign({}, request) }, options));
1226
+ };
1227
+ ConfigurationSettingsApiService.prototype.removeSetting = function (setting, options) {
1228
+ var request = ConfigurationSettingsDTO.toDTO(setting);
1229
+ return this.httpService.api(Object.assign({ url: this.SERVICE_URL + "/" + request.id, method: 'delete' }, options));
1230
+ };
1231
+ ConfigurationSettingsApiService.prototype.restoreSetting = function (settingId, options) {
1232
+ return this.httpService.api(Object.assign({ url: this.SERVICE_URL + "/" + settingId + "/restore", method: 'patch' }, options));
1233
+ };
1234
+ ConfigurationSettingsApiService.prototype.clear = function (name, options) {
1235
+ return this.httpService.api(Object.assign({ method: 'get', url: '/cache/evict/' + name }, options));
1236
+ };
1237
+ return ConfigurationSettingsApiService;
1238
+ }());
1239
+ ConfigurationSettingsApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationSettingsApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1240
+ ConfigurationSettingsApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationSettingsApiService });
1241
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationSettingsApiService, decorators: [{
1242
+ type: i0.Injectable
1243
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1244
+
1245
+ var ContextApiService = /** @class */ (function () {
1246
+ function ContextApiService(httpService) {
1247
+ this.httpService = httpService;
1248
+ this.SERVICE_URL = '/context';
1249
+ }
1250
+ ContextApiService.prototype.getContext = function (headerId, mode) {
1251
+ return this.httpService.api({
1252
+ method: 'post',
1253
+ body: {
1254
+ headerId: headerId,
1255
+ contextMode: i1.ConfigurationContextMode[mode],
1256
+ },
1257
+ url: "" + this.SERVICE_URL,
1258
+ });
1259
+ };
1260
+ return ContextApiService;
1261
+ }());
1262
+ ContextApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1263
+ ContextApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextApiService });
1264
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextApiService, decorators: [{
1265
+ type: i0.Injectable
1266
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1267
+
1268
+ var DeltaApiService = /** @class */ (function () {
1269
+ function DeltaApiService(httpService) {
1270
+ this.httpService = httpService;
1271
+ this.SERVICE_URL = '/delta';
1272
+ }
1273
+ DeltaApiService.prototype.calculate$ = function (request) {
1274
+ return this.httpService
1275
+ .api({
1276
+ method: 'post',
1277
+ url: this.SERVICE_URL + "/calculate",
1278
+ body: request,
1279
+ skipErrorHandler: true,
1280
+ })
1281
+ .pipe(rxjs.map(function (dtos) { return dtos.map(function (dto) { return LineItemDTO.fromDTO(dto); }); }));
1282
+ };
1283
+ return DeltaApiService;
1284
+ }());
1285
+ DeltaApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DeltaApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1286
+ DeltaApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DeltaApiService });
1287
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DeltaApiService, decorators: [{
1288
+ type: i0.Injectable
1289
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1290
+
1291
+ var DocumentAttachmentApiService = /** @class */ (function () {
1292
+ function DocumentAttachmentApiService(httpService, fileDownloadService) {
1293
+ this.httpService = httpService;
1294
+ this.fileDownloadService = fileDownloadService;
1295
+ this.SERVICE_URL = '/attachments';
1296
+ }
1297
+ DocumentAttachmentApiService.prototype.getAttachments = function (searchRequest) {
1298
+ return this.httpService.api({
1299
+ url: this.SERVICE_URL + "/search",
1300
+ method: 'post',
1301
+ body: searchRequest,
1302
+ });
1303
+ };
1304
+ DocumentAttachmentApiService.prototype.createAttachment = function (attachment, file, reportProgress) {
1305
+ var formData = new FormData();
1306
+ if (file) {
1307
+ formData.append('file', file, file.name);
1308
+ }
1309
+ formData.append('attachment', new Blob([JSON.stringify(attachment)], {
1310
+ type: 'application/json',
1311
+ }));
1312
+ return this.httpService.upload({
1313
+ url: "" + this.SERVICE_URL,
1314
+ body: formData,
1315
+ method: 'post',
1316
+ observe: reportProgress ? 'events' : undefined,
1317
+ reportProgress: reportProgress,
1318
+ });
1319
+ };
1320
+ DocumentAttachmentApiService.prototype.updateAttachment = function (id, attachment) {
1321
+ return this.httpService.api({
1322
+ url: this.SERVICE_URL + "/" + id,
1323
+ body: attachment,
1324
+ method: 'put',
1325
+ });
1326
+ };
1327
+ DocumentAttachmentApiService.prototype.getAttachmentFile = function (id, isPreventDownload) {
1328
+ var _this = this;
1329
+ return this.httpService
1330
+ .api({
1331
+ url: this.SERVICE_URL + "/" + id + "/file",
1332
+ responseType: isPreventDownload ? 'arraybuffer' : 'blob',
1333
+ observe: isPreventDownload ? 'body' : 'response',
1334
+ })
1335
+ .pipe(operators.tap(function (response) {
1336
+ if (!isPreventDownload) {
1337
+ _this.fileDownloadService.processDownload(response);
1338
+ }
1339
+ }), operators.map(function (response) { return (isPreventDownload ? new Blob([response.body || response]) : response.body || response); }));
1340
+ };
1341
+ DocumentAttachmentApiService.prototype.removeAttachment = function (id) {
1342
+ return this.httpService.api({
1343
+ url: this.SERVICE_URL + "/" + id,
1344
+ method: 'delete',
1345
+ });
1346
+ };
1347
+ return DocumentAttachmentApiService;
1348
+ }());
1349
+ DocumentAttachmentApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DocumentAttachmentApiService, deps: [{ token: i1__namespace.BaseHttpService }, { token: i1__namespace.FileDownloadService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1350
+ DocumentAttachmentApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DocumentAttachmentApiService });
1351
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DocumentAttachmentApiService, decorators: [{
1352
+ type: i0.Injectable
1353
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }, { type: i1__namespace.FileDownloadService }]; } });
1354
+
1355
+ var SalesforceApiService = /** @class */ (function () {
1356
+ function SalesforceApiService(httpService) {
1357
+ this.httpService = httpService;
1358
+ this.SERVICE_URL = '/proxy';
1359
+ }
1360
+ SalesforceApiService.prototype.query = function (searchRequest, objectName, options) {
1361
+ 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));
1362
+ };
1363
+ SalesforceApiService.prototype.queryObjects = function (search, options) {
1364
+ var params = new i4.HttpParams();
1365
+ if (search) {
1366
+ params = params.append('search', search);
1367
+ }
1368
+ return this.httpService.api(Object.assign({ url: this.SERVICE_URL + "/query", params: params }, options));
1369
+ };
1370
+ SalesforceApiService.prototype.describe = function (objectName, fieldName, options) {
1371
+ var methodUrl = this.SERVICE_URL + "/describe/" + objectName + "/fields" + (fieldName ? "/" + fieldName : '');
1372
+ return this.httpService.api(Object.assign({ url: methodUrl }, options));
1373
+ };
1374
+ SalesforceApiService.prototype.describe2 = function (objectName, fields, options) {
1375
+ var methodUrl = this.SERVICE_URL + "/describe/" + objectName + "/fields";
1376
+ return this.httpService.api(Object.assign({ method: 'post', url: methodUrl, body: fields }, options));
1377
+ };
1378
+ SalesforceApiService.prototype.apexGetRequest = function (path, params, options) {
1379
+ return this.httpService.api(Object.assign({ url: this.SERVICE_URL + "/apex" + path, params: params }, options));
1380
+ };
1381
+ SalesforceApiService.prototype.apexPostRequest = function (path, body, options) {
1382
+ return this.httpService.api(Object.assign({ method: 'post', body: body, url: this.SERVICE_URL + "/apex" + path }, options));
1383
+ };
1384
+ return SalesforceApiService;
1385
+ }());
1386
+ SalesforceApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SalesforceApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1387
+ SalesforceApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SalesforceApiService });
1388
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SalesforceApiService, decorators: [{
1389
+ type: i0.Injectable
1390
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1391
+
1392
+ var moment = moment___namespace;
1393
+ var DocumentTemplatesApiService = /** @class */ (function () {
1394
+ function DocumentTemplatesApiService(service, salesforceApiService, fileDownloadService, documentAttachmentService, http) {
1395
+ this.service = service;
1396
+ this.salesforceApiService = salesforceApiService;
1397
+ this.fileDownloadService = fileDownloadService;
1398
+ this.documentAttachmentService = documentAttachmentService;
1399
+ this.http = http;
1400
+ this.DOCGEN_TAG = 'docgen';
1401
+ this.SERVICE_URL = '/templates';
1402
+ this.DOC_GEN_URL_FALLBACK = 'https://dev-dp1.velocpq.com/docgen';
1403
+ this.mapSfQueryResult = function (limit) { return operators.map(function (records) {
1404
+ if (!records.length) {
1405
+ return { _result: 'No Records Found' };
1406
+ }
1407
+ if (limit === 1) {
1408
+ return records[0];
1409
+ }
1410
+ return records;
1411
+ }); };
1412
+ this.mapBooleanIfAplicable = function (value) {
1413
+ if (value === 'true') {
1414
+ return true;
1415
+ }
1416
+ if (value === 'false') {
1417
+ return false;
1418
+ }
1419
+ return value;
1420
+ };
1421
+ if (window.VELO_DOCGEN_API) {
1422
+ this.DOC_GEN_URL = window.VELO_DOCGEN_API;
1423
+ }
1424
+ else {
1425
+ console.log("window.VELO_DOCGEN_API not set, will use fallback \"" + this.DOC_GEN_URL_FALLBACK + "\"");
1426
+ this.DOC_GEN_URL = this.DOC_GEN_URL_FALLBACK;
1427
+ }
1428
+ }
1429
+ DocumentTemplatesApiService.prototype.getTemplates = function (tag) {
1430
+ return this.service.api({
1431
+ url: "" + this.SERVICE_URL,
1432
+ method: 'get',
1433
+ params: Object.assign({}, (tag && { tag: tag })),
1434
+ });
1435
+ };
1436
+ DocumentTemplatesApiService.prototype.getTemplate = function (id) {
1437
+ return this.service.api({
1438
+ url: this.SERVICE_URL + "/" + id,
1439
+ method: 'get',
1440
+ });
1441
+ };
1442
+ DocumentTemplatesApiService.prototype.upsertTemplate = function (template, file, reportProgress) {
1443
+ var formData = new FormData();
1444
+ if (file) {
1445
+ formData.append('file', file, file.name);
1446
+ }
1447
+ formData.append('template', new Blob([JSON.stringify(template)], {
1448
+ type: 'application/json',
1449
+ }));
1450
+ var url = "" + this.SERVICE_URL;
1451
+ if (template.id) {
1452
+ url += "/" + template.id;
1453
+ }
1454
+ return this.service.upload({
1455
+ url: url,
1456
+ body: formData,
1457
+ method: template.id ? 'put' : 'post',
1458
+ reportProgress: reportProgress,
1459
+ });
1460
+ };
1461
+ DocumentTemplatesApiService.prototype.removeTemplate = function (id) {
1462
+ return this.service.api({
1463
+ url: this.SERVICE_URL + "/" + id,
1464
+ method: 'delete',
1465
+ });
1466
+ };
1467
+ DocumentTemplatesApiService.prototype.restoreTemplate = function (id) {
1468
+ return this.service.api({
1469
+ url: this.SERVICE_URL + "/" + id + "/restore",
1470
+ method: 'patch',
1471
+ });
1472
+ };
1473
+ DocumentTemplatesApiService.prototype.cloneTemplate = function (id, propertiesToOverride) {
1474
+ if (propertiesToOverride === void 0) { propertiesToOverride = {}; }
1475
+ return this.service.api({
1476
+ url: this.SERVICE_URL + "/clone/" + id,
1477
+ method: 'post',
1478
+ body: {
1479
+ id: id,
1480
+ propertiesToOverride: propertiesToOverride,
1481
+ },
1482
+ });
1483
+ };
1484
+ DocumentTemplatesApiService.prototype.getTemplateFile = function (id) {
1485
+ return this.service.api({
1486
+ method: 'get',
1487
+ url: this.SERVICE_URL + "/" + id + "/file",
1488
+ responseType: 'arraybuffer',
1489
+ });
1490
+ };
1491
+ DocumentTemplatesApiService.prototype.downloadTemplateFile = function (id) {
1492
+ var _this = this;
1493
+ return this.service
1494
+ .api({
1495
+ url: this.SERVICE_URL + "/" + id + "/file",
1496
+ responseType: 'blob',
1497
+ observe: 'response',
1498
+ })
1499
+ .pipe(operators.tap(function (response) {
1500
+ _this.fileDownloadService.processDownload(response);
1501
+ }), operators.map(function (response) { return response.body || response; }));
1502
+ };
1503
+ DocumentTemplatesApiService.prototype.mergeDocuments = function (document, attachments) {
1504
+ var body = new FormData();
1505
+ attachments.forEach(function (attachment) {
1506
+ body.append('attachments', new Blob([attachment]));
1507
+ });
1508
+ body.append('orderform', document);
1509
+ return this.http.post(this.DOC_GEN_URL + "/documents/merge", body, {
1510
+ responseType: 'arraybuffer',
1511
+ });
1512
+ };
1513
+ DocumentTemplatesApiService.prototype.getAttachments = function (searchRequest) {
1514
+ return this.documentAttachmentService.getAttachments(searchRequest);
1515
+ };
1516
+ DocumentTemplatesApiService.prototype.getAttachmentFile = function (id) {
1517
+ return this.documentAttachmentService.getAttachmentFile(id);
1518
+ };
1519
+ DocumentTemplatesApiService.prototype.createAttachment = function (attachment, file, reportProgress) {
1520
+ return this.documentAttachmentService.createAttachment(attachment, file, reportProgress);
1521
+ };
1522
+ DocumentTemplatesApiService.prototype.removeAttachment = function (id) {
1523
+ return this.documentAttachmentService.removeAttachment(id);
1524
+ };
1525
+ DocumentTemplatesApiService.prototype.generateDocumentData = function (template, object, params) {
1526
+ var _this = this;
1527
+ if (params === void 0) { params = {}; }
1528
+ var _a;
1529
+ if (i1.isLegacyDocumentTemplate(template)) {
1530
+ return this.generateDocumentDataLegacy(template, object, params);
1531
+ }
1532
+ var templateProperties = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, _g) {
1533
+ var _h;
1534
+ var name = _g.name, value = _g.value;
1535
+ return (Object.assign(Object.assign({}, acc), (_h = {}, _h[name] = _this.mapBooleanIfAplicable(value), _h)));
1536
+ }, {});
1537
+ /*
1538
+ Resolve quote and template properties for now
1539
+ When procedures are ready, whey will replace template scripts.
1540
+
1541
+ TODO: run procedure to resolve document data
1542
+ */
1543
+ return rxjs.of(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object: object })), templateProperties));
1544
+ };
1545
+ DocumentTemplatesApiService.prototype.generateDocument = function (template, object, params) {
1546
+ var _this = this;
1547
+ if (params === void 0) { params = {}; }
1548
+ var documentData$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
1549
+ return rxjs.zip(this.getTemplateFile(template.id), documentData$, this.resolveAttachments$(template)).pipe(operators.switchMap(function (_g) {
1550
+ var _h = __read(_g, 3), templateFile = _h[0], data = _h[1], attachments = _h[2];
1551
+ var _a, _b, _c, _d, _e, _f;
1552
+ var document = i1.DocxTemplater.generate(templateFile, data);
1553
+ 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 : {};
1554
+ var documentName = properties.Name || template.name;
1555
+ 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;
1556
+ if (documentFormat === 'DOCX') {
1557
+ _this.fileDownloadService.processDownload(document, documentName);
1558
+ return rxjs.of(document);
1559
+ }
1560
+ return _this.mergeDocuments(document, attachments).pipe(operators.switchMap(function (pdf) {
1561
+ if (params.attachToQuote && i1.QuoteDraft.isQuote(object)) {
1562
+ var file = new File([pdf], documentName + ".pdf");
1563
+ return _this.documentAttachmentService
1564
+ .createAttachment({
1565
+ linkedEntityId: object.quoteId,
1566
+ fileName: documentName,
1567
+ fileExtension: 'pdf',
1568
+ tags: _this.DOCGEN_TAG,
1569
+ }, file)
1570
+ .pipe(operators.map(function () { return pdf; }));
1571
+ }
1572
+ return rxjs.of(pdf);
1573
+ }), operators.map(function (pdf) {
1574
+ var blob = new Blob([pdf]);
1575
+ if (!params.shouldPreventDownload) {
1576
+ _this.fileDownloadService.processDownload(blob, documentName + ".pdf");
1577
+ }
1578
+ return blob;
1579
+ }));
1580
+ }));
1581
+ };
1582
+ DocumentTemplatesApiService.prototype.generateDocumentDataLegacy = function (template, object, params) {
1583
+ var _this = this;
1584
+ if (params === void 0) { params = {}; }
1585
+ var _a, _b, _c, _d;
1586
+ var shouldPreventDownload = params.shouldPreventDownload;
1587
+ var allQueries = __spreadArray([], __read(((_a = template === null || template === void 0 ? void 0 : template.queries) !== null && _a !== void 0 ? _a : [])));
1588
+ 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 : {};
1589
+ var accountId = properties === null || properties === void 0 ? void 0 : properties.AccountId;
1590
+ var userId = properties === null || properties === void 0 ? void 0 : properties.UserId;
1591
+ if (accountId) {
1592
+ allQueries.push({
1593
+ queryName: 'QuoteAccountQuery',
1594
+ objectName: 'Account',
1595
+ resultObjectName: 'account',
1596
+ statement: "Id ='" + accountId + "'",
1597
+ fields: [],
1598
+ });
1599
+ }
1600
+ if (userId) {
1601
+ allQueries.push({
1602
+ queryName: 'QuoteUserQuery',
1603
+ objectName: 'User',
1604
+ resultObjectName: 'agent',
1605
+ statement: "Id ='" + userId + "'",
1606
+ fields: [],
1607
+ });
1608
+ }
1609
+ var queries = allQueries.map(function (query) { return _this.queryObject(query, { properties: properties }); }) || [];
1610
+ return rxjs.forkJoin(__spreadArray([], __read(queries))).pipe(operators.defaultIfEmpty([]), operators.map(function (results) {
1611
+ var _a, _b, _c, _d;
1612
+ var queriesResult = ___namespace.chain(results)
1613
+ .reduce(function (acc, r) {
1614
+ if (r) {
1615
+ return Object.assign(Object.assign({}, acc), r);
1616
+ }
1617
+ return acc;
1618
+ }, {})
1619
+ .value();
1620
+ var templateProperties = ((template === null || template === void 0 ? void 0 : template.properties) || []).reduce(function (trunk, _g) {
1621
+ var _h;
1622
+ var name = _g.name, value = _g.value;
1623
+ return Object.assign(Object.assign({}, trunk), (_h = {}, _h[name] = _this.mapBooleanIfAplicable(value), _h));
1624
+ }, {});
1625
+ var data = Object.assign(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object: object })), queriesResult), templateProperties);
1626
+ if (template.script && template.script.trim().length) {
1627
+ var currencyFormat_1 = ((_b = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.find(function (_g) {
1628
+ var name = _g.name;
1629
+ return name === 'currencyFormat';
1630
+ })) === null || _b === void 0 ? void 0 : _b.value) || '1.2-2';
1631
+ var dateFormat_1 = ((_d = (_c = template.properties) === null || _c === void 0 ? void 0 : _c.find(function (_g) {
1632
+ var name = _g.name;
1633
+ return name === 'dateFormat';
1634
+ })) === null || _d === void 0 ? void 0 : _d.value) || 'D/MMM/YYYY';
1635
+ var formatDate = function (value) {
1636
+ return value ? moment(value).format(dateFormat_1) : value;
1637
+ };
1638
+ var transform = new Function("return " + template.script)();
1639
+ var transformedData = transform(Object.assign(Object.assign({}, data), { utils: {
1640
+ lodash: ___namespace,
1641
+ currency: function (value) { return new common.CurrencyPipe('en-US').transform(value, 'USD', 'symbol', currencyFormat_1); },
1642
+ date: formatDate,
1643
+ }, ToDay: formatDate(Date.now()) }));
1644
+ if (!shouldPreventDownload) {
1645
+ var blob = new Blob([JSON.stringify(transformedData)]);
1646
+ _this.fileDownloadService.processDownload(blob, 'data.json');
1647
+ }
1648
+ return transformedData;
1649
+ }
1650
+ return data;
1651
+ }));
1652
+ };
1653
+ DocumentTemplatesApiService.prototype.resolveAttachments$ = function (template) {
1654
+ var _this = this;
1655
+ var _a, _b;
1656
+ var attachmentIds = (_b = (_a = template.attachments) === null || _a === void 0 ? void 0 : _a.map(function (_g) {
1657
+ var id = _g.id;
1658
+ return id;
1659
+ }).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
1660
+ if (!attachmentIds.length) {
1661
+ return rxjs.of([]);
1662
+ }
1663
+ return rxjs.forkJoin(attachmentIds.map(function (id) { return _this.documentAttachmentService.getAttachmentFile(id, true); }));
1664
+ };
1665
+ DocumentTemplatesApiService.prototype.queryObject = function (_g, _h) {
1666
+ var objectName = _g.objectName, resultObjectName = _g.resultObjectName, fields = _g.fields, statement = _g.statement;
1667
+ var properties = _h.properties;
1668
+ var _a;
1669
+ var patternLimit = /(\s*limit\s\d*)/i;
1670
+ var limit = 1;
1671
+ if (statement && patternLimit.test(statement)) {
1672
+ 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();
1673
+ if (limitStr) {
1674
+ limit = Number.parseInt(limitStr, 10);
1675
+ }
1676
+ statement = statement.replace(patternLimit, '');
1677
+ }
1678
+ var resolvedStatement = statement
1679
+ ? i1.StringUtils.fillPlaceholders(statement, properties, /:\s*(\w[\w\d_.]+)/i)
1680
+ : undefined;
1681
+ var searchRequest = Object.assign({ skip: 0, count: limit, rawCondition: resolvedStatement }, ((fields === null || fields === void 0 ? void 0 : fields.length) && !!fields[0] && { fields: fields }));
1682
+ return this.salesforceApiService.query(searchRequest, objectName).pipe(this.mapSfQueryResult(limit), operators.map(function (value) {
1683
+ var _g;
1684
+ return (_g = {}, _g[resultObjectName] = value, _g);
1685
+ }));
1686
+ };
1687
+ return DocumentTemplatesApiService;
1688
+ }());
1689
+ DocumentTemplatesApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", 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 });
1690
+ DocumentTemplatesApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DocumentTemplatesApiService });
1691
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DocumentTemplatesApiService, decorators: [{
1692
+ type: i0.Injectable
1693
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }, { type: SalesforceApiService }, { type: i1__namespace.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i4__namespace.HttpClient }]; } });
1694
+
1695
+ var FlowsApiService = /** @class */ (function () {
1696
+ function FlowsApiService(configurationSettingsApiService) {
1697
+ this.configurationSettingsApiService = configurationSettingsApiService;
1698
+ this.flowsKey = 'flows';
1699
+ }
1700
+ FlowsApiService.prototype.getFlow = function (id) {
1701
+ return this.fetchFlows().pipe(operators.map(function (flows) { return flows.find(function (flow) { return flow.id == id; }); }));
1702
+ };
1703
+ FlowsApiService.prototype.fetchFlows = function () {
1704
+ return this.configurationSettingsApiService
1705
+ .fetchSetting(this.flowsKey)
1706
+ .pipe(operators.map(function (flow) { return ((flow === null || flow === void 0 ? void 0 : flow.value) ? JSON.parse(flow.value) : []); }));
1707
+ };
1708
+ return FlowsApiService;
1709
+ }());
1710
+ FlowsApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1711
+ FlowsApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowsApiService });
1712
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowsApiService, decorators: [{
1713
+ type: i0.Injectable
1714
+ }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
1715
+
1716
+ var PicklistsApiService = /** @class */ (function () {
1717
+ function PicklistsApiService(baseHttpService) {
1718
+ var _this = this;
1719
+ this.baseHttpService = baseHttpService;
1720
+ this.serviceUrl = '/admin';
1721
+ this.fetchAllPicklists$ = function () { return _this.baseHttpService.api({ url: _this.serviceUrl + "/picklists" }); };
1722
+ this.fetchPicklist$ = function (code) { return _this.baseHttpService.api({ url: _this.serviceUrl + "/picklists/" + code }); };
1723
+ this.createPicklist$ = function (picklist) {
1724
+ return _this.baseHttpService.api({ method: 'post', url: _this.serviceUrl + "/picklists", body: picklist });
1725
+ };
1726
+ this.updatePicklist$ = function (picklist) {
1727
+ return _this.baseHttpService.api({
1728
+ method: 'put',
1729
+ url: _this.serviceUrl + "/picklists/" + picklist.id,
1730
+ body: picklist,
1731
+ });
1732
+ };
1733
+ this.removePicklist$ = function (id) { return _this.baseHttpService.api({ method: 'delete', url: _this.serviceUrl + "/picklists/" + id }); };
1734
+ this.restorePicklist$ = function (id) {
1735
+ return _this.baseHttpService.api({
1736
+ url: _this.serviceUrl + "/picklists/" + id + "/restore",
1737
+ method: 'patch',
1738
+ });
1739
+ };
1740
+ this.addPicklistValue$ = function (picklist, value) {
1741
+ var data = Object.assign(Object.assign({}, picklist), { values: __spreadArray(__spreadArray([], __read(picklist.values)), [value]) });
1742
+ return _this.baseHttpService.api({ method: 'put', url: _this.serviceUrl + "/picklists/" + picklist.id, body: data });
1743
+ };
1744
+ }
1745
+ return PicklistsApiService;
1746
+ }());
1747
+ PicklistsApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PicklistsApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1748
+ PicklistsApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PicklistsApiService });
1749
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PicklistsApiService, decorators: [{
1750
+ type: i0.Injectable
1751
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1752
+
1753
+ var PriceApiService = /** @class */ (function () {
1754
+ function PriceApiService(httpService) {
1755
+ this.httpService = httpService;
1756
+ this.SERVICE_URL = '/price';
1757
+ }
1758
+ PriceApiService.prototype.calculate = function (request) {
1759
+ return this.httpService.api({
1760
+ method: 'post',
1761
+ url: this.SERVICE_URL + "/calculate",
1762
+ body: request,
1763
+ skipErrorHandler: true,
1764
+ });
1765
+ };
1766
+ PriceApiService.prototype.getPriceLists = function () {
1767
+ return this.httpService.api({
1768
+ method: 'get',
1769
+ url: '/price-lists',
1770
+ });
1771
+ };
1772
+ PriceApiService.prototype.getPriceList = function (id) {
1773
+ return this.httpService.api({
1774
+ method: 'get',
1775
+ url: "/price-lists/" + id,
1776
+ });
1777
+ };
1778
+ PriceApiService.prototype.getSellingTermByEndDate = function (planId, offeringId, startDate, endDate, frequencyUnit, frequencyDuration) {
1779
+ return this.httpService.api({
1780
+ method: 'post',
1781
+ url: this.SERVICE_URL + "/selling-term-by-end-date",
1782
+ body: {
1783
+ planId: planId,
1784
+ offeringId: offeringId,
1785
+ startDate: startDate,
1786
+ endDate: endDate,
1787
+ frequencyUnit: frequencyUnit,
1788
+ frequencyDuration: frequencyDuration,
1789
+ },
1790
+ });
1791
+ };
1792
+ PriceApiService.prototype.getSellingTermByTerm = function (planId, offeringId, startDate, term, frequencyUnit, frequencyDuration) {
1793
+ return this.httpService.api({
1794
+ method: 'post',
1795
+ url: this.SERVICE_URL + "/selling-term-by-term",
1796
+ body: {
1797
+ planId: planId,
1798
+ offeringId: offeringId,
1799
+ startDate: startDate,
1800
+ term: term,
1801
+ frequencyUnit: frequencyUnit,
1802
+ frequencyDuration: frequencyDuration,
1803
+ },
1804
+ });
1805
+ };
1806
+ return PriceApiService;
1807
+ }());
1808
+ PriceApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PriceApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1809
+ PriceApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PriceApiService });
1810
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PriceApiService, decorators: [{
1811
+ type: i0.Injectable
1812
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1813
+
1814
+ var ProceduresApiService = /** @class */ (function () {
1815
+ function ProceduresApiService(baseHttpService) {
1816
+ var _this = this;
1817
+ this.baseHttpService = baseHttpService;
1818
+ this.ADMIN_SERVICE_URL = '/admin/procedures';
1819
+ this.SERVICE_URL = '/procedures';
1820
+ this.fetchProcedures$ = function () {
1821
+ return _this.searchProcedures$(new i1.Expression(), 0, 100);
1822
+ };
1823
+ this.searchProcedures$ = function (expression, skip, count) {
1824
+ var params = new i4.HttpParams();
1825
+ params = params.set('skip', '' + skip);
1826
+ params = params.set('count', '' + count);
1827
+ return _this.baseHttpService.api({
1828
+ method: 'post',
1829
+ url: _this.ADMIN_SERVICE_URL + "/search",
1830
+ params: params,
1831
+ body: expression,
1832
+ });
1833
+ };
1834
+ this.createProcedure$ = function (newProcedure) {
1835
+ return _this.baseHttpService.api({
1836
+ url: "" + _this.ADMIN_SERVICE_URL,
1837
+ method: 'post',
1838
+ body: newProcedure,
1839
+ });
1840
+ };
1841
+ this.updateProcedure$ = function (procedure) {
1842
+ return _this.baseHttpService.api({
1843
+ url: _this.ADMIN_SERVICE_URL + "/" + procedure.id,
1844
+ method: 'put',
1845
+ body: procedure,
1846
+ });
1847
+ };
1848
+ this.duplicateProcedure$ = function (body) {
1849
+ return _this.baseHttpService
1850
+ .api({
1851
+ url: _this.ADMIN_SERVICE_URL + "/" + body.id + "/clone",
1852
+ method: 'post',
1853
+ body: body,
1854
+ })
1855
+ .pipe(operators.map(function (response) { return response.clonedRecordId; }));
1856
+ };
1857
+ this.removeProcedure$ = function (id) {
1858
+ return _this.baseHttpService.api({
1859
+ url: _this.ADMIN_SERVICE_URL + "/" + id,
1860
+ method: 'delete',
1861
+ });
1862
+ };
1863
+ this.restoreProcedure$ = function (id) {
1864
+ return _this.baseHttpService.api({
1865
+ url: _this.ADMIN_SERVICE_URL + "/" + id + "/restore",
1866
+ method: 'patch',
1867
+ });
1868
+ };
1869
+ }
1870
+ ProceduresApiService.prototype.fetchProcedure$ = function (id) {
1871
+ return this.baseHttpService.api({
1872
+ url: this.ADMIN_SERVICE_URL + "/" + id,
1873
+ method: 'get',
1874
+ });
1875
+ };
1876
+ ProceduresApiService.prototype.execute$ = function (body) {
1877
+ return this.baseHttpService.api({
1878
+ url: this.SERVICE_URL + "/execute",
1879
+ method: 'post',
1880
+ body: body,
1881
+ });
1882
+ };
1883
+ /**
1884
+ * Run active procedure against QuoteDraft
1885
+ * @param body
1886
+ * @returns
1887
+ */
1888
+ ProceduresApiService.prototype.apply$ = function (body) {
1889
+ return this.baseHttpService.api({
1890
+ url: this.SERVICE_URL + "/apply",
1891
+ method: 'post',
1892
+ body: body,
1893
+ });
1894
+ };
1895
+ return ProceduresApiService;
1896
+ }());
1897
+ ProceduresApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProceduresApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1898
+ ProceduresApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProceduresApiService });
1899
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProceduresApiService, decorators: [{
1900
+ type: i0.Injectable
1901
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1902
+
1903
+ var ProductApiService = /** @class */ (function () {
1904
+ function ProductApiService(baseHttpService) {
1905
+ var _this = this;
1906
+ this.baseHttpService = baseHttpService;
1907
+ this.serviceUrl = '/products';
1908
+ this.fetchProducts$ = function (payload) {
1909
+ var params = new i4.HttpParams();
1910
+ params = params.append('count', payload.count);
1911
+ params = params.append('skip', payload.skip);
1912
+ if (payload.name) {
1913
+ params = params.append('name', payload.name);
1914
+ }
1915
+ return _this.baseHttpService.api({ url: "" + _this.serviceUrl, params: params });
1916
+ };
1917
+ this.searchProducts$ = function (expression, skip, count) {
1918
+ var params = new i4.HttpParams();
1919
+ params = params.set('skip', '' + skip);
1920
+ params = params.set('count', '' + count);
1921
+ return _this.baseHttpService.api({
1922
+ method: 'post',
1923
+ url: _this.serviceUrl + "/search",
1924
+ params: params,
1925
+ body: expression,
1926
+ });
1927
+ };
1928
+ this.fetchProduct$ = function (id) { return _this.baseHttpService.api({ url: _this.serviceUrl + "/" + id }); };
1929
+ this.fetchAttributes$ = function () {
1930
+ return _this.baseHttpService.api({ url: _this.serviceUrl + "/attributes/definition" });
1931
+ };
1932
+ this.searchAttributes$ = function (expression, skip, count) {
1933
+ var params = new i4.HttpParams();
1934
+ params = params.set('skip', '' + skip);
1935
+ params = params.set('count', '' + count);
1936
+ return _this.baseHttpService.api({
1937
+ method: 'post',
1938
+ url: _this.serviceUrl + "/attributes/definition/search",
1939
+ params: params,
1940
+ body: expression,
1941
+ });
1942
+ };
1943
+ this.fetchAttributesByModel = function (modelId) {
1944
+ return _this.baseHttpService.api({ url: _this.serviceUrl + "/attributes/definition/forModel/" + modelId });
1945
+ };
1946
+ this.createNewProduct$ = function (productData) {
1947
+ return _this.baseHttpService.api({
1948
+ url: "" + _this.serviceUrl,
1949
+ method: 'post',
1950
+ body: productData,
1951
+ });
1952
+ };
1953
+ this.updateProduct$ = function (body) {
1954
+ return _this.baseHttpService.api({
1955
+ url: _this.serviceUrl + "/" + body.id,
1956
+ method: 'put',
1957
+ body: body,
1958
+ });
1959
+ };
1960
+ this.removeProduct$ = function (id) {
1961
+ return _this.baseHttpService.api({
1962
+ url: _this.serviceUrl + "/" + id,
1963
+ method: 'delete',
1964
+ });
1965
+ };
1966
+ this.restoreProduct$ = function (id) {
1967
+ return _this.baseHttpService.api({
1968
+ url: _this.serviceUrl + "/" + id + "/restore",
1969
+ method: 'patch',
1970
+ });
1971
+ };
1972
+ this.createProductAttribute$ = function (attributeData) {
1973
+ return _this.baseHttpService.api({
1974
+ url: _this.serviceUrl + "/attributes",
1975
+ method: 'post',
1976
+ body: attributeData,
1977
+ });
1978
+ };
1979
+ this.updateProductAttribute$ = function (attributeData) {
1980
+ return _this.baseHttpService.api({
1981
+ url: _this.serviceUrl + "/attributes/" + attributeData.id,
1982
+ method: 'put',
1983
+ body: attributeData,
1984
+ });
1985
+ };
1986
+ this.removeProductAttribute$ = function (id) {
1987
+ return _this.baseHttpService.api({
1988
+ url: _this.serviceUrl + "/attributes/" + id,
1989
+ method: 'delete',
1990
+ });
1991
+ };
1992
+ this.createNewAttribute$ = function (attributeData) {
1993
+ return _this.baseHttpService.api({
1994
+ url: _this.serviceUrl + "/attributes/definition",
1995
+ method: 'post',
1996
+ body: attributeData,
1997
+ });
1998
+ };
1999
+ this.updateAttribute$ = function (body) {
2000
+ return _this.baseHttpService.api({
2001
+ url: _this.serviceUrl + "/attributes/definition/" + body.id,
2002
+ method: 'put',
2003
+ body: body,
2004
+ });
2005
+ };
2006
+ this.removeAttribute$ = function (id) {
2007
+ return _this.baseHttpService.api({
2008
+ url: _this.serviceUrl + "/attributes/definition/" + id,
2009
+ method: 'delete',
2010
+ });
2011
+ };
2012
+ this.restoreAttribute$ = function (id) {
2013
+ return _this.baseHttpService.api({
2014
+ url: _this.serviceUrl + "/attributes/definition/" + id + "/restore",
2015
+ method: 'patch',
2016
+ });
2017
+ };
2018
+ }
2019
+ ProductApiService.prototype.attachImage$ = function (productId, file) {
2020
+ var data = new FormData();
2021
+ data.append('image', file);
2022
+ return this.baseHttpService.upload({
2023
+ method: 'post',
2024
+ url: this.serviceUrl + "/" + productId + "/image",
2025
+ body: data,
2026
+ });
2027
+ };
2028
+ ProductApiService.prototype.removeImage$ = function (productId) {
2029
+ return this.baseHttpService.api({
2030
+ method: 'delete',
2031
+ url: this.serviceUrl + "/" + productId + "/image",
2032
+ });
2033
+ };
2034
+ ProductApiService.prototype.fetchImage$ = function (productId) {
2035
+ return this.baseHttpService.api({
2036
+ url: this.getImageUrl(productId),
2037
+ method: 'get',
2038
+ responseType: 'blob',
2039
+ errorHandler: rxjs.noop,
2040
+ });
2041
+ };
2042
+ ProductApiService.prototype.getImageUrl = function (productId) {
2043
+ return this.serviceUrl + "/" + productId + "/image";
2044
+ };
2045
+ return ProductApiService;
2046
+ }());
2047
+ ProductApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2048
+ ProductApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductApiService });
2049
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductApiService, decorators: [{
2050
+ type: i0.Injectable
2051
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2052
+
2053
+ var ProductModelApiService = /** @class */ (function () {
2054
+ function ProductModelApiService(httpService) {
2055
+ this.httpService = httpService;
2056
+ this.SERVICE_URL = '/models';
2057
+ }
2058
+ ProductModelApiService.prototype.addModel = function (model) {
2059
+ return this.httpService
2060
+ .api({
2061
+ method: 'post',
2062
+ url: this.SERVICE_URL,
2063
+ body: model,
2064
+ errorHandler: this.httpService.handleValidationError,
2065
+ })
2066
+ .pipe(operators.map(function (result) {
2067
+ if (result.successful) {
2068
+ return result;
2069
+ }
2070
+ else {
2071
+ throw new Error(result.message);
2072
+ }
2073
+ }));
2074
+ };
2075
+ ProductModelApiService.prototype.releaseModel = function (model) {
2076
+ return this.httpService
2077
+ .api({
2078
+ method: 'put',
2079
+ url: this.SERVICE_URL + "/" + model.id + "/release",
2080
+ body: model,
2081
+ errorHandler: this.httpService.handleValidationError,
2082
+ })
2083
+ .pipe(operators.map(function (result) {
2084
+ if (result.successful) {
2085
+ return '';
2086
+ }
2087
+ else {
2088
+ throw new Error(result.message);
2089
+ }
2090
+ }));
2091
+ };
2092
+ ProductModelApiService.prototype.removeModel = function (modelId, successFn, failureFn) {
2093
+ var observable = this.httpService
2094
+ .api({
2095
+ method: 'delete',
2096
+ url: this.SERVICE_URL + "/" + modelId,
2097
+ errorHandler: this.httpService.handleValidationError,
2098
+ })
2099
+ .pipe(operators.map(function (result) {
2100
+ if (result.successful) {
2101
+ return '';
2102
+ }
2103
+ else {
2104
+ throw new Error(result.message);
2105
+ }
2106
+ }));
2107
+ observable.subscribe(function () {
2108
+ successFn && successFn.apply();
2109
+ }, function () {
2110
+ failureFn && failureFn.apply();
2111
+ });
2112
+ };
2113
+ ProductModelApiService.prototype.getModelVersions = function (modelId, count, skip) {
2114
+ if (count === void 0) { count = 100; }
2115
+ if (skip === void 0) { skip = 0; }
2116
+ return this.httpService.api({
2117
+ method: 'post',
2118
+ url: this.SERVICE_URL + "/" + modelId + "/versions",
2119
+ body: {
2120
+ skipCount: skip,
2121
+ count: count,
2122
+ },
2123
+ });
2124
+ };
2125
+ ProductModelApiService.prototype.getModel = function (id, version) {
2126
+ var url = this.SERVICE_URL + "/" + id;
2127
+ if (version) {
2128
+ url += "/versions/" + version;
2129
+ }
2130
+ return this.httpService.api({ url: url });
2131
+ };
2132
+ ProductModelApiService.prototype.getModels = function (skipCount, searchText) {
2133
+ return this.httpService.api({
2134
+ method: 'post',
2135
+ url: this.SERVICE_URL + "/search",
2136
+ body: {
2137
+ nameRegex: searchText,
2138
+ skipCount: skipCount.toString(),
2139
+ count: ProductModelApiService.MAX_RESULTS,
2140
+ },
2141
+ });
2142
+ };
2143
+ ProductModelApiService.prototype.getLinkedModels = function (id, version) {
2144
+ var url = this.SERVICE_URL + "/" + id;
2145
+ if (version) {
2146
+ url += "/versions/" + version;
2147
+ }
2148
+ url += '/linked';
2149
+ return this.httpService.api({ url: url }).pipe(operators.map(function (linkedModels) {
2150
+ if (linkedModels) {
2151
+ linkedModels.forEach(function (model) { return i1.ModelTranslatorUtils.toLocalModel(model); });
2152
+ }
2153
+ return linkedModels;
2154
+ }));
2155
+ };
2156
+ ProductModelApiService.prototype.load = function (id, version) {
2157
+ return rxjs.forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(operators.map(function (_a) {
2158
+ var _b = __read(_a, 2), model = _b[0], linkedModels = _b[1];
2159
+ var container = new i1.ProductModelsContainer(model, linkedModels !== null && linkedModels !== void 0 ? linkedModels : []);
2160
+ i1.ModelUtils.override(container.main, container.linked);
2161
+ i1.ModelTranslatorUtils.toLocalModel(container.main, container.linked);
2162
+ return container;
2163
+ }));
2164
+ };
2165
+ ProductModelApiService.prototype.getPML = function (modelId, version) {
2166
+ var url = this.SERVICE_URL + "/" + modelId + "/pml/" + version;
2167
+ if (version) {
2168
+ url += "/versions/" + version;
2169
+ }
2170
+ return this.httpService.api({
2171
+ url: url,
2172
+ responseType: 'text',
2173
+ });
2174
+ };
2175
+ ProductModelApiService.prototype.savePML = function (modelId, pml, comment) {
2176
+ return this.httpService
2177
+ .api({
2178
+ method: 'put',
2179
+ url: this.SERVICE_URL + "/" + modelId + "/pml",
2180
+ body: {
2181
+ id: modelId,
2182
+ pml: pml,
2183
+ comment: comment,
2184
+ },
2185
+ })
2186
+ .pipe(operators.map(function (result) {
2187
+ if (result.successful) {
2188
+ return '';
2189
+ }
2190
+ else {
2191
+ throw new Error(result.message);
2192
+ }
2193
+ }), operators.catchError(this.httpService.handleValidationError));
2194
+ };
2195
+ ProductModelApiService.prototype.generateProducts = function (modelId) {
2196
+ return this.httpService.api({
2197
+ url: this.SERVICE_URL + "/" + modelId + "/generate-products",
2198
+ });
2199
+ };
2200
+ ProductModelApiService.prototype.saveModel = function (productModel, comment) {
2201
+ var model = i1.EntityUtil.clone(productModel);
2202
+ model.comment = comment;
2203
+ i1.ModelTranslatorUtils.toServerModel(model);
2204
+ return this.httpService
2205
+ .api({
2206
+ method: 'put',
2207
+ url: this.SERVICE_URL + "/" + model.id,
2208
+ body: model,
2209
+ })
2210
+ .pipe(operators.map(function (result) {
2211
+ if (result.successful) {
2212
+ return '';
2213
+ }
2214
+ else {
2215
+ throw new Error(result.message);
2216
+ }
2217
+ }), operators.catchError(this.httpService.handleValidationError));
2218
+ };
2219
+ ProductModelApiService.prototype.validateModel = function (productModel) {
2220
+ return this.httpService
2221
+ .api({
2222
+ method: 'post',
2223
+ url: this.SERVICE_URL + "/validate",
2224
+ body: productModel,
2225
+ errorHandler: this.httpService.handleValidationError,
2226
+ })
2227
+ .pipe(operators.map(function (result) {
2228
+ if (result.successful) {
2229
+ return '';
2230
+ }
2231
+ else {
2232
+ throw new Error(result.message);
2233
+ }
2234
+ }));
2235
+ };
2236
+ ProductModelApiService.prototype.renameModel = function (productModel, name) {
2237
+ var model = i1.EntityUtil.clone(productModel);
2238
+ model.name = name;
2239
+ i1.ModelTranslatorUtils.toServerModel(model);
2240
+ return this.httpService
2241
+ .api({
2242
+ method: 'patch',
2243
+ url: this.SERVICE_URL + "/" + model.id,
2244
+ body: model,
2245
+ })
2246
+ .pipe(operators.catchError(this.httpService.handleValidationError));
2247
+ };
2248
+ ProductModelApiService.prototype.uploadPmlFile = function (file, modelId) {
2249
+ var formData = new FormData();
2250
+ formData.append('file', file, file.name);
2251
+ return this.httpService.upload({
2252
+ url: this.SERVICE_URL + "/" + modelId + "/pml/upload",
2253
+ body: formData,
2254
+ });
2255
+ };
2256
+ ProductModelApiService.prototype.runPml = function (modelId, pml, rootType, configurationMode) {
2257
+ return this.httpService.api({
2258
+ method: 'post',
2259
+ url: this.SERVICE_URL + "/" + modelId + "/pml/run",
2260
+ body: {
2261
+ pml: pml,
2262
+ rootType: rootType,
2263
+ configurationMode: configurationMode,
2264
+ },
2265
+ responseType: 'text',
2266
+ });
2267
+ };
2268
+ ProductModelApiService.prototype.evictAllCache = function () {
2269
+ return this.httpService.api({
2270
+ method: 'get',
2271
+ url: '/cache/evict/environment-variables',
2272
+ });
2273
+ };
2274
+ return ProductModelApiService;
2275
+ }());
2276
+ ProductModelApiService.MAX_RESULTS = 200;
2277
+ ProductModelApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductModelApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2278
+ ProductModelApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductModelApiService });
2279
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductModelApiService, decorators: [{
2280
+ type: i0.Injectable
2281
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2282
+
2283
+ var QuoteApiService = /** @class */ (function () {
2284
+ function QuoteApiService(httpService) {
2285
+ this.httpService = httpService;
2286
+ this.SERVICE_URL = '/quotes';
2287
+ /**
2288
+ * @deprecated
2289
+ * Will be removed in next major release
2290
+ * Use `getQuoteDraft` instead
2291
+ */
2292
+ // eslint-disable-next-line @typescript-eslint/member-ordering
2293
+ this.getQuote = this.getQuoteDraft;
2294
+ }
2295
+ // request quoteId | accountId | opportunityId | orderId
2296
+ QuoteApiService.prototype.getQuoteDraft = function (objectId, params, errorHandler) {
2297
+ return this.httpService.api({
2298
+ method: 'get',
2299
+ url: this.SERVICE_URL + "/" + objectId,
2300
+ params: params,
2301
+ errorHandler: errorHandler,
2302
+ });
2303
+ };
2304
+ QuoteApiService.prototype.upsertQuote = function (request, options) {
2305
+ return this.httpService.api(Object.assign({ method: 'post', url: "" + this.SERVICE_URL, body: request }, options));
2306
+ };
2307
+ QuoteApiService.prototype.submitQuote = function (request, options) {
2308
+ return this.httpService.api(Object.assign({ method: 'post', url: this.SERVICE_URL + "/submit", body: request }, options));
2309
+ };
2310
+ QuoteApiService.prototype.attachDocument = function (id, documentName, data) {
2311
+ var formData = new FormData();
2312
+ var blob = new Blob([data]);
2313
+ formData.append('file', blob, documentName);
2314
+ return this.httpService.upload({
2315
+ url: this.SERVICE_URL + "/" + id + "/attach-document",
2316
+ responseType: 'arraybuffer',
2317
+ method: 'post',
2318
+ body: formData,
2319
+ });
2320
+ };
2321
+ return QuoteApiService;
2322
+ }());
2323
+ QuoteApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2324
+ QuoteApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteApiService });
2325
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteApiService, decorators: [{
2326
+ type: i0.Injectable
2327
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2328
+
2329
+ var RampApiService = /** @class */ (function () {
2330
+ function RampApiService(httpService) {
2331
+ this.httpService = httpService;
2332
+ this.SERVICE_URL = '/ramp';
2333
+ }
2334
+ RampApiService.prototype.next = function (request, options) {
2335
+ return this.httpService.api(Object.assign({ method: 'post', url: this.SERVICE_URL + "/next", body: request }, options));
2336
+ };
2337
+ RampApiService.prototype.renew = function (request, options) {
2338
+ return this.httpService.api(Object.assign({ method: 'post', url: this.SERVICE_URL + "/renew", body: request }, options));
2339
+ };
2340
+ return RampApiService;
2341
+ }());
2342
+ RampApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RampApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2343
+ RampApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RampApiService });
2344
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RampApiService, decorators: [{
2345
+ type: i0.Injectable
2346
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2347
+
2348
+ var RuleGroupsApiService = /** @class */ (function () {
2349
+ function RuleGroupsApiService(baseHttpService) {
2350
+ var _this = this;
2351
+ this.baseHttpService = baseHttpService;
2352
+ this.serviceUrl = '/admin/rule-groups';
2353
+ this.fetchRuleGroups$ = function () {
2354
+ return _this.searchRuleGroups$(new i1.Expression(), 0, 100);
2355
+ };
2356
+ this.searchRuleGroups$ = function (expression, skip, count) {
2357
+ var params = new i4.HttpParams();
2358
+ params = params.set('skip', '' + skip);
2359
+ params = params.set('count', '' + count);
2360
+ return _this.baseHttpService.api({ method: 'post', url: _this.serviceUrl + "/search", params: params, body: expression });
2361
+ };
2362
+ this.createRuleGroup$ = function (ruleGroup) {
2363
+ return _this.baseHttpService.api({
2364
+ url: "" + _this.serviceUrl,
2365
+ method: 'post',
2366
+ body: ruleGroup,
2367
+ });
2368
+ };
2369
+ this.updateRuleGroup$ = function (ruleGroup) {
2370
+ return _this.baseHttpService.api({
2371
+ url: _this.serviceUrl + "/" + ruleGroup.id,
2372
+ method: 'post',
2373
+ body: ruleGroup,
2374
+ });
2375
+ };
2376
+ this.duplicateRuleGroup$ = function (body) {
2377
+ return _this.baseHttpService
2378
+ .api({
2379
+ url: _this.serviceUrl + "/" + body.id + "/clone",
2380
+ method: 'post',
2381
+ body: body,
2382
+ })
2383
+ .pipe(rxjs.map(function (response) { return response.clonedRecordId; }));
2384
+ };
2385
+ this.removeRuleGroup$ = function (id) {
2386
+ return _this.baseHttpService.api({
2387
+ url: _this.serviceUrl + "/" + id,
2388
+ method: 'delete',
2389
+ });
2390
+ };
2391
+ this.restoreRuleGroup$ = function (id) {
2392
+ return _this.baseHttpService.api({
2393
+ url: _this.serviceUrl + "/" + id + "/restore",
2394
+ method: 'patch',
2395
+ });
2396
+ };
2397
+ }
2398
+ return RuleGroupsApiService;
2399
+ }());
2400
+ RuleGroupsApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuleGroupsApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2401
+ RuleGroupsApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuleGroupsApiService });
2402
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuleGroupsApiService, decorators: [{
2403
+ type: i0.Injectable
2404
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2405
+
2406
+ var RulesApiService = /** @class */ (function () {
2407
+ function RulesApiService(baseHttpService) {
2408
+ var _this = this;
2409
+ this.baseHttpService = baseHttpService;
2410
+ this.serviceUrl = '/admin/rules';
2411
+ this.fetchRules$ = function () {
2412
+ return _this.searchRules$(new i1.Expression(), 0, 100);
2413
+ };
2414
+ this.searchRules$ = function (expression, skip, count) {
2415
+ var params = new i4.HttpParams();
2416
+ params = params.set('skip', '' + skip);
2417
+ params = params.set('count', '' + count);
2418
+ return _this.baseHttpService.api({ method: 'post', url: _this.serviceUrl + "/search", params: params, body: expression });
2419
+ };
2420
+ this.createRule$ = function (rule) {
2421
+ return _this.baseHttpService.api({
2422
+ url: "" + _this.serviceUrl,
2423
+ method: 'post',
2424
+ body: rule,
2425
+ });
2426
+ };
2427
+ this.updateRule$ = function (rule) {
2428
+ return _this.baseHttpService.api({
2429
+ url: _this.serviceUrl + "/" + rule.id,
2430
+ method: 'put',
2431
+ body: rule,
2432
+ });
2433
+ };
2434
+ this.duplicateRule$ = function (body) {
2435
+ return _this.baseHttpService
2436
+ .api({
2437
+ url: _this.serviceUrl + "/" + body.id + "/clone",
2438
+ method: 'post',
2439
+ body: body,
2440
+ })
2441
+ .pipe(operators.map(function (response) { return response.clonedRecordId; }));
2442
+ };
2443
+ this.removeRule$ = function (id) {
2444
+ return _this.baseHttpService.api({
2445
+ url: _this.serviceUrl + "/" + id,
2446
+ method: 'delete',
2447
+ });
2448
+ };
2449
+ this.restoreRule$ = function (id) {
2450
+ return _this.baseHttpService.api({
2451
+ url: _this.serviceUrl + "/" + id + "/restore",
2452
+ method: 'patch',
2453
+ });
2454
+ };
2455
+ }
2456
+ RulesApiService.prototype.fetchRule$ = function (id) {
2457
+ return this.baseHttpService.api({
2458
+ url: this.serviceUrl + "/" + id,
2459
+ method: 'get',
2460
+ });
2461
+ };
2462
+ RulesApiService.prototype.fetchHeaderFields$ = function () {
2463
+ return this.baseHttpService.api({
2464
+ url: this.serviceUrl + "/describe/Header",
2465
+ method: 'get',
2466
+ });
2467
+ };
2468
+ RulesApiService.prototype.execute$ = function (body) {
2469
+ return this.baseHttpService.api({
2470
+ url: "/rules/execute",
2471
+ method: 'post',
2472
+ body: body,
2473
+ });
2474
+ };
2475
+ return RulesApiService;
2476
+ }());
2477
+ RulesApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RulesApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2478
+ RulesApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RulesApiService });
2479
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RulesApiService, decorators: [{
2480
+ type: i0.Injectable
2481
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2482
+
2483
+ var ScriptsApiService = /** @class */ (function () {
2484
+ function ScriptsApiService(baseHttpService) {
2485
+ var _this = this;
2486
+ this.baseHttpService = baseHttpService;
2487
+ this.serviceUrl = '/admin/scripts';
2488
+ this.fetchScripts$ = function () {
2489
+ return _this.baseHttpService.api({ url: "" + _this.serviceUrl });
2490
+ };
2491
+ this.searchScripts$ = function (expression, skip, count) {
2492
+ var params = new i4.HttpParams();
2493
+ params = params.set('skip', '' + skip);
2494
+ params = params.set('count', '' + count);
2495
+ return _this.baseHttpService.api({ method: 'post', url: _this.serviceUrl + "/search", params: params, body: expression });
2496
+ };
2497
+ this.fetchScript$ = function (id) {
2498
+ return _this.baseHttpService.api({ url: _this.serviceUrl + "/" + id });
2499
+ };
2500
+ this.createScript$ = function (script) {
2501
+ return _this.baseHttpService.api({
2502
+ url: "" + _this.serviceUrl,
2503
+ method: 'post',
2504
+ body: script,
2505
+ });
2506
+ };
2507
+ this.updateScriptMeta$ = function (script) {
2508
+ return _this.baseHttpService.api({
2509
+ url: _this.serviceUrl + "/" + script.id,
2510
+ method: 'put',
2511
+ body: script,
2512
+ });
2513
+ };
2514
+ this.updateScriptDetails$ = function (script) {
2515
+ return _this.baseHttpService.api({
2516
+ url: _this.serviceUrl + "/" + script.id,
2517
+ method: 'put',
2518
+ body: script,
2519
+ });
2520
+ };
2521
+ this.cloneScript$ = function (cloneRequest) {
2522
+ return _this.baseHttpService.api({
2523
+ url: _this.serviceUrl + "/" + cloneRequest.id + "/clone",
2524
+ method: 'post',
2525
+ body: cloneRequest,
2526
+ });
2527
+ };
2528
+ this.removeScript$ = function (id) {
2529
+ return _this.baseHttpService.api({
2530
+ url: _this.serviceUrl + "/" + id,
2531
+ method: 'delete',
2532
+ });
2533
+ };
2534
+ this.restoreScript$ = function (id) {
2535
+ return _this.baseHttpService.api({
2536
+ url: _this.serviceUrl + "/" + id + "/restore",
2537
+ method: 'patch',
2538
+ });
2539
+ };
2540
+ this.execute$ = function (body) {
2541
+ return _this.baseHttpService.api({
2542
+ url: "/scripts/execute",
2543
+ method: 'post',
2544
+ body: body,
2545
+ errorHandler: function () { return null; },
2546
+ });
2547
+ };
2548
+ }
2549
+ return ScriptsApiService;
2550
+ }());
2551
+ ScriptsApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptsApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2552
+ ScriptsApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptsApiService });
2553
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptsApiService, decorators: [{
2554
+ type: i0.Injectable
2555
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2556
+
2557
+ var fromUIComponentStoryDTO = function (dto, attachments) {
2558
+ return {
2559
+ id: dto.id,
2560
+ name: dto.name,
2561
+ uiComponentId: dto.uiComponentId,
2562
+ description: dto.description,
2563
+ section: attachments.json,
2564
+ template: attachments.html,
2565
+ script: attachments.js,
2566
+ styles: attachments.css,
2567
+ };
2568
+ };
2569
+
2570
+ var UITemplatesApiService = /** @class */ (function () {
2571
+ function UITemplatesApiService(baseHttpService) {
2572
+ var _this = this;
2573
+ this.baseHttpService = baseHttpService;
2574
+ this.serviceUrl = '/uitemplates';
2575
+ this.fetchTemplates$ = function (name) {
2576
+ var params = new i4.HttpParams();
2577
+ if (name) {
2578
+ params = params.append('name', name);
2579
+ }
2580
+ return _this.baseHttpService.api({ url: "" + _this.serviceUrl, params: params });
2581
+ };
2582
+ this.createTemplate$ = function (template) {
2583
+ return _this.baseHttpService.api({
2584
+ method: 'post',
2585
+ url: "" + _this.serviceUrl,
2586
+ body: template,
2587
+ });
2588
+ };
2589
+ this.updateTemplate$ = function (template) {
2590
+ return _this.baseHttpService.api({
2591
+ method: 'put',
2592
+ url: _this.serviceUrl + "/" + template.id,
2593
+ body: template,
2594
+ });
2595
+ };
2596
+ this.duplicateTemplate$ = function (template, cloneRequest) {
2597
+ return _this.baseHttpService
2598
+ .api({
2599
+ url: _this.serviceUrl + "/" + template.id + "/clone",
2600
+ method: 'post',
2601
+ body: cloneRequest,
2602
+ })
2603
+ .pipe(rxjs.map(function (response) { return response.clonedRecordId; }));
2604
+ };
2605
+ this.removeTemplate$ = function (id) {
2606
+ return _this.baseHttpService.api({
2607
+ method: 'delete',
2608
+ url: _this.serviceUrl + "/" + id,
2609
+ });
2610
+ };
2611
+ this.restoreTemplate$ = function (id) {
2612
+ return _this.baseHttpService.api({
2613
+ method: 'patch',
2614
+ url: _this.serviceUrl + "/" + id,
2615
+ });
2616
+ };
2617
+ this.searchTemplates$ = function (data) {
2618
+ return _this.baseHttpService.api({
2619
+ method: 'post',
2620
+ url: _this.serviceUrl + "/search",
2621
+ params: data.params,
2622
+ body: data.expression,
2623
+ });
2624
+ };
2625
+ this.fetchComponents$ = function (templateId, name) {
2626
+ var params = new i4.HttpParams();
2627
+ if (name) {
2628
+ params = params.append('name', name);
2629
+ }
2630
+ return _this.baseHttpService.api({
2631
+ url: _this.serviceUrl + "/" + templateId + "/components",
2632
+ params: params,
2633
+ });
2634
+ };
2635
+ this.fetchComponent$ = function (templateId, componentId) {
2636
+ return _this.baseHttpService.api({
2637
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId,
2638
+ });
2639
+ };
2640
+ this.createComponent$ = function (component) {
2641
+ return _this.baseHttpService.api({
2642
+ method: 'post',
2643
+ url: _this.serviceUrl + "/" + component.uiTemplateId + "/components",
2644
+ body: component,
2645
+ });
2646
+ };
2647
+ this.updateComponent$ = function (component) {
2648
+ return _this.baseHttpService.api({
2649
+ method: 'put',
2650
+ url: _this.serviceUrl + "/" + component.uiTemplateId + "/components/" + component.id,
2651
+ body: component,
2652
+ });
2653
+ };
2654
+ this.duplicateComponent$ = function (component, cloneRequest) {
2655
+ return _this.baseHttpService
2656
+ .api({
2657
+ url: _this.serviceUrl + "/" + component.uiTemplateId + "/components/" + component.id + "/clone",
2658
+ method: 'post',
2659
+ body: cloneRequest,
2660
+ })
2661
+ .pipe(rxjs.map(function (response) { return response.clonedRecordId; }));
2662
+ };
2663
+ this.removeComponent$ = function (templateId, componentId) {
2664
+ return _this.baseHttpService.api({
2665
+ method: 'delete',
2666
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId,
2667
+ });
2668
+ };
2669
+ this.restoreComponent$ = function (templateId, componentId) {
2670
+ return _this.baseHttpService.api({
2671
+ method: 'patch',
2672
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId,
2673
+ });
2674
+ };
2675
+ this.searchComponents$ = function (templateId, data) {
2676
+ return _this.baseHttpService.api({
2677
+ method: 'post',
2678
+ url: _this.serviceUrl + "/" + templateId + "/components/search",
2679
+ params: data.params,
2680
+ body: data.expression,
2681
+ });
2682
+ };
2683
+ this.fetchStoryAttachment = function (templateId, componentId, storyId, type) {
2684
+ return _this.baseHttpService
2685
+ .api({
2686
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId + "/attachments/" + type + "/file",
2687
+ responseType: 'text',
2688
+ errorHandler: rxjs.noop,
2689
+ })
2690
+ .pipe(rxjs.catchError(function () { return rxjs.of(''); }));
2691
+ };
2692
+ this.convertToComponentStory$ = function (templateId, componentId, storyDto) {
2693
+ return rxjs.forkJoin([
2694
+ _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'html'),
2695
+ _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'js'),
2696
+ _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'css'),
2697
+ _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'json'),
2698
+ ]).pipe(rxjs.map(function (_a) {
2699
+ var _b = __read(_a, 4), html = _b[0], js = _b[1], css = _b[2], json = _b[3];
2700
+ return ({ html: html, js: js, css: css, json: json });
2701
+ }), rxjs.map(function (attachments) { return fromUIComponentStoryDTO(storyDto, attachments); }));
2702
+ };
2703
+ this.fetchStories$ = function (templateId, componentId, name) {
2704
+ var params = new i4.HttpParams();
2705
+ if (name) {
2706
+ params = params.append('name', name);
2707
+ }
2708
+ return _this.baseHttpService
2709
+ .api({
2710
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories",
2711
+ params: params,
2712
+ })
2713
+ .pipe(rxjs.switchMap(function (dtos) {
2714
+ if (!dtos.length) {
2715
+ return rxjs.of([]);
2716
+ }
2717
+ return rxjs.forkJoin(dtos.map(function (dto) { return _this.convertToComponentStory$(templateId, componentId, dto); }));
2718
+ }));
2719
+ };
2720
+ this.fetchStory$ = function (templateId, componentId, storyId) {
2721
+ return _this.baseHttpService
2722
+ .api({
2723
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId,
2724
+ })
2725
+ .pipe(rxjs.switchMap(function (dto) { return _this.convertToComponentStory$(templateId, componentId, dto); }));
2726
+ };
2727
+ this.createComponentStory$ = function (templateId, story) {
2728
+ return _this.baseHttpService.api({
2729
+ method: 'post',
2730
+ url: _this.serviceUrl + "/" + templateId + "/components/" + story.uiComponentId + "/stories",
2731
+ body: story,
2732
+ });
2733
+ };
2734
+ this.updateComponentStory$ = function (templateId, story) {
2735
+ var script = story.script, template = story.template, styles = story.styles, section = story.section, rest = __rest(story, ["script", "template", "styles", "section"]);
2736
+ return _this.baseHttpService
2737
+ .api({
2738
+ method: 'put',
2739
+ url: _this.serviceUrl + "/" + templateId + "/components/" + story.uiComponentId + "/stories/" + story.id,
2740
+ body: rest,
2741
+ })
2742
+ .pipe(rxjs.map(function (dto) { return fromUIComponentStoryDTO(dto, { html: template, js: script, css: styles, json: section }); }));
2743
+ };
2744
+ this.duplicateComponentStory$ = function (story, cloneRequest) {
2745
+ return _this.baseHttpService
2746
+ .api({
2747
+ url: _this.serviceUrl + "/" + story.template + "/components/" + story.uiComponentId + "/stories/" + story.id + "/clone",
2748
+ method: 'post',
2749
+ body: cloneRequest,
2750
+ })
2751
+ .pipe(rxjs.map(function (response) { return response.clonedRecordId; }));
2752
+ };
2753
+ this.deleteComponentStory$ = function (templateId, componentId, storyId) {
2754
+ return _this.baseHttpService.api({
2755
+ method: 'delete',
2756
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId,
2757
+ });
2758
+ };
2759
+ this.restoreComponentStory$ = function (templateId, componentId, storyId) {
2760
+ return _this.baseHttpService.api({
2761
+ method: 'patch',
2762
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId,
2763
+ });
2764
+ };
2765
+ this.uploadStoryAttachments$ = function (templateId, componentId, storyId, attachments) {
2766
+ var formData = new FormData();
2767
+ if (attachments.html != null) {
2768
+ formData.append('html', new Blob([attachments.html]), 'story-template.html');
2769
+ }
2770
+ if (attachments.css != null) {
2771
+ formData.append('css', new Blob([attachments.css]), 'story-styles.css');
2772
+ }
2773
+ if (attachments.js != null) {
2774
+ formData.append('js', new Blob([attachments.js]), 'story-script.js');
2775
+ }
2776
+ if (attachments.json != null) {
2777
+ formData.append('json', new Blob([attachments.json]), 'story-section.json');
2778
+ }
2779
+ return _this.baseHttpService.upload({
2780
+ method: 'post',
2781
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId + "/attachments",
2782
+ body: formData,
2783
+ });
2784
+ };
2785
+ this.fetchComponentAttachments$ = function (templateId, component) {
2786
+ return rxjs.forkJoin([
2787
+ _this.fetchComponentAttachmentFile$(templateId, component.id, 'html'),
2788
+ _this.fetchComponentAttachmentFile$(templateId, component.id, 'js'),
2789
+ _this.fetchComponentAttachmentFile$(templateId, component.id, 'css'),
2790
+ _this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
2791
+ ]).pipe(rxjs.map(function (_a) {
2792
+ var _b = __read(_a, 4), html = _b[0], js = _b[1], css = _b[2], json = _b[3];
2793
+ return ({ html: html, js: js, css: css, json: json });
2794
+ }));
2795
+ };
2796
+ this.fetchComponentAttachmentFile$ = function (templateId, componentId, attachmentType) {
2797
+ return _this.baseHttpService
2798
+ .api({
2799
+ method: 'get',
2800
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/attachments/" + attachmentType + "/file",
2801
+ responseType: 'text',
2802
+ errorHandler: rxjs.noop,
2803
+ })
2804
+ .pipe(rxjs.catchError(function () { return rxjs.of(''); }));
2805
+ };
2806
+ this.uploadComponentAttachments$ = function (templateId, componentId, attachments) {
2807
+ var formData = new FormData();
2808
+ if (attachments.html != null) {
2809
+ formData.append('html', new Blob([attachments.html]), 'template.html');
2810
+ }
2811
+ if (attachments.css != null) {
2812
+ formData.append('css', new Blob([attachments.css]), 'styles.css');
2813
+ }
2814
+ if (attachments.js != null) {
2815
+ formData.append('js', new Blob([attachments.js]), 'script.js');
2816
+ }
2817
+ if (attachments.json != null) {
2818
+ formData.append('json', new Blob([attachments.json]), 'section.json');
2819
+ }
2820
+ return _this.baseHttpService.upload({
2821
+ method: 'post',
2822
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/attachments",
2823
+ body: formData,
2824
+ });
2825
+ };
2826
+ }
2827
+ UITemplatesApiService.prototype.getTemplateThumbnailUrl = function (templateId) {
2828
+ return this.serviceUrl + "/" + templateId + "/thumbnail/file";
2829
+ };
2830
+ UITemplatesApiService.prototype.attachTemplateThumbnail$ = function (templateId, file) {
2831
+ var data = new FormData();
2832
+ data.append('thumb', file);
2833
+ return this.baseHttpService.upload({
2834
+ method: 'post',
2835
+ url: this.serviceUrl + "/" + templateId + "/thumbnail",
2836
+ body: data,
2837
+ });
2838
+ };
2839
+ UITemplatesApiService.prototype.removeTemplateThumbnail$ = function (templateId) {
2840
+ return this.baseHttpService.api({
2841
+ method: 'delete',
2842
+ url: this.serviceUrl + "/" + templateId + "/thumbnail",
2843
+ });
2844
+ };
2845
+ return UITemplatesApiService;
2846
+ }());
2847
+ UITemplatesApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: UITemplatesApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2848
+ UITemplatesApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: UITemplatesApiService });
2849
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: UITemplatesApiService, decorators: [{
2850
+ type: i0.Injectable
2851
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2852
+
2853
+ var ApiModule = /** @class */ (function () {
2854
+ function ApiModule() {
2855
+ }
2856
+ return ApiModule;
2857
+ }());
2858
+ ApiModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ApiModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2859
+ ApiModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ApiModule, imports: [i4.HttpClientModule] });
2860
+ ApiModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ApiModule, providers: [
2861
+ i1.BaseHttpService,
2862
+ i1.XrayService,
2863
+ ConfigurationApiService,
2864
+ ConfigurationSettingsApiService,
2865
+ ContextApiService,
2866
+ DocumentAttachmentApiService,
2867
+ PriceApiService,
2868
+ ProductModelApiService,
2869
+ ProceduresApiService,
2870
+ QuoteApiService,
2871
+ DocumentTemplatesApiService,
2872
+ RampApiService,
2873
+ SalesforceApiService,
2874
+ UITemplatesApiService,
2875
+ ScriptsApiService,
2876
+ RulesApiService,
2877
+ RuleGroupsApiService,
2878
+ FlowsApiService,
2879
+ ProductApiService,
2880
+ CatalogAdminApiService,
2881
+ CatalogApiService,
2882
+ DeltaApiService,
2883
+ AccountApiService,
2884
+ PicklistsApiService,
2885
+ ], imports: [[i4.HttpClientModule]] });
2886
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ApiModule, decorators: [{
2887
+ type: i0.NgModule,
2888
+ args: [{
2889
+ imports: [i4.HttpClientModule],
2890
+ providers: [
2891
+ i1.BaseHttpService,
2892
+ i1.XrayService,
2893
+ ConfigurationApiService,
2894
+ ConfigurationSettingsApiService,
2895
+ ContextApiService,
2896
+ DocumentAttachmentApiService,
2897
+ PriceApiService,
2898
+ ProductModelApiService,
2899
+ ProceduresApiService,
2900
+ QuoteApiService,
2901
+ DocumentTemplatesApiService,
2902
+ RampApiService,
2903
+ SalesforceApiService,
2904
+ UITemplatesApiService,
2905
+ ScriptsApiService,
2906
+ RulesApiService,
2907
+ RuleGroupsApiService,
2908
+ FlowsApiService,
2909
+ ProductApiService,
2910
+ CatalogAdminApiService,
2911
+ CatalogApiService,
2912
+ DeltaApiService,
2913
+ AccountApiService,
2914
+ PicklistsApiService,
2915
+ ],
2916
+ }]
2917
+ }] });
2918
+
2919
+ /**
2920
+ * Generated bundle index. Do not edit.
2921
+ */
2922
+
2923
+ exports.AccountApiService = AccountApiService;
2924
+ exports.ApiModule = ApiModule;
2925
+ exports.CatalogAdminApiService = CatalogAdminApiService;
2926
+ exports.CatalogApiService = CatalogApiService;
2927
+ exports.ConfigurationApiService = ConfigurationApiService;
2928
+ exports.ConfigurationSettingsApiService = ConfigurationSettingsApiService;
2929
+ exports.ContextApiService = ContextApiService;
2930
+ exports.DeltaApiService = DeltaApiService;
2931
+ exports.DocumentAttachmentApiService = DocumentAttachmentApiService;
2932
+ exports.DocumentTemplatesApiService = DocumentTemplatesApiService;
2933
+ exports.FlowsApiService = FlowsApiService;
2934
+ exports.PicklistsApiService = PicklistsApiService;
2935
+ exports.PriceApiService = PriceApiService;
2936
+ exports.ProceduresApiService = ProceduresApiService;
2937
+ exports.ProductApiService = ProductApiService;
2938
+ exports.ProductModelApiService = ProductModelApiService;
2939
+ exports.QuoteApiService = QuoteApiService;
2940
+ exports.RampApiService = RampApiService;
2941
+ exports.RuleGroupsApiService = RuleGroupsApiService;
2942
+ exports.RulesApiService = RulesApiService;
2943
+ exports.SalesforceApiService = SalesforceApiService;
2944
+ exports.ScriptsApiService = ScriptsApiService;
2945
+ exports.UITemplatesApiService = UITemplatesApiService;
2946
+
2947
+ Object.defineProperty(exports, '__esModule', { value: true });
2948
+
2949
+ }));
2950
+ //# sourceMappingURL=veloceapps-api.umd.js.map