@veloceapps/api 11.0.0-2 → 11.0.0-21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. package/esm2020/index.mjs +2 -45
  2. package/esm2020/src/index.mjs +32 -0
  3. package/esm2020/src/lib/api.module.mjs +108 -0
  4. package/esm2020/src/lib/services/account-api.service.mjs +87 -0
  5. package/esm2020/src/lib/services/auth.service.mjs +22 -0
  6. package/esm2020/src/lib/services/catalog-admin-api.service.mjs +192 -0
  7. package/esm2020/src/lib/services/catalog-api.service.mjs +90 -0
  8. package/esm2020/src/lib/services/configuration-settings-api.service.mjs +96 -0
  9. package/esm2020/src/lib/services/contracted-price-api.service.mjs +45 -0
  10. package/esm2020/src/lib/services/delta-api.service.mjs +23 -0
  11. package/esm2020/src/lib/services/document-attachment-api.service.mjs +66 -0
  12. package/esm2020/src/lib/services/endpoints-api.service.mjs +80 -0
  13. package/esm2020/src/lib/services/flow-state-api.mjs +142 -0
  14. package/esm2020/src/lib/services/flows-api.service.mjs +29 -0
  15. package/esm2020/src/lib/services/guided-sellings-admin-api.service.mjs +65 -0
  16. package/esm2020/src/lib/services/guided-sellings-api.service.mjs +37 -0
  17. package/esm2020/src/lib/services/offers-api.service.mjs +76 -0
  18. package/esm2020/src/lib/services/org-info-api.service.mjs +54 -0
  19. package/esm2020/src/lib/services/picklists-api.service.mjs +41 -0
  20. package/esm2020/src/lib/services/portals-api.service.mjs +76 -0
  21. package/esm2020/src/lib/services/price-api.service.mjs +63 -0
  22. package/esm2020/src/lib/services/product-api.service.mjs +153 -0
  23. package/esm2020/src/lib/services/promotions-api.service.mjs +68 -0
  24. package/esm2020/src/lib/services/ramp-api.service.mjs +31 -0
  25. package/esm2020/src/lib/services/rebate-program-api.service.mjs +68 -0
  26. package/esm2020/src/lib/services/rebate-type-api.service.mjs +68 -0
  27. package/esm2020/src/lib/services/salesforce-api.service.mjs +79 -0
  28. package/esm2020/src/lib/services/sandbox-manager-api.service.mjs +94 -0
  29. package/esm2020/src/lib/services/shopping-cart-settings-api.service.mjs +28 -0
  30. package/esm2020/src/lib/services/stateful-configuration-api.mjs +51 -0
  31. package/esm2020/src/lib/services/veloce-objects-api.service.mjs +90 -0
  32. package/esm2020/src/lib/types/attachment.types.mjs +2 -0
  33. package/esm2020/src/lib/types/auth.types.mjs +2 -0
  34. package/esm2020/src/lib/types/clone-request.types.mjs +2 -0
  35. package/esm2020/src/lib/types/delta-request.types.mjs +2 -0
  36. package/esm2020/src/lib/types/dto/configuration-settings-dto.types.mjs +22 -0
  37. package/esm2020/src/lib/types/dto/offers-dto.types.mjs +2 -0
  38. package/esm2020/src/lib/types/index.mjs +8 -0
  39. package/esm2020/src/lib/types/org-info.types.mjs +2 -0
  40. package/esm2020/src/lib/types/price.types.mjs +2 -0
  41. package/esm2020/src/lib/types/quote.types.mjs +2 -0
  42. package/esm2020/src/lib/types/ramp-request.types.mjs +2 -0
  43. package/esm2020/src/lib/types/search-request.types.mjs +2 -0
  44. package/esm2020/src/lib/types/stateful-configuration.types.mjs +2 -0
  45. package/esm2020/src/lib/utils/canvas.utils.mjs +33 -0
  46. package/esm2020/src/lib/utils/index.mjs +2 -0
  47. package/esm2020/v2/api-v2.module.mjs +48 -0
  48. package/esm2020/v2/index.mjs +4 -0
  49. package/esm2020/v2/services/configuration-processors-api.service.mjs +38 -0
  50. package/esm2020/v2/services/context-definition-api.service.mjs +62 -0
  51. package/esm2020/v2/services/index.mjs +13 -0
  52. package/esm2020/v2/services/procedures-admin-api.service.mjs +82 -0
  53. package/esm2020/v2/services/procedures-api.service.mjs +44 -0
  54. package/esm2020/v2/services/rule-groups-admin-api.service.mjs +62 -0
  55. package/esm2020/v2/services/rules-admin-api.service.mjs +95 -0
  56. package/esm2020/v2/services/rules-api.service.mjs +36 -0
  57. package/esm2020/v2/services/sales-transactions-api.service.mjs +52 -0
  58. package/esm2020/v2/services/scripts-admin-api.service.mjs +75 -0
  59. package/esm2020/v2/services/scripts-api.service.mjs +23 -0
  60. package/esm2020/v2/services/ui-definitions-api.service.mjs +66 -0
  61. package/esm2020/{lib → v2}/services/ui-templates-api.service.mjs +2 -2
  62. package/esm2020/v2/types/clone-request.types.mjs +2 -0
  63. package/esm2020/v2/types/dto/ui-definition-dto.types.mjs +2 -0
  64. package/esm2020/v2/types/dto/ui-template-dto.types.mjs +2 -0
  65. package/esm2020/v2/types/index.mjs +4 -0
  66. package/esm2020/v2/types/procedure.types.mjs +2 -0
  67. package/esm2020/v2/types/sales-transaction.types.mjs +2 -0
  68. package/esm2020/v2/utils/ui-definition.utils.mjs +23 -0
  69. package/esm2020/v2/utils/ui-template.utils.mjs +13 -0
  70. package/esm2020/v2/veloceapps-api-v2.mjs +5 -0
  71. package/esm2020/veloceapps-api.mjs +1 -1
  72. package/fesm2015/veloceapps-api-v2.mjs +940 -0
  73. package/fesm2015/veloceapps-api-v2.mjs.map +1 -0
  74. package/fesm2015/veloceapps-api.mjs +14 -1217
  75. package/fesm2015/veloceapps-api.mjs.map +1 -1
  76. package/fesm2020/veloceapps-api-v2.mjs +956 -0
  77. package/fesm2020/veloceapps-api-v2.mjs.map +1 -0
  78. package/fesm2020/veloceapps-api.mjs +11 -1246
  79. package/fesm2020/veloceapps-api.mjs.map +1 -1
  80. package/index.d.ts +1 -44
  81. package/package.json +9 -1
  82. package/src/index.d.ts +31 -0
  83. package/{lib → src/lib}/api.module.d.ts +2 -1
  84. package/{lib → src/lib}/services/catalog-api.service.d.ts +5 -5
  85. package/src/lib/types/price.types.d.ts +5 -0
  86. package/{lib → src/lib}/types/ramp-request.types.d.ts +3 -3
  87. package/{lib → src/lib}/types/stateful-configuration.types.d.ts +1 -2
  88. package/src/lib/utils/index.d.ts +1 -0
  89. package/v2/api-v2.module.d.ts +7 -0
  90. package/v2/index.d.ts +3 -0
  91. package/{lib/services/rlm-api.service.d.ts → v2/services/context-definition-api.service.d.ts} +3 -3
  92. package/v2/services/index.d.ts +12 -0
  93. package/{lib/services/procedures-api.service.d.ts → v2/services/procedures-admin-api.service.d.ts} +6 -13
  94. package/v2/services/procedures-api.service.d.ts +15 -0
  95. package/{lib/services/rule-groups-api.service.d.ts → v2/services/rule-groups-admin-api.service.d.ts} +3 -3
  96. package/{lib/services/rules-api.service.d.ts → v2/services/rules-admin-api.service.d.ts} +4 -4
  97. package/v2/services/rules-api.service.d.ts +11 -0
  98. package/v2/services/sales-transactions-api.service.d.ts +20 -0
  99. package/{lib/services/scripts-api.service.d.ts → v2/services/scripts-admin-api.service.d.ts} +4 -5
  100. package/v2/services/scripts-api.service.d.ts +11 -0
  101. package/{lib → v2}/services/ui-definitions-api.service.d.ts +8 -5
  102. package/v2/types/clone-request.types.d.ts +5 -0
  103. package/v2/types/dto/ui-definition-dto.types.d.ts +7 -0
  104. package/v2/types/index.d.ts +3 -0
  105. package/v2/types/procedure.types.d.ts +10 -0
  106. package/v2/types/sales-transaction.types.d.ts +14 -0
  107. package/v2/utils/ui-definition.utils.d.ts +5 -0
  108. package/esm2020/lib/api.module.mjs +0 -146
  109. package/esm2020/lib/services/account-api.service.mjs +0 -87
  110. package/esm2020/lib/services/auth.service.mjs +0 -22
  111. package/esm2020/lib/services/catalog-admin-api.service.mjs +0 -192
  112. package/esm2020/lib/services/catalog-api.service.mjs +0 -90
  113. package/esm2020/lib/services/configuration-api.service.mjs +0 -109
  114. package/esm2020/lib/services/configuration-processors-api.service.mjs +0 -38
  115. package/esm2020/lib/services/configuration-settings-api.service.mjs +0 -96
  116. package/esm2020/lib/services/context-api.service.mjs +0 -26
  117. package/esm2020/lib/services/contracted-price-api.service.mjs +0 -45
  118. package/esm2020/lib/services/delta-api.service.mjs +0 -23
  119. package/esm2020/lib/services/document-attachment-api.service.mjs +0 -66
  120. package/esm2020/lib/services/endpoints-api.service.mjs +0 -80
  121. package/esm2020/lib/services/flow-state-api.mjs +0 -142
  122. package/esm2020/lib/services/flows-api.service.mjs +0 -29
  123. package/esm2020/lib/services/guided-sellings-admin-api.service.mjs +0 -65
  124. package/esm2020/lib/services/guided-sellings-api.service.mjs +0 -37
  125. package/esm2020/lib/services/offers-api.service.mjs +0 -76
  126. package/esm2020/lib/services/org-info-api.service.mjs +0 -54
  127. package/esm2020/lib/services/picklists-api.service.mjs +0 -41
  128. package/esm2020/lib/services/portals-api.service.mjs +0 -76
  129. package/esm2020/lib/services/price-api.service.mjs +0 -63
  130. package/esm2020/lib/services/procedures-api.service.mjs +0 -113
  131. package/esm2020/lib/services/product-api.service.mjs +0 -153
  132. package/esm2020/lib/services/product-model-api.service.mjs +0 -223
  133. package/esm2020/lib/services/promotions-api.service.mjs +0 -68
  134. package/esm2020/lib/services/quote-api.service.mjs +0 -56
  135. package/esm2020/lib/services/ramp-api.service.mjs +0 -31
  136. package/esm2020/lib/services/rebate-program-api.service.mjs +0 -68
  137. package/esm2020/lib/services/rebate-type-api.service.mjs +0 -68
  138. package/esm2020/lib/services/rlm-api.service.mjs +0 -65
  139. package/esm2020/lib/services/rlm-quote-api.service.mjs +0 -27
  140. package/esm2020/lib/services/rule-groups-api.service.mjs +0 -62
  141. package/esm2020/lib/services/rules-api.service.mjs +0 -98
  142. package/esm2020/lib/services/salesforce-api.service.mjs +0 -79
  143. package/esm2020/lib/services/sandbox-manager-api.service.mjs +0 -94
  144. package/esm2020/lib/services/scripts-api.service.mjs +0 -83
  145. package/esm2020/lib/services/shopping-cart-settings-api.service.mjs +0 -28
  146. package/esm2020/lib/services/stateful-configuration-api.mjs +0 -51
  147. package/esm2020/lib/services/ui-definitions-api.service.mjs +0 -76
  148. package/esm2020/lib/services/veloce-objects-api.service.mjs +0 -90
  149. package/esm2020/lib/types/attachment.types.mjs +0 -2
  150. package/esm2020/lib/types/auth.types.mjs +0 -2
  151. package/esm2020/lib/types/clone-request.types.mjs +0 -2
  152. package/esm2020/lib/types/delta-request.types.mjs +0 -2
  153. package/esm2020/lib/types/dto/configuration-settings-dto.types.mjs +0 -22
  154. package/esm2020/lib/types/dto/offers-dto.types.mjs +0 -2
  155. package/esm2020/lib/types/dto/ui-template-dto.types.mjs +0 -2
  156. package/esm2020/lib/types/index.mjs +0 -8
  157. package/esm2020/lib/types/org-info.types.mjs +0 -2
  158. package/esm2020/lib/types/price.types.mjs +0 -2
  159. package/esm2020/lib/types/quote.types.mjs +0 -2
  160. package/esm2020/lib/types/ramp-request.types.mjs +0 -2
  161. package/esm2020/lib/types/search-request.types.mjs +0 -2
  162. package/esm2020/lib/types/stateful-configuration.types.mjs +0 -2
  163. package/esm2020/lib/utils/canvas.utils.mjs +0 -33
  164. package/esm2020/lib/utils/index.mjs +0 -3
  165. package/esm2020/lib/utils/ui-template.utils.mjs +0 -13
  166. package/lib/services/configuration-api.service.d.ts +0 -23
  167. package/lib/services/context-api.service.d.ts +0 -11
  168. package/lib/services/product-model-api.service.d.ts +0 -29
  169. package/lib/services/quote-api.service.d.ts +0 -22
  170. package/lib/services/rlm-quote-api.service.d.ts +0 -11
  171. package/lib/types/price.types.d.ts +0 -5
  172. package/lib/utils/index.d.ts +0 -2
  173. /package/{lib → src/lib}/services/account-api.service.d.ts +0 -0
  174. /package/{lib → src/lib}/services/auth.service.d.ts +0 -0
  175. /package/{lib → src/lib}/services/catalog-admin-api.service.d.ts +0 -0
  176. /package/{lib → src/lib}/services/configuration-settings-api.service.d.ts +0 -0
  177. /package/{lib → src/lib}/services/contracted-price-api.service.d.ts +0 -0
  178. /package/{lib → src/lib}/services/delta-api.service.d.ts +0 -0
  179. /package/{lib → src/lib}/services/document-attachment-api.service.d.ts +0 -0
  180. /package/{lib → src/lib}/services/endpoints-api.service.d.ts +0 -0
  181. /package/{lib → src/lib}/services/flow-state-api.d.ts +0 -0
  182. /package/{lib → src/lib}/services/flows-api.service.d.ts +0 -0
  183. /package/{lib → src/lib}/services/guided-sellings-admin-api.service.d.ts +0 -0
  184. /package/{lib → src/lib}/services/guided-sellings-api.service.d.ts +0 -0
  185. /package/{lib → src/lib}/services/offers-api.service.d.ts +0 -0
  186. /package/{lib → src/lib}/services/org-info-api.service.d.ts +0 -0
  187. /package/{lib → src/lib}/services/picklists-api.service.d.ts +0 -0
  188. /package/{lib → src/lib}/services/portals-api.service.d.ts +0 -0
  189. /package/{lib → src/lib}/services/price-api.service.d.ts +0 -0
  190. /package/{lib → src/lib}/services/product-api.service.d.ts +0 -0
  191. /package/{lib → src/lib}/services/promotions-api.service.d.ts +0 -0
  192. /package/{lib → src/lib}/services/ramp-api.service.d.ts +0 -0
  193. /package/{lib → src/lib}/services/rebate-program-api.service.d.ts +0 -0
  194. /package/{lib → src/lib}/services/rebate-type-api.service.d.ts +0 -0
  195. /package/{lib → src/lib}/services/salesforce-api.service.d.ts +0 -0
  196. /package/{lib → src/lib}/services/sandbox-manager-api.service.d.ts +0 -0
  197. /package/{lib → src/lib}/services/shopping-cart-settings-api.service.d.ts +0 -0
  198. /package/{lib → src/lib}/services/stateful-configuration-api.d.ts +0 -0
  199. /package/{lib → src/lib}/services/veloce-objects-api.service.d.ts +0 -0
  200. /package/{lib → src/lib}/types/attachment.types.d.ts +0 -0
  201. /package/{lib → src/lib}/types/auth.types.d.ts +0 -0
  202. /package/{lib → src/lib}/types/clone-request.types.d.ts +0 -0
  203. /package/{lib → src/lib}/types/delta-request.types.d.ts +0 -0
  204. /package/{lib → src/lib}/types/dto/configuration-settings-dto.types.d.ts +0 -0
  205. /package/{lib → src/lib}/types/dto/offers-dto.types.d.ts +0 -0
  206. /package/{lib → src/lib}/types/index.d.ts +0 -0
  207. /package/{lib → src/lib}/types/org-info.types.d.ts +0 -0
  208. /package/{lib → src/lib}/types/quote.types.d.ts +0 -0
  209. /package/{lib → src/lib}/types/search-request.types.d.ts +0 -0
  210. /package/{lib → src/lib}/utils/canvas.utils.d.ts +0 -0
  211. /package/{lib → v2}/services/configuration-processors-api.service.d.ts +0 -0
  212. /package/{lib → v2}/services/ui-templates-api.service.d.ts +0 -0
  213. /package/{lib → v2}/types/dto/ui-template-dto.types.d.ts +0 -0
  214. /package/{lib → v2}/utils/ui-template.utils.d.ts +0 -0
@@ -0,0 +1,940 @@
1
+ import { HttpParams, HttpClientModule } from '@angular/common/http';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable, NgModule } from '@angular/core';
4
+ import * as i1 from '@veloceapps/core';
5
+ import { Expression, RuleGroupTypes, parseJsonStringAsObject, BaseHttpService, XrayService } from '@veloceapps/core';
6
+ import { of, map as map$1, noop, catchError as catchError$1, forkJoin, switchMap } from 'rxjs';
7
+ import { catchError, map } from 'rxjs/operators';
8
+ import { __rest } from 'tslib';
9
+
10
+ class ConfigurationProcessorsApiService {
11
+ constructor(baseHttpService) {
12
+ this.baseHttpService = baseHttpService;
13
+ this.serviceUrl = '/v2/configuration/processors/owners';
14
+ this.fetchConfigurationProcessors$ = (ownerId) => {
15
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${ownerId}` });
16
+ };
17
+ this.createConfigurationProcessors$ = (configurationProcessor) => {
18
+ return this.baseHttpService.api({
19
+ method: 'post',
20
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}`,
21
+ body: configurationProcessor,
22
+ });
23
+ };
24
+ this.updateConfigurationProcessors$ = (configurationProcessor) => {
25
+ return this.baseHttpService.api({
26
+ method: 'put',
27
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
28
+ body: configurationProcessor,
29
+ });
30
+ };
31
+ this.deleteConfigurationProcessors$ = (configurationProcessor) => {
32
+ return this.baseHttpService.api({
33
+ method: 'delete',
34
+ url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
35
+ });
36
+ };
37
+ }
38
+ }
39
+ ConfigurationProcessorsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
40
+ ConfigurationProcessorsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService });
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, decorators: [{
42
+ type: Injectable
43
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
44
+
45
+ class ContextDefinitionApiService {
46
+ constructor(baseHttpService) {
47
+ this.baseHttpService = baseHttpService;
48
+ this.serviceUrl = '/v2/context-definition';
49
+ }
50
+ fetchContextDefinitions$() {
51
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, skipErrorHandler: true }).pipe(catchError(() => {
52
+ return of([]);
53
+ }));
54
+ }
55
+ fetchContextMappings$(id) {
56
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}/mappings` });
57
+ }
58
+ fetchContextDefinitionStructure$(id) {
59
+ return this.baseHttpService
60
+ .api({
61
+ url: `${this.serviceUrl}/${id}/structure/details`,
62
+ skipErrorHandler: true,
63
+ })
64
+ .pipe(catchError(() => {
65
+ return of([]);
66
+ }), map(objects => {
67
+ return objects.map(object => {
68
+ var _a, _b;
69
+ const tag = (_b = (_a = object.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
70
+ const objectAttributes = object.attributes || [];
71
+ return {
72
+ id: object.id,
73
+ title: tag || object.title,
74
+ attributes: objectAttributes.map(attribute => {
75
+ var _a, _b;
76
+ const tag = (_b = (_a = attribute.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
77
+ return {
78
+ title: tag || attribute.title,
79
+ fieldType: attribute.fieldType,
80
+ dataType: attribute.dataType,
81
+ };
82
+ }),
83
+ };
84
+ });
85
+ }));
86
+ }
87
+ fetchRlmProcedures(contextDefinitionId) {
88
+ const params = {};
89
+ if (contextDefinitionId) {
90
+ params['contextDefinitionId'] = contextDefinitionId;
91
+ }
92
+ return this.baseHttpService.api({
93
+ url: `${this.serviceUrl}/procedures`,
94
+ params,
95
+ });
96
+ }
97
+ }
98
+ ContextDefinitionApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextDefinitionApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
99
+ ContextDefinitionApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextDefinitionApiService });
100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextDefinitionApiService, decorators: [{
101
+ type: Injectable
102
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
103
+
104
+ class ProceduresAdminApiService {
105
+ constructor(baseHttpService) {
106
+ this.baseHttpService = baseHttpService;
107
+ this.SERVICE_URL = '/v2/admin/procedures';
108
+ this.fetchProcedures$ = () => {
109
+ return this.searchProcedures$(new Expression(), 0, 100);
110
+ };
111
+ this.searchProcedures$ = (expression, skip, count) => {
112
+ let params = new HttpParams();
113
+ params = params.set('skip', '' + skip);
114
+ params = params.set('count', '' + count);
115
+ return this.baseHttpService.api({
116
+ method: 'post',
117
+ url: `${this.SERVICE_URL}/search`,
118
+ params,
119
+ body: expression,
120
+ });
121
+ };
122
+ this.createProcedure$ = (newProcedure) => {
123
+ return this.baseHttpService.api({
124
+ url: `${this.SERVICE_URL}`,
125
+ method: 'post',
126
+ body: newProcedure,
127
+ });
128
+ };
129
+ this.updateProcedure$ = (procedure) => {
130
+ return this.baseHttpService.api({
131
+ url: `${this.SERVICE_URL}/${procedure.id}`,
132
+ method: 'put',
133
+ body: procedure,
134
+ });
135
+ };
136
+ this.duplicateProcedure$ = (body) => {
137
+ return this.baseHttpService
138
+ .api({
139
+ url: `${this.SERVICE_URL}/${body.id}/clone`,
140
+ method: 'post',
141
+ body,
142
+ })
143
+ .pipe(map$1(response => response.clonedRecordId));
144
+ };
145
+ this.removeProcedure$ = (id) => {
146
+ return this.baseHttpService.api({
147
+ url: `${this.SERVICE_URL}/${id}`,
148
+ method: 'delete',
149
+ });
150
+ };
151
+ this.restoreProcedure$ = (id) => {
152
+ return this.baseHttpService.api({
153
+ url: `${this.SERVICE_URL}/${id}/restore`,
154
+ method: 'patch',
155
+ });
156
+ };
157
+ }
158
+ fetchProcedure$(id) {
159
+ return this.baseHttpService.api({
160
+ url: `${this.SERVICE_URL}/${id}`,
161
+ method: 'get',
162
+ });
163
+ }
164
+ /**
165
+ * @deprecated
166
+ */
167
+ fetchDefaultPricingSteps$() {
168
+ return this.baseHttpService.api({
169
+ url: `/admin/procedures/pricing-steps`,
170
+ method: 'get',
171
+ });
172
+ }
173
+ }
174
+ ProceduresAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
175
+ ProceduresAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresAdminApiService });
176
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresAdminApiService, decorators: [{
177
+ type: Injectable
178
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
179
+
180
+ class ProceduresApiService {
181
+ constructor(baseHttpService) {
182
+ this.baseHttpService = baseHttpService;
183
+ this.SERVICE_URL = '/v2/procedures';
184
+ }
185
+ apply$(request, options) {
186
+ return this.baseHttpService.api(Object.assign({ url: `${this.SERVICE_URL}/apply`, method: 'post', body: request }, options));
187
+ }
188
+ execute$(body) {
189
+ return this.baseHttpService.api({
190
+ url: `${this.SERVICE_URL}/execute`,
191
+ method: 'post',
192
+ body,
193
+ });
194
+ }
195
+ catalogExecute$(body) {
196
+ return this.baseHttpService.api({
197
+ url: `${this.SERVICE_URL}/catalog/execute`,
198
+ method: 'post',
199
+ body,
200
+ });
201
+ }
202
+ rlmExecute$(body) {
203
+ return this.baseHttpService.api({
204
+ url: `${this.SERVICE_URL}/rlm/execute`,
205
+ method: 'post',
206
+ body,
207
+ });
208
+ }
209
+ }
210
+ ProceduresApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
211
+ ProceduresApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService });
212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService, decorators: [{
213
+ type: Injectable
214
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
215
+
216
+ class RuleGroupsAdminApiService {
217
+ constructor(baseHttpService) {
218
+ this.baseHttpService = baseHttpService;
219
+ this.serviceUrl = '/v2/admin/rule-groups';
220
+ this.fetchRuleGroups$ = () => {
221
+ return this.searchRuleGroups$(new Expression(), 0, 100);
222
+ };
223
+ this.searchRuleGroups$ = (expression, skip, count) => {
224
+ let params = new HttpParams();
225
+ params = params.set('skip', '' + skip);
226
+ params = params.set('count', '' + count);
227
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
228
+ };
229
+ this.createRuleGroup$ = (ruleGroup) => {
230
+ return this.baseHttpService.api({
231
+ url: `${this.serviceUrl}`,
232
+ method: 'post',
233
+ body: ruleGroup,
234
+ });
235
+ };
236
+ this.updateRuleGroup$ = (ruleGroup) => {
237
+ return this.baseHttpService.api({
238
+ url: `${this.serviceUrl}/${ruleGroup.id}`,
239
+ method: 'post',
240
+ body: ruleGroup,
241
+ });
242
+ };
243
+ this.duplicateRuleGroup$ = (body) => {
244
+ return this.baseHttpService
245
+ .api({
246
+ url: `${this.serviceUrl}/${body.id}/clone`,
247
+ method: 'post',
248
+ body,
249
+ })
250
+ .pipe(map$1(response => response.clonedRecordId));
251
+ };
252
+ this.removeRuleGroup$ = (id) => {
253
+ return this.baseHttpService.api({
254
+ url: `${this.serviceUrl}/${id}`,
255
+ method: 'delete',
256
+ });
257
+ };
258
+ this.restoreRuleGroup$ = (id) => {
259
+ return this.baseHttpService.api({
260
+ url: `${this.serviceUrl}/${id}/restore`,
261
+ method: 'patch',
262
+ });
263
+ };
264
+ }
265
+ }
266
+ RuleGroupsAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
267
+ RuleGroupsAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsAdminApiService });
268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsAdminApiService, decorators: [{
269
+ type: Injectable
270
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
271
+
272
+ class RulesAdminApiService {
273
+ constructor(baseHttpService) {
274
+ this.baseHttpService = baseHttpService;
275
+ this.serviceUrl = '/v2/admin/rules';
276
+ this.fetchRules$ = () => {
277
+ return this.searchRules$(new Expression(), 0, 100);
278
+ };
279
+ this.searchRules$ = (expression, skip, count) => {
280
+ let params = new HttpParams();
281
+ if (typeof skip === 'number') {
282
+ params = params.set('skip', '' + skip);
283
+ }
284
+ if (typeof count === 'number') {
285
+ params = params.set('count', '' + count);
286
+ }
287
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
288
+ };
289
+ this.createRule$ = (rule) => {
290
+ return this.baseHttpService.api({
291
+ url: `${this.serviceUrl}`,
292
+ method: 'post',
293
+ body: rule,
294
+ });
295
+ };
296
+ this.updateRule$ = (rule) => {
297
+ return this.baseHttpService.api({
298
+ url: `${this.serviceUrl}/${rule.id}`,
299
+ method: 'put',
300
+ body: rule,
301
+ });
302
+ };
303
+ this.duplicateRule$ = (body) => {
304
+ return this.baseHttpService
305
+ .api({
306
+ url: `${this.serviceUrl}/${body.id}/clone`,
307
+ method: 'post',
308
+ body,
309
+ })
310
+ .pipe(map$1(response => response.clonedRecordId));
311
+ };
312
+ this.removeRule$ = (id) => {
313
+ return this.baseHttpService.api({
314
+ url: `${this.serviceUrl}/${id}`,
315
+ method: 'delete',
316
+ });
317
+ };
318
+ this.restoreRule$ = (id) => {
319
+ return this.baseHttpService.api({
320
+ url: `${this.serviceUrl}/${id}/restore`,
321
+ method: 'patch',
322
+ });
323
+ };
324
+ }
325
+ fetchRule$(id) {
326
+ return this.baseHttpService.api({
327
+ url: `${this.serviceUrl}/${id}`,
328
+ method: 'get',
329
+ });
330
+ }
331
+ fetchHeaderFields$() {
332
+ return this.baseHttpService.api({
333
+ url: `${this.serviceUrl}/describe/Header`,
334
+ method: 'get',
335
+ });
336
+ }
337
+ execute$(body) {
338
+ const url = this.getExecuteRuleUrl(body.rule.ruleGroupType);
339
+ return this.baseHttpService.api({
340
+ url,
341
+ method: 'post',
342
+ body,
343
+ });
344
+ }
345
+ getExecuteRuleUrl(ruleGroupType) {
346
+ if (ruleGroupType === RuleGroupTypes.eligibility) {
347
+ return '/v2/rules/eligibility/execute';
348
+ }
349
+ if (ruleGroupType === RuleGroupTypes.rlmContextBased || ruleGroupType === RuleGroupTypes.generalContextBased) {
350
+ return '/v2/rules/rlm/execute';
351
+ }
352
+ return '/v2/rules/execute';
353
+ }
354
+ }
355
+ RulesAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
356
+ RulesAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesAdminApiService });
357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesAdminApiService, decorators: [{
358
+ type: Injectable
359
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
360
+
361
+ class RulesApiService {
362
+ constructor(baseHttpService) {
363
+ this.baseHttpService = baseHttpService;
364
+ this.serviceUrl = '/v2/rules';
365
+ }
366
+ execute$(body) {
367
+ const url = this.getExecuteRuleUrl(body.rule.ruleGroupType);
368
+ return this.baseHttpService.api({
369
+ url,
370
+ method: 'post',
371
+ body,
372
+ });
373
+ }
374
+ getExecuteRuleUrl(ruleGroupType) {
375
+ if (ruleGroupType === RuleGroupTypes.eligibility) {
376
+ return `${this.serviceUrl}/eligibility/execute`;
377
+ }
378
+ if (ruleGroupType === RuleGroupTypes.catalog) {
379
+ return `${this.serviceUrl}/catalog/execute`;
380
+ }
381
+ if (ruleGroupType === RuleGroupTypes.rlmContextBased) {
382
+ return `${this.serviceUrl}/rlm/execute`;
383
+ }
384
+ return `${this.serviceUrl}/execute`;
385
+ }
386
+ }
387
+ RulesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
388
+ RulesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService });
389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, decorators: [{
390
+ type: Injectable
391
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
392
+
393
+ class SalesTransactionApiService {
394
+ constructor(httpService) {
395
+ this.httpService = httpService;
396
+ this.SERVICE_URL = '/v2/transactions';
397
+ }
398
+ /**
399
+ * This endpoint doesn't include orders and assets
400
+ * @param objectId SF record ID (quoteId | accountId | opportunityId | orderId etc)
401
+ * @param params Query params
402
+ * @param options Request options
403
+ */
404
+ getState(objectId, params, options) {
405
+ return this.httpService.api(Object.assign({ method: 'get', url: `${this.SERVICE_URL}/${objectId}`, params: params }, options));
406
+ }
407
+ upsert(request, options) {
408
+ return of({
409
+ id: 'ID',
410
+ });
411
+ // return this.httpService.api({
412
+ // method: 'post',
413
+ // url: `${this.SERVICE_URL}`,
414
+ // body: request,
415
+ // ...options,
416
+ // });
417
+ }
418
+ submit(request, options) {
419
+ return of({
420
+ id: 'ID',
421
+ });
422
+ // return this.httpService.api({
423
+ // method: 'post',
424
+ // url: `${this.SERVICE_URL}`,
425
+ // body: request,
426
+ // ...options,
427
+ // });
428
+ }
429
+ }
430
+ SalesTransactionApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
431
+ SalesTransactionApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionApiService });
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionApiService, decorators: [{
433
+ type: Injectable
434
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
435
+
436
+ class ScriptsAdminApiService {
437
+ constructor(baseHttpService) {
438
+ this.baseHttpService = baseHttpService;
439
+ this.serviceUrl = '/v2/admin/scripts';
440
+ this.fetchScripts$ = () => {
441
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
442
+ };
443
+ this.searchScripts$ = (expression, skip, count) => {
444
+ let params = new HttpParams();
445
+ if (typeof skip === 'number') {
446
+ params = params.set('skip', '' + skip);
447
+ }
448
+ if (typeof count === 'number') {
449
+ params = params.set('count', '' + count);
450
+ }
451
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
452
+ };
453
+ this.fetchScript$ = (id) => {
454
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
455
+ };
456
+ this.createScript$ = (script) => {
457
+ return this.baseHttpService.api({
458
+ url: `${this.serviceUrl}`,
459
+ method: 'post',
460
+ body: script,
461
+ });
462
+ };
463
+ this.updateScriptMeta$ = (script) => {
464
+ return this.baseHttpService.api({
465
+ url: `${this.serviceUrl}/${script.id}`,
466
+ method: 'put',
467
+ body: script,
468
+ });
469
+ };
470
+ this.updateScriptDetails$ = (script) => {
471
+ return this.baseHttpService.api({
472
+ url: `${this.serviceUrl}/${script.id}`,
473
+ method: 'put',
474
+ body: script,
475
+ });
476
+ };
477
+ this.cloneScript$ = (cloneRequest) => {
478
+ return this.baseHttpService
479
+ .api({
480
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
481
+ method: 'post',
482
+ body: cloneRequest,
483
+ })
484
+ .pipe(map(response => response.clonedRecordId));
485
+ };
486
+ this.removeScript$ = (id) => {
487
+ return this.baseHttpService.api({
488
+ url: `${this.serviceUrl}/${id}`,
489
+ method: 'delete',
490
+ });
491
+ };
492
+ this.restoreScript$ = (id) => {
493
+ return this.baseHttpService.api({
494
+ url: `${this.serviceUrl}/${id}/restore`,
495
+ method: 'patch',
496
+ });
497
+ };
498
+ }
499
+ }
500
+ ScriptsAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
501
+ ScriptsAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsAdminApiService });
502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsAdminApiService, decorators: [{
503
+ type: Injectable
504
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
505
+
506
+ class ScriptsApiService {
507
+ constructor(baseHttpService) {
508
+ this.baseHttpService = baseHttpService;
509
+ this.serviceUrl = '/v2/scripts';
510
+ this.execute$ = (body) => {
511
+ return this.baseHttpService.api({
512
+ url: `${this.serviceUrl}/execute`,
513
+ method: 'post',
514
+ body,
515
+ errorHandler: () => null,
516
+ });
517
+ };
518
+ }
519
+ }
520
+ ScriptsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
521
+ ScriptsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService });
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, decorators: [{
523
+ type: Injectable
524
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
525
+
526
+ function uiDefinitionFromDTO(container) {
527
+ const { sourceBlob } = container, rest = __rest(container, ["sourceBlob"]);
528
+ return Object.assign(Object.assign({}, rest), { source: parseJsonStringAsObject(sourceBlob) });
529
+ }
530
+ function uiDefinitionToDTO(container) {
531
+ const { source } = container, rest = __rest(container, ["source"]);
532
+ return Object.assign(Object.assign({}, rest), { sourceBlob: JSON.stringify(source) });
533
+ }
534
+ function newUiDefinitionToDTO(container) {
535
+ const { source } = container, rest = __rest(container, ["source"]);
536
+ return Object.assign(Object.assign({}, rest), { sourceBlob: JSON.stringify(source) });
537
+ }
538
+
539
+ class UIDefinitionsApiService {
540
+ constructor(baseHttpService) {
541
+ this.baseHttpService = baseHttpService;
542
+ this.serviceUrl = '/v2/uidefinitions';
543
+ }
544
+ fetchAll$(params) {
545
+ let httpParams = new HttpParams();
546
+ if ((params === null || params === void 0 ? void 0 : params.productId) != null) {
547
+ httpParams = httpParams.set('productId', params.productId);
548
+ }
549
+ if ((params === null || params === void 0 ? void 0 : params.defaultUIDefinitionId) != null) {
550
+ httpParams = httpParams.set('defaultUIDefinitionId', params.defaultUIDefinitionId);
551
+ }
552
+ return this.baseHttpService
553
+ .api({
554
+ method: 'get',
555
+ url: this.serviceUrl,
556
+ params: httpParams,
557
+ })
558
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
559
+ }
560
+ fetch$(id) {
561
+ return this.baseHttpService
562
+ .api({
563
+ method: 'get',
564
+ url: `${this.serviceUrl}/${id}`,
565
+ })
566
+ .pipe(map$1(container => uiDefinitionFromDTO(Object.assign(Object.assign({}, container), { id }))));
567
+ }
568
+ create$(uiDefinitionContainer) {
569
+ const dto = newUiDefinitionToDTO(uiDefinitionContainer);
570
+ return this.baseHttpService
571
+ .api({
572
+ method: 'post',
573
+ url: this.serviceUrl,
574
+ body: dto,
575
+ })
576
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
577
+ }
578
+ update$(uiDefinitionContainer) {
579
+ const dto = uiDefinitionToDTO(uiDefinitionContainer);
580
+ return this.baseHttpService.api({
581
+ method: 'put',
582
+ url: `${this.serviceUrl}/${uiDefinitionContainer.id}`,
583
+ body: dto,
584
+ });
585
+ }
586
+ delete$(id) {
587
+ return this.baseHttpService.api({
588
+ method: 'delete',
589
+ url: `${this.serviceUrl}/${id}`,
590
+ });
591
+ }
592
+ }
593
+ UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
594
+ UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });
595
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
596
+ type: Injectable
597
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
598
+
599
+ const fromUIComponentStoryDTO = (dto, attachments) => {
600
+ return {
601
+ id: dto.id,
602
+ name: dto.name,
603
+ uiComponentId: dto.uiComponentId,
604
+ description: dto.description,
605
+ section: attachments.json,
606
+ template: attachments.html,
607
+ script: attachments.js,
608
+ styles: attachments.css,
609
+ };
610
+ };
611
+
612
+ class UITemplatesApiService {
613
+ constructor(baseHttpService) {
614
+ this.baseHttpService = baseHttpService;
615
+ this.serviceUrl = '/v2/uitemplates';
616
+ this.fetchTemplates$ = (name) => {
617
+ let params = new HttpParams();
618
+ if (name) {
619
+ params = params.append('name', name);
620
+ }
621
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
622
+ };
623
+ this.createTemplate$ = (template) => {
624
+ return this.baseHttpService.api({
625
+ method: 'post',
626
+ url: `${this.serviceUrl}`,
627
+ body: template,
628
+ });
629
+ };
630
+ this.updateTemplate$ = (template) => {
631
+ return this.baseHttpService.api({
632
+ method: 'put',
633
+ url: `${this.serviceUrl}/${template.id}`,
634
+ body: template,
635
+ });
636
+ };
637
+ this.duplicateTemplate$ = (template, cloneRequest) => {
638
+ return this.baseHttpService
639
+ .api({
640
+ url: `${this.serviceUrl}/${template.id}/clone`,
641
+ method: 'post',
642
+ body: cloneRequest,
643
+ })
644
+ .pipe(map$1(response => response.clonedRecordId));
645
+ };
646
+ this.removeTemplate$ = (id) => {
647
+ return this.baseHttpService.api({
648
+ method: 'delete',
649
+ url: `${this.serviceUrl}/${id}`,
650
+ });
651
+ };
652
+ this.restoreTemplate$ = (id) => {
653
+ return this.baseHttpService.api({
654
+ method: 'patch',
655
+ url: `${this.serviceUrl}/${id}`,
656
+ });
657
+ };
658
+ this.searchTemplates$ = (data) => {
659
+ return this.baseHttpService.api({
660
+ method: 'post',
661
+ url: `${this.serviceUrl}/search`,
662
+ params: data.params,
663
+ body: data.expression,
664
+ });
665
+ };
666
+ this.fetchComponents$ = (templateId, name) => {
667
+ let params = new HttpParams();
668
+ if (name) {
669
+ params = params.append('name', name);
670
+ }
671
+ return this.baseHttpService.api({
672
+ url: `${this.serviceUrl}/${templateId}/components`,
673
+ params,
674
+ });
675
+ };
676
+ this.fetchComponent$ = (templateId, componentId) => {
677
+ return this.baseHttpService.api({
678
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
679
+ });
680
+ };
681
+ this.createComponent$ = (component) => {
682
+ return this.baseHttpService.api({
683
+ method: 'post',
684
+ url: `${this.serviceUrl}/${component.uiTemplateId}/components`,
685
+ body: component,
686
+ });
687
+ };
688
+ this.updateComponent$ = (component) => {
689
+ return this.baseHttpService.api({
690
+ method: 'put',
691
+ url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}`,
692
+ body: component,
693
+ });
694
+ };
695
+ this.duplicateComponent$ = (component, cloneRequest) => {
696
+ return this.baseHttpService
697
+ .api({
698
+ url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}/clone`,
699
+ method: 'post',
700
+ body: cloneRequest,
701
+ })
702
+ .pipe(map$1(response => response.clonedRecordId));
703
+ };
704
+ this.removeComponent$ = (templateId, componentId) => {
705
+ return this.baseHttpService.api({
706
+ method: 'delete',
707
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
708
+ });
709
+ };
710
+ this.restoreComponent$ = (templateId, componentId) => {
711
+ return this.baseHttpService.api({
712
+ method: 'patch',
713
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
714
+ });
715
+ };
716
+ this.searchComponents$ = (templateId, data) => {
717
+ return this.baseHttpService.api({
718
+ method: 'post',
719
+ url: `${this.serviceUrl}/${templateId}/components/search`,
720
+ params: data.params,
721
+ body: data.expression,
722
+ });
723
+ };
724
+ this.fetchStoryAttachment = (templateId, componentId, storyId, type) => {
725
+ return this.baseHttpService
726
+ .api({
727
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments/${type}/file`,
728
+ responseType: 'text',
729
+ errorHandler: noop,
730
+ })
731
+ .pipe(catchError$1(() => of('')));
732
+ };
733
+ this.convertToComponentStory$ = (templateId, componentId, storyDto) => {
734
+ return forkJoin([
735
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'html'),
736
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'js'),
737
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'css'),
738
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'json'),
739
+ ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })), map$1(attachments => fromUIComponentStoryDTO(storyDto, attachments)));
740
+ };
741
+ this.fetchStories$ = (templateId, componentId, name) => {
742
+ let params = new HttpParams();
743
+ if (name) {
744
+ params = params.append('name', name);
745
+ }
746
+ return this.baseHttpService
747
+ .api({
748
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
749
+ params,
750
+ })
751
+ .pipe(switchMap(dtos => {
752
+ if (!dtos.length) {
753
+ return of([]);
754
+ }
755
+ return forkJoin(dtos.map(dto => this.convertToComponentStory$(templateId, componentId, dto)));
756
+ }));
757
+ };
758
+ this.fetchStory$ = (templateId, componentId, storyId) => {
759
+ return this.baseHttpService
760
+ .api({
761
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
762
+ })
763
+ .pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
764
+ };
765
+ this.createComponentStory$ = (templateId, story) => {
766
+ return this.baseHttpService.api({
767
+ method: 'post',
768
+ url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories`,
769
+ body: story,
770
+ });
771
+ };
772
+ this.updateComponentStory$ = (templateId, story) => {
773
+ const { script, template, styles, section } = story, rest = __rest(story, ["script", "template", "styles", "section"]);
774
+ return this.baseHttpService
775
+ .api({
776
+ method: 'put',
777
+ url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories/${story.id}`,
778
+ body: rest,
779
+ })
780
+ .pipe(map$1(dto => fromUIComponentStoryDTO(dto, { html: template, js: script, css: styles, json: section })));
781
+ };
782
+ this.duplicateComponentStory$ = (story, cloneRequest) => {
783
+ return this.baseHttpService
784
+ .api({
785
+ url: `${this.serviceUrl}/${story.template}/components/${story.uiComponentId}/stories/${story.id}/clone`,
786
+ method: 'post',
787
+ body: cloneRequest,
788
+ })
789
+ .pipe(map$1(response => response.clonedRecordId));
790
+ };
791
+ this.deleteComponentStory$ = (templateId, componentId, storyId) => {
792
+ return this.baseHttpService.api({
793
+ method: 'delete',
794
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
795
+ });
796
+ };
797
+ this.restoreComponentStory$ = (templateId, componentId, storyId) => {
798
+ return this.baseHttpService.api({
799
+ method: 'patch',
800
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
801
+ });
802
+ };
803
+ this.uploadStoryAttachments$ = (templateId, componentId, storyId, attachments) => {
804
+ const formData = new FormData();
805
+ if (attachments.html != null) {
806
+ formData.append('html', new Blob([attachments.html]), 'story-template.html');
807
+ }
808
+ if (attachments.css != null) {
809
+ formData.append('css', new Blob([attachments.css]), 'story-styles.css');
810
+ }
811
+ if (attachments.js != null) {
812
+ formData.append('js', new Blob([attachments.js]), 'story-script.js');
813
+ }
814
+ if (attachments.json != null) {
815
+ formData.append('json', new Blob([attachments.json]), 'story-section.json');
816
+ }
817
+ return this.baseHttpService.upload({
818
+ method: 'post',
819
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments`,
820
+ body: formData,
821
+ });
822
+ };
823
+ this.fetchComponentAttachments$ = (templateId, component) => {
824
+ return forkJoin([
825
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'html'),
826
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'js'),
827
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'css'),
828
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
829
+ ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
830
+ };
831
+ this.fetchComponentsAttachments$ = (templateId) => {
832
+ return this.fetchComponents$(templateId).pipe(switchMap(components => {
833
+ return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
834
+ }));
835
+ };
836
+ this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
837
+ return this.baseHttpService
838
+ .api({
839
+ method: 'get',
840
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments/${attachmentType}/file`,
841
+ responseType: 'text',
842
+ errorHandler: noop,
843
+ })
844
+ .pipe(catchError$1(() => of('')));
845
+ };
846
+ this.uploadComponentAttachments$ = (templateId, componentId, attachments) => {
847
+ const formData = new FormData();
848
+ if (attachments.html != null) {
849
+ formData.append('html', new Blob([attachments.html]), 'template.html');
850
+ }
851
+ if (attachments.css != null) {
852
+ formData.append('css', new Blob([attachments.css]), 'styles.css');
853
+ }
854
+ if (attachments.js != null) {
855
+ formData.append('js', new Blob([attachments.js]), 'script.js');
856
+ }
857
+ if (attachments.json != null) {
858
+ formData.append('json', new Blob([attachments.json]), 'section.json');
859
+ }
860
+ return this.baseHttpService.upload({
861
+ method: 'post',
862
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments`,
863
+ body: formData,
864
+ });
865
+ };
866
+ }
867
+ getTemplateThumbnailUrl(templateId) {
868
+ return `${this.serviceUrl}/${templateId}/thumbnail/file`;
869
+ }
870
+ attachTemplateThumbnail$(templateId, file) {
871
+ const data = new FormData();
872
+ data.append('thumb', file);
873
+ return this.baseHttpService.upload({
874
+ method: 'post',
875
+ url: `${this.serviceUrl}/${templateId}/thumbnail`,
876
+ body: data,
877
+ });
878
+ }
879
+ removeTemplateThumbnail$(templateId) {
880
+ return this.baseHttpService.api({
881
+ method: 'delete',
882
+ url: `${this.serviceUrl}/${templateId}/thumbnail`,
883
+ });
884
+ }
885
+ }
886
+ UITemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
887
+ UITemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService });
888
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService, decorators: [{
889
+ type: Injectable
890
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
891
+
892
+ class ApiV2Module {
893
+ }
894
+ ApiV2Module.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
895
+ ApiV2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, imports: [HttpClientModule] });
896
+ ApiV2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, providers: [
897
+ BaseHttpService,
898
+ ConfigurationProcessorsApiService,
899
+ ContextDefinitionApiService,
900
+ ProceduresAdminApiService,
901
+ ProceduresApiService,
902
+ RuleGroupsAdminApiService,
903
+ RulesAdminApiService,
904
+ RulesApiService,
905
+ SalesTransactionApiService,
906
+ ScriptsAdminApiService,
907
+ ScriptsApiService,
908
+ UIDefinitionsApiService,
909
+ UITemplatesApiService,
910
+ XrayService,
911
+ ], imports: [HttpClientModule] });
912
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, decorators: [{
913
+ type: NgModule,
914
+ args: [{
915
+ imports: [HttpClientModule],
916
+ providers: [
917
+ BaseHttpService,
918
+ ConfigurationProcessorsApiService,
919
+ ContextDefinitionApiService,
920
+ ProceduresAdminApiService,
921
+ ProceduresApiService,
922
+ RuleGroupsAdminApiService,
923
+ RulesAdminApiService,
924
+ RulesApiService,
925
+ SalesTransactionApiService,
926
+ ScriptsAdminApiService,
927
+ ScriptsApiService,
928
+ UIDefinitionsApiService,
929
+ UITemplatesApiService,
930
+ XrayService,
931
+ ],
932
+ }]
933
+ }] });
934
+
935
+ /**
936
+ * Generated bundle index. Do not edit.
937
+ */
938
+
939
+ export { ApiV2Module, ConfigurationProcessorsApiService, ContextDefinitionApiService, ProceduresAdminApiService, ProceduresApiService, RuleGroupsAdminApiService, RulesAdminApiService, RulesApiService, SalesTransactionApiService, ScriptsAdminApiService, ScriptsApiService, UIDefinitionsApiService, UITemplatesApiService };
940
+ //# sourceMappingURL=veloceapps-api-v2.mjs.map