@veloceapps/api 11.0.0-11 → 11.0.0-12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/esm2020/index.mjs +2 -45
  2. package/esm2020/src/index.mjs +34 -0
  3. package/esm2020/src/lib/api.module.mjs +114 -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-api.service.mjs +122 -0
  9. package/esm2020/src/lib/services/configuration-settings-api.service.mjs +96 -0
  10. package/esm2020/src/lib/services/contracted-price-api.service.mjs +45 -0
  11. package/esm2020/src/lib/services/delta-api.service.mjs +23 -0
  12. package/esm2020/src/lib/services/document-attachment-api.service.mjs +66 -0
  13. package/esm2020/src/lib/services/endpoints-api.service.mjs +80 -0
  14. package/esm2020/src/lib/services/flow-state-api.mjs +142 -0
  15. package/esm2020/src/lib/services/flows-api.service.mjs +29 -0
  16. package/esm2020/src/lib/services/guided-sellings-admin-api.service.mjs +65 -0
  17. package/esm2020/src/lib/services/guided-sellings-api.service.mjs +37 -0
  18. package/esm2020/src/lib/services/offers-api.service.mjs +76 -0
  19. package/esm2020/src/lib/services/org-info-api.service.mjs +54 -0
  20. package/esm2020/src/lib/services/picklists-api.service.mjs +41 -0
  21. package/esm2020/src/lib/services/portals-api.service.mjs +76 -0
  22. package/esm2020/src/lib/services/price-api.service.mjs +63 -0
  23. package/esm2020/src/lib/services/product-api.service.mjs +153 -0
  24. package/esm2020/src/lib/services/product-model-api.service.mjs +223 -0
  25. package/esm2020/src/lib/services/promotions-api.service.mjs +68 -0
  26. package/esm2020/src/lib/services/ramp-api.service.mjs +31 -0
  27. package/esm2020/src/lib/services/rebate-program-api.service.mjs +68 -0
  28. package/esm2020/src/lib/services/rebate-type-api.service.mjs +68 -0
  29. package/esm2020/src/lib/services/salesforce-api.service.mjs +79 -0
  30. package/esm2020/src/lib/services/sandbox-manager-api.service.mjs +94 -0
  31. package/esm2020/src/lib/services/shopping-cart-settings-api.service.mjs +28 -0
  32. package/esm2020/src/lib/services/stateful-configuration-api.mjs +51 -0
  33. package/esm2020/src/lib/services/veloce-objects-api.service.mjs +90 -0
  34. package/esm2020/src/lib/types/attachment.types.mjs +2 -0
  35. package/esm2020/src/lib/types/auth.types.mjs +2 -0
  36. package/esm2020/src/lib/types/clone-request.types.mjs +2 -0
  37. package/esm2020/src/lib/types/delta-request.types.mjs +2 -0
  38. package/esm2020/src/lib/types/dto/configuration-settings-dto.types.mjs +22 -0
  39. package/esm2020/src/lib/types/dto/offers-dto.types.mjs +2 -0
  40. package/esm2020/src/lib/types/index.mjs +8 -0
  41. package/esm2020/src/lib/types/org-info.types.mjs +2 -0
  42. package/esm2020/src/lib/types/price.types.mjs +2 -0
  43. package/esm2020/src/lib/types/quote.types.mjs +2 -0
  44. package/esm2020/src/lib/types/ramp-request.types.mjs +2 -0
  45. package/esm2020/src/lib/types/search-request.types.mjs +2 -0
  46. package/esm2020/src/lib/types/stateful-configuration.types.mjs +2 -0
  47. package/esm2020/src/lib/utils/canvas.utils.mjs +33 -0
  48. package/esm2020/src/lib/utils/index.mjs +2 -0
  49. package/esm2020/v2/api-v2.module.mjs +48 -0
  50. package/esm2020/v2/index.mjs +4 -0
  51. package/esm2020/v2/services/configuration-processors-api.service.mjs +38 -0
  52. package/esm2020/v2/services/context-definition-api.service.mjs +62 -0
  53. package/esm2020/v2/services/index.mjs +13 -0
  54. package/esm2020/v2/services/procedures-admin-api.service.mjs +82 -0
  55. package/esm2020/v2/services/procedures-api.service.mjs +44 -0
  56. package/esm2020/v2/services/rule-groups-admin-api.service.mjs +62 -0
  57. package/esm2020/v2/services/rules-admin-api.service.mjs +98 -0
  58. package/esm2020/v2/services/rules-api.service.mjs +36 -0
  59. package/esm2020/v2/services/sales-transactions-api.service.mjs +68 -0
  60. package/esm2020/v2/services/scripts-admin-api.service.mjs +75 -0
  61. package/esm2020/v2/services/scripts-api.service.mjs +23 -0
  62. package/esm2020/v2/services/ui-definitions-api.service.mjs +132 -0
  63. package/esm2020/{lib → v2}/services/ui-templates-api.service.mjs +2 -2
  64. package/esm2020/v2/types/clone-request.types.mjs +2 -0
  65. package/esm2020/v2/types/dto/ui-template-dto.types.mjs +2 -0
  66. package/esm2020/v2/types/index.mjs +4 -0
  67. package/esm2020/v2/types/procedure.types.mjs +2 -0
  68. package/esm2020/v2/types/sales-transaction.types.mjs +2 -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 +1005 -0
  73. package/fesm2015/veloceapps-api-v2.mjs.map +1 -0
  74. package/fesm2015/veloceapps-api.mjs +8 -939
  75. package/fesm2015/veloceapps-api.mjs.map +1 -1
  76. package/fesm2020/veloceapps-api-v2.mjs +1019 -0
  77. package/fesm2020/veloceapps-api-v2.mjs.map +1 -0
  78. package/fesm2020/veloceapps-api.mjs +78 -1033
  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 +33 -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 +5 -2
  98. package/v2/types/clone-request.types.d.ts +5 -0
  99. package/v2/types/index.d.ts +3 -0
  100. package/v2/types/procedure.types.d.ts +10 -0
  101. package/v2/types/sales-transaction.types.d.ts +10 -0
  102. package/esm2020/lib/api.module.mjs +0 -146
  103. package/esm2020/lib/services/account-api.service.mjs +0 -87
  104. package/esm2020/lib/services/auth.service.mjs +0 -22
  105. package/esm2020/lib/services/catalog-admin-api.service.mjs +0 -192
  106. package/esm2020/lib/services/catalog-api.service.mjs +0 -90
  107. package/esm2020/lib/services/configuration-api.service.mjs +0 -122
  108. package/esm2020/lib/services/configuration-processors-api.service.mjs +0 -38
  109. package/esm2020/lib/services/configuration-settings-api.service.mjs +0 -96
  110. package/esm2020/lib/services/context-api.service.mjs +0 -26
  111. package/esm2020/lib/services/contracted-price-api.service.mjs +0 -45
  112. package/esm2020/lib/services/delta-api.service.mjs +0 -23
  113. package/esm2020/lib/services/document-attachment-api.service.mjs +0 -66
  114. package/esm2020/lib/services/endpoints-api.service.mjs +0 -80
  115. package/esm2020/lib/services/flow-state-api.mjs +0 -142
  116. package/esm2020/lib/services/flows-api.service.mjs +0 -29
  117. package/esm2020/lib/services/guided-sellings-admin-api.service.mjs +0 -65
  118. package/esm2020/lib/services/guided-sellings-api.service.mjs +0 -37
  119. package/esm2020/lib/services/offers-api.service.mjs +0 -76
  120. package/esm2020/lib/services/org-info-api.service.mjs +0 -54
  121. package/esm2020/lib/services/picklists-api.service.mjs +0 -41
  122. package/esm2020/lib/services/portals-api.service.mjs +0 -76
  123. package/esm2020/lib/services/price-api.service.mjs +0 -63
  124. package/esm2020/lib/services/procedures-api.service.mjs +0 -113
  125. package/esm2020/lib/services/product-api.service.mjs +0 -153
  126. package/esm2020/lib/services/product-model-api.service.mjs +0 -223
  127. package/esm2020/lib/services/promotions-api.service.mjs +0 -68
  128. package/esm2020/lib/services/quote-api.service.mjs +0 -56
  129. package/esm2020/lib/services/ramp-api.service.mjs +0 -31
  130. package/esm2020/lib/services/rebate-program-api.service.mjs +0 -68
  131. package/esm2020/lib/services/rebate-type-api.service.mjs +0 -68
  132. package/esm2020/lib/services/rlm-api.service.mjs +0 -64
  133. package/esm2020/lib/services/rlm-quote-api.service.mjs +0 -27
  134. package/esm2020/lib/services/rule-groups-api.service.mjs +0 -62
  135. package/esm2020/lib/services/rules-api.service.mjs +0 -98
  136. package/esm2020/lib/services/salesforce-api.service.mjs +0 -79
  137. package/esm2020/lib/services/sandbox-manager-api.service.mjs +0 -94
  138. package/esm2020/lib/services/scripts-api.service.mjs +0 -83
  139. package/esm2020/lib/services/shopping-cart-settings-api.service.mjs +0 -28
  140. package/esm2020/lib/services/stateful-configuration-api.mjs +0 -51
  141. package/esm2020/lib/services/ui-definitions-api.service.mjs +0 -122
  142. package/esm2020/lib/services/veloce-objects-api.service.mjs +0 -90
  143. package/esm2020/lib/types/attachment.types.mjs +0 -2
  144. package/esm2020/lib/types/auth.types.mjs +0 -2
  145. package/esm2020/lib/types/clone-request.types.mjs +0 -2
  146. package/esm2020/lib/types/delta-request.types.mjs +0 -2
  147. package/esm2020/lib/types/dto/configuration-settings-dto.types.mjs +0 -22
  148. package/esm2020/lib/types/dto/offers-dto.types.mjs +0 -2
  149. package/esm2020/lib/types/dto/ui-template-dto.types.mjs +0 -2
  150. package/esm2020/lib/types/index.mjs +0 -8
  151. package/esm2020/lib/types/org-info.types.mjs +0 -2
  152. package/esm2020/lib/types/price.types.mjs +0 -2
  153. package/esm2020/lib/types/quote.types.mjs +0 -2
  154. package/esm2020/lib/types/ramp-request.types.mjs +0 -2
  155. package/esm2020/lib/types/search-request.types.mjs +0 -2
  156. package/esm2020/lib/types/stateful-configuration.types.mjs +0 -2
  157. package/esm2020/lib/utils/canvas.utils.mjs +0 -33
  158. package/esm2020/lib/utils/index.mjs +0 -3
  159. package/esm2020/lib/utils/ui-template.utils.mjs +0 -13
  160. package/lib/services/context-api.service.d.ts +0 -11
  161. package/lib/services/quote-api.service.d.ts +0 -22
  162. package/lib/services/rlm-quote-api.service.d.ts +0 -11
  163. package/lib/utils/index.d.ts +0 -2
  164. /package/{lib → src/lib}/services/account-api.service.d.ts +0 -0
  165. /package/{lib → src/lib}/services/auth.service.d.ts +0 -0
  166. /package/{lib → src/lib}/services/catalog-admin-api.service.d.ts +0 -0
  167. /package/{lib → src/lib}/services/catalog-api.service.d.ts +0 -0
  168. /package/{lib → src/lib}/services/configuration-api.service.d.ts +0 -0
  169. /package/{lib → src/lib}/services/configuration-settings-api.service.d.ts +0 -0
  170. /package/{lib → src/lib}/services/contracted-price-api.service.d.ts +0 -0
  171. /package/{lib → src/lib}/services/delta-api.service.d.ts +0 -0
  172. /package/{lib → src/lib}/services/document-attachment-api.service.d.ts +0 -0
  173. /package/{lib → src/lib}/services/endpoints-api.service.d.ts +0 -0
  174. /package/{lib → src/lib}/services/flow-state-api.d.ts +0 -0
  175. /package/{lib → src/lib}/services/flows-api.service.d.ts +0 -0
  176. /package/{lib → src/lib}/services/guided-sellings-admin-api.service.d.ts +0 -0
  177. /package/{lib → src/lib}/services/guided-sellings-api.service.d.ts +0 -0
  178. /package/{lib → src/lib}/services/offers-api.service.d.ts +0 -0
  179. /package/{lib → src/lib}/services/org-info-api.service.d.ts +0 -0
  180. /package/{lib → src/lib}/services/picklists-api.service.d.ts +0 -0
  181. /package/{lib → src/lib}/services/portals-api.service.d.ts +0 -0
  182. /package/{lib → src/lib}/services/price-api.service.d.ts +0 -0
  183. /package/{lib → src/lib}/services/product-api.service.d.ts +0 -0
  184. /package/{lib → src/lib}/services/product-model-api.service.d.ts +0 -0
  185. /package/{lib → src/lib}/services/promotions-api.service.d.ts +0 -0
  186. /package/{lib → src/lib}/services/ramp-api.service.d.ts +0 -0
  187. /package/{lib → src/lib}/services/rebate-program-api.service.d.ts +0 -0
  188. /package/{lib → src/lib}/services/rebate-type-api.service.d.ts +0 -0
  189. /package/{lib → src/lib}/services/salesforce-api.service.d.ts +0 -0
  190. /package/{lib → src/lib}/services/sandbox-manager-api.service.d.ts +0 -0
  191. /package/{lib → src/lib}/services/shopping-cart-settings-api.service.d.ts +0 -0
  192. /package/{lib → src/lib}/services/stateful-configuration-api.d.ts +0 -0
  193. /package/{lib → src/lib}/services/veloce-objects-api.service.d.ts +0 -0
  194. /package/{lib → src/lib}/types/attachment.types.d.ts +0 -0
  195. /package/{lib → src/lib}/types/auth.types.d.ts +0 -0
  196. /package/{lib → src/lib}/types/clone-request.types.d.ts +0 -0
  197. /package/{lib → src/lib}/types/delta-request.types.d.ts +0 -0
  198. /package/{lib → src/lib}/types/dto/configuration-settings-dto.types.d.ts +0 -0
  199. /package/{lib → src/lib}/types/dto/offers-dto.types.d.ts +0 -0
  200. /package/{lib → src/lib}/types/index.d.ts +0 -0
  201. /package/{lib → src/lib}/types/org-info.types.d.ts +0 -0
  202. /package/{lib → src/lib}/types/price.types.d.ts +0 -0
  203. /package/{lib → src/lib}/types/quote.types.d.ts +0 -0
  204. /package/{lib → src/lib}/types/ramp-request.types.d.ts +0 -0
  205. /package/{lib → src/lib}/types/search-request.types.d.ts +0 -0
  206. /package/{lib → src/lib}/types/stateful-configuration.types.d.ts +0 -0
  207. /package/{lib → src/lib}/utils/canvas.utils.d.ts +0 -0
  208. /package/{lib → v2}/services/configuration-processors-api.service.d.ts +0 -0
  209. /package/{lib → v2}/services/ui-templates-api.service.d.ts +0 -0
  210. /package/{lib → v2}/types/dto/ui-template-dto.types.d.ts +0 -0
  211. /package/{lib → v2}/utils/ui-template.utils.d.ts +0 -0
@@ -0,0 +1,1019 @@
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, uiDefinitionFromDTO, uiDefinitionToDTO, 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 '/rules/eligibility/execute';
351
+ }
352
+ if (ruleGroupType === RuleGroupTypes.catalog) {
353
+ return '/rules/catalog/execute';
354
+ }
355
+ if (ruleGroupType === RuleGroupTypes.rlmContextBased) {
356
+ return '/rules/rlm/execute';
357
+ }
358
+ return '/rules/execute';
359
+ }
360
+ }
361
+ RulesAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
362
+ RulesAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesAdminApiService });
363
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesAdminApiService, decorators: [{
364
+ type: Injectable
365
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
366
+
367
+ class RulesApiService {
368
+ constructor(baseHttpService) {
369
+ this.baseHttpService = baseHttpService;
370
+ this.serviceUrl = '/v2/rules';
371
+ }
372
+ execute$(body) {
373
+ const url = this.getExecuteRuleUrl(body.rule.ruleGroupType);
374
+ return this.baseHttpService.api({
375
+ url,
376
+ method: 'post',
377
+ body,
378
+ });
379
+ }
380
+ getExecuteRuleUrl(ruleGroupType) {
381
+ if (ruleGroupType === RuleGroupTypes.eligibility) {
382
+ return `${this.serviceUrl}/eligibility/execute`;
383
+ }
384
+ if (ruleGroupType === RuleGroupTypes.catalog) {
385
+ return `${this.serviceUrl}/catalog/execute`;
386
+ }
387
+ if (ruleGroupType === RuleGroupTypes.rlmContextBased) {
388
+ return `${this.serviceUrl}/rlm/execute`;
389
+ }
390
+ return `${this.serviceUrl}/execute`;
391
+ }
392
+ }
393
+ RulesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
394
+ RulesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService });
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, decorators: [{
396
+ type: Injectable
397
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
398
+
399
+ class SalesTransactionApiService {
400
+ constructor(httpService) {
401
+ this.httpService = httpService;
402
+ this.SERVICE_URL = '/v2/transactions';
403
+ }
404
+ /**
405
+ * This endpoint doesn't include orders and assets
406
+ * @param objectId SF record ID (quoteId | accountId | opportunityId | orderId etc)
407
+ * @param params Query params
408
+ * @param options Request options
409
+ */
410
+ getState(objectId, params, options) {
411
+ // return of({
412
+ // id: 'ID',
413
+ // salesTransactionName: 'Sales Transaction Name',
414
+ // account: 'Acc ID',
415
+ // quoteAccount: 'Acc ID',
416
+ // pricebook: 'Pricebook ID',
417
+ // status: 'Draft',
418
+ // totalAmount: 0,
419
+ // subtotal: 0,
420
+ // activatedDate: '2025-01-25',
421
+ // effectiveDate: '2025-01-25',
422
+ // startDate: '2025-01-25',
423
+ // tags: {},
424
+ // salesTransactionItems: [],
425
+ // assets: [],
426
+ // } satisfies SalesTransaction);
427
+ return this.httpService.api({
428
+ method: 'get',
429
+ url: `${this.SERVICE_URL}/${objectId}`,
430
+ params: params,
431
+ ...options,
432
+ });
433
+ }
434
+ upsert(request, options) {
435
+ return of({
436
+ id: 'ID',
437
+ });
438
+ // return this.httpService.api({
439
+ // method: 'post',
440
+ // url: `${this.SERVICE_URL}`,
441
+ // body: request,
442
+ // ...options,
443
+ // });
444
+ }
445
+ submit(request, options) {
446
+ return of({
447
+ id: 'ID',
448
+ });
449
+ // return this.httpService.api({
450
+ // method: 'post',
451
+ // url: `${this.SERVICE_URL}`,
452
+ // body: request,
453
+ // ...options,
454
+ // });
455
+ }
456
+ }
457
+ SalesTransactionApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
458
+ SalesTransactionApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionApiService });
459
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionApiService, decorators: [{
460
+ type: Injectable
461
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
462
+
463
+ class ScriptsAdminApiService {
464
+ constructor(baseHttpService) {
465
+ this.baseHttpService = baseHttpService;
466
+ this.serviceUrl = '/v2/admin/scripts';
467
+ this.fetchScripts$ = () => {
468
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
469
+ };
470
+ this.searchScripts$ = (expression, skip, count) => {
471
+ let params = new HttpParams();
472
+ if (typeof skip === 'number') {
473
+ params = params.set('skip', '' + skip);
474
+ }
475
+ if (typeof count === 'number') {
476
+ params = params.set('count', '' + count);
477
+ }
478
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
479
+ };
480
+ this.fetchScript$ = (id) => {
481
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
482
+ };
483
+ this.createScript$ = (script) => {
484
+ return this.baseHttpService.api({
485
+ url: `${this.serviceUrl}`,
486
+ method: 'post',
487
+ body: script,
488
+ });
489
+ };
490
+ this.updateScriptMeta$ = (script) => {
491
+ return this.baseHttpService.api({
492
+ url: `${this.serviceUrl}/${script.id}`,
493
+ method: 'put',
494
+ body: script,
495
+ });
496
+ };
497
+ this.updateScriptDetails$ = (script) => {
498
+ return this.baseHttpService.api({
499
+ url: `${this.serviceUrl}/${script.id}`,
500
+ method: 'put',
501
+ body: script,
502
+ });
503
+ };
504
+ this.cloneScript$ = (cloneRequest) => {
505
+ return this.baseHttpService
506
+ .api({
507
+ url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
508
+ method: 'post',
509
+ body: cloneRequest,
510
+ })
511
+ .pipe(map(response => response.clonedRecordId));
512
+ };
513
+ this.removeScript$ = (id) => {
514
+ return this.baseHttpService.api({
515
+ url: `${this.serviceUrl}/${id}`,
516
+ method: 'delete',
517
+ });
518
+ };
519
+ this.restoreScript$ = (id) => {
520
+ return this.baseHttpService.api({
521
+ url: `${this.serviceUrl}/${id}/restore`,
522
+ method: 'patch',
523
+ });
524
+ };
525
+ }
526
+ }
527
+ ScriptsAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
528
+ ScriptsAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsAdminApiService });
529
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsAdminApiService, decorators: [{
530
+ type: Injectable
531
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
532
+
533
+ class ScriptsApiService {
534
+ constructor(baseHttpService) {
535
+ this.baseHttpService = baseHttpService;
536
+ this.serviceUrl = '/v2/scripts';
537
+ this.execute$ = (body) => {
538
+ return this.baseHttpService.api({
539
+ url: `${this.serviceUrl}/execute`,
540
+ method: 'post',
541
+ body,
542
+ errorHandler: () => null,
543
+ });
544
+ };
545
+ }
546
+ }
547
+ ScriptsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
548
+ ScriptsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService });
549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, decorators: [{
550
+ type: Injectable
551
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
552
+
553
+ class UIDefinitionsApiService {
554
+ constructor(baseHttpService) {
555
+ this.baseHttpService = baseHttpService;
556
+ this.serviceUrl = '/v2/uidefinitions';
557
+ }
558
+ fetch$(modelId, version) {
559
+ const serviceUrl = this.getServiceUrl(modelId);
560
+ let params = new HttpParams();
561
+ if (version != null) {
562
+ params = params.set('modelVersion', version);
563
+ }
564
+ return this.baseHttpService
565
+ .api({
566
+ method: 'get',
567
+ url: serviceUrl,
568
+ params: params,
569
+ })
570
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
571
+ }
572
+ create$(modelId, uiDefinitionContainer) {
573
+ const serviceUrl = this.getServiceUrl(modelId);
574
+ const dto = {
575
+ ...omit(uiDefinitionContainer, 'source'),
576
+ name: uiDefinitionContainer.source.name,
577
+ modelId: uiDefinitionContainer.source.modelId,
578
+ templateName: uiDefinitionContainer.source.uiTemplateData?.TEMPLATE_NAME,
579
+ rootType: uiDefinitionContainer.source.uiTemplateData?.ROOT_TYPE,
580
+ defaultFlag: uiDefinitionContainer.source.primary,
581
+ sourceBlob: JSON.stringify(uiDefinitionContainer.source),
582
+ };
583
+ return this.baseHttpService
584
+ .api({
585
+ method: 'post',
586
+ url: serviceUrl,
587
+ body: dto,
588
+ })
589
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
590
+ }
591
+ get$(modelId, uiDefinitionId) {
592
+ const serviceUrl = this.getServiceUrl(modelId);
593
+ return this.baseHttpService
594
+ .api({
595
+ method: 'get',
596
+ url: `${serviceUrl}/${uiDefinitionId}`,
597
+ })
598
+ .pipe(map$1(container => uiDefinitionFromDTO({ ...container, id: uiDefinitionId })));
599
+ }
600
+ update$(uiDefinitionContainer) {
601
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
602
+ const dto = uiDefinitionToDTO(uiDefinitionContainer);
603
+ return this.baseHttpService
604
+ .api({
605
+ method: 'put',
606
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
607
+ body: dto,
608
+ })
609
+ .pipe(map$1(container => uiDefinitionFromDTO(container)));
610
+ }
611
+ delete$(uiDefinitionContainer) {
612
+ const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
613
+ return this.baseHttpService.api({
614
+ method: 'delete',
615
+ url: `${serviceUrl}/${uiDefinitionContainer.id}`,
616
+ });
617
+ }
618
+ getServiceUrl(modelId) {
619
+ return `/models/${modelId}/uidefinitions`;
620
+ }
621
+ fetchUIDefinitions$(params) {
622
+ let httpParams = new HttpParams();
623
+ if (params?.productId != null) {
624
+ httpParams = httpParams.set('productId', params.productId);
625
+ }
626
+ if (params?.defaultUIDefinitionId != null) {
627
+ httpParams = httpParams.set('defaultUIDefinitionId', params.defaultUIDefinitionId);
628
+ }
629
+ return this.baseHttpService
630
+ .api({
631
+ method: 'get',
632
+ url: this.serviceUrl,
633
+ params: httpParams,
634
+ })
635
+ .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
636
+ }
637
+ fetchUIDefinition$(id) {
638
+ return this.baseHttpService
639
+ .api({
640
+ method: 'get',
641
+ url: `${this.serviceUrl}/${id}`,
642
+ })
643
+ .pipe(map$1(container => uiDefinitionFromDTO({ ...container, id })), map$1(uiDefinition => {
644
+ const result = uiDefinition;
645
+ if (!uiDefinition.modelId && uiDefinition.source.modelId) {
646
+ result['modelId'] = uiDefinition.source.modelId;
647
+ }
648
+ return result;
649
+ }));
650
+ }
651
+ createUIDefinition$(body) {
652
+ return this.baseHttpService.api({
653
+ method: 'post',
654
+ url: this.serviceUrl,
655
+ body,
656
+ });
657
+ }
658
+ updateUIDefinition$(uiDefinition) {
659
+ return this.baseHttpService.api({
660
+ method: 'put',
661
+ url: `${this.serviceUrl}/${uiDefinition.id}`,
662
+ body: uiDefinition,
663
+ });
664
+ }
665
+ deleteUIDefinition$(id) {
666
+ return this.baseHttpService.api({
667
+ method: 'delete',
668
+ url: `${this.serviceUrl}/${id}`,
669
+ });
670
+ }
671
+ }
672
+ UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
673
+ UIDefinitionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });
674
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
675
+ type: Injectable
676
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
677
+
678
+ const fromUIComponentStoryDTO = (dto, attachments) => {
679
+ return {
680
+ id: dto.id,
681
+ name: dto.name,
682
+ uiComponentId: dto.uiComponentId,
683
+ description: dto.description,
684
+ section: attachments.json,
685
+ template: attachments.html,
686
+ script: attachments.js,
687
+ styles: attachments.css,
688
+ };
689
+ };
690
+
691
+ class UITemplatesApiService {
692
+ constructor(baseHttpService) {
693
+ this.baseHttpService = baseHttpService;
694
+ this.serviceUrl = '/v2/uitemplates';
695
+ this.fetchTemplates$ = (name) => {
696
+ let params = new HttpParams();
697
+ if (name) {
698
+ params = params.append('name', name);
699
+ }
700
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
701
+ };
702
+ this.createTemplate$ = (template) => {
703
+ return this.baseHttpService.api({
704
+ method: 'post',
705
+ url: `${this.serviceUrl}`,
706
+ body: template,
707
+ });
708
+ };
709
+ this.updateTemplate$ = (template) => {
710
+ return this.baseHttpService.api({
711
+ method: 'put',
712
+ url: `${this.serviceUrl}/${template.id}`,
713
+ body: template,
714
+ });
715
+ };
716
+ this.duplicateTemplate$ = (template, cloneRequest) => {
717
+ return this.baseHttpService
718
+ .api({
719
+ url: `${this.serviceUrl}/${template.id}/clone`,
720
+ method: 'post',
721
+ body: cloneRequest,
722
+ })
723
+ .pipe(map$1(response => response.clonedRecordId));
724
+ };
725
+ this.removeTemplate$ = (id) => {
726
+ return this.baseHttpService.api({
727
+ method: 'delete',
728
+ url: `${this.serviceUrl}/${id}`,
729
+ });
730
+ };
731
+ this.restoreTemplate$ = (id) => {
732
+ return this.baseHttpService.api({
733
+ method: 'patch',
734
+ url: `${this.serviceUrl}/${id}`,
735
+ });
736
+ };
737
+ this.searchTemplates$ = (data) => {
738
+ return this.baseHttpService.api({
739
+ method: 'post',
740
+ url: `${this.serviceUrl}/search`,
741
+ params: data.params,
742
+ body: data.expression,
743
+ });
744
+ };
745
+ this.fetchComponents$ = (templateId, name) => {
746
+ let params = new HttpParams();
747
+ if (name) {
748
+ params = params.append('name', name);
749
+ }
750
+ return this.baseHttpService.api({
751
+ url: `${this.serviceUrl}/${templateId}/components`,
752
+ params,
753
+ });
754
+ };
755
+ this.fetchComponent$ = (templateId, componentId) => {
756
+ return this.baseHttpService.api({
757
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
758
+ });
759
+ };
760
+ this.createComponent$ = (component) => {
761
+ return this.baseHttpService.api({
762
+ method: 'post',
763
+ url: `${this.serviceUrl}/${component.uiTemplateId}/components`,
764
+ body: component,
765
+ });
766
+ };
767
+ this.updateComponent$ = (component) => {
768
+ return this.baseHttpService.api({
769
+ method: 'put',
770
+ url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}`,
771
+ body: component,
772
+ });
773
+ };
774
+ this.duplicateComponent$ = (component, cloneRequest) => {
775
+ return this.baseHttpService
776
+ .api({
777
+ url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}/clone`,
778
+ method: 'post',
779
+ body: cloneRequest,
780
+ })
781
+ .pipe(map$1(response => response.clonedRecordId));
782
+ };
783
+ this.removeComponent$ = (templateId, componentId) => {
784
+ return this.baseHttpService.api({
785
+ method: 'delete',
786
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
787
+ });
788
+ };
789
+ this.restoreComponent$ = (templateId, componentId) => {
790
+ return this.baseHttpService.api({
791
+ method: 'patch',
792
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
793
+ });
794
+ };
795
+ this.searchComponents$ = (templateId, data) => {
796
+ return this.baseHttpService.api({
797
+ method: 'post',
798
+ url: `${this.serviceUrl}/${templateId}/components/search`,
799
+ params: data.params,
800
+ body: data.expression,
801
+ });
802
+ };
803
+ this.fetchStoryAttachment = (templateId, componentId, storyId, type) => {
804
+ return this.baseHttpService
805
+ .api({
806
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments/${type}/file`,
807
+ responseType: 'text',
808
+ errorHandler: noop,
809
+ })
810
+ .pipe(catchError$1(() => of('')));
811
+ };
812
+ this.convertToComponentStory$ = (templateId, componentId, storyDto) => {
813
+ return forkJoin([
814
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'html'),
815
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'js'),
816
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'css'),
817
+ this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'json'),
818
+ ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })), map$1(attachments => fromUIComponentStoryDTO(storyDto, attachments)));
819
+ };
820
+ this.fetchStories$ = (templateId, componentId, name) => {
821
+ let params = new HttpParams();
822
+ if (name) {
823
+ params = params.append('name', name);
824
+ }
825
+ return this.baseHttpService
826
+ .api({
827
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
828
+ params,
829
+ })
830
+ .pipe(switchMap(dtos => {
831
+ if (!dtos.length) {
832
+ return of([]);
833
+ }
834
+ return forkJoin(dtos.map(dto => this.convertToComponentStory$(templateId, componentId, dto)));
835
+ }));
836
+ };
837
+ this.fetchStory$ = (templateId, componentId, storyId) => {
838
+ return this.baseHttpService
839
+ .api({
840
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
841
+ })
842
+ .pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
843
+ };
844
+ this.createComponentStory$ = (templateId, story) => {
845
+ return this.baseHttpService.api({
846
+ method: 'post',
847
+ url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories`,
848
+ body: story,
849
+ });
850
+ };
851
+ this.updateComponentStory$ = (templateId, story) => {
852
+ const { script, template, styles, section, ...rest } = story;
853
+ return this.baseHttpService
854
+ .api({
855
+ method: 'put',
856
+ url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories/${story.id}`,
857
+ body: rest,
858
+ })
859
+ .pipe(map$1(dto => fromUIComponentStoryDTO(dto, { html: template, js: script, css: styles, json: section })));
860
+ };
861
+ this.duplicateComponentStory$ = (story, cloneRequest) => {
862
+ return this.baseHttpService
863
+ .api({
864
+ url: `${this.serviceUrl}/${story.template}/components/${story.uiComponentId}/stories/${story.id}/clone`,
865
+ method: 'post',
866
+ body: cloneRequest,
867
+ })
868
+ .pipe(map$1(response => response.clonedRecordId));
869
+ };
870
+ this.deleteComponentStory$ = (templateId, componentId, storyId) => {
871
+ return this.baseHttpService.api({
872
+ method: 'delete',
873
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
874
+ });
875
+ };
876
+ this.restoreComponentStory$ = (templateId, componentId, storyId) => {
877
+ return this.baseHttpService.api({
878
+ method: 'patch',
879
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
880
+ });
881
+ };
882
+ this.uploadStoryAttachments$ = (templateId, componentId, storyId, attachments) => {
883
+ const formData = new FormData();
884
+ if (attachments.html != null) {
885
+ formData.append('html', new Blob([attachments.html]), 'story-template.html');
886
+ }
887
+ if (attachments.css != null) {
888
+ formData.append('css', new Blob([attachments.css]), 'story-styles.css');
889
+ }
890
+ if (attachments.js != null) {
891
+ formData.append('js', new Blob([attachments.js]), 'story-script.js');
892
+ }
893
+ if (attachments.json != null) {
894
+ formData.append('json', new Blob([attachments.json]), 'story-section.json');
895
+ }
896
+ return this.baseHttpService.upload({
897
+ method: 'post',
898
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments`,
899
+ body: formData,
900
+ });
901
+ };
902
+ this.fetchComponentAttachments$ = (templateId, component) => {
903
+ return forkJoin([
904
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'html'),
905
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'js'),
906
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'css'),
907
+ this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
908
+ ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
909
+ };
910
+ this.fetchComponentsAttachments$ = (templateId) => {
911
+ return this.fetchComponents$(templateId).pipe(switchMap(components => {
912
+ return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
913
+ }));
914
+ };
915
+ this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
916
+ return this.baseHttpService
917
+ .api({
918
+ method: 'get',
919
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments/${attachmentType}/file`,
920
+ responseType: 'text',
921
+ errorHandler: noop,
922
+ })
923
+ .pipe(catchError$1(() => of('')));
924
+ };
925
+ this.uploadComponentAttachments$ = (templateId, componentId, attachments) => {
926
+ const formData = new FormData();
927
+ if (attachments.html != null) {
928
+ formData.append('html', new Blob([attachments.html]), 'template.html');
929
+ }
930
+ if (attachments.css != null) {
931
+ formData.append('css', new Blob([attachments.css]), 'styles.css');
932
+ }
933
+ if (attachments.js != null) {
934
+ formData.append('js', new Blob([attachments.js]), 'script.js');
935
+ }
936
+ if (attachments.json != null) {
937
+ formData.append('json', new Blob([attachments.json]), 'section.json');
938
+ }
939
+ return this.baseHttpService.upload({
940
+ method: 'post',
941
+ url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments`,
942
+ body: formData,
943
+ });
944
+ };
945
+ }
946
+ getTemplateThumbnailUrl(templateId) {
947
+ return `${this.serviceUrl}/${templateId}/thumbnail/file`;
948
+ }
949
+ attachTemplateThumbnail$(templateId, file) {
950
+ const data = new FormData();
951
+ data.append('thumb', file);
952
+ return this.baseHttpService.upload({
953
+ method: 'post',
954
+ url: `${this.serviceUrl}/${templateId}/thumbnail`,
955
+ body: data,
956
+ });
957
+ }
958
+ removeTemplateThumbnail$(templateId) {
959
+ return this.baseHttpService.api({
960
+ method: 'delete',
961
+ url: `${this.serviceUrl}/${templateId}/thumbnail`,
962
+ });
963
+ }
964
+ }
965
+ UITemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
966
+ UITemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService });
967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService, decorators: [{
968
+ type: Injectable
969
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
970
+
971
+ class ApiV2Module {
972
+ }
973
+ ApiV2Module.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
974
+ ApiV2Module.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, imports: [HttpClientModule] });
975
+ ApiV2Module.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, providers: [
976
+ BaseHttpService,
977
+ ConfigurationProcessorsApiService,
978
+ ContextDefinitionApiService,
979
+ ProceduresAdminApiService,
980
+ ProceduresApiService,
981
+ RuleGroupsAdminApiService,
982
+ RulesAdminApiService,
983
+ RulesApiService,
984
+ SalesTransactionApiService,
985
+ ScriptsAdminApiService,
986
+ ScriptsApiService,
987
+ UIDefinitionsApiService,
988
+ UITemplatesApiService,
989
+ XrayService,
990
+ ], imports: [HttpClientModule] });
991
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiV2Module, decorators: [{
992
+ type: NgModule,
993
+ args: [{
994
+ imports: [HttpClientModule],
995
+ providers: [
996
+ BaseHttpService,
997
+ ConfigurationProcessorsApiService,
998
+ ContextDefinitionApiService,
999
+ ProceduresAdminApiService,
1000
+ ProceduresApiService,
1001
+ RuleGroupsAdminApiService,
1002
+ RulesAdminApiService,
1003
+ RulesApiService,
1004
+ SalesTransactionApiService,
1005
+ ScriptsAdminApiService,
1006
+ ScriptsApiService,
1007
+ UIDefinitionsApiService,
1008
+ UITemplatesApiService,
1009
+ XrayService,
1010
+ ],
1011
+ }]
1012
+ }] });
1013
+
1014
+ /**
1015
+ * Generated bundle index. Do not edit.
1016
+ */
1017
+
1018
+ export { ApiV2Module, ConfigurationProcessorsApiService, ContextDefinitionApiService, ProceduresAdminApiService, ProceduresApiService, RuleGroupsAdminApiService, RulesAdminApiService, RulesApiService, SalesTransactionApiService, ScriptsAdminApiService, ScriptsApiService, UIDefinitionsApiService, UITemplatesApiService };
1019
+ //# sourceMappingURL=veloceapps-api-v2.mjs.map