@veloceapps/api 1.0.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 (62) hide show
  1. package/README.md +7 -0
  2. package/bundles/veloce-api.umd.js +2117 -0
  3. package/bundles/veloce-api.umd.js.map +1 -0
  4. package/esm2015/index.js +14 -0
  5. package/esm2015/lib/api.module.js +59 -0
  6. package/esm2015/lib/services/configuration-api.service.js +90 -0
  7. package/esm2015/lib/services/configuration-settings-api.service.js +69 -0
  8. package/esm2015/lib/services/context-api.service.js +26 -0
  9. package/esm2015/lib/services/document-attachment-api.service.js +65 -0
  10. package/esm2015/lib/services/document-templates-api.service.js +278 -0
  11. package/esm2015/lib/services/price-api.service.js +86 -0
  12. package/esm2015/lib/services/product-model-api.service.js +232 -0
  13. package/esm2015/lib/services/quote-api.service.js +36 -0
  14. package/esm2015/lib/services/ramp-api.service.js +42 -0
  15. package/esm2015/lib/services/salesforce-api.service.js +51 -0
  16. package/esm2015/lib/services/scripts-api.service.js +75 -0
  17. package/esm2015/lib/services/ui-templates-api.service.js +262 -0
  18. package/esm2015/lib/types/attribute-dto.types.js +21 -0
  19. package/esm2015/lib/types/charge-group-item-dto.types.js +45 -0
  20. package/esm2015/lib/types/charge-item-dto.types.js +74 -0
  21. package/esm2015/lib/types/clone-request.types.js +2 -0
  22. package/esm2015/lib/types/configuration-settings-dto.types.js +22 -0
  23. package/esm2015/lib/types/domain-type-dto.types.js +27 -0
  24. package/esm2015/lib/types/line-item-dto.types.js +93 -0
  25. package/esm2015/lib/types/port-domain-dto.types.js +22 -0
  26. package/esm2015/lib/types/price-adjustment-dto.types.js +15 -0
  27. package/esm2015/lib/types/price-dto.types.js +25 -0
  28. package/esm2015/lib/types/recommended-price-dto.types.js +23 -0
  29. package/esm2015/lib/types/ui-template-dto.types.js +2 -0
  30. package/esm2015/lib/utils/ui-template.utils.js +17 -0
  31. package/esm2015/veloce-api.js +5 -0
  32. package/fesm2015/veloce-api.js +1686 -0
  33. package/fesm2015/veloce-api.js.map +1 -0
  34. package/index.d.ts +14 -0
  35. package/lib/api.module.d.ts +7 -0
  36. package/lib/services/configuration-api.service.d.ts +18 -0
  37. package/lib/services/configuration-settings-api.service.d.ts +17 -0
  38. package/lib/services/context-api.service.d.ts +11 -0
  39. package/lib/services/document-attachment-api.service.d.ts +15 -0
  40. package/lib/services/document-templates-api.service.d.ts +39 -0
  41. package/lib/services/price-api.service.d.ts +16 -0
  42. package/lib/services/product-model-api.service.d.ts +30 -0
  43. package/lib/services/quote-api.service.d.ts +14 -0
  44. package/lib/services/ramp-api.service.d.ts +12 -0
  45. package/lib/services/salesforce-api.service.d.ts +17 -0
  46. package/lib/services/scripts-api.service.d.ts +21 -0
  47. package/lib/services/ui-templates-api.service.d.ts +47 -0
  48. package/lib/types/attribute-dto.types.d.ts +11 -0
  49. package/lib/types/charge-group-item-dto.types.d.ts +24 -0
  50. package/lib/types/charge-item-dto.types.d.ts +39 -0
  51. package/lib/types/clone-request.types.d.ts +6 -0
  52. package/lib/types/configuration-settings-dto.types.d.ts +9 -0
  53. package/lib/types/domain-type-dto.types.d.ts +15 -0
  54. package/lib/types/line-item-dto.types.d.ts +50 -0
  55. package/lib/types/port-domain-dto.types.d.ts +13 -0
  56. package/lib/types/price-adjustment-dto.types.d.ts +8 -0
  57. package/lib/types/price-dto.types.d.ts +13 -0
  58. package/lib/types/recommended-price-dto.types.d.ts +12 -0
  59. package/lib/types/ui-template-dto.types.d.ts +10 -0
  60. package/lib/utils/ui-template.utils.d.ts +3 -0
  61. package/package.json +33 -0
  62. package/veloce-api.d.ts +5 -0
@@ -0,0 +1,2117 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@veloce/core'), require('rxjs'), require('rxjs/operators'), require('lodash'), require('@angular/common'), require('moment')) :
3
+ typeof define === 'function' && define.amd ? define('@veloce/api', ['exports', '@angular/common/http', '@angular/core', '@veloce/core', 'rxjs', 'rxjs/operators', 'lodash', '@angular/common', 'moment'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloce = global.veloce || {}, global.veloce.api = {}), global.ng.common.http, global.ng.core, global["@veloce/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
+ /*! *****************************************************************************
32
+ Copyright (c) Microsoft Corporation.
33
+
34
+ Permission to use, copy, modify, and/or distribute this software for any
35
+ purpose with or without fee is hereby granted.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
39
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
41
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
42
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
43
+ PERFORMANCE OF THIS SOFTWARE.
44
+ ***************************************************************************** */
45
+ /* global Reflect, Promise */
46
+ var extendStatics = function (d, b) {
47
+ extendStatics = Object.setPrototypeOf ||
48
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49
+ function (d, b) { for (var p in b)
50
+ if (Object.prototype.hasOwnProperty.call(b, p))
51
+ d[p] = b[p]; };
52
+ return extendStatics(d, b);
53
+ };
54
+ function __extends(d, b) {
55
+ if (typeof b !== "function" && b !== null)
56
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
57
+ extendStatics(d, b);
58
+ function __() { this.constructor = d; }
59
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
60
+ }
61
+ var __assign = function () {
62
+ __assign = Object.assign || function __assign(t) {
63
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
64
+ s = arguments[i];
65
+ for (var p in s)
66
+ if (Object.prototype.hasOwnProperty.call(s, p))
67
+ t[p] = s[p];
68
+ }
69
+ return t;
70
+ };
71
+ return __assign.apply(this, arguments);
72
+ };
73
+ function __rest(s, e) {
74
+ var t = {};
75
+ for (var p in s)
76
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
77
+ t[p] = s[p];
78
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
79
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
80
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
81
+ t[p[i]] = s[p[i]];
82
+ }
83
+ return t;
84
+ }
85
+ function __decorate(decorators, target, key, desc) {
86
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
87
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
88
+ r = Reflect.decorate(decorators, target, key, desc);
89
+ else
90
+ for (var i = decorators.length - 1; i >= 0; i--)
91
+ if (d = decorators[i])
92
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
93
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
94
+ }
95
+ function __param(paramIndex, decorator) {
96
+ return function (target, key) { decorator(target, key, paramIndex); };
97
+ }
98
+ function __metadata(metadataKey, metadataValue) {
99
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
100
+ return Reflect.metadata(metadataKey, metadataValue);
101
+ }
102
+ function __awaiter(thisArg, _arguments, P, generator) {
103
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
104
+ return new (P || (P = Promise))(function (resolve, reject) {
105
+ function fulfilled(value) { try {
106
+ step(generator.next(value));
107
+ }
108
+ catch (e) {
109
+ reject(e);
110
+ } }
111
+ function rejected(value) { try {
112
+ step(generator["throw"](value));
113
+ }
114
+ catch (e) {
115
+ reject(e);
116
+ } }
117
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
118
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
119
+ });
120
+ }
121
+ function __generator(thisArg, body) {
122
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
123
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
124
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
125
+ function verb(n) { return function (v) { return step([n, v]); }; }
126
+ function step(op) {
127
+ if (f)
128
+ throw new TypeError("Generator is already executing.");
129
+ while (_)
130
+ try {
131
+ 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)
132
+ return t;
133
+ if (y = 0, t)
134
+ op = [op[0] & 2, t.value];
135
+ switch (op[0]) {
136
+ case 0:
137
+ case 1:
138
+ t = op;
139
+ break;
140
+ case 4:
141
+ _.label++;
142
+ return { value: op[1], done: false };
143
+ case 5:
144
+ _.label++;
145
+ y = op[1];
146
+ op = [0];
147
+ continue;
148
+ case 7:
149
+ op = _.ops.pop();
150
+ _.trys.pop();
151
+ continue;
152
+ default:
153
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
154
+ _ = 0;
155
+ continue;
156
+ }
157
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
158
+ _.label = op[1];
159
+ break;
160
+ }
161
+ if (op[0] === 6 && _.label < t[1]) {
162
+ _.label = t[1];
163
+ t = op;
164
+ break;
165
+ }
166
+ if (t && _.label < t[2]) {
167
+ _.label = t[2];
168
+ _.ops.push(op);
169
+ break;
170
+ }
171
+ if (t[2])
172
+ _.ops.pop();
173
+ _.trys.pop();
174
+ continue;
175
+ }
176
+ op = body.call(thisArg, _);
177
+ }
178
+ catch (e) {
179
+ op = [6, e];
180
+ y = 0;
181
+ }
182
+ finally {
183
+ f = t = 0;
184
+ }
185
+ if (op[0] & 5)
186
+ throw op[1];
187
+ return { value: op[0] ? op[1] : void 0, done: true };
188
+ }
189
+ }
190
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
191
+ if (k2 === undefined)
192
+ k2 = k;
193
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
194
+ }) : (function (o, m, k, k2) {
195
+ if (k2 === undefined)
196
+ k2 = k;
197
+ o[k2] = m[k];
198
+ });
199
+ function __exportStar(m, o) {
200
+ for (var p in m)
201
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
202
+ __createBinding(o, m, p);
203
+ }
204
+ function __values(o) {
205
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
206
+ if (m)
207
+ return m.call(o);
208
+ if (o && typeof o.length === "number")
209
+ return {
210
+ next: function () {
211
+ if (o && i >= o.length)
212
+ o = void 0;
213
+ return { value: o && o[i++], done: !o };
214
+ }
215
+ };
216
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
217
+ }
218
+ function __read(o, n) {
219
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
220
+ if (!m)
221
+ return o;
222
+ var i = m.call(o), r, ar = [], e;
223
+ try {
224
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
225
+ ar.push(r.value);
226
+ }
227
+ catch (error) {
228
+ e = { error: error };
229
+ }
230
+ finally {
231
+ try {
232
+ if (r && !r.done && (m = i["return"]))
233
+ m.call(i);
234
+ }
235
+ finally {
236
+ if (e)
237
+ throw e.error;
238
+ }
239
+ }
240
+ return ar;
241
+ }
242
+ /** @deprecated */
243
+ function __spread() {
244
+ for (var ar = [], i = 0; i < arguments.length; i++)
245
+ ar = ar.concat(__read(arguments[i]));
246
+ return ar;
247
+ }
248
+ /** @deprecated */
249
+ function __spreadArrays() {
250
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
251
+ s += arguments[i].length;
252
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
253
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
254
+ r[k] = a[j];
255
+ return r;
256
+ }
257
+ function __spreadArray(to, from, pack) {
258
+ if (pack || arguments.length === 2)
259
+ for (var i = 0, l = from.length, ar; i < l; i++) {
260
+ if (ar || !(i in from)) {
261
+ if (!ar)
262
+ ar = Array.prototype.slice.call(from, 0, i);
263
+ ar[i] = from[i];
264
+ }
265
+ }
266
+ return to.concat(ar || Array.prototype.slice.call(from));
267
+ }
268
+ function __await(v) {
269
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
270
+ }
271
+ function __asyncGenerator(thisArg, _arguments, generator) {
272
+ if (!Symbol.asyncIterator)
273
+ throw new TypeError("Symbol.asyncIterator is not defined.");
274
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
275
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
276
+ function verb(n) { if (g[n])
277
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
278
+ function resume(n, v) { try {
279
+ step(g[n](v));
280
+ }
281
+ catch (e) {
282
+ settle(q[0][3], e);
283
+ } }
284
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
285
+ function fulfill(value) { resume("next", value); }
286
+ function reject(value) { resume("throw", value); }
287
+ function settle(f, v) { if (f(v), q.shift(), q.length)
288
+ resume(q[0][0], q[0][1]); }
289
+ }
290
+ function __asyncDelegator(o) {
291
+ var i, p;
292
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
293
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
294
+ }
295
+ function __asyncValues(o) {
296
+ if (!Symbol.asyncIterator)
297
+ throw new TypeError("Symbol.asyncIterator is not defined.");
298
+ var m = o[Symbol.asyncIterator], i;
299
+ 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);
300
+ 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); }); }; }
301
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
302
+ }
303
+ function __makeTemplateObject(cooked, raw) {
304
+ if (Object.defineProperty) {
305
+ Object.defineProperty(cooked, "raw", { value: raw });
306
+ }
307
+ else {
308
+ cooked.raw = raw;
309
+ }
310
+ return cooked;
311
+ }
312
+ ;
313
+ var __setModuleDefault = Object.create ? (function (o, v) {
314
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
315
+ }) : function (o, v) {
316
+ o["default"] = v;
317
+ };
318
+ function __importStar(mod) {
319
+ if (mod && mod.__esModule)
320
+ return mod;
321
+ var result = {};
322
+ if (mod != null)
323
+ for (var k in mod)
324
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
325
+ __createBinding(result, mod, k);
326
+ __setModuleDefault(result, mod);
327
+ return result;
328
+ }
329
+ function __importDefault(mod) {
330
+ return (mod && mod.__esModule) ? mod : { default: mod };
331
+ }
332
+ function __classPrivateFieldGet(receiver, state, kind, f) {
333
+ if (kind === "a" && !f)
334
+ throw new TypeError("Private accessor was defined without a getter");
335
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
336
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
337
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
338
+ }
339
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
340
+ if (kind === "m")
341
+ throw new TypeError("Private method is not writable");
342
+ if (kind === "a" && !f)
343
+ throw new TypeError("Private accessor was defined without a setter");
344
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
345
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
346
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
347
+ }
348
+
349
+ var AttributeDTO = /** @class */ (function () {
350
+ function AttributeDTO(name, type, value, cfgStatus, id, scale) {
351
+ this.name = name;
352
+ this.type = type;
353
+ this.value = value;
354
+ this.cfgStatus = cfgStatus;
355
+ this.id = id;
356
+ this.scale = scale;
357
+ }
358
+ AttributeDTO.fromDTO = function (dto) {
359
+ return {
360
+ id: dto.id,
361
+ name: dto.name,
362
+ type: dto.type,
363
+ scale: dto.scale,
364
+ value: dto.value,
365
+ cfgStatus: dto.cfgStatus,
366
+ };
367
+ };
368
+ return AttributeDTO;
369
+ }());
370
+
371
+ var PriceAdjustmentDTO = /** @class */ (function () {
372
+ function PriceAdjustmentDTO(amount, explanation, type) {
373
+ this.amount = amount;
374
+ this.explanation = explanation;
375
+ this.type = type;
376
+ }
377
+ PriceAdjustmentDTO.fromDTO = function (dto) {
378
+ return {
379
+ amount: dto.amount,
380
+ explanation: dto.explanation,
381
+ type: dto.type,
382
+ };
383
+ };
384
+ return PriceAdjustmentDTO;
385
+ }());
386
+
387
+ var ChargeGroupItemDTO = /** @class */ (function () {
388
+ function ChargeGroupItemDTO(chargeType, chargeMethod, properties, id, chargeTypeDisplayValue, frequencyUnit, frequencyDuration, currency, sellingTerm, netPrice, listPrice, netUnitPrice, listUnitPrice, cost, priceAdjustment, priceWaterfalls, enablePriceAdjustment) {
389
+ this.chargeType = chargeType;
390
+ this.chargeMethod = chargeMethod;
391
+ this.properties = properties;
392
+ this.id = id;
393
+ this.chargeTypeDisplayValue = chargeTypeDisplayValue;
394
+ this.frequencyUnit = frequencyUnit;
395
+ this.frequencyDuration = frequencyDuration;
396
+ this.currency = currency;
397
+ this.sellingTerm = sellingTerm;
398
+ this.netPrice = netPrice;
399
+ this.listPrice = listPrice;
400
+ this.netUnitPrice = netUnitPrice;
401
+ this.listUnitPrice = listUnitPrice;
402
+ this.cost = cost;
403
+ this.priceAdjustment = priceAdjustment;
404
+ this.priceWaterfalls = priceWaterfalls;
405
+ this.enablePriceAdjustment = enablePriceAdjustment;
406
+ }
407
+ ChargeGroupItemDTO.fromDTO = function (dto) {
408
+ var _a;
409
+ return {
410
+ id: dto.id,
411
+ chargeType: dto.chargeType,
412
+ chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
413
+ chargeMethod: dto.chargeMethod,
414
+ frequencyUnit: dto.frequencyUnit,
415
+ frequencyDuration: dto.frequencyDuration,
416
+ currency: dto.currency,
417
+ sellingTerm: dto.sellingTerm,
418
+ netPrice: dto.netPrice,
419
+ listPrice: dto.listPrice,
420
+ netUnitPrice: dto.netUnitPrice,
421
+ listUnitPrice: dto.listUnitPrice,
422
+ cost: dto.cost,
423
+ priceAdjustment: dto.priceAdjustment && PriceAdjustmentDTO.fromDTO(dto.priceAdjustment),
424
+ priceWaterfalls: (_a = dto.priceWaterfalls) === null || _a === void 0 ? void 0 : _a.map(PriceAdjustmentDTO.fromDTO),
425
+ enablePriceAdjustment: dto.enablePriceAdjustment,
426
+ properties: dto.properties,
427
+ };
428
+ };
429
+ return ChargeGroupItemDTO;
430
+ }());
431
+
432
+ var ChargeItemDTO = /** @class */ (function () {
433
+ function ChargeItemDTO(id, price, unitPrice, baseListPrice, baseListUnitPrice, listPrice, listUnitPrice, netPrice, netUnitPrice, chargeId, chargeType, chargeMethod, priceItemId, startDate, priceWaterfalls, quantity, properties, chargeTypeDisplayValue, arr, frequencyUnit, frequencyDuration, endDate, sellingTerm, currency, unitCost, cost, minUnitPrice, minPrice, enablePriceAdjustment, enableListPriceAdjustment, listPriceAdjustment, priceAdjustment) {
434
+ this.id = id;
435
+ this.price = price;
436
+ this.unitPrice = unitPrice;
437
+ this.baseListPrice = baseListPrice;
438
+ this.baseListUnitPrice = baseListUnitPrice;
439
+ this.listPrice = listPrice;
440
+ this.listUnitPrice = listUnitPrice;
441
+ this.netPrice = netPrice;
442
+ this.netUnitPrice = netUnitPrice;
443
+ this.chargeId = chargeId;
444
+ this.chargeType = chargeType;
445
+ this.chargeMethod = chargeMethod;
446
+ this.priceItemId = priceItemId;
447
+ this.startDate = startDate;
448
+ this.priceWaterfalls = priceWaterfalls;
449
+ this.quantity = quantity;
450
+ this.properties = properties;
451
+ this.chargeTypeDisplayValue = chargeTypeDisplayValue;
452
+ this.arr = arr;
453
+ this.frequencyUnit = frequencyUnit;
454
+ this.frequencyDuration = frequencyDuration;
455
+ this.endDate = endDate;
456
+ this.sellingTerm = sellingTerm;
457
+ this.currency = currency;
458
+ this.unitCost = unitCost;
459
+ this.cost = cost;
460
+ this.minUnitPrice = minUnitPrice;
461
+ this.minPrice = minPrice;
462
+ this.enablePriceAdjustment = enablePriceAdjustment;
463
+ this.enableListPriceAdjustment = enableListPriceAdjustment;
464
+ this.listPriceAdjustment = listPriceAdjustment;
465
+ this.priceAdjustment = priceAdjustment;
466
+ }
467
+ ChargeItemDTO.fromDTO = function (dto) {
468
+ return {
469
+ id: dto.id,
470
+ price: dto.price,
471
+ unitPrice: dto.unitPrice,
472
+ baseListPrice: dto.baseListPrice,
473
+ baseListUnitPrice: dto.baseListUnitPrice,
474
+ listPrice: dto.listPrice,
475
+ listUnitPrice: dto.listUnitPrice,
476
+ netPrice: dto.netPrice,
477
+ netUnitPrice: dto.netUnitPrice,
478
+ chargeId: dto.chargeId,
479
+ chargeType: dto.chargeType,
480
+ chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
481
+ chargeMethod: dto.chargeMethod,
482
+ priceItemId: dto.priceItemId,
483
+ startDate: dto.startDate,
484
+ endDate: dto.endDate,
485
+ priceWaterfalls: dto.priceWaterfalls.map(PriceAdjustmentDTO.fromDTO),
486
+ quantity: dto.quantity,
487
+ properties: dto.properties,
488
+ arr: dto.arr,
489
+ frequencyUnit: dto.frequencyUnit,
490
+ frequencyDuration: dto.frequencyDuration,
491
+ sellingTerm: dto.sellingTerm,
492
+ currency: dto.currency,
493
+ unitCost: dto.unitCost,
494
+ cost: dto.cost,
495
+ minUnitPrice: dto.minUnitPrice,
496
+ minPrice: dto.minPrice,
497
+ enablePriceAdjustment: dto.enablePriceAdjustment,
498
+ enableListPriceAdjustment: dto.enableListPriceAdjustment,
499
+ listPriceAdjustment: dto.listPriceAdjustment && PriceAdjustmentDTO.fromDTO(dto.listPriceAdjustment),
500
+ priceAdjustment: dto.priceAdjustment && PriceAdjustmentDTO.fromDTO(dto.priceAdjustment),
501
+ };
502
+ };
503
+ return ChargeItemDTO;
504
+ }());
505
+
506
+ var RecommendedPriceDTO = /** @class */ (function () {
507
+ function RecommendedPriceDTO(netPrice, listPrice, chargeType, chargeMethod, explanation, frequencyDuration, frequencyUnit) {
508
+ this.netPrice = netPrice;
509
+ this.listPrice = listPrice;
510
+ this.chargeType = chargeType;
511
+ this.chargeMethod = chargeMethod;
512
+ this.explanation = explanation;
513
+ this.frequencyDuration = frequencyDuration;
514
+ this.frequencyUnit = frequencyUnit;
515
+ }
516
+ RecommendedPriceDTO.fromDTO = function (dto) {
517
+ return {
518
+ netPrice: dto.netPrice,
519
+ listPrice: dto.listPrice,
520
+ chargeType: dto.chargeType,
521
+ chargeMethod: dto.chargeMethod,
522
+ frequencyUnit: dto.frequencyUnit,
523
+ frequencyDuration: dto.frequencyDuration,
524
+ explanation: dto.explanation,
525
+ };
526
+ };
527
+ return RecommendedPriceDTO;
528
+ }());
529
+
530
+ var DomainTypeDTO = /** @class */ (function () {
531
+ function DomainTypeDTO(name, displayName, minCard, maxCard, recommendedPrices, properties, status, cardinality) {
532
+ this.name = name;
533
+ this.displayName = displayName;
534
+ this.minCard = minCard;
535
+ this.maxCard = maxCard;
536
+ this.recommendedPrices = recommendedPrices;
537
+ this.properties = properties;
538
+ this.status = status;
539
+ this.cardinality = cardinality;
540
+ }
541
+ DomainTypeDTO.fromDTO = function (dto) {
542
+ var _a;
543
+ return {
544
+ name: dto.name,
545
+ displayName: dto.displayName,
546
+ minCard: dto.minCard,
547
+ maxCard: dto.maxCard,
548
+ recommendedPrices: (_a = dto.recommendedPrices) === null || _a === void 0 ? void 0 : _a.map(RecommendedPriceDTO.fromDTO),
549
+ properties: dto.properties,
550
+ status: dto.status,
551
+ cardinality: dto.cardinality,
552
+ };
553
+ };
554
+ return DomainTypeDTO;
555
+ }());
556
+
557
+ var PortDomainDTO = /** @class */ (function () {
558
+ function PortDomainDTO(name, type, minCard, maxCard, domainTypes, properties) {
559
+ this.name = name;
560
+ this.type = type;
561
+ this.minCard = minCard;
562
+ this.maxCard = maxCard;
563
+ this.domainTypes = domainTypes;
564
+ this.properties = properties;
565
+ }
566
+ PortDomainDTO.fromDTO = function (dto) {
567
+ return {
568
+ name: dto.name,
569
+ type: dto.type,
570
+ minCard: dto.minCard,
571
+ maxCard: dto.maxCard,
572
+ domainTypes: dto.domainTypes.map(DomainTypeDTO.fromDTO),
573
+ properties: dto.properties,
574
+ };
575
+ };
576
+ return PortDomainDTO;
577
+ }());
578
+
579
+ var PriceDTO = /** @class */ (function () {
580
+ function PriceDTO(netPrice, listPrice, chargeType, chargeTypeDisplayValue, chargeMethod, frequencyUnit, frequencyDuration, sellingTerm) {
581
+ this.netPrice = netPrice;
582
+ this.listPrice = listPrice;
583
+ this.chargeType = chargeType;
584
+ this.chargeTypeDisplayValue = chargeTypeDisplayValue;
585
+ this.chargeMethod = chargeMethod;
586
+ this.frequencyUnit = frequencyUnit;
587
+ this.frequencyDuration = frequencyDuration;
588
+ this.sellingTerm = sellingTerm;
589
+ }
590
+ PriceDTO.fromDTO = function (dto) {
591
+ return {
592
+ netPrice: dto.netPrice,
593
+ listPrice: dto.listPrice,
594
+ chargeType: dto.chargeType,
595
+ chargeTypeDisplayValue: dto.chargeTypeDisplayValue,
596
+ chargeMethod: dto.chargeMethod,
597
+ frequencyUnit: dto.frequencyUnit,
598
+ frequencyDuration: dto.frequencyDuration,
599
+ sellingTerm: dto.sellingTerm,
600
+ };
601
+ };
602
+ return PriceDTO;
603
+ }());
604
+
605
+ var LineItemDTO = /** @class */ (function () {
606
+ function LineItemDTO(id, activated, attributes, attributeDomains, cfgStatus, chargeGroupItems, chargeItems, domainComputations, lineItems, messages, name, optionalCharges, pending, portDomains, properties, qty, totalPrices, type, productId, port, parentId, assetId, openOrderLineItemId, productName, rootId, actionCode, serviceStartDate, effectiveDate, startDate, endDate, planId, sellingFrequencyUnit, sellingFrequencyDuration, offeringId, offeringItemId, offeringInstanceId, rampInstanceId, enableRamp, configurable) {
607
+ this.id = id;
608
+ this.activated = activated;
609
+ this.attributes = attributes;
610
+ this.attributeDomains = attributeDomains;
611
+ this.cfgStatus = cfgStatus;
612
+ this.chargeGroupItems = chargeGroupItems;
613
+ this.chargeItems = chargeItems;
614
+ this.domainComputations = domainComputations;
615
+ this.lineItems = lineItems;
616
+ this.messages = messages;
617
+ this.name = name;
618
+ this.optionalCharges = optionalCharges;
619
+ this.pending = pending;
620
+ this.portDomains = portDomains;
621
+ this.properties = properties;
622
+ this.qty = qty;
623
+ this.totalPrices = totalPrices;
624
+ this.type = type;
625
+ this.productId = productId;
626
+ this.port = port;
627
+ this.parentId = parentId;
628
+ this.assetId = assetId;
629
+ this.openOrderLineItemId = openOrderLineItemId;
630
+ this.productName = productName;
631
+ this.rootId = rootId;
632
+ this.actionCode = actionCode;
633
+ this.serviceStartDate = serviceStartDate;
634
+ this.effectiveDate = effectiveDate;
635
+ this.startDate = startDate;
636
+ this.endDate = endDate;
637
+ this.planId = planId;
638
+ this.sellingFrequencyUnit = sellingFrequencyUnit;
639
+ this.sellingFrequencyDuration = sellingFrequencyDuration;
640
+ this.offeringId = offeringId;
641
+ this.offeringItemId = offeringItemId;
642
+ this.offeringInstanceId = offeringInstanceId;
643
+ this.rampInstanceId = rampInstanceId;
644
+ this.enableRamp = enableRamp;
645
+ this.configurable = configurable;
646
+ }
647
+ LineItemDTO.fromDTO = function (dto) {
648
+ return {
649
+ id: dto.id,
650
+ activated: dto.activated,
651
+ attributes: dto.attributes.map(AttributeDTO.fromDTO),
652
+ attributeDomains: dto.attributeDomains,
653
+ cfgStatus: dto.cfgStatus,
654
+ chargeGroupItems: dto.chargeGroupItems.map(ChargeGroupItemDTO.fromDTO),
655
+ chargeItems: dto.chargeItems.map(ChargeItemDTO.fromDTO),
656
+ domainComputations: dto.domainComputations,
657
+ lineItems: dto.lineItems.map(LineItemDTO.fromDTO),
658
+ messages: dto.messages,
659
+ name: dto.name,
660
+ optionalCharges: dto.optionalCharges,
661
+ pending: dto.pending,
662
+ portDomains: _.transform(dto.portDomains, function (result, value, key) { return (result[key] = PortDomainDTO.fromDTO(value)); }),
663
+ properties: dto.properties,
664
+ qty: dto.qty,
665
+ totalPrices: _.transform(dto.totalPrices, function (result, value, key) { return (result[key] = PriceDTO.fromDTO(value)); }),
666
+ type: dto.type,
667
+ productId: dto.productId,
668
+ port: dto.port,
669
+ parentId: dto.parentId,
670
+ assetId: dto.assetId,
671
+ openOrderLineItemId: dto.openOrderLineItemId,
672
+ productName: dto.productName,
673
+ rootId: dto.rootId,
674
+ actionCode: dto.actionCode,
675
+ serviceStartDate: dto.serviceStartDate,
676
+ effectiveDate: dto.effectiveDate,
677
+ startDate: dto.startDate,
678
+ endDate: dto.endDate,
679
+ planId: dto.planId,
680
+ sellingFrequencyUnit: dto.sellingFrequencyUnit,
681
+ sellingFrequencyDuration: dto.sellingFrequencyDuration,
682
+ offeringId: dto.offeringId,
683
+ offeringItemId: dto.offeringItemId,
684
+ offeringInstanceId: dto.offeringInstanceId,
685
+ rampInstanceId: dto.rampInstanceId,
686
+ enableRamp: dto.enableRamp,
687
+ configurable: dto.configurable,
688
+ };
689
+ };
690
+ return LineItemDTO;
691
+ }());
692
+
693
+ var ConfigurationApiService = /** @class */ (function () {
694
+ function ConfigurationApiService(httpService) {
695
+ this.httpService = httpService;
696
+ this.SERVICE_URL = '/configuration';
697
+ }
698
+ ConfigurationApiService.prototype.configureLineItem = function (configurationRequest, runtimeModel) {
699
+ var _this = this;
700
+ return this.httpService
701
+ .api({
702
+ method: 'post',
703
+ url: "" + this.SERVICE_URL,
704
+ body: configurationRequest,
705
+ errorHandler: function (e) { return rxjs.throwError(e); },
706
+ })
707
+ .pipe(operators.map(function (response) {
708
+ var lineItem = LineItemDTO.fromDTO(response);
709
+ if (runtimeModel) {
710
+ return _this.updatePortDomains(lineItem, runtimeModel);
711
+ }
712
+ else {
713
+ return lineItem;
714
+ }
715
+ }));
716
+ };
717
+ ConfigurationApiService.prototype.configureAndPriceLineItem = function (configurationRequest, runtimeModel) {
718
+ var _this = this;
719
+ return this.httpService
720
+ .api({
721
+ method: 'post',
722
+ url: this.SERVICE_URL + "/price",
723
+ body: configurationRequest,
724
+ errorHandler: function (e) { return rxjs.throwError(e); },
725
+ })
726
+ .pipe(operators.map(function (response) {
727
+ var lineItem = LineItemDTO.fromDTO(response.lineItem);
728
+ return {
729
+ lineItem: _this.updatePortDomains(lineItem, runtimeModel),
730
+ context: response.context,
731
+ };
732
+ }));
733
+ };
734
+ ConfigurationApiService.prototype.getRuntimeDataByProductId = function (productId, offeringId) {
735
+ return this.httpService
736
+ .api({
737
+ method: 'get',
738
+ url: this.SERVICE_URL + "/" + productId + "/model" + ((offeringId && "/" + offeringId) || ''),
739
+ })
740
+ .pipe(operators.map(function (runtimeData) {
741
+ runtimeData.uiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
742
+ runtimeData.uiDefinitions.forEach(function (uiDefinition) {
743
+ i1.ModelTranslatorUtils.toLocalUIDefinition(uiDefinition);
744
+ });
745
+ return runtimeData;
746
+ }));
747
+ };
748
+ ConfigurationApiService.prototype.getRuntimeDataByModelId = function (modelId) {
749
+ return this.httpService
750
+ .api({
751
+ method: 'get',
752
+ url: this.SERVICE_URL + "/" + modelId + "/model-test",
753
+ })
754
+ .pipe(operators.map(function (runtimeData) {
755
+ runtimeData.uiDefinitions = [];
756
+ return runtimeData;
757
+ }));
758
+ };
759
+ ConfigurationApiService.prototype.updatePortDomains = function (lineItem, runtimeModel) {
760
+ var e_1, _d;
761
+ var _this = this;
762
+ var _a, _b, _c;
763
+ var type = runtimeModel.components.get(lineItem.type);
764
+ var portDomains = Object.assign({}, lineItem.portDomains);
765
+ try {
766
+ 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()) {
767
+ var port = _f.value;
768
+ var portDomain = portDomains[port.name];
769
+ if (((_b = portDomain === null || portDomain === void 0 ? void 0 : portDomain.properties) === null || _b === void 0 ? void 0 : _b.domainComputation) === 'false') {
770
+ portDomain.domainTypes = port.domainTypes;
771
+ }
772
+ }
773
+ }
774
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
775
+ finally {
776
+ try {
777
+ if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
778
+ }
779
+ finally { if (e_1) throw e_1.error; }
780
+ }
781
+ 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 });
782
+ };
783
+ return ConfigurationApiService;
784
+ }());
785
+ ConfigurationApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
786
+ ConfigurationApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationApiService });
787
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationApiService, decorators: [{
788
+ type: i0.Injectable
789
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
790
+
791
+ var ConfigurationSettingsDTO = /** @class */ (function () {
792
+ function ConfigurationSettingsDTO(id, key, value) {
793
+ this.id = id;
794
+ this.key = key;
795
+ this.value = value;
796
+ }
797
+ ConfigurationSettingsDTO.fromDTO = function (dto, key) {
798
+ return {
799
+ id: dto === null || dto === void 0 ? void 0 : dto.id,
800
+ key: (dto === null || dto === void 0 ? void 0 : dto.key) || key || '',
801
+ value: dto === null || dto === void 0 ? void 0 : dto.value,
802
+ };
803
+ };
804
+ ConfigurationSettingsDTO.toDTO = function (data) {
805
+ return {
806
+ id: data.id,
807
+ key: data.key,
808
+ value: data.value,
809
+ };
810
+ };
811
+ return ConfigurationSettingsDTO;
812
+ }());
813
+
814
+ var ConfigurationSettingsApiService = /** @class */ (function () {
815
+ function ConfigurationSettingsApiService(httpService) {
816
+ this.httpService = httpService;
817
+ this.SERVICE_URL = '/configuration-settings';
818
+ }
819
+ ConfigurationSettingsApiService.prototype.fetchSettings = function () {
820
+ return this.httpService
821
+ .api({
822
+ url: "" + this.SERVICE_URL,
823
+ method: 'get',
824
+ })
825
+ .pipe(operators.map(function (settings) { return settings.map(function (setting) { return ConfigurationSettingsDTO.fromDTO(setting); }); }));
826
+ };
827
+ ConfigurationSettingsApiService.prototype.fetchSetting = function (settingsKey) {
828
+ return this.httpService
829
+ .api({
830
+ url: this.SERVICE_URL + "/byKey/" + settingsKey,
831
+ method: 'get',
832
+ })
833
+ .pipe(operators.map(function (setting) { return ConfigurationSettingsDTO.fromDTO(setting, settingsKey); }));
834
+ };
835
+ ConfigurationSettingsApiService.prototype.createSetting = function (setting) {
836
+ var request = ConfigurationSettingsDTO.toDTO(setting);
837
+ return this.httpService.api({
838
+ url: "" + this.SERVICE_URL,
839
+ method: 'post',
840
+ body: Object.assign({}, request),
841
+ });
842
+ };
843
+ ConfigurationSettingsApiService.prototype.updateSetting = function (setting) {
844
+ var request = ConfigurationSettingsDTO.toDTO(setting);
845
+ return this.httpService.api({
846
+ url: this.SERVICE_URL + "/" + request.id,
847
+ method: 'put',
848
+ body: Object.assign({}, request),
849
+ });
850
+ };
851
+ ConfigurationSettingsApiService.prototype.removeSetting = function (setting) {
852
+ var request = ConfigurationSettingsDTO.toDTO(setting);
853
+ return this.httpService.api({
854
+ url: this.SERVICE_URL + "/" + request.id,
855
+ method: 'delete',
856
+ });
857
+ };
858
+ ConfigurationSettingsApiService.prototype.restoreSetting = function (settingId) {
859
+ return this.httpService.api({
860
+ url: this.SERVICE_URL + "/" + settingId + "/restore",
861
+ method: 'patch',
862
+ });
863
+ };
864
+ ConfigurationSettingsApiService.prototype.clear = function (name) {
865
+ return this.httpService
866
+ .api({
867
+ method: 'get',
868
+ url: '/cache/evict/' + name
869
+ });
870
+ };
871
+ return ConfigurationSettingsApiService;
872
+ }());
873
+ ConfigurationSettingsApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationSettingsApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
874
+ ConfigurationSettingsApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationSettingsApiService });
875
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationSettingsApiService, decorators: [{
876
+ type: i0.Injectable
877
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
878
+
879
+ var ContextApiService = /** @class */ (function () {
880
+ function ContextApiService(httpService) {
881
+ this.httpService = httpService;
882
+ this.SERVICE_URL = '/context';
883
+ }
884
+ ContextApiService.prototype.getContext = function (headerId, mode) {
885
+ return this.httpService.api({
886
+ method: 'post',
887
+ body: {
888
+ headerId: headerId,
889
+ contextMode: i1.ConfigurationContextMode[mode],
890
+ },
891
+ url: "" + this.SERVICE_URL,
892
+ });
893
+ };
894
+ return ContextApiService;
895
+ }());
896
+ ContextApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ContextApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
897
+ ContextApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ContextApiService });
898
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ContextApiService, decorators: [{
899
+ type: i0.Injectable
900
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
901
+
902
+ var DocumentAttachmentApiService = /** @class */ (function () {
903
+ function DocumentAttachmentApiService(httpService, fileDownloadService) {
904
+ this.httpService = httpService;
905
+ this.fileDownloadService = fileDownloadService;
906
+ }
907
+ DocumentAttachmentApiService.prototype.getAttachments = function (searchRequest) {
908
+ return this.httpService.api({
909
+ url: '/attachments/search',
910
+ method: 'post',
911
+ body: searchRequest,
912
+ });
913
+ };
914
+ DocumentAttachmentApiService.prototype.createAttachment = function (attachment, file, reportProgress) {
915
+ var formData = new FormData();
916
+ if (file) {
917
+ formData.append('file', file, file.name);
918
+ }
919
+ formData.append('attachment', new Blob([JSON.stringify(attachment)], {
920
+ type: 'application/json',
921
+ }));
922
+ return this.httpService.upload({
923
+ url: "/attachments",
924
+ body: formData,
925
+ method: 'post',
926
+ observe: reportProgress ? 'events' : undefined,
927
+ reportProgress: reportProgress,
928
+ });
929
+ };
930
+ DocumentAttachmentApiService.prototype.updateAttachment = function (id, attachment) {
931
+ return this.httpService.api({
932
+ url: "/attachments/" + id,
933
+ body: attachment,
934
+ method: 'put',
935
+ });
936
+ };
937
+ DocumentAttachmentApiService.prototype.getAttachmentFile = function (id, isPreventDownload) {
938
+ var _this = this;
939
+ return this.httpService
940
+ .api({
941
+ url: "/attachments/" + id + "/file",
942
+ responseType: isPreventDownload ? 'arraybuffer' : 'blob',
943
+ observe: isPreventDownload ? 'body' : 'response',
944
+ })
945
+ .pipe(operators.tap(function (response) {
946
+ if (!isPreventDownload) {
947
+ _this.fileDownloadService.processDownload(response);
948
+ }
949
+ }), operators.map(function (response) { return (isPreventDownload ? new Blob([response.body || response]) : response.body || response); }));
950
+ };
951
+ DocumentAttachmentApiService.prototype.removeAttachment = function (id) {
952
+ return this.httpService.api({
953
+ url: "/attachments/" + id,
954
+ method: 'delete',
955
+ });
956
+ };
957
+ return DocumentAttachmentApiService;
958
+ }());
959
+ DocumentAttachmentApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentAttachmentApiService, deps: [{ token: i1__namespace.BaseHttpService }, { token: i1__namespace.FileDownloadService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
960
+ DocumentAttachmentApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentAttachmentApiService });
961
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentAttachmentApiService, decorators: [{
962
+ type: i0.Injectable
963
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }, { type: i1__namespace.FileDownloadService }]; } });
964
+
965
+ var SalesforceApiService = /** @class */ (function () {
966
+ function SalesforceApiService(httpService) {
967
+ this.httpService = httpService;
968
+ this.SERVICE_URL = '/proxy';
969
+ }
970
+ SalesforceApiService.prototype.query = function (searchRequest, objectName) {
971
+ return this.httpService.api({
972
+ method: 'post',
973
+ body: Object.assign(Object.assign({}, searchRequest), { count: searchRequest.count || 100 }),
974
+ url: this.SERVICE_URL + "/query/" + objectName,
975
+ });
976
+ };
977
+ SalesforceApiService.prototype.queryObjects = function (search) {
978
+ var params = new i4.HttpParams();
979
+ if (search) {
980
+ params.append('search', search);
981
+ }
982
+ return this.httpService.api({
983
+ url: this.SERVICE_URL + "/query",
984
+ params: params,
985
+ });
986
+ };
987
+ SalesforceApiService.prototype.describe = function (objectName, fieldName) {
988
+ var methodUrl = this.SERVICE_URL + "/describe/" + objectName + "/fields" + (fieldName ? "/" + fieldName : '');
989
+ return this.httpService.api({ url: methodUrl });
990
+ };
991
+ SalesforceApiService.prototype.describe2 = function (objectName, fields) {
992
+ var methodUrl = this.SERVICE_URL + "/describe/" + objectName + "/fields";
993
+ return this.httpService.api({ method: 'post', url: methodUrl, body: fields });
994
+ };
995
+ SalesforceApiService.prototype.apexGetRequest = function (path, params) {
996
+ return this.httpService.api({ url: this.SERVICE_URL + "/apex" + path, params: params });
997
+ };
998
+ SalesforceApiService.prototype.apexPostRequest = function (path, body) {
999
+ return this.httpService.api({
1000
+ method: 'post',
1001
+ body: body,
1002
+ url: this.SERVICE_URL + "/apex" + path,
1003
+ });
1004
+ };
1005
+ return SalesforceApiService;
1006
+ }());
1007
+ SalesforceApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SalesforceApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1008
+ SalesforceApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SalesforceApiService });
1009
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SalesforceApiService, decorators: [{
1010
+ type: i0.Injectable
1011
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1012
+
1013
+ var moment = moment___namespace;
1014
+ var mapSfQueryResult = function (limit) { return operators.map(function (records) {
1015
+ if (!records.length) {
1016
+ return { _result: 'No Records Found' };
1017
+ }
1018
+ if (limit === 1) {
1019
+ return records[0];
1020
+ }
1021
+ return records;
1022
+ }); };
1023
+ var mapBooleanIfAplicable = function (value) {
1024
+ if (value === 'true') {
1025
+ return true;
1026
+ }
1027
+ if (value === 'false') {
1028
+ return false;
1029
+ }
1030
+ return value;
1031
+ };
1032
+ var DocumentTemplatesApiService = /** @class */ (function () {
1033
+ function DocumentTemplatesApiService(service, sfRepo, fileDownloadService, documentAttachmentService, http) {
1034
+ this.service = service;
1035
+ this.sfRepo = sfRepo;
1036
+ this.fileDownloadService = fileDownloadService;
1037
+ this.documentAttachmentService = documentAttachmentService;
1038
+ this.http = http;
1039
+ this.fallbackDocGenHost = 'https://dev-dp1.velocpq.com/docgen';
1040
+ if (window.VELO_DOCGEN_API) {
1041
+ this.docGenHost = window.VELO_DOCGEN_API;
1042
+ }
1043
+ else {
1044
+ console.log("window.VELO_DOCGEN_API not set, will use fallback \"" + this.fallbackDocGenHost + "\"");
1045
+ this.docGenHost = this.fallbackDocGenHost;
1046
+ }
1047
+ }
1048
+ DocumentTemplatesApiService.prototype.getTemplates = function (tag) {
1049
+ return this.service.api({
1050
+ url: '/templates',
1051
+ method: 'get',
1052
+ params: Object.assign({}, (tag && { tag: tag })),
1053
+ });
1054
+ };
1055
+ DocumentTemplatesApiService.prototype.upsertTemplate = function (template, file, reportProgress) {
1056
+ var formData = new FormData();
1057
+ if (file) {
1058
+ formData.append('file', file, file.name);
1059
+ }
1060
+ formData.append('template', new Blob([JSON.stringify(template)], {
1061
+ type: 'application/json',
1062
+ }));
1063
+ return this.service.upload({
1064
+ url: "/templates" + ((template.id && "/" + template.id) || ''),
1065
+ body: formData,
1066
+ method: template.id ? 'put' : 'post',
1067
+ reportProgress: reportProgress,
1068
+ });
1069
+ };
1070
+ DocumentTemplatesApiService.prototype.removeTemplate = function (id) {
1071
+ return this.service.api({
1072
+ url: '/templates' + id,
1073
+ method: 'delete',
1074
+ });
1075
+ };
1076
+ DocumentTemplatesApiService.prototype.cloneTemplate = function (id) {
1077
+ return this.service.api({
1078
+ url: '/templates/clone/' + id,
1079
+ method: 'post',
1080
+ });
1081
+ };
1082
+ DocumentTemplatesApiService.prototype.generateDocumentData = function (template, object, params) {
1083
+ var _this = this;
1084
+ var _a, _b, _c, _d;
1085
+ var shouldPreventDownload = params === null || params === void 0 ? void 0 : params.shouldPreventDownload;
1086
+ var useLocalDataGeneration = (_b = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.find(function (_e) {
1087
+ var name = _e.name;
1088
+ return name === 'useLocalDataGeneration';
1089
+ })) === null || _b === void 0 ? void 0 : _b.value;
1090
+ if (!useLocalDataGeneration && object instanceof i1.QuoteDraft) {
1091
+ return this.generate('/templates/generate-data', { template: template, quote: object }, shouldPreventDownload, shouldPreventDownload ? 'json' : 'blob');
1092
+ }
1093
+ var allQueries = __spreadArray([], __read(((_c = template === null || template === void 0 ? void 0 : template.queries) !== null && _c !== void 0 ? _c : [])));
1094
+ var properties = ((_d = object === null || object === void 0 ? void 0 : object.context) === null || _d === void 0 ? void 0 : _d.properties) || (object === null || object === void 0 ? void 0 : object.properties) || {};
1095
+ var accountId = properties === null || properties === void 0 ? void 0 : properties.AccountId;
1096
+ var userId = properties === null || properties === void 0 ? void 0 : properties.UserId;
1097
+ if (accountId) {
1098
+ allQueries.push({
1099
+ queryName: 'QuoteAccountQuery',
1100
+ objectName: 'Account',
1101
+ resultObjectName: 'account',
1102
+ statement: "Id ='" + accountId + "'",
1103
+ fields: [],
1104
+ });
1105
+ }
1106
+ if (userId) {
1107
+ allQueries.push({
1108
+ queryName: 'QuoteUserQuery',
1109
+ objectName: 'User',
1110
+ resultObjectName: 'agent',
1111
+ statement: "Id ='" + userId + "'",
1112
+ fields: [],
1113
+ });
1114
+ }
1115
+ var queries = allQueries.map(function (query) { return _this.queryObject(query, { properties: properties }); }) || [];
1116
+ return rxjs.forkJoin(__spreadArray([], __read(queries)))
1117
+ .pipe(operators.defaultIfEmpty([]))
1118
+ .pipe(operators.map(function (results) {
1119
+ var _a, _b, _c, _d;
1120
+ var queriesResult = ___namespace.chain(results)
1121
+ .reduce(function (acc, r) {
1122
+ if (r) {
1123
+ return Object.assign(Object.assign({}, acc), r);
1124
+ }
1125
+ return acc;
1126
+ }, {})
1127
+ .value();
1128
+ var templateProperties = ((template === null || template === void 0 ? void 0 : template.properties) || []).reduce(function (trunk, _e) {
1129
+ var _f;
1130
+ var name = _e.name, value = _e.value;
1131
+ return Object.assign(Object.assign({}, trunk), (_f = {}, _f[name] = mapBooleanIfAplicable(value), _f));
1132
+ }, {});
1133
+ var data = Object.assign(Object.assign(Object.assign({}, (typeof object === 'object' ? object : { object: object })), queriesResult), templateProperties);
1134
+ if (template.script && template.script.trim().length) {
1135
+ var currencyFormat_1 = ((_b = (_a = template.properties) === null || _a === void 0 ? void 0 : _a.find(function (_e) {
1136
+ var name = _e.name;
1137
+ return name === 'currencyFormat';
1138
+ })) === null || _b === void 0 ? void 0 : _b.value) || '1.2-2';
1139
+ var dateFormat_1 = ((_d = (_c = template.properties) === null || _c === void 0 ? void 0 : _c.find(function (_e) {
1140
+ var name = _e.name;
1141
+ return name === 'dateFormat';
1142
+ })) === null || _d === void 0 ? void 0 : _d.value) || 'D/MMM/YYYY';
1143
+ var formatDate = function (value) {
1144
+ return value ? moment(value).format(dateFormat_1) : value;
1145
+ };
1146
+ var transform = new Function("return " + template.script)();
1147
+ var transformedData = transform(Object.assign(Object.assign({}, data), { utils: {
1148
+ lodash: ___namespace,
1149
+ currency: function (value) { return new common.CurrencyPipe('en-US').transform(value, 'USD', 'symbol', currencyFormat_1); },
1150
+ date: formatDate,
1151
+ }, ToDay: formatDate(Date.now()) }));
1152
+ if (!shouldPreventDownload) {
1153
+ var blob = new Blob([JSON.stringify(transformedData)]);
1154
+ _this.fileDownloadService.processDownload(blob, 'data.json');
1155
+ }
1156
+ return transformedData;
1157
+ }
1158
+ return data;
1159
+ }));
1160
+ };
1161
+ DocumentTemplatesApiService.prototype.generateDocument = function (template, object, params) {
1162
+ if (params === void 0) { params = {}; }
1163
+ var attachmentIds = (template.attachments || []).map(function (_e) {
1164
+ var id = _e.id;
1165
+ return id;
1166
+ }).filter(Boolean);
1167
+ var shouldUseLocalDocxTemplater = params.shouldUseLocalDocxTemplater;
1168
+ return shouldUseLocalDocxTemplater && !(object instanceof i1.QuoteDraft)
1169
+ ? this.generateDocumentNew(template, object, params)
1170
+ : this.generateWithBackendDocxTemplater({ template: template, quote: object, attachmentIds: attachmentIds, params: params });
1171
+ };
1172
+ DocumentTemplatesApiService.prototype.generateDocumentNew = function (template, object, params) {
1173
+ var _this = this;
1174
+ if (params === void 0) { params = {}; }
1175
+ var attachToQuote = params.attachToQuote, documentFormat = params.documentFormat, shouldPreventDownload = params.shouldPreventDownload;
1176
+ var file$ = this.service.api({
1177
+ method: 'get',
1178
+ url: "/templates/" + template.id + "/file",
1179
+ responseType: 'arraybuffer',
1180
+ });
1181
+ var attachmentIds = (template.attachments || []).map(function (_e) {
1182
+ var id = _e.id;
1183
+ return id;
1184
+ });
1185
+ var attachments$ = attachmentIds.length
1186
+ ? attachmentIds.map(function (attachmentId) {
1187
+ return _this.documentAttachmentService.getAttachmentFile(attachmentId, true);
1188
+ })
1189
+ : [];
1190
+ var data$ = this.generateDocumentData(template, object, Object.assign(Object.assign({}, params), { shouldPreventDownload: true }));
1191
+ return rxjs.zip.apply(void 0, __spreadArray([file$, data$], __read(attachments$))).pipe(operators.switchMap(function (_e) {
1192
+ var _f = __read(_e), file = _f[0], data = _f[1], attachments = _f.slice(2);
1193
+ var _a;
1194
+ var d = i1.DocxTemplater.generate(file, data);
1195
+ var body = new FormData();
1196
+ var properties = ((_a = object === null || object === void 0 ? void 0 : object.context) === null || _a === void 0 ? void 0 : _a.properties) || (object === null || object === void 0 ? void 0 : object.properties) || {};
1197
+ var documentName = (properties === null || properties === void 0 ? void 0 : properties.Name) || template.name;
1198
+ // TODO: special CATO case. Refactor for a more generic approach
1199
+ if (documentFormat === 'DOCX') {
1200
+ _this.fileDownloadService.processDownload(d, documentName);
1201
+ return rxjs.of(d);
1202
+ }
1203
+ attachments.forEach(function (attachment) {
1204
+ body.append('attachments', new Blob([attachment]));
1205
+ });
1206
+ body.append('orderform', d);
1207
+ return _this.http
1208
+ .post(_this.docGenHost + "/documents/merge", body, {
1209
+ responseType: 'arraybuffer',
1210
+ })
1211
+ .pipe(operators.switchMap(function (pdf) {
1212
+ var blob = new Blob([pdf]);
1213
+ if (!shouldPreventDownload) {
1214
+ _this.fileDownloadService.processDownload(blob, documentName + ".pdf");
1215
+ }
1216
+ if (attachToQuote && object instanceof i1.QuoteDraft) {
1217
+ var formData = new FormData();
1218
+ formData.append('file', blob, documentName + ".pdf");
1219
+ return _this.http.post(window['VELO_API'] + "/services/quotes/" + object.quoteId + "/attach-document", formData, {
1220
+ responseType: 'arraybuffer',
1221
+ headers: {
1222
+ Authorization: window['VELO_KEY'],
1223
+ },
1224
+ });
1225
+ }
1226
+ return rxjs.of(blob);
1227
+ }));
1228
+ }));
1229
+ };
1230
+ DocumentTemplatesApiService.prototype.getAttachments = function (searchRequest) {
1231
+ return this.documentAttachmentService.getAttachments(searchRequest);
1232
+ };
1233
+ DocumentTemplatesApiService.prototype.getAttachmentFile = function (id) {
1234
+ return this.documentAttachmentService.getAttachmentFile(id);
1235
+ };
1236
+ DocumentTemplatesApiService.prototype.createAttachment = function (attachment, file, reportProgress) {
1237
+ return this.documentAttachmentService.createAttachment(attachment, file, reportProgress);
1238
+ };
1239
+ DocumentTemplatesApiService.prototype.removeAttachment = function (id) {
1240
+ return this.documentAttachmentService.removeAttachment(id);
1241
+ };
1242
+ DocumentTemplatesApiService.prototype.downloadTemplateFile = function (id) {
1243
+ var _this = this;
1244
+ return this.service
1245
+ .api({
1246
+ url: "/templates/" + id + "/file",
1247
+ responseType: 'blob',
1248
+ observe: 'response',
1249
+ })
1250
+ .pipe(operators.tap(function (response) {
1251
+ _this.fileDownloadService.processDownload(response);
1252
+ }), operators.map(function (response) { return response.body || response; }));
1253
+ };
1254
+ DocumentTemplatesApiService.prototype.generateWithBackendDocxTemplater = function (_e) {
1255
+ var template = _e.template, quote = _e.quote, attachmentIds = _e.attachmentIds, params = _e.params;
1256
+ var shouldPreventDownload = params.shouldPreventDownload;
1257
+ var nonEmptyParams = Object.keys(params || {})
1258
+ .filter(function (k) { return params[k] !== undefined; })
1259
+ .reduce(function (obj, key) {
1260
+ obj[key] = params[key];
1261
+ return obj;
1262
+ }, {});
1263
+ return this.generate("/templates/" + template.id + "/generate", { quote: quote, attachments: attachmentIds }, Boolean(shouldPreventDownload), 'blob', nonEmptyParams, false);
1264
+ };
1265
+ DocumentTemplatesApiService.prototype.generate = function (url, body, shouldPreventDownload, responseType, params, isUpload, reportProgress) {
1266
+ var _this = this;
1267
+ var requestOptions = {
1268
+ method: 'post',
1269
+ url: url,
1270
+ body: body,
1271
+ reportProgress: reportProgress,
1272
+ responseType: responseType,
1273
+ observe: shouldPreventDownload ? 'body' : 'response',
1274
+ params: params,
1275
+ };
1276
+ return (isUpload ? this.service.upload(requestOptions) : this.service.api(requestOptions)).pipe(operators.tap(function (response) {
1277
+ if (!shouldPreventDownload) {
1278
+ _this.fileDownloadService.processDownload(response);
1279
+ }
1280
+ }));
1281
+ };
1282
+ DocumentTemplatesApiService.prototype.queryObject = function (_e, _f) {
1283
+ var objectName = _e.objectName, resultObjectName = _e.resultObjectName, fields = _e.fields, statement = _e.statement;
1284
+ var properties = _f.properties;
1285
+ var _a;
1286
+ var patternLimit = /(\s*limit\s\d*)/i;
1287
+ var limit = 1;
1288
+ if (patternLimit.test(statement)) {
1289
+ 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();
1290
+ if (limitStr) {
1291
+ limit = Number.parseInt(limitStr, 10);
1292
+ }
1293
+ statement = statement.replace(patternLimit, '');
1294
+ }
1295
+ var resolvedStatement = i1.StringUtils.fillPlaceholders(statement, properties, /:\s*(\w[\w\d_.]+)/i);
1296
+ var searchRequest = Object.assign({ skip: 0, count: limit, rawCondition: resolvedStatement }, ((fields === null || fields === void 0 ? void 0 : fields.length) && !!fields[0] && { fields: fields }));
1297
+ return this.sfRepo.query(searchRequest, objectName).pipe(mapSfQueryResult(limit), operators.map(function (value) {
1298
+ var _e;
1299
+ return (_e = {}, _e[resultObjectName] = value, _e);
1300
+ }));
1301
+ };
1302
+ return DocumentTemplatesApiService;
1303
+ }());
1304
+ DocumentTemplatesApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentTemplatesApiService, deps: [{ token: i1__namespace.BaseHttpService }, { token: SalesforceApiService }, { token: i1__namespace.FileDownloadService }, { token: DocumentAttachmentApiService }, { token: i4__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1305
+ DocumentTemplatesApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentTemplatesApiService });
1306
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DocumentTemplatesApiService, decorators: [{
1307
+ type: i0.Injectable
1308
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }, { type: SalesforceApiService }, { type: i1__namespace.FileDownloadService }, { type: DocumentAttachmentApiService }, { type: i4__namespace.HttpClient }]; } });
1309
+
1310
+ var PriceApiService = /** @class */ (function () {
1311
+ function PriceApiService(httpService) {
1312
+ this.httpService = httpService;
1313
+ this.SERVICE_URL = '/price';
1314
+ }
1315
+ PriceApiService.prototype.calculateRuntime = function (request) {
1316
+ return this.httpService.api({
1317
+ method: 'post',
1318
+ url: this.SERVICE_URL + "/calculate-runtime",
1319
+ body: request,
1320
+ });
1321
+ };
1322
+ PriceApiService.prototype.calculate = function (request) {
1323
+ return this.httpService.api({
1324
+ method: 'post',
1325
+ url: this.SERVICE_URL + "/calculate",
1326
+ body: request,
1327
+ });
1328
+ // TODO: move outside API service
1329
+ // .pipe(
1330
+ // map(data => {
1331
+ // if (data.context) {
1332
+ // const context = this.contextService.resolveOrCreate();
1333
+ // const patchedContext = {
1334
+ // ...context,
1335
+ // properties: {
1336
+ // ...context.properties,
1337
+ // ...data.context.properties,
1338
+ // },
1339
+ // };
1340
+ // this.contextService.update(patchedContext);
1341
+ // }
1342
+ // return data;
1343
+ // }),
1344
+ // );
1345
+ };
1346
+ PriceApiService.prototype.getPriceLists = function () {
1347
+ return this.httpService.api({
1348
+ method: 'get',
1349
+ url: '/price-lists',
1350
+ });
1351
+ };
1352
+ PriceApiService.prototype.getPriceList = function (id) {
1353
+ return this.httpService.api({
1354
+ method: 'get',
1355
+ url: "/price-lists/" + id,
1356
+ });
1357
+ };
1358
+ PriceApiService.prototype.getSellingTermByEndDate = function (planId, offeringId, startDate, endDate, frequencyUnit, frequencyDuration) {
1359
+ return this.httpService.api({
1360
+ method: 'post',
1361
+ url: this.SERVICE_URL + "/selling-term-by-end-date",
1362
+ body: {
1363
+ planId: planId,
1364
+ offeringId: offeringId,
1365
+ startDate: startDate,
1366
+ endDate: endDate,
1367
+ frequencyUnit: frequencyUnit,
1368
+ frequencyDuration: frequencyDuration,
1369
+ },
1370
+ });
1371
+ };
1372
+ PriceApiService.prototype.getSellingTermByTerm = function (planId, offeringId, startDate, term, frequencyUnit, frequencyDuration) {
1373
+ return this.httpService.api({
1374
+ method: 'post',
1375
+ url: this.SERVICE_URL + "/selling-term-by-term",
1376
+ body: {
1377
+ planId: planId,
1378
+ offeringId: offeringId,
1379
+ startDate: startDate,
1380
+ term: term,
1381
+ frequencyUnit: frequencyUnit,
1382
+ frequencyDuration: frequencyDuration,
1383
+ },
1384
+ });
1385
+ };
1386
+ return PriceApiService;
1387
+ }());
1388
+ PriceApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PriceApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1389
+ PriceApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PriceApiService });
1390
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PriceApiService, decorators: [{
1391
+ type: i0.Injectable
1392
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1393
+
1394
+ var ProductModelApiService = /** @class */ (function () {
1395
+ function ProductModelApiService(httpService) {
1396
+ this.httpService = httpService;
1397
+ this.SERVICE_URL = '/models';
1398
+ }
1399
+ ProductModelApiService.prototype.addModel = function (model) {
1400
+ return this.httpService
1401
+ .api({
1402
+ method: 'post',
1403
+ url: this.SERVICE_URL,
1404
+ body: model,
1405
+ errorHandler: this.httpService.handleValidationError,
1406
+ })
1407
+ .pipe(operators.map(function (result) {
1408
+ if (result.successful) {
1409
+ return result;
1410
+ }
1411
+ else {
1412
+ throw new Error(result.message);
1413
+ }
1414
+ }));
1415
+ };
1416
+ ProductModelApiService.prototype.releaseModel = function (model) {
1417
+ return this.httpService
1418
+ .api({
1419
+ method: 'put',
1420
+ url: this.SERVICE_URL + "/" + model.id + "/release",
1421
+ body: model,
1422
+ errorHandler: this.httpService.handleValidationError,
1423
+ })
1424
+ .pipe(operators.map(function (result) {
1425
+ if (result.successful) {
1426
+ return '';
1427
+ }
1428
+ else {
1429
+ throw new Error(result.message);
1430
+ }
1431
+ }));
1432
+ };
1433
+ ProductModelApiService.prototype.removeModel = function (modelId, successFn, failureFn) {
1434
+ var observable = this.httpService
1435
+ .api({
1436
+ method: 'delete',
1437
+ url: this.SERVICE_URL + "/" + modelId,
1438
+ errorHandler: this.httpService.handleValidationError,
1439
+ })
1440
+ .pipe(operators.map(function (result) {
1441
+ if (result.successful) {
1442
+ return '';
1443
+ }
1444
+ else {
1445
+ throw new Error(result.message);
1446
+ }
1447
+ }));
1448
+ observable.subscribe(function () {
1449
+ successFn && successFn.apply();
1450
+ }, function () {
1451
+ failureFn && failureFn.apply();
1452
+ });
1453
+ };
1454
+ ProductModelApiService.prototype.getModelVersions = function (modelId, count, skip) {
1455
+ if (count === void 0) { count = 100; }
1456
+ if (skip === void 0) { skip = 0; }
1457
+ return this.httpService.api({
1458
+ method: 'post',
1459
+ url: this.SERVICE_URL + "/" + modelId + "/versions",
1460
+ body: {
1461
+ skipCount: skip,
1462
+ count: count,
1463
+ },
1464
+ });
1465
+ };
1466
+ ProductModelApiService.prototype.getModel = function (id, version) {
1467
+ var url = this.SERVICE_URL + "/" + id;
1468
+ if (version) {
1469
+ url += "/versions/" + version;
1470
+ }
1471
+ return this.httpService.api({ url: url });
1472
+ };
1473
+ ProductModelApiService.prototype.getModels = function (skipCount, searchText) {
1474
+ return this.httpService.api({
1475
+ method: 'post',
1476
+ url: this.SERVICE_URL + "/search",
1477
+ body: {
1478
+ nameRegex: searchText,
1479
+ skipCount: skipCount.toString(),
1480
+ count: ProductModelApiService.MAX_RESULTS,
1481
+ },
1482
+ });
1483
+ };
1484
+ ProductModelApiService.prototype.getLinkedModels = function (id, version) {
1485
+ var url = this.SERVICE_URL + "/" + id;
1486
+ if (version) {
1487
+ url += "/versions/" + version;
1488
+ }
1489
+ url += '/linked';
1490
+ return this.httpService.api({ url: url }).pipe(operators.map(function (linkedModels) {
1491
+ if (linkedModels) {
1492
+ linkedModels.forEach(function (model) { return i1.ModelTranslatorUtils.toLocalModel(model); });
1493
+ }
1494
+ return linkedModels;
1495
+ }));
1496
+ };
1497
+ ProductModelApiService.prototype.load = function (id, version) {
1498
+ return rxjs.forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(operators.map(function (_a) {
1499
+ var _b = __read(_a, 2), model = _b[0], linkedModels = _b[1];
1500
+ var container = new i1.ProductModelsContainer(model, linkedModels !== null && linkedModels !== void 0 ? linkedModels : []);
1501
+ i1.ModelUtils.override(container.main, container.linked);
1502
+ i1.ModelTranslatorUtils.toLocalModel(container.main, container.linked);
1503
+ return container;
1504
+ }));
1505
+ };
1506
+ ProductModelApiService.prototype.getPML = function (modelId, version) {
1507
+ var url = this.SERVICE_URL + "/" + modelId + "/pml/" + version;
1508
+ if (version) {
1509
+ url += "/versions/" + version;
1510
+ }
1511
+ return this.httpService.api({
1512
+ url: url,
1513
+ responseType: 'text',
1514
+ });
1515
+ };
1516
+ ProductModelApiService.prototype.savePML = function (modelId, pml, comment) {
1517
+ return this.httpService
1518
+ .api({
1519
+ method: 'put',
1520
+ url: this.SERVICE_URL + "/" + modelId + "/pml",
1521
+ body: {
1522
+ id: modelId,
1523
+ pml: pml,
1524
+ comment: comment,
1525
+ },
1526
+ })
1527
+ .pipe(operators.map(function (result) {
1528
+ if (result.successful) {
1529
+ return '';
1530
+ }
1531
+ else {
1532
+ throw new Error(result.message);
1533
+ }
1534
+ }), operators.catchError(this.httpService.handleValidationError));
1535
+ };
1536
+ ProductModelApiService.prototype.generateProducts = function (modelId) {
1537
+ return this.httpService.api({
1538
+ url: this.SERVICE_URL + "/" + modelId + "/generate-products",
1539
+ });
1540
+ };
1541
+ ProductModelApiService.prototype.saveModel = function (productModel, comment) {
1542
+ var model = i1.EntityUtil.clone(productModel);
1543
+ model.comment = comment;
1544
+ i1.ModelTranslatorUtils.toServerModel(model);
1545
+ return this.httpService
1546
+ .api({
1547
+ method: 'put',
1548
+ url: this.SERVICE_URL + "/" + model.id,
1549
+ body: model,
1550
+ })
1551
+ .pipe(operators.map(function (result) {
1552
+ if (result.successful) {
1553
+ return '';
1554
+ }
1555
+ else {
1556
+ throw new Error(result.message);
1557
+ }
1558
+ }), operators.catchError(this.httpService.handleValidationError));
1559
+ };
1560
+ ProductModelApiService.prototype.validateModel = function (productModel) {
1561
+ return this.httpService
1562
+ .api({
1563
+ method: 'post',
1564
+ url: this.SERVICE_URL + "/validate",
1565
+ body: productModel,
1566
+ errorHandler: this.httpService.handleValidationError,
1567
+ })
1568
+ .pipe(operators.map(function (result) {
1569
+ if (result.successful) {
1570
+ return '';
1571
+ }
1572
+ else {
1573
+ throw new Error(result.message);
1574
+ }
1575
+ }));
1576
+ };
1577
+ ProductModelApiService.prototype.renameModel = function (productModel, name) {
1578
+ var model = i1.EntityUtil.clone(productModel);
1579
+ model.name = name;
1580
+ i1.ModelTranslatorUtils.toServerModel(model);
1581
+ return this.httpService
1582
+ .api({
1583
+ method: 'patch',
1584
+ url: this.SERVICE_URL + "/" + model.id,
1585
+ body: model,
1586
+ })
1587
+ .pipe(operators.catchError(this.httpService.handleValidationError));
1588
+ };
1589
+ ProductModelApiService.prototype.uploadPmlFile = function (file, modelId) {
1590
+ var formData = new FormData();
1591
+ formData.append('file', file, file.name);
1592
+ return this.httpService.upload({
1593
+ url: this.SERVICE_URL + "/" + modelId + "/pml/upload",
1594
+ body: formData,
1595
+ });
1596
+ };
1597
+ ProductModelApiService.prototype.runPml = function (modelId, pml, rootType, configurationMode) {
1598
+ return this.httpService.api({
1599
+ method: 'post',
1600
+ url: this.SERVICE_URL + "/" + modelId + "/pml/run",
1601
+ body: {
1602
+ pml: pml,
1603
+ rootType: rootType,
1604
+ configurationMode: configurationMode,
1605
+ },
1606
+ responseType: 'text',
1607
+ });
1608
+ };
1609
+ ProductModelApiService.prototype.evictAllCache = function () {
1610
+ return this.httpService.api({
1611
+ method: 'get',
1612
+ url: '/cache/evict/environment-variables',
1613
+ });
1614
+ };
1615
+ return ProductModelApiService;
1616
+ }());
1617
+ ProductModelApiService.MAX_RESULTS = 200;
1618
+ ProductModelApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ProductModelApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1619
+ ProductModelApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ProductModelApiService });
1620
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ProductModelApiService, decorators: [{
1621
+ type: i0.Injectable
1622
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1623
+
1624
+ var QuoteApiService = /** @class */ (function () {
1625
+ function QuoteApiService(httpService) {
1626
+ this.httpService = httpService;
1627
+ this.SERVICE_URL = '/quotes';
1628
+ }
1629
+ QuoteApiService.prototype.getQuote = function (quoteId, params) {
1630
+ return this.httpService.api({
1631
+ method: 'get',
1632
+ url: this.SERVICE_URL + "/" + quoteId,
1633
+ params: params,
1634
+ });
1635
+ };
1636
+ QuoteApiService.prototype.upsertQuote = function (request) {
1637
+ return this.httpService.api({
1638
+ method: 'post',
1639
+ url: "" + this.SERVICE_URL,
1640
+ body: request,
1641
+ });
1642
+ };
1643
+ QuoteApiService.prototype.submitQuote = function (request) {
1644
+ return this.httpService.api({
1645
+ method: 'post',
1646
+ url: this.SERVICE_URL + "/submit",
1647
+ body: request,
1648
+ });
1649
+ };
1650
+ return QuoteApiService;
1651
+ }());
1652
+ QuoteApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1653
+ QuoteApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteApiService });
1654
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteApiService, decorators: [{
1655
+ type: i0.Injectable
1656
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1657
+
1658
+ var RampApiService = /** @class */ (function () {
1659
+ function RampApiService(httpService) {
1660
+ this.httpService = httpService;
1661
+ this.SERVICE_URL = '/ramp';
1662
+ }
1663
+ RampApiService.prototype.next = function (request) {
1664
+ return this.httpService.api({
1665
+ method: 'post',
1666
+ url: this.SERVICE_URL + "/next",
1667
+ body: request,
1668
+ });
1669
+ };
1670
+ RampApiService.prototype.renew = function (request) {
1671
+ return this.httpService.api({
1672
+ method: 'post',
1673
+ url: this.SERVICE_URL + "/renew",
1674
+ body: request,
1675
+ });
1676
+ // TODO: move out of API service
1677
+ // .pipe(
1678
+ // map(data => {
1679
+ // if (data.context) {
1680
+ // const context = this.contextService.resolveOrCreate();
1681
+ // Object.keys(data.context.properties).forEach(function (key) {
1682
+ // context.properties[key] = data.context.properties[key];
1683
+ // });
1684
+ // this.contextService.update(context);
1685
+ // }
1686
+ // return data;
1687
+ // }),
1688
+ // );
1689
+ };
1690
+ return RampApiService;
1691
+ }());
1692
+ RampApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RampApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1693
+ RampApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RampApiService });
1694
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RampApiService, decorators: [{
1695
+ type: i0.Injectable
1696
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1697
+
1698
+ var fromUIComponentStoryDTO = function (dto, attachments) {
1699
+ return {
1700
+ id: dto.id,
1701
+ name: dto.name,
1702
+ uiComponentId: dto.uiComponentId,
1703
+ description: dto.description,
1704
+ templateHtmlId: dto.templateHtmlId,
1705
+ scriptJsId: dto.scriptJsId,
1706
+ styleCssId: dto.styleCssId,
1707
+ sectionJsonId: dto.sectionJsonId,
1708
+ section: attachments.json,
1709
+ template: attachments.html,
1710
+ script: attachments.js,
1711
+ styles: attachments.css,
1712
+ };
1713
+ };
1714
+
1715
+ var UITemplatesApiService = /** @class */ (function () {
1716
+ function UITemplatesApiService(baseHttpService) {
1717
+ var _this = this;
1718
+ this.baseHttpService = baseHttpService;
1719
+ this.serviceUrl = '/uitemplates';
1720
+ this.fetchTemplates$ = function (name) {
1721
+ var params = new i4.HttpParams();
1722
+ if (name) {
1723
+ params = params.append('name', name);
1724
+ }
1725
+ return _this.baseHttpService.api({ url: "" + _this.serviceUrl, params: params });
1726
+ };
1727
+ this.createTemplate$ = function (template) {
1728
+ return _this.baseHttpService.api({
1729
+ method: 'post',
1730
+ url: "" + _this.serviceUrl,
1731
+ body: template,
1732
+ });
1733
+ };
1734
+ this.updateTemplate$ = function (template) {
1735
+ return _this.baseHttpService.api({
1736
+ method: 'put',
1737
+ url: _this.serviceUrl + "/" + template.id,
1738
+ body: template,
1739
+ });
1740
+ };
1741
+ this.duplicateTemplate$ = function (template) {
1742
+ // TODO: integrate with BE
1743
+ return rxjs.of(i1.UUID.UUID());
1744
+ };
1745
+ this.removeTemplate$ = function (id) {
1746
+ return _this.baseHttpService.api({
1747
+ method: 'delete',
1748
+ url: _this.serviceUrl + "/" + id,
1749
+ });
1750
+ };
1751
+ this.restoreTemplate$ = function (id) {
1752
+ return _this.baseHttpService.api({
1753
+ method: 'patch',
1754
+ url: _this.serviceUrl + "/" + id,
1755
+ });
1756
+ };
1757
+ this.searchTemplates$ = function (data) {
1758
+ return _this.baseHttpService.api({
1759
+ method: 'post',
1760
+ url: _this.serviceUrl + "/search",
1761
+ params: data.params,
1762
+ body: data.expression,
1763
+ });
1764
+ };
1765
+ this.fetchComponents$ = function (templateId, name) {
1766
+ var params = new i4.HttpParams();
1767
+ if (name) {
1768
+ params = params.append('name', name);
1769
+ }
1770
+ return _this.baseHttpService.api({
1771
+ url: _this.serviceUrl + "/" + templateId + "/components",
1772
+ params: params,
1773
+ });
1774
+ };
1775
+ this.fetchComponent$ = function (templateId, componentId) {
1776
+ return _this.baseHttpService.api({
1777
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId,
1778
+ });
1779
+ };
1780
+ this.createComponent$ = function (component) {
1781
+ return _this.baseHttpService.api({
1782
+ method: 'post',
1783
+ url: _this.serviceUrl + "/" + component.uiTemplateId + "/components",
1784
+ body: component,
1785
+ });
1786
+ };
1787
+ this.updateComponent$ = function (component) {
1788
+ return _this.baseHttpService.api({
1789
+ method: 'put',
1790
+ url: _this.serviceUrl + "/" + component.uiTemplateId + "/components/" + component.id,
1791
+ body: component,
1792
+ });
1793
+ };
1794
+ this.duplicateComponent$ = function (component) {
1795
+ // TODO: integrate with BE
1796
+ return rxjs.of(i1.UUID.UUID());
1797
+ };
1798
+ this.removeComponent$ = function (templateId, componentId) {
1799
+ return _this.baseHttpService.api({
1800
+ method: 'delete',
1801
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId,
1802
+ });
1803
+ };
1804
+ this.restoreComponent$ = function (templateId, componentId) {
1805
+ return _this.baseHttpService.api({
1806
+ method: 'patch',
1807
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId,
1808
+ });
1809
+ };
1810
+ this.searchComponents$ = function (templateId, data) {
1811
+ return _this.baseHttpService.api({
1812
+ method: 'post',
1813
+ url: _this.serviceUrl + "/" + templateId + "/components/search",
1814
+ params: data.params,
1815
+ body: data.expression,
1816
+ });
1817
+ };
1818
+ this.fetchStoryAttachment = function (templateId, componentId, storyId, type) {
1819
+ return _this.baseHttpService
1820
+ .api({
1821
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId + "/attachments/" + type + "/file",
1822
+ responseType: 'text',
1823
+ })
1824
+ .pipe(rxjs.catchError(function () { return rxjs.of(''); }));
1825
+ };
1826
+ this.convertToComponentStory$ = function (templateId, componentId, storyDto) {
1827
+ return rxjs.forkJoin([
1828
+ storyDto.templateHtmlId ? _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'html') : rxjs.of(undefined),
1829
+ storyDto.scriptJsId ? _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'js') : rxjs.of(undefined),
1830
+ storyDto.styleCssId ? _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'css') : rxjs.of(undefined),
1831
+ storyDto.sectionJsonId ? _this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'json') : rxjs.of(undefined),
1832
+ ]).pipe(rxjs.map(function (_a) {
1833
+ var _b = __read(_a, 4), html = _b[0], js = _b[1], css = _b[2], json = _b[3];
1834
+ return ({ html: html, js: js, css: css, json: json });
1835
+ }), rxjs.map(function (attachments) { return fromUIComponentStoryDTO(storyDto, attachments); }));
1836
+ };
1837
+ this.fetchStories$ = function (templateId, componentId, name) {
1838
+ var params = new i4.HttpParams();
1839
+ if (name) {
1840
+ params = params.append('name', name);
1841
+ }
1842
+ return _this.baseHttpService
1843
+ .api({
1844
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories",
1845
+ params: params,
1846
+ })
1847
+ .pipe(rxjs.switchMap(function (dtos) {
1848
+ if (!dtos.length) {
1849
+ return rxjs.of([]);
1850
+ }
1851
+ return rxjs.forkJoin(dtos.map(function (dto) { return _this.convertToComponentStory$(templateId, componentId, dto); }));
1852
+ }));
1853
+ };
1854
+ this.fetchStory$ = function (templateId, componentId, storyId) {
1855
+ return _this.baseHttpService
1856
+ .api({
1857
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId,
1858
+ })
1859
+ .pipe(rxjs.switchMap(function (dto) { return _this.convertToComponentStory$(templateId, componentId, dto); }));
1860
+ };
1861
+ this.createComponentStory$ = function (templateId, story) {
1862
+ return _this.baseHttpService.api({
1863
+ method: 'post',
1864
+ url: _this.serviceUrl + "/" + templateId + "/components/" + story.uiComponentId + "/stories",
1865
+ body: story,
1866
+ });
1867
+ };
1868
+ this.updateComponentStory$ = function (templateId, story) {
1869
+ var script = story.script, template = story.template, styles = story.styles, section = story.section, rest = __rest(story, ["script", "template", "styles", "section"]);
1870
+ return _this.baseHttpService
1871
+ .api({
1872
+ method: 'put',
1873
+ url: _this.serviceUrl + "/" + templateId + "/components/" + story.uiComponentId + "/stories/" + story.id,
1874
+ body: rest,
1875
+ })
1876
+ .pipe(rxjs.map(function (dto) { return fromUIComponentStoryDTO(dto, { html: template, js: script, css: styles, json: section }); }));
1877
+ };
1878
+ this.deleteComponentStory$ = function (templateId, componentId, storyId) {
1879
+ return _this.baseHttpService.api({
1880
+ method: 'delete',
1881
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId,
1882
+ });
1883
+ };
1884
+ this.restoreComponentStory$ = function (templateId, componentId, storyId) {
1885
+ return _this.baseHttpService.api({
1886
+ method: 'patch',
1887
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId,
1888
+ });
1889
+ };
1890
+ this.uploadStoryAttachments$ = function (templateId, componentId, storyId, attachments) {
1891
+ var formData = new FormData();
1892
+ if (attachments.html != null) {
1893
+ formData.append('html', new Blob([attachments.html]), 'story-template.html');
1894
+ }
1895
+ if (attachments.css != null) {
1896
+ formData.append('css', new Blob([attachments.css]), 'story-styles.css');
1897
+ }
1898
+ if (attachments.js != null) {
1899
+ formData.append('js', new Blob([attachments.js]), 'story-script.js');
1900
+ }
1901
+ if (attachments.json != null) {
1902
+ formData.append('json', new Blob([attachments.json]), 'story-section.json');
1903
+ }
1904
+ return _this.baseHttpService.upload({
1905
+ method: 'post',
1906
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/stories/" + storyId + "/attachments",
1907
+ body: formData,
1908
+ });
1909
+ };
1910
+ this.fetchComponentAttachments$ = function (templateId, component) {
1911
+ return rxjs.forkJoin([
1912
+ component.templateHtmlId ? _this.fetchComponentAttachmentFile$(templateId, component.id, 'html') : rxjs.of(undefined),
1913
+ component.scriptJsId ? _this.fetchComponentAttachmentFile$(templateId, component.id, 'js') : rxjs.of(undefined),
1914
+ component.styleCssId ? _this.fetchComponentAttachmentFile$(templateId, component.id, 'css') : rxjs.of(undefined),
1915
+ component.propertiesJsonId ? _this.fetchComponentAttachmentFile$(templateId, component.id, 'json') : rxjs.of(undefined),
1916
+ ]).pipe(rxjs.map(function (_a) {
1917
+ var _b = __read(_a, 4), html = _b[0], js = _b[1], css = _b[2], json = _b[3];
1918
+ return ({ html: html, js: js, css: css, json: json });
1919
+ }));
1920
+ };
1921
+ this.fetchComponentAttachmentFile$ = function (templateId, componentId, attachmentType) {
1922
+ return _this.baseHttpService
1923
+ .api({
1924
+ method: 'get',
1925
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/attachments/" + attachmentType + "/file",
1926
+ responseType: 'text',
1927
+ })
1928
+ .pipe(rxjs.catchError(function () { return rxjs.of(''); }));
1929
+ };
1930
+ this.uploadComponentAttachments$ = function (templateId, componentId, attachments) {
1931
+ var formData = new FormData();
1932
+ if (attachments.html != null) {
1933
+ formData.append('html', new Blob([attachments.html]), 'template.html');
1934
+ }
1935
+ if (attachments.css != null) {
1936
+ formData.append('css', new Blob([attachments.css]), 'styles.css');
1937
+ }
1938
+ if (attachments.js != null) {
1939
+ formData.append('js', new Blob([attachments.js]), 'script.js');
1940
+ }
1941
+ if (attachments.json != null) {
1942
+ formData.append('json', new Blob([attachments.json]), 'section.json');
1943
+ }
1944
+ return _this.baseHttpService.upload({
1945
+ method: 'post',
1946
+ url: _this.serviceUrl + "/" + templateId + "/components/" + componentId + "/attachments",
1947
+ body: formData,
1948
+ });
1949
+ };
1950
+ }
1951
+ UITemplatesApiService.prototype.getTemplateThumbnailUrl = function (templateId) {
1952
+ return this.serviceUrl + "/" + templateId + "/thumbnail/file";
1953
+ };
1954
+ UITemplatesApiService.prototype.attachTemplateThumbnail$ = function (templateId, file) {
1955
+ var data = new FormData();
1956
+ data.append('thumb', file);
1957
+ return this.baseHttpService.upload({
1958
+ method: 'post',
1959
+ url: this.serviceUrl + "/" + templateId + "/thumbnail",
1960
+ body: data,
1961
+ });
1962
+ };
1963
+ UITemplatesApiService.prototype.removeTemplateThumbnail$ = function (templateId) {
1964
+ return this.baseHttpService.api({
1965
+ method: 'delete',
1966
+ url: this.serviceUrl + "/" + templateId + "/thumbnail",
1967
+ });
1968
+ };
1969
+ return UITemplatesApiService;
1970
+ }());
1971
+ UITemplatesApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UITemplatesApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1972
+ UITemplatesApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UITemplatesApiService });
1973
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UITemplatesApiService, decorators: [{
1974
+ type: i0.Injectable
1975
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
1976
+
1977
+ var ScriptsApiService = /** @class */ (function () {
1978
+ function ScriptsApiService(baseHttpService) {
1979
+ var _this = this;
1980
+ this.baseHttpService = baseHttpService;
1981
+ this.serviceUrl = '/admin/scripts';
1982
+ this.fetchScripts$ = function () {
1983
+ return _this.baseHttpService.api({ url: "" + _this.serviceUrl });
1984
+ };
1985
+ this.searchScripts$ = function (expression, skip, count) {
1986
+ var params = new i4.HttpParams();
1987
+ params = params.set('skip', '' + skip);
1988
+ params = params.set('count', '' + count);
1989
+ return _this.baseHttpService.api({ method: 'post', url: _this.serviceUrl + "/search", params: params, body: expression });
1990
+ };
1991
+ this.fetchScript$ = function (id) {
1992
+ return _this.baseHttpService.api({ url: _this.serviceUrl + "/" + id });
1993
+ };
1994
+ this.createScript$ = function (script) {
1995
+ return _this.baseHttpService.api({
1996
+ url: "" + _this.serviceUrl,
1997
+ method: 'post',
1998
+ body: script,
1999
+ });
2000
+ };
2001
+ this.updateScriptMeta$ = function (script) {
2002
+ return _this.baseHttpService.api({
2003
+ url: _this.serviceUrl + "/" + script.id,
2004
+ method: 'post',
2005
+ body: script,
2006
+ });
2007
+ };
2008
+ this.updateScriptDetails$ = function (script) {
2009
+ return _this.baseHttpService.api({
2010
+ url: _this.serviceUrl + "/" + script.id,
2011
+ method: 'put',
2012
+ body: script,
2013
+ });
2014
+ };
2015
+ this.cloneScript$ = function (cloneRequest) {
2016
+ return _this.baseHttpService.api({
2017
+ url: _this.serviceUrl + "/" + cloneRequest.id + "/clone",
2018
+ method: 'post',
2019
+ body: cloneRequest
2020
+ });
2021
+ };
2022
+ this.removeScript$ = function (id) {
2023
+ return _this.baseHttpService.api({
2024
+ url: _this.serviceUrl + "/" + id,
2025
+ method: 'delete',
2026
+ });
2027
+ };
2028
+ this.restoreScript$ = function (id) {
2029
+ return _this.baseHttpService.api({
2030
+ url: _this.serviceUrl + "/" + id + "/restore",
2031
+ method: 'patch',
2032
+ });
2033
+ };
2034
+ this.execute$ = function (body) {
2035
+ return _this.baseHttpService.api({
2036
+ url: "/scripts/execute",
2037
+ method: 'post',
2038
+ body: body,
2039
+ });
2040
+ };
2041
+ }
2042
+ return ScriptsApiService;
2043
+ }());
2044
+ ScriptsApiService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptsApiService, deps: [{ token: i1__namespace.BaseHttpService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2045
+ ScriptsApiService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptsApiService });
2046
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptsApiService, decorators: [{
2047
+ type: i0.Injectable
2048
+ }], ctorParameters: function () { return [{ type: i1__namespace.BaseHttpService }]; } });
2049
+
2050
+ var ApiModule = /** @class */ (function () {
2051
+ function ApiModule() {
2052
+ }
2053
+ return ApiModule;
2054
+ }());
2055
+ ApiModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ApiModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2056
+ ApiModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ApiModule, imports: [i4.HttpClientModule] });
2057
+ ApiModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ApiModule, providers: [
2058
+ i1.BaseHttpService,
2059
+ i1.XrayService,
2060
+ ConfigurationApiService,
2061
+ ConfigurationSettingsApiService,
2062
+ ContextApiService,
2063
+ DocumentAttachmentApiService,
2064
+ PriceApiService,
2065
+ ProductModelApiService,
2066
+ QuoteApiService,
2067
+ DocumentTemplatesApiService,
2068
+ RampApiService,
2069
+ SalesforceApiService,
2070
+ UITemplatesApiService,
2071
+ ScriptsApiService,
2072
+ ], imports: [[i4.HttpClientModule]] });
2073
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ApiModule, decorators: [{
2074
+ type: i0.NgModule,
2075
+ args: [{
2076
+ imports: [i4.HttpClientModule],
2077
+ providers: [
2078
+ i1.BaseHttpService,
2079
+ i1.XrayService,
2080
+ ConfigurationApiService,
2081
+ ConfigurationSettingsApiService,
2082
+ ContextApiService,
2083
+ DocumentAttachmentApiService,
2084
+ PriceApiService,
2085
+ ProductModelApiService,
2086
+ QuoteApiService,
2087
+ DocumentTemplatesApiService,
2088
+ RampApiService,
2089
+ SalesforceApiService,
2090
+ UITemplatesApiService,
2091
+ ScriptsApiService,
2092
+ ],
2093
+ }]
2094
+ }] });
2095
+
2096
+ /**
2097
+ * Generated bundle index. Do not edit.
2098
+ */
2099
+
2100
+ exports.ApiModule = ApiModule;
2101
+ exports.ConfigurationApiService = ConfigurationApiService;
2102
+ exports.ConfigurationSettingsApiService = ConfigurationSettingsApiService;
2103
+ exports.ContextApiService = ContextApiService;
2104
+ exports.DocumentAttachmentApiService = DocumentAttachmentApiService;
2105
+ exports.DocumentTemplatesApiService = DocumentTemplatesApiService;
2106
+ exports.PriceApiService = PriceApiService;
2107
+ exports.ProductModelApiService = ProductModelApiService;
2108
+ exports.QuoteApiService = QuoteApiService;
2109
+ exports.RampApiService = RampApiService;
2110
+ exports.SalesforceApiService = SalesforceApiService;
2111
+ exports.ScriptsApiService = ScriptsApiService;
2112
+ exports.UITemplatesApiService = UITemplatesApiService;
2113
+
2114
+ Object.defineProperty(exports, '__esModule', { value: true });
2115
+
2116
+ }));
2117
+ //# sourceMappingURL=veloce-api.umd.js.map