@veloceapps/api 11.0.0-4 → 11.0.0-40

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