@veloceapps/api 11.0.0-4 → 11.0.0-41

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 (217) 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 +74 -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 +67 -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/function-groups-admin-api.service.mjs +62 -0
  38. package/esm2020/v2/services/functions-admin-api.service.mjs +97 -0
  39. package/esm2020/v2/services/guided-sellings-admin-api.service.mjs +65 -0
  40. package/esm2020/v2/services/guided-sellings-api.service.mjs +37 -0
  41. package/esm2020/v2/services/index.mjs +26 -0
  42. package/esm2020/v2/services/orchestrations-admin-api.service.mjs +87 -0
  43. package/esm2020/v2/services/orchestrations-api.service.mjs +23 -0
  44. package/esm2020/v2/services/pcm-api.service.mjs +29 -0
  45. package/esm2020/v2/services/picklists-admin-api.service.mjs +41 -0
  46. package/esm2020/v2/services/products-admin-api.service.mjs +90 -0
  47. package/esm2020/v2/services/sales-transactions-api.service.mjs +52 -0
  48. package/esm2020/v2/services/salesforce-api.service.mjs +83 -0
  49. package/esm2020/v2/services/scripts-admin-api.service.mjs +83 -0
  50. package/esm2020/v2/services/shopping-cart-settings-api.service.mjs +28 -0
  51. package/esm2020/v2/services/ui-definitions-admin-api.service.mjs +68 -0
  52. package/esm2020/v2/services/ui-templates-admin-api.service.mjs +286 -0
  53. package/esm2020/v2/services/veloce-objects-api.service.mjs +90 -0
  54. package/esm2020/v2/types/attachment.types.mjs +2 -0
  55. package/esm2020/v2/types/clone-request.types.mjs +2 -0
  56. package/esm2020/v2/types/dto/configuration-settings-dto.types.mjs +22 -0
  57. package/esm2020/v2/types/dto/ui-definition-dto.types.mjs +2 -0
  58. package/esm2020/v2/types/dto/ui-template-dto.types.mjs +2 -0
  59. package/esm2020/v2/types/index.mjs +6 -0
  60. package/esm2020/v2/types/pcm.types.mjs +2 -0
  61. package/esm2020/v2/types/procedure.types.mjs +2 -0
  62. package/esm2020/v2/types/sales-transaction.types.mjs +2 -0
  63. package/esm2020/v2/types/search-request.types.mjs +2 -0
  64. package/esm2020/v2/utils/ui-definition.utils.mjs +23 -0
  65. package/esm2020/v2/utils/ui-template.utils.mjs +13 -0
  66. package/esm2020/v2/veloceapps-api-v2.mjs +5 -0
  67. package/esm2020/veloceapps-api.mjs +1 -1
  68. package/fesm2015/veloceapps-api-v2.mjs +1843 -0
  69. package/fesm2015/veloceapps-api-v2.mjs.map +1 -0
  70. package/fesm2015/veloceapps-api.mjs +497 -2781
  71. package/fesm2015/veloceapps-api.mjs.map +1 -1
  72. package/fesm2020/veloceapps-api-v2.mjs +1915 -0
  73. package/fesm2020/veloceapps-api-v2.mjs.map +1 -0
  74. package/fesm2020/veloceapps-api.mjs +512 -2894
  75. package/fesm2020/veloceapps-api.mjs.map +1 -1
  76. package/index.d.ts +1 -44
  77. package/package.json +9 -1
  78. package/src/index.d.ts +15 -0
  79. package/{lib → src/lib}/api.module.d.ts +2 -1
  80. package/{lib → src/lib}/types/index.d.ts +0 -2
  81. package/{lib → src/lib}/types/stateful-configuration.types.d.ts +1 -2
  82. package/src/lib/utils/index.d.ts +1 -0
  83. package/v2/api-v2.module.d.ts +7 -0
  84. package/v2/index.d.ts +3 -0
  85. package/v2/services/cache-api.service.d.ts +11 -0
  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} +3 -3
  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/function-groups-admin-api.service.d.ts +18 -0
  92. package/v2/services/functions-admin-api.service.d.ts +22 -0
  93. package/v2/services/index.d.ts +25 -0
  94. package/v2/services/orchestrations-admin-api.service.d.ts +21 -0
  95. package/v2/services/orchestrations-api.service.d.ts +12 -0
  96. package/v2/services/pcm-api.service.d.ts +11 -0
  97. package/{lib/services/picklists-api.service.d.ts → v2/services/picklists-admin-api.service.d.ts} +3 -3
  98. package/v2/services/products-admin-api.service.d.ts +21 -0
  99. package/v2/services/sales-transactions-api.service.d.ts +20 -0
  100. package/{lib → v2}/services/salesforce-api.service.d.ts +1 -0
  101. package/{lib/services/scripts-api.service.d.ts → v2/services/scripts-admin-api.service.d.ts} +3 -3
  102. package/v2/services/ui-definitions-admin-api.service.d.ts +18 -0
  103. package/{lib/services/ui-templates-api.service.d.ts → v2/services/ui-templates-admin-api.service.d.ts} +3 -3
  104. package/{lib → v2}/services/veloce-objects-api.service.d.ts +3 -3
  105. package/v2/types/clone-request.types.d.ts +5 -0
  106. package/v2/types/dto/ui-definition-dto.types.d.ts +7 -0
  107. package/v2/types/index.d.ts +5 -0
  108. package/v2/types/pcm.types.d.ts +10 -0
  109. package/v2/types/procedure.types.d.ts +10 -0
  110. package/v2/types/sales-transaction.types.d.ts +14 -0
  111. package/v2/types/search-request.types.d.ts +8 -0
  112. package/v2/utils/ui-definition.utils.d.ts +5 -0
  113. package/esm2020/lib/api.module.mjs +0 -146
  114. package/esm2020/lib/services/account-api.service.mjs +0 -87
  115. package/esm2020/lib/services/auth.service.mjs +0 -22
  116. package/esm2020/lib/services/catalog-admin-api.service.mjs +0 -192
  117. package/esm2020/lib/services/catalog-api.service.mjs +0 -90
  118. package/esm2020/lib/services/configuration-api.service.mjs +0 -109
  119. package/esm2020/lib/services/configuration-processors-api.service.mjs +0 -38
  120. package/esm2020/lib/services/configuration-settings-api.service.mjs +0 -96
  121. package/esm2020/lib/services/context-api.service.mjs +0 -26
  122. package/esm2020/lib/services/contracted-price-api.service.mjs +0 -45
  123. package/esm2020/lib/services/delta-api.service.mjs +0 -23
  124. package/esm2020/lib/services/document-attachment-api.service.mjs +0 -66
  125. package/esm2020/lib/services/endpoints-api.service.mjs +0 -80
  126. package/esm2020/lib/services/flow-state-api.mjs +0 -142
  127. package/esm2020/lib/services/flows-api.service.mjs +0 -29
  128. package/esm2020/lib/services/guided-sellings-admin-api.service.mjs +0 -65
  129. package/esm2020/lib/services/guided-sellings-api.service.mjs +0 -37
  130. package/esm2020/lib/services/offers-api.service.mjs +0 -76
  131. package/esm2020/lib/services/org-info-api.service.mjs +0 -54
  132. package/esm2020/lib/services/picklists-api.service.mjs +0 -41
  133. package/esm2020/lib/services/portals-api.service.mjs +0 -76
  134. package/esm2020/lib/services/price-api.service.mjs +0 -63
  135. package/esm2020/lib/services/procedures-api.service.mjs +0 -113
  136. package/esm2020/lib/services/product-api.service.mjs +0 -153
  137. package/esm2020/lib/services/product-model-api.service.mjs +0 -223
  138. package/esm2020/lib/services/promotions-api.service.mjs +0 -68
  139. package/esm2020/lib/services/quote-api.service.mjs +0 -56
  140. package/esm2020/lib/services/ramp-api.service.mjs +0 -31
  141. package/esm2020/lib/services/rebate-program-api.service.mjs +0 -68
  142. package/esm2020/lib/services/rebate-type-api.service.mjs +0 -68
  143. package/esm2020/lib/services/rlm-api.service.mjs +0 -64
  144. package/esm2020/lib/services/rlm-quote-api.service.mjs +0 -27
  145. package/esm2020/lib/services/rule-groups-api.service.mjs +0 -62
  146. package/esm2020/lib/services/rules-api.service.mjs +0 -98
  147. package/esm2020/lib/services/salesforce-api.service.mjs +0 -79
  148. package/esm2020/lib/services/sandbox-manager-api.service.mjs +0 -94
  149. package/esm2020/lib/services/scripts-api.service.mjs +0 -83
  150. package/esm2020/lib/services/shopping-cart-settings-api.service.mjs +0 -28
  151. package/esm2020/lib/services/stateful-configuration-api.mjs +0 -51
  152. package/esm2020/lib/services/ui-definitions-api.service.mjs +0 -76
  153. package/esm2020/lib/services/ui-templates-api.service.mjs +0 -286
  154. package/esm2020/lib/services/veloce-objects-api.service.mjs +0 -90
  155. package/esm2020/lib/types/attachment.types.mjs +0 -2
  156. package/esm2020/lib/types/auth.types.mjs +0 -2
  157. package/esm2020/lib/types/clone-request.types.mjs +0 -2
  158. package/esm2020/lib/types/delta-request.types.mjs +0 -2
  159. package/esm2020/lib/types/dto/configuration-settings-dto.types.mjs +0 -22
  160. package/esm2020/lib/types/dto/offers-dto.types.mjs +0 -2
  161. package/esm2020/lib/types/dto/ui-template-dto.types.mjs +0 -2
  162. package/esm2020/lib/types/index.mjs +0 -8
  163. package/esm2020/lib/types/org-info.types.mjs +0 -2
  164. package/esm2020/lib/types/price.types.mjs +0 -2
  165. package/esm2020/lib/types/quote.types.mjs +0 -2
  166. package/esm2020/lib/types/ramp-request.types.mjs +0 -2
  167. package/esm2020/lib/types/search-request.types.mjs +0 -2
  168. package/esm2020/lib/types/stateful-configuration.types.mjs +0 -2
  169. package/esm2020/lib/utils/canvas.utils.mjs +0 -33
  170. package/esm2020/lib/utils/index.mjs +0 -3
  171. package/esm2020/lib/utils/ui-template.utils.mjs +0 -13
  172. package/lib/services/configuration-api.service.d.ts +0 -23
  173. package/lib/services/context-api.service.d.ts +0 -11
  174. package/lib/services/delta-api.service.d.ts +0 -12
  175. package/lib/services/price-api.service.d.ts +0 -16
  176. package/lib/services/procedures-api.service.d.ts +0 -30
  177. package/lib/services/product-api.service.d.ts +0 -31
  178. package/lib/services/product-model-api.service.d.ts +0 -29
  179. package/lib/services/quote-api.service.d.ts +0 -22
  180. package/lib/services/ramp-api.service.d.ts +0 -13
  181. package/lib/services/rlm-quote-api.service.d.ts +0 -11
  182. package/lib/services/rule-groups-api.service.d.ts +0 -18
  183. package/lib/services/rules-api.service.d.ts +0 -22
  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/catalog-admin-api.service.d.ts +0 -0
  209. /package/{lib → v2}/services/configuration-processors-api.service.d.ts +0 -0
  210. /package/{lib → v2}/services/flows-api.service.d.ts +0 -0
  211. /package/{lib → v2}/services/guided-sellings-admin-api.service.d.ts +0 -0
  212. /package/{lib → v2}/services/guided-sellings-api.service.d.ts +0 -0
  213. /package/{lib → v2}/services/shopping-cart-settings-api.service.d.ts +0 -0
  214. /package/{lib → v2}/types/attachment.types.d.ts +0 -0
  215. /package/{lib → v2}/types/dto/configuration-settings-dto.types.d.ts +0 -0
  216. /package/{lib → v2}/types/dto/ui-template-dto.types.d.ts +0 -0
  217. /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, 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,2375 +110,289 @@ 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
147
  }
293
- CatalogAdminApiService.MAX_RESULTS = 60;
294
- CatalogAdminApiServicefac = 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: [{
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
+ ContractedPriceApiServiceprov = 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: [{
297
151
  type: Injectable
298
152
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
299
153
 
300
- class CatalogApiService {
301
- constructor(service) {
302
- this.service = service;
303
- this.serviceUrl = '/product-catalogs';
154
+ class FlowStateApiService {
155
+ constructor(httpService) {
156
+ this.httpService = httpService;
157
+ this.SERVICE_URL = '/configuration/states';
304
158
  }
305
- fetchCatalogs$() {
306
- return this.service.api({
307
- method: 'get',
308
- url: `${this.serviceUrl}`,
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) {
165
+ return this.httpService.api({
166
+ method: 'post',
167
+ url: `${this.SERVICE_URL}/quote/start`,
168
+ body: request,
309
169
  });
310
170
  }
311
- searchCatalogs$(searchParams, expression) {
312
- const params = new HttpParams({ fromObject: searchParams });
313
- return this.service.api({
171
+ /**
172
+ * Get existing state by ID
173
+ * @param id ID
174
+ * @returns Flow State
175
+ */
176
+ get(id) {
177
+ return this.httpService.api({
178
+ url: `${this.SERVICE_URL}/${id}`,
179
+ });
180
+ }
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({
314
189
  method: 'post',
315
- url: `${this.serviceUrl}/search`,
316
- params,
317
- body: expression,
190
+ url: `${this.SERVICE_URL}/quote/${id}/execute`,
191
+ body: request,
318
192
  });
319
193
  }
320
- getCatalog$(id) {
321
- return this.service.api({
322
- method: 'get',
323
- url: `${this.serviceUrl}/${id}`,
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`,
324
202
  });
325
203
  }
326
- fetchCategories$(catalogId) {
327
- return this.service.api({
328
- method: 'get',
329
- url: `${this.serviceUrl}/${catalogId}/categories`,
204
+ /**
205
+ * Submit Quote in the state
206
+ * @param id State ID
207
+ */
208
+ submit(id) {
209
+ return this.httpService.api({
210
+ method: 'post',
211
+ url: `${this.SERVICE_URL}/quote/${id}/submit`,
330
212
  });
331
213
  }
332
- fetchCatalogProducts$(catalogId, searchParams, context) {
333
- const params = new HttpParams({ fromObject: searchParams });
334
- return this.service.api({
214
+ /**
215
+ * Close Flow state
216
+ * @param id State ID
217
+ */
218
+ cancel(id) {
219
+ return this.httpService.api({
335
220
  method: 'post',
336
- url: `${this.serviceUrl}/${catalogId}/products`,
337
- params,
338
- body: context,
221
+ url: `${this.SERVICE_URL}/quote/${id}/cancel`,
339
222
  });
340
223
  }
341
- fetchCategoryProducts$(catalogId, categoryId, searchParams, context) {
342
- const params = new HttpParams({ fromObject: searchParams });
343
- return this.service.api({
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({
344
232
  method: 'post',
345
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products`,
346
- params,
347
- body: context,
233
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/new`,
234
+ body: request,
348
235
  });
349
236
  }
350
- searchCategoryProducts$(catalogId, categoryId, searchParams, searchRequest, context) {
351
- const params = new HttpParams({ fromObject: searchParams });
352
- return this.service.api({
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) {
244
+ return this.httpService.api({
353
245
  method: 'post',
354
- url: `${this.serviceUrl}/${catalogId}/categories/${categoryId}/products/search`,
355
- params,
356
- body: {
357
- configurationContext: context,
358
- request: searchRequest,
359
- },
246
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/start`,
247
+ body: request,
360
248
  });
361
249
  }
362
- fetchEligibleProducts$(searchParams, context) {
363
- const params = new HttpParams({ fromObject: searchParams });
364
- return this.service.api({
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) {
258
+ return this.httpService.api({
365
259
  method: 'post',
366
- url: `${this.serviceUrl}/products`,
367
- params: params,
368
- body: context,
260
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/execute`,
261
+ body: request,
369
262
  });
370
263
  }
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,
264
+ /**
265
+ * Save stateful configuration
266
+ * @param stateId string
267
+ * @param configurationId string
268
+ */
269
+ saveConfiguration(stateId, configurationId) {
270
+ return this.httpService.api({
271
+ method: 'post',
272
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/save`,
273
+ });
274
+ }
275
+ /**
276
+ * Cancel stateful configuration
277
+ * @param stateId string
278
+ * @param configurationId string
279
+ */
280
+ cancelConfiguration(stateId, configurationId) {
281
+ return this.httpService.api({
282
+ method: 'post',
283
+ url: `${this.SERVICE_URL}/quote/${stateId}/configuration/${configurationId}/cancel`,
377
284
  });
378
285
  }
379
286
  }
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: [{
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: [{
383
290
  type: Injectable
384
291
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
385
292
 
386
- class ConfigurationApiService {
387
- constructor(httpService) {
388
- this.httpService = httpService;
389
- this.SERVICE_URL = '/configuration';
293
+ class OffersApiService {
294
+ constructor(baseHttpService) {
295
+ this.baseHttpService = baseHttpService;
296
+ this.serviceUrl = '/admin/offers';
390
297
  }
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({
298
+ createOffer$(body) {
299
+ return this.baseHttpService.api({
300
+ url: `${this.serviceUrl}`,
414
301
  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))));
560
- }
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);
585
- return this.httpService.api({
586
- url: `${this.SERVICE_URL}`,
587
- 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,
869
- });
870
- }
871
- /**
872
- * Get existing state by ID
873
- * @param id ID
874
- * @returns Flow State
875
- */
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
- getPML(modelId, version) {
1789
- let url = `${this.SERVICE_URL}/${modelId}/pml/${version}`;
1790
- if (version) {
1791
- url += `/versions/${version}`;
1792
- }
1793
- return this.httpService.api({
1794
- url,
1795
- responseType: 'text',
1796
- });
1797
- }
1798
- savePML(modelId, pml, comment) {
1799
- return this.httpService
1800
- .api({
1801
- method: 'put',
1802
- url: `${this.SERVICE_URL}/${modelId}/pml`,
1803
- body: {
1804
- id: modelId,
1805
- pml: pml,
1806
- comment: comment,
1807
- },
1808
- })
1809
- .pipe(map(result => {
1810
- if (result.successful) {
1811
- return '';
1812
- }
1813
- else {
1814
- throw new Error(result.message);
1815
- }
1816
- }), catchError(this.httpService.handleValidationError));
1817
- }
1818
- generateProducts(modelId) {
1819
- return this.httpService.api({
1820
- url: `${this.SERVICE_URL}/${modelId}/generate-products`,
1821
- });
1822
- }
1823
- saveModel(productModel, comment) {
1824
- const model = EntityUtil.clone(productModel);
1825
- model.comment = comment;
1826
- ModelTranslatorUtils.toServerModel(model);
1827
- return this.httpService
1828
- .api({
1829
- method: 'put',
1830
- url: `${this.SERVICE_URL}/${model.id}`,
1831
- body: model,
1832
- })
1833
- .pipe(map(result => {
1834
- if (result.successful) {
1835
- return '';
1836
- }
1837
- else {
1838
- throw new Error(result.message);
1839
- }
1840
- }), catchError(this.httpService.handleValidationError));
1841
- }
1842
- validateModel(productModel) {
1843
- return this.httpService
1844
- .api({
1845
- method: 'post',
1846
- url: `${this.SERVICE_URL}/validate`,
1847
- body: productModel,
1848
- errorHandler: this.httpService.handleValidationError,
1849
- })
1850
- .pipe(map(result => {
1851
- if (result.successful) {
1852
- return '';
1853
- }
1854
- else {
1855
- throw new Error(result.message);
1856
- }
1857
- }));
1858
- }
1859
- renameModel(productModel, name) {
1860
- const model = EntityUtil.clone(productModel);
1861
- model.name = name;
1862
- ModelTranslatorUtils.toServerModel(model);
1863
- return this.httpService
1864
- .api({
1865
- method: 'patch',
1866
- url: `${this.SERVICE_URL}/${model.id}`,
1867
- body: model,
1868
- })
1869
- .pipe(catchError(this.httpService.handleValidationError));
1870
- }
1871
- uploadPmlFile(file, modelId) {
1872
- const formData = new FormData();
1873
- formData.append('file', file, file.name);
1874
- return this.httpService.upload({
1875
- url: `${this.SERVICE_URL}/${modelId}/pml/upload`,
1876
- body: formData,
1877
- });
1878
- }
1879
- runPml(modelId, pml, rootType, configurationMode) {
1880
- return this.httpService.api({
1881
- method: 'post',
1882
- url: `${this.SERVICE_URL}/${modelId}/pml/run`,
1883
- body: {
1884
- pml,
1885
- rootType,
1886
- configurationMode,
1887
- },
1888
- responseType: 'text',
1889
- });
1890
- }
1891
- evictAllCache() {
1892
- return this.httpService.api({
1893
- method: 'get',
1894
- url: '/cache/evict/environment-variables',
1895
- });
1896
- }
1897
- }
1898
- ProductModelApiService.MAX_RESULTS = 200;
1899
- ProductModelApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModelApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1900
- ProductModelApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModelApiService });
1901
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModelApiService, decorators: [{
1902
- type: Injectable
1903
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1904
-
1905
- class PromotionsApiService {
1906
- constructor(baseHttpService) {
1907
- this.baseHttpService = baseHttpService;
1908
- this.serviceUrl = '/admin/promotion';
1909
- this.fetchAll$ = () => {
1910
- return this.baseHttpService.api({ url: this.serviceUrl });
1911
- };
1912
- this.fetchOne$ = (id) => {
1913
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
1914
- };
1915
- this.remove$ = (id) => {
1916
- return this.baseHttpService.api({
1917
- url: `${this.serviceUrl}/${id}`,
1918
- method: 'delete',
1919
- });
1920
- };
1921
- this.restore$ = (id) => {
1922
- return this.baseHttpService.api({
1923
- method: 'patch',
1924
- url: `${this.serviceUrl}/${id}/restore`,
1925
- });
1926
- };
1927
- this.duplicate$ = (body) => {
1928
- return this.baseHttpService
1929
- .api({
1930
- url: `${this.serviceUrl}/${body.id}/clone`,
1931
- method: 'post',
1932
- body,
1933
- })
1934
- .pipe(map$1(response => response.clonedRecordId));
1935
- };
1936
- }
1937
- search$(expression, skip, count) {
1938
- let params = new HttpParams();
1939
- if (typeof skip === 'number') {
1940
- params = params.set('skip', '' + skip);
1941
- }
1942
- if (typeof count === 'number') {
1943
- params = params.set('count', '' + count);
1944
- }
1945
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
1946
- }
1947
- create$(body) {
1948
- return this.baseHttpService.api({
1949
- url: `${this.serviceUrl}`,
1950
- method: 'post',
1951
- body,
1952
- });
1953
- }
1954
- update$(body) {
1955
- return this.baseHttpService.api({
1956
- url: `${this.serviceUrl}/${body.id}`,
1957
- method: 'put',
1958
- body,
1959
- });
1960
- }
1961
- }
1962
- PromotionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
1963
- PromotionsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService });
1964
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromotionsApiService, decorators: [{
1965
- type: Injectable
1966
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
1967
-
1968
- class QuoteApiService {
1969
- constructor(httpService) {
1970
- this.httpService = httpService;
1971
- this.SERVICE_URL = '/quotes';
1972
- }
1973
- /**
1974
- * This endpoint doesn't include orders and assets
1975
- * @param objectId quoteId | accountId | opportunityId | orderId
1976
- * @param params Query params
1977
- * @param options Request options
1978
- */
1979
- getQuoteState(objectId, params, options) {
1980
- return this.httpService.api({
1981
- method: 'get',
1982
- url: `/v2${this.SERVICE_URL}/${objectId}`,
1983
- params,
1984
- ...options,
1985
- });
1986
- }
1987
- upsertQuote(request, options) {
1988
- return this.httpService.api({
1989
- method: 'post',
1990
- url: `${this.SERVICE_URL}`,
1991
- body: request,
1992
- ...options,
1993
- });
1994
- }
1995
- submitQuote(request, options) {
1996
- return this.httpService.api({
1997
- method: 'post',
1998
- url: `${this.SERVICE_URL}/submit`,
1999
- body: request,
2000
- ...options,
2001
- });
2002
- }
2003
- attachDocument(id, documentName, data) {
2004
- const formData = new FormData();
2005
- const blob = new Blob([data]);
2006
- formData.append('file', blob, documentName);
2007
- return this.httpService.upload({
2008
- url: `${this.SERVICE_URL}/${id}/attach-document`,
2009
- responseType: 'arraybuffer',
2010
- method: 'post',
2011
- body: formData,
2012
- });
2013
- }
2014
- }
2015
- QuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2016
- QuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteApiService });
2017
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteApiService, decorators: [{
2018
- type: Injectable
2019
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2020
-
2021
- class RampApiService {
2022
- constructor(httpService) {
2023
- this.httpService = httpService;
2024
- this.SERVICE_URL = '/ramp';
2025
- }
2026
- next(request, options) {
2027
- return this.httpService.api({
2028
- method: 'post',
2029
- url: `${this.SERVICE_URL}/next`,
2030
- body: request,
2031
- ...options,
2032
- });
2033
- }
2034
- renew(request, options) {
2035
- return this.httpService.api({
2036
- method: 'post',
2037
- url: `${this.SERVICE_URL}/renew`,
2038
- body: request,
2039
- ...options,
2040
- });
2041
- }
2042
- }
2043
- RampApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RampApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2044
- RampApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RampApiService });
2045
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RampApiService, decorators: [{
2046
- type: Injectable
2047
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2048
-
2049
- class RebateProgramApiService {
2050
- constructor(baseHttpService) {
2051
- this.baseHttpService = baseHttpService;
2052
- this.serviceUrl = '/admin/rebate-program';
2053
- this.fetchAll$ = () => {
2054
- return this.baseHttpService.api({ url: this.serviceUrl });
2055
- };
2056
- this.fetchOne$ = (id) => {
2057
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2058
- };
2059
- this.remove$ = (id) => {
2060
- return this.baseHttpService.api({
2061
- url: `${this.serviceUrl}/${id}`,
2062
- method: 'delete',
2063
- });
2064
- };
2065
- this.restore$ = (id) => {
2066
- return this.baseHttpService.api({
2067
- method: 'patch',
2068
- url: `${this.serviceUrl}/${id}/restore`,
2069
- });
2070
- };
2071
- this.duplicate$ = (body) => {
2072
- return this.baseHttpService
2073
- .api({
2074
- url: `${this.serviceUrl}/${body.id}/clone`,
2075
- method: 'post',
2076
- body,
2077
- })
2078
- .pipe(map$1(response => response.clonedRecordId));
2079
- };
2080
- }
2081
- search$(expression, skip, count) {
2082
- let params = new HttpParams();
2083
- if (typeof skip === 'number') {
2084
- params = params.set('skip', '' + skip);
2085
- }
2086
- if (typeof count === 'number') {
2087
- params = params.set('count', '' + count);
2088
- }
2089
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2090
- }
2091
- create$(body) {
2092
- return this.baseHttpService.api({
2093
- url: `${this.serviceUrl}`,
2094
- method: 'post',
2095
- body,
2096
- });
2097
- }
2098
- update$(body) {
2099
- return this.baseHttpService.api({
2100
- url: `${this.serviceUrl}/${body.id}`,
2101
- method: 'put',
2102
- body,
2103
- });
2104
- }
2105
- }
2106
- RebateProgramApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2107
- RebateProgramApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService });
2108
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateProgramApiService, decorators: [{
2109
- type: Injectable
2110
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2111
-
2112
- class RebateTypeApiService {
2113
- constructor(baseHttpService) {
2114
- this.baseHttpService = baseHttpService;
2115
- this.serviceUrl = '/admin/rebate-type';
2116
- this.fetchAll$ = () => {
2117
- return this.baseHttpService.api({ url: this.serviceUrl });
2118
- };
2119
- this.fetchOne$ = (id) => {
2120
- return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2121
- };
2122
- this.remove$ = (id) => {
2123
- return this.baseHttpService.api({
2124
- url: `${this.serviceUrl}/${id}`,
2125
- method: 'delete',
2126
- });
2127
- };
2128
- this.restore$ = (id) => {
2129
- return this.baseHttpService.api({
2130
- method: 'patch',
2131
- url: `${this.serviceUrl}/${id}/restore`,
2132
- });
2133
- };
2134
- this.duplicate$ = (body) => {
2135
- return this.baseHttpService
2136
- .api({
2137
- url: `${this.serviceUrl}/${body.id}/clone`,
2138
- method: 'post',
2139
- body,
2140
- })
2141
- .pipe(map$1(response => response.clonedRecordId));
2142
- };
2143
- }
2144
- search$(expression, skip, count) {
2145
- let params = new HttpParams();
2146
- if (typeof skip === 'number') {
2147
- params = params.set('skip', '' + skip);
2148
- }
2149
- if (typeof count === 'number') {
2150
- params = params.set('count', '' + count);
2151
- }
2152
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2153
- }
2154
- create$(body) {
2155
- return this.baseHttpService.api({
2156
- url: `${this.serviceUrl}`,
2157
- method: 'post',
2158
- body,
2159
- });
2160
- }
2161
- update$(body) {
2162
- return this.baseHttpService.api({
2163
- url: `${this.serviceUrl}/${body.id}`,
2164
- method: 'put',
2165
- body,
2166
- });
2167
- }
2168
- }
2169
- RebateTypeApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2170
- RebateTypeApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService });
2171
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RebateTypeApiService, decorators: [{
2172
- type: Injectable
2173
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2174
-
2175
- class RlmApiService {
2176
- constructor(baseHttpService) {
2177
- this.baseHttpService = baseHttpService;
2178
- this.serviceUrl = '/rlm';
2179
- }
2180
- fetchContextDefinitions$() {
2181
- return this.baseHttpService
2182
- .api({ url: `${this.serviceUrl}/context`, skipErrorHandler: true })
2183
- .pipe(catchError(() => {
2184
- return of([]);
2185
- }));
2186
- }
2187
- fetchContextMappings$(id) {
2188
- return this.baseHttpService.api({ url: `${this.serviceUrl}/context/${id}/mappings` });
2189
- }
2190
- fetchContextDefinitionStructure$(id) {
2191
- return this.baseHttpService
2192
- .api({
2193
- url: `${this.serviceUrl}/context/${id}/structure/details`,
2194
- skipErrorHandler: true,
2195
- })
2196
- .pipe(catchError(() => {
2197
- return of([]);
2198
- }), map(objects => {
2199
- return objects.map(object => {
2200
- const tag = object.tags?.[0]?.title;
2201
- const objectAttributes = object.attributes || [];
2202
- return {
2203
- id: object.id,
2204
- title: tag || object.title,
2205
- attributes: objectAttributes.map(attribute => {
2206
- const tag = attribute.tags?.[0]?.title;
2207
- return {
2208
- title: tag || attribute.title,
2209
- fieldType: attribute.fieldType,
2210
- dataType: attribute.dataType,
2211
- };
2212
- }),
2213
- };
2214
- });
2215
- }));
2216
- }
2217
- fetchRlmProcedures(contextDefinitionId) {
2218
- const params = {};
2219
- if (contextDefinitionId) {
2220
- params['contextDefinitionId'] = contextDefinitionId;
2221
- }
2222
- return this.baseHttpService.api({
2223
- url: `${this.serviceUrl}/procedures`,
2224
- params,
302
+ body,
2225
303
  });
2226
304
  }
2227
- }
2228
- RlmApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2229
- RlmApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService });
2230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmApiService, decorators: [{
2231
- type: Injectable
2232
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2233
-
2234
- class RlmQuoteApiService {
2235
- constructor(httpService) {
2236
- this.httpService = httpService;
2237
- this.SERVICE_URL = '/quotes/rlm';
2238
- }
2239
- getQuote(mappingType, objectId, contextMappingId, options) {
2240
- const params = { mappingType };
2241
- if (contextMappingId) {
2242
- params['contextMappingId'] = contextMappingId;
2243
- }
2244
- return this.httpService.api({
2245
- method: 'get',
2246
- url: `${this.SERVICE_URL}/${objectId}`,
2247
- params,
2248
- ...options,
305
+ fetchOffers$() {
306
+ return this.baseHttpService.api({
307
+ url: `${this.serviceUrl}`,
2249
308
  });
2250
309
  }
2251
- }
2252
- RlmQuoteApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2253
- RlmQuoteApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService });
2254
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RlmQuoteApiService, decorators: [{
2255
- type: Injectable
2256
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2257
-
2258
- class RuleGroupsApiService {
2259
- constructor(baseHttpService) {
2260
- this.baseHttpService = baseHttpService;
2261
- this.serviceUrl = '/admin/rule-groups';
2262
- this.fetchRuleGroups$ = () => {
2263
- return this.searchRuleGroups$(new Expression(), 0, 100);
2264
- };
2265
- this.searchRuleGroups$ = (expression, skip, count) => {
2266
- let params = new HttpParams();
2267
- params = params.set('skip', '' + skip);
2268
- params = params.set('count', '' + count);
2269
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2270
- };
2271
- this.createRuleGroup$ = (ruleGroup) => {
2272
- return this.baseHttpService.api({
2273
- url: `${this.serviceUrl}`,
2274
- method: 'post',
2275
- body: ruleGroup,
2276
- });
2277
- };
2278
- this.updateRuleGroup$ = (ruleGroup) => {
2279
- return this.baseHttpService.api({
2280
- url: `${this.serviceUrl}/${ruleGroup.id}`,
2281
- method: 'post',
2282
- body: ruleGroup,
2283
- });
2284
- };
2285
- this.duplicateRuleGroup$ = (body) => {
2286
- return this.baseHttpService
2287
- .api({
2288
- url: `${this.serviceUrl}/${body.id}/clone`,
2289
- method: 'post',
2290
- body,
2291
- })
2292
- .pipe(map$1(response => response.clonedRecordId));
2293
- };
2294
- this.removeRuleGroup$ = (id) => {
2295
- return this.baseHttpService.api({
2296
- url: `${this.serviceUrl}/${id}`,
2297
- method: 'delete',
2298
- });
2299
- };
2300
- this.restoreRuleGroup$ = (id) => {
2301
- return this.baseHttpService.api({
2302
- url: `${this.serviceUrl}/${id}/restore`,
2303
- method: 'patch',
2304
- });
2305
- };
2306
- }
2307
- }
2308
- RuleGroupsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2309
- RuleGroupsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService });
2310
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuleGroupsApiService, decorators: [{
2311
- type: Injectable
2312
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2313
-
2314
- class RulesApiService {
2315
- constructor(baseHttpService) {
2316
- this.baseHttpService = baseHttpService;
2317
- this.serviceUrl = '/admin/rules';
2318
- this.fetchRules$ = () => {
2319
- return this.searchRules$(new Expression(), 0, 100);
2320
- };
2321
- this.searchRules$ = (expression, skip, count) => {
2322
- let params = new HttpParams();
2323
- if (typeof skip === 'number') {
2324
- params = params.set('skip', '' + skip);
2325
- }
2326
- if (typeof count === 'number') {
2327
- params = params.set('count', '' + count);
2328
- }
2329
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2330
- };
2331
- this.createRule$ = (rule) => {
2332
- return this.baseHttpService.api({
2333
- url: `${this.serviceUrl}`,
2334
- method: 'post',
2335
- body: rule,
2336
- });
2337
- };
2338
- this.updateRule$ = (rule) => {
2339
- return this.baseHttpService.api({
2340
- url: `${this.serviceUrl}/${rule.id}`,
2341
- method: 'put',
2342
- body: rule,
2343
- });
2344
- };
2345
- this.duplicateRule$ = (body) => {
2346
- return this.baseHttpService
2347
- .api({
2348
- url: `${this.serviceUrl}/${body.id}/clone`,
2349
- method: 'post',
2350
- body,
2351
- })
2352
- .pipe(map(response => response.clonedRecordId));
2353
- };
2354
- this.removeRule$ = (id) => {
2355
- return this.baseHttpService.api({
2356
- url: `${this.serviceUrl}/${id}`,
2357
- method: 'delete',
2358
- });
2359
- };
2360
- this.restoreRule$ = (id) => {
2361
- return this.baseHttpService.api({
2362
- url: `${this.serviceUrl}/${id}/restore`,
2363
- method: 'patch',
2364
- });
2365
- };
2366
- }
2367
- fetchRule$(id) {
310
+ fetchOffer$(id) {
2368
311
  return this.baseHttpService.api({
2369
312
  url: `${this.serviceUrl}/${id}`,
2370
- method: 'get',
2371
313
  });
2372
314
  }
2373
- fetchHeaderFields$() {
315
+ updateOffer$(offer) {
2374
316
  return this.baseHttpService.api({
2375
- url: `${this.serviceUrl}/describe/Header`,
2376
- method: 'get',
317
+ url: `${this.serviceUrl}/${offer.id}`,
318
+ method: 'put',
319
+ body: offer,
2377
320
  });
2378
321
  }
2379
- execute$(body) {
2380
- const url = this.getExecuteRuleUrl(body.rule.ruleGroupType);
322
+ removeOffer$(id) {
2381
323
  return this.baseHttpService.api({
2382
- url,
2383
- method: 'post',
2384
- body,
2385
- });
2386
- }
2387
- getExecuteRuleUrl(ruleGroupType) {
2388
- if (ruleGroupType === RuleGroupTypes.eligibility) {
2389
- return '/rules/eligibility/execute';
2390
- }
2391
- if (ruleGroupType === RuleGroupTypes.catalog) {
2392
- return '/rules/catalog/execute';
2393
- }
2394
- if (ruleGroupType === RuleGroupTypes.rlmContextBased) {
2395
- return '/rules/rlm/execute';
2396
- }
2397
- return '/rules/execute';
2398
- }
2399
- }
2400
- RulesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2401
- RulesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService });
2402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RulesApiService, decorators: [{
2403
- type: Injectable
2404
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2405
-
2406
- class SalesforceApiService {
2407
- constructor(httpService) {
2408
- this.httpService = httpService;
2409
- this.SERVICE_URL = '/proxy';
2410
- }
2411
- query(searchRequest, objectName, options) {
2412
- return this.httpService.api({
2413
- method: 'post',
2414
- body: { ...searchRequest, count: searchRequest.count || 100 },
2415
- url: `${this.SERVICE_URL}/query/${objectName}`,
2416
- ...options,
324
+ url: `${this.serviceUrl}/${id}`,
325
+ method: 'delete',
2417
326
  });
2418
327
  }
2419
- queryObjects(search, options) {
328
+ searchOffers$(expression, skip, count) {
2420
329
  let params = new HttpParams();
2421
- if (search) {
2422
- params = params.append('search', search);
2423
- }
2424
- return this.httpService.api({
2425
- url: `${this.SERVICE_URL}/query`,
2426
- params,
2427
- ...options,
2428
- });
2429
- }
2430
- search(req, options) {
2431
- return this.httpService.api({
2432
- url: `${this.SERVICE_URL}/rest/search`,
2433
- params: { q: req.searchString },
2434
- ...options,
2435
- });
2436
- }
2437
- describeObject(objectName, options) {
2438
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2439
- return this.httpService.api({ url: methodUrl, ...options });
2440
- }
2441
- describeField(objectName, fieldName, options) {
2442
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields/${fieldName}`;
2443
- return this.httpService.api({ url: methodUrl, ...options });
2444
- }
2445
- describe2(objectName, fields, options) {
2446
- const methodUrl = `${this.SERVICE_URL}/describe/${objectName}/fields`;
2447
- return this.httpService.api({ method: 'post', url: methodUrl, body: fields, ...options });
2448
- }
2449
- apexGetRequest(path, params, options) {
2450
- // this line is needed because HttpParams instance from Integration behaves wrong in studio instance of Angular
2451
- const httpParams = new HttpParams({ fromString: params.toString() });
2452
- return this.httpService.api({ url: `${this.SERVICE_URL}/apex${path}`, params: httpParams, ...options });
2453
- }
2454
- apexPostRequest(path, body, options) {
2455
- return this.httpService.api({
330
+ params = params.set('skip', '' + skip);
331
+ params = params.set('count', '' + count);
332
+ return this.baseHttpService.api({
2456
333
  method: 'post',
2457
- body,
2458
- url: `${this.SERVICE_URL}/apex${path}`,
2459
- ...options,
334
+ url: `${this.serviceUrl}/search`,
335
+ params,
336
+ body: expression,
2460
337
  });
2461
338
  }
2462
- getGlobalPicklists() {
2463
- return this.httpService.api({
2464
- method: 'get',
2465
- url: `${this.SERVICE_URL}/globalvalueset`,
2466
- });
339
+ fetchOfferProducts$(id) {
340
+ return this.baseHttpService
341
+ .api({
342
+ url: `${this.serviceUrl}/${id}/products`,
343
+ })
344
+ .pipe(map(response => response.products));
2467
345
  }
2468
- getGlobalPicklistValues(id) {
2469
- return this.httpService.api({
2470
- method: 'get',
2471
- url: `${this.SERVICE_URL}/globalvalueset/${id}/values`,
2472
- });
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));
2473
355
  }
2474
356
  }
2475
- SalesforceApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2476
- SalesforceApiServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesforceApiService });
2477
- 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: [{
2478
361
  type: Injectable
2479
362
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2480
363
 
2481
- 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 {
2482
396
  constructor(messageService) {
2483
397
  this.messageService = messageService;
2484
398
  /**
@@ -2490,70 +404,30 @@ class SandboxManagerApiService {
2490
404
  this.messageService.add({ severity: 'error', summary: message, sticky: true });
2491
405
  };
2492
406
  }
2493
- getSalesforceOrganizations$() {
2494
- try {
2495
- return window.doSandboxCall
2496
- ? from(window.doSandboxCall('orgs', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, [], this.publishErrorMessage)), catchError$1(() => of([])))
2497
- : of([]);
2498
- }
2499
- catch {
2500
- return of([]);
2501
- }
2502
- }
2503
- getAvailableSalesforceOrganizationSizes$() {
2504
- try {
2505
- return window.doSandboxCall
2506
- ? from(window.doSandboxCall('available-sizes', '', 'GET')).pipe(map$1(response => handleCanvasResponse(response, {}, this.publishErrorMessage)), catchError$1(() => of({})))
2507
- : of({});
2508
- }
2509
- catch {
2510
- return of({});
2511
- }
2512
- }
2513
- createSalesforceOrganization$(payload) {
2514
- try {
2515
- return window.doSandboxCall
2516
- ? from(window.doSandboxCall('orgs', JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2517
- : of(undefined);
2518
- }
2519
- catch (err) {
2520
- return of(undefined);
2521
- }
2522
- }
2523
- updateSalesforceOrganization$(payload) {
2524
- try {
2525
- return window.doSandboxCall
2526
- ? from(window.doSandboxCall(`orgs/${payload.orgId}`, JSON.stringify(payload), 'POST')).pipe(map$1(response => handleCanvasResponse(response, undefined, this.publishErrorMessage)), catchError$1(() => of(undefined)))
2527
- : of(undefined);
2528
- }
2529
- catch {
2530
- return of(undefined);
2531
- }
2532
- }
2533
- deleteSalesforceOrganization$(payload) {
407
+ getOrgInfo$() {
2534
408
  try {
2535
- return window.doSandboxCall
2536
- ? 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)))
2537
411
  : of(undefined);
2538
412
  }
2539
413
  catch {
2540
414
  return of(undefined);
2541
415
  }
2542
416
  }
2543
- activateSalesforceOrganization$(payload) {
417
+ getAvailableVersionsInfo$() {
2544
418
  try {
2545
- return window.doSandboxCall
2546
- ? 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)))
2547
421
  : of(undefined);
2548
422
  }
2549
423
  catch {
2550
424
  return of(undefined);
2551
425
  }
2552
426
  }
2553
- deactivateSalesforceOrganization$(payload) {
427
+ upgradeVersion$(targetVersion) {
2554
428
  try {
2555
- return window.doSandboxCall
2556
- ? 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)))
2557
431
  : of(undefined);
2558
432
  }
2559
433
  catch {
@@ -2561,644 +435,420 @@ class SandboxManagerApiService {
2561
435
  }
2562
436
  }
2563
437
  }
2564
- 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 });
2565
- SandboxManagerApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SandboxManagerApiService });
2566
- 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: [{
2567
441
  type: Injectable
2568
442
  }], ctorParameters: function () { return [{ type: i1$2.MessageService }]; } });
2569
443
 
2570
- class ScriptsApiService {
444
+ class PortalsApiService {
2571
445
  constructor(baseHttpService) {
2572
446
  this.baseHttpService = baseHttpService;
2573
- this.serviceUrl = '/admin/scripts';
2574
- this.fetchScripts$ = () => {
2575
- return this.baseHttpService.api({ url: `${this.serviceUrl}` });
2576
- };
2577
- this.searchScripts$ = (expression, skip, count) => {
447
+ this.serviceUrl = '/admin/portal';
448
+ this.getPortals$ = (skip = 1, name = '') => {
2578
449
  let params = new HttpParams();
2579
- if (typeof skip === 'number') {
2580
- params = params.set('skip', '' + skip);
2581
- }
2582
- if (typeof count === 'number') {
2583
- params = params.set('count', '' + count);
2584
- }
2585
- return this.baseHttpService.api({ method: 'post', url: `${this.serviceUrl}/search`, params, body: expression });
2586
- };
2587
- this.fetchScript$ = (id) => {
2588
- 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 });
2589
454
  };
2590
- 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);
2591
459
  return this.baseHttpService.api({
2592
- url: `${this.serviceUrl}`,
2593
460
  method: 'post',
2594
- body: script,
461
+ url: `${this.serviceUrl}/search`,
462
+ params,
463
+ body: expression || {},
2595
464
  });
2596
465
  };
2597
- this.updateScriptMeta$ = (script) => {
466
+ this.removePortal$ = (id) => {
2598
467
  return this.baseHttpService.api({
2599
- url: `${this.serviceUrl}/${script.id}`,
2600
- method: 'put',
2601
- body: script,
468
+ url: `${this.serviceUrl}/${id}`,
469
+ method: 'delete',
2602
470
  });
2603
471
  };
2604
- this.updateScriptDetails$ = (script) => {
472
+ this.restore$ = (id) => {
2605
473
  return this.baseHttpService.api({
2606
- url: `${this.serviceUrl}/${script.id}`,
2607
- method: 'put',
2608
- body: script,
474
+ method: 'patch',
475
+ url: `${this.serviceUrl}/${id}/restore`,
2609
476
  });
2610
477
  };
2611
- this.cloneScript$ = (cloneRequest) => {
2612
- return this.baseHttpService
2613
- .api({
478
+ this.duplicatePortal$ = (cloneRequest) => {
479
+ return this.baseHttpService.api({
2614
480
  url: `${this.serviceUrl}/${cloneRequest.id}/clone`,
2615
481
  method: 'post',
2616
482
  body: cloneRequest,
2617
- })
2618
- .pipe(map(response => response.clonedRecordId));
2619
- };
2620
- this.removeScript$ = (id) => {
2621
- return this.baseHttpService.api({
2622
- url: `${this.serviceUrl}/${id}`,
2623
- method: 'delete',
2624
- });
2625
- };
2626
- this.restoreScript$ = (id) => {
2627
- return this.baseHttpService.api({
2628
- url: `${this.serviceUrl}/${id}/restore`,
2629
- method: 'patch',
2630
483
  });
2631
484
  };
2632
- this.execute$ = (body) => {
485
+ this.getPortal$ = (id) => {
2633
486
  return this.baseHttpService.api({
2634
- url: `/scripts/execute`,
2635
- method: 'post',
2636
- body,
2637
- errorHandler: () => null,
487
+ url: `${this.serviceUrl}/${id}`,
2638
488
  });
2639
489
  };
2640
490
  }
2641
- }
2642
- ScriptsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2643
- ScriptsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService });
2644
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScriptsApiService, decorators: [{
2645
- type: Injectable
2646
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2647
-
2648
- class ShoppingCartSettingsApiService {
2649
- constructor(configurationSettingsApiService) {
2650
- this.configurationSettingsApiService = configurationSettingsApiService;
2651
- this.shoppingCartSettingsKey = 'shopping-cart';
2652
- }
2653
- getSetting(id) {
2654
- return this.fetchSettings().pipe(map((settings) => parseJsonSafely(settings?.value, [])), map(settings => settings.find(setting => setting.id == id)));
2655
- }
2656
- fetchSettings() {
2657
- return this.configurationSettingsApiService.fetchSetting(this.shoppingCartSettingsKey, { skipErrorHandler: true });
2658
- }
2659
- getSettingsMap() {
2660
- return this.fetchSettings().pipe(map((settings) => parseJsonSafely(settings?.value, [])), map((settings) => settings.reduce((acc, setting) => {
2661
- return { ...acc, [setting.id]: setting.properties };
2662
- }, {})));
2663
- }
2664
- }
2665
- ShoppingCartSettingsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartSettingsApiService, deps: [{ token: ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
2666
- ShoppingCartSettingsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartSettingsApiService });
2667
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartSettingsApiService, decorators: [{
2668
- type: Injectable
2669
- }], ctorParameters: function () { return [{ type: ConfigurationSettingsApiService }]; } });
2670
-
2671
- class StatefulConfigurationApiService {
2672
- constructor(httpService) {
2673
- this.httpService = httpService;
2674
- this.SERVICE_URL = '/configuration/states';
2675
- }
2676
- /**
2677
- * Initialize configuration state
2678
- * @param request Request
2679
- * @returns ID of new configuration state
2680
- */
2681
- init(request) {
2682
- return this.httpService.api({
2683
- method: 'post',
2684
- url: `${this.SERVICE_URL}/init`,
2685
- body: request,
2686
- responseType: 'text',
2687
- });
2688
- }
2689
- /**
2690
- * Get existing state by ID
2691
- * @param id ID
2692
- * @returns Configuration State
2693
- */
2694
- get(id) {
2695
- return this.httpService.api({
2696
- url: `${this.SERVICE_URL}/${id}`,
2697
- });
2698
- }
2699
- /**
2700
- * Execute actions/selectors
2701
- * @param id State ID
2702
- * @param request Request
2703
- * @returns Execute result
2704
- */
2705
- execute(id, request) {
2706
- return this.httpService.api({
491
+ createNewPortal$(body) {
492
+ return this.baseHttpService.api({
493
+ url: `${this.serviceUrl}`,
2707
494
  method: 'post',
2708
- url: `${this.SERVICE_URL}/${id}/execute`,
2709
- body: request,
495
+ body,
2710
496
  });
2711
497
  }
2712
- }
2713
- StatefulConfigurationApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2714
- StatefulConfigurationApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService });
2715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: StatefulConfigurationApiService, decorators: [{
2716
- type: Injectable
2717
- }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2718
-
2719
- class UIDefinitionsApiService {
2720
- constructor(baseHttpService) {
2721
- this.baseHttpService = baseHttpService;
2722
- }
2723
- fetch$(modelId, version) {
2724
- const serviceUrl = this.getServiceUrl(modelId);
2725
- let params = new HttpParams();
2726
- if (version != null) {
2727
- params = params.set('modelVersion', version);
2728
- }
2729
- return this.baseHttpService
2730
- .api({
2731
- method: 'get',
2732
- url: serviceUrl,
2733
- params: params,
2734
- })
2735
- .pipe(map$1(containers => containers.map(uiDefinitionFromDTO)));
2736
- }
2737
- create$(modelId, uiDefinitionContainer) {
2738
- const serviceUrl = this.getServiceUrl(modelId);
2739
- const dto = {
2740
- ...omit(uiDefinitionContainer, 'source'),
2741
- sourceBlob: JSON.stringify(uiDefinitionContainer.source),
2742
- };
2743
- return this.baseHttpService
2744
- .api({
2745
- method: 'post',
2746
- url: serviceUrl,
2747
- body: dto,
2748
- })
2749
- .pipe(map$1(container => uiDefinitionFromDTO(container)));
2750
- }
2751
- get$(modelId, uiDefinitionId) {
2752
- const serviceUrl = this.getServiceUrl(modelId);
2753
- return this.baseHttpService
2754
- .api({
2755
- method: 'get',
2756
- url: `${serviceUrl}/${uiDefinitionId}`,
2757
- })
2758
- .pipe(map$1(container => uiDefinitionFromDTO({ ...container, id: uiDefinitionId })));
2759
- }
2760
- update$(uiDefinitionContainer) {
2761
- const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
2762
- const dto = uiDefinitionToDTO(uiDefinitionContainer);
2763
- return this.baseHttpService
2764
- .api({
2765
- method: 'put',
2766
- url: `${serviceUrl}/${uiDefinitionContainer.id}`,
2767
- body: dto,
2768
- })
2769
- .pipe(map$1(container => uiDefinitionFromDTO(container)));
2770
- }
2771
- delete$(uiDefinitionContainer) {
2772
- const serviceUrl = this.getServiceUrl(uiDefinitionContainer.modelId);
498
+ updatePortal$(portal, settings) {
2773
499
  return this.baseHttpService.api({
2774
- method: 'delete',
2775
- url: `${serviceUrl}/${uiDefinitionContainer.id}`,
500
+ url: `${this.serviceUrl}/${portal.id}`,
501
+ method: 'put',
502
+ body: {
503
+ ...portal,
504
+ settings: JSON.stringify(settings),
505
+ },
2776
506
  });
2777
507
  }
2778
- getServiceUrl(modelId) {
2779
- return `/models/${modelId}/uidefinitions`;
2780
- }
2781
508
  }
2782
- UIDefinitionsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
2783
- UIDefinitionsApiServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UIDefinitionsApiService });
2784
- 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: [{
2785
513
  type: Injectable
2786
514
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
2787
515
 
2788
- const fromUIComponentStoryDTO = (dto, attachments) => {
2789
- return {
2790
- id: dto.id,
2791
- name: dto.name,
2792
- uiComponentId: dto.uiComponentId,
2793
- description: dto.description,
2794
- section: attachments.json,
2795
- template: attachments.html,
2796
- script: attachments.js,
2797
- styles: attachments.css,
2798
- };
2799
- };
2800
-
2801
- class UITemplatesApiService {
516
+ class PromotionsApiService {
2802
517
  constructor(baseHttpService) {
2803
518
  this.baseHttpService = baseHttpService;
2804
- this.serviceUrl = '/uitemplates';
2805
- this.fetchTemplates$ = (name) => {
2806
- let params = new HttpParams();
2807
- if (name) {
2808
- params = params.append('name', name);
2809
- }
2810
- return this.baseHttpService.api({ url: `${this.serviceUrl}`, params });
2811
- };
2812
- this.createTemplate$ = (template) => {
2813
- return this.baseHttpService.api({
2814
- method: 'post',
2815
- url: `${this.serviceUrl}`,
2816
- body: template,
2817
- });
2818
- };
2819
- this.updateTemplate$ = (template) => {
2820
- return this.baseHttpService.api({
2821
- method: 'put',
2822
- url: `${this.serviceUrl}/${template.id}`,
2823
- body: template,
2824
- });
2825
- };
2826
- this.duplicateTemplate$ = (template, cloneRequest) => {
2827
- return this.baseHttpService
2828
- .api({
2829
- url: `${this.serviceUrl}/${template.id}/clone`,
2830
- method: 'post',
2831
- body: cloneRequest,
2832
- })
2833
- .pipe(map$1(response => response.clonedRecordId));
519
+ this.serviceUrl = '/admin/promotion';
520
+ this.fetchAll$ = () => {
521
+ return this.baseHttpService.api({ url: this.serviceUrl });
2834
522
  };
2835
- this.removeTemplate$ = (id) => {
2836
- return this.baseHttpService.api({
2837
- method: 'delete',
2838
- url: `${this.serviceUrl}/${id}`,
2839
- });
523
+ this.fetchOne$ = (id) => {
524
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2840
525
  };
2841
- this.restoreTemplate$ = (id) => {
526
+ this.remove$ = (id) => {
2842
527
  return this.baseHttpService.api({
2843
- method: 'patch',
2844
528
  url: `${this.serviceUrl}/${id}`,
2845
- });
2846
- };
2847
- this.searchTemplates$ = (data) => {
2848
- return this.baseHttpService.api({
2849
- method: 'post',
2850
- url: `${this.serviceUrl}/search`,
2851
- params: data.params,
2852
- body: data.expression,
2853
- });
2854
- };
2855
- this.fetchComponents$ = (templateId, name) => {
2856
- let params = new HttpParams();
2857
- if (name) {
2858
- params = params.append('name', name);
2859
- }
2860
- return this.baseHttpService.api({
2861
- url: `${this.serviceUrl}/${templateId}/components`,
2862
- params,
2863
- });
2864
- };
2865
- this.fetchComponent$ = (templateId, componentId) => {
2866
- return this.baseHttpService.api({
2867
- url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
2868
- });
2869
- };
2870
- this.createComponent$ = (component) => {
2871
- return this.baseHttpService.api({
2872
- method: 'post',
2873
- url: `${this.serviceUrl}/${component.uiTemplateId}/components`,
2874
- body: component,
2875
- });
2876
- };
2877
- this.updateComponent$ = (component) => {
2878
- return this.baseHttpService.api({
2879
- method: 'put',
2880
- url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}`,
2881
- body: component,
2882
- });
2883
- };
2884
- this.duplicateComponent$ = (component, cloneRequest) => {
2885
- return this.baseHttpService
2886
- .api({
2887
- url: `${this.serviceUrl}/${component.uiTemplateId}/components/${component.id}/clone`,
2888
- method: 'post',
2889
- body: cloneRequest,
2890
- })
2891
- .pipe(map$1(response => response.clonedRecordId));
2892
- };
2893
- this.removeComponent$ = (templateId, componentId) => {
2894
- return this.baseHttpService.api({
2895
529
  method: 'delete',
2896
- url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
2897
530
  });
2898
531
  };
2899
- this.restoreComponent$ = (templateId, componentId) => {
532
+ this.restore$ = (id) => {
2900
533
  return this.baseHttpService.api({
2901
534
  method: 'patch',
2902
- url: `${this.serviceUrl}/${templateId}/components/${componentId}`,
2903
- });
2904
- };
2905
- this.searchComponents$ = (templateId, data) => {
2906
- return this.baseHttpService.api({
2907
- method: 'post',
2908
- url: `${this.serviceUrl}/${templateId}/components/search`,
2909
- params: data.params,
2910
- body: data.expression,
535
+ url: `${this.serviceUrl}/${id}/restore`,
2911
536
  });
2912
537
  };
2913
- this.fetchStoryAttachment = (templateId, componentId, storyId, type) => {
2914
- return this.baseHttpService
2915
- .api({
2916
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments/${type}/file`,
2917
- responseType: 'text',
2918
- errorHandler: noop,
2919
- })
2920
- .pipe(catchError$1(() => of('')));
2921
- };
2922
- this.convertToComponentStory$ = (templateId, componentId, storyDto) => {
2923
- return forkJoin([
2924
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'html'),
2925
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'js'),
2926
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'css'),
2927
- this.fetchStoryAttachment(templateId, componentId, storyDto.id, 'json'),
2928
- ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })), map$1(attachments => fromUIComponentStoryDTO(storyDto, attachments)));
2929
- };
2930
- this.fetchStories$ = (templateId, componentId, name) => {
2931
- let params = new HttpParams();
2932
- if (name) {
2933
- params = params.append('name', name);
2934
- }
2935
- return this.baseHttpService
2936
- .api({
2937
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories`,
2938
- params,
2939
- })
2940
- .pipe(switchMap(dtos => {
2941
- if (!dtos.length) {
2942
- return of([]);
2943
- }
2944
- return forkJoin(dtos.map(dto => this.convertToComponentStory$(templateId, componentId, dto)));
2945
- }));
2946
- };
2947
- this.fetchStory$ = (templateId, componentId, storyId) => {
538
+ this.duplicate$ = (body) => {
2948
539
  return this.baseHttpService
2949
540
  .api({
2950
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
2951
- })
2952
- .pipe(switchMap(dto => this.convertToComponentStory$(templateId, componentId, dto)));
2953
- };
2954
- this.createComponentStory$ = (templateId, story) => {
2955
- return this.baseHttpService.api({
541
+ url: `${this.serviceUrl}/${body.id}/clone`,
2956
542
  method: 'post',
2957
- url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories`,
2958
- body: story,
2959
- });
2960
- };
2961
- this.updateComponentStory$ = (templateId, story) => {
2962
- const { script, template, styles, section, ...rest } = story;
2963
- return this.baseHttpService
2964
- .api({
2965
- method: 'put',
2966
- url: `${this.serviceUrl}/${templateId}/components/${story.uiComponentId}/stories/${story.id}`,
2967
- body: rest,
543
+ body,
2968
544
  })
2969
- .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 });
2970
585
  };
2971
- this.duplicateComponentStory$ = (story, cloneRequest) => {
2972
- return this.baseHttpService
2973
- .api({
2974
- url: `${this.serviceUrl}/${story.template}/components/${story.uiComponentId}/stories/${story.id}/clone`,
2975
- method: 'post',
2976
- body: cloneRequest,
2977
- })
2978
- .pipe(map$1(response => response.clonedRecordId));
586
+ this.fetchOne$ = (id) => {
587
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
2979
588
  };
2980
- this.deleteComponentStory$ = (templateId, componentId, storyId) => {
589
+ this.remove$ = (id) => {
2981
590
  return this.baseHttpService.api({
591
+ url: `${this.serviceUrl}/${id}`,
2982
592
  method: 'delete',
2983
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
2984
593
  });
2985
594
  };
2986
- this.restoreComponentStory$ = (templateId, componentId, storyId) => {
595
+ this.restore$ = (id) => {
2987
596
  return this.baseHttpService.api({
2988
597
  method: 'patch',
2989
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}`,
2990
- });
2991
- };
2992
- this.uploadStoryAttachments$ = (templateId, componentId, storyId, attachments) => {
2993
- const formData = new FormData();
2994
- if (attachments.html != null) {
2995
- formData.append('html', new Blob([attachments.html]), 'story-template.html');
2996
- }
2997
- if (attachments.css != null) {
2998
- formData.append('css', new Blob([attachments.css]), 'story-styles.css');
2999
- }
3000
- if (attachments.js != null) {
3001
- formData.append('js', new Blob([attachments.js]), 'story-script.js');
3002
- }
3003
- if (attachments.json != null) {
3004
- formData.append('json', new Blob([attachments.json]), 'story-section.json');
3005
- }
3006
- return this.baseHttpService.upload({
3007
- method: 'post',
3008
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/stories/${storyId}/attachments`,
3009
- body: formData,
598
+ url: `${this.serviceUrl}/${id}/restore`,
3010
599
  });
3011
600
  };
3012
- this.fetchComponentAttachments$ = (templateId, component) => {
3013
- return forkJoin([
3014
- this.fetchComponentAttachmentFile$(templateId, component.id, 'html'),
3015
- this.fetchComponentAttachmentFile$(templateId, component.id, 'js'),
3016
- this.fetchComponentAttachmentFile$(templateId, component.id, 'css'),
3017
- this.fetchComponentAttachmentFile$(templateId, component.id, 'json'),
3018
- ]).pipe(map$1(([html, js, css, json]) => ({ html, js, css, json })));
3019
- };
3020
- this.fetchComponentsAttachments$ = (templateId) => {
3021
- return this.fetchComponents$(templateId).pipe(switchMap(components => {
3022
- return forkJoin(components.map(component => this.fetchComponentAttachments$(templateId, component)));
3023
- }));
3024
- };
3025
- this.fetchComponentAttachmentFile$ = (templateId, componentId, attachmentType) => {
601
+ this.duplicate$ = (body) => {
3026
602
  return this.baseHttpService
3027
603
  .api({
3028
- method: 'get',
3029
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments/${attachmentType}/file`,
3030
- responseType: 'text',
3031
- errorHandler: noop,
3032
- })
3033
- .pipe(catchError$1(() => of('')));
3034
- };
3035
- this.uploadComponentAttachments$ = (templateId, componentId, attachments) => {
3036
- const formData = new FormData();
3037
- if (attachments.html != null) {
3038
- formData.append('html', new Blob([attachments.html]), 'template.html');
3039
- }
3040
- if (attachments.css != null) {
3041
- formData.append('css', new Blob([attachments.css]), 'styles.css');
3042
- }
3043
- if (attachments.js != null) {
3044
- formData.append('js', new Blob([attachments.js]), 'script.js');
3045
- }
3046
- if (attachments.json != null) {
3047
- formData.append('json', new Blob([attachments.json]), 'section.json');
3048
- }
3049
- return this.baseHttpService.upload({
604
+ url: `${this.serviceUrl}/${body.id}/clone`,
3050
605
  method: 'post',
3051
- url: `${this.serviceUrl}/${templateId}/components/${componentId}/attachments`,
3052
- body: formData,
3053
- });
606
+ body,
607
+ })
608
+ .pipe(map(response => response.clonedRecordId));
3054
609
  };
3055
610
  }
3056
- getTemplateThumbnailUrl(templateId) {
3057
- 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 });
3058
620
  }
3059
- attachTemplateThumbnail$(templateId, file) {
3060
- const data = new FormData();
3061
- data.append('thumb', file);
3062
- return this.baseHttpService.upload({
621
+ create$(body) {
622
+ return this.baseHttpService.api({
623
+ url: `${this.serviceUrl}`,
3063
624
  method: 'post',
3064
- url: `${this.serviceUrl}/${templateId}/thumbnail`,
3065
- body: data,
625
+ body,
3066
626
  });
3067
627
  }
3068
- removeTemplateThumbnail$(templateId) {
628
+ update$(body) {
3069
629
  return this.baseHttpService.api({
3070
- method: 'delete',
3071
- url: `${this.serviceUrl}/${templateId}/thumbnail`,
630
+ url: `${this.serviceUrl}/${body.id}`,
631
+ method: 'put',
632
+ body,
3072
633
  });
3073
634
  }
3074
635
  }
3075
- UITemplatesApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3076
- UITemplatesApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UITemplatesApiService });
3077
- 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: [{
3078
639
  type: Injectable
3079
640
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3080
641
 
3081
- class VeloceObjectsApiService {
642
+ class RebateTypeApiService {
3082
643
  constructor(baseHttpService) {
3083
644
  this.baseHttpService = baseHttpService;
3084
- this.serviceUrl = '/veloceobjects';
3085
- this.updateCategory$ = (category) => {
3086
- return this.baseHttpService.api({
3087
- method: 'put',
3088
- url: `${this.serviceUrl}/categories/${category.id}`,
3089
- body: category,
3090
- });
645
+ this.serviceUrl = '/admin/rebate-type';
646
+ this.fetchAll$ = () => {
647
+ return this.baseHttpService.api({ url: this.serviceUrl });
3091
648
  };
3092
- this.deleteCategory$ = (id) => {
3093
- return this.baseHttpService.api({
3094
- method: 'delete',
3095
- url: `${this.serviceUrl}/categories/${id}`,
3096
- });
649
+ this.fetchOne$ = (id) => {
650
+ return this.baseHttpService.api({ url: `${this.serviceUrl}/${id}` });
3097
651
  };
3098
- this.searchObjects$ = (searchParams, expression) => {
3099
- const params = new HttpParams({ fromObject: { ...searchParams } });
652
+ this.remove$ = (id) => {
3100
653
  return this.baseHttpService.api({
3101
- method: 'post',
3102
- url: `${this.serviceUrl}/search`,
3103
- params,
3104
- body: expression || {},
654
+ url: `${this.serviceUrl}/${id}`,
655
+ method: 'delete',
3105
656
  });
3106
657
  };
3107
- this.deleteObject$ = (id) => {
658
+ this.restore$ = (id) => {
3108
659
  return this.baseHttpService.api({
3109
- method: 'delete',
3110
- url: `${this.serviceUrl}/${id}`,
660
+ method: 'patch',
661
+ url: `${this.serviceUrl}/${id}/restore`,
3111
662
  });
3112
663
  };
3113
- this.duplicateObject$ = (body) => {
664
+ this.duplicate$ = (body) => {
3114
665
  return this.baseHttpService
3115
666
  .api({
3116
- method: 'post',
3117
667
  url: `${this.serviceUrl}/${body.id}/clone`,
668
+ method: 'post',
3118
669
  body,
3119
670
  })
3120
671
  .pipe(map(response => response.clonedRecordId));
3121
672
  };
3122
- this.restoreObject$ = (id) => {
3123
- return this.baseHttpService.api({
3124
- method: 'patch',
3125
- url: `${this.serviceUrl}/${id}/restore`,
3126
- });
3127
- };
3128
673
  }
3129
- fetchCategories$() {
3130
- 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 });
3131
683
  }
3132
- createCategory$(category) {
684
+ create$(body) {
3133
685
  return this.baseHttpService.api({
686
+ url: `${this.serviceUrl}`,
3134
687
  method: 'post',
3135
- url: `${this.serviceUrl}/categories`,
3136
- 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,
3137
696
  });
3138
697
  }
3139
- fetchObjects$() {
3140
- 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
+ }
3141
756
  }
3142
- fetchObject$(id) {
3143
- 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
+ }
3144
766
  }
3145
- createObject$(object) {
3146
- 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({
3147
806
  method: 'post',
3148
- url: `${this.serviceUrl}`,
3149
- body: object,
807
+ url: `${this.SERVICE_URL}/init`,
808
+ body: request,
809
+ responseType: 'text',
3150
810
  });
3151
811
  }
3152
- updateObject$(object) {
3153
- return this.baseHttpService.api({
3154
- method: 'put',
3155
- url: `${this.serviceUrl}/${object.id}`,
3156
- 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,
3157
833
  });
3158
834
  }
3159
835
  }
3160
- VeloceObjectsApiService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceObjectsApiService, deps: [{ token: i1.BaseHttpService }], target: i0.ɵɵFactoryTarget.Injectable });
3161
- VeloceObjectsApiService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: VeloceObjectsApiService });
3162
- 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: [{
3163
839
  type: Injectable
3164
840
  }], ctorParameters: function () { return [{ type: i1.BaseHttpService }]; } });
3165
841
 
3166
842
  class ApiModule {
3167
843
  }
3168
844
  ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3169
- 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] });
3170
846
  ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, providers: [
3171
847
  BaseHttpService,
3172
848
  XrayService,
3173
- ConfigurationApiService,
3174
- ConfigurationSettingsApiService,
3175
- ContextApiService,
3176
- DocumentAttachmentApiService,
3177
- PriceApiService,
3178
- ProductModelApiService,
3179
- ProceduresApiService,
3180
- QuoteApiService,
3181
- RampApiService,
3182
- SalesforceApiService,
3183
- UITemplatesApiService,
3184
- ScriptsApiService,
3185
- RulesApiService,
3186
- RuleGroupsApiService,
3187
- FlowsApiService,
3188
- GuidedSellingsAdminApiService,
3189
- ShoppingCartSettingsApiService,
3190
- ProductApiService,
3191
- CatalogAdminApiService,
3192
- GuidedSellingApiService,
3193
- CatalogApiService,
3194
- DeltaApiService,
3195
849
  AccountApiService,
3196
- PicklistsApiService,
3197
- EndpointsApiService,
3198
850
  OrgInfoApiService,
3199
851
  OffersApiService,
3200
- UIDefinitionsApiService,
3201
- VeloceObjectsApiService,
3202
852
  StatefulConfigurationApiService,
3203
853
  RebateProgramApiService,
3204
854
  RebateTypeApiService,
@@ -3206,48 +856,19 @@ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
3206
856
  VeloceAuthService,
3207
857
  ContractedPriceApiService,
3208
858
  PortalsApiService,
3209
- ConfigurationProcessorsApiService,
3210
859
  FlowStateApiService,
3211
860
  SandboxManagerApiService,
3212
- RlmApiService,
3213
- RlmQuoteApiService,
3214
- ], imports: [HttpClientModule] });
861
+ ], imports: [HttpClientModule, ApiV2Module] });
3215
862
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ApiModule, decorators: [{
3216
863
  type: NgModule,
3217
864
  args: [{
3218
- imports: [HttpClientModule],
865
+ imports: [HttpClientModule, ApiV2Module],
3219
866
  providers: [
3220
867
  BaseHttpService,
3221
868
  XrayService,
3222
- ConfigurationApiService,
3223
- ConfigurationSettingsApiService,
3224
- ContextApiService,
3225
- DocumentAttachmentApiService,
3226
- PriceApiService,
3227
- ProductModelApiService,
3228
- ProceduresApiService,
3229
- QuoteApiService,
3230
- RampApiService,
3231
- SalesforceApiService,
3232
- UITemplatesApiService,
3233
- ScriptsApiService,
3234
- RulesApiService,
3235
- RuleGroupsApiService,
3236
- FlowsApiService,
3237
- GuidedSellingsAdminApiService,
3238
- ShoppingCartSettingsApiService,
3239
- ProductApiService,
3240
- CatalogAdminApiService,
3241
- GuidedSellingApiService,
3242
- CatalogApiService,
3243
- DeltaApiService,
3244
869
  AccountApiService,
3245
- PicklistsApiService,
3246
- EndpointsApiService,
3247
870
  OrgInfoApiService,
3248
871
  OffersApiService,
3249
- UIDefinitionsApiService,
3250
- VeloceObjectsApiService,
3251
872
  StatefulConfigurationApiService,
3252
873
  RebateProgramApiService,
3253
874
  RebateTypeApiService,
@@ -3255,11 +876,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3255
876
  VeloceAuthService,
3256
877
  ContractedPriceApiService,
3257
878
  PortalsApiService,
3258
- ConfigurationProcessorsApiService,
3259
879
  FlowStateApiService,
3260
880
  SandboxManagerApiService,
3261
- RlmApiService,
3262
- RlmQuoteApiService,
3263
881
  ],
3264
882
  }]
3265
883
  }] });
@@ -3268,5 +886,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3268
886
  * Generated bundle index. Do not edit.
3269
887
  */
3270
888
 
3271
- 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 };
3272
890
  //# sourceMappingURL=veloceapps-api.mjs.map