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