@veloceapps/sdk 4.0.21-0

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 (375) hide show
  1. package/README.md +3 -0
  2. package/bundles/veloceapps-sdk-cms.umd.js +1946 -0
  3. package/bundles/veloceapps-sdk-cms.umd.js.map +1 -0
  4. package/bundles/veloceapps-sdk-core.umd.js +1671 -0
  5. package/bundles/veloceapps-sdk-core.umd.js.map +1 -0
  6. package/bundles/veloceapps-sdk-runtime.umd.js +4414 -0
  7. package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -0
  8. package/bundles/veloceapps-sdk.umd.js +3043 -0
  9. package/bundles/veloceapps-sdk.umd.js.map +1 -0
  10. package/cms/cms.actions.d.ts +22 -0
  11. package/cms/cms.default.d.ts +5 -0
  12. package/cms/cms.elements.d.ts +4 -0
  13. package/cms/components/element-children/element-children.component.d.ts +10 -0
  14. package/cms/components/element-children/element-children.module.d.ts +8 -0
  15. package/cms/components/element-renderer/element-renderer.component.d.ts +35 -0
  16. package/cms/components/element-renderer/element-renderer.module.d.ts +7 -0
  17. package/cms/components/element.component.d.ts +17 -0
  18. package/cms/components/index.d.ts +1 -0
  19. package/cms/components/plugin.component.d.ts +15 -0
  20. package/cms/components/preview/index.d.ts +2 -0
  21. package/cms/components/preview/preview.component.d.ts +34 -0
  22. package/cms/components/preview/preview.module.d.ts +11 -0
  23. package/cms/decorators/element.decorator.d.ts +2 -0
  24. package/cms/decorators/index.d.ts +1 -0
  25. package/cms/directives/custom-template.directive.d.ts +12 -0
  26. package/cms/engine/models/entity.d.ts +11 -0
  27. package/cms/engine/models/plugin.d.ts +5 -0
  28. package/cms/index.d.ts +11 -0
  29. package/cms/injection-tokens.d.ts +11 -0
  30. package/cms/launcher.module.d.ts +10 -0
  31. package/cms/modules/federated/default-options.d.ts +4 -0
  32. package/cms/modules/federated/export.d.ts +1 -0
  33. package/cms/modules/federated/federated.component.d.ts +26 -0
  34. package/cms/modules/federated/federated.module.d.ts +9 -0
  35. package/cms/modules/federated/federated.types.d.ts +30 -0
  36. package/cms/modules/federated/federated.utils.d.ts +1 -0
  37. package/cms/package.json +10 -0
  38. package/cms/plugins/configuration.plugin.d.ts +23 -0
  39. package/cms/plugins/io.plugin.d.ts +9 -0
  40. package/cms/plugins/script.plugin.d.ts +13 -0
  41. package/cms/services/dynamic-module.service.d.ts +15 -0
  42. package/cms/services/element-context.service.d.ts +8 -0
  43. package/cms/services/index.d.ts +3 -0
  44. package/cms/services/integration.state.d.ts +17 -0
  45. package/cms/services/io-provider.service.d.ts +15 -0
  46. package/cms/services/launcher.service.d.ts +18 -0
  47. package/cms/services/templates.service.d.ts +14 -0
  48. package/cms/types/common.types.d.ts +103 -0
  49. package/cms/types/configuration.types.d.ts +20 -0
  50. package/cms/types/elements.types.d.ts +2 -0
  51. package/cms/types/index.d.ts +5 -0
  52. package/cms/types/integration.types.d.ts +4 -0
  53. package/cms/types/path.types.d.ts +11 -0
  54. package/cms/utils/element.utils.d.ts +15 -0
  55. package/cms/utils/elements-resolver.d.ts +20 -0
  56. package/cms/utils/index.d.ts +3 -0
  57. package/cms/utils/path.utils.d.ts +5 -0
  58. package/cms/veloceapps-sdk-cms.d.ts +5 -0
  59. package/cms/vendor-map.d.ts +707 -0
  60. package/core/core.module.d.ts +8 -0
  61. package/core/index.d.ts +6 -0
  62. package/core/modules/configuration/configuration.module.d.ts +7 -0
  63. package/core/modules/configuration/helpers.d.ts +3 -0
  64. package/core/modules/configuration/index.d.ts +4 -0
  65. package/core/modules/configuration/services/configuration-runtime.service.d.ts +29 -0
  66. package/core/modules/configuration/services/configuration.service.d.ts +45 -0
  67. package/core/modules/configuration/services/runtime-context.service.d.ts +12 -0
  68. package/core/modules/configuration/types/configuration-runtime.types.d.ts +7 -0
  69. package/core/modules/flow-configuration/flow-configuration.module.d.ts +6 -0
  70. package/core/modules/flow-configuration/index.d.ts +4 -0
  71. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +38 -0
  72. package/core/modules/flow-configuration/services/flow-update.service.d.ts +12 -0
  73. package/core/modules/flow-configuration/types/update.types.d.ts +12 -0
  74. package/core/modules/index.d.ts +2 -0
  75. package/core/package.json +10 -0
  76. package/core/services/context.service.d.ts +18 -0
  77. package/core/services/index.d.ts +3 -0
  78. package/core/services/product-images.service.d.ts +12 -0
  79. package/core/services/quote-draft.service.d.ts +60 -0
  80. package/core/types/index.d.ts +3 -0
  81. package/core/types/quote-states.types.d.ts +6 -0
  82. package/core/types/runtime.types.d.ts +31 -0
  83. package/core/types/ui-definition.types.d.ts +26 -0
  84. package/core/utils/index.d.ts +2 -0
  85. package/core/utils/line-item.utils.d.ts +26 -0
  86. package/core/utils/line-item.worker.d.ts +12 -0
  87. package/core/veloceapps-sdk-core.d.ts +5 -0
  88. package/esm2015/cms/cms.actions.js +37 -0
  89. package/esm2015/cms/cms.default.js +6 -0
  90. package/esm2015/cms/cms.elements.js +29 -0
  91. package/esm2015/cms/components/element-children/element-children.component.js +23 -0
  92. package/esm2015/cms/components/element-children/element-children.module.js +18 -0
  93. package/esm2015/cms/components/element-renderer/element-renderer.component.js +143 -0
  94. package/esm2015/cms/components/element-renderer/element-renderer.module.js +16 -0
  95. package/esm2015/cms/components/element.component.js +44 -0
  96. package/esm2015/cms/components/index.js +2 -0
  97. package/esm2015/cms/components/plugin.component.js +16 -0
  98. package/esm2015/cms/components/preview/index.js +3 -0
  99. package/esm2015/cms/components/preview/preview.component.js +105 -0
  100. package/esm2015/cms/components/preview/preview.module.js +23 -0
  101. package/esm2015/cms/decorators/element.decorator.js +6 -0
  102. package/esm2015/cms/decorators/index.js +2 -0
  103. package/esm2015/cms/directives/custom-template.directive.js +25 -0
  104. package/esm2015/cms/engine/models/entity.js +18 -0
  105. package/esm2015/cms/engine/models/plugin.js +6 -0
  106. package/esm2015/cms/index.js +11 -0
  107. package/esm2015/cms/injection-tokens.js +8 -0
  108. package/esm2015/cms/launcher.module.js +23 -0
  109. package/esm2015/cms/modules/federated/default-options.js +5 -0
  110. package/esm2015/cms/modules/federated/export.js +2 -0
  111. package/esm2015/cms/modules/federated/federated.component.js +82 -0
  112. package/esm2015/cms/modules/federated/federated.module.js +19 -0
  113. package/esm2015/cms/modules/federated/federated.types.js +2 -0
  114. package/esm2015/cms/modules/federated/federated.utils.js +37 -0
  115. package/esm2015/cms/plugins/configuration.plugin.js +98 -0
  116. package/esm2015/cms/plugins/io.plugin.js +37 -0
  117. package/esm2015/cms/plugins/script.plugin.js +66 -0
  118. package/esm2015/cms/services/dynamic-module.service.js +33 -0
  119. package/esm2015/cms/services/element-context.service.js +10 -0
  120. package/esm2015/cms/services/index.js +4 -0
  121. package/esm2015/cms/services/integration.state.js +40 -0
  122. package/esm2015/cms/services/io-provider.service.js +51 -0
  123. package/esm2015/cms/services/launcher.service.js +57 -0
  124. package/esm2015/cms/services/templates.service.js +31 -0
  125. package/esm2015/cms/types/common.types.js +2 -0
  126. package/esm2015/cms/types/configuration.types.js +2 -0
  127. package/esm2015/cms/types/elements.types.js +2 -0
  128. package/esm2015/cms/types/index.js +6 -0
  129. package/esm2015/cms/types/integration.types.js +2 -0
  130. package/esm2015/cms/types/path.types.js +2 -0
  131. package/esm2015/cms/utils/element.utils.js +149 -0
  132. package/esm2015/cms/utils/elements-resolver.js +108 -0
  133. package/esm2015/cms/utils/index.js +4 -0
  134. package/esm2015/cms/utils/path.utils.js +67 -0
  135. package/esm2015/cms/veloceapps-sdk-cms.js +5 -0
  136. package/esm2015/cms/vendor-map.js +39 -0
  137. package/esm2015/core/core.module.js +18 -0
  138. package/esm2015/core/index.js +7 -0
  139. package/esm2015/core/modules/configuration/configuration.module.js +34 -0
  140. package/esm2015/core/modules/configuration/helpers.js +10 -0
  141. package/esm2015/core/modules/configuration/index.js +5 -0
  142. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +92 -0
  143. package/esm2015/core/modules/configuration/services/configuration.service.js +173 -0
  144. package/esm2015/core/modules/configuration/services/runtime-context.service.js +51 -0
  145. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +2 -0
  146. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +18 -0
  147. package/esm2015/core/modules/flow-configuration/index.js +5 -0
  148. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +135 -0
  149. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +129 -0
  150. package/esm2015/core/modules/flow-configuration/types/update.types.js +2 -0
  151. package/esm2015/core/modules/index.js +3 -0
  152. package/esm2015/core/services/context.service.js +50 -0
  153. package/esm2015/core/services/index.js +4 -0
  154. package/esm2015/core/services/product-images.service.js +30 -0
  155. package/esm2015/core/services/quote-draft.service.js +201 -0
  156. package/esm2015/core/types/index.js +4 -0
  157. package/esm2015/core/types/quote-states.types.js +2 -0
  158. package/esm2015/core/types/runtime.types.js +16 -0
  159. package/esm2015/core/types/ui-definition.types.js +2 -0
  160. package/esm2015/core/utils/index.js +3 -0
  161. package/esm2015/core/utils/line-item.utils.js +100 -0
  162. package/esm2015/core/utils/line-item.worker.js +19 -0
  163. package/esm2015/core/veloceapps-sdk-core.js +5 -0
  164. package/esm2015/index.js +2 -0
  165. package/esm2015/runtime/components/component-preview/component-preview.component.js +125 -0
  166. package/esm2015/runtime/components/index.js +5 -0
  167. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +71 -0
  168. package/esm2015/runtime/components/ui-runtime/runtime.component.js +427 -0
  169. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +109 -0
  170. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +68 -0
  171. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +36 -0
  172. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +72 -0
  173. package/esm2015/runtime/execution/components/federated/federated.component.js +81 -0
  174. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +65 -0
  175. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +136 -0
  176. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +80 -0
  177. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +101 -0
  178. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +150 -0
  179. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +121 -0
  180. package/esm2015/runtime/execution/directives/section-script.directive.js +242 -0
  181. package/esm2015/runtime/execution/directives/sf-query.directive.js +34 -0
  182. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +86 -0
  183. package/esm2015/runtime/execution/directives/velo-port.directive.js +373 -0
  184. package/esm2015/runtime/execution/directives/vl-approval.directive.js +22 -0
  185. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +35 -0
  186. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +59 -0
  187. package/esm2015/runtime/execution/directives/vl-quote.directive.js +41 -0
  188. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +51 -0
  189. package/esm2015/runtime/execution/runtime-execution.module.js +163 -0
  190. package/esm2015/runtime/execution/utils/federated.util.js +37 -0
  191. package/esm2015/runtime/index.js +5 -0
  192. package/esm2015/runtime/runtime.module.js +104 -0
  193. package/esm2015/runtime/services/cart.service.js +27 -0
  194. package/esm2015/runtime/services/collapsible-state.service.js +34 -0
  195. package/esm2015/runtime/services/configuration.service.js +102 -0
  196. package/esm2015/runtime/services/current-state.service.js +17 -0
  197. package/esm2015/runtime/services/form-scope.service.js +30 -0
  198. package/esm2015/runtime/services/index.js +4 -0
  199. package/esm2015/runtime/services/product-model-cache.service.js +30 -0
  200. package/esm2015/runtime/services/runtime-context.service.js +56 -0
  201. package/esm2015/runtime/services/runtime-form.service.js +224 -0
  202. package/esm2015/runtime/services/runtime.service.js +108 -0
  203. package/esm2015/runtime/services/section-helper.service.js +27 -0
  204. package/esm2015/runtime/services/section-scope.service.js +36 -0
  205. package/esm2015/runtime/services/section-store.service.js +22 -0
  206. package/esm2015/runtime/services/section.service.js +124 -0
  207. package/esm2015/runtime/types/bound-data.types.js +7 -0
  208. package/esm2015/runtime/types/index.js +2 -0
  209. package/esm2015/runtime/types/runtime.types.js +2 -0
  210. package/esm2015/runtime/types/script-registry.types.js +51 -0
  211. package/esm2015/runtime/utils/line-item.util.js +273 -0
  212. package/esm2015/runtime/utils/section.utils.js +26 -0
  213. package/esm2015/runtime/utils/sections-binder.helper.js +105 -0
  214. package/esm2015/runtime/veloceapps-sdk-runtime.js +5 -0
  215. package/esm2015/src/components/dialog/dialog.component.js +30 -0
  216. package/esm2015/src/components/dialog/dialog.module.js +19 -0
  217. package/esm2015/src/components/dialog/dialog.types.js +2 -0
  218. package/esm2015/src/components/doc-gen/doc-gen.component.js +109 -0
  219. package/esm2015/src/components/doc-gen/doc-gen.module.js +19 -0
  220. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +122 -0
  221. package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +46 -0
  222. package/esm2015/src/components/header/header.component.js +284 -0
  223. package/esm2015/src/components/header/header.module.js +46 -0
  224. package/esm2015/src/components/header/header.types.js +2 -0
  225. package/esm2015/src/constants.js +2 -0
  226. package/esm2015/src/flow-routing.module.js +137 -0
  227. package/esm2015/src/flow.component.js +45 -0
  228. package/esm2015/src/flow.module.js +60 -0
  229. package/esm2015/src/guards/context.guard.js +84 -0
  230. package/esm2015/src/guards/index.js +2 -0
  231. package/esm2015/src/guards/product-unload.guard.js +43 -0
  232. package/esm2015/src/guards/root.guard.js +41 -0
  233. package/esm2015/src/index.js +7 -0
  234. package/esm2015/src/pages/catalog/catalog.component.js +117 -0
  235. package/esm2015/src/pages/catalog/catalog.module.js +20 -0
  236. package/esm2015/src/pages/debug/debug.component.js +61 -0
  237. package/esm2015/src/pages/debug/debug.module.js +48 -0
  238. package/esm2015/src/pages/empty-account/empty-account.component.js +17 -0
  239. package/esm2015/src/pages/empty-account/empty-account.module.js +20 -0
  240. package/esm2015/src/pages/legacy-product/legacy-product.component.js +132 -0
  241. package/esm2015/src/pages/legacy-product/legacy-product.module.js +21 -0
  242. package/esm2015/src/pages/product/product.component.js +108 -0
  243. package/esm2015/src/pages/product/product.module.js +20 -0
  244. package/esm2015/src/pages/record-not-found/record-not-found.component.js +29 -0
  245. package/esm2015/src/pages/record-not-found/record-not-found.module.js +20 -0
  246. package/esm2015/src/pages/remote/remote.component.js +353 -0
  247. package/esm2015/src/pages/remote/remote.module.js +20 -0
  248. package/esm2015/src/pages/remote/remote.types.js +2 -0
  249. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +117 -0
  250. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +20 -0
  251. package/esm2015/src/resolvers/flow.resolver.js +62 -0
  252. package/esm2015/src/resolvers/quote.resolver.js +74 -0
  253. package/esm2015/src/services/doc-gen.service.js +33 -0
  254. package/esm2015/src/services/flow-dialog.service.js +123 -0
  255. package/esm2015/src/services/flow-router.service.js +124 -0
  256. package/esm2015/src/services/flow.service.js +71 -0
  257. package/esm2015/src/services/index.js +2 -0
  258. package/esm2015/src/types/context-route.types.js +2 -0
  259. package/esm2015/src/types/flow-customization.types.js +3 -0
  260. package/esm2015/src/types/index.js +3 -0
  261. package/esm2015/src/types/route.types.js +2 -0
  262. package/esm2015/src/utils/flow.utils.js +22 -0
  263. package/esm2015/src/utils/index.js +2 -0
  264. package/esm2015/veloceapps-sdk.js +5 -0
  265. package/fesm2015/veloceapps-sdk-cms.js +1357 -0
  266. package/fesm2015/veloceapps-sdk-cms.js.map +1 -0
  267. package/fesm2015/veloceapps-sdk-core.js +1029 -0
  268. package/fesm2015/veloceapps-sdk-core.js.map +1 -0
  269. package/fesm2015/veloceapps-sdk-runtime.js +3894 -0
  270. package/fesm2015/veloceapps-sdk-runtime.js.map +1 -0
  271. package/fesm2015/veloceapps-sdk.js +2449 -0
  272. package/fesm2015/veloceapps-sdk.js.map +1 -0
  273. package/index.d.ts +1 -0
  274. package/package.json +50 -0
  275. package/runtime/components/component-preview/component-preview.component.d.ts +27 -0
  276. package/runtime/components/index.d.ts +4 -0
  277. package/runtime/components/section-renderer/section-renderer.component.d.ts +25 -0
  278. package/runtime/components/ui-runtime/runtime.component.d.ts +53 -0
  279. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +27 -0
  280. package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +30 -0
  281. package/runtime/execution/components/context-provider/context-provider.component.d.ts +14 -0
  282. package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +25 -0
  283. package/runtime/execution/components/federated/federated.component.d.ts +36 -0
  284. package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +19 -0
  285. package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +35 -0
  286. package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +22 -0
  287. package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +22 -0
  288. package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +28 -0
  289. package/runtime/execution/components/velo-type/velo-type.component.d.ts +31 -0
  290. package/runtime/execution/directives/section-script.directive.d.ts +59 -0
  291. package/runtime/execution/directives/sf-query.directive.d.ts +15 -0
  292. package/runtime/execution/directives/velo-attribute.directive.d.ts +26 -0
  293. package/runtime/execution/directives/velo-port.directive.d.ts +74 -0
  294. package/runtime/execution/directives/vl-approval.directive.d.ts +10 -0
  295. package/runtime/execution/directives/vl-document-attachments.directive.d.ts +15 -0
  296. package/runtime/execution/directives/vl-document-templates.directive.d.ts +33 -0
  297. package/runtime/execution/directives/vl-quote.directive.d.ts +14 -0
  298. package/runtime/execution/directives/vl-ramp.directive.d.ts +15 -0
  299. package/runtime/execution/runtime-execution.module.d.ts +27 -0
  300. package/runtime/execution/utils/federated.util.d.ts +6 -0
  301. package/runtime/index.d.ts +4 -0
  302. package/runtime/package.json +10 -0
  303. package/runtime/runtime.module.d.ts +18 -0
  304. package/runtime/services/cart.service.d.ts +15 -0
  305. package/runtime/services/collapsible-state.service.d.ts +15 -0
  306. package/runtime/services/configuration.service.d.ts +19 -0
  307. package/runtime/services/current-state.service.d.ts +8 -0
  308. package/runtime/services/form-scope.service.d.ts +20 -0
  309. package/runtime/services/index.d.ts +3 -0
  310. package/runtime/services/product-model-cache.service.d.ts +14 -0
  311. package/runtime/services/runtime-context.service.d.ts +16 -0
  312. package/runtime/services/runtime-form.service.d.ts +24 -0
  313. package/runtime/services/runtime.service.d.ts +43 -0
  314. package/runtime/services/section-helper.service.d.ts +8 -0
  315. package/runtime/services/section-scope.service.d.ts +14 -0
  316. package/runtime/services/section-store.service.d.ts +11 -0
  317. package/runtime/services/section.service.d.ts +30 -0
  318. package/runtime/types/bound-data.types.d.ts +13 -0
  319. package/runtime/types/index.d.ts +1 -0
  320. package/runtime/types/runtime.types.d.ts +19 -0
  321. package/runtime/types/script-registry.types.d.ts +13 -0
  322. package/runtime/utils/line-item.util.d.ts +34 -0
  323. package/runtime/utils/section.utils.d.ts +2 -0
  324. package/runtime/utils/sections-binder.helper.d.ts +16 -0
  325. package/runtime/veloceapps-sdk-runtime.d.ts +5 -0
  326. package/src/components/dialog/dialog.component.d.ts +13 -0
  327. package/src/components/dialog/dialog.module.d.ts +9 -0
  328. package/src/components/dialog/dialog.types.d.ts +6 -0
  329. package/src/components/doc-gen/doc-gen.component.d.ts +26 -0
  330. package/src/components/doc-gen/doc-gen.module.d.ts +9 -0
  331. package/src/components/header/cart-overlay/cart-preview.component.d.ts +36 -0
  332. package/src/components/header/cart-overlay/cart-preview.module.d.ts +14 -0
  333. package/src/components/header/header.component.d.ts +63 -0
  334. package/src/components/header/header.module.d.ts +14 -0
  335. package/src/components/header/header.types.d.ts +20 -0
  336. package/src/constants.d.ts +1 -0
  337. package/src/flow-routing.module.d.ts +13 -0
  338. package/src/flow.component.d.ts +23 -0
  339. package/src/flow.module.d.ts +16 -0
  340. package/src/guards/context.guard.d.ts +19 -0
  341. package/src/guards/index.d.ts +1 -0
  342. package/src/guards/product-unload.guard.d.ts +16 -0
  343. package/src/guards/root.guard.d.ts +15 -0
  344. package/src/index.d.ts +6 -0
  345. package/src/pages/catalog/catalog.component.d.ts +32 -0
  346. package/src/pages/catalog/catalog.module.d.ts +10 -0
  347. package/src/pages/debug/debug.component.d.ts +25 -0
  348. package/src/pages/debug/debug.module.d.ts +14 -0
  349. package/src/pages/empty-account/empty-account.component.d.ts +5 -0
  350. package/src/pages/empty-account/empty-account.module.d.ts +10 -0
  351. package/src/pages/legacy-product/legacy-product.component.d.ts +37 -0
  352. package/src/pages/legacy-product/legacy-product.module.d.ts +10 -0
  353. package/src/pages/product/product.component.d.ts +32 -0
  354. package/src/pages/product/product.module.d.ts +10 -0
  355. package/src/pages/record-not-found/record-not-found.component.d.ts +11 -0
  356. package/src/pages/record-not-found/record-not-found.module.d.ts +9 -0
  357. package/src/pages/remote/remote.component.d.ts +47 -0
  358. package/src/pages/remote/remote.module.d.ts +10 -0
  359. package/src/pages/remote/remote.types.d.ts +4 -0
  360. package/src/pages/shopping-cart/shopping-cart.component.d.ts +32 -0
  361. package/src/pages/shopping-cart/shopping-cart.module.d.ts +10 -0
  362. package/src/resolvers/flow.resolver.d.ts +16 -0
  363. package/src/resolvers/quote.resolver.d.ts +20 -0
  364. package/src/services/doc-gen.service.d.ts +13 -0
  365. package/src/services/flow-dialog.service.d.ts +26 -0
  366. package/src/services/flow-router.service.d.ts +35 -0
  367. package/src/services/flow.service.d.ts +17 -0
  368. package/src/services/index.d.ts +1 -0
  369. package/src/types/context-route.types.d.ts +5 -0
  370. package/src/types/flow-customization.types.d.ts +11 -0
  371. package/src/types/index.d.ts +2 -0
  372. package/src/types/route.types.d.ts +9 -0
  373. package/src/utils/flow.utils.d.ts +8 -0
  374. package/src/utils/index.d.ts +1 -0
  375. package/veloceapps-sdk.d.ts +5 -0
@@ -0,0 +1,1029 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
3
+ import { UUID, ConfigurationContext, ConfigurationContextMode, RuntimeModel, SalesforceIdUtils, ConfigurationMode, ChargeGroupUtils } from '@veloceapps/core';
4
+ import { BehaviorSubject, map as map$1, distinctUntilChanged, catchError, of, tap as tap$1, zip, noop, combineLatest, throwError, shareReplay as shareReplay$1, switchMap as switchMap$1 } from 'rxjs';
5
+ import { filter, tap, map, switchMap, skip, take, shareReplay, first, catchError as catchError$1, finalize } from 'rxjs/operators';
6
+ import * as i1 from '@veloceapps/api';
7
+ import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
8
+ import { merge, flatten, sortBy, cloneDeep } from 'lodash';
9
+ import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
10
+ import * as i4 from 'primeng/api';
11
+ import * as i5 from 'primeng/dynamicdialog';
12
+ import moment from 'moment';
13
+
14
+ const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
15
+ var _a, _b, _c;
16
+ const id = UUID.UUID();
17
+ const lineItem = Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
18
+ ? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
19
+ : {}));
20
+ return lineItem;
21
+ };
22
+
23
+ var RuntimeMode;
24
+ (function (RuntimeMode) {
25
+ RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
26
+ RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
27
+ })(RuntimeMode || (RuntimeMode = {}));
28
+ var RuntimeOperation;
29
+ (function (RuntimeOperation) {
30
+ RuntimeOperation["INIT"] = "INIT";
31
+ RuntimeOperation["UPDATE"] = "UPDATE";
32
+ })(RuntimeOperation || (RuntimeOperation = {}));
33
+ var RuntimeStep;
34
+ (function (RuntimeStep) {
35
+ RuntimeStep["START"] = "START";
36
+ RuntimeStep["UPDATE"] = "UPDATE";
37
+ })(RuntimeStep || (RuntimeStep = {}));
38
+
39
+ class ContextService {
40
+ constructor(contextApiService) {
41
+ this.contextApiService = contextApiService;
42
+ this.context = new BehaviorSubject(null);
43
+ }
44
+ get isInitialized() {
45
+ return Boolean(this.context.value);
46
+ }
47
+ resolve() {
48
+ if (!this.context.value) {
49
+ throw new Error('Context is not initialized yet!');
50
+ }
51
+ return Object.assign({}, this.context.value);
52
+ }
53
+ resolve$() {
54
+ return this.context.pipe(filter((ctx) => Boolean(ctx)));
55
+ }
56
+ create(headerId, mode) {
57
+ return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
58
+ }
59
+ update(partialContext) {
60
+ const originalContext = this.resolve();
61
+ const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
62
+ this.context.next(updatedContext);
63
+ return updatedContext;
64
+ }
65
+ set(context) {
66
+ const originalContext = this.resolve();
67
+ const updatedContext = Object.assign(Object.assign({}, originalContext), context);
68
+ this.context.next(updatedContext);
69
+ return updatedContext;
70
+ }
71
+ delete() {
72
+ this.context.next(null);
73
+ }
74
+ }
75
+ ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
76
+ ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextService, providedIn: 'root' });
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextService, decorators: [{
78
+ type: Injectable,
79
+ args: [{ providedIn: 'root' }]
80
+ }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
81
+
82
+ class ProductImagesService {
83
+ constructor(productApiService) {
84
+ this.productApiService = productApiService;
85
+ this.imagesMap$ = new BehaviorSubject({});
86
+ }
87
+ getImageUrl$(productId) {
88
+ if (this.imagesMap$.value[productId] == null) {
89
+ this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
90
+ this.fetchProductImage(productId);
91
+ }
92
+ return this.imagesMap$.pipe(map$1(imagesMap => imagesMap[productId]), distinctUntilChanged());
93
+ }
94
+ fetchProductImage(productId) {
95
+ this.productApiService
96
+ .fetchImage$(productId)
97
+ .pipe(map$1(file => URL.createObjectURL(file)), catchError(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
98
+ .subscribe();
99
+ }
100
+ }
101
+ ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
102
+ ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductImagesService, decorators: [{
104
+ type: Injectable,
105
+ args: [{ providedIn: 'root' }]
106
+ }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
107
+
108
+ class QuoteDraftService {
109
+ constructor(context, quoteApiService, priceApiService) {
110
+ this.context = context;
111
+ this.quoteApiService = quoteApiService;
112
+ this.priceApiService = priceApiService;
113
+ this.quoteSubj$ = new BehaviorSubject(null);
114
+ this.resetSubj$ = new BehaviorSubject(true);
115
+ this.isInitializedSubj$ = new BehaviorSubject(false);
116
+ this.allPriceLists = [];
117
+ this.assetPriceLists = [];
118
+ this.hasUnsavedChanges = false;
119
+ this.reset$ = this.resetSubj$.asObservable();
120
+ this.activePriceList$ = this.context.resolve$().pipe(map(ctx => this.allPriceLists.find(priceList => priceList.id === ctx.properties.PriceListId)), map(priceList => priceList !== null && priceList !== void 0 ? priceList : null));
121
+ this.isInitializedSubj$
122
+ .pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
123
+ .subscribe();
124
+ }
125
+ get isInitialized() {
126
+ return this.isInitializedSubj$.getValue();
127
+ }
128
+ set isInitialized(value) {
129
+ if (this.isInitialized !== value) {
130
+ this.isInitializedSubj$.next(value);
131
+ }
132
+ }
133
+ get hasAssets$() {
134
+ return this.quoteSubj$.pipe(map(() => this.hasAssets));
135
+ }
136
+ get hasAssets() {
137
+ const quoteDraft = this.quoteSubj$.value;
138
+ return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
139
+ }
140
+ reset() {
141
+ this.resetSubj$.next(true);
142
+ this.quoteSubj$.next(null);
143
+ }
144
+ init(quoteId, params) {
145
+ return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(tap(([quote, allPriceLists]) => {
146
+ this.allPriceLists = allPriceLists;
147
+ this.quoteSubj$.next(quote);
148
+ this.context.update(quote.context);
149
+ this.populateActivePriceLists$();
150
+ }), map(() => noop()), take(1));
151
+ }
152
+ setCurrentLineItemState(lineItems) {
153
+ const quoteDraft = this.quoteSubj$.value;
154
+ if (!quoteDraft) {
155
+ return;
156
+ }
157
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
158
+ }
159
+ updateQuoteDraft(update) {
160
+ const quoteDraft = this.quoteSubj$.value;
161
+ if (!quoteDraft) {
162
+ return;
163
+ }
164
+ if (update.context) {
165
+ this.context.set(update.context);
166
+ }
167
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
168
+ }
169
+ updateByPriceSummary(priceSummary) {
170
+ const quoteDraft = this.quoteSubj$.value;
171
+ if (!quoteDraft) {
172
+ return;
173
+ }
174
+ const updatedCurrentState = this.currentState.map(lineItem => {
175
+ const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
176
+ return updated !== null && updated !== void 0 ? updated : lineItem;
177
+ });
178
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
179
+ }
180
+ get quoteDraft$() {
181
+ return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
182
+ }
183
+ get quoteDraft() {
184
+ const quote = this.quoteSubj$.value;
185
+ if (!quote) {
186
+ return null;
187
+ }
188
+ return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
189
+ }
190
+ get quoteDraftForActivePriceList() {
191
+ const quoteDraft = this.quoteDraft;
192
+ if (!quoteDraft) {
193
+ return null;
194
+ }
195
+ return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
196
+ }
197
+ get currentState$() {
198
+ return this.quoteDraft$.pipe(map(quote => quote.currentState));
199
+ }
200
+ get currentState() {
201
+ var _a, _b;
202
+ return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
203
+ }
204
+ /**
205
+ * Stream of activeCurrentState
206
+ */
207
+ get activeCurrentState$() {
208
+ return this.quoteDraft$.pipe(map(() => this.activeCurrentState));
209
+ }
210
+ /**
211
+ * activeCurrentState is currentState passed through additional filters
212
+ */
213
+ get activeCurrentState() {
214
+ var _a, _b;
215
+ let currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
216
+ currentState = this.filterByActivePriceList(currentState);
217
+ return currentState;
218
+ }
219
+ /**
220
+ * Stream of activeInitialState
221
+ */
222
+ get activeInitialState$() {
223
+ return this.quoteDraft$.pipe(map(() => this.activeInitialState));
224
+ }
225
+ /**
226
+ * activeInitialState is initialState passed through additional filters
227
+ */
228
+ get activeInitialState() {
229
+ var _a, _b;
230
+ const ctx = this.context.resolve();
231
+ let initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
232
+ if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
233
+ initialState = this.filterByActivePriceList(initialState);
234
+ }
235
+ return initialState;
236
+ }
237
+ get isStandalone() {
238
+ return this.context.resolve().properties.standalone === 'true';
239
+ }
240
+ get isStandalone$() {
241
+ return this.context.resolve$().pipe(map(() => this.isStandalone));
242
+ }
243
+ isEditMode$() {
244
+ return this.context.resolve$().pipe(map(() => this.isEditMode()));
245
+ }
246
+ isEditMode() {
247
+ const context = this.context.resolve();
248
+ if (context.mode === ConfigurationContextMode.ACCOUNT) {
249
+ return true;
250
+ }
251
+ if (context.mode === ConfigurationContextMode.QUOTE) {
252
+ return context.properties.Status === 'Draft';
253
+ }
254
+ return false;
255
+ }
256
+ updateActivePriceList(priceListId) {
257
+ this.context.update({ properties: { PriceListId: priceListId } });
258
+ }
259
+ populateActivePriceLists$() {
260
+ const ctx = this.context.resolve();
261
+ const quoteDraft = this.quoteDraft;
262
+ if (!quoteDraft) {
263
+ return;
264
+ }
265
+ // In ACCOUNT mode populate price lists from related assets
266
+ if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
267
+ // Populate list of price lists
268
+ this.assetPriceLists = quoteDraft.currentState
269
+ .map(({ priceListId }) => priceListId)
270
+ .reduce((trunk, priceListId) => {
271
+ var _a, _b;
272
+ if (!priceListId || trunk.some(item => item.id === priceListId)) {
273
+ return trunk;
274
+ }
275
+ return [
276
+ ...trunk,
277
+ { id: priceListId, name: (_b = (_a = this.allPriceLists.find(item => item.id === priceListId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
278
+ ];
279
+ }, []);
280
+ }
281
+ }
282
+ filterByActivePriceList(lineItems) {
283
+ const ctx = this.context.resolve();
284
+ return lineItems.filter(li => !li.priceListId || li.priceListId === ctx.properties.PriceListId);
285
+ }
286
+ markAsUpdated(quote) {
287
+ if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === ConfigurationContextMode.ACCOUNT) {
288
+ this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
289
+ }
290
+ else {
291
+ this.hasUnsavedChanges = true;
292
+ }
293
+ }
294
+ }
295
+ QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
296
+ QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteDraftService, decorators: [{
298
+ type: Injectable,
299
+ args: [{ providedIn: 'root' }]
300
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
301
+
302
+ class RuntimeContextService {
303
+ constructor(configurationApiService) {
304
+ this.configurationApiService = configurationApiService;
305
+ }
306
+ getRuntimeContext(productId, offeringId) {
307
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
308
+ var _a, _b, _c;
309
+ const uiDefinition = this.getUIDefinition(runtimeData);
310
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
311
+ const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
312
+ return {
313
+ modelId: runtimeData.modelId,
314
+ uiDefinition: uiDefinition,
315
+ runtimeModel: runtimeModel,
316
+ runtimeMode: RuntimeMode.PROD,
317
+ productId: productId,
318
+ productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
319
+ offeringId: offeringId,
320
+ properties: {
321
+ PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
322
+ PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
323
+ },
324
+ };
325
+ }));
326
+ }
327
+ getUIDefinition(runtimeData) {
328
+ var _a;
329
+ let rawUiDefinitions;
330
+ try {
331
+ rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
332
+ }
333
+ catch (e) {
334
+ return;
335
+ }
336
+ const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
337
+ const uiDefinition = (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[0];
338
+ return uiDefinition;
339
+ }
340
+ }
341
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
342
+ RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuntimeContextService });
343
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuntimeContextService, decorators: [{
344
+ type: Injectable
345
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
346
+
347
+ class ConfigurationRuntimeService {
348
+ constructor(apiService, contextService, runtimeContextService) {
349
+ this.apiService = apiService;
350
+ this.contextService = contextService;
351
+ this.runtimeContextService = runtimeContextService;
352
+ this._isInitialized = false;
353
+ this.uiDefinitionProperties = {};
354
+ }
355
+ reset() {
356
+ this._isInitialized = false;
357
+ this._runtimeContext = undefined;
358
+ this._assets = undefined;
359
+ this.initializationProps = undefined;
360
+ this.uiDefinitionProperties = {};
361
+ }
362
+ initTestMode(modelId, uiDefinition) {
363
+ var _a, _b;
364
+ this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
365
+ const uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
366
+ return combineLatest([
367
+ this.apiService.getRuntimeDataByModelId(modelId),
368
+ this.contextService.create('TestId', ConfigurationContextMode.TEST),
369
+ ]).pipe(first(), tap(([runtimeData, context]) => {
370
+ var _a;
371
+ this._runtimeContext = {
372
+ modelId: modelId,
373
+ runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
374
+ runtimeMode: RuntimeMode.TEST,
375
+ };
376
+ this.contextService.update({
377
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
378
+ });
379
+ this._isInitialized = true;
380
+ }));
381
+ }
382
+ init(props) {
383
+ this.initializationProps = props;
384
+ this._assets = props.assets;
385
+ const context = this.contextService.resolve();
386
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
387
+ var _a, _b, _c, _d;
388
+ this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
389
+ const { PriceListId } = (_c = context.properties) !== null && _c !== void 0 ? _c : {};
390
+ const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
391
+ this.id15to18('AccountId', mergeContext.properties);
392
+ this._runtimeContext = mergeContext;
393
+ if (context.properties && ((_d = this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
394
+ this.contextService.update({
395
+ properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
396
+ });
397
+ }
398
+ this._isInitialized = true;
399
+ }));
400
+ }
401
+ id15to18(propertyName, source) {
402
+ if (!source) {
403
+ return;
404
+ }
405
+ const value = source[propertyName];
406
+ if (typeof value === 'string' && value.length === 15) {
407
+ source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
408
+ }
409
+ }
410
+ getAsset(lineItem) {
411
+ return this._assets && this._assets.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
412
+ }
413
+ get isInitialized() {
414
+ return this._isInitialized;
415
+ }
416
+ get runtimeModel() {
417
+ var _a;
418
+ return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
419
+ }
420
+ get runtimeContext() {
421
+ return this._runtimeContext;
422
+ }
423
+ }
424
+ ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
425
+ ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationRuntimeService });
426
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
427
+ type: Injectable
428
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
429
+
430
+ const findLineItem = (id, lineItems) => {
431
+ return findLineItemWithComparator(lineItems, (li) => li.id === id);
432
+ };
433
+ const findLineItemWithComparator = (lineItems, comparator) => {
434
+ let currentLevel = lineItems;
435
+ while (currentLevel.length) {
436
+ const found = currentLevel.find(comparator);
437
+ if (found) {
438
+ return found;
439
+ }
440
+ currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
441
+ }
442
+ return;
443
+ };
444
+ const insertLineItem = (lineItem, parentId, toInsert) => {
445
+ const insertData = lineItem.id === parentId ? [toInsert] : [];
446
+ return Object.assign(Object.assign({}, lineItem), { lineItems: [
447
+ ...insertData,
448
+ ...lineItem.lineItems.map(li => {
449
+ return insertLineItem(li, parentId, toInsert);
450
+ }),
451
+ ] });
452
+ };
453
+ const removeLineItem = (lineItem, idToRemove) => {
454
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
455
+ .map(li => {
456
+ if (li.id === idToRemove) {
457
+ return;
458
+ }
459
+ else if (li.lineItems.length) {
460
+ return removeLineItem(li, idToRemove);
461
+ }
462
+ return li;
463
+ })
464
+ .filter(r => !!r) });
465
+ };
466
+ const replaceLineItem = (lineItem, replaceTo) => {
467
+ if (lineItem.id === replaceTo.id) {
468
+ return Object.assign({}, replaceTo);
469
+ }
470
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => {
471
+ if (li.id === replaceTo.id) {
472
+ return replaceTo;
473
+ }
474
+ else if (li.lineItems.length) {
475
+ return replaceLineItem(li, replaceTo);
476
+ }
477
+ return li;
478
+ }) });
479
+ };
480
+ const mapAttributes = (attributes) => {
481
+ return attributes.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: value })), {});
482
+ };
483
+ const getAttributes = (attributes, names = []) => {
484
+ const filtered = attributes.filter(({ name }) => names.includes(name));
485
+ return sortBy(filtered, [({ name }) => names.indexOf(name)]);
486
+ };
487
+ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
488
+ return attributesToUpsert.reduce((acc, { name, value }) => {
489
+ const [origAttr] = getAttributes(acc, [name]);
490
+ return [
491
+ ...acc.filter(attr => attr.name !== name),
492
+ Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name })), { cfgStatus: 'User', value }),
493
+ ];
494
+ }, originalAttributes);
495
+ };
496
+ const patchAttributes = (rootLineItem, id, attrs) => {
497
+ const lineItem = findLineItem(id, [rootLineItem]);
498
+ if (!lineItem) {
499
+ return rootLineItem;
500
+ }
501
+ const attributes = upsertAttributes(lineItem.attributes, attrs);
502
+ return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
503
+ };
504
+ const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
505
+ const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
506
+ return {
507
+ id: UUID.UUID(),
508
+ port,
509
+ type,
510
+ actionCode: 'ADD',
511
+ cfgStatus: 'New',
512
+ attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
513
+ lineItems,
514
+ parentId,
515
+ qty: 1,
516
+ };
517
+ };
518
+ const getRecommendedPrices = (portDomain, type) => {
519
+ var _a, _b;
520
+ const domainType = portDomain.domainTypes.find(({ name }) => name === type);
521
+ const [net, list] = (_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(({ chargeMethod }) => chargeMethod === 'ONE_TIME').reduce((acc, rp) => {
522
+ const [netPrice, listPrice] = acc;
523
+ return [netPrice + rp.netPrice, listPrice + rp.listPrice];
524
+ }, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0];
525
+ return { net, list };
526
+ };
527
+
528
+ var lineItem_utils = /*#__PURE__*/Object.freeze({
529
+ __proto__: null,
530
+ findLineItem: findLineItem,
531
+ findLineItemWithComparator: findLineItemWithComparator,
532
+ insertLineItem: insertLineItem,
533
+ removeLineItem: removeLineItem,
534
+ replaceLineItem: replaceLineItem,
535
+ mapAttributes: mapAttributes,
536
+ getAttributes: getAttributes,
537
+ upsertAttributes: upsertAttributes,
538
+ patchAttributes: patchAttributes,
539
+ getAttributeValue: getAttributeValue,
540
+ generateLineItem: generateLineItem,
541
+ getRecommendedPrices: getRecommendedPrices
542
+ });
543
+
544
+ class LineItemWorker {
545
+ constructor(src) {
546
+ this.li = Object.assign({}, src);
547
+ }
548
+ insert(parentId, toInsert) {
549
+ return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
550
+ }
551
+ remove(id) {
552
+ return new LineItemWorker(removeLineItem(this.li, id));
553
+ }
554
+ replace(toReplace) {
555
+ return new LineItemWorker(replaceLineItem(this.li, toReplace));
556
+ }
557
+ patchAttribute(attrs, id) {
558
+ return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
559
+ }
560
+ }
561
+
562
+ class ConfigurationService {
563
+ constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
564
+ this.quoteDraftService = quoteDraftService;
565
+ this.runtimeService = runtimeService;
566
+ this.contextService = contextService;
567
+ this.configurationApiService = configurationApiService;
568
+ this.messageService = messageService;
569
+ this.dialogService = dialogService;
570
+ this.mode = ConfigurationMode.SEARCH;
571
+ this.states = {};
572
+ this.lineItem = new BehaviorSubject(undefined);
573
+ this.charges = new BehaviorSubject({});
574
+ this.pricePlans = new BehaviorSubject({});
575
+ this.hasUnsavedChanges = false;
576
+ }
577
+ reset() {
578
+ this.hasUnsavedChanges = false;
579
+ this.runtimeService.reset();
580
+ this.states = {};
581
+ this.lineItem.next(undefined);
582
+ this.charges.next({});
583
+ this.pricePlans.next({});
584
+ }
585
+ patch$(lineItem) {
586
+ if (!this.lineItem.value) {
587
+ return throwError(() => new Error(`Source LineItem not found`));
588
+ }
589
+ this.states.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
590
+ this.states.asset = this.states.configurableRamp
591
+ ? this.runtimeService.getAsset(this.states.configurableRamp)
592
+ : undefined;
593
+ return this.configure().pipe(catchError$1(error => {
594
+ console.error(error);
595
+ if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
596
+ this.messageService.add({ severity: 'error', summary: error });
597
+ }
598
+ // bounce back if configuration call has failed
599
+ this.lineItem.next(this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined);
600
+ return throwError(() => error);
601
+ }), tap(() => {
602
+ if (!this.hasUnsavedChanges) {
603
+ this.hasUnsavedChanges = true;
604
+ }
605
+ }));
606
+ }
607
+ patch(lineItem) {
608
+ this.patch$(lineItem).subscribe();
609
+ }
610
+ updateCurrentStates(update) {
611
+ this.states = Object.assign(Object.assign({}, this.states), update);
612
+ }
613
+ get() {
614
+ return this.lineItem.asObservable().pipe(shareReplay$1());
615
+ }
616
+ getSnapshot() {
617
+ return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
618
+ }
619
+ getRuntimeModel() {
620
+ return this.runtimeService.runtimeModel;
621
+ }
622
+ getRuntimeContext() {
623
+ return this.runtimeService.runtimeContext;
624
+ }
625
+ get contextSnapshot() {
626
+ return this.contextService.resolve();
627
+ }
628
+ get context$() {
629
+ return this.contextService.resolve$();
630
+ }
631
+ get charges$() {
632
+ return this.charges.asObservable();
633
+ }
634
+ get chargesSnapshot() {
635
+ return this.charges.value;
636
+ }
637
+ get pricePlans$() {
638
+ return this.pricePlans.asObservable();
639
+ }
640
+ get pricePlansSnapshot() {
641
+ return this.pricePlans.value;
642
+ }
643
+ configure() {
644
+ var _a, _b, _c, _d, _e, _f;
645
+ const runtimeContext = this.getRuntimeContext();
646
+ const runtimeModel = this.getRuntimeModel();
647
+ if (!runtimeContext || !runtimeModel) {
648
+ return throwError(() => new Error('Runtime context/model not initialized'));
649
+ }
650
+ const uiDefinitionProperties = Object.assign(Object.assign({}, ((_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
651
+ const qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
652
+ const lineItem = (_e = this.states.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
653
+ const configurationRequest = this.createRequest(lineItem);
654
+ const mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
655
+ const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
656
+ return this.configurationApiService
657
+ .configureLineItem({ configurationRequest, runtimeModel, pricingEnabled })
658
+ .pipe(map(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
659
+ this.contextService.update(context !== null && context !== void 0 ? context : {});
660
+ this.charges.next(charges !== null && charges !== void 0 ? charges : {});
661
+ this.pricePlans.next(pricePlans !== null && pricePlans !== void 0 ? pricePlans : {});
662
+ if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
663
+ this.showInactiveProductsConfirmation();
664
+ }
665
+ return lineItem;
666
+ }))
667
+ .pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError$1(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
668
+ }
669
+ configureExternal$(productId, qty) {
670
+ this.updateCurrentStates({
671
+ currentState: this.quoteDraftService.currentState,
672
+ });
673
+ return this.runtimeService.init({ productId, defaultQty: qty }).pipe(switchMap(() => this.configure()), first(), catchError$1(error => {
674
+ this.messageService.add({ severity: ToastType.error, summary: error });
675
+ throw error;
676
+ }), finalize(() => this.reset()));
677
+ }
678
+ createRequest(lineItem) {
679
+ return {
680
+ lineItem,
681
+ mode: this.mode,
682
+ step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
683
+ attributeDomainMode: 'ALL',
684
+ context: this.contextService.resolve(),
685
+ lineItems: this.states.currentState || [],
686
+ asset: this.states.asset,
687
+ };
688
+ }
689
+ showInactiveProductsConfirmation() {
690
+ this.dialogService
691
+ .open(ConfirmationComponent, {
692
+ dismissableMask: false,
693
+ closeOnEscape: false,
694
+ closable: false,
695
+ showHeader: true,
696
+ header: `Inactive Products in Quote`,
697
+ width: '440px',
698
+ data: {
699
+ confirmationConfig: {
700
+ title: ' ',
701
+ description: 'This quote contains inactive products. Do you want to remove them?',
702
+ submitBtn: 'Remove products',
703
+ cancelBtn: 'Back to Quote',
704
+ },
705
+ },
706
+ })
707
+ .onClose.subscribe(result => {
708
+ if (!result) {
709
+ const context = this.contextService.resolve();
710
+ window['VELO_BACK_FN'].apply(null, [context.headerId]);
711
+ }
712
+ });
713
+ }
714
+ }
715
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i4.MessageService }, { token: i5.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
716
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationService });
717
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationService, decorators: [{
718
+ type: Injectable
719
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i4.MessageService }, { type: i5.DialogService }]; } });
720
+
721
+ class FlowUpdateService {
722
+ update(rootLineItems, updates) {
723
+ let remainingUpdates = [...updates];
724
+ let currentLevel = rootLineItems;
725
+ while (currentLevel.length && remainingUpdates.length) {
726
+ currentLevel.forEach(li => {
727
+ const unhandledUpdates = [];
728
+ remainingUpdates.forEach(update => {
729
+ let updated = false;
730
+ switch (update.dataType) {
731
+ case 'LINEITEM':
732
+ updated = this.applyLineItemUpdate(li, update);
733
+ break;
734
+ case 'CHARGE':
735
+ updated = this.applyChargeUpdate(li, update);
736
+ break;
737
+ case 'GROUP_CHARGE':
738
+ updated = this.applyChargeGroupUpdate(li, update);
739
+ break;
740
+ default:
741
+ // Unknown dataType. Do not try to handle it anymore
742
+ updated = true;
743
+ }
744
+ if (!updated) {
745
+ unhandledUpdates.push(update);
746
+ }
747
+ });
748
+ remainingUpdates = unhandledUpdates;
749
+ });
750
+ currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
751
+ }
752
+ }
753
+ delete(lineItems, id) {
754
+ const idsToRemove = [id];
755
+ const topLevelLineItem = lineItems.find(li => li.id === id);
756
+ if (topLevelLineItem) {
757
+ // find term-related line items (which are only top level)
758
+ // expired term line items won't be deleted
759
+ let foundTermLineItem = topLevelLineItem;
760
+ while (foundTermLineItem) {
761
+ foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
762
+ if (foundTermLineItem) {
763
+ idsToRemove.push(foundTermLineItem.id);
764
+ }
765
+ }
766
+ }
767
+ const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
768
+ return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
769
+ }
770
+ applyLineItemUpdate(lineItem, update) {
771
+ if (lineItem.id !== update.id) {
772
+ return false;
773
+ }
774
+ switch (update.attributeType) {
775
+ case 'QTY':
776
+ lineItem.qty = update.newValue;
777
+ break;
778
+ case 'EFFECTIVE_START_DATE':
779
+ lineItem.properties.StartDate = moment(update.newValue).format('YYYY-MM-DD');
780
+ break;
781
+ case 'END_DATE':
782
+ lineItem.properties.EndDate = moment(update.newValue).format('YYYY-MM-DD');
783
+ break;
784
+ case 'PRICE_ADJUSTMENT':
785
+ {
786
+ const [charge] = lineItem.chargeItems;
787
+ if (charge) {
788
+ charge.priceAdjustment = update.newValue;
789
+ }
790
+ }
791
+ break;
792
+ case 'LIST_PRICE_ADJUSTMENT':
793
+ {
794
+ const [charge] = lineItem.chargeItems;
795
+ if (charge) {
796
+ charge.listPriceAdjustment = update.newValue;
797
+ }
798
+ }
799
+ break;
800
+ default:
801
+ throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
802
+ }
803
+ return true;
804
+ }
805
+ applyChargeUpdate(lineItem, update) {
806
+ const foundCharge = lineItem.chargeItems.find(({ id }) => id === update.id);
807
+ if (!foundCharge) {
808
+ return false;
809
+ }
810
+ if (update.attributeType === 'PRICE_ADJUSTMENT') {
811
+ foundCharge.priceAdjustment = update.newValue;
812
+ }
813
+ else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
814
+ foundCharge.listPriceAdjustment = update.newValue;
815
+ }
816
+ else {
817
+ throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
818
+ }
819
+ return true;
820
+ }
821
+ applyChargeGroupUpdate(lineItem, update) {
822
+ const foundChargeGroup = ChargeGroupUtils.findChargeGroupById(update.id, lineItem);
823
+ if (!foundChargeGroup) {
824
+ return false;
825
+ }
826
+ if (update.attributeType === 'PRICE_ADJUSTMENT') {
827
+ foundChargeGroup.priceAdjustment = update.newValue;
828
+ }
829
+ else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
830
+ foundChargeGroup.listPriceAdjustment = update.newValue;
831
+ }
832
+ else {
833
+ throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
834
+ }
835
+ return true;
836
+ }
837
+ }
838
+ FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
839
+ FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowUpdateService });
840
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowUpdateService, decorators: [{
841
+ type: Injectable
842
+ }] });
843
+
844
+ class FlowConfigurationService {
845
+ constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
846
+ this.proceduresApiService = proceduresApiService;
847
+ this.contextService = contextService;
848
+ this.quoteDraftService = quoteDraftService;
849
+ this.updateService = updateService;
850
+ this.configurationService = configurationService;
851
+ }
852
+ calculate$(quoteDraft) {
853
+ return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
854
+ // sort the result current state based on the quote draft initial state
855
+ const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
856
+ result.currentState = result.currentState
857
+ .slice()
858
+ .sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
859
+ this.quoteDraftService.updateQuoteDraft(result);
860
+ }), map$1(noop));
861
+ }
862
+ calculate(quoteDraft) {
863
+ this.calculate$(quoteDraft).subscribe();
864
+ }
865
+ update$(updates) {
866
+ const quoteDraft = this.quoteDraftService.quoteDraft;
867
+ if (!quoteDraft) {
868
+ return of(null);
869
+ }
870
+ return of([]).pipe(map$1(() => {
871
+ const updatedState = cloneDeep(quoteDraft.currentState);
872
+ this.updateService.update(updatedState, updates);
873
+ return updatedState;
874
+ }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
875
+ }
876
+ update(updates) {
877
+ this.update$(updates).subscribe();
878
+ }
879
+ revert$(lineItemId) {
880
+ const quoteDraft = this.quoteDraftService.quoteDraft;
881
+ const initialState = this.quoteDraftService.activeInitialState;
882
+ const currentState = this.quoteDraftService.activeCurrentState;
883
+ const currentLineItemIndex = currentState.findIndex(({ id }) => id === lineItemId);
884
+ const currentLineItem = currentState[currentLineItemIndex];
885
+ const initialLineItem = initialState.find(({ integrationId }) => integrationId === (currentLineItem === null || currentLineItem === void 0 ? void 0 : currentLineItem.integrationId));
886
+ if (!quoteDraft || !currentLineItem || !initialLineItem) {
887
+ return of(null);
888
+ }
889
+ const updatedState = cloneDeep(currentState);
890
+ updatedState.splice(currentLineItemIndex, 1, initialLineItem);
891
+ return of([]).pipe(tap$1(() => {
892
+ this.quoteDraftService.setCurrentLineItemState(updatedState);
893
+ }), switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
894
+ }
895
+ revert(lineItemId) {
896
+ this.revert$(lineItemId).subscribe();
897
+ }
898
+ delete$(ids) {
899
+ const quoteDraft = this.quoteDraftService.quoteDraft;
900
+ const currentState = this.quoteDraftService.currentState;
901
+ if (!quoteDraft) {
902
+ return of(null);
903
+ }
904
+ return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
905
+ }
906
+ delete(ids) {
907
+ this.delete$(ids).subscribe();
908
+ }
909
+ addTerm$(term) {
910
+ const quoteDraft = this.quoteDraftService.quoteDraft;
911
+ if (!quoteDraft) {
912
+ return of(null);
913
+ }
914
+ const updatedState = [...quoteDraft.currentState, term];
915
+ return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
916
+ }
917
+ addToCart$(productId, qty) {
918
+ const quoteDraft = this.quoteDraftService.quoteDraft;
919
+ if (!quoteDraft) {
920
+ return of(null);
921
+ }
922
+ return this.configurationService.configureExternal$(productId, qty).pipe(map$1(lineItem => [...quoteDraft.currentState, lineItem]), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
923
+ }
924
+ get() {
925
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
926
+ }
927
+ getSnapshot() {
928
+ var _a, _b;
929
+ return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
930
+ }
931
+ get charges$() {
932
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(({ charges }) => charges));
933
+ }
934
+ get pricePlans$() {
935
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(({ pricePlans }) => pricePlans));
936
+ }
937
+ get chargesSnapshot() {
938
+ var _a, _b;
939
+ return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
940
+ }
941
+ get pricePlansSnapshot() {
942
+ var _a, _b;
943
+ return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
944
+ }
945
+ get contextSnapshot() {
946
+ return this.contextService.resolve();
947
+ }
948
+ get context$() {
949
+ return this.contextService.resolve$();
950
+ }
951
+ handleErrorAndBounceBack() {
952
+ return (source$) => {
953
+ return source$.pipe(catchError(error => {
954
+ console.error(error);
955
+ // bounce back if configuration call has failed
956
+ const quoteDraft = this.quoteDraftService.quoteDraft;
957
+ if (quoteDraft) {
958
+ this.quoteDraftService.updateQuoteDraft(quoteDraft);
959
+ }
960
+ return throwError(() => error);
961
+ }));
962
+ };
963
+ }
964
+ }
965
+ FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
966
+ FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationService });
967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationService, decorators: [{
968
+ type: Injectable
969
+ }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
970
+
971
+ class FlowConfigurationModule {
972
+ }
973
+ FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
974
+ FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule });
975
+ FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService], imports: [[]] });
976
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule, decorators: [{
977
+ type: NgModule,
978
+ args: [{
979
+ imports: [],
980
+ providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
981
+ }]
982
+ }] });
983
+
984
+ class ConfigurationModule {
985
+ }
986
+ ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
987
+ ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
988
+ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, providers: [
989
+ ContextApiService,
990
+ ProductModelApiService,
991
+ ConfigurationApiService,
992
+ ConfigurationRuntimeService,
993
+ RuntimeContextService,
994
+ ConfigurationService,
995
+ ], imports: [[ConfirmationDialogModule]] });
996
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, decorators: [{
997
+ type: NgModule,
998
+ args: [{
999
+ imports: [ConfirmationDialogModule],
1000
+ providers: [
1001
+ ContextApiService,
1002
+ ProductModelApiService,
1003
+ ConfigurationApiService,
1004
+ ConfigurationRuntimeService,
1005
+ RuntimeContextService,
1006
+ ConfigurationService,
1007
+ ],
1008
+ }]
1009
+ }] });
1010
+
1011
+ class SdkCoreModule {
1012
+ }
1013
+ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1014
+ SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1015
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
1016
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, decorators: [{
1017
+ type: NgModule,
1018
+ args: [{
1019
+ imports: [ConfigurationModule, FlowConfigurationModule],
1020
+ providers: [ContextService, QuoteDraftService, ProductImagesService],
1021
+ }]
1022
+ }] });
1023
+
1024
+ /**
1025
+ * Generated bundle index. Do not edit.
1026
+ */
1027
+
1028
+ export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, findLineItem, findLineItemWithComparator, generateLineItem, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, patchAttributes, removeLineItem, replaceLineItem, upsertAttributes };
1029
+ //# sourceMappingURL=veloceapps-sdk-core.js.map