@veloceapps/api 11.0.0-1 → 11.0.0-100

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 (216) hide show
  1. package/esm2020/index.mjs +2 -45
  2. package/esm2020/src/index.mjs +16 -0
  3. package/esm2020/src/lib/api.module.mjs +60 -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/contracted-price-api.service.mjs +45 -0
  7. package/esm2020/src/lib/services/flow-state-api.mjs +142 -0
  8. package/esm2020/src/lib/services/offers-api.service.mjs +76 -0
  9. package/esm2020/src/lib/services/org-info-api.service.mjs +54 -0
  10. package/esm2020/src/lib/services/portals-api.service.mjs +76 -0
  11. package/esm2020/src/lib/services/promotions-api.service.mjs +68 -0
  12. package/esm2020/src/lib/services/rebate-program-api.service.mjs +68 -0
  13. package/esm2020/src/lib/services/rebate-type-api.service.mjs +68 -0
  14. package/esm2020/src/lib/services/sandbox-manager-api.service.mjs +94 -0
  15. package/esm2020/src/lib/services/stateful-configuration-api.mjs +51 -0
  16. package/esm2020/src/lib/types/auth.types.mjs +2 -0
  17. package/esm2020/src/lib/types/clone-request.types.mjs +2 -0
  18. package/esm2020/src/lib/types/delta-request.types.mjs +2 -0
  19. package/esm2020/src/lib/types/dto/offers-dto.types.mjs +2 -0
  20. package/esm2020/src/lib/types/index.mjs +6 -0
  21. package/esm2020/src/lib/types/org-info.types.mjs +2 -0
  22. package/esm2020/src/lib/types/search-request.types.mjs +2 -0
  23. package/esm2020/src/lib/types/stateful-configuration.types.mjs +2 -0
  24. package/esm2020/src/lib/utils/canvas.utils.mjs +33 -0
  25. package/esm2020/src/lib/utils/index.mjs +2 -0
  26. package/esm2020/v2/api-v2.module.mjs +70 -0
  27. package/esm2020/v2/index.mjs +4 -0
  28. package/esm2020/v2/services/cache-api.service.mjs +22 -0
  29. package/esm2020/v2/services/catalog-admin-api.service.mjs +192 -0
  30. package/esm2020/v2/services/catalog-api.service.mjs +90 -0
  31. package/esm2020/v2/services/configuration-processors-api.service.mjs +38 -0
  32. package/esm2020/v2/services/configuration-settings-api.service.mjs +89 -0
  33. package/esm2020/v2/services/context-definition-admin-api.service.mjs +70 -0
  34. package/esm2020/v2/services/document-attachment-api.service.mjs +66 -0
  35. package/esm2020/v2/services/endpoints-admin-api.service.mjs +79 -0
  36. package/esm2020/v2/services/flows-api.service.mjs +29 -0
  37. package/esm2020/v2/services/functions-admin-api.service.mjs +116 -0
  38. package/esm2020/v2/services/guided-sellings-admin-api.service.mjs +65 -0
  39. package/esm2020/v2/services/guided-sellings-api.service.mjs +37 -0
  40. package/esm2020/v2/services/index.mjs +24 -0
  41. package/esm2020/v2/services/orchestrations-admin-api.service.mjs +87 -0
  42. package/esm2020/v2/services/orchestrations-api.service.mjs +23 -0
  43. package/esm2020/v2/services/pcm-api.service.mjs +38 -0
  44. package/esm2020/v2/services/picklists-admin-api.service.mjs +41 -0
  45. package/esm2020/v2/services/products-admin-api.service.mjs +90 -0
  46. package/esm2020/v2/services/sales-transactions-api.service.mjs +52 -0
  47. package/esm2020/v2/services/salesforce-api.service.mjs +83 -0
  48. package/esm2020/v2/services/shopping-cart-settings-api.service.mjs +28 -0
  49. package/esm2020/v2/services/ui-definitions-admin-api.service.mjs +68 -0
  50. package/esm2020/v2/services/ui-templates-admin-api.service.mjs +286 -0
  51. package/esm2020/v2/services/veloce-objects-api.service.mjs +90 -0
  52. package/esm2020/v2/types/attachment.types.mjs +2 -0
  53. package/esm2020/v2/types/clone-request.types.mjs +2 -0
  54. package/esm2020/v2/types/dto/configuration-settings-dto.types.mjs +22 -0
  55. package/esm2020/v2/types/dto/ui-definition-dto.types.mjs +2 -0
  56. package/esm2020/v2/types/dto/ui-template-dto.types.mjs +2 -0
  57. package/esm2020/v2/types/function.types.mjs +2 -0
  58. package/esm2020/v2/types/index.mjs +7 -0
  59. package/esm2020/v2/types/pcm.types.mjs +2 -0
  60. package/esm2020/v2/types/procedure.types.mjs +2 -0
  61. package/esm2020/v2/types/sales-transaction.types.mjs +2 -0
  62. package/esm2020/v2/types/search-request.types.mjs +2 -0
  63. package/esm2020/v2/utils/ui-definition.utils.mjs +23 -0
  64. package/esm2020/v2/utils/ui-template.utils.mjs +13 -0
  65. package/esm2020/v2/veloceapps-api-v2.mjs +5 -0
  66. package/esm2020/veloceapps-api.mjs +1 -1
  67. package/fesm2015/veloceapps-api-v2.mjs +1726 -0
  68. package/fesm2015/veloceapps-api-v2.mjs.map +1 -0
  69. package/fesm2015/veloceapps-api.mjs +497 -2813
  70. package/fesm2015/veloceapps-api.mjs.map +1 -1
  71. package/fesm2020/veloceapps-api-v2.mjs +1809 -0
  72. package/fesm2020/veloceapps-api-v2.mjs.map +1 -0
  73. package/fesm2020/veloceapps-api.mjs +517 -2931
  74. package/fesm2020/veloceapps-api.mjs.map +1 -1
  75. package/index.d.ts +1 -44
  76. package/package.json +9 -1
  77. package/src/index.d.ts +15 -0
  78. package/{lib → src/lib}/api.module.d.ts +2 -1
  79. package/{lib → src/lib}/types/index.d.ts +0 -2
  80. package/{lib → src/lib}/types/stateful-configuration.types.d.ts +1 -2
  81. package/src/lib/utils/index.d.ts +1 -0
  82. package/v2/api-v2.module.d.ts +7 -0
  83. package/v2/index.d.ts +3 -0
  84. package/v2/services/cache-api.service.d.ts +11 -0
  85. package/{lib → v2}/services/catalog-admin-api.service.d.ts +2 -2
  86. package/{lib → v2}/services/catalog-api.service.d.ts +5 -5
  87. package/{lib → v2}/services/configuration-settings-api.service.d.ts +1 -2
  88. package/{lib/services/rlm-api.service.d.ts → v2/services/context-definition-admin-api.service.d.ts} +5 -4
  89. package/{lib → v2}/services/document-attachment-api.service.d.ts +1 -1
  90. package/{lib/services/endpoints-api.service.d.ts → v2/services/endpoints-admin-api.service.d.ts} +3 -4
  91. package/v2/services/functions-admin-api.service.d.ts +25 -0
  92. package/v2/services/index.d.ts +23 -0
  93. package/v2/services/orchestrations-admin-api.service.d.ts +21 -0
  94. package/v2/services/orchestrations-api.service.d.ts +12 -0
  95. package/v2/services/pcm-api.service.d.ts +12 -0
  96. package/{lib/services/picklists-api.service.d.ts → v2/services/picklists-admin-api.service.d.ts} +3 -3
  97. package/v2/services/products-admin-api.service.d.ts +21 -0
  98. package/v2/services/sales-transactions-api.service.d.ts +26 -0
  99. package/{lib → v2}/services/salesforce-api.service.d.ts +1 -4
  100. package/v2/services/ui-definitions-admin-api.service.d.ts +18 -0
  101. package/{lib/services/ui-templates-api.service.d.ts → v2/services/ui-templates-admin-api.service.d.ts} +3 -3
  102. package/{lib → v2}/services/veloce-objects-api.service.d.ts +3 -3
  103. package/v2/types/clone-request.types.d.ts +5 -0
  104. package/v2/types/dto/ui-definition-dto.types.d.ts +7 -0
  105. package/v2/types/function.types.d.ts +14 -0
  106. package/v2/types/index.d.ts +6 -0
  107. package/v2/types/pcm.types.d.ts +10 -0
  108. package/v2/types/procedure.types.d.ts +61 -0
  109. package/v2/types/sales-transaction.types.d.ts +13 -0
  110. package/v2/types/search-request.types.d.ts +8 -0
  111. package/v2/utils/ui-definition.utils.d.ts +5 -0
  112. package/esm2020/lib/api.module.mjs +0 -146
  113. package/esm2020/lib/services/account-api.service.mjs +0 -87
  114. package/esm2020/lib/services/auth.service.mjs +0 -22
  115. package/esm2020/lib/services/catalog-admin-api.service.mjs +0 -192
  116. package/esm2020/lib/services/catalog-api.service.mjs +0 -90
  117. package/esm2020/lib/services/configuration-api.service.mjs +0 -109
  118. package/esm2020/lib/services/configuration-processors-api.service.mjs +0 -38
  119. package/esm2020/lib/services/configuration-settings-api.service.mjs +0 -96
  120. package/esm2020/lib/services/context-api.service.mjs +0 -26
  121. package/esm2020/lib/services/contracted-price-api.service.mjs +0 -45
  122. package/esm2020/lib/services/delta-api.service.mjs +0 -23
  123. package/esm2020/lib/services/document-attachment-api.service.mjs +0 -66
  124. package/esm2020/lib/services/endpoints-api.service.mjs +0 -80
  125. package/esm2020/lib/services/flow-state-api.mjs +0 -142
  126. package/esm2020/lib/services/flows-api.service.mjs +0 -29
  127. package/esm2020/lib/services/guided-sellings-admin-api.service.mjs +0 -65
  128. package/esm2020/lib/services/guided-sellings-api.service.mjs +0 -37
  129. package/esm2020/lib/services/offers-api.service.mjs +0 -76
  130. package/esm2020/lib/services/org-info-api.service.mjs +0 -54
  131. package/esm2020/lib/services/picklists-api.service.mjs +0 -41
  132. package/esm2020/lib/services/portals-api.service.mjs +0 -76
  133. package/esm2020/lib/services/price-api.service.mjs +0 -63
  134. package/esm2020/lib/services/procedures-api.service.mjs +0 -113
  135. package/esm2020/lib/services/product-api.service.mjs +0 -153
  136. package/esm2020/lib/services/product-model-api.service.mjs +0 -237
  137. package/esm2020/lib/services/promotions-api.service.mjs +0 -68
  138. package/esm2020/lib/services/quote-api.service.mjs +0 -67
  139. package/esm2020/lib/services/ramp-api.service.mjs +0 -31
  140. package/esm2020/lib/services/rebate-program-api.service.mjs +0 -68
  141. package/esm2020/lib/services/rebate-type-api.service.mjs +0 -68
  142. package/esm2020/lib/services/rlm-api.service.mjs +0 -65
  143. package/esm2020/lib/services/rlm-quote-api.service.mjs +0 -27
  144. package/esm2020/lib/services/rule-groups-api.service.mjs +0 -62
  145. package/esm2020/lib/services/rules-api.service.mjs +0 -98
  146. package/esm2020/lib/services/salesforce-api.service.mjs +0 -86
  147. package/esm2020/lib/services/sandbox-manager-api.service.mjs +0 -94
  148. package/esm2020/lib/services/scripts-api.service.mjs +0 -83
  149. package/esm2020/lib/services/shopping-cart-settings-api.service.mjs +0 -28
  150. package/esm2020/lib/services/stateful-configuration-api.mjs +0 -51
  151. package/esm2020/lib/services/ui-definitions-api.service.mjs +0 -76
  152. package/esm2020/lib/services/ui-templates-api.service.mjs +0 -286
  153. package/esm2020/lib/services/veloce-objects-api.service.mjs +0 -90
  154. package/esm2020/lib/types/attachment.types.mjs +0 -2
  155. package/esm2020/lib/types/auth.types.mjs +0 -2
  156. package/esm2020/lib/types/clone-request.types.mjs +0 -2
  157. package/esm2020/lib/types/delta-request.types.mjs +0 -2
  158. package/esm2020/lib/types/dto/configuration-settings-dto.types.mjs +0 -22
  159. package/esm2020/lib/types/dto/offers-dto.types.mjs +0 -2
  160. package/esm2020/lib/types/dto/ui-template-dto.types.mjs +0 -2
  161. package/esm2020/lib/types/index.mjs +0 -8
  162. package/esm2020/lib/types/org-info.types.mjs +0 -2
  163. package/esm2020/lib/types/price.types.mjs +0 -2
  164. package/esm2020/lib/types/quote.types.mjs +0 -2
  165. package/esm2020/lib/types/ramp-request.types.mjs +0 -2
  166. package/esm2020/lib/types/search-request.types.mjs +0 -2
  167. package/esm2020/lib/types/stateful-configuration.types.mjs +0 -2
  168. package/esm2020/lib/utils/canvas.utils.mjs +0 -33
  169. package/esm2020/lib/utils/index.mjs +0 -3
  170. package/esm2020/lib/utils/ui-template.utils.mjs +0 -13
  171. package/lib/services/configuration-api.service.d.ts +0 -23
  172. package/lib/services/context-api.service.d.ts +0 -11
  173. package/lib/services/delta-api.service.d.ts +0 -12
  174. package/lib/services/price-api.service.d.ts +0 -16
  175. package/lib/services/procedures-api.service.d.ts +0 -30
  176. package/lib/services/product-api.service.d.ts +0 -31
  177. package/lib/services/product-model-api.service.d.ts +0 -35
  178. package/lib/services/quote-api.service.d.ts +0 -26
  179. package/lib/services/ramp-api.service.d.ts +0 -13
  180. package/lib/services/rlm-quote-api.service.d.ts +0 -11
  181. package/lib/services/rule-groups-api.service.d.ts +0 -18
  182. package/lib/services/rules-api.service.d.ts +0 -22
  183. package/lib/services/scripts-api.service.d.ts +0 -21
  184. package/lib/services/ui-definitions-api.service.d.ts +0 -15
  185. package/lib/types/price.types.d.ts +0 -5
  186. package/lib/types/quote.types.d.ts +0 -8
  187. package/lib/types/ramp-request.types.d.ts +0 -13
  188. package/lib/utils/index.d.ts +0 -2
  189. /package/{lib → src/lib}/services/account-api.service.d.ts +0 -0
  190. /package/{lib → src/lib}/services/auth.service.d.ts +0 -0
  191. /package/{lib → src/lib}/services/contracted-price-api.service.d.ts +0 -0
  192. /package/{lib → src/lib}/services/flow-state-api.d.ts +0 -0
  193. /package/{lib → src/lib}/services/offers-api.service.d.ts +0 -0
  194. /package/{lib → src/lib}/services/org-info-api.service.d.ts +0 -0
  195. /package/{lib → src/lib}/services/portals-api.service.d.ts +0 -0
  196. /package/{lib → src/lib}/services/promotions-api.service.d.ts +0 -0
  197. /package/{lib → src/lib}/services/rebate-program-api.service.d.ts +0 -0
  198. /package/{lib → src/lib}/services/rebate-type-api.service.d.ts +0 -0
  199. /package/{lib → src/lib}/services/sandbox-manager-api.service.d.ts +0 -0
  200. /package/{lib → src/lib}/services/stateful-configuration-api.d.ts +0 -0
  201. /package/{lib → src/lib}/types/auth.types.d.ts +0 -0
  202. /package/{lib → src/lib}/types/clone-request.types.d.ts +0 -0
  203. /package/{lib → src/lib}/types/delta-request.types.d.ts +0 -0
  204. /package/{lib → src/lib}/types/dto/offers-dto.types.d.ts +0 -0
  205. /package/{lib → src/lib}/types/org-info.types.d.ts +0 -0
  206. /package/{lib → src/lib}/types/search-request.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/flows-api.service.d.ts +0 -0
  210. /package/{lib → v2}/services/guided-sellings-admin-api.service.d.ts +0 -0
  211. /package/{lib → v2}/services/guided-sellings-api.service.d.ts +0 -0
  212. /package/{lib → v2}/services/shopping-cart-settings-api.service.d.ts +0 -0
  213. /package/{lib → v2}/types/attachment.types.d.ts +0 -0
  214. /package/{lib → v2}/types/dto/configuration-settings-dto.types.d.ts +0 -0
  215. /package/{lib → v2}/types/dto/ui-template-dto.types.d.ts +0 -0
  216. /package/{lib → v2}/utils/ui-template.utils.d.ts +0 -0
@@ -1,14 +1,13 @@
1
1
  import * as i1$1 from '@angular/common/http';
2
- import { HttpParams, HttpHeaders, HttpErrorResponse, HttpClientModule } from '@angular/common/http';
2
+ import { HttpParams, HttpHeaders, HttpClientModule } from '@angular/common/http';
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, NgModule } from '@angular/core';
5
+ import { ApiV2Module } from '@veloceapps/api/v2';
5
6
  import * as i1 from '@veloceapps/core';
6
- import { uiDefinitionFromDTO, DomainComputation, ConfigurationContextMode, Expression, Operator, isApexError, isCanvasError, ModelTranslatorUtils, ProductModelsContainer, ModelUtils, EntityUtil, RuleGroupTypes, parseJsonSafely, uiDefinitionToDTO, BaseHttpService, XrayService } from '@veloceapps/core';
7
- import { noop, throwError, of, map as map$1, from, catchError as catchError$1, forkJoin, switchMap } from 'rxjs';
8
- import { map, catchError, tap } from 'rxjs/operators';
7
+ import { isApexError, isCanvasError, BaseHttpService, XrayService } from '@veloceapps/core';
8
+ import { map, from, catchError, of } from 'rxjs';
9
+ import { isArray } from 'lodash';
9
10
  import * as i1$2 from 'primeng/api';
10
- import { isArray, omit } from 'lodash';
11
- import { __rest } from 'tslib';
12
11
 
13
12
  class AccountApiService {
14
13
  constructor(httpService) {
@@ -77,2308 +76,289 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
77
76
  type: Injectable
78
77
  }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
79
78
 
80
- class CatalogAdminApiService {
79
+ class ContractedPriceApiService {
81
80
  constructor(baseHttpService) {
82
81
  this.baseHttpService = baseHttpService;
83
- this.serviceUrl = '/catalogs';
84
- this.fetchCatalogs$ = (searchParams) => {
85
- const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
86
- return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
87
- };
88
- this.searchCatalogs$ = (searchParams, expression) => {
89
- const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
90
- return this.baseHttpService.api({
91
- method: 'post',
92
- url: `${this.serviceUrl}/search`,
93
- params,
94
- body: expression || {},
95
- });
96
- };
97
- this.fetchCategories$ = (catalogId) => {
98
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories` });
99
- };
100
- this.searchProducts$ = (catalogId, categoryId) => {
101
- return this.baseHttpService.api({
102
- method: 'post',
103
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
104
- body: {},
105
- });
82
+ this.serviceUrl = '/admin/contracted-price';
83
+ this.fetchContractedPrices$ = () => {
84
+ return this.baseHttpService.api({ url: `${this.serviceUrl}` });
106
85
  };
107
- this.fetchAttributes$ = (catalogId, categoryId) => {
108
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes` });
86
+ this.fetchContractedPrice$ = (id) => {
87
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
109
88
  };
110
- this.createNewCatalog$ = (catalogData) => {
89
+ this.createContractedPrice$ = (data) => {
111
90
  return this.baseHttpService.api({
112
91
  url: `${this.serviceUrl}`,
113
- method: 'post',
114
- body: catalogData,
115
- });
116
- };
117
- this.duplicateCatalog$ = (cloneRequest) => {
118
- return this.baseHttpService.api({
119
- url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
120
- method: 'post',
121
- body: cloneRequest,
122
- });
123
- };
124
- this.updateCatalog$ = (data) => {
125
- return this.baseHttpService.api({
126
- url: `${this.serviceUrl}/${data.id}`,
127
- method: 'put',
128
- body: data,
129
- });
130
- };
131
- this.removeCatalog$ = (id) => {
132
- return this.baseHttpService.api({
133
- url: `${this.serviceUrl}/${id}`,
134
- method: 'delete',
135
- });
136
- };
137
- this.restoreCatalog$ = (id) => {
138
- return this.baseHttpService.api({
139
- url: `${this.serviceUrl}/${id}/restore`,
140
- method: 'patch',
141
- });
142
- };
143
- this.createNewCategory$ = (categoryData) => {
144
- return this.baseHttpService.api({
145
- url: `${this.serviceUrl}/${categoryData.catalogId}/categories`,
146
- method: 'post',
147
- body: categoryData,
148
- });
149
- };
150
- this.updateCategory$ = (category) => {
151
- return this.baseHttpService.api({
152
- url: `${this.serviceUrl}/${category.catalogId}/categories/${category.id}`,
153
92
  method: 'put',
154
- body: category,
155
- });
156
- };
157
- this.duplicateCategory$ = (catalogId, cloneRequest) => {
158
- return this.baseHttpService.api({
159
- url: `${this.serviceUrl}/${catalogId}/categories/${cloneRequest.id}/clone`,
160
- method: 'post',
161
- body: cloneRequest,
162
- });
163
- };
164
- this.removeCategory$ = (id, catalogId) => {
165
- return this.baseHttpService.api({
166
- url: `${this.serviceUrl}/${catalogId}/categories/${id}`,
167
- method: 'delete',
168
- });
169
- };
170
- this.restoreCategory$ = (id, catalogId) => {
171
- return this.baseHttpService.api({
172
- url: `${this.serviceUrl}/${catalogId}/categories/${id}/restore`,
173
- method: 'patch',
174
- });
175
- };
176
- this.removeAttribute$ = ({ catalogId, categoryId, data, }) => {
177
- return this.baseHttpService.api({
178
- method: 'delete',
179
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
180
- body: data,
181
- });
182
- };
183
- this.restoreAttribute$ = ({ catalogId, categoryId, data, }) => {
184
- return this.baseHttpService.api({
185
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}/restore`,
186
- method: 'patch',
187
- });
188
- };
189
- this.createNewAttribute$ = ({ catalogId, categoryId, data, }) => {
190
- return this.baseHttpService.api({
191
- method: 'post',
192
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes`,
193
93
  body: data,
194
94
  });
195
95
  };
196
- this.updateAttribute$ = ({ catalogId, categoryId, data, }) => {
96
+ this.updateContractedPrice$ = (data) => {
197
97
  return this.baseHttpService.api({
98
+ url: `${this.serviceUrl}/${data.id}`,
198
99
  method: 'put',
199
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/attributes/${data.id}`,
200
100
  body: data,
201
101
  });
202
102
  };
203
- this.searchProductCandidates$ = (catalogId, categoryId, expression, searchParams) => {
103
+ this.searchContractedPrices$ = (searchParams, expression) => {
204
104
  const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
205
105
  return this.baseHttpService.api({
206
106
  method: 'post',
207
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/candidates/search`,
107
+ url: `${this.serviceUrl}/search`,
208
108
  params,
209
- body: expression,
210
- });
211
- };
212
- this.addProduct$ = (product, catalogId, categoryId) => {
213
- return this.baseHttpService.api({
214
- method: 'post',
215
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
216
- body: product,
217
- });
218
- };
219
- this.updateProduct$ = (product, catalogId, categoryId) => {
220
- return this.baseHttpService.api({
221
- method: 'put',
222
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/${product.id}`,
223
- body: product,
224
- });
225
- };
226
- this.removeProduct$ = ({ catalogId, categoryId, data, }) => {
227
- return this.baseHttpService.api({
228
- method: 'delete',
229
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/${data.id}`,
109
+ body: expression || {},
230
110
  });
231
111
  };
232
112
  }
233
- attachImage$(catalogId, categoryId, file) {
234
- const data = new FormData();
235
- data.append('image', file);
236
- return this.baseHttpService.upload({
237
- method: 'post',
238
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
239
- body: data,
240
- });
241
- }
242
- removeImage$(catalogId, categoryId) {
243
- return this.baseHttpService.api({
244
- method: 'delete',
245
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`,
246
- });
247
- }
248
- fetchImage$(catalogId, categoryId) {
249
- return this.baseHttpService.api({
250
- url: this.getImageUrl(catalogId, categoryId),
251
- method: 'get',
252
- responseType: 'blob',
253
- errorHandler: noop,
254
- });
255
- }
256
- getImageUrl(catalogId, categoryId) {
257
- return `${this.serviceUrl}/${catalogId}/categories/${categoryId}/image`;
258
- }
259
113
  }
260
- CatalogAdminApiService.MAX_RESULTS = 60;
261
- CatalogAdminApiServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
262
- CatalogAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService });
263
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogAdminApiService, decorators: [{
114
+ ContractedPriceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
115
+ ContractedPriceApiServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService });
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, decorators: [{
264
117
  type: Injectable
265
118
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
266
119
 
267
- class CatalogApiService {
268
- constructor(service) {
269
- this.service = service;
270
- this.serviceUrl = '/product-catalogs';
271
- }
272
- fetchCatalogs$() {
273
- return this.service.api({
274
- method: 'get',
275
- url: `${this.serviceUrl}`,
276
- });
120
+ class FlowStateApiService {
121
+ constructor(httpService) {
122
+ this.httpService = httpService;
123
+ this.SERVICE_URL = '/configuration/states';
277
124
  }
278
- searchCatalogs$(searchParams, expression) {
279
- const params = new HttpParams({ fromObject: searchParams });
280
- return this.service.api({
125
+ /**
126
+ * Initialize flow state
127
+ * @param request Request
128
+ * @returns Flow initialization response, which contains session ID and result of selectors
129
+ */
130
+ init(request) {
131
+ return this.httpService.api({
281
132
  method: 'post',
282
- url: `${this.serviceUrl}/search`,
283
- params,
284
- body: expression,
133
+ url: `${this.SERVICE_URL}/quote/start`,
134
+ body: request,
285
135
  });
286
136
  }
287
- getCatalog$(id) {
288
- return this.service.api({
289
- method: 'get',
290
- url: `${this.serviceUrl}/${id}`,
137
+ /**
138
+ * Get existing state by ID
139
+ * @param id ID
140
+ * @returns Flow State
141
+ */
142
+ get(id) {
143
+ return this.httpService.api({
144
+ url: `${this.SERVICE_URL}/${id}`,
291
145
  });
292
146
  }
293
- fetchCategories$(catalogId) {
294
- return this.service.api({
295
- method: 'get',
296
- url: `${this.serviceUrl}/${catalogId}/categories`,
147
+ /**
148
+ * Execute actions/selectors
149
+ * @param id State ID
150
+ * @param request Request
151
+ * @returns Execute result
152
+ */
153
+ execute(id, request) {
154
+ return this.httpService.api({
155
+ method: 'post',
156
+ url: `${this.SERVICE_URL}/quote/${id}/execute`,
157
+ body: request,
297
158
  });
298
159
  }
299
- fetchCatalogProducts$(catalogId, searchParams, context) {
300
- const params = new HttpParams({ fromObject: searchParams });
301
- return this.service.api({
160
+ /**
161
+ * Save Quote in the state
162
+ * @param id State ID
163
+ */
164
+ save(id) {
165
+ return this.httpService.api({
302
166
  method: 'post',
303
- url: `${this.serviceUrl}/${catalogId}/products`,
304
- params,
305
- body: context,
167
+ url: `${this.SERVICE_URL}/quote/${id}/save`,
306
168
  });
307
169
  }
308
- fetchCategoryProducts$(catalogId, categoryId, searchParams, context) {
309
- const params = new HttpParams({ fromObject: searchParams });
310
- return this.service.api({
170
+ /**
171
+ * Submit Quote in the state
172
+ * @param id State ID
173
+ */
174
+ submit(id) {
175
+ return this.httpService.api({
311
176
  method: 'post',
312
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
313
- params,
314
- body: context,
177
+ url: `${this.SERVICE_URL}/quote/${id}/submit`,
315
178
  });
316
179
  }
317
- searchCategoryProducts$(catalogId, categoryId, searchParams, searchRequest, context) {
318
- const params = new HttpParams({ fromObject: searchParams });
319
- return this.service.api({
180
+ /**
181
+ * Close Flow state
182
+ * @param id State ID
183
+ */
184
+ cancel(id) {
185
+ return this.httpService.api({
320
186
  method: 'post',
321
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
322
- params,
323
- body: {
324
- configurationContext: context,
325
- request: searchRequest,
326
- },
187
+ url: `${this.SERVICE_URL}/quote/${id}/cancel`,
327
188
  });
328
189
  }
329
- fetchEligibleProducts$(searchParams, context) {
330
- const params = new HttpParams({ fromObject: searchParams });
331
- return this.service.api({
190
+ /**
191
+ * Initialize stateful configuration
192
+ * @param stateId string
193
+ * @param request Request
194
+ * @returns Flow initialization response, which contains session ID and result of selectors
195
+ */
196
+ newConfiguration(stateId, request) {
197
+ return this.httpService.api({
332
198
  method: 'post',
333
- url: `${this.serviceUrl}/products`,
334
- params: params,
335
- body: context,
199
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/new`,
200
+ body: request,
336
201
  });
337
202
  }
338
- fetchProducts$(searchParams) {
339
- const params = new HttpParams({ fromObject: searchParams });
340
- return this.service.api({
341
- method: 'get',
342
- url: `${this.serviceUrl}/products`,
343
- params: params,
203
+ /**
204
+ * Start stateful configuration
205
+ * @param stateId string
206
+ * @param request Request
207
+ * @returns Flow initialization response, which contains session ID and result of selectors
208
+ */
209
+ startConfiguration(stateId, request) {
210
+ return this.httpService.api({
211
+ method: 'post',
212
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/start`,
213
+ body: request,
344
214
  });
345
215
  }
346
- }
347
- CatalogApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
348
- CatalogApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService });
349
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogApiService, decorators: [{
350
- type: Injectable
351
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
352
-
353
- class ConfigurationApiService {
354
- constructor(httpService) {
355
- this.httpService = httpService;
356
- this.SERVICE_URL = '/configuration';
357
- }
358
- configureLineItem({ configurationRequest, runtimeModel, pricingEnabled, }) {
359
- return this.httpService
360
- .api({
361
- method: 'post',
362
- url: `${this.SERVICE_URL}${pricingEnabled ? '/price' : ''}`,
363
- body: configurationRequest,
364
- errorHandler: e => throwError(e),
365
- })
366
- .pipe(map(configurePrice => {
367
- if (runtimeModel) {
368
- return Object.assign(Object.assign({}, configurePrice), { lineItem: this.updateDomains(configurePrice.lineItem, runtimeModel) });
369
- }
370
- else {
371
- return configurePrice;
372
- }
373
- }));
374
- }
375
- customConfigurePrice({ url, configurationRequest, runtimeModel, }) {
376
- return this.httpService
377
- .api({
216
+ /**
217
+ * Execute stateful configuration
218
+ * @param stateId string
219
+ * @param configurationId string
220
+ * @param request Request
221
+ * @returns Flow initialization response, which contains session ID and result of selectors
222
+ */
223
+ executeConfiguration(stateId, configurationId, request) {
224
+ return this.httpService.api({
378
225
  method: 'post',
379
- url,
380
- body: configurationRequest,
381
- errorHandler: e => throwError(e),
382
- })
383
- .pipe(map(configurePrice => {
384
- if (runtimeModel) {
385
- return Object.assign(Object.assign({}, configurePrice), { lineItem: this.updateDomains(configurePrice.lineItem, runtimeModel) });
386
- }
387
- else {
388
- return configurePrice;
389
- }
390
- }));
391
- }
392
- getRuntimeDataByProductId(productId, offeringId) {
393
- return this.httpService
394
- .api({
395
- method: 'get',
396
- url: `${this.SERVICE_URL}/${productId}/model` + ((offeringId && `/${offeringId}`) || ''),
397
- })
398
- .pipe(map(runtimeData => {
399
- return Object.assign(Object.assign({}, runtimeData), { uiDefinitions: runtimeData.uiDefinitions.map(dto => uiDefinitionFromDTO(dto)) });
400
- }));
226
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/execute`,
227
+ body: request,
228
+ });
401
229
  }
402
- getRuntimeDataByModelId(modelId) {
230
+ /**
231
+ * Save stateful configuration
232
+ * @param stateId string
233
+ * @param configurationId string
234
+ */
235
+ saveConfiguration(stateId, configurationId) {
403
236
  return this.httpService.api({
404
- method: 'get',
405
- url: `${this.SERVICE_URL}/${modelId}/model-test`,
237
+ method: 'post',
238
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/save`,
406
239
  });
407
240
  }
408
- updateDomains(lineItem, runtimeModel) {
409
- var _a, _b, _c;
410
- const component = runtimeModel.components.get(lineItem.type);
411
- const portDomains = Object.assign({}, lineItem.portDomains);
412
- // loop through ports to look for 'None' type domain computations
413
- for (const port of (_a = component === null || component === void 0 ? void 0 : component.ports) !== null && _a !== void 0 ? _a : []) {
414
- const portDomain = portDomains[port.name];
415
- if (((_b = portDomain === null || portDomain === void 0 ? void 0 : portDomain.properties) === null || _b === void 0 ? void 0 : _b['domainComputation']) === DomainComputation.NONE) {
416
- portDomain.domainTypes = port.domainTypes;
417
- }
418
- }
419
- const type = runtimeModel.types.find(({ name }) => {
420
- return lineItem.type === name;
241
+ /**
242
+ * Cancel stateful configuration
243
+ * @param stateId string
244
+ * @param configurationId string
245
+ */
246
+ cancelConfiguration(stateId, configurationId) {
247
+ return this.httpService.api({
248
+ method: 'post',
249
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/cancel`,
421
250
  });
422
- const attributeDomains = lineItem.attributeDomains;
423
- if (type) {
424
- const initialDomains = lineItem.attributeDomains;
425
- type.attributes.forEach(attribute => {
426
- if (Object.prototype.hasOwnProperty.call(initialDomains, attribute.name)) {
427
- return;
428
- }
429
- if (attribute.attributeDomain) {
430
- attributeDomains[attribute.name] = attribute.attributeDomain;
431
- }
432
- });
433
- }
434
- return Object.assign(Object.assign({}, lineItem), { lineItems: (_c = lineItem.lineItems) === null || _c === void 0 ? void 0 : _c.map(i => this.updateDomains(i, runtimeModel)), attributeDomains,
435
- portDomains });
436
251
  }
437
252
  }
438
- ConfigurationApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
439
- ConfigurationApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationApiService });
440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationApiService, decorators: [{
253
+ FlowStateApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
254
+ FlowStateApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService });
255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, decorators: [{
441
256
  type: Injectable
442
257
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
443
258
 
444
- class ConfigurationProcessorsApiService {
259
+ class OffersApiService {
445
260
  constructor(baseHttpService) {
446
261
  this.baseHttpService = baseHttpService;
447
- this.serviceUrl = '/configuration/processors/owners';
448
- this.fetchConfigurationProcessors$ = (ownerId) => {
449
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${ownerId}` });
450
- };
451
- this.createConfigurationProcessors$ = (configurationProcessor) => {
452
- return this.baseHttpService.api({
453
- method: 'post',
454
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}`,
455
- body: configurationProcessor,
456
- });
457
- };
458
- this.updateConfigurationProcessors$ = (configurationProcessor) => {
459
- return this.baseHttpService.api({
460
- method: 'put',
461
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
462
- body: configurationProcessor,
463
- });
464
- };
465
- this.deleteConfigurationProcessors$ = (configurationProcessor) => {
466
- return this.baseHttpService.api({
467
- method: 'delete',
468
- url: `${this.serviceUrl}/${configurationProcessor.ownerId}/${configurationProcessor.id}`,
469
- });
470
- };
471
- }
472
- }
473
- ConfigurationProcessorsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
474
- ConfigurationProcessorsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService });
475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationProcessorsApiService, decorators: [{
476
- type: Injectable
477
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
478
-
479
- class ConfigurationSettingsDTO {
480
- static fromDTO(dto, key) {
481
- return {
482
- id: dto === null || dto === void 0 ? void 0 : dto.id,
483
- key: (dto === null || dto === void 0 ? void 0 : dto.key) || key || '',
484
- value: dto === null || dto === void 0 ? void 0 : dto.value,
485
- };
486
- }
487
- static toDTO(data) {
488
- return {
489
- id: data.id,
490
- key: data.key,
491
- value: data.value,
492
- };
493
- }
494
- constructor(id, key, value) {
495
- this.id = id;
496
- this.key = key;
497
- this.value = value;
498
- }
499
- }
500
-
501
- class ConfigurationSettingsApiService {
502
- constructor(httpService, messageService) {
503
- this.httpService = httpService;
504
- this.messageService = messageService;
505
- this.SERVICE_URL = '/configuration-settings';
506
- }
507
- fetchSettings(options) {
508
- return this.httpService
509
- .api(Object.assign({ url: `${this.SERVICE_URL}`, method: 'get' }, options))
510
- .pipe(map((settings) => settings.map(setting => ConfigurationSettingsDTO.fromDTO(setting))));
511
- }
512
- fetchSetting(settingsKey, options) {
513
- return this.httpService
514
- .api(Object.assign(Object.assign({ url: `${this.SERVICE_URL}/byKey/${settingsKey}`, method: 'get' }, options), { skipErrorHandler: true }))
515
- .pipe(map((setting) => ConfigurationSettingsDTO.fromDTO(setting, settingsKey)), catchError(err => {
516
- if (err instanceof HttpErrorResponse && err.status === 404) {
517
- if (!(options === null || options === void 0 ? void 0 : options.skipErrorHandler)) {
518
- this.messageService.add({
519
- severity: 'error',
520
- summary: `Configuration Setting "${settingsKey}" is not found`,
521
- sticky: true,
522
- });
523
- }
524
- return of(null);
525
- }
526
- throw err;
527
- }));
528
- }
529
- createSetting(setting, options) {
530
- const request = ConfigurationSettingsDTO.toDTO(setting);
531
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}`, method: 'post', body: Object.assign({}, request) }, options));
532
- }
533
- updateSetting(setting, options) {
534
- const request = ConfigurationSettingsDTO.toDTO(setting);
535
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${request.id}`, method: 'put', body: Object.assign({}, request) }, options));
536
- }
537
- removeSetting(setting, options) {
538
- const request = ConfigurationSettingsDTO.toDTO(setting);
539
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${request.id}`, method: 'delete' }, options));
540
- }
541
- restoreSetting(settingId, options) {
542
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/${settingId}/restore`, method: 'patch' }, options));
543
- }
544
- clear(name, options) {
545
- return this.httpService.api(Object.assign({ method: 'get', url: '/cache/evict/' + name }, options));
546
- }
547
- }
548
- ConfigurationSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, deps: [{ token: i1.BaseHttpService }, { token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
549
- ConfigurationSettingsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService });
550
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationSettingsApiService, decorators: [{
551
- type: Injectable
552
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1$2.MessageService }]; } });
553
-
554
- class ContextApiService {
555
- constructor(httpService) {
556
- this.httpService = httpService;
557
- this.SERVICE_URL = '/context';
558
- }
559
- getContext(headerId, mode) {
560
- return this.httpService.api({
561
- method: 'post',
562
- body: {
563
- headerId: headerId,
564
- contextMode: ConfigurationContextMode[mode],
565
- },
566
- url: `${this.SERVICE_URL}`,
567
- });
568
- }
569
- }
570
- ContextApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
571
- ContextApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextApiService });
572
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextApiService, decorators: [{
573
- type: Injectable
574
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
575
-
576
- class ContractedPriceApiService {
577
- constructor(baseHttpService) {
578
- this.baseHttpService = baseHttpService;
579
- this.serviceUrl = '/admin/contracted-price';
580
- this.fetchContractedPrices$ = () => {
581
- return this.baseHttpService.api({ url: `${this.serviceUrl}` });
582
- };
583
- this.fetchContractedPrice$ = (id) => {
584
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
585
- };
586
- this.createContractedPrice$ = (data) => {
587
- return this.baseHttpService.api({
588
- url: `${this.serviceUrl}`,
589
- method: 'put',
590
- body: data,
591
- });
592
- };
593
- this.updateContractedPrice$ = (data) => {
594
- return this.baseHttpService.api({
595
- url: `${this.serviceUrl}/${data.id}`,
596
- method: 'put',
597
- body: data,
598
- });
599
- };
600
- this.searchContractedPrices$ = (searchParams, expression) => {
601
- const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
602
- return this.baseHttpService.api({
603
- method: 'post',
604
- url: `${this.serviceUrl}/search`,
605
- params,
606
- body: expression || {},
607
- });
608
- };
609
- }
610
- }
611
- ContractedPriceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
612
- ContractedPriceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService });
613
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContractedPriceApiService, decorators: [{
614
- type: Injectable
615
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
616
-
617
- class DeltaApiService {
618
- constructor(httpService) {
619
- this.httpService = httpService;
620
- this.SERVICE_URL = '/delta';
621
- }
622
- calculate$(request) {
623
- return this.httpService.api({
624
- method: 'post',
625
- url: `${this.SERVICE_URL}/calculate`,
626
- body: request,
627
- skipErrorHandler: true,
628
- });
629
- }
630
- }
631
- DeltaApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeltaApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
632
- DeltaApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeltaApiService });
633
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeltaApiService, decorators: [{
634
- type: Injectable
635
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
636
-
637
- class DocumentAttachmentApiService {
638
- constructor(httpService, fileDownloadService) {
639
- this.httpService = httpService;
640
- this.fileDownloadService = fileDownloadService;
641
- this.SERVICE_URL = '/attachments';
642
- }
643
- getAttachments(searchRequest) {
644
- return this.httpService.api({
645
- url: `${this.SERVICE_URL}/search`,
646
- method: 'post',
647
- body: searchRequest,
648
- });
649
- }
650
- createAttachment(attachment, file, reportProgress) {
651
- const formData = new FormData();
652
- if (file) {
653
- formData.append('file', file, file.name);
654
- }
655
- formData.append('attachment', new Blob([JSON.stringify(attachment)], {
656
- type: 'application/json',
657
- }));
658
- return this.httpService.upload({
659
- url: `${this.SERVICE_URL}`,
660
- body: formData,
661
- method: 'post',
662
- observe: reportProgress ? 'events' : undefined,
663
- reportProgress,
664
- });
665
- }
666
- updateAttachment(id, attachment) {
667
- return this.httpService.api({
668
- url: `${this.SERVICE_URL}/${id}`,
669
- body: attachment,
670
- method: 'put',
671
- });
672
- }
673
- getAttachmentFile(id, isPreventDownload) {
674
- return this.httpService
675
- .api({
676
- url: `${this.SERVICE_URL}/${id}/file`,
677
- responseType: isPreventDownload ? 'arraybuffer' : 'blob',
678
- observe: isPreventDownload ? 'body' : 'response',
679
- })
680
- .pipe(tap(response => {
681
- if (!isPreventDownload) {
682
- this.fileDownloadService.processDownload(response);
683
- }
684
- }), map(response => (isPreventDownload ? new Blob([response.body || response]) : response.body || response)));
685
- }
686
- removeAttachment(id) {
687
- return this.httpService.api({
688
- url: `${this.SERVICE_URL}/${id}`,
689
- method: 'delete',
690
- });
691
- }
692
- }
693
- DocumentAttachmentApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService, deps: [{ token: i1.BaseHttpService }, { token: i1.FileDownloadService }], target: i0.ɵɵFactoryTarget.Injectable });
694
- DocumentAttachmentApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService });
695
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DocumentAttachmentApiService, decorators: [{
696
- type: Injectable
697
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }, { type: i1.FileDownloadService }]; } });
698
-
699
- class EndpointsApiService {
700
- constructor(baseHttpService) {
701
- this.baseHttpService = baseHttpService;
702
- this.adminServiceUrl = '/admin/api-endpoints';
703
- this.serviceUrl = '/api-endpoints';
704
- }
705
- fetchEndpoints$() {
706
- return this.searchEndpoints$(new Expression(), 0, -1);
707
- }
708
- searchEndpoints$(expression, skip, count) {
709
- let params = new HttpParams();
710
- params = params.set('skip', '' + skip);
711
- params = params.set('count', '' + count);
712
- return this.baseHttpService.api({
713
- method: 'post',
714
- url: `${this.adminServiceUrl}/search`,
715
- params,
716
- body: expression,
717
- });
718
- }
719
- removeEndpoint$(id) {
720
- return this.baseHttpService.api({
721
- url: `${this.adminServiceUrl}/${id}`,
722
- method: 'delete',
723
- });
724
- }
725
- restoreEndpoint$(id) {
726
- return this.baseHttpService.api({
727
- url: `${this.adminServiceUrl}/${id}/restore`,
728
- method: 'patch',
729
- });
730
- }
731
- fetchEndpoint$(id) {
732
- return this.baseHttpService.api({
733
- url: `${this.adminServiceUrl}/${id}`,
734
- method: 'get',
735
- });
736
- }
737
- createEndpoint$(body) {
738
- return this.baseHttpService.api({
739
- url: `${this.adminServiceUrl}`,
740
- method: 'post',
741
- body,
742
- });
743
- }
744
- updateEndpoint$(body) {
745
- return this.baseHttpService.api({
746
- url: `${this.adminServiceUrl}/${body.id}`,
747
- method: 'put',
748
- body,
749
- });
750
- }
751
- duplicateEndpoint$(cloneRequest) {
752
- return this.baseHttpService.api({
753
- url: `${this.adminServiceUrl}/${cloneRequest.id}/clone`,
754
- method: 'post',
755
- body: cloneRequest,
756
- });
757
- }
758
- executeEndpoint$(body) {
759
- return this.baseHttpService.api({
760
- url: `${this.serviceUrl}/execute`,
761
- method: 'post',
762
- body,
763
- responseType: 'text',
764
- skipErrorHandler: true,
765
- });
766
- }
767
- }
768
- EndpointsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EndpointsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
769
- EndpointsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EndpointsApiService });
770
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EndpointsApiService, decorators: [{
771
- type: Injectable
772
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
773
-
774
- class FlowStateApiService {
775
- constructor(httpService) {
776
- this.httpService = httpService;
777
- this.SERVICE_URL = '/configuration/states';
778
- }
779
- /**
780
- * Initialize flow state
781
- * @param request Request
782
- * @returns Flow initialization response, which contains session ID and result of selectors
783
- */
784
- init(request) {
785
- return this.httpService.api({
786
- method: 'post',
787
- url: `${this.SERVICE_URL}/quote/start`,
788
- body: request,
789
- });
790
- }
791
- /**
792
- * Get existing state by ID
793
- * @param id ID
794
- * @returns Flow State
795
- */
796
- get(id) {
797
- return this.httpService.api({
798
- url: `${this.SERVICE_URL}/${id}`,
799
- });
800
- }
801
- /**
802
- * Execute actions/selectors
803
- * @param id State ID
804
- * @param request Request
805
- * @returns Execute result
806
- */
807
- execute(id, request) {
808
- return this.httpService.api({
809
- method: 'post',
810
- url: `${this.SERVICE_URL}/quote/${id}/execute`,
811
- body: request,
812
- });
813
- }
814
- /**
815
- * Save Quote in the state
816
- * @param id State ID
817
- */
818
- save(id) {
819
- return this.httpService.api({
820
- method: 'post',
821
- url: `${this.SERVICE_URL}/quote/${id}/save`,
822
- });
823
- }
824
- /**
825
- * Submit Quote in the state
826
- * @param id State ID
827
- */
828
- submit(id) {
829
- return this.httpService.api({
830
- method: 'post',
831
- url: `${this.SERVICE_URL}/quote/${id}/submit`,
832
- });
833
- }
834
- /**
835
- * Close Flow state
836
- * @param id State ID
837
- */
838
- cancel(id) {
839
- return this.httpService.api({
840
- method: 'post',
841
- url: `${this.SERVICE_URL}/quote/${id}/cancel`,
842
- });
843
- }
844
- /**
845
- * Initialize stateful configuration
846
- * @param stateId string
847
- * @param request Request
848
- * @returns Flow initialization response, which contains session ID and result of selectors
849
- */
850
- newConfiguration(stateId, request) {
851
- return this.httpService.api({
852
- method: 'post',
853
- url: `${this.SERVICE_URL}/quote/${stateId}/configuration/new`,
854
- body: request,
855
- });
856
- }
857
- /**
858
- * Start stateful configuration
859
- * @param stateId string
860
- * @param request Request
861
- * @returns Flow initialization response, which contains session ID and result of selectors
862
- */
863
- startConfiguration(stateId, request) {
864
- return this.httpService.api({
865
- method: 'post',
866
- url: `${this.SERVICE_URL}/quote/${stateId}/configuration/start`,
867
- body: request,
868
- });
869
- }
870
- /**
871
- * Execute stateful configuration
872
- * @param stateId string
873
- * @param configurationId string
874
- * @param request Request
875
- * @returns Flow initialization response, which contains session ID and result of selectors
876
- */
877
- executeConfiguration(stateId, configurationId, request) {
878
- return this.httpService.api({
879
- method: 'post',
880
- url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/execute`,
881
- body: request,
882
- });
883
- }
884
- /**
885
- * Save stateful configuration
886
- * @param stateId string
887
- * @param configurationId string
888
- */
889
- saveConfiguration(stateId, configurationId) {
890
- return this.httpService.api({
891
- method: 'post',
892
- url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/save`,
893
- });
894
- }
895
- /**
896
- * Cancel stateful configuration
897
- * @param stateId string
898
- * @param configurationId string
899
- */
900
- cancelConfiguration(stateId, configurationId) {
901
- return this.httpService.api({
902
- method: 'post',
903
- url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/cancel`,
904
- });
905
- }
906
- }
907
- FlowStateApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
908
- FlowStateApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService });
909
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateApiService, decorators: [{
910
- type: Injectable
911
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
912
-
913
- class FlowsApiService {
914
- constructor(configurationSettingsApiService) {
915
- this.configurationSettingsApiService = configurationSettingsApiService;
916
- this.flowsKey = 'flows';
917
- }
918
- getFlow(id) {
919
- return this.fetchFlows().pipe(map(flows => flows.find(flow => flow.id == id)), map(flow => {
920
- if (!flow) {
921
- throw new Error(`Flow with flowId=${id} is not defined`);
922
- }
923
- return flow;
924
- }));
925
- }
926
- fetchFlows() {
927
- return this.configurationSettingsApiService
928
- .fetchSetting(this.flowsKey)
929
- .pipe(map((setting) => ((setting === null || setting === void 0 ? void 0 : setting.value) ? JSON.parse(setting.value) : [])));
930
- }
931
- }
932
- FlowsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
933
- FlowsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowsApiService });
934
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowsApiService, decorators: [{
935
- type: Injectable
936
- }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
937
-
938
- class GuidedSellingsAdminApiService {
939
- constructor(baseHttpService) {
940
- this.baseHttpService = baseHttpService;
941
- this.serviceUrl = '/admin/guided-selling';
942
- this.fetchGuidedSellings$ = (searchParams) => {
943
- return this.searchGuidedSellings$(searchParams);
944
- };
945
- this.searchGuidedSellings$ = (searchParams, expression) => {
946
- const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
947
- return this.baseHttpService.api({
948
- method: 'post',
949
- url: `${this.serviceUrl}/search`,
950
- params,
951
- body: expression || {},
952
- });
953
- };
954
- this.fetchGuidedSelling$ = (id) => {
955
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
956
- };
957
- this.createNewGuidedSelling$ = (guidedSelling) => {
958
- return this.baseHttpService.api({
959
- url: `${this.serviceUrl}`,
960
- method: 'post',
961
- body: guidedSelling,
962
- });
963
- };
964
- this.duplicateGuidedSelling$ = (cloneRequest) => {
965
- return this.baseHttpService.api({
966
- url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
967
- method: 'post',
968
- body: cloneRequest,
969
- });
970
- };
971
- this.updateGuidedSelling$ = (data) => {
972
- return this.baseHttpService.api({
973
- url: `${this.serviceUrl}/${data.id}`,
974
- method: 'put',
975
- body: data,
976
- });
977
- };
978
- this.removeGuidedSelling$ = (id) => {
979
- return this.baseHttpService.api({
980
- url: `${this.serviceUrl}/${id}`,
981
- method: 'delete',
982
- });
983
- };
984
- this.restoreGuidedSelling$ = (id) => {
985
- return this.baseHttpService.api({
986
- url: `${this.serviceUrl}/${id}/restore`,
987
- method: 'patch',
988
- });
989
- };
990
- }
991
- }
992
- GuidedSellingsAdminApiService.MAX_RESULTS = 60;
993
- GuidedSellingsAdminApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingsAdminApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
994
- GuidedSellingsAdminApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingsAdminApiService });
995
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingsAdminApiService, decorators: [{
996
- type: Injectable
997
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
998
-
999
- class GuidedSellingApiService {
1000
- constructor(http) {
1001
- this.http = http;
1002
- this.serviceUrl = '/guided-selling';
1003
- }
1004
- searchByName$(name, searchParams) {
1005
- const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
1006
- const expression = new Expression(undefined, [{ key: 'name', operator: Operator.EQ, value: name }]);
1007
- return this.http.api({
1008
- method: 'post',
1009
- url: `${this.serviceUrl}/search`,
1010
- params,
1011
- body: expression || {},
1012
- });
1013
- }
1014
- searchById$(id, searchParams) {
1015
- const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
1016
- const expression = new Expression(undefined, [{ key: 'id', operator: Operator.EQ, value: id }]);
1017
- return this.http.api({
1018
- method: 'post',
1019
- url: `${this.serviceUrl}/search`,
1020
- params,
1021
- body: expression || {},
1022
- });
1023
- }
1024
- }
1025
- GuidedSellingApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1026
- GuidedSellingApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingApiService });
1027
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingApiService, decorators: [{
1028
- type: Injectable
1029
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1030
-
1031
- class OffersApiService {
1032
- constructor(baseHttpService) {
1033
- this.baseHttpService = baseHttpService;
1034
- this.serviceUrl = '/admin/offers';
1035
- }
1036
- createOffer$(body) {
1037
- return this.baseHttpService.api({
1038
- url: `${this.serviceUrl}`,
1039
- method: 'post',
1040
- body,
1041
- });
1042
- }
1043
- fetchOffers$() {
1044
- return this.baseHttpService.api({
1045
- url: `${this.serviceUrl}`,
1046
- });
1047
- }
1048
- fetchOffer$(id) {
1049
- return this.baseHttpService.api({
1050
- url: `${this.serviceUrl}/${id}`,
1051
- });
1052
- }
1053
- updateOffer$(offer) {
1054
- return this.baseHttpService.api({
1055
- url: `${this.serviceUrl}/${offer.id}`,
1056
- method: 'put',
1057
- body: offer,
1058
- });
1059
- }
1060
- removeOffer$(id) {
1061
- return this.baseHttpService.api({
1062
- url: `${this.serviceUrl}/${id}`,
1063
- method: 'delete',
1064
- });
1065
- }
1066
- searchOffers$(expression, skip, count) {
1067
- let params = new HttpParams();
1068
- params = params.set('skip', '' + skip);
1069
- params = params.set('count', '' + count);
1070
- return this.baseHttpService.api({
1071
- method: 'post',
1072
- url: `${this.serviceUrl}/search`,
1073
- params,
1074
- body: expression,
1075
- });
1076
- }
1077
- fetchOfferProducts$(id) {
1078
- return this.baseHttpService
1079
- .api({
1080
- url: `${this.serviceUrl}/${id}/products`,
1081
- })
1082
- .pipe(map$1(response => response.products));
1083
- }
1084
- upsertOfferProducts$(id, products) {
1085
- const request = { products };
1086
- return this.baseHttpService
1087
- .api({
1088
- url: `${this.serviceUrl}/${id}/products`,
1089
- method: 'put',
1090
- body: request,
1091
- })
1092
- .pipe(map$1(response => response.products));
1093
- }
1094
- }
1095
- OffersApiService.MAX_RESULTS = 60;
1096
- OffersApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OffersApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1097
- OffersApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OffersApiService });
1098
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OffersApiService, decorators: [{
1099
- type: Injectable
1100
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1101
-
1102
- /**
1103
- * Parses the response from Canvas and checks for errors.
1104
- * - If an error is found, publishes an error message and returns the failover value.
1105
- * - If no error is found, returns the parsed response.
1106
- *
1107
- * Note! The API call first goes to APEX before reaching the Canvas, so errors can originate from either APEX or Canvas.
1108
- *
1109
- * @param {string} response - The JSON string response from the Canvas call.
1110
- * @param {T} failover - The value to return in case of error.
1111
- * @returns {T | K} The parsed response or the failover value.
1112
- *
1113
- * @template T The expected type of the parsed response.
1114
- * @template K The type of the failover value.
1115
- *
1116
- * @remarks If there's an Apex error, the response data can be an array.
1117
- * In such cases, the function extracts the first element of the array.
1118
- */
1119
- const handleCanvasResponse = (response, failover, errorPublisher) => {
1120
- const parsed = JSON.parse(response);
1121
- const errorCandidate = isArray(parsed) ? parsed[0] : parsed;
1122
- if (isApexError(errorCandidate)) {
1123
- errorPublisher(errorCandidate.message);
1124
- return failover;
1125
- }
1126
- if (isCanvasError(errorCandidate)) {
1127
- errorPublisher(errorCandidate.error);
1128
- return failover;
1129
- }
1130
- return parsed;
1131
- };
1132
-
1133
- class OrgInfoApiService {
1134
- constructor(messageService) {
1135
- this.messageService = messageService;
1136
- /**
1137
- * Shows an error message using the message service.
1138
- *
1139
- * @param {string} message - the error message to be published.
1140
- */
1141
- this.publishErrorMessage = (message) => {
1142
- this.messageService.add({ severity: 'error', summary: message, sticky: true });
1143
- };
1144
- }
1145
- getOrgInfo$() {
1146
- try {
1147
- return window.doCanvasCall && window.ORGANIZATION_ID
1148
- ? from(window.doCanvasCall(`org-info/${window.ORGANIZATION_ID}`, null)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1149
- : of(undefined);
1150
- }
1151
- catch (_a) {
1152
- return of(undefined);
1153
- }
1154
- }
1155
- getAvailableVersionsInfo$() {
1156
- try {
1157
- return window.doCanvasCall && window.ORGANIZATION_ID
1158
- ? from(window.doCanvasCall('versions/available', 'include_all=true')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1159
- : of(undefined);
1160
- }
1161
- catch (_a) {
1162
- return of(undefined);
1163
- }
1164
- }
1165
- upgradeVersion$(targetVersion) {
1166
- try {
1167
- return window.doCanvasCall && window.ORGANIZATION_ID
1168
- ? from(window.doCanvasCall('versions/upgrade', `target_version=${targetVersion}`)).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
1169
- : of(undefined);
1170
- }
1171
- catch (_a) {
1172
- return of(undefined);
1173
- }
1174
- }
1175
- }
1176
- OrgInfoApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
1177
- OrgInfoApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService });
1178
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, decorators: [{
1179
- type: Injectable
1180
- }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
1181
-
1182
- class PicklistsApiService {
1183
- constructor(baseHttpService) {
1184
- this.baseHttpService = baseHttpService;
1185
- this.serviceUrl = '/admin';
1186
- this.fetchAllPicklists$ = () => this.baseHttpService.api({ url: `${this.serviceUrl}/picklists` });
1187
- this.fetchPicklist$ = (code) => this.baseHttpService.api({ url: `${this.serviceUrl}/picklists/${code}` });
1188
- this.createPicklist$ = (picklist) => {
1189
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/picklists`, body: picklist });
1190
- };
1191
- this.updatePicklist$ = (picklist) => {
1192
- return this.baseHttpService.api({
1193
- method: 'put',
1194
- url: `${this.serviceUrl}/picklists/${picklist.id}`,
1195
- body: picklist,
1196
- });
1197
- };
1198
- this.removePicklist$ = (id) => this.baseHttpService.api({ method: 'delete', url: `${this.serviceUrl}/picklists/${id}` });
1199
- this.restorePicklist$ = (id) => {
1200
- return this.baseHttpService.api({
1201
- url: `${this.serviceUrl}/picklists/${id}/restore`,
1202
- method: 'patch',
1203
- });
1204
- };
1205
- this.addPicklistValue$ = (picklist, value) => {
1206
- const data = Object.assign(Object.assign({}, picklist), { values: [...picklist.values, value] });
1207
- return this.baseHttpService.api({ method: 'put', url: `${this.serviceUrl}/picklists/${picklist.id}`, body: data });
1208
- };
1209
- }
1210
- }
1211
- PicklistsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PicklistsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1212
- PicklistsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PicklistsApiService });
1213
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PicklistsApiService, decorators: [{
1214
- type: Injectable
1215
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1216
-
1217
- class PortalsApiService {
1218
- constructor(baseHttpService) {
1219
- this.baseHttpService = baseHttpService;
1220
- this.serviceUrl = '/admin/portal';
1221
- this.getPortals$ = (skip = 1, name = '') => {
1222
- let params = new HttpParams();
1223
- params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
1224
- params = params.append('skip', '0');
1225
- params = params.append('name', name);
1226
- return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
1227
- };
1228
- this.searchPortals$ = (skip = 0, expression) => {
1229
- let params = new HttpParams();
1230
- params = params.set('skip', '' + skip);
1231
- params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
1232
- return this.baseHttpService.api({
1233
- method: 'post',
1234
- url: `${this.serviceUrl}/search`,
1235
- params,
1236
- body: expression || {},
1237
- });
1238
- };
1239
- this.removePortal$ = (id) => {
1240
- return this.baseHttpService.api({
1241
- url: `${this.serviceUrl}/${id}`,
1242
- method: 'delete',
1243
- });
1244
- };
1245
- this.restore$ = (id) => {
1246
- return this.baseHttpService.api({
1247
- method: 'patch',
1248
- url: `${this.serviceUrl}/${id}/restore`,
1249
- });
1250
- };
1251
- this.duplicatePortal$ = (cloneRequest) => {
1252
- return this.baseHttpService.api({
1253
- url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
1254
- method: 'post',
1255
- body: cloneRequest,
1256
- });
1257
- };
1258
- this.getPortal$ = (id) => {
1259
- return this.baseHttpService.api({
1260
- url: `${this.serviceUrl}/${id}`,
1261
- });
1262
- };
1263
- }
1264
- createNewPortal$(body) {
1265
- return this.baseHttpService.api({
1266
- url: `${this.serviceUrl}`,
1267
- method: 'post',
1268
- body,
1269
- });
1270
- }
1271
- updatePortal$(portal, settings) {
1272
- return this.baseHttpService.api({
1273
- url: `${this.serviceUrl}/${portal.id}`,
1274
- method: 'put',
1275
- body: Object.assign(Object.assign({}, portal), { settings: JSON.stringify(settings) }),
1276
- });
1277
- }
1278
- }
1279
- PortalsApiService.MAX_RESULTS = 60;
1280
- PortalsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1281
- PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
1282
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
1283
- type: Injectable
1284
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1285
-
1286
- class PriceApiService {
1287
- constructor(httpService) {
1288
- this.httpService = httpService;
1289
- this.SERVICE_URL = '/price';
1290
- }
1291
- calculate(request) {
1292
- return this.httpService.api({
1293
- method: 'post',
1294
- url: `${this.SERVICE_URL}/calculate`,
1295
- body: request,
1296
- skipErrorHandler: true,
1297
- });
1298
- }
1299
- getPriceLists() {
1300
- return this.httpService.api({
1301
- method: 'get',
1302
- url: '/price-lists',
1303
- });
1304
- }
1305
- getPriceList(id) {
1306
- return this.httpService.api({
1307
- method: 'get',
1308
- url: `/price-lists/${id}`,
1309
- });
1310
- }
1311
- getSellingTermByEndDate(planId, offeringId, startDate, endDate, frequencyUnit, frequencyDuration) {
1312
- return this.httpService.api({
1313
- method: 'post',
1314
- url: `${this.SERVICE_URL}/selling-term-by-end-date`,
1315
- body: {
1316
- planId: planId,
1317
- offeringId: offeringId,
1318
- startDate: startDate,
1319
- endDate: endDate,
1320
- frequencyUnit: frequencyUnit,
1321
- frequencyDuration: frequencyDuration,
1322
- },
1323
- });
1324
- }
1325
- getSellingTermByTerm(planId, offeringId, startDate, term, frequencyUnit, frequencyDuration) {
1326
- return this.httpService.api({
1327
- method: 'post',
1328
- url: `${this.SERVICE_URL}/selling-term-by-term`,
1329
- body: {
1330
- planId: planId,
1331
- offeringId: offeringId,
1332
- startDate: startDate,
1333
- term: term,
1334
- frequencyUnit: frequencyUnit,
1335
- frequencyDuration: frequencyDuration,
1336
- },
1337
- });
1338
- }
1339
- }
1340
- PriceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PriceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1341
- PriceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PriceApiService });
1342
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PriceApiService, decorators: [{
1343
- type: Injectable
1344
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1345
-
1346
- class ProceduresApiService {
1347
- constructor(baseHttpService) {
1348
- this.baseHttpService = baseHttpService;
1349
- this.ADMIN_SERVICE_URL = '/admin/procedures';
1350
- this.SERVICE_URL = '/procedures';
1351
- this.fetchProcedures$ = () => {
1352
- return this.searchProcedures$(new Expression(), 0, 100);
1353
- };
1354
- this.searchProcedures$ = (expression, skip, count) => {
1355
- let params = new HttpParams();
1356
- params = params.set('skip', '' + skip);
1357
- params = params.set('count', '' + count);
1358
- return this.baseHttpService.api({
1359
- method: 'post',
1360
- url: `${this.ADMIN_SERVICE_URL}/search`,
1361
- params,
1362
- body: expression,
1363
- });
1364
- };
1365
- this.createProcedure$ = (newProcedure) => {
1366
- return this.baseHttpService.api({
1367
- url: `${this.ADMIN_SERVICE_URL}`,
1368
- method: 'post',
1369
- body: newProcedure,
1370
- });
1371
- };
1372
- this.updateProcedure$ = (procedure) => {
1373
- return this.baseHttpService.api({
1374
- url: `${this.ADMIN_SERVICE_URL}/${procedure.id}`,
1375
- method: 'put',
1376
- body: procedure,
1377
- });
1378
- };
1379
- this.duplicateProcedure$ = (body) => {
1380
- return this.baseHttpService
1381
- .api({
1382
- url: `${this.ADMIN_SERVICE_URL}/${body.id}/clone`,
1383
- method: 'post',
1384
- body,
1385
- })
1386
- .pipe(map(response => response.clonedRecordId));
1387
- };
1388
- this.removeProcedure$ = (id) => {
1389
- return this.baseHttpService.api({
1390
- url: `${this.ADMIN_SERVICE_URL}/${id}`,
1391
- method: 'delete',
1392
- });
1393
- };
1394
- this.restoreProcedure$ = (id) => {
1395
- return this.baseHttpService.api({
1396
- url: `${this.ADMIN_SERVICE_URL}/${id}/restore`,
1397
- method: 'patch',
1398
- });
1399
- };
1400
- }
1401
- fetchProcedure$(id) {
1402
- return this.baseHttpService.api({
1403
- url: `${this.ADMIN_SERVICE_URL}/${id}`,
1404
- method: 'get',
1405
- });
1406
- }
1407
- execute$(body) {
1408
- return this.baseHttpService.api({
1409
- url: `${this.SERVICE_URL}/execute`,
1410
- method: 'post',
1411
- body,
1412
- });
1413
- }
1414
- catalogExecute$(body) {
1415
- return this.baseHttpService.api({
1416
- url: `${this.SERVICE_URL}/catalog/execute`,
1417
- method: 'post',
1418
- body,
1419
- });
1420
- }
1421
- rlmExecute$(body) {
1422
- return this.baseHttpService.api({
1423
- url: `${this.SERVICE_URL}/rlm/execute`,
1424
- method: 'post',
1425
- body,
1426
- });
1427
- }
1428
- /**
1429
- * Run active procedure against QuoteDraft
1430
- * @param body
1431
- * @returns
1432
- */
1433
- apply$(body) {
1434
- return this.baseHttpService.api({
1435
- url: `${this.SERVICE_URL}/apply`,
1436
- method: 'post',
1437
- body,
1438
- });
1439
- }
1440
- fetchDefaultPricingSteps$() {
1441
- return this.baseHttpService.api({
1442
- url: `${this.ADMIN_SERVICE_URL}/pricing-steps`,
1443
- method: 'get',
1444
- });
1445
- }
1446
- }
1447
- ProceduresApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1448
- ProceduresApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService });
1449
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProceduresApiService, decorators: [{
1450
- type: Injectable
1451
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1452
-
1453
- class ProductApiService {
1454
- constructor(baseHttpService) {
1455
- this.baseHttpService = baseHttpService;
1456
- this.serviceUrl = '/products';
1457
- this.fetchProducts$ = (payload) => {
1458
- let params = new HttpParams();
1459
- params = params.append('count', payload.count);
1460
- params = params.append('skip', payload.skip);
1461
- if (payload.name) {
1462
- params = params.append('name', payload.name);
1463
- }
1464
- return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
1465
- };
1466
- this.searchProducts$ = (expression, skip, count) => {
1467
- let params = new HttpParams();
1468
- params = params.set('skip', '' + skip);
1469
- params = params.set('count', '' + count);
1470
- return this.baseHttpService.api({
1471
- method: 'post',
1472
- url: `${this.serviceUrl}/search`,
1473
- params: params,
1474
- body: expression,
1475
- });
1476
- };
1477
- this.fetchProduct$ = (id) => this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
1478
- this.fetchAttributes$ = () => {
1479
- return this.baseHttpService.api({ url: `${this.serviceUrl}/attributes/definition` });
1480
- };
1481
- this.searchAttributes$ = (expression, skip, count) => {
1482
- let params = new HttpParams();
1483
- params = params.set('skip', '' + skip);
1484
- params = params.set('count', '' + count);
1485
- return this.baseHttpService.api({
1486
- method: 'post',
1487
- url: `${this.serviceUrl}/attributes/definition/search`,
1488
- params: params,
1489
- body: expression,
1490
- });
1491
- };
1492
- this.fetchAttributesByModel = (modelId) => {
1493
- return this.baseHttpService.api({ url: `${this.serviceUrl}/attributes/definition/forModel/${modelId}` });
1494
- };
1495
- this.createNewProduct$ = (productData) => {
1496
- return this.baseHttpService.api({
1497
- url: `${this.serviceUrl}`,
1498
- method: 'post',
1499
- body: productData,
1500
- });
1501
- };
1502
- this.updateProduct$ = (body) => {
1503
- return this.baseHttpService.api({
1504
- url: `${this.serviceUrl}/${body.id}`,
1505
- method: 'put',
1506
- body,
1507
- });
1508
- };
1509
- this.removeProduct$ = (id) => {
1510
- return this.baseHttpService.api({
1511
- url: `${this.serviceUrl}/${id}`,
1512
- method: 'delete',
1513
- });
1514
- };
1515
- this.restoreProduct$ = (id) => {
1516
- return this.baseHttpService.api({
1517
- url: `${this.serviceUrl}/${id}/restore`,
1518
- method: 'patch',
1519
- });
1520
- };
1521
- this.createProductAttribute$ = (attributeData) => {
1522
- return this.baseHttpService.api({
1523
- url: `${this.serviceUrl}/attributes`,
1524
- method: 'post',
1525
- body: attributeData,
1526
- });
1527
- };
1528
- this.updateProductAttribute$ = (attributeData) => {
1529
- return this.baseHttpService.api({
1530
- url: `${this.serviceUrl}/attributes/${attributeData.id}`,
1531
- method: 'put',
1532
- body: attributeData,
1533
- });
1534
- };
1535
- this.removeProductAttribute$ = (id) => {
1536
- return this.baseHttpService.api({
1537
- url: `${this.serviceUrl}/attributes/${id}`,
1538
- method: 'delete',
1539
- });
1540
- };
1541
- this.createNewAttribute$ = (attributeData) => {
1542
- return this.baseHttpService.api({
1543
- url: `${this.serviceUrl}/attributes/definition`,
1544
- method: 'post',
1545
- body: attributeData,
1546
- });
1547
- };
1548
- this.updateAttribute$ = (body) => {
1549
- return this.baseHttpService.api({
1550
- url: `${this.serviceUrl}/attributes/definition/${body.id}`,
1551
- method: 'put',
1552
- body,
1553
- });
1554
- };
1555
- this.removeAttribute$ = (id) => {
1556
- return this.baseHttpService.api({
1557
- url: `${this.serviceUrl}/attributes/definition/${id}`,
1558
- method: 'delete',
1559
- });
1560
- };
1561
- this.restoreAttribute$ = (id) => {
1562
- return this.baseHttpService.api({
1563
- url: `${this.serviceUrl}/attributes/definition/${id}/restore`,
1564
- method: 'patch',
1565
- });
1566
- };
1567
- }
1568
- attachImage$(productId, file) {
1569
- const data = new FormData();
1570
- data.append('image', file);
1571
- return this.baseHttpService.upload({
1572
- method: 'post',
1573
- url: `${this.serviceUrl}/${productId}/image`,
1574
- body: data,
1575
- });
1576
- }
1577
- removeImage$(productId) {
1578
- return this.baseHttpService.api({
1579
- method: 'delete',
1580
- url: `${this.serviceUrl}/${productId}/image`,
1581
- });
1582
- }
1583
- fetchImage$(productId) {
1584
- return this.baseHttpService.api({
1585
- url: this.getImageUrl(productId),
1586
- method: 'get',
1587
- responseType: 'blob',
1588
- errorHandler: noop,
1589
- });
1590
- }
1591
- getImageUrl(productId) {
1592
- return `${this.serviceUrl}/${productId}/image`;
1593
- }
1594
- }
1595
- ProductApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1596
- ProductApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductApiService });
1597
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductApiService, decorators: [{
1598
- type: Injectable
1599
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1600
-
1601
- class ProductModelApiService {
1602
- constructor(httpService) {
1603
- this.httpService = httpService;
1604
- this.SERVICE_URL = '/models';
1605
- }
1606
- addModel(model) {
1607
- return this.httpService
1608
- .api({
1609
- method: 'post',
1610
- url: this.SERVICE_URL,
1611
- body: model,
1612
- errorHandler: this.httpService.handleValidationError,
1613
- })
1614
- .pipe(map(result => {
1615
- if (result.successful) {
1616
- return result;
1617
- }
1618
- else {
1619
- throw new Error(result.message);
1620
- }
1621
- }));
1622
- }
1623
- releaseModel(model) {
1624
- return this.httpService
1625
- .api({
1626
- method: 'put',
1627
- url: `${this.SERVICE_URL}/${model.id}/release`,
1628
- body: model,
1629
- errorHandler: this.httpService.handleValidationError,
1630
- })
1631
- .pipe(map(result => {
1632
- if (result.successful) {
1633
- return '';
1634
- }
1635
- else {
1636
- throw new Error(result.message);
1637
- }
1638
- }));
1639
- }
1640
- removeModel(modelId, successFn, failureFn) {
1641
- const observable = this.httpService
1642
- .api({
1643
- method: 'delete',
1644
- url: `${this.SERVICE_URL}/${modelId}`,
1645
- errorHandler: this.httpService.handleValidationError,
1646
- })
1647
- .pipe(map(result => {
1648
- if (result.successful) {
1649
- return '';
1650
- }
1651
- else {
1652
- throw new Error(result.message);
1653
- }
1654
- }));
1655
- observable.subscribe(() => {
1656
- successFn && successFn.apply();
1657
- }, () => {
1658
- failureFn && failureFn.apply();
1659
- });
1660
- }
1661
- getModelVersions(modelId, count = 100, skip = 0) {
1662
- return this.httpService.api({
1663
- method: 'post',
1664
- url: `${this.SERVICE_URL}/${modelId}/versions`,
1665
- body: {
1666
- skipCount: skip,
1667
- count: count,
1668
- },
1669
- });
1670
- }
1671
- getModel(id, version) {
1672
- let url = `${this.SERVICE_URL}/${id}`;
1673
- if (version) {
1674
- url += `/versions/${version}`;
1675
- }
1676
- return this.httpService.api({ url });
1677
- }
1678
- getModels(skipCount, searchText) {
1679
- return this.httpService.api({
1680
- method: 'post',
1681
- url: `${this.SERVICE_URL}/search`,
1682
- body: {
1683
- nameRegex: searchText,
1684
- skipCount: skipCount.toString(),
1685
- count: ProductModelApiService.MAX_RESULTS,
1686
- },
1687
- });
1688
- }
1689
- getLinkedModels(id, version) {
1690
- let url = `${this.SERVICE_URL}/${id}`;
1691
- if (version) {
1692
- url += `/versions/${version}`;
1693
- }
1694
- url += '/linked';
1695
- return this.httpService.api({ url }).pipe(map((linkedModels) => {
1696
- if (linkedModels) {
1697
- linkedModels.forEach(model => ModelTranslatorUtils.toLocalModel(model));
1698
- }
1699
- return linkedModels;
1700
- }));
1701
- }
1702
- /**
1703
- *
1704
- * @deprecated
1705
- * Will be removed in next major release
1706
- */
1707
- load(id, version) {
1708
- return forkJoin([this.getModel(id, version), this.getLinkedModels(id, version)]).pipe(map(([model, linkedModels]) => {
1709
- const container = new ProductModelsContainer(model, linkedModels !== null && linkedModels !== void 0 ? linkedModels : []);
1710
- ModelUtils.override(container.main, container.linked);
1711
- ModelTranslatorUtils.toLocalModel(container.main, container.linked);
1712
- return container;
1713
- }));
1714
- }
1715
- getPML(modelId, version) {
1716
- let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
1717
- if (version) {
1718
- url += `/versions/${version}`;
1719
- }
1720
- return this.httpService.api({
1721
- url,
1722
- responseType: 'text',
1723
- });
1724
- }
1725
- savePML(modelId, pml, comment) {
1726
- return this.httpService
1727
- .api({
1728
- method: 'put',
1729
- url: `${this.SERVICE_URL}/${modelId}/pml`,
1730
- body: {
1731
- id: modelId,
1732
- pml: pml,
1733
- comment: comment,
1734
- },
1735
- })
1736
- .pipe(map(result => {
1737
- if (result.successful) {
1738
- return '';
1739
- }
1740
- else {
1741
- throw new Error(result.message);
1742
- }
1743
- }), catchError(this.httpService.handleValidationError));
1744
- }
1745
- generateProducts(modelId) {
1746
- return this.httpService.api({
1747
- url: `${this.SERVICE_URL}/${modelId}/generate-products`,
1748
- });
1749
- }
1750
- saveModel(productModel, comment) {
1751
- const model = EntityUtil.clone(productModel);
1752
- model.comment = comment;
1753
- ModelTranslatorUtils.toServerModel(model);
1754
- return this.httpService
1755
- .api({
1756
- method: 'put',
1757
- url: `${this.SERVICE_URL}/${model.id}`,
1758
- body: model,
1759
- })
1760
- .pipe(map(result => {
1761
- if (result.successful) {
1762
- return '';
1763
- }
1764
- else {
1765
- throw new Error(result.message);
1766
- }
1767
- }), catchError(this.httpService.handleValidationError));
1768
- }
1769
- validateModel(productModel) {
1770
- return this.httpService
1771
- .api({
1772
- method: 'post',
1773
- url: `${this.SERVICE_URL}/validate`,
1774
- body: productModel,
1775
- errorHandler: this.httpService.handleValidationError,
1776
- })
1777
- .pipe(map(result => {
1778
- if (result.successful) {
1779
- return '';
1780
- }
1781
- else {
1782
- throw new Error(result.message);
1783
- }
1784
- }));
1785
- }
1786
- renameModel(productModel, name) {
1787
- const model = EntityUtil.clone(productModel);
1788
- model.name = name;
1789
- ModelTranslatorUtils.toServerModel(model);
1790
- return this.httpService
1791
- .api({
1792
- method: 'patch',
1793
- url: `${this.SERVICE_URL}/${model.id}`,
1794
- body: model,
1795
- })
1796
- .pipe(catchError(this.httpService.handleValidationError));
1797
- }
1798
- uploadPmlFile(file, modelId) {
1799
- const formData = new FormData();
1800
- formData.append('file', file, file.name);
1801
- return this.httpService.upload({
1802
- url: `${this.SERVICE_URL}/${modelId}/pml/upload`,
1803
- body: formData,
1804
- });
1805
- }
1806
- runPml(modelId, pml, rootType, configurationMode) {
1807
- return this.httpService.api({
1808
- method: 'post',
1809
- url: `${this.SERVICE_URL}/${modelId}/pml/run`,
1810
- body: {
1811
- pml,
1812
- rootType,
1813
- configurationMode,
1814
- },
1815
- responseType: 'text',
1816
- });
1817
- }
1818
- evictAllCache() {
1819
- return this.httpService.api({
1820
- method: 'get',
1821
- url: '/cache/evict/environment-variables',
1822
- });
1823
- }
1824
- }
1825
- ProductModelApiService.MAX_RESULTS = 200;
1826
- ProductModelApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModelApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1827
- ProductModelApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModelApiService });
1828
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModelApiService, decorators: [{
1829
- type: Injectable
1830
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1831
-
1832
- class PromotionsApiService {
1833
- constructor(baseHttpService) {
1834
- this.baseHttpService = baseHttpService;
1835
- this.serviceUrl = '/admin/promotion';
1836
- this.fetchAll$ = () => {
1837
- return this.baseHttpService.api({ url: this.serviceUrl });
1838
- };
1839
- this.fetchOne$ = (id) => {
1840
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
1841
- };
1842
- this.remove$ = (id) => {
1843
- return this.baseHttpService.api({
1844
- url: `${this.serviceUrl}/${id}`,
1845
- method: 'delete',
1846
- });
1847
- };
1848
- this.restore$ = (id) => {
1849
- return this.baseHttpService.api({
1850
- method: 'patch',
1851
- url: `${this.serviceUrl}/${id}/restore`,
1852
- });
1853
- };
1854
- this.duplicate$ = (body) => {
1855
- return this.baseHttpService
1856
- .api({
1857
- url: `${this.serviceUrl}/${body.id}/clone`,
1858
- method: 'post',
1859
- body,
1860
- })
1861
- .pipe(map$1(response => response.clonedRecordId));
1862
- };
1863
- }
1864
- search$(expression, skip, count) {
1865
- let params = new HttpParams();
1866
- if (typeof skip === 'number') {
1867
- params = params.set('skip', '' + skip);
1868
- }
1869
- if (typeof count === 'number') {
1870
- params = params.set('count', '' + count);
1871
- }
1872
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
1873
- }
1874
- create$(body) {
1875
- return this.baseHttpService.api({
1876
- url: `${this.serviceUrl}`,
1877
- method: 'post',
1878
- body,
1879
- });
1880
- }
1881
- update$(body) {
1882
- return this.baseHttpService.api({
1883
- url: `${this.serviceUrl}/${body.id}`,
1884
- method: 'put',
1885
- body,
1886
- });
1887
- }
1888
- }
1889
- PromotionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1890
- PromotionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService });
1891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, decorators: [{
1892
- type: Injectable
1893
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1894
-
1895
- class QuoteApiService {
1896
- constructor(httpService) {
1897
- this.httpService = httpService;
1898
- this.SERVICE_URL = '/quotes';
1899
- }
1900
- /**
1901
- * @deprecated Use getQuoteState instead
1902
- */
1903
- getQuoteDraft(objectId, params, errorHandler) {
1904
- return this.httpService.api({
1905
- method: 'get',
1906
- url: `${this.SERVICE_URL}/${objectId}`,
1907
- params,
1908
- errorHandler,
1909
- });
1910
- }
1911
- /**
1912
- * Comparing to deprecated `getQuoteDraft` this endpoint doesn't include orders and assets
1913
- * @param objectId quoteId | accountId | opportunityId | orderId
1914
- * @param params Query params
1915
- * @param options Request options
1916
- */
1917
- getQuoteState(objectId, params, options) {
1918
- return this.httpService.api(Object.assign({ method: 'get', url: `/v2${this.SERVICE_URL}/${objectId}`, params }, options));
1919
- }
1920
- upsertQuote(request, options) {
1921
- return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}`, body: request }, options));
1922
- }
1923
- submitQuote(request, options) {
1924
- return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/submit`, body: request }, options));
1925
- }
1926
- attachDocument(id, documentName, data) {
1927
- const formData = new FormData();
1928
- const blob = new Blob([data]);
1929
- formData.append('file', blob, documentName);
1930
- return this.httpService.upload({
1931
- url: `${this.SERVICE_URL}/${id}/attach-document`,
1932
- responseType: 'arraybuffer',
1933
- method: 'post',
1934
- body: formData,
1935
- });
1936
- }
1937
- }
1938
- QuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1939
- QuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteApiService });
1940
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteApiService, decorators: [{
1941
- type: Injectable
1942
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1943
-
1944
- class RampApiService {
1945
- constructor(httpService) {
1946
- this.httpService = httpService;
1947
- this.SERVICE_URL = '/ramp';
1948
- }
1949
- next(request, options) {
1950
- return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/next`, body: request }, options));
1951
- }
1952
- renew(request, options) {
1953
- return this.httpService.api(Object.assign({ method: 'post', url: `${this.SERVICE_URL}/renew`, body: request }, options));
1954
- }
1955
- }
1956
- RampApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RampApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1957
- RampApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RampApiService });
1958
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RampApiService, decorators: [{
1959
- type: Injectable
1960
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1961
-
1962
- class RebateProgramApiService {
1963
- constructor(baseHttpService) {
1964
- this.baseHttpService = baseHttpService;
1965
- this.serviceUrl = '/admin/rebate-program';
1966
- this.fetchAll$ = () => {
1967
- return this.baseHttpService.api({ url: this.serviceUrl });
1968
- };
1969
- this.fetchOne$ = (id) => {
1970
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
1971
- };
1972
- this.remove$ = (id) => {
1973
- return this.baseHttpService.api({
1974
- url: `${this.serviceUrl}/${id}`,
1975
- method: 'delete',
1976
- });
1977
- };
1978
- this.restore$ = (id) => {
1979
- return this.baseHttpService.api({
1980
- method: 'patch',
1981
- url: `${this.serviceUrl}/${id}/restore`,
1982
- });
1983
- };
1984
- this.duplicate$ = (body) => {
1985
- return this.baseHttpService
1986
- .api({
1987
- url: `${this.serviceUrl}/${body.id}/clone`,
1988
- method: 'post',
1989
- body,
1990
- })
1991
- .pipe(map$1(response => response.clonedRecordId));
1992
- };
1993
- }
1994
- search$(expression, skip, count) {
1995
- let params = new HttpParams();
1996
- if (typeof skip === 'number') {
1997
- params = params.set('skip', '' + skip);
1998
- }
1999
- if (typeof count === 'number') {
2000
- params = params.set('count', '' + count);
2001
- }
2002
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2003
- }
2004
- create$(body) {
2005
- return this.baseHttpService.api({
2006
- url: `${this.serviceUrl}`,
2007
- method: 'post',
2008
- body,
2009
- });
2010
- }
2011
- update$(body) {
2012
- return this.baseHttpService.api({
2013
- url: `${this.serviceUrl}/${body.id}`,
2014
- method: 'put',
2015
- body,
2016
- });
2017
- }
2018
- }
2019
- RebateProgramApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2020
- RebateProgramApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService });
2021
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, decorators: [{
2022
- type: Injectable
2023
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2024
-
2025
- class RebateTypeApiService {
2026
- constructor(baseHttpService) {
2027
- this.baseHttpService = baseHttpService;
2028
- this.serviceUrl = '/admin/rebate-type';
2029
- this.fetchAll$ = () => {
2030
- return this.baseHttpService.api({ url: this.serviceUrl });
2031
- };
2032
- this.fetchOne$ = (id) => {
2033
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2034
- };
2035
- this.remove$ = (id) => {
2036
- return this.baseHttpService.api({
2037
- url: `${this.serviceUrl}/${id}`,
2038
- method: 'delete',
2039
- });
2040
- };
2041
- this.restore$ = (id) => {
2042
- return this.baseHttpService.api({
2043
- method: 'patch',
2044
- url: `${this.serviceUrl}/${id}/restore`,
2045
- });
2046
- };
2047
- this.duplicate$ = (body) => {
2048
- return this.baseHttpService
2049
- .api({
2050
- url: `${this.serviceUrl}/${body.id}/clone`,
2051
- method: 'post',
2052
- body,
2053
- })
2054
- .pipe(map$1(response => response.clonedRecordId));
2055
- };
2056
- }
2057
- search$(expression, skip, count) {
2058
- let params = new HttpParams();
2059
- if (typeof skip === 'number') {
2060
- params = params.set('skip', '' + skip);
2061
- }
2062
- if (typeof count === 'number') {
2063
- params = params.set('count', '' + count);
2064
- }
2065
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
262
+ this.serviceUrl = '/admin/offers';
2066
263
  }
2067
- create$(body) {
264
+ createOffer$(body) {
2068
265
  return this.baseHttpService.api({
2069
266
  url: `${this.serviceUrl}`,
2070
267
  method: 'post',
2071
268
  body,
2072
269
  });
2073
270
  }
2074
- update$(body) {
271
+ fetchOffers$() {
2075
272
  return this.baseHttpService.api({
2076
- url: `${this.serviceUrl}/${body.id}`,
2077
- method: 'put',
2078
- body,
273
+ url: `${this.serviceUrl}`,
2079
274
  });
2080
275
  }
2081
- }
2082
- RebateTypeApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2083
- RebateTypeApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService });
2084
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, decorators: [{
2085
- type: Injectable
2086
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2087
-
2088
- class RlmApiService {
2089
- constructor(baseHttpService) {
2090
- this.baseHttpService = baseHttpService;
2091
- this.serviceUrl = '/rlm';
2092
- }
2093
- // TODO: request RLM data only when RLM is installed. Otherwise skip rlm requests. Discuss solution|approach with BE
2094
- fetchContextDefinitions$() {
2095
- return this.baseHttpService
2096
- .api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
2097
- .pipe(catchError(() => {
2098
- return of([]);
2099
- }));
2100
- }
2101
- fetchContextMappings$(id) {
2102
- return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
2103
- }
2104
- fetchContextDefinitionStructure$(id) {
2105
- return this.baseHttpService
2106
- .api({
2107
- url: `${this.serviceUrl}/context/${id}/structure/details`,
2108
- skipErrorHandler: true,
2109
- })
2110
- .pipe(catchError(() => {
2111
- return of([]);
2112
- }), map(objects => {
2113
- return objects.map(object => {
2114
- var _a, _b;
2115
- const tag = (_b = (_a = object.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
2116
- const objectAttributes = object.attributes || [];
2117
- return {
2118
- id: object.id,
2119
- title: tag || object.title,
2120
- attributes: objectAttributes.map(attribute => {
2121
- var _a, _b;
2122
- const tag = (_b = (_a = attribute.tags) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.title;
2123
- return {
2124
- title: tag || attribute.title,
2125
- fieldType: attribute.fieldType,
2126
- dataType: attribute.dataType,
2127
- };
2128
- }),
2129
- };
2130
- });
2131
- }));
2132
- }
2133
- fetchRlmProcedures(contextDefinitionId) {
2134
- const params = {};
2135
- if (contextDefinitionId) {
2136
- params['contextDefinitionId'] = contextDefinitionId;
2137
- }
276
+ fetchOffer$(id) {
2138
277
  return this.baseHttpService.api({
2139
- url: `${this.serviceUrl}/procedures`,
2140
- params,
278
+ url: `${this.serviceUrl}/${id}`,
2141
279
  });
2142
280
  }
2143
- }
2144
- RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2145
- RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
2146
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
2147
- type: Injectable
2148
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2149
-
2150
- class RlmQuoteApiService {
2151
- constructor(httpService) {
2152
- this.httpService = httpService;
2153
- this.SERVICE_URL = '/quotes/rlm';
2154
- }
2155
- getQuote(mappingType, objectId, contextMappingId, options) {
2156
- const params = { mappingType };
2157
- if (contextMappingId) {
2158
- params['contextMappingId'] = contextMappingId;
2159
- }
2160
- return this.httpService.api(Object.assign({ method: 'get', url: `${this.SERVICE_URL}/${objectId}`, params }, options));
2161
- }
2162
- }
2163
- RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2164
- RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
2165
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
2166
- type: Injectable
2167
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2168
-
2169
- class RuleGroupsApiService {
2170
- constructor(baseHttpService) {
2171
- this.baseHttpService = baseHttpService;
2172
- this.serviceUrl = '/admin/rule-groups';
2173
- this.fetchRuleGroups$ = () => {
2174
- return this.searchRuleGroups$(new Expression(), 0, 100);
2175
- };
2176
- this.searchRuleGroups$ = (expression, skip, count) => {
2177
- let params = new HttpParams();
2178
- params = params.set('skip', '' + skip);
2179
- params = params.set('count', '' + count);
2180
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2181
- };
2182
- this.createRuleGroup$ = (ruleGroup) => {
2183
- return this.baseHttpService.api({
2184
- url: `${this.serviceUrl}`,
2185
- method: 'post',
2186
- body: ruleGroup,
2187
- });
2188
- };
2189
- this.updateRuleGroup$ = (ruleGroup) => {
2190
- return this.baseHttpService.api({
2191
- url: `${this.serviceUrl}/${ruleGroup.id}`,
2192
- method: 'post',
2193
- body: ruleGroup,
2194
- });
2195
- };
2196
- this.duplicateRuleGroup$ = (body) => {
2197
- return this.baseHttpService
2198
- .api({
2199
- url: `${this.serviceUrl}/${body.id}/clone`,
2200
- method: 'post',
2201
- body,
2202
- })
2203
- .pipe(map$1(response => response.clonedRecordId));
2204
- };
2205
- this.removeRuleGroup$ = (id) => {
2206
- return this.baseHttpService.api({
2207
- url: `${this.serviceUrl}/${id}`,
2208
- method: 'delete',
2209
- });
2210
- };
2211
- this.restoreRuleGroup$ = (id) => {
2212
- return this.baseHttpService.api({
2213
- url: `${this.serviceUrl}/${id}/restore`,
2214
- method: 'patch',
2215
- });
2216
- };
2217
- }
2218
- }
2219
- RuleGroupsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2220
- RuleGroupsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService });
2221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, decorators: [{
2222
- type: Injectable
2223
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2224
-
2225
- class RulesApiService {
2226
- constructor(baseHttpService) {
2227
- this.baseHttpService = baseHttpService;
2228
- this.serviceUrl = '/admin/rules';
2229
- this.fetchRules$ = () => {
2230
- return this.searchRules$(new Expression(), 0, 100);
2231
- };
2232
- this.searchRules$ = (expression, skip, count) => {
2233
- let params = new HttpParams();
2234
- if (typeof skip === 'number') {
2235
- params = params.set('skip', '' + skip);
2236
- }
2237
- if (typeof count === 'number') {
2238
- params = params.set('count', '' + count);
2239
- }
2240
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2241
- };
2242
- this.createRule$ = (rule) => {
2243
- return this.baseHttpService.api({
2244
- url: `${this.serviceUrl}`,
2245
- method: 'post',
2246
- body: rule,
2247
- });
2248
- };
2249
- this.updateRule$ = (rule) => {
2250
- return this.baseHttpService.api({
2251
- url: `${this.serviceUrl}/${rule.id}`,
2252
- method: 'put',
2253
- body: rule,
2254
- });
2255
- };
2256
- this.duplicateRule$ = (body) => {
2257
- return this.baseHttpService
2258
- .api({
2259
- url: `${this.serviceUrl}/${body.id}/clone`,
2260
- method: 'post',
2261
- body,
2262
- })
2263
- .pipe(map(response => response.clonedRecordId));
2264
- };
2265
- this.removeRule$ = (id) => {
2266
- return this.baseHttpService.api({
2267
- url: `${this.serviceUrl}/${id}`,
2268
- method: 'delete',
2269
- });
2270
- };
2271
- this.restoreRule$ = (id) => {
2272
- return this.baseHttpService.api({
2273
- url: `${this.serviceUrl}/${id}/restore`,
2274
- method: 'patch',
2275
- });
2276
- };
2277
- }
2278
- fetchRule$(id) {
281
+ updateOffer$(offer) {
2279
282
  return this.baseHttpService.api({
2280
- url: `${this.serviceUrl}/${id}`,
2281
- method: 'get',
283
+ url: `${this.serviceUrl}/${offer.id}`,
284
+ method: 'put',
285
+ body: offer,
2282
286
  });
2283
287
  }
2284
- fetchHeaderFields$() {
288
+ removeOffer$(id) {
2285
289
  return this.baseHttpService.api({
2286
- url: `${this.serviceUrl}/describe/Header`,
2287
- method: 'get',
290
+ url: `${this.serviceUrl}/${id}`,
291
+ method: 'delete',
2288
292
  });
2289
293
  }
2290
- execute$(body) {
2291
- const url = this.getExecuteRuleUrl(body.rule.ruleGroupType);
294
+ searchOffers$(expression, skip, count) {
295
+ let params = new HttpParams();
296
+ params = params.set('skip', '' + skip);
297
+ params = params.set('count', '' + count);
2292
298
  return this.baseHttpService.api({
2293
- url,
2294
299
  method: 'post',
2295
- body,
300
+ url: `${this.serviceUrl}/search`,
301
+ params,
302
+ body: expression,
2296
303
  });
2297
304
  }
2298
- getExecuteRuleUrl(ruleGroupType) {
2299
- if (ruleGroupType === RuleGroupTypes.eligibility) {
2300
- return '/rules/eligibility/execute';
2301
- }
2302
- if (ruleGroupType === RuleGroupTypes.catalog) {
2303
- return '/rules/catalog/execute';
2304
- }
2305
- if (ruleGroupType === RuleGroupTypes.rlmContextBased) {
2306
- return '/rules/rlm/execute';
2307
- }
2308
- return '/rules/execute';
305
+ fetchOfferProducts$(id) {
306
+ return this.baseHttpService
307
+ .api({
308
+ url: `${this.serviceUrl}/${id}/products`,
309
+ })
310
+ .pipe(map(response => response.products));
311
+ }
312
+ upsertOfferProducts$(id, products) {
313
+ const request = { products };
314
+ return this.baseHttpService
315
+ .api({
316
+ url: `${this.serviceUrl}/${id}/products`,
317
+ method: 'put',
318
+ body: request,
319
+ })
320
+ .pipe(map(response => response.products));
2309
321
  }
2310
322
  }
2311
- RulesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2312
- RulesApiServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService });
2313
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, decorators: [{
323
+ OffersApiService.MAX_RESULTS = 60;
324
+ OffersApiServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OffersApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
325
+ OffersApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OffersApiService });
326
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OffersApiService, decorators: [{
2314
327
  type: Injectable
2315
328
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2316
329
 
2317
- class SalesforceApiService {
2318
- constructor(httpService) {
2319
- this.httpService = httpService;
2320
- this.SERVICE_URL = '/proxy';
2321
- }
2322
- query(searchRequest, objectName, options) {
2323
- return this.httpService.api(Object.assign({ method: 'post', body: Object.assign(Object.assign({}, searchRequest), { count: searchRequest.count || 100 }), url: `${this.SERVICE_URL}/query/${objectName}` }, options));
2324
- }
2325
- queryObjects(search, options) {
2326
- let params = new HttpParams();
2327
- if (search) {
2328
- params = params.append('search', search);
2329
- }
2330
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/query`, params }, options));
2331
- }
2332
- search(req, options) {
2333
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/rest/search`, params: { q: req.searchString } }, options));
2334
- }
2335
- /**
2336
- * @deprecated
2337
- */
2338
- describe(objectName, fieldName, options) {
2339
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields` + (fieldName ? `/${fieldName}` : '');
2340
- return this.httpService.api(Object.assign({ url: methodUrl }, options));
2341
- }
2342
- describeObject(objectName, options) {
2343
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2344
- return this.httpService.api(Object.assign({ url: methodUrl }, options));
2345
- }
2346
- describeField(objectName, fieldName, options) {
2347
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
2348
- return this.httpService.api(Object.assign({ url: methodUrl }, options));
2349
- }
2350
- describe2(objectName, fields, options) {
2351
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2352
- return this.httpService.api(Object.assign({ method: 'post', url: methodUrl, body: fields }, options));
2353
- }
2354
- apexGetRequest(path, params, options) {
2355
- // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
2356
- const httpParams = new HttpParams({ fromString: params.toString() });
2357
- return this.httpService.api(Object.assign({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams }, options));
2358
- }
2359
- apexPostRequest(path, body, options) {
2360
- return this.httpService.api(Object.assign({ method: 'post', body, url: `${this.SERVICE_URL}/apex${path}` }, options));
2361
- }
2362
- getGlobalPicklists() {
2363
- return this.httpService.api({
2364
- method: 'get',
2365
- url: `${this.SERVICE_URL}/globalvalueset`,
2366
- });
330
+ /**
331
+ * Parses the response from Canvas and checks for errors.
332
+ * - If an error is found, publishes an error message and returns the failover value.
333
+ * - If no error is found, returns the parsed response.
334
+ *
335
+ * Note! The API call first goes to APEX before reaching the Canvas, so errors can originate from either APEX or Canvas.
336
+ *
337
+ * @param {string} response - The JSON string response from the Canvas call.
338
+ * @param {T} failover - The value to return in case of error.
339
+ * @returns {T | K} The parsed response or the failover value.
340
+ *
341
+ * @template T The expected type of the parsed response.
342
+ * @template K The type of the failover value.
343
+ *
344
+ * @remarks If there's an Apex error, the response data can be an array.
345
+ * In such cases, the function extracts the first element of the array.
346
+ */
347
+ const handleCanvasResponse = (response, failover, errorPublisher) => {
348
+ const parsed = JSON.parse(response);
349
+ const errorCandidate = isArray(parsed) ? parsed[0] : parsed;
350
+ if (isApexError(errorCandidate)) {
351
+ errorPublisher(errorCandidate.message);
352
+ return failover;
2367
353
  }
2368
- getGlobalPicklistValues(id) {
2369
- return this.httpService.api({
2370
- method: 'get',
2371
- url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
2372
- });
354
+ if (isCanvasError(errorCandidate)) {
355
+ errorPublisher(errorCandidate.error);
356
+ return failover;
2373
357
  }
2374
- }
2375
- SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2376
- SalesforceApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
2377
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, decorators: [{
2378
- type: Injectable
2379
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
358
+ return parsed;
359
+ };
2380
360
 
2381
- class SandboxManagerApiService {
361
+ class OrgInfoApiService {
2382
362
  constructor(messageService) {
2383
363
  this.messageService = messageService;
2384
364
  /**
@@ -2390,70 +370,30 @@ class SandboxManagerApiService {
2390
370
  this.messageService.add({ severity: 'error', summary: message, sticky: true });
2391
371
  };
2392
372
  }
2393
- getSalesforceOrganizations$() {
2394
- try {
2395
- return window.doSandboxCall
2396
- ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
2397
- : of([]);
2398
- }
2399
- catch (_a) {
2400
- return of([]);
2401
- }
2402
- }
2403
- getAvailableSalesforceOrganizationSizes$() {
2404
- try {
2405
- return window.doSandboxCall
2406
- ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
2407
- : of({});
2408
- }
2409
- catch (_a) {
2410
- return of({});
2411
- }
2412
- }
2413
- createSalesforceOrganization$(payload) {
2414
- try {
2415
- return window.doSandboxCall
2416
- ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2417
- : of(undefined);
2418
- }
2419
- catch (err) {
2420
- return of(undefined);
2421
- }
2422
- }
2423
- updateSalesforceOrganization$(payload) {
2424
- try {
2425
- return window.doSandboxCall
2426
- ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2427
- : of(undefined);
2428
- }
2429
- catch (_a) {
2430
- return of(undefined);
2431
- }
2432
- }
2433
- deleteSalesforceOrganization$(payload) {
373
+ getOrgInfo$() {
2434
374
  try {
2435
- return window.doSandboxCall
2436
- ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
375
+ return window.doCanvasCall && window.ORGANIZATION_ID
376
+ ? from(window.doCanvasCall(`org-info/${window.ORGANIZATION_ID}`, null)).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
2437
377
  : of(undefined);
2438
378
  }
2439
379
  catch (_a) {
2440
380
  return of(undefined);
2441
381
  }
2442
382
  }
2443
- activateSalesforceOrganization$(payload) {
383
+ getAvailableVersionsInfo$() {
2444
384
  try {
2445
- return window.doSandboxCall
2446
- ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
385
+ return window.doCanvasCall && window.ORGANIZATION_ID
386
+ ? from(window.doCanvasCall('versions/available', 'include_all=true')).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
2447
387
  : of(undefined);
2448
388
  }
2449
389
  catch (_a) {
2450
390
  return of(undefined);
2451
391
  }
2452
392
  }
2453
- deactivateSalesforceOrganization$(payload) {
393
+ upgradeVersion$(targetVersion) {
2454
394
  try {
2455
- return window.doSandboxCall
2456
- ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
395
+ return window.doCanvasCall && window.ORGANIZATION_ID
396
+ ? from(window.doCanvasCall('versions/upgrade', `target_version=${targetVersion}`)).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
2457
397
  : of(undefined);
2458
398
  }
2459
399
  catch (_a) {
@@ -2461,641 +401,417 @@ class SandboxManagerApiService {
2461
401
  }
2462
402
  }
2463
403
  }
2464
- SandboxManagerApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
2465
- SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
2466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
404
+ OrgInfoApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
405
+ OrgInfoApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService });
406
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: OrgInfoApiService, decorators: [{
2467
407
  type: Injectable
2468
408
  }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
2469
409
 
2470
- class ScriptsApiService {
410
+ class PortalsApiService {
2471
411
  constructor(baseHttpService) {
2472
412
  this.baseHttpService = baseHttpService;
2473
- this.serviceUrl = '/admin/scripts';
2474
- this.fetchScripts$ = () => {
2475
- return this.baseHttpService.api({ url: `${this.serviceUrl}` });
2476
- };
2477
- this.searchScripts$ = (expression, skip, count) => {
413
+ this.serviceUrl = '/admin/portal';
414
+ this.getPortals$ = (skip = 1, name = '') => {
2478
415
  let params = new HttpParams();
2479
- if (typeof skip === 'number') {
2480
- params = params.set('skip', '' + skip);
2481
- }
2482
- if (typeof count === 'number') {
2483
- params = params.set('count', '' + count);
2484
- }
2485
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2486
- };
2487
- this.fetchScript$ = (id) => {
2488
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
416
+ params = params.append('count', (PortalsApiService.MAX_RESULTS * skip).toString());
417
+ params = params.append('skip', '0');
418
+ params = params.append('name', name);
419
+ return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
2489
420
  };
2490
- this.createScript$ = (script) => {
421
+ this.searchPortals$ = (skip = 0, expression) => {
422
+ let params = new HttpParams();
423
+ params = params.set('skip', '' + skip);
424
+ params = params.set('count', '' + PortalsApiService.MAX_RESULTS);
2491
425
  return this.baseHttpService.api({
2492
- url: `${this.serviceUrl}`,
2493
426
  method: 'post',
2494
- body: script,
427
+ url: `${this.serviceUrl}/search`,
428
+ params,
429
+ body: expression || {},
2495
430
  });
2496
431
  };
2497
- this.updateScriptMeta$ = (script) => {
432
+ this.removePortal$ = (id) => {
2498
433
  return this.baseHttpService.api({
2499
- url: `${this.serviceUrl}/${script.id}`,
2500
- method: 'put',
2501
- body: script,
434
+ url: `${this.serviceUrl}/${id}`,
435
+ method: 'delete',
2502
436
  });
2503
437
  };
2504
- this.updateScriptDetails$ = (script) => {
438
+ this.restore$ = (id) => {
2505
439
  return this.baseHttpService.api({
2506
- url: `${this.serviceUrl}/${script.id}`,
2507
- method: 'put',
2508
- body: script,
440
+ method: 'patch',
441
+ url: `${this.serviceUrl}/${id}/restore`,
2509
442
  });
2510
443
  };
2511
- this.cloneScript$ = (cloneRequest) => {
2512
- return this.baseHttpService
2513
- .api({
444
+ this.duplicatePortal$ = (cloneRequest) => {
445
+ return this.baseHttpService.api({
2514
446
  url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
2515
447
  method: 'post',
2516
448
  body: cloneRequest,
2517
- })
2518
- .pipe(map(response => response.clonedRecordId));
2519
- };
2520
- this.removeScript$ = (id) => {
2521
- return this.baseHttpService.api({
2522
- url: `${this.serviceUrl}/${id}`,
2523
- method: 'delete',
2524
- });
2525
- };
2526
- this.restoreScript$ = (id) => {
2527
- return this.baseHttpService.api({
2528
- url: `${this.serviceUrl}/${id}/restore`,
2529
- method: 'patch',
2530
449
  });
2531
450
  };
2532
- this.execute$ = (body) => {
451
+ this.getPortal$ = (id) => {
2533
452
  return this.baseHttpService.api({
2534
- url: `/scripts/execute`,
2535
- method: 'post',
2536
- body,
2537
- errorHandler: () => null,
453
+ url: `${this.serviceUrl}/${id}`,
2538
454
  });
2539
455
  };
2540
456
  }
2541
- }
2542
- ScriptsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2543
- ScriptsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService });
2544
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, decorators: [{
2545
- type: Injectable
2546
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2547
-
2548
- class ShoppingCartSettingsApiService {
2549
- constructor(configurationSettingsApiService) {
2550
- this.configurationSettingsApiService = configurationSettingsApiService;
2551
- this.shoppingCartSettingsKey = 'shopping-cart';
2552
- }
2553
- getSetting(id) {
2554
- return this.fetchSettings().pipe(map((settings) => parseJsonSafely(settings === null || settings === void 0 ? void 0 : settings.value, [])), map(settings => settings.find(setting => setting.id == id)));
2555
- }
2556
- fetchSettings() {
2557
- return this.configurationSettingsApiService.fetchSetting(this.shoppingCartSettingsKey, { skipErrorHandler: true });
2558
- }
2559
- getSettingsMap() {
2560
- return this.fetchSettings().pipe(map((settings) => parseJsonSafely(settings === null || settings === void 0 ? void 0 : settings.value, [])), map((settings) => settings.reduce((acc, setting) => {
2561
- return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
2562
- }, {})));
2563
- }
2564
- }
2565
- ShoppingCartSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartSettingsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
2566
- ShoppingCartSettingsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartSettingsApiService });
2567
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartSettingsApiService, decorators: [{
2568
- type: Injectable
2569
- }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
2570
-
2571
- class StatefulConfigurationApiService {
2572
- constructor(httpService) {
2573
- this.httpService = httpService;
2574
- this.SERVICE_URL = '/configuration/states';
2575
- }
2576
- /**
2577
- * Initialize configuration state
2578
- * @param request Request
2579
- * @returns ID of new configuration state
2580
- */
2581
- init(request) {
2582
- return this.httpService.api({
2583
- method: 'post',
2584
- url: `${this.SERVICE_URL}/init`,
2585
- body: request,
2586
- responseType: 'text',
2587
- });
2588
- }
2589
- /**
2590
- * Get existing state by ID
2591
- * @param id ID
2592
- * @returns Configuration State
2593
- */
2594
- get(id) {
2595
- return this.httpService.api({
2596
- url: `${this.SERVICE_URL}/${id}`,
2597
- });
2598
- }
2599
- /**
2600
- * Execute actions/selectors
2601
- * @param id State ID
2602
- * @param request Request
2603
- * @returns Execute result
2604
- */
2605
- execute(id, request) {
2606
- return this.httpService.api({
457
+ createNewPortal$(body) {
458
+ return this.baseHttpService.api({
459
+ url: `${this.serviceUrl}`,
2607
460
  method: 'post',
2608
- url: `${this.SERVICE_URL}/${id}/execute`,
2609
- body: request,
461
+ body,
2610
462
  });
2611
463
  }
2612
- }
2613
- StatefulConfigurationApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2614
- StatefulConfigurationApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService });
2615
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService, decorators: [{
2616
- type: Injectable
2617
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2618
-
2619
- class UIDefinitionsApiService {
2620
- constructor(baseHttpService) {
2621
- this.baseHttpService = baseHttpService;
2622
- }
2623
- fetch$(modelId, version) {
2624
- const serviceUrl = this.getServiceUrl(modelId);
2625
- let params = new HttpParams();
2626
- if (version != null) {
2627
- params = params.set('modelVersion', version);
2628
- }
2629
- return this.baseHttpService
2630
- .api({
2631
- method: 'get',
2632
- url: serviceUrl,
2633
- params: params,
2634
- })
2635
- .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2636
- }
2637
- create$(modelId, uiDefinitionContainer) {
2638
- const serviceUrl = this.getServiceUrl(modelId);
2639
- const dto = Object.assign(Object.assign({}, omit(uiDefinitionContainer, 'source')), { sourceBlob: JSON.stringify(uiDefinitionContainer.source) });
2640
- return this.baseHttpService
2641
- .api({
2642
- method: 'post',
2643
- url: serviceUrl,
2644
- body: dto,
2645
- })
2646
- .pipe(map$1(container => uiDefinitionFromDTO(container)));
2647
- }
2648
- get$(modelId, uiDefinitionId) {
2649
- const serviceUrl = this.getServiceUrl(modelId);
2650
- return this.baseHttpService
2651
- .api({
2652
- method: 'get',
2653
- url: `${serviceUrl}/${uiDefinitionId}`,
2654
- })
2655
- .pipe(map$1(container => uiDefinitionFromDTO(Object.assign(Object.assign({}, container), { id: uiDefinitionId }))));
2656
- }
2657
- update$(uiDefinitionContainer) {
2658
- const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2659
- const dto = uiDefinitionToDTO(uiDefinitionContainer);
2660
- return this.baseHttpService
2661
- .api({
2662
- method: 'put',
2663
- url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2664
- body: dto,
2665
- })
2666
- .pipe(map$1(container => uiDefinitionFromDTO(container)));
2667
- }
2668
- delete$(uiDefinitionContainer) {
2669
- const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
464
+ updatePortal$(portal, settings) {
2670
465
  return this.baseHttpService.api({
2671
- method: 'delete',
2672
- url: `${serviceUrl}/${uiDefinitionContainer.id}`,
466
+ url: `${this.serviceUrl}/${portal.id}`,
467
+ method: 'put',
468
+ body: Object.assign(Object.assign({}, portal), { settings: JSON.stringify(settings) }),
2673
469
  });
2674
470
  }
2675
- getServiceUrl(modelId) {
2676
- return `/models/${modelId}/uidefinitions`;
2677
- }
2678
471
  }
2679
- UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2680
- UIDefinitionsApiServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });
2681
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, decorators: [{
472
+ PortalsApiService.MAX_RESULTS = 60;
473
+ PortalsApiServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
474
+ PortalsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService });
475
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PortalsApiService, decorators: [{
2682
476
  type: Injectable
2683
477
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2684
478
 
2685
- const fromUIComponentStoryDTO = (dto, attachments) => {
2686
- return {
2687
- id: dto.id,
2688
- name: dto.name,
2689
- uiComponentId: dto.uiComponentId,
2690
- description: dto.description,
2691
- section: attachments.json,
2692
- template: attachments.html,
2693
- script: attachments.js,
2694
- styles: attachments.css,
2695
- };
2696
- };
2697
-
2698
- class UITemplatesApiService {
479
+ class PromotionsApiService {
2699
480
  constructor(baseHttpService) {
2700
481
  this.baseHttpService = baseHttpService;
2701
- this.serviceUrl = '/uitemplates';
2702
- this.fetchTemplates$ = (name) => {
2703
- let params = new HttpParams();
2704
- if (name) {
2705
- params = params.append('name', name);
2706
- }
2707
- return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
2708
- };
2709
- this.createTemplate$ = (template) => {
2710
- return this.baseHttpService.api({
2711
- method: 'post',
2712
- url: `${this.serviceUrl}`,
2713
- body: template,
2714
- });
2715
- };
2716
- this.updateTemplate$ = (template) => {
2717
- return this.baseHttpService.api({
2718
- method: 'put',
2719
- url: `${this.serviceUrl}/${template.id}`,
2720
- body: template,
2721
- });
2722
- };
2723
- this.duplicateTemplate$ = (template, cloneRequest) => {
2724
- return this.baseHttpService
2725
- .api({
2726
- url: `${this.serviceUrl}/${template.id}/clone`,
2727
- method: 'post',
2728
- body: cloneRequest,
2729
- })
2730
- .pipe(map$1(response => response.clonedRecordId));
482
+ this.serviceUrl = '/admin/promotion';
483
+ this.fetchAll$ = () => {
484
+ return this.baseHttpService.api({ url: this.serviceUrl });
2731
485
  };
2732
- this.removeTemplate$ = (id) => {
2733
- return this.baseHttpService.api({
2734
- method: 'delete',
2735
- url: `${this.serviceUrl}/${id}`,
2736
- });
486
+ this.fetchOne$ = (id) => {
487
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2737
488
  };
2738
- this.restoreTemplate$ = (id) => {
489
+ this.remove$ = (id) => {
2739
490
  return this.baseHttpService.api({
2740
- method: 'patch',
2741
491
  url: `${this.serviceUrl}/${id}`,
2742
- });
2743
- };
2744
- this.searchTemplates$ = (data) => {
2745
- return this.baseHttpService.api({
2746
- method: 'post',
2747
- url: `${this.serviceUrl}/search`,
2748
- params: data.params,
2749
- body: data.expression,
2750
- });
2751
- };
2752
- this.fetchComponents$ = (templateId, name) => {
2753
- let params = new HttpParams();
2754
- if (name) {
2755
- params = params.append('name', name);
2756
- }
2757
- return this.baseHttpService.api({
2758
- url: `${this.serviceUrl}/${templateId}/components`,
2759
- params,
2760
- });
2761
- };
2762
- this.fetchComponent$ = (templateId, componentId) => {
2763
- return this.baseHttpService.api({
2764
- url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
2765
- });
2766
- };
2767
- this.createComponent$ = (component) => {
2768
- return this.baseHttpService.api({
2769
- method: 'post',
2770
- url: `${this.serviceUrl}/${component.uiTemplateId}/components`,
2771
- body: component,
2772
- });
2773
- };
2774
- this.updateComponent$ = (component) => {
2775
- return this.baseHttpService.api({
2776
- method: 'put',
2777
- url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}`,
2778
- body: component,
2779
- });
2780
- };
2781
- this.duplicateComponent$ = (component, cloneRequest) => {
2782
- return this.baseHttpService
2783
- .api({
2784
- url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}/clone`,
2785
- method: 'post',
2786
- body: cloneRequest,
2787
- })
2788
- .pipe(map$1(response => response.clonedRecordId));
2789
- };
2790
- this.removeComponent$ = (templateId, componentId) => {
2791
- return this.baseHttpService.api({
2792
492
  method: 'delete',
2793
- url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
2794
493
  });
2795
494
  };
2796
- this.restoreComponent$ = (templateId, componentId) => {
495
+ this.restore$ = (id) => {
2797
496
  return this.baseHttpService.api({
2798
497
  method: 'patch',
2799
- url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
2800
- });
2801
- };
2802
- this.searchComponents$ = (templateId, data) => {
2803
- return this.baseHttpService.api({
2804
- method: 'post',
2805
- url: `${this.serviceUrl}/${templateId}/components/search`,
2806
- params: data.params,
2807
- body: data.expression,
498
+ url: `${this.serviceUrl}/${id}/restore`,
2808
499
  });
2809
500
  };
2810
- this.fetchStoryAttachment = (templateId, componentId, storyId, type) => {
2811
- return this.baseHttpService
2812
- .api({
2813
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments/${type}/file`,
2814
- responseType: 'text',
2815
- errorHandler: noop,
2816
- })
2817
- .pipe(catchError$1(() => of('')));
2818
- };
2819
- this.convertToComponentStory$ = (templateId, componentId, storyDto) => {
2820
- return forkJoin([
2821
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'html'),
2822
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'js'),
2823
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'css'),
2824
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'json'),
2825
- ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })), map$1(attachments => fromUIComponentStoryDTO(storyDto, attachments)));
2826
- };
2827
- this.fetchStories$ = (templateId, componentId, name) => {
2828
- let params = new HttpParams();
2829
- if (name) {
2830
- params = params.append('name', name);
2831
- }
2832
- return this.baseHttpService
2833
- .api({
2834
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
2835
- params,
2836
- })
2837
- .pipe(switchMap(dtos => {
2838
- if (!dtos.length) {
2839
- return of([]);
2840
- }
2841
- return forkJoin(dtos.map(dto => this.convertToComponentStory$(templateId, componentId, dto)));
2842
- }));
2843
- };
2844
- this.fetchStory$ = (templateId, componentId, storyId) => {
501
+ this.duplicate$ = (body) => {
2845
502
  return this.baseHttpService
2846
503
  .api({
2847
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
2848
- })
2849
- .pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
2850
- };
2851
- this.createComponentStory$ = (templateId, story) => {
2852
- return this.baseHttpService.api({
504
+ url: `${this.serviceUrl}/${body.id}/clone`,
2853
505
  method: 'post',
2854
- url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories`,
2855
- body: story,
2856
- });
2857
- };
2858
- this.updateComponentStory$ = (templateId, story) => {
2859
- const { script, template, styles, section } = story, rest = __rest(story, ["script", "template", "styles", "section"]);
2860
- return this.baseHttpService
2861
- .api({
2862
- method: 'put',
2863
- url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories/${story.id}`,
2864
- body: rest,
506
+ body,
2865
507
  })
2866
- .pipe(map$1(dto => fromUIComponentStoryDTO(dto, { html: template, js: script, css: styles, json: section })));
508
+ .pipe(map(response => response.clonedRecordId));
509
+ };
510
+ }
511
+ search$(expression, skip, count) {
512
+ let params = new HttpParams();
513
+ if (typeof skip === 'number') {
514
+ params = params.set('skip', '' + skip);
515
+ }
516
+ if (typeof count === 'number') {
517
+ params = params.set('count', '' + count);
518
+ }
519
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
520
+ }
521
+ create$(body) {
522
+ return this.baseHttpService.api({
523
+ url: `${this.serviceUrl}`,
524
+ method: 'post',
525
+ body,
526
+ });
527
+ }
528
+ update$(body) {
529
+ return this.baseHttpService.api({
530
+ url: `${this.serviceUrl}/${body.id}`,
531
+ method: 'put',
532
+ body,
533
+ });
534
+ }
535
+ }
536
+ PromotionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
537
+ PromotionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService });
538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, decorators: [{
539
+ type: Injectable
540
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
541
+
542
+ class RebateProgramApiService {
543
+ constructor(baseHttpService) {
544
+ this.baseHttpService = baseHttpService;
545
+ this.serviceUrl = '/admin/rebate-program';
546
+ this.fetchAll$ = () => {
547
+ return this.baseHttpService.api({ url: this.serviceUrl });
2867
548
  };
2868
- this.duplicateComponentStory$ = (story, cloneRequest) => {
2869
- return this.baseHttpService
2870
- .api({
2871
- url: `${this.serviceUrl}/${story.template}/components/${story.uiComponentId}/stories/${story.id}/clone`,
2872
- method: 'post',
2873
- body: cloneRequest,
2874
- })
2875
- .pipe(map$1(response => response.clonedRecordId));
549
+ this.fetchOne$ = (id) => {
550
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2876
551
  };
2877
- this.deleteComponentStory$ = (templateId, componentId, storyId) => {
552
+ this.remove$ = (id) => {
2878
553
  return this.baseHttpService.api({
554
+ url: `${this.serviceUrl}/${id}`,
2879
555
  method: 'delete',
2880
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
2881
556
  });
2882
557
  };
2883
- this.restoreComponentStory$ = (templateId, componentId, storyId) => {
558
+ this.restore$ = (id) => {
2884
559
  return this.baseHttpService.api({
2885
560
  method: 'patch',
2886
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
2887
- });
2888
- };
2889
- this.uploadStoryAttachments$ = (templateId, componentId, storyId, attachments) => {
2890
- const formData = new FormData();
2891
- if (attachments.html != null) {
2892
- formData.append('html', new Blob([attachments.html]), 'story-template.html');
2893
- }
2894
- if (attachments.css != null) {
2895
- formData.append('css', new Blob([attachments.css]), 'story-styles.css');
2896
- }
2897
- if (attachments.js != null) {
2898
- formData.append('js', new Blob([attachments.js]), 'story-script.js');
2899
- }
2900
- if (attachments.json != null) {
2901
- formData.append('json', new Blob([attachments.json]), 'story-section.json');
2902
- }
2903
- return this.baseHttpService.upload({
2904
- method: 'post',
2905
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments`,
2906
- body: formData,
561
+ url: `${this.serviceUrl}/${id}/restore`,
2907
562
  });
2908
563
  };
2909
- this.fetchComponentAttachments$ = (templateId, component) => {
2910
- return forkJoin([
2911
- this.fetchComponentAttachmentFile$(templateId, component.id, 'html'),
2912
- this.fetchComponentAttachmentFile$(templateId, component.id, 'js'),
2913
- this.fetchComponentAttachmentFile$(templateId, component.id, 'css'),
2914
- this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
2915
- ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
2916
- };
2917
- this.fetchComponentsAttachments$ = (templateId) => {
2918
- return this.fetchComponents$(templateId).pipe(switchMap(components => {
2919
- return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
2920
- }));
2921
- };
2922
- this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
564
+ this.duplicate$ = (body) => {
2923
565
  return this.baseHttpService
2924
566
  .api({
2925
- method: 'get',
2926
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments/${attachmentType}/file`,
2927
- responseType: 'text',
2928
- errorHandler: noop,
2929
- })
2930
- .pipe(catchError$1(() => of('')));
2931
- };
2932
- this.uploadComponentAttachments$ = (templateId, componentId, attachments) => {
2933
- const formData = new FormData();
2934
- if (attachments.html != null) {
2935
- formData.append('html', new Blob([attachments.html]), 'template.html');
2936
- }
2937
- if (attachments.css != null) {
2938
- formData.append('css', new Blob([attachments.css]), 'styles.css');
2939
- }
2940
- if (attachments.js != null) {
2941
- formData.append('js', new Blob([attachments.js]), 'script.js');
2942
- }
2943
- if (attachments.json != null) {
2944
- formData.append('json', new Blob([attachments.json]), 'section.json');
2945
- }
2946
- return this.baseHttpService.upload({
567
+ url: `${this.serviceUrl}/${body.id}/clone`,
2947
568
  method: 'post',
2948
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments`,
2949
- body: formData,
2950
- });
569
+ body,
570
+ })
571
+ .pipe(map(response => response.clonedRecordId));
2951
572
  };
2952
573
  }
2953
- getTemplateThumbnailUrl(templateId) {
2954
- return `${this.serviceUrl}/${templateId}/thumbnail/file`;
574
+ search$(expression, skip, count) {
575
+ let params = new HttpParams();
576
+ if (typeof skip === 'number') {
577
+ params = params.set('skip', '' + skip);
578
+ }
579
+ if (typeof count === 'number') {
580
+ params = params.set('count', '' + count);
581
+ }
582
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2955
583
  }
2956
- attachTemplateThumbnail$(templateId, file) {
2957
- const data = new FormData();
2958
- data.append('thumb', file);
2959
- return this.baseHttpService.upload({
584
+ create$(body) {
585
+ return this.baseHttpService.api({
586
+ url: `${this.serviceUrl}`,
2960
587
  method: 'post',
2961
- url: `${this.serviceUrl}/${templateId}/thumbnail`,
2962
- body: data,
588
+ body,
2963
589
  });
2964
590
  }
2965
- removeTemplateThumbnail$(templateId) {
591
+ update$(body) {
2966
592
  return this.baseHttpService.api({
2967
- method: 'delete',
2968
- url: `${this.serviceUrl}/${templateId}/thumbnail`,
593
+ url: `${this.serviceUrl}/${body.id}`,
594
+ method: 'put',
595
+ body,
2969
596
  });
2970
597
  }
2971
598
  }
2972
- UITemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2973
- UITemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService });
2974
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService, decorators: [{
599
+ RebateProgramApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
600
+ RebateProgramApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService });
601
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, decorators: [{
2975
602
  type: Injectable
2976
603
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2977
604
 
2978
- class VeloceObjectsApiService {
605
+ class RebateTypeApiService {
2979
606
  constructor(baseHttpService) {
2980
607
  this.baseHttpService = baseHttpService;
2981
- this.serviceUrl = '/veloceobjects';
2982
- this.updateCategory$ = (category) => {
2983
- return this.baseHttpService.api({
2984
- method: 'put',
2985
- url: `${this.serviceUrl}/categories/${category.id}`,
2986
- body: category,
2987
- });
608
+ this.serviceUrl = '/admin/rebate-type';
609
+ this.fetchAll$ = () => {
610
+ return this.baseHttpService.api({ url: this.serviceUrl });
2988
611
  };
2989
- this.deleteCategory$ = (id) => {
2990
- return this.baseHttpService.api({
2991
- method: 'delete',
2992
- url: `${this.serviceUrl}/categories/${id}`,
2993
- });
612
+ this.fetchOne$ = (id) => {
613
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2994
614
  };
2995
- this.searchObjects$ = (searchParams, expression) => {
2996
- const params = new HttpParams({ fromObject: Object.assign({}, searchParams) });
615
+ this.remove$ = (id) => {
2997
616
  return this.baseHttpService.api({
2998
- method: 'post',
2999
- url: `${this.serviceUrl}/search`,
3000
- params,
3001
- body: expression || {},
617
+ url: `${this.serviceUrl}/${id}`,
618
+ method: 'delete',
3002
619
  });
3003
620
  };
3004
- this.deleteObject$ = (id) => {
621
+ this.restore$ = (id) => {
3005
622
  return this.baseHttpService.api({
3006
- method: 'delete',
3007
- url: `${this.serviceUrl}/${id}`,
623
+ method: 'patch',
624
+ url: `${this.serviceUrl}/${id}/restore`,
3008
625
  });
3009
626
  };
3010
- this.duplicateObject$ = (body) => {
627
+ this.duplicate$ = (body) => {
3011
628
  return this.baseHttpService
3012
629
  .api({
3013
- method: 'post',
3014
630
  url: `${this.serviceUrl}/${body.id}/clone`,
631
+ method: 'post',
3015
632
  body,
3016
633
  })
3017
634
  .pipe(map(response => response.clonedRecordId));
3018
635
  };
3019
- this.restoreObject$ = (id) => {
3020
- return this.baseHttpService.api({
3021
- method: 'patch',
3022
- url: `${this.serviceUrl}/${id}/restore`,
3023
- });
3024
- };
3025
636
  }
3026
- fetchCategories$() {
3027
- return this.baseHttpService.api({ url: `${this.serviceUrl}/categories` });
637
+ search$(expression, skip, count) {
638
+ let params = new HttpParams();
639
+ if (typeof skip === 'number') {
640
+ params = params.set('skip', '' + skip);
641
+ }
642
+ if (typeof count === 'number') {
643
+ params = params.set('count', '' + count);
644
+ }
645
+ return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
3028
646
  }
3029
- createCategory$(category) {
647
+ create$(body) {
3030
648
  return this.baseHttpService.api({
649
+ url: `${this.serviceUrl}`,
3031
650
  method: 'post',
3032
- url: `${this.serviceUrl}/categories`,
3033
- body: category,
651
+ body,
652
+ });
653
+ }
654
+ update$(body) {
655
+ return this.baseHttpService.api({
656
+ url: `${this.serviceUrl}/${body.id}`,
657
+ method: 'put',
658
+ body,
3034
659
  });
3035
660
  }
3036
- fetchObjects$() {
3037
- return this.baseHttpService.api({ url: `${this.serviceUrl}` });
661
+ }
662
+ RebateTypeApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
663
+ RebateTypeApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService });
664
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, decorators: [{
665
+ type: Injectable
666
+ }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
667
+
668
+ class SandboxManagerApiService {
669
+ constructor(messageService) {
670
+ this.messageService = messageService;
671
+ /**
672
+ * Shows an error message using the message service.
673
+ *
674
+ * @param {string} message - the error message to be published.
675
+ */
676
+ this.publishErrorMessage = (message) => {
677
+ this.messageService.add({ severity: 'error', summary: message, sticky: true });
678
+ };
679
+ }
680
+ getSalesforceOrganizations$() {
681
+ try {
682
+ return window.doSandboxCall
683
+ ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError(() => of([])))
684
+ : of([]);
685
+ }
686
+ catch (_a) {
687
+ return of([]);
688
+ }
689
+ }
690
+ getAvailableSalesforceOrganizationSizes$() {
691
+ try {
692
+ return window.doSandboxCall
693
+ ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError(() => of({})))
694
+ : of({});
695
+ }
696
+ catch (_a) {
697
+ return of({});
698
+ }
699
+ }
700
+ createSalesforceOrganization$(payload) {
701
+ try {
702
+ return window.doSandboxCall
703
+ ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
704
+ : of(undefined);
705
+ }
706
+ catch (err) {
707
+ return of(undefined);
708
+ }
709
+ }
710
+ updateSalesforceOrganization$(payload) {
711
+ try {
712
+ return window.doSandboxCall
713
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
714
+ : of(undefined);
715
+ }
716
+ catch (_a) {
717
+ return of(undefined);
718
+ }
3038
719
  }
3039
- fetchObject$(id) {
3040
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
720
+ deleteSalesforceOrganization$(payload) {
721
+ try {
722
+ return window.doSandboxCall
723
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}`, '', 'DELETE')).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
724
+ : of(undefined);
725
+ }
726
+ catch (_a) {
727
+ return of(undefined);
728
+ }
3041
729
  }
3042
- createObject$(object) {
3043
- return this.baseHttpService.api({
730
+ activateSalesforceOrganization$(payload) {
731
+ try {
732
+ return window.doSandboxCall
733
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/activate`, JSON.stringify({}), 'POST')).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
734
+ : of(undefined);
735
+ }
736
+ catch (_a) {
737
+ return of(undefined);
738
+ }
739
+ }
740
+ deactivateSalesforceOrganization$(payload) {
741
+ try {
742
+ return window.doSandboxCall
743
+ ? from(window.doSandboxCall(`orgs/${payload.orgId}/deactivate`, JSON.stringify({}), 'POST')).pipe(map(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError(() => of(undefined)))
744
+ : of(undefined);
745
+ }
746
+ catch (_a) {
747
+ return of(undefined);
748
+ }
749
+ }
750
+ }
751
+ SandboxManagerApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, deps: [{ token: i1$2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
752
+ SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
753
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService, decorators: [{
754
+ type: Injectable
755
+ }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
756
+
757
+ class StatefulConfigurationApiService {
758
+ constructor(httpService) {
759
+ this.httpService = httpService;
760
+ this.SERVICE_URL = '/configuration/states';
761
+ }
762
+ /**
763
+ * Initialize configuration state
764
+ * @param request Request
765
+ * @returns ID of new configuration state
766
+ */
767
+ init(request) {
768
+ return this.httpService.api({
3044
769
  method: 'post',
3045
- url: `${this.serviceUrl}`,
3046
- body: object,
770
+ url: `${this.SERVICE_URL}/init`,
771
+ body: request,
772
+ responseType: 'text',
3047
773
  });
3048
774
  }
3049
- updateObject$(object) {
3050
- return this.baseHttpService.api({
3051
- method: 'put',
3052
- url: `${this.serviceUrl}/${object.id}`,
3053
- body: object,
775
+ /**
776
+ * Get existing state by ID
777
+ * @param id ID
778
+ * @returns Configuration State
779
+ */
780
+ get(id) {
781
+ return this.httpService.api({
782
+ url: `${this.SERVICE_URL}/${id}`,
783
+ });
784
+ }
785
+ /**
786
+ * Execute actions/selectors
787
+ * @param id State ID
788
+ * @param request Request
789
+ * @returns Execute result
790
+ */
791
+ execute(id, request) {
792
+ return this.httpService.api({
793
+ method: 'post',
794
+ url: `${this.SERVICE_URL}/${id}/execute`,
795
+ body: request,
3054
796
  });
3055
797
  }
3056
798
  }
3057
- VeloceObjectsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceObjectsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3058
- VeloceObjectsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceObjectsApiService });
3059
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceObjectsApiService, decorators: [{
799
+ StatefulConfigurationApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
800
+ StatefulConfigurationApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService });
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService, decorators: [{
3060
802
  type: Injectable
3061
803
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3062
804
 
3063
805
  class ApiModule {
3064
806
  }
3065
807
  ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3066
- ApiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, imports: [HttpClientModule] });
808
+ ApiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, imports: [HttpClientModule, ApiV2Module] });
3067
809
  ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, providers: [
3068
810
  BaseHttpService,
3069
811
  XrayService,
3070
- ConfigurationApiService,
3071
- ConfigurationSettingsApiService,
3072
- ContextApiService,
3073
- DocumentAttachmentApiService,
3074
- PriceApiService,
3075
- ProductModelApiService,
3076
- ProceduresApiService,
3077
- QuoteApiService,
3078
- RampApiService,
3079
- SalesforceApiService,
3080
- UITemplatesApiService,
3081
- ScriptsApiService,
3082
- RulesApiService,
3083
- RuleGroupsApiService,
3084
- FlowsApiService,
3085
- GuidedSellingsAdminApiService,
3086
- ShoppingCartSettingsApiService,
3087
- ProductApiService,
3088
- CatalogAdminApiService,
3089
- GuidedSellingApiService,
3090
- CatalogApiService,
3091
- DeltaApiService,
3092
812
  AccountApiService,
3093
- PicklistsApiService,
3094
- EndpointsApiService,
3095
813
  OrgInfoApiService,
3096
814
  OffersApiService,
3097
- UIDefinitionsApiService,
3098
- VeloceObjectsApiService,
3099
815
  StatefulConfigurationApiService,
3100
816
  RebateProgramApiService,
3101
817
  RebateTypeApiService,
@@ -3103,48 +819,19 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
3103
819
  VeloceAuthService,
3104
820
  ContractedPriceApiService,
3105
821
  PortalsApiService,
3106
- ConfigurationProcessorsApiService,
3107
822
  FlowStateApiService,
3108
823
  SandboxManagerApiService,
3109
- RlmApiService,
3110
- RlmQuoteApiService,
3111
- ], imports: [HttpClientModule] });
824
+ ], imports: [HttpClientModule, ApiV2Module] });
3112
825
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, decorators: [{
3113
826
  type: NgModule,
3114
827
  args: [{
3115
- imports: [HttpClientModule],
828
+ imports: [HttpClientModule, ApiV2Module],
3116
829
  providers: [
3117
830
  BaseHttpService,
3118
831
  XrayService,
3119
- ConfigurationApiService,
3120
- ConfigurationSettingsApiService,
3121
- ContextApiService,
3122
- DocumentAttachmentApiService,
3123
- PriceApiService,
3124
- ProductModelApiService,
3125
- ProceduresApiService,
3126
- QuoteApiService,
3127
- RampApiService,
3128
- SalesforceApiService,
3129
- UITemplatesApiService,
3130
- ScriptsApiService,
3131
- RulesApiService,
3132
- RuleGroupsApiService,
3133
- FlowsApiService,
3134
- GuidedSellingsAdminApiService,
3135
- ShoppingCartSettingsApiService,
3136
- ProductApiService,
3137
- CatalogAdminApiService,
3138
- GuidedSellingApiService,
3139
- CatalogApiService,
3140
- DeltaApiService,
3141
832
  AccountApiService,
3142
- PicklistsApiService,
3143
- EndpointsApiService,
3144
833
  OrgInfoApiService,
3145
834
  OffersApiService,
3146
- UIDefinitionsApiService,
3147
- VeloceObjectsApiService,
3148
835
  StatefulConfigurationApiService,
3149
836
  RebateProgramApiService,
3150
837
  RebateTypeApiService,
@@ -3152,11 +839,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3152
839
  VeloceAuthService,
3153
840
  ContractedPriceApiService,
3154
841
  PortalsApiService,
3155
- ConfigurationProcessorsApiService,
3156
842
  FlowStateApiService,
3157
843
  SandboxManagerApiService,
3158
- RlmApiService,
3159
- RlmQuoteApiService,
3160
844
  ],
3161
845
  }]
3162
846
  }] });
@@ -3165,5 +849,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3165
849
  * Generated bundle index. Do not edit.
3166
850
  */
3167
851
 
3168
- export { AccountApiService, ApiModule, CatalogAdminApiService, CatalogApiService, ConfigurationApiService, ConfigurationProcessorsApiService, ConfigurationSettingsApiService, ContextApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService, EndpointsApiService, FlowStateApiService, FlowsApiService, GuidedSellingApiService, GuidedSellingsAdminApiService, OffersApiService, OrgInfoApiService, PicklistsApiService, PortalsApiService, PriceApiService, ProceduresApiService, ProductApiService, ProductModelApiService, PromotionsApiService, QuoteApiService, RampApiService, RebateProgramApiService, RebateTypeApiService, RlmApiService, RlmQuoteApiService, RuleGroupsApiService, RulesApiService, SalesforceApiService, SandboxManagerApiService, ScriptsApiService, ShoppingCartSettingsApiService, StatefulConfigurationApiService, UIDefinitionsApiService, UITemplatesApiService, VeloceAuthService, VeloceObjectsApiService, fromUIComponentStoryDTO, handleCanvasResponse };
852
+ export { AccountApiService, ApiModule, ContractedPriceApiService, FlowStateApiService, OffersApiService, OrgInfoApiService, PortalsApiService, PromotionsApiService, RebateProgramApiService, RebateTypeApiService, SandboxManagerApiService, StatefulConfigurationApiService, VeloceAuthService, handleCanvasResponse };
3169
853
  //# sourceMappingURL=veloceapps-api.mjs.map