@veloceapps/api 11.0.0-8 → 11.0.0-81

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