@veloceapps/api 11.0.0-2 → 11.0.0-20

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