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