@veloceapps/api 11.0.0-8 → 11.0.0-81

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