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