@veloceapps/sdk 8.0.0-13 → 8.0.0-130

Sign up to get free protection for your applications and to get access to all the features.
Files changed (330) hide show
  1. package/README.md +0 -1
  2. package/cms/README.md +0 -20
  3. package/cms/cms.actions.d.ts +7 -1
  4. package/cms/components/preview/preview.component.d.ts +1 -2
  5. package/cms/components/preview/preview.types.d.ts +4 -0
  6. package/cms/index.d.ts +1 -0
  7. package/cms/modules/runtime/services/runtime.service.d.ts +1 -1
  8. package/cms/services/index.d.ts +0 -1
  9. package/cms/types/index.d.ts +0 -1
  10. package/cms/utils/element-metadata-worker.d.ts +11 -0
  11. package/cms/utils/elements-resolver.d.ts +0 -2
  12. package/cms/utils/index.d.ts +3 -0
  13. package/cms/utils/transpilation-worker.d.ts +13 -0
  14. package/cms/vendor-map.d.ts +26 -13
  15. package/core/README.md +20 -0
  16. package/core/modules/configuration/helpers.d.ts +4 -3
  17. package/core/modules/configuration/services/configuration-runtime.service.d.ts +1 -1
  18. package/core/modules/configuration/services/configuration.service.d.ts +6 -1
  19. package/core/modules/configuration/types/configuration.types.d.ts +4 -0
  20. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +5 -0
  21. package/core/pipes/action-code.pipe.d.ts +8 -0
  22. package/core/pipes/date.pipe.d.ts +2 -1
  23. package/core/pipes/index.d.ts +1 -0
  24. package/core/pipes/pipes.module.d.ts +2 -1
  25. package/core/services/context.service.d.ts +3 -0
  26. package/core/services/flow-info.service.d.ts +27 -0
  27. package/core/services/flow-state-configuration.service.d.ts +20 -0
  28. package/core/services/flow-state.service.d.ts +70 -0
  29. package/core/services/index.d.ts +4 -0
  30. package/core/services/quote-draft.service.d.ts +8 -1
  31. package/core/services/runtime-settings.service.d.ts +4 -1
  32. package/core/types/flow-customization.types.d.ts +22 -0
  33. package/core/types/flow-state.types.d.ts +6 -0
  34. package/core/types/formatting-settings.types.d.ts +2 -0
  35. package/core/types/index.d.ts +3 -0
  36. package/{cms → core}/types/integration.types.d.ts +1 -0
  37. package/core/types/pipe.types.d.ts +1 -0
  38. package/esm2020/cms/cms.actions.mjs +15 -1
  39. package/esm2020/cms/components/element-children/element-children.component.mjs +3 -3
  40. package/esm2020/cms/components/element-children/element-children.module.mjs +4 -4
  41. package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +3 -3
  42. package/esm2020/cms/components/element-drop-handle/element-drop-handle.module.mjs +4 -4
  43. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +3 -3
  44. package/esm2020/cms/components/element-renderer/element-renderer.module.mjs +4 -4
  45. package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +5 -5
  46. package/esm2020/cms/components/plugin.component.mjs +3 -3
  47. package/esm2020/cms/components/preview/preview.component.mjs +11 -11
  48. package/esm2020/cms/components/preview/preview.module.mjs +6 -6
  49. package/esm2020/cms/components/preview/preview.types.mjs +1 -1
  50. package/esm2020/cms/directives/custom-template.directive.mjs +7 -7
  51. package/esm2020/cms/index.mjs +2 -1
  52. package/esm2020/cms/launcher.module.mjs +7 -7
  53. package/esm2020/cms/modules/federated/federated-host.directive.mjs +3 -3
  54. package/esm2020/cms/modules/federated/federated.component.mjs +3 -3
  55. package/esm2020/cms/modules/federated/federated.module.mjs +4 -4
  56. package/esm2020/cms/modules/migrations/migrations.module.mjs +4 -4
  57. package/esm2020/cms/modules/migrations/services/migrations.service.mjs +3 -3
  58. package/esm2020/cms/modules/runtime/runtime.module.mjs +4 -4
  59. package/esm2020/cms/modules/runtime/services/compilation.service.mjs +12 -8
  60. package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +3 -3
  61. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +7 -7
  62. package/esm2020/cms/plugins/configuration.plugin.mjs +3 -3
  63. package/esm2020/cms/plugins/element-hover.plugin.mjs +3 -3
  64. package/esm2020/cms/plugins/io.plugin.mjs +3 -3
  65. package/esm2020/cms/plugins/page.plugin.mjs +3 -3
  66. package/esm2020/cms/plugins/region.plugin.mjs +3 -3
  67. package/esm2020/cms/plugins/script.plugin.mjs +3 -3
  68. package/esm2020/cms/services/element-context.service.mjs +3 -3
  69. package/esm2020/cms/services/index.mjs +1 -2
  70. package/esm2020/cms/services/io-provider.service.mjs +3 -3
  71. package/esm2020/cms/services/resources.service.mjs +3 -3
  72. package/esm2020/cms/services/templates.service.mjs +3 -3
  73. package/esm2020/cms/types/index.mjs +1 -2
  74. package/esm2020/cms/utils/element-metadata-worker.mjs +31 -0
  75. package/esm2020/cms/utils/elements-resolver.mjs +14 -28
  76. package/esm2020/cms/utils/index.mjs +4 -1
  77. package/esm2020/cms/utils/transpilation-worker.mjs +52 -0
  78. package/esm2020/cms/vendor-map.mjs +18 -5
  79. package/esm2020/core/core.module.mjs +12 -17
  80. package/esm2020/core/directives/directives.module.mjs +4 -4
  81. package/esm2020/core/directives/primeng-calendar.directive.mjs +3 -3
  82. package/esm2020/core/modules/configuration/configuration.module.mjs +4 -4
  83. package/esm2020/core/modules/configuration/helpers.mjs +28 -3
  84. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +11 -14
  85. package/esm2020/core/modules/configuration/services/configuration.service.mjs +29 -10
  86. package/esm2020/core/modules/configuration/services/configuration.state.mjs +5 -5
  87. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +9 -9
  88. package/esm2020/core/modules/configuration/types/configuration.types.mjs +1 -1
  89. package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +4 -4
  90. package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +15 -11
  91. package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +3 -3
  92. package/esm2020/core/pipes/action-code.pipe.mjs +20 -0
  93. package/esm2020/core/pipes/date.pipe.mjs +13 -7
  94. package/esm2020/core/pipes/index.mjs +2 -1
  95. package/esm2020/core/pipes/number.pipe.mjs +3 -3
  96. package/esm2020/core/pipes/pipes.module.mjs +8 -7
  97. package/esm2020/core/pipes/price.pipe.mjs +3 -3
  98. package/esm2020/core/services/context.service.mjs +32 -5
  99. package/esm2020/core/services/flow-info.service.mjs +94 -0
  100. package/esm2020/core/services/flow-state-configuration.service.mjs +52 -0
  101. package/esm2020/core/services/flow-state.service.mjs +441 -0
  102. package/esm2020/core/services/index.mjs +5 -1
  103. package/esm2020/core/services/integration.state.mjs +37 -0
  104. package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +3 -3
  105. package/esm2020/core/services/product-images.service.mjs +3 -3
  106. package/esm2020/core/services/quote-draft.service.mjs +32 -7
  107. package/esm2020/core/services/runtime-settings.service.mjs +20 -5
  108. package/esm2020/core/types/flow-customization.types.mjs +3 -0
  109. package/esm2020/core/types/flow-state.types.mjs +2 -0
  110. package/esm2020/core/types/formatting-settings.types.mjs +1 -1
  111. package/esm2020/core/types/index.mjs +4 -1
  112. package/esm2020/core/types/integration.types.mjs +2 -0
  113. package/esm2020/core/types/pipe.types.mjs +2 -0
  114. package/esm2020/src/components/dialog/dialog.component.mjs +3 -3
  115. package/esm2020/src/components/dialog/dialog.module.mjs +4 -4
  116. package/esm2020/src/components/doc-gen/doc-gen.component.mjs +45 -54
  117. package/esm2020/src/components/doc-gen/doc-gen.module.mjs +4 -4
  118. package/esm2020/src/components/flow-header/flow-header.component.mjs +108 -0
  119. package/esm2020/src/components/flow-header/flow-header.module.mjs +19 -0
  120. package/esm2020/src/components/flow-header/index.mjs +2 -0
  121. package/esm2020/src/components/guided-selling/guided-selling.component.mjs +42 -51
  122. package/esm2020/src/components/guided-selling/guided-selling.module.mjs +4 -4
  123. package/esm2020/src/configure-primeng.mjs +33 -0
  124. package/esm2020/src/flow-routing.module.mjs +66 -75
  125. package/esm2020/src/flow.component.mjs +24 -33
  126. package/esm2020/src/flow.module.mjs +11 -9
  127. package/esm2020/src/guards/context.guard.mjs +7 -12
  128. package/esm2020/src/guards/flow.guard.mjs +31 -0
  129. package/esm2020/src/guards/product-unload.guard.mjs +7 -4
  130. package/esm2020/src/guards/root.guard.mjs +17 -13
  131. package/esm2020/src/pages/assets/assets.component.mjs +34 -38
  132. package/esm2020/src/pages/assets/assets.module.mjs +4 -4
  133. package/esm2020/src/pages/catalog/catalog.component.mjs +34 -38
  134. package/esm2020/src/pages/catalog/catalog.module.mjs +4 -4
  135. package/esm2020/src/pages/debug/debug.component.mjs +12 -16
  136. package/esm2020/src/pages/debug/debug.module.mjs +4 -4
  137. package/esm2020/src/pages/empty-account/empty-account.component.mjs +3 -3
  138. package/esm2020/src/pages/empty-account/empty-account.module.mjs +4 -4
  139. package/esm2020/src/pages/product/product.component.mjs +7 -10
  140. package/esm2020/src/pages/product/product.module.mjs +4 -4
  141. package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +3 -3
  142. package/esm2020/src/pages/record-not-found/record-not-found.module.mjs +4 -4
  143. package/esm2020/src/pages/remote/remote.component.mjs +13 -14
  144. package/esm2020/src/pages/remote/remote.module.mjs +4 -4
  145. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +35 -39
  146. package/esm2020/src/pages/shopping-cart/shopping-cart.module.mjs +4 -4
  147. package/esm2020/src/resolvers/flow.resolver.mjs +37 -51
  148. package/esm2020/src/resolvers/quote.resolver.mjs +40 -65
  149. package/esm2020/src/services/doc-gen.service.mjs +7 -6
  150. package/esm2020/src/services/flow-dialog.service.mjs +22 -7
  151. package/esm2020/src/services/flow-router.service.mjs +31 -10
  152. package/esm2020/src/services/flow.service.mjs +36 -11
  153. package/esm2020/src/services/guided-selling.service.mjs +8 -7
  154. package/esm2020/src/services/index.mjs +3 -1
  155. package/esm2020/src/types/index.mjs +1 -2
  156. package/esm2020/src/utils/flow.utils.mjs +6 -2
  157. package/fesm2015/veloceapps-sdk-cms.mjs +317 -244
  158. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  159. package/fesm2015/veloceapps-sdk-core.mjs +1551 -827
  160. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  161. package/fesm2015/veloceapps-sdk.mjs +744 -1544
  162. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  163. package/fesm2020/veloceapps-sdk-cms.mjs +331 -266
  164. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  165. package/fesm2020/veloceapps-sdk-core.mjs +1865 -1157
  166. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  167. package/fesm2020/veloceapps-sdk.mjs +856 -1655
  168. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  169. package/package.json +7 -13
  170. package/src/components/doc-gen/doc-gen.component.d.ts +8 -12
  171. package/src/components/flow-header/flow-header.component.d.ts +25 -0
  172. package/src/components/flow-header/flow-header.module.d.ts +9 -0
  173. package/src/components/flow-header/index.d.ts +1 -0
  174. package/src/components/guided-selling/guided-selling.component.d.ts +7 -11
  175. package/src/configure-primeng.d.ts +1 -0
  176. package/src/flow-routing.module.d.ts +6 -7
  177. package/src/flow.component.d.ts +7 -11
  178. package/src/flow.module.d.ts +2 -2
  179. package/src/guards/context.guard.d.ts +4 -5
  180. package/src/guards/flow.guard.d.ts +2 -0
  181. package/src/guards/product-unload.guard.d.ts +2 -2
  182. package/src/guards/root.guard.d.ts +0 -1
  183. package/src/pages/assets/assets.component.d.ts +5 -7
  184. package/src/pages/catalog/catalog.component.d.ts +5 -7
  185. package/src/pages/debug/debug.component.d.ts +5 -8
  186. package/src/pages/product/product.component.d.ts +2 -3
  187. package/src/pages/remote/remote.component.d.ts +1 -2
  188. package/src/pages/shopping-cart/shopping-cart.component.d.ts +5 -7
  189. package/src/resolvers/flow.resolver.d.ts +6 -7
  190. package/src/resolvers/quote.resolver.d.ts +6 -12
  191. package/src/services/doc-gen.service.d.ts +1 -1
  192. package/src/services/flow-dialog.service.d.ts +5 -2
  193. package/src/services/flow-router.service.d.ts +4 -2
  194. package/src/services/flow.service.d.ts +4 -2
  195. package/src/services/guided-selling.service.d.ts +1 -1
  196. package/src/services/index.d.ts +2 -0
  197. package/src/types/index.d.ts +0 -1
  198. package/esm2020/cms/services/integration.state.mjs +0 -37
  199. package/esm2020/cms/types/integration.types.mjs +0 -2
  200. package/esm2020/runtime/components/component-preview/component-preview.component.mjs +0 -125
  201. package/esm2020/runtime/components/index.mjs +0 -5
  202. package/esm2020/runtime/components/section-renderer/section-renderer.component.mjs +0 -67
  203. package/esm2020/runtime/components/ui-runtime/runtime.component.mjs +0 -440
  204. package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +0 -108
  205. package/esm2020/runtime/execution/components/children-placeholder/children-placeholder.component.mjs +0 -60
  206. package/esm2020/runtime/execution/components/context-provider/context-provider.component.mjs +0 -39
  207. package/esm2020/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.mjs +0 -67
  208. package/esm2020/runtime/execution/components/federated/federated.component.mjs +0 -74
  209. package/esm2020/runtime/execution/components/velo-attribute/velo-attribute.component.mjs +0 -60
  210. package/esm2020/runtime/execution/components/velo-multiselect/velo-multiselect.component.mjs +0 -130
  211. package/esm2020/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.mjs +0 -72
  212. package/esm2020/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.mjs +0 -97
  213. package/esm2020/runtime/execution/components/velo-port-radio/velo-port-radio.component.mjs +0 -142
  214. package/esm2020/runtime/execution/components/velo-type/velo-type.component.mjs +0 -119
  215. package/esm2020/runtime/execution/directives/section-script.directive.mjs +0 -247
  216. package/esm2020/runtime/execution/directives/sf-query.directive.mjs +0 -35
  217. package/esm2020/runtime/execution/directives/velo-attribute.directive.mjs +0 -88
  218. package/esm2020/runtime/execution/directives/velo-port.directive.mjs +0 -376
  219. package/esm2020/runtime/execution/directives/vl-approval.directive.mjs +0 -23
  220. package/esm2020/runtime/execution/directives/vl-document-attachments.directive.mjs +0 -36
  221. package/esm2020/runtime/execution/directives/vl-document-templates.directive.mjs +0 -60
  222. package/esm2020/runtime/execution/directives/vl-quote.directive.mjs +0 -42
  223. package/esm2020/runtime/execution/directives/vl-ramp.directive.mjs +0 -55
  224. package/esm2020/runtime/execution/runtime-execution.module.mjs +0 -133
  225. package/esm2020/runtime/execution/utils/federated.util.mjs +0 -32
  226. package/esm2020/runtime/index.mjs +0 -5
  227. package/esm2020/runtime/runtime.module.mjs +0 -74
  228. package/esm2020/runtime/services/cart.service.mjs +0 -29
  229. package/esm2020/runtime/services/collapsible-state.service.mjs +0 -34
  230. package/esm2020/runtime/services/configuration.service.mjs +0 -119
  231. package/esm2020/runtime/services/current-state.service.mjs +0 -17
  232. package/esm2020/runtime/services/form-scope.service.mjs +0 -30
  233. package/esm2020/runtime/services/index.mjs +0 -4
  234. package/esm2020/runtime/services/product-model-cache.service.mjs +0 -31
  235. package/esm2020/runtime/services/runtime-context.service.mjs +0 -60
  236. package/esm2020/runtime/services/runtime-form.service.mjs +0 -219
  237. package/esm2020/runtime/services/runtime.service.mjs +0 -115
  238. package/esm2020/runtime/services/section-helper.service.mjs +0 -27
  239. package/esm2020/runtime/services/section-scope.service.mjs +0 -36
  240. package/esm2020/runtime/services/section-store.service.mjs +0 -22
  241. package/esm2020/runtime/services/section.service.mjs +0 -117
  242. package/esm2020/runtime/types/bound-data.types.mjs +0 -7
  243. package/esm2020/runtime/types/index.mjs +0 -3
  244. package/esm2020/runtime/types/quote-states.types.mjs +0 -2
  245. package/esm2020/runtime/types/runtime.types.mjs +0 -2
  246. package/esm2020/runtime/types/script-registry.types.mjs +0 -51
  247. package/esm2020/runtime/utils/line-item.util.mjs +0 -270
  248. package/esm2020/runtime/utils/section.utils.mjs +0 -26
  249. package/esm2020/runtime/utils/sections-binder.helper.mjs +0 -105
  250. package/esm2020/runtime/veloceapps-sdk-runtime.mjs +0 -5
  251. package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +0 -119
  252. package/esm2020/src/components/header/cart-overlay/cart-preview.module.mjs +0 -47
  253. package/esm2020/src/components/header/header.component.mjs +0 -355
  254. package/esm2020/src/components/header/header.module.mjs +0 -52
  255. package/esm2020/src/components/header/header.types.mjs +0 -2
  256. package/esm2020/src/components/header/metrics/index.mjs +0 -2
  257. package/esm2020/src/components/header/metrics/metrics.component.mjs +0 -255
  258. package/esm2020/src/components/header/metrics/metrics.definitions.mjs +0 -2
  259. package/esm2020/src/components/header/metrics/metrics.module.mjs +0 -69
  260. package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +0 -137
  261. package/esm2020/src/pages/legacy-product/legacy-product.module.mjs +0 -19
  262. package/esm2020/src/types/flow-customization.types.mjs +0 -3
  263. package/fesm2015/veloceapps-sdk-runtime.mjs +0 -3770
  264. package/fesm2015/veloceapps-sdk-runtime.mjs.map +0 -1
  265. package/fesm2020/veloceapps-sdk-runtime.mjs +0 -3767
  266. package/fesm2020/veloceapps-sdk-runtime.mjs.map +0 -1
  267. package/runtime/README.md +0 -5
  268. package/runtime/components/component-preview/component-preview.component.d.ts +0 -27
  269. package/runtime/components/index.d.ts +0 -4
  270. package/runtime/components/section-renderer/section-renderer.component.d.ts +0 -25
  271. package/runtime/components/ui-runtime/runtime.component.d.ts +0 -53
  272. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +0 -27
  273. package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +0 -30
  274. package/runtime/execution/components/context-provider/context-provider.component.d.ts +0 -14
  275. package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +0 -25
  276. package/runtime/execution/components/federated/federated.component.d.ts +0 -36
  277. package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +0 -19
  278. package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +0 -35
  279. package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +0 -22
  280. package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +0 -22
  281. package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +0 -28
  282. package/runtime/execution/components/velo-type/velo-type.component.d.ts +0 -31
  283. package/runtime/execution/directives/section-script.directive.d.ts +0 -59
  284. package/runtime/execution/directives/sf-query.directive.d.ts +0 -15
  285. package/runtime/execution/directives/velo-attribute.directive.d.ts +0 -26
  286. package/runtime/execution/directives/velo-port.directive.d.ts +0 -74
  287. package/runtime/execution/directives/vl-approval.directive.d.ts +0 -10
  288. package/runtime/execution/directives/vl-document-attachments.directive.d.ts +0 -15
  289. package/runtime/execution/directives/vl-document-templates.directive.d.ts +0 -33
  290. package/runtime/execution/directives/vl-quote.directive.d.ts +0 -14
  291. package/runtime/execution/directives/vl-ramp.directive.d.ts +0 -15
  292. package/runtime/execution/runtime-execution.module.d.ts +0 -25
  293. package/runtime/execution/utils/federated.util.d.ts +0 -6
  294. package/runtime/index.d.ts +0 -4
  295. package/runtime/runtime.module.d.ts +0 -16
  296. package/runtime/services/cart.service.d.ts +0 -15
  297. package/runtime/services/collapsible-state.service.d.ts +0 -15
  298. package/runtime/services/configuration.service.d.ts +0 -20
  299. package/runtime/services/current-state.service.d.ts +0 -8
  300. package/runtime/services/form-scope.service.d.ts +0 -20
  301. package/runtime/services/index.d.ts +0 -3
  302. package/runtime/services/product-model-cache.service.d.ts +0 -14
  303. package/runtime/services/runtime-context.service.d.ts +0 -16
  304. package/runtime/services/runtime-form.service.d.ts +0 -24
  305. package/runtime/services/runtime.service.d.ts +0 -44
  306. package/runtime/services/section-helper.service.d.ts +0 -8
  307. package/runtime/services/section-scope.service.d.ts +0 -14
  308. package/runtime/services/section-store.service.d.ts +0 -11
  309. package/runtime/services/section.service.d.ts +0 -30
  310. package/runtime/types/bound-data.types.d.ts +0 -13
  311. package/runtime/types/index.d.ts +0 -2
  312. package/runtime/types/quote-states.types.d.ts +0 -6
  313. package/runtime/types/runtime.types.d.ts +0 -19
  314. package/runtime/types/script-registry.types.d.ts +0 -13
  315. package/runtime/utils/line-item.util.d.ts +0 -34
  316. package/runtime/utils/section.utils.d.ts +0 -2
  317. package/runtime/utils/sections-binder.helper.d.ts +0 -16
  318. package/src/components/header/cart-overlay/cart-preview.component.d.ts +0 -36
  319. package/src/components/header/cart-overlay/cart-preview.module.d.ts +0 -14
  320. package/src/components/header/header.component.d.ts +0 -70
  321. package/src/components/header/header.module.d.ts +0 -16
  322. package/src/components/header/header.types.d.ts +0 -20
  323. package/src/components/header/metrics/index.d.ts +0 -1
  324. package/src/components/header/metrics/metrics.component.d.ts +0 -67
  325. package/src/components/header/metrics/metrics.definitions.d.ts +0 -1
  326. package/src/components/header/metrics/metrics.module.d.ts +0 -18
  327. package/src/pages/legacy-product/legacy-product.component.d.ts +0 -37
  328. package/src/pages/legacy-product/legacy-product.module.d.ts +0 -9
  329. package/src/types/flow-customization.types.d.ts +0 -12
  330. /package/{cms → core}/services/integration.state.d.ts +0 -0
@@ -1,17 +1,17 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
3
- import { UUID, ConfigurationContextMode, ConfigurationContext, RuntimeModel, getUIDefinitionProperties, isLegacyUIDefinition, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, EntityUtil, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, parseJsonSafely, formatNumber } from '@veloceapps/core';
4
- import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1, switchMap as switchMap$1, of, tap as tap$1, map as map$2, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
5
- import { filter, tap, map, first, switchMap, skip, take, shareReplay, catchError, finalize } from 'rxjs/operators';
2
+ import { InjectionToken, Injectable, Optional, Inject, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
3
+ import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, isDefined, ConfigurationProcessorTypes, EntityUtil, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, DEFAULT_ACTION_CODE_LABELS, parseJsonSafely, ConfigurationMode, ConfigurationTranslatorUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
4
+ import { BehaviorSubject, switchMap, map as map$1, tap as tap$1, noop, catchError, throwError, of, forkJoin, Subject, filter as filter$1, zip, combineLatest, shareReplay as shareReplay$1, finalize, takeUntil, take as take$1, distinctUntilChanged } from 'rxjs';
5
+ import { map, filter, tap, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1, first } from 'rxjs/operators';
6
6
  import * as i1 from '@veloceapps/api';
7
7
  import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
8
- import { merge, flatten, sortBy, map as map$1, isEqual, transform, omit, cloneDeep, uniq } from 'lodash';
9
- import { HttpErrorResponse } from '@angular/common/http';
10
- import * as i4 from '@veloceapps/components';
8
+ import { merge, isEmpty, flatten, sortBy, map as map$2, omit, isEqual, cloneDeep, assign, uniqBy, transform, uniq } from 'lodash';
9
+ import * as i6 from '@veloceapps/components';
11
10
  import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
12
- import * as i5 from 'primeng/api';
13
- import * as i6 from 'primeng/dynamicdialog';
14
11
  import moment from 'moment';
12
+ import { HttpErrorResponse } from '@angular/common/http';
13
+ import * as i5 from 'primeng/api';
14
+ import * as i6$1 from 'primeng/dynamicdialog';
15
15
  import { NgControl } from '@angular/forms';
16
16
  import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
17
17
 
@@ -24,21 +24,16 @@ const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
24
24
  attributes,
25
25
  lineItems, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b['displayName']) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (uiDefinitionProperties.offeringId ? { offeringId: uiDefinitionProperties.offeringId } : {}));
26
26
  };
27
- const getGuidedSellingConfigurationRequest = (data) => {
27
+ const getGuidedSellingConfigurationRequest = (data, context) => {
28
+ const _context = Object.assign({}, context);
29
+ delete _context.configurationToken;
30
+ const properties = Object.assign({}, context.properties);
31
+ delete properties['ConfigurationToken'];
28
32
  return {
29
33
  mode: 'SEARCH',
30
34
  step: 'START',
31
35
  attributeDomainMode: 'ALL',
32
- context: {
33
- headerId: 'TestId',
34
- mode: ConfigurationContextMode.TEST,
35
- properties: {
36
- ModelId: data.modelId,
37
- Name: 'Veloce Guided Selling',
38
- PricingEnabled: 'false',
39
- RuntimeMode: 'TEST',
40
- },
41
- },
36
+ context: Object.assign(Object.assign({}, _context), { mode: ConfigurationContextMode.TEST, properties: Object.assign(Object.assign({}, properties), { ModelId: data.modelId, Name: 'Veloce Guided Selling', PricingEnabled: 'false', RuntimeMode: 'TEST' }) }),
42
37
  lineItem: {
43
38
  actionCode: 'ADD',
44
39
  cfgStatus: 'Default',
@@ -53,6 +48,29 @@ const getGuidedSellingConfigurationRequest = (data) => {
53
48
  },
54
49
  };
55
50
  };
51
+ const generateConfigurationLineItem = (props, qty = 1) => {
52
+ var _a, _b, _c;
53
+ const id = UUID.UUID();
54
+ const attributes = Object.entries((_a = props.attributesMap) !== null && _a !== void 0 ? _a : {}).map(([name, value]) => ({
55
+ name,
56
+ value,
57
+ cfgStatus: 'User',
58
+ }));
59
+ const lineItems = [];
60
+ return {
61
+ id,
62
+ type: (_b = props.product.typeName) !== null && _b !== void 0 ? _b : '',
63
+ cfgStatus: 'Default',
64
+ actionCode: 'ADD',
65
+ qty,
66
+ attributes,
67
+ lineItems,
68
+ productName: props.product.name,
69
+ productId: (_c = props.product.id) !== null && _c !== void 0 ? _c : '',
70
+ };
71
+ };
72
+
73
+ const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
56
74
 
57
75
  const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
58
76
 
@@ -82,9 +100,24 @@ class ContextService {
82
100
  get isInitialized() {
83
101
  return Boolean(this.context.value);
84
102
  }
103
+ get isInitialized$() {
104
+ return this.context.pipe(map(Boolean));
105
+ }
85
106
  get mode() {
86
107
  return this.resolve().properties.mode;
87
108
  }
109
+ get isEditMode$() {
110
+ return this.resolve$().pipe(map(() => {
111
+ const context = this.resolve();
112
+ if (context.mode === ConfigurationContextMode.ACCOUNT) {
113
+ return true;
114
+ }
115
+ if (context.mode === ConfigurationContextMode.QUOTE) {
116
+ return context.properties.Status === 'Draft';
117
+ }
118
+ return false;
119
+ }));
120
+ }
88
121
  resolve() {
89
122
  if (!this.context.value) {
90
123
  throw new Error('Context is not initialized yet!');
@@ -97,6 +130,13 @@ class ContextService {
97
130
  create(headerId, mode) {
98
131
  return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
99
132
  }
133
+ initTestMode() {
134
+ return this.create('TestId', ConfigurationContextMode.TEST).pipe(map(context => {
135
+ return this.update({
136
+ properties: Object.assign(Object.assign({}, context.properties), { RuntimeMode: ConfigurationContextMode.TEST, StartDate: new Date().toISOString().substring(0, 10), standalone: 'true' }),
137
+ });
138
+ }));
139
+ }
100
140
  update(partialContext) {
101
141
  const originalContext = this.resolve();
102
142
  const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
@@ -113,136 +153,101 @@ class ContextService {
113
153
  this.context.next(null);
114
154
  }
115
155
  }
116
- ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
117
- ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ContextService, providedIn: 'root' });
118
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ContextService, decorators: [{
156
+ ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
157
+ ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, providedIn: 'root' });
158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, decorators: [{
119
159
  type: Injectable,
120
160
  args: [{ providedIn: 'root' }]
121
161
  }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
122
162
 
123
- class RuntimeContextService {
124
- constructor(configurationApiService) {
125
- this.configurationApiService = configurationApiService;
126
- }
127
- getRuntimeContext(productId, offeringId) {
128
- return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
129
- var _a;
130
- const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
131
- const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
132
- const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
133
- const uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
134
- return {
135
- modelId: runtimeData.modelId,
136
- uiDefinitionContainer: uiDefinitionContainer,
137
- runtimeModel: runtimeModel,
138
- runtimeMode: RuntimeMode.PROD,
139
- productId: productId,
140
- productType: (properties === null || properties === void 0 ? void 0 : properties['displayName']) || productName,
141
- offeringId: offeringId,
142
- properties: {
143
- PricingEnabled: uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
144
- PriceListId: uiDefinitionProperties.priceList,
145
- },
146
- };
163
+ class FlowInfoService {
164
+ get flow() {
165
+ return this.flowSubj$.value;
166
+ }
167
+ set flow(value) {
168
+ this.flowSubj$.next(value);
169
+ }
170
+ constructor(flowsApiService, templatesApiService, customizationService) {
171
+ this.flowsApiService = flowsApiService;
172
+ this.templatesApiService = templatesApiService;
173
+ this.customizationService = customizationService;
174
+ this.templates = {};
175
+ this.defaultTemplates = {
176
+ flowEngine: 'Flow Engine',
177
+ };
178
+ this.flowSubj$ = new BehaviorSubject(null);
179
+ this.flow$ = this.flowSubj$.asObservable();
180
+ }
181
+ init$(flowId, params) {
182
+ this.params = params;
183
+ return this.flowsApiService.getFlow(flowId).pipe(switchMap(flow => this.initFlowTemplates$(flow).pipe(map$1(() => flow))), tap$1(flow => this.flowSubj$.next(flow)), map$1(noop), catchError(e => {
184
+ this.flowSubj$.next(null);
185
+ return throwError(() => e);
147
186
  }));
148
187
  }
149
- getUIDefinitionContainer(runtimeData) {
150
- var _a;
151
- const containers = runtimeData.uiDefinitions.filter(container => !isLegacyUIDefinition(container.source));
152
- return (_a = containers.find(container => container.source.primary)) !== null && _a !== void 0 ? _a : containers[0];
153
- }
154
- }
155
- RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
156
- RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService });
157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, decorators: [{
158
- type: Injectable
159
- }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
160
-
161
- class ConfigurationRuntimeService {
162
- constructor(apiService, contextService, runtimeContextService) {
163
- this.apiService = apiService;
164
- this.contextService = contextService;
165
- this.runtimeContextService = runtimeContextService;
166
- this._isInitialized = false;
167
- this.uiDefinitionProperties = {};
168
- }
169
- reset() {
170
- this._isInitialized = false;
171
- this._runtimeContext = undefined;
172
- this.initializationProps = undefined;
173
- this.uiDefinitionProperties = {};
174
- }
175
- initTestMode(uiDefinitionContainer) {
176
- var _a;
177
- this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
178
- const uiDefinitionExternals = (_a = uiDefinitionContainer.source.externals) !== null && _a !== void 0 ? _a : {};
179
- return combineLatest([
180
- this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
181
- this.contextService.create('TestId', ConfigurationContextMode.TEST),
182
- ]).pipe(first(), map(([runtimeData, context]) => {
183
- var _a;
184
- this.contextService.update({
185
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: uiDefinitionContainer.modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, offeringId: this.uiDefinitionProperties.offeringId, standalone: 'true' }), uiDefinitionExternals),
186
- });
187
- this._runtimeContext = {
188
- modelId: uiDefinitionContainer.modelId,
189
- runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
190
- runtimeMode: RuntimeMode.TEST,
191
- uiDefinitionContainer,
192
- };
193
- return this._runtimeContext;
194
- }), tap(() => (this._isInitialized = true)));
195
- }
196
- init(props) {
197
- this.initializationProps = props;
198
- const context = this.contextService.resolve();
199
- return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
200
- var _a, _b;
201
- this.uiDefinitionProperties = getUIDefinitionProperties(runtimeContext.uiDefinitionContainer);
202
- const { PriceListId } = (_a = context.properties) !== null && _a !== void 0 ? _a : {};
203
- const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
204
- this.id15to18('AccountId', mergeContext.properties);
205
- this._runtimeContext = mergeContext;
206
- if (context.properties && ((_b = this._runtimeContext.properties) === null || _b === void 0 ? void 0 : _b.StartDate)) {
207
- this.contextService.update({
208
- properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
209
- });
210
- }
211
- return this._runtimeContext;
212
- }), tap(() => (this._isInitialized = true)));
188
+ cleanup() {
189
+ this.flowSubj$.next(null);
190
+ this.params = undefined;
191
+ this.templates = {};
213
192
  }
214
- overrideUIDefinition(uiDefinitionContainer) {
215
- if (!this._runtimeContext) {
216
- return;
193
+ initFlowTemplates$(flow) {
194
+ var _a, _b, _c;
195
+ if (isEmpty(flow.properties.templates)) {
196
+ return of(undefined);
217
197
  }
218
- this._runtimeContext.uiDefinitionContainer = uiDefinitionContainer;
219
- this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
198
+ return forkJoin([
199
+ this.templatesApiService.fetchTemplates$(),
200
+ (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : of([]),
201
+ ]).pipe(map$1(([templates, localTemplates]) => {
202
+ Object.entries(Object.assign(Object.assign({}, this.defaultTemplates), flow.properties.templates)).forEach(([key, name]) => {
203
+ var _a;
204
+ const type = this.remapTemplateName(key);
205
+ if (type) {
206
+ this.templates[type] =
207
+ (_a = localTemplates.find(template => template.name === name && template.type === type)) !== null && _a !== void 0 ? _a : templates.find(template => template.name === name && template.type === type);
208
+ }
209
+ });
210
+ }));
220
211
  }
221
- id15to18(propertyName, source) {
222
- if (!source) {
223
- return;
212
+ remapTemplateName(templateType) {
213
+ switch (templateType) {
214
+ case 'flowEngine':
215
+ return UITemplateType.FLOW_ENGINE;
216
+ default:
217
+ break;
224
218
  }
225
- const value = source[propertyName];
226
- if (typeof value === 'string' && value.length === 15) {
227
- source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
219
+ switch (templateType) {
220
+ case 'assets':
221
+ case 'shoppingCart':
222
+ // No separate Assets template at the moment
223
+ return UITemplateType.SHOPPING_CART;
224
+ case 'catalog':
225
+ return UITemplateType.CATALOG;
226
+ case 'docGen':
227
+ return UITemplateType.DOCGEN;
228
+ case 'guidedSelling':
229
+ return UITemplateType.GUIDED_SELLING;
230
+ case 'flowHeader':
231
+ return UITemplateType.FLOW_HEADER;
232
+ default:
233
+ break;
228
234
  }
229
- }
230
- get isInitialized() {
231
- return this._isInitialized;
232
- }
233
- get runtimeModel() {
234
- var _a;
235
- return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
236
- }
237
- get runtimeContext() {
238
- return this._runtimeContext;
235
+ return undefined;
239
236
  }
240
237
  }
241
- ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
242
- ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService });
243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
244
- type: Injectable
245
- }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
238
+ FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: i1.FlowsApiService }, { token: i1.UITemplatesApiService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
239
+ FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, providedIn: 'root' });
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, decorators: [{
241
+ type: Injectable,
242
+ args: [{ providedIn: 'root' }]
243
+ }], ctorParameters: function () {
244
+ return [{ type: i1.FlowsApiService }, { type: i1.UITemplatesApiService }, { type: undefined, decorators: [{
245
+ type: Optional
246
+ }, {
247
+ type: Inject,
248
+ args: [FLOW_CUSTOMIZATION]
249
+ }] }];
250
+ } });
246
251
 
247
252
  const findLineItem = (id, lineItems) => {
248
253
  return findLineItemWithComparator(lineItems, (li) => li.id === id);
@@ -395,7 +400,7 @@ const isLineItemModified = (lineItem) => {
395
400
  const multiplyLineItems = (lineItem, qty, split) => {
396
401
  if (split) {
397
402
  const unifyIds = (lineItem) => (Object.assign(Object.assign({}, lineItem), { id: UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds) }));
398
- return map$1(new Array(qty), () => unifyIds(lineItem));
403
+ return map$2(new Array(qty), () => unifyIds(lineItem));
399
404
  }
400
405
  else {
401
406
  return [
@@ -452,7 +457,52 @@ class LineItemWorker {
452
457
  }
453
458
  }
454
459
 
460
+ function extractMetadata(uiDefinition) {
461
+ return omit(uiDefinition, [
462
+ 'children',
463
+ 'pages',
464
+ 'components',
465
+ ]);
466
+ }
467
+
468
+ class IntegrationState {
469
+ constructor() {
470
+ this.stateSubj$ = new BehaviorSubject({});
471
+ this.action$ = new Subject();
472
+ }
473
+ get state$() {
474
+ return this.stateSubj$.asObservable();
475
+ }
476
+ get state() {
477
+ return this.stateSubj$.getValue();
478
+ }
479
+ patchState(update) {
480
+ this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
481
+ }
482
+ dispatch(action) {
483
+ this.action$.next(action);
484
+ }
485
+ listen$(actionType) {
486
+ return this.action$.pipe(filter$1(action => action.type === actionType), map$1(action => action.payload));
487
+ }
488
+ listenAll$() {
489
+ return this.action$.asObservable();
490
+ }
491
+ clear() {
492
+ this.stateSubj$.next({});
493
+ }
494
+ }
495
+ IntegrationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IntegrationState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
496
+ IntegrationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IntegrationState, providedIn: 'root' });
497
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IntegrationState, decorators: [{
498
+ type: Injectable,
499
+ args: [{ providedIn: 'root' }]
500
+ }] });
501
+
455
502
  class QuoteDraftService {
503
+ get isInitialized$() {
504
+ return this.isInitializedSubj$.asObservable();
505
+ }
456
506
  get isInitialized() {
457
507
  return this.isInitializedSubj$.getValue();
458
508
  }
@@ -476,12 +526,20 @@ class QuoteDraftService {
476
526
  }
477
527
  get hasProducts() {
478
528
  const quoteDraft = this.quoteSubj$.value;
479
- return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
529
+ return this.filterByActivePriceList((quoteDraft === null || quoteDraft === void 0 ? void 0 : quoteDraft.currentState) || []).some(li => !li.assetId && !li.openOrderLineItemId);
480
530
  }
481
- constructor(context, quoteApiService, priceApiService) {
531
+ get hasAssets$() {
532
+ return this.quoteSubj$.pipe(map(() => this.hasAssets));
533
+ }
534
+ get hasAssets() {
535
+ const quoteDraft = this.quoteSubj$.value;
536
+ return this.filterByActivePriceList((quoteDraft === null || quoteDraft === void 0 ? void 0 : quoteDraft.currentState) || []).some(li => li.assetId || li.openOrderLineItemId);
537
+ }
538
+ constructor(context, quoteApiService, priceApiService, integrationState) {
482
539
  this.context = context;
483
540
  this.quoteApiService = quoteApiService;
484
541
  this.priceApiService = priceApiService;
542
+ this.integrationState = integrationState;
485
543
  this.quoteSubj$ = new BehaviorSubject(null);
486
544
  this.resetSubj$ = new BehaviorSubject(true);
487
545
  this.isInitializedSubj$ = new BehaviorSubject(false);
@@ -492,12 +550,13 @@ class QuoteDraftService {
492
550
  this.reset$ = this.resetSubj$.asObservable();
493
551
  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));
494
552
  this.isInitializedSubj$
495
- .pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
553
+ .pipe(filter(isInitialized => isInitialized), switchMap$1(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
496
554
  .subscribe();
497
555
  }
498
556
  reset() {
499
557
  this.resetSubj$.next(true);
500
558
  this.quoteSubj$.next(null);
559
+ this.isInitialized = false;
501
560
  this.hasUnsavedChanges = false;
502
561
  }
503
562
  init(quoteId, params) {
@@ -508,6 +567,11 @@ class QuoteDraftService {
508
567
  this.populateActivePriceLists$();
509
568
  }), map(() => noop()), take(1));
510
569
  }
570
+ finalizeInit() {
571
+ this.initializeModifiedAssetsMap();
572
+ this.isInitialized = true;
573
+ this.hasUnsavedChanges = false;
574
+ }
511
575
  setCurrentLineItemState(lineItems) {
512
576
  const quoteDraft = this.quoteSubj$.value;
513
577
  if (!quoteDraft) {
@@ -653,333 +717,418 @@ class QuoteDraftService {
653
717
  this.hasUnsavedChanges = !isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
654
718
  }
655
719
  }
720
+ initializeModifiedAssetsMap() {
721
+ this.integrationState.patchState({
722
+ modifiedAssets: generateModifiedAssetsMap(this.currentState),
723
+ });
724
+ }
656
725
  }
657
- QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
658
- QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QuoteDraftService, decorators: [{
726
+ QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }, { token: IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
727
+ QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
728
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
660
729
  type: Injectable,
661
730
  args: [{ providedIn: 'root' }]
662
- }], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
731
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }, { type: IntegrationState }]; } });
663
732
 
664
- class ConfigurationService {
665
- constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
666
- this.quoteDraftService = quoteDraftService;
667
- this.runtimeService = runtimeService;
733
+ class FlowStateService {
734
+ constructor(contextService, quoteDraftService, flowInfoService, flowConfiguration, processorsApiService, flowStateApiService, quoteApiService, toastService, customizationService) {
668
735
  this.contextService = contextService;
669
- this.configurationApiService = configurationApiService;
670
- this.messageService = messageService;
671
- this.dialogService = dialogService;
672
- this.mode = ConfigurationMode.SEARCH;
673
- this.lineItem = new BehaviorSubject(undefined);
674
- this.charges = new BehaviorSubject({});
675
- this.pricePlans = new BehaviorSubject({});
676
- this.isLoadingSubj$ = new BehaviorSubject(false);
677
- this.isLoading$ = this.isLoadingSubj$.asObservable();
678
- this.hasUnsavedChanges = false;
679
- }
680
- reset() {
681
- this.hasUnsavedChanges = false;
682
- this.runtimeService.reset();
683
- this.configurableRamp = undefined;
684
- this.lineItem.next(undefined);
685
- this.charges.next({});
686
- this.pricePlans.next({});
736
+ this.quoteDraftService = quoteDraftService;
737
+ this.flowInfoService = flowInfoService;
738
+ this.flowConfiguration = flowConfiguration;
739
+ this.processorsApiService = processorsApiService;
740
+ this.flowStateApiService = flowStateApiService;
741
+ this.quoteApiService = quoteApiService;
742
+ this.toastService = toastService;
743
+ this.customizationService = customizationService;
744
+ this.NOT_INITIALIZED = Symbol();
745
+ this._hasStatefulUnsavedChanges = false;
746
+ this.stateId$ = new BehaviorSubject(null);
747
+ this.processors = {};
748
+ this.subscriptions = {};
749
+ this.cleanup$ = new Subject();
750
+ /*
751
+ In stateless mode watch QuoteDraft changes and call executeRequest so that
752
+ all subscriptions get their updates according to updated QuoteDraft
753
+ */
754
+ this.isInitialized$()
755
+ .pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap(() => this.flowConfiguration.updated$), switchMap(() => this.executeRequest$({}, true)))
756
+ .subscribe();
757
+ this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(flow => {
758
+ if (!flow.properties.stateful) {
759
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.charges));
760
+ }
761
+ else {
762
+ return this.subscribe$(UITemplateType.FLOW_ENGINE, 'CHARGES', null, {
763
+ cold: true,
764
+ }).pipe(map$1(response => (response.success ? response.result : {})));
765
+ }
766
+ }), filter$1(isDefined), shareReplay$1());
767
+ this.charges$.subscribe();
768
+ this.pricePlans$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(flow => {
769
+ if (!flow.properties.stateful) {
770
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.pricePlans));
771
+ }
772
+ else {
773
+ return this.subscribe$(UITemplateType.FLOW_ENGINE, 'PRICE_PLANS', null, {
774
+ cold: true,
775
+ }).pipe(map$1(response => (response.success ? response.result : {})));
776
+ }
777
+ }), filter$1(isDefined), shareReplay$1());
778
+ this.pricePlans$.subscribe();
779
+ this.activeMetrics$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(flow => {
780
+ if (!flow.properties.stateful) {
781
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.activeMetrics));
782
+ }
783
+ else {
784
+ return this.subscribe$(UITemplateType.FLOW_ENGINE, 'ACTIVE_METRICS', null, {
785
+ cold: true,
786
+ }).pipe(map$1(response => (response.success ? response.result : [])));
787
+ }
788
+ }), filter$1(isDefined), shareReplay$1());
789
+ this.activeMetrics$.subscribe();
687
790
  }
688
- patch$(lineItem, options) {
689
- if (!this.lineItem.value) {
690
- return throwError(() => new Error(`Source LineItem not found`));
691
- }
692
- const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
693
- this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
694
- return this.configure().pipe(catchError(error => {
695
- console.error(error);
696
- if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
697
- this.messageService.add({ severity: 'error', summary: error });
791
+ init$() {
792
+ return this.initProcessors$().pipe(switchMap(() => {
793
+ if (this.getFlowSafe().properties.stateful) {
794
+ return this.initStateful$();
698
795
  }
699
- // bounce back if configuration call has failed
700
- this.lineItem.next(this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined);
701
- return throwError(() => error);
702
- }), tap(() => {
703
- if (!this.hasUnsavedChanges) {
704
- this.hasUnsavedChanges = true;
796
+ else {
797
+ return this.initStateless$();
705
798
  }
706
799
  }));
707
800
  }
708
- patch(lineItem, options) {
709
- this.patch$(lineItem, options).subscribe();
710
- }
711
- setConfigurableRamp(lineItem) {
712
- this.configurableRamp = lineItem;
713
- }
714
- get() {
715
- return this.lineItem.asObservable().pipe(shareReplay$1());
716
- }
717
- getSnapshot() {
718
- return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
719
- }
720
- getRuntimeModel() {
721
- const runtimeModel = this.runtimeService.runtimeModel;
722
- if (!runtimeModel) {
723
- throw new Error('Runtime model not initialized');
801
+ cleanup() {
802
+ Object.values(this.subscriptions).forEach(({ data$ }) => data$.complete());
803
+ this.subscriptions = {};
804
+ if (this.stateId$.value) {
805
+ this.flowStateApiService.cancel(this.stateId$.value).subscribe();
806
+ this.stateId$.next(null);
724
807
  }
725
- return runtimeModel;
808
+ this.processors = {};
809
+ this.cleanup$.next();
726
810
  }
727
- getRuntimeContext() {
728
- const runtimeContext = this.runtimeService.runtimeContext;
729
- if (!runtimeContext) {
730
- throw new Error('Runtime context not initialized');
731
- }
732
- return runtimeContext;
811
+ get hasUnsavedChanges() {
812
+ return this.getFlowSafe().properties.stateful
813
+ ? this._hasStatefulUnsavedChanges
814
+ : this.quoteDraftService.hasUnsavedChanges;
733
815
  }
734
- get contextSnapshot() {
735
- return this.contextService.resolve();
816
+ get stateId() {
817
+ return this.stateId$.value;
736
818
  }
737
- get context$() {
738
- return this.contextService.resolve$();
819
+ isInitialized$() {
820
+ return combineLatest([this.stateId$, this.quoteDraftService.isInitialized$]).pipe(map$1(values => values.some(Boolean)));
739
821
  }
740
- get charges$() {
741
- return this.charges.asObservable();
822
+ isInitialized() {
823
+ return Boolean(this.stateId$.value) || this.quoteDraftService.isInitialized;
742
824
  }
743
- get chargesSnapshot() {
744
- return this.charges.value;
825
+ execute$(scope, exec) {
826
+ const request = this.execToRequest(scope, exec);
827
+ return this.executeRequest$(request).pipe(map$1(result => {
828
+ // Keep only requested results
829
+ const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
830
+ var _a;
831
+ if ((_a = exec.selectors) === null || _a === void 0 ? void 0 : _a[requestId]) {
832
+ trunk[requestId] = result;
833
+ }
834
+ return trunk;
835
+ }, {});
836
+ return actualSelectors;
837
+ }));
745
838
  }
746
- get pricePlans$() {
747
- return this.pricePlans.asObservable();
839
+ dispatch$(scope, action, inputData) {
840
+ const exec = {
841
+ actions: [{ name: action, inputData }],
842
+ };
843
+ const request = this.execToRequest(scope, exec);
844
+ return this.executeRequest$(request).pipe(map$1(noop));
748
845
  }
749
- get pricePlansSnapshot() {
750
- return this.pricePlans.value;
751
- }
752
- configure() {
753
- return this.configureRequest$(this.generateRequest());
754
- }
755
- configureRequest$(configurationRequest) {
756
- var _a;
757
- const runtimeContext = this.getRuntimeContext();
758
- const runtimeModel = this.getRuntimeModel();
759
- const uiDefinitionProperties = this.getUIDefinitionProperties();
760
- const mainPricingEnabled = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.PricingEnabled;
761
- const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
762
- this.isLoadingSubj$.next(true);
763
- return this.configurationApiService.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled }).pipe(tap(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
764
- this.contextService.update(context !== null && context !== void 0 ? context : {});
765
- this.charges.next(charges !== null && charges !== void 0 ? charges : {});
766
- this.pricePlans.next(pricePlans !== null && pricePlans !== void 0 ? pricePlans : {});
767
- if (lineItem) {
768
- this.lineItem.next(lineItem);
846
+ select$(scope, selectorName, inputData) {
847
+ const requestId = this.generateRequestId(scope, selectorName, inputData);
848
+ const request = this.execToRequest(scope, {
849
+ selectors: {
850
+ [requestId]: {
851
+ name: selectorName,
852
+ inputData,
853
+ },
854
+ },
855
+ });
856
+ return this.executeRequest$(request).pipe(map$1(response => response.selectors[requestId]));
857
+ }
858
+ subscribe$(scope, selectorName, inputData, options) {
859
+ const requestId = this.generateRequestId(scope, selectorName, inputData);
860
+ if (!this.subscriptions[requestId]) {
861
+ const request = this.execToRequest(scope, {
862
+ selectors: {
863
+ [requestId]: {
864
+ name: selectorName,
865
+ inputData,
866
+ },
867
+ },
868
+ });
869
+ this.subscriptions[requestId] = {
870
+ request,
871
+ data$: new BehaviorSubject(this.NOT_INITIALIZED),
872
+ };
873
+ if (!(options === null || options === void 0 ? void 0 : options.cold)) {
874
+ this.executeRequest$(request).subscribe();
769
875
  }
770
- if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
771
- this.showInactiveProductsConfirmation();
876
+ }
877
+ return this.subscriptions[requestId].data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), finalize(() => {
878
+ if (!this.subscriptions[requestId].data$.observed) {
879
+ delete this.subscriptions[requestId];
772
880
  }
773
- this.configurableRamp = lineItem;
774
- }), map(({ lineItem }) => lineItem), catchError(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })), finalize(() => this.isLoadingSubj$.next(false)));
881
+ }));
775
882
  }
776
- configureExternal$(props) {
777
- return this.runtimeService
778
- .init({ productId: props.productId, defaultQty: props.qty, attributesMap: props.attributesMap })
779
- .pipe(switchMap(() => this.configure()), first(), catchError(error => {
780
- this.messageService.add({ severity: ToastType.error, summary: error });
781
- throw error;
782
- }), finalize(() => this.reset()));
883
+ save$() {
884
+ if (this.getFlowSafe().properties.stateful) {
885
+ if (this.stateId$.value) {
886
+ return this.flowStateApiService.save(this.stateId$.value);
887
+ }
888
+ }
889
+ else {
890
+ const quoteDraft = this.quoteDraftService.quoteDraftForActivePriceList;
891
+ if (quoteDraft) {
892
+ return this.quoteApiService.upsertQuote(quoteDraft);
893
+ }
894
+ }
895
+ return of({ quoteId: '' });
783
896
  }
784
- configureGuidedSelling$(data) {
785
- return this.configurationApiService
786
- .configureLineItem({
787
- configurationRequest: getGuidedSellingConfigurationRequest(data),
788
- })
789
- .pipe(catchError(error => {
790
- if (error instanceof HttpErrorResponse) {
791
- this.messageService.add({ severity: ToastType.error, summary: error.error.message || error.error });
897
+ submit$() {
898
+ if (this.getFlowSafe().properties.stateful) {
899
+ if (this.stateId$.value) {
900
+ return this.flowStateApiService.submit(this.stateId$.value);
792
901
  }
793
- throw error;
794
- }));
902
+ }
903
+ else {
904
+ const quoteDraft = this.quoteDraftService.quoteDraftForActivePriceList;
905
+ if (quoteDraft) {
906
+ return this.quoteApiService.submitQuote(quoteDraft);
907
+ }
908
+ }
909
+ return of({ quoteId: '' });
795
910
  }
796
- generateRequest() {
797
- var _a, _b;
798
- const runtimeContext = this.getRuntimeContext();
799
- const uiDefinitionProperties = this.getUIDefinitionProperties();
800
- let lineItem = this.configurableRamp;
801
- if (!lineItem) {
802
- const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
803
- lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
804
- // Set default attributes
805
- if (initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap) {
806
- const attributes = transform(initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
807
- lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
911
+ getOwnerIdByScope(scope) {
912
+ var _a;
913
+ const ownerId = (_a = this.flowInfoService.templates[scope]) === null || _a === void 0 ? void 0 : _a.id;
914
+ if (!ownerId) {
915
+ throw `OwnerId is not found for scope ${scope}`;
916
+ }
917
+ return ownerId;
918
+ }
919
+ getScopeByOwnerId(id) {
920
+ for (const template of Object.values(this.flowInfoService.templates)) {
921
+ if (template.id === id) {
922
+ return template.type;
808
923
  }
809
924
  }
810
- let request = {
811
- lineItem,
812
- mode: this.mode,
813
- step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
814
- attributeDomainMode: 'ALL',
815
- context: this.contextService.resolve(),
816
- lineItems: ((_b = this.quoteDraftService.quoteDraft) === null || _b === void 0 ? void 0 : _b.currentState) || [],
817
- asset: this.getAsset(),
925
+ return;
926
+ }
927
+ execToRequest(scope, exec) {
928
+ var _a;
929
+ const ownerId = this.getOwnerIdByScope(scope);
930
+ return {
931
+ actions: (_a = exec.actions) === null || _a === void 0 ? void 0 : _a.map(action => { var _a; return ({ apiName: action.name, ownerId, inputData: (_a = action.inputData) !== null && _a !== void 0 ? _a : {} }); }),
932
+ selectors: exec.selectors &&
933
+ Object.entries(exec.selectors).reduce((trunk, [key, selector]) => {
934
+ var _a;
935
+ return (Object.assign(Object.assign({}, trunk), { [key]: { apiName: selector.name, ownerId, inputData: (_a = selector.inputData) !== null && _a !== void 0 ? _a : {} } }));
936
+ }, {}),
818
937
  };
819
- request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
820
- return request;
821
938
  }
822
- getUIDefinitionProperties() {
939
+ executeRequest$(request, forceSubscriptions = false) {
823
940
  var _a;
824
- return Object.assign(Object.assign({}, getUIDefinitionProperties(this.getRuntimeContext().uiDefinitionContainer)), ((_a = this.runtimeService.uiDefinitionProperties) !== null && _a !== void 0 ? _a : {}));
941
+ const fullRequest = cloneDeep(request);
942
+ if (((_a = fullRequest.actions) === null || _a === void 0 ? void 0 : _a.length) || forceSubscriptions) {
943
+ for (const subscription of Object.values(this.subscriptions)) {
944
+ fullRequest.selectors = assign(fullRequest.selectors, subscription.request.selectors);
945
+ }
946
+ }
947
+ const execution$ = this.getFlowSafe().properties.stateful
948
+ ? this.executeStateful$(fullRequest)
949
+ : this.executeStateless$(fullRequest);
950
+ return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
825
951
  }
826
- showInactiveProductsConfirmation() {
827
- const confirmationConfig = {
828
- title: ' ',
829
- description: 'This quote contains inactive products. Do you want to remove them?',
830
- primaryButtonLabel: 'Remove products',
831
- secondaryButtonLabel: 'Back to Quote',
832
- };
833
- this.dialogService
834
- .open(ConfirmationComponent, {
835
- dismissableMask: false,
836
- closeOnEscape: false,
837
- closable: false,
838
- showHeader: true,
839
- header: `Inactive Products in Quote`,
840
- width: '440px',
841
- data: { confirmationConfig },
842
- })
843
- .onClose.subscribe(result => {
844
- if (!result) {
845
- const context = this.contextService.resolve();
846
- window['VELO_BACK_FN'].apply(null, [context.headerId]);
952
+ handleSelectorsResponse(selectors) {
953
+ Object.entries(selectors).forEach(([requestId, selectorResult]) => {
954
+ var _a;
955
+ if (!selectorResult.success) {
956
+ this.toastService.add({ severity: ToastType.error, summary: selectorResult.errorMessage });
957
+ }
958
+ const subscription$ = (_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$;
959
+ if (subscription$) {
960
+ subscription$.next(selectorResult);
847
961
  }
848
962
  });
849
963
  }
850
- getAsset() {
964
+ initStateful$() {
851
965
  var _a;
852
- const lineItem = this.configurableRamp;
853
- if (!lineItem) {
854
- return;
855
- }
856
- return (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
857
- }
858
- }
859
- ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
860
- ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationService });
861
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationService, decorators: [{
862
- type: Injectable
863
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }]; } });
864
-
865
- class ConfigurationState {
866
- constructor(statefulConfigurationApiService, runtimeService, configurationService, toastService) {
867
- this.statefulConfigurationApiService = statefulConfigurationApiService;
868
- this.runtimeService = runtimeService;
869
- this.configurationService = configurationService;
870
- this.toastService = toastService;
871
- this.stateSubj$ = new BehaviorSubject({});
872
- this.state$ = this.stateSubj$.asObservable();
873
- this.stateId = null;
966
+ // Subscriptions
967
+ this.subscribe$(UITemplateType.FLOW_ENGINE, 'CONTEXT', null, { cold: true })
968
+ .pipe(tap$1(response => {
969
+ if (response.success) {
970
+ this.contextService.update(response.result);
971
+ }
972
+ }), takeUntil(this.cleanup$))
973
+ .subscribe();
974
+ const processorsList = flatten(Object.values(this.processors).map(ownerMap => Object.values(ownerMap !== null && ownerMap !== void 0 ? ownerMap : {})));
975
+ const processors = processorsList.length ? processorsList : undefined;
976
+ const selectors = Object.values(this.subscriptions)
977
+ .map(({ request }) => request.selectors)
978
+ .filter(isDefined)
979
+ .reduce((trunk, selectors) => (Object.assign(Object.assign({}, trunk), selectors)), {});
980
+ const request = this.getDefaultExecutionRequestDTO();
981
+ return this.flowStateApiService
982
+ .init({
983
+ quoteId: this.contextService.resolve().headerId,
984
+ params: (_a = this.flowInfoService.params) !== null && _a !== void 0 ? _a : {},
985
+ actionsOverride: processors === null || processors === void 0 ? void 0 : processors.filter(processor => processor.type === ConfigurationProcessorTypes.ACTION),
986
+ selectorsOverride: processors === null || processors === void 0 ? void 0 : processors.filter(processor => processor.type === ConfigurationProcessorTypes.SELECTOR),
987
+ selectors: Object.assign(Object.assign({}, selectors), request.selectors),
988
+ actions: request.actions,
989
+ })
990
+ .pipe(map$1(({ stateId, selectors }) => {
991
+ this.handleSelectorsResponse(selectors);
992
+ this.stateId$.next(stateId);
993
+ }));
874
994
  }
875
- init$() {
876
- return this.configurationService.configure().pipe(switchMap$1(() => {
877
- var _a, _b;
878
- if (!this.isStatefulConfiguration) {
879
- return of(undefined);
995
+ executeStateful$(request) {
996
+ if (!this.stateId$.value) {
997
+ throw 'Stateful session is not initialized';
998
+ }
999
+ return this.flowStateApiService.execute(this.stateId$.value, request).pipe(tap$1(() => {
1000
+ var _a;
1001
+ if ((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length) {
1002
+ this._hasStatefulUnsavedChanges = true;
880
1003
  }
881
- const { actions, selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
882
- return this.statefulConfigurationApiService.init({
883
- request: this.configurationService.generateRequest(),
884
- actions: actions === null || actions === void 0 ? void 0 : actions.map(action => ({ name: action.apiName, script: action.script })),
885
- selectors: selectors === null || selectors === void 0 ? void 0 : selectors.map(selector => ({ name: selector.apiName, script: selector.script })),
886
- });
887
- }), tap$1(stateId => (this.stateId = stateId || null)), map$2(() => undefined));
1004
+ }), tap$1(response => this.stateId$.next(response.stateId)));
888
1005
  }
889
- cleanup() {
890
- this.stateId = null;
891
- this.configurationService.reset();
892
- this.stateSubj$.next({});
1006
+ initStateless$() {
1007
+ var _a;
1008
+ const { headerId } = this.contextService.resolve();
1009
+ const stateInit$ = this.quoteDraftService.init(headerId, (_a = this.flowInfoService.params) !== null && _a !== void 0 ? _a : {}).pipe(switchMap(() => this.executeRequest$(this.getDefaultExecutionRequestDTO())), switchMap(() => this.calculate$()));
1010
+ return stateInit$.pipe(tap$1(() => this.quoteDraftService.finalizeInit()), map$1(noop));
893
1011
  }
894
- execute$(req) {
895
- if (this.isStatefulConfiguration) {
896
- return this.executeStateful$(req);
1012
+ calculate$() {
1013
+ const flowState = this.quoteDraftService.quoteDraft;
1014
+ if (!flowState) {
1015
+ return of(undefined);
897
1016
  }
898
- else {
899
- return this.executeStateless$(req);
1017
+ /*
1018
+ Don't execute procedures when:
1019
+ * Initializing a standalone product configuration UI, as procedure is execute in /price call
1020
+ * Initializing an empty account (account with no assets)
1021
+ */
1022
+ const isEmptyAccountMode = this.contextService.mode === ConfigurationContextMode.ACCOUNT && !this.quoteDraftService.hasProducts;
1023
+ if (this.quoteDraftService.isStandalone || isEmptyAccountMode) {
1024
+ return of(undefined);
900
1025
  }
901
- }
902
- dispatch$(actionName, inputData) {
903
- return this.execute$({ actions: [{ name: actionName, inputData }] });
904
- }
905
- select$(selectorName, inputData) {
906
- const requestId = UUID.UUID();
907
- return this.execute$({
908
- selectors: {
909
- [requestId]: {
910
- name: selectorName,
911
- inputData,
912
- },
913
- },
914
- }).pipe(map$2(() => this.stateSubj$.value[requestId]), tap$1(() => this.stateSubj$.next(omit(this.stateSubj$.value, requestId))));
915
- }
916
- get isStatefulConfiguration() {
917
- var _a;
918
- return (_a = this.runtimeService.uiDefinitionProperties.statefulConfigurationEnabled) !== null && _a !== void 0 ? _a : false;
1026
+ return this.flowConfiguration.calculate$(flowState);
919
1027
  }
920
1028
  executeStateless$(request) {
921
- return of(undefined).pipe(switchMap$1(() => {
1029
+ return of(undefined).pipe(tap$1(() => this.executeStatelessActions(request)), switchMap(() => {
922
1030
  var _a;
923
- // Apply actions and execute configuration/price call
924
- // No need to run configuration if no actions in the request
925
- if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
1031
+ /*
1032
+ Skip price calculation in case
1033
+ 1. No actions in the request
1034
+ 2. Initialization process execution (state not initialized yet)
1035
+ */
1036
+ if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length) || !this.isInitialized()) {
926
1037
  return of(undefined);
927
1038
  }
928
- let configurationRequest = this.configurationService.generateRequest();
929
- request.actions.forEach(action => {
930
- var _a;
931
- configurationRequest = (_a = this.executeActionScript(configurationRequest, action)) !== null && _a !== void 0 ? _a : configurationRequest;
932
- });
933
- return this.configurationService.configureRequest$(configurationRequest);
934
- }), tap$1(() => {
935
- if (!request.selectors) {
936
- return;
1039
+ else {
1040
+ return this.calculate$();
937
1041
  }
938
- // Run selectors and apply them to the state
939
- const finalConfigurationRequest = this.configurationService.generateRequest();
940
- const selectorsResult = EntityUtil.entries(request.selectors).reduce((trunk, [key, selector]) => {
941
- trunk[key] = this.executeSelectorScript(finalConfigurationRequest, selector);
942
- return trunk;
943
- }, {});
944
- this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.value), selectorsResult));
945
- }), map$2(() => undefined));
1042
+ }), map$1(() => this.executeStatelessSelectors(request)));
946
1043
  }
947
- executeStateful$(request) {
948
- if (!this.stateId) {
1044
+ executeStatelessActions(request) {
1045
+ var _a;
1046
+ if (!this.quoteDraftService.quoteDraft || !((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
1047
+ return;
1048
+ }
1049
+ let flowState = this.quoteDraftService.quoteDraft;
1050
+ request.actions.forEach(action => {
1051
+ var _a;
1052
+ flowState = (_a = this.executeActionScript(flowState, action)) !== null && _a !== void 0 ? _a : flowState;
1053
+ });
1054
+ this.quoteDraftService.updateQuoteDraft(flowState);
1055
+ }
1056
+ executeStatelessSelectors(request) {
1057
+ var _a;
1058
+ if (!this.quoteDraftService.quoteDraft) {
1059
+ throw 'QuoteDraft is not initialized';
1060
+ }
1061
+ const flowState = this.quoteDraftService.quoteDraft;
1062
+ return EntityUtil.entries((_a = request.selectors) !== null && _a !== void 0 ? _a : {}).reduce((result, [key, selector]) => {
1063
+ try {
1064
+ result.selectors[key] = {
1065
+ success: true,
1066
+ result: this.executeSelectorScript(flowState, selector),
1067
+ };
1068
+ }
1069
+ catch (e) {
1070
+ result.selectors[key] = {
1071
+ success: false,
1072
+ errorMessage: String(e),
1073
+ };
1074
+ }
1075
+ return result;
1076
+ }, { stateId: '', selectors: {} });
1077
+ }
1078
+ getFlowSafe() {
1079
+ if (!this.flowInfoService.flow) {
1080
+ throw 'Flow is not defined';
1081
+ }
1082
+ return this.flowInfoService.flow;
1083
+ }
1084
+ initProcessors$() {
1085
+ var _a;
1086
+ const hasOverrides = Boolean((_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors);
1087
+ const flow = this.getFlowSafe();
1088
+ if (flow.properties.stateful && !hasOverrides) {
1089
+ // Skip initialization as backend will take processors from SF
949
1090
  return of(undefined);
950
1091
  }
951
- return this.statefulConfigurationApiService.execute(this.stateId, request).pipe(tap$1(response => {
952
- this.stateId = response.stateId;
953
- const updatedState = this.stateSubj$.value;
954
- EntityUtil.entries(response.selectors).forEach(([key, value]) => {
955
- if (!value.success) {
956
- if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
957
- this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
958
- }
959
- return;
960
- }
961
- updatedState[key] = value.result;
962
- });
963
- this.stateSubj$.next(updatedState);
964
- }), map$2(() => undefined));
1092
+ const owners$ = Object.values(this.flowInfoService.templates)
1093
+ .map(template => {
1094
+ var _a, _b, _c;
1095
+ if (!template) {
1096
+ return;
1097
+ }
1098
+ const localProcessors$ = (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors) === null || _b === void 0 ? void 0 : _b.call(_a, template.name)) !== null && _c !== void 0 ? _c : of(null);
1099
+ return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap$1(processors => {
1100
+ const processorsMap = processors.reduce((acc, p) => {
1101
+ acc[p.apiName] = p;
1102
+ return acc;
1103
+ }, {});
1104
+ this.processors[template.id] = processorsMap;
1105
+ }));
1106
+ })
1107
+ .filter(isDefined);
1108
+ if (!owners$.length) {
1109
+ return of(undefined);
1110
+ }
1111
+ return forkJoin(owners$).pipe(map$1(noop));
965
1112
  }
966
- executeActionScript(request, processor) {
967
- var _a, _b, _c;
968
- const { actions } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
969
- const script = (_c = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
1113
+ executeActionScript(request, executable) {
1114
+ var _a, _b;
1115
+ const script = (_b = (_a = this.processors[executable.ownerId]) === null || _a === void 0 ? void 0 : _a[executable.apiName]) === null || _b === void 0 ? void 0 : _b.script;
970
1116
  if (!script) {
971
- return null;
1117
+ const scope = this.getScopeByOwnerId(executable.ownerId);
1118
+ const scopeText = scope ? ` in ${scope}` : '';
1119
+ throw `ConfigurationProcessor ${executable.apiName}${scopeText} not found`;
972
1120
  }
973
- return this.executeProcessorScript(request, script, processor.inputData);
1121
+ return this.executeProcessorScript(request, script, executable.inputData);
974
1122
  }
975
- executeSelectorScript(request, processor) {
976
- var _a, _b, _c;
977
- const { selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
978
- const script = (_c = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
1123
+ executeSelectorScript(request, executable) {
1124
+ var _a, _b;
1125
+ const script = (_b = (_a = this.processors[executable.ownerId]) === null || _a === void 0 ? void 0 : _a[executable.apiName]) === null || _b === void 0 ? void 0 : _b.script;
979
1126
  if (!script) {
980
- return null;
1127
+ const scope = this.getScopeByOwnerId(executable.ownerId);
1128
+ const scopeText = scope ? ` in ${scope}` : '';
1129
+ throw `ConfigurationProcessor ${executable.apiName}${scopeText} not found`;
981
1130
  }
982
- return this.executeProcessorScript(request, script, processor.inputData);
1131
+ return this.executeProcessorScript(request, script, executable.inputData);
983
1132
  }
984
1133
  executeProcessorScript(request, script, inputData) {
985
1134
  return new Function(`${script}\nreturn transform;`)()({
@@ -987,20 +1136,41 @@ class ConfigurationState {
987
1136
  inputData: inputData,
988
1137
  });
989
1138
  }
1139
+ generateRequestId(scope, selectorName, inputData) {
1140
+ const inputDataHash = UUID.hex(JSON.stringify(inputData) || '').slice(0, 8);
1141
+ return `${scope}/${selectorName}/${inputDataHash}`;
1142
+ }
1143
+ getDefaultExecutionRequestDTO() {
1144
+ var _a;
1145
+ const request = {
1146
+ actions: [],
1147
+ selectors: {},
1148
+ };
1149
+ if (this.getFlowSafe().properties.standalone) {
1150
+ return request;
1151
+ }
1152
+ const ownerId = this.getOwnerIdByScope(UITemplateType.FLOW_ENGINE);
1153
+ (_a = request.actions) === null || _a === void 0 ? void 0 : _a.push({
1154
+ apiName: 'INITIALIZE_STATE',
1155
+ ownerId,
1156
+ inputData: {},
1157
+ });
1158
+ return request;
1159
+ }
990
1160
  }
991
- ConfigurationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState, deps: [{ token: i1.StatefulConfigurationApiService }, { token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: i4.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
992
- ConfigurationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState });
993
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState, decorators: [{
994
- type: Injectable
995
- }], ctorParameters: function () { return [{ type: i1.StatefulConfigurationApiService }, { type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: i4.ToastService }]; } });
996
-
997
- function extractMetadata(uiDefinition) {
998
- return omit(uiDefinition, [
999
- 'children',
1000
- 'pages',
1001
- 'components',
1002
- ]);
1003
- }
1161
+ FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: ContextService }, { token: QuoteDraftService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.ConfigurationProcessorsApiService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }, { token: i6.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1162
+ FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, providedIn: 'root' });
1163
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, decorators: [{
1164
+ type: Injectable,
1165
+ args: [{ providedIn: 'root' }]
1166
+ }], ctorParameters: function () {
1167
+ return [{ type: ContextService }, { type: QuoteDraftService }, { type: FlowInfoService }, { type: FlowConfigurationService }, { type: i1.ConfigurationProcessorsApiService }, { type: i1.FlowStateApiService }, { type: i1.QuoteApiService }, { type: i6.ToastService }, { type: undefined, decorators: [{
1168
+ type: Optional
1169
+ }, {
1170
+ type: Inject,
1171
+ args: [FLOW_CUSTOMIZATION]
1172
+ }] }];
1173
+ } });
1004
1174
 
1005
1175
  class FlowUpdateService {
1006
1176
  update(rootLineItems, updates, charges) {
@@ -1128,170 +1298,937 @@ class FlowUpdateService {
1128
1298
  return true;
1129
1299
  }
1130
1300
  }
1131
- FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1132
- FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService });
1133
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService, decorators: [{
1301
+ FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1302
+ FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService });
1303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, decorators: [{
1134
1304
  type: Injectable
1135
1305
  }] });
1136
1306
 
1137
- class FlowConfigurationService {
1138
- constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
1139
- this.proceduresApiService = proceduresApiService;
1140
- this.contextService = contextService;
1141
- this.quoteDraftService = quoteDraftService;
1142
- this.updateService = updateService;
1143
- this.configurationService = configurationService;
1307
+ class RuntimeSettingsService {
1308
+ constructor(configurationSettingsApiService) {
1309
+ this.configurationSettingsApiService = configurationSettingsApiService;
1310
+ this.configurationSettings$ = new BehaviorSubject({});
1311
+ this.currencySettings$ = new BehaviorSubject({
1312
+ iso: DEFAULT_CURRENCY_ISO_CODE,
1313
+ symbol: DEFAULT_CURRENCY_SYMBOL,
1314
+ });
1315
+ this.shoppingCartSettings$ = new BehaviorSubject([]);
1316
+ this.getCurrencySymbol = (locale, currency) => {
1317
+ return (0)
1318
+ .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
1319
+ .replace(/\d/g, '')
1320
+ .trim();
1321
+ };
1144
1322
  }
1145
- calculate$(quoteDraft) {
1146
- return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
1147
- // sort the result current state based on the quote draft initial state
1148
- const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
1149
- result.currentState = result.currentState
1150
- .slice()
1151
- .sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
1152
- this.quoteDraftService.updateQuoteDraft(result);
1153
- }), map$2(noop));
1323
+ create() {
1324
+ return this.configurationSettingsApiService.fetchSettings().pipe(map$1(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
1325
+ var _a;
1326
+ this.configurationSettings$.next(configurationSettings);
1327
+ this.addShoppingCartSettings((_a = configurationSettings['shopping-cart']) !== null && _a !== void 0 ? _a : []);
1328
+ this.formattingSettings = this.getFormattingSettings();
1329
+ }), map$1(() => undefined));
1154
1330
  }
1155
- calculate(quoteDraft) {
1156
- this.calculate$(quoteDraft).subscribe();
1331
+ initCurrency(iso) {
1332
+ if (iso) {
1333
+ const symbol = this.getCurrencySymbol('en-US', iso);
1334
+ this.currencySettings$.next({ iso, symbol });
1335
+ }
1157
1336
  }
1158
- update$(updates) {
1159
- const quoteDraft = this.quoteDraftService.quoteDraft;
1160
- if (!quoteDraft) {
1161
- return of(null);
1337
+ getFormattingSettings() {
1338
+ var _a, _b;
1339
+ if (this.formattingSettings) {
1340
+ return this.formattingSettings;
1162
1341
  }
1163
- return of([]).pipe(map$2(() => {
1164
- const updatedState = cloneDeep(quoteDraft.currentState);
1165
- this.updateService.update(updatedState, updates, quoteDraft.charges);
1166
- return updatedState;
1167
- }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1342
+ const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
1343
+ return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
1344
+ }, {});
1345
+ const currencySettings = this.getCurrencySettings();
1346
+ const dateFormat = (validateDateFormat((_b = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT) !== null && _b !== void 0 ? _b : '') && (shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT)) ||
1347
+ DEFAULT_DATE_FORMAT;
1348
+ const decimalSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR;
1349
+ const thousandsSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR;
1350
+ // the number of decimal places can be 0
1351
+ const priceScale = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE;
1352
+ const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
1353
+ ? Number(priceScale)
1354
+ : DEFAULT_DECIMALS_COUNT;
1355
+ const actionCodeSettings = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.STATUS_LABEL;
1356
+ return {
1357
+ currencySymbol: currencySettings.symbol,
1358
+ dateFormats: getSupportedDateFormats(dateFormat),
1359
+ decimalsCount,
1360
+ decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
1361
+ ? decimalSeparator
1362
+ : DEFAULT_DECIMAL_SEPARATOR,
1363
+ // thousands separator can be a blank value, so it can also be null
1364
+ thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
1365
+ ? thousandsSeparator || ''
1366
+ : DEFAULT_THOUSANDS_SEPARATOR,
1367
+ actionCodeLabels: (actionCodeSettings === null || actionCodeSettings === void 0 ? void 0 : actionCodeSettings.length)
1368
+ ? actionCodeSettings.reduce((result, setting) => (Object.assign(Object.assign({}, result), { [setting.status_label]: setting.custom_label })), {})
1369
+ : DEFAULT_ACTION_CODE_LABELS,
1370
+ };
1168
1371
  }
1169
- update(updates) {
1170
- this.update$(updates).subscribe();
1372
+ getConfigurationSettings() {
1373
+ return this.configurationSettings$.value;
1171
1374
  }
1172
- revert$(lineItemId) {
1173
- const quoteDraft = this.quoteDraftService.quoteDraft;
1174
- const initialCurrentState = this.quoteDraftService.getInitialCurrentState();
1175
- const currentState = this.quoteDraftService.activeCurrentState;
1176
- const currentLineItemIndex = currentState.findIndex(({ id }) => id === lineItemId);
1177
- const currentLineItem = currentState[currentLineItemIndex];
1178
- const initialLineItem = initialCurrentState.find(({ integrationId }) => integrationId === (currentLineItem === null || currentLineItem === void 0 ? void 0 : currentLineItem.integrationId));
1179
- if (!quoteDraft || !currentLineItem || !initialLineItem) {
1180
- return of(null);
1181
- }
1182
- const updatedState = cloneDeep(currentState);
1183
- updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1184
- return of([]).pipe(tap$1(() => {
1185
- this.quoteDraftService.setCurrentLineItemState(updatedState);
1186
- }), switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1375
+ getShoppingCartSettings() {
1376
+ return this.shoppingCartSettings$.value;
1187
1377
  }
1188
- revert(lineItemId) {
1189
- this.revert$(lineItemId).subscribe();
1378
+ getCurrencySettings() {
1379
+ return this.currencySettings$.value;
1190
1380
  }
1191
- delete$(ids) {
1192
- const quoteDraft = this.quoteDraftService.quoteDraft;
1193
- const currentState = this.quoteDraftService.currentState;
1194
- if (!quoteDraft) {
1195
- return of(null);
1196
- }
1197
- return of([]).pipe(map$2(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1381
+ parseConfigurationSettings(settings) {
1382
+ return settings.reduce((acc, setting) => {
1383
+ switch (setting.key) {
1384
+ case 'shopping-cart':
1385
+ acc['shopping-cart'] = parseJsonSafely(setting.value, []);
1386
+ break;
1387
+ case 'navigation':
1388
+ acc.navigation = parseJsonSafely(setting.value, {});
1389
+ break;
1390
+ case 'flows':
1391
+ acc.flows = parseJsonSafely(setting.value, []);
1392
+ break;
1393
+ default:
1394
+ acc[setting.key] = setting.value;
1395
+ }
1396
+ return acc;
1397
+ }, {});
1198
1398
  }
1199
- delete(ids) {
1200
- this.delete$(ids).subscribe();
1399
+ addShoppingCartSettings(settings) {
1400
+ // uniqBy removes items with the biggest index
1401
+ const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
1402
+ this.shoppingCartSettings$.next(newSettings);
1201
1403
  }
1202
- addTerm$(term) {
1203
- const quoteDraft = this.quoteDraftService.quoteDraft;
1204
- if (!quoteDraft) {
1205
- return of(null);
1206
- }
1207
- const updatedState = [...quoteDraft.currentState, term];
1208
- return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1404
+ }
1405
+ RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1406
+ RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
1407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
1408
+ type: Injectable,
1409
+ args: [{ providedIn: 'root' }]
1410
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
1411
+
1412
+ class ConfigurationService {
1413
+ constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService, runtimeSettings) {
1414
+ this.quoteDraftService = quoteDraftService;
1415
+ this.runtimeService = runtimeService;
1416
+ this.contextService = contextService;
1417
+ this.configurationApiService = configurationApiService;
1418
+ this.messageService = messageService;
1419
+ this.dialogService = dialogService;
1420
+ this.runtimeSettings = runtimeSettings;
1421
+ this.mode = ConfigurationMode.SEARCH;
1422
+ this.lineItem = new BehaviorSubject(undefined);
1423
+ this.charges = new BehaviorSubject({});
1424
+ this.pricePlans = new BehaviorSubject({});
1425
+ this.procedureContext = new BehaviorSubject({});
1426
+ this.isLoadingSubj$ = new BehaviorSubject(false);
1427
+ this.isLoading$ = this.isLoadingSubj$.asObservable();
1428
+ this.hasUnsavedChanges = false;
1209
1429
  }
1210
- addToCart$(props) {
1211
- const quoteDraft = this.quoteDraftService.quoteDraft;
1212
- if (!quoteDraft) {
1213
- return of(null);
1430
+ reset() {
1431
+ this.hasUnsavedChanges = false;
1432
+ this.runtimeService.reset();
1433
+ this.configurableRamp = undefined;
1434
+ this.lineItem.next(undefined);
1435
+ this.charges.next({});
1436
+ this.pricePlans.next({});
1437
+ }
1438
+ patch$(lineItem, options) {
1439
+ if (!this.lineItem.value) {
1440
+ return throwError(() => new Error(`Source LineItem not found`));
1214
1441
  }
1215
- return this.configurationService.configureExternal$(props).pipe(map$2(lineItem => {
1216
- var _a, _b, _c;
1217
- const model = this.configurationService.getRuntimeModel();
1218
- const split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(type => type.name === lineItem.type)) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
1219
- const lineItems = multiplyLineItems(lineItem, (_c = props.qty) !== null && _c !== void 0 ? _c : 1, split);
1220
- return [...quoteDraft.currentState, ...lineItems];
1221
- }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1442
+ const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
1443
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
1444
+ return this.configure().pipe(catchError$1(error => {
1445
+ console.error(error);
1446
+ if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
1447
+ this.messageService.add({ severity: 'error', summary: error });
1448
+ }
1449
+ // bounce back if configuration call has failed
1450
+ this.lineItem.next(this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined);
1451
+ return throwError(() => error);
1452
+ }), tap(() => {
1453
+ if (!this.hasUnsavedChanges) {
1454
+ this.hasUnsavedChanges = true;
1455
+ }
1456
+ }));
1457
+ }
1458
+ patch(lineItem, options) {
1459
+ this.patch$(lineItem, options).subscribe();
1460
+ }
1461
+ setConfigurableRamp(lineItem) {
1462
+ this.configurableRamp = lineItem;
1222
1463
  }
1223
1464
  get() {
1224
- return this.quoteDraftService.quoteDraft$.pipe(map$2(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
1465
+ return this.lineItem.asObservable().pipe(shareReplay$1());
1225
1466
  }
1226
1467
  getSnapshot() {
1227
- var _a, _b;
1228
- return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
1468
+ return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
1229
1469
  }
1230
- get charges$() {
1231
- return this.quoteDraftService.quoteDraft$.pipe(map$2(({ charges }) => charges));
1470
+ getRuntimeModel() {
1471
+ const runtimeModel = this.runtimeService.runtimeModel;
1472
+ if (!runtimeModel) {
1473
+ throw new Error('Runtime model not initialized');
1474
+ }
1475
+ return runtimeModel;
1232
1476
  }
1233
- get pricePlans$() {
1234
- return this.quoteDraftService.quoteDraft$.pipe(map$2(({ pricePlans }) => pricePlans));
1477
+ getRuntimeContext() {
1478
+ const runtimeContext = this.runtimeService.runtimeContext;
1479
+ if (!runtimeContext) {
1480
+ throw new Error('Runtime context not initialized');
1481
+ }
1482
+ return runtimeContext;
1235
1483
  }
1236
- get activeMetrics$() {
1237
- return this.quoteDraftService.quoteDraft$.pipe(map$2(({ activeMetrics }) => activeMetrics));
1484
+ get contextSnapshot() {
1485
+ return this.contextService.resolve();
1486
+ }
1487
+ get context$() {
1488
+ return this.contextService.resolve$();
1489
+ }
1490
+ get charges$() {
1491
+ return this.charges.asObservable();
1238
1492
  }
1239
1493
  get chargesSnapshot() {
1240
- var _a, _b;
1241
- return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
1494
+ return this.charges.value;
1495
+ }
1496
+ get pricePlans$() {
1497
+ return this.pricePlans.asObservable();
1242
1498
  }
1243
1499
  get pricePlansSnapshot() {
1244
- var _a, _b;
1245
- return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
1500
+ return this.pricePlans.value;
1246
1501
  }
1247
- get activeMetricsSnapshot() {
1248
- var _a, _b;
1249
- return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.activeMetrics) !== null && _b !== void 0 ? _b : [];
1502
+ get procedureContext$() {
1503
+ return this.procedureContext.asObservable();
1250
1504
  }
1251
- get contextSnapshot() {
1252
- return this.contextService.resolve();
1505
+ get procedureContextSnapshot() {
1506
+ return this.procedureContext.value;
1253
1507
  }
1254
- get context$() {
1255
- return this.contextService.resolve$();
1508
+ configure() {
1509
+ return this.configureRequest$(this.generateRequest());
1256
1510
  }
1257
- handleErrorAndBounceBack() {
1258
- return (source$) => {
1259
- return source$.pipe(catchError$1(error => {
1260
- console.error(error);
1261
- // bounce back if configuration call has failed
1262
- const quoteDraft = this.quoteDraftService.quoteDraft;
1263
- if (quoteDraft) {
1264
- this.quoteDraftService.updateQuoteDraft(quoteDraft);
1265
- }
1266
- return throwError(() => error);
1267
- }));
1268
- };
1511
+ configureRequest$(configurationRequest) {
1512
+ var _a;
1513
+ const runtimeContext = this.getRuntimeContext();
1514
+ const runtimeModel = this.getRuntimeModel();
1515
+ const uiDefinitionProperties = this.getUIDefinitionProperties();
1516
+ const mainPricingEnabled = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.PricingEnabled;
1517
+ const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
1518
+ const customPriceApi = this.runtimeSettings.getConfigurationSettings()['CUSTOM_PRICE_API'];
1519
+ this.isLoadingSubj$.next(true);
1520
+ const configure$ = pricingEnabled && customPriceApi
1521
+ ? this.configurationApiService.customConfigurePrice({ url: customPriceApi, configurationRequest, runtimeModel })
1522
+ : this.configurationApiService.configureLineItem({
1523
+ configurationRequest,
1524
+ runtimeModel,
1525
+ pricingEnabled,
1526
+ });
1527
+ return configure$.pipe(tap(({ lineItem, context, charges, pricePlans, deletedLineItems, procedureContext }) => {
1528
+ this.contextService.update(context !== null && context !== void 0 ? context : {});
1529
+ this.charges.next(charges !== null && charges !== void 0 ? charges : {});
1530
+ this.pricePlans.next(pricePlans !== null && pricePlans !== void 0 ? pricePlans : {});
1531
+ this.procedureContext.next(procedureContext !== null && procedureContext !== void 0 ? procedureContext : {});
1532
+ if (lineItem) {
1533
+ this.lineItem.next(lineItem);
1534
+ }
1535
+ if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
1536
+ this.showInactiveProductsConfirmation();
1537
+ }
1538
+ this.configurableRamp = lineItem;
1539
+ }), map(({ lineItem }) => 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)); })), finalize$1(() => this.isLoadingSubj$.next(false)));
1540
+ }
1541
+ configureExternal$(props) {
1542
+ return this.runtimeService
1543
+ .init({ productId: props.productId, defaultQty: props.qty, attributesMap: props.attributesMap })
1544
+ .pipe(switchMap$1(() => this.configure()), first(), catchError$1(error => {
1545
+ this.messageService.add({ severity: ToastType.error, summary: error });
1546
+ throw error;
1547
+ }), finalize$1(() => this.reset()));
1548
+ }
1549
+ configureGuidedSelling$(data) {
1550
+ return this.configurationApiService
1551
+ .configureLineItem({
1552
+ configurationRequest: getGuidedSellingConfigurationRequest(data, this.contextService.resolve()),
1553
+ })
1554
+ .pipe(catchError$1(error => {
1555
+ if (error instanceof HttpErrorResponse) {
1556
+ this.messageService.add({ severity: ToastType.error, summary: error.error.message || error.error });
1557
+ }
1558
+ throw error;
1559
+ }));
1560
+ }
1561
+ generateRequest() {
1562
+ var _a, _b;
1563
+ const runtimeContext = this.getRuntimeContext();
1564
+ const uiDefinitionProperties = this.getUIDefinitionProperties();
1565
+ let lineItem = this.configurableRamp;
1566
+ if (!lineItem) {
1567
+ const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
1568
+ lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
1569
+ // Set default attributes
1570
+ if (initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap) {
1571
+ const attributes = transform(initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
1572
+ lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
1573
+ }
1574
+ }
1575
+ let request = {
1576
+ lineItem,
1577
+ mode: this.mode,
1578
+ step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
1579
+ attributeDomainMode: 'ALL',
1580
+ context: this.contextService.resolve(),
1581
+ lineItems: ((_b = this.quoteDraftService.quoteDraft) === null || _b === void 0 ? void 0 : _b.currentState) || [],
1582
+ asset: this.getAsset(),
1583
+ };
1584
+ request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
1585
+ return request;
1586
+ }
1587
+ getUIDefinitionProperties() {
1588
+ var _a, _b, _c;
1589
+ return Object.assign(Object.assign({}, ((_b = (_a = this.getRuntimeContext().uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
1590
+ }
1591
+ showInactiveProductsConfirmation() {
1592
+ const confirmationConfig = {
1593
+ title: ' ',
1594
+ description: 'This quote contains inactive products. Do you want to remove them?',
1595
+ primaryButtonLabel: 'Remove products',
1596
+ secondaryButtonLabel: 'Back to Quote',
1597
+ };
1598
+ this.dialogService
1599
+ .open(ConfirmationComponent, {
1600
+ dismissableMask: false,
1601
+ closeOnEscape: false,
1602
+ closable: false,
1603
+ showHeader: true,
1604
+ header: `Inactive Products in Quote`,
1605
+ width: '440px',
1606
+ data: { confirmationConfig },
1607
+ })
1608
+ .onClose.subscribe(result => {
1609
+ if (!result) {
1610
+ const context = this.contextService.resolve();
1611
+ window['VELO_BACK_FN'].apply(null, [context.headerId]);
1612
+ }
1613
+ });
1614
+ }
1615
+ getAsset() {
1616
+ var _a;
1617
+ const lineItem = this.configurableRamp;
1618
+ if (!lineItem) {
1619
+ return;
1620
+ }
1621
+ return (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
1622
+ }
1623
+ }
1624
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6$1.DialogService }, { token: RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
1625
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
1626
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
1627
+ type: Injectable
1628
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6$1.DialogService }, { type: RuntimeSettingsService }]; } });
1629
+
1630
+ class FlowConfigurationService {
1631
+ constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
1632
+ this.proceduresApiService = proceduresApiService;
1633
+ this.contextService = contextService;
1634
+ this.quoteDraftService = quoteDraftService;
1635
+ this.updateService = updateService;
1636
+ this.configurationService = configurationService;
1637
+ this.updatedSubj$ = new Subject();
1638
+ this.updated$ = this.updatedSubj$.asObservable();
1639
+ }
1640
+ calculate$(quoteDraft) {
1641
+ return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
1642
+ // sort the result current state based on the quote draft initial state
1643
+ const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
1644
+ result.currentState = result.currentState
1645
+ .slice()
1646
+ .sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
1647
+ this.quoteDraftService.updateQuoteDraft(result);
1648
+ }), map$1(noop));
1649
+ }
1650
+ calculate(quoteDraft) {
1651
+ this.calculate$(quoteDraft).subscribe();
1652
+ }
1653
+ update$(updates) {
1654
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1655
+ if (!quoteDraft) {
1656
+ return of(null);
1657
+ }
1658
+ return of([]).pipe(map$1(() => {
1659
+ const updatedState = cloneDeep(quoteDraft.currentState);
1660
+ this.updateService.update(updatedState, updates, quoteDraft.charges);
1661
+ return updatedState;
1662
+ }), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1663
+ }
1664
+ update(updates) {
1665
+ this.update$(updates).subscribe();
1666
+ }
1667
+ revert$(lineItemId) {
1668
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1669
+ const initialCurrentState = this.quoteDraftService.getInitialCurrentState();
1670
+ const currentState = this.quoteDraftService.activeCurrentState;
1671
+ const currentLineItemIndex = currentState.findIndex(({ id }) => id === lineItemId);
1672
+ const currentLineItem = currentState[currentLineItemIndex];
1673
+ const initialLineItem = initialCurrentState.find(({ integrationId }) => integrationId === (currentLineItem === null || currentLineItem === void 0 ? void 0 : currentLineItem.integrationId));
1674
+ if (!quoteDraft || !currentLineItem || !initialLineItem) {
1675
+ return of(null);
1676
+ }
1677
+ const updatedState = cloneDeep(currentState);
1678
+ updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1679
+ return of([]).pipe(tap$1(() => {
1680
+ this.quoteDraftService.setCurrentLineItemState(updatedState);
1681
+ }), switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1682
+ }
1683
+ revert(lineItemId) {
1684
+ this.revert$(lineItemId).subscribe();
1685
+ }
1686
+ delete$(ids) {
1687
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1688
+ const currentState = this.quoteDraftService.currentState;
1689
+ if (!quoteDraft) {
1690
+ return of(null);
1691
+ }
1692
+ return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1693
+ }
1694
+ delete(ids) {
1695
+ this.delete$(ids).subscribe();
1696
+ }
1697
+ addTerm$(term) {
1698
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1699
+ if (!quoteDraft) {
1700
+ return of(null);
1701
+ }
1702
+ const updatedState = [...quoteDraft.currentState, term];
1703
+ return of([]).pipe(switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1704
+ }
1705
+ addToCart$(props) {
1706
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1707
+ if (!quoteDraft) {
1708
+ return of(null);
1709
+ }
1710
+ return this.configurationService.configureExternal$(props).pipe(map$1(lineItem => {
1711
+ var _a, _b, _c;
1712
+ const model = this.configurationService.getRuntimeModel();
1713
+ const split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(type => type.name === lineItem.type)) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
1714
+ const lineItems = multiplyLineItems(lineItem, (_c = props.qty) !== null && _c !== void 0 ? _c : 1, split);
1715
+ return [...quoteDraft.currentState, ...lineItems];
1716
+ }), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1717
+ }
1718
+ get() {
1719
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
1720
+ }
1721
+ getSnapshot() {
1722
+ var _a, _b;
1723
+ return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
1724
+ }
1725
+ get charges$() {
1726
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(({ charges }) => charges));
1727
+ }
1728
+ get pricePlans$() {
1729
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(({ pricePlans }) => pricePlans));
1730
+ }
1731
+ get activeMetrics$() {
1732
+ return this.quoteDraftService.quoteDraft$.pipe(map$1(({ activeMetrics }) => activeMetrics));
1733
+ }
1734
+ get chargesSnapshot() {
1735
+ var _a, _b;
1736
+ return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
1737
+ }
1738
+ get pricePlansSnapshot() {
1739
+ var _a, _b;
1740
+ return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
1741
+ }
1742
+ get activeMetricsSnapshot() {
1743
+ var _a, _b;
1744
+ return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.activeMetrics) !== null && _b !== void 0 ? _b : [];
1745
+ }
1746
+ get contextSnapshot() {
1747
+ return this.contextService.resolve();
1748
+ }
1749
+ get context$() {
1750
+ return this.contextService.resolve$();
1751
+ }
1752
+ handleErrorAndBounceBack() {
1753
+ return (source$) => {
1754
+ return source$.pipe(catchError(error => {
1755
+ console.error(error);
1756
+ // bounce back if configuration call has failed
1757
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1758
+ if (quoteDraft) {
1759
+ this.quoteDraftService.updateQuoteDraft(quoteDraft);
1760
+ this.updatedSubj$.next();
1761
+ }
1762
+ return throwError(() => error);
1763
+ }));
1764
+ };
1765
+ }
1766
+ }
1767
+ FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
1768
+ FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, providedIn: 'root' });
1769
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
1770
+ type: Injectable,
1771
+ args: [{ providedIn: 'root' }]
1772
+ }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1773
+
1774
+ class FlowConfigurationModule {
1775
+ }
1776
+ FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1777
+ FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule });
1778
+ FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
1779
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
1780
+ type: NgModule,
1781
+ args: [{
1782
+ imports: [],
1783
+ providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
1784
+ }]
1785
+ }] });
1786
+
1787
+ class FlowStateConfigurationService {
1788
+ constructor(flowStateService, flowInfoService, configurationService, flowConfigurationService, flowStateApiService) {
1789
+ this.flowStateService = flowStateService;
1790
+ this.flowInfoService = flowInfoService;
1791
+ this.configurationService = configurationService;
1792
+ this.flowConfigurationService = flowConfigurationService;
1793
+ this.flowStateApiService = flowStateApiService;
1794
+ this.configurationStateId$ = new BehaviorSubject(null);
1795
+ }
1796
+ get configurationStateId() {
1797
+ return this.configurationStateId$.value;
1798
+ }
1799
+ addToCart$(props) {
1800
+ var _a;
1801
+ const stateful = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful;
1802
+ if (stateful) {
1803
+ const stateId = this.flowStateService.stateId;
1804
+ if (!stateId) {
1805
+ return of();
1806
+ }
1807
+ const lineItem = generateConfigurationLineItem(props, props.qty);
1808
+ return this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap$1(r => this.configurationStateId$.next(r.stateId)), switchMap(() => {
1809
+ if (!this.configurationStateId) {
1810
+ return of();
1811
+ }
1812
+ return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
1813
+ }));
1814
+ }
1815
+ else {
1816
+ return this.flowConfigurationService.addToCart$(props).pipe(map$1(noop));
1817
+ }
1818
+ }
1819
+ }
1820
+ FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token: FlowStateService }, { token: FlowInfoService }, { token: ConfigurationService }, { token: FlowConfigurationService }, { token: i1.FlowStateApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1821
+ FlowStateConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, providedIn: 'root' });
1822
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, decorators: [{
1823
+ type: Injectable,
1824
+ args: [{ providedIn: 'root' }]
1825
+ }], ctorParameters: function () { return [{ type: FlowStateService }, { type: FlowInfoService }, { type: ConfigurationService }, { type: FlowConfigurationService }, { type: i1.FlowStateApiService }]; } });
1826
+
1827
+ function calculateMetricByMethod(lineItems, metric, method) {
1828
+ const items = getLineItemsByMethod(lineItems, method);
1829
+ return items.reduce((acc, li) => {
1830
+ let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
1831
+ if (method === 'avg' && li.length > 0) {
1832
+ value /= li.length;
1833
+ }
1834
+ return acc + value;
1835
+ }, 0);
1836
+ }
1837
+ function getLineItemsByMethod(lineItems, method) {
1838
+ switch (method) {
1839
+ case 'first': {
1840
+ return lineItems.filter(li => !li.rampInstanceId).map(item => [item]);
1841
+ }
1842
+ case 'last': {
1843
+ const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1844
+ const products = rootTermItems.map(lineItem => [
1845
+ lineItem,
1846
+ ...lineItems.filter(li => li.rampInstanceId === lineItem.id),
1847
+ ]);
1848
+ return products
1849
+ .map(items => [...items].sort((a, b) => getDateValue(a.endDate || '') - getDateValue(b.endDate || '')).pop())
1850
+ .filter((li) => Boolean(li))
1851
+ .map(item => [item]);
1852
+ }
1853
+ case 'avg': {
1854
+ const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1855
+ return rootTermItems.map(lineItem => [lineItem, ...lineItems.filter(li => li.rampInstanceId === lineItem.id)]);
1856
+ }
1857
+ case 'sum': {
1858
+ return lineItems.map(item => [item]);
1859
+ }
1860
+ default: {
1861
+ return lineItems.map(item => [item]);
1862
+ }
1863
+ }
1864
+ }
1865
+ function getDateValue(date) {
1866
+ return date ? new Date(date).getTime() : 0;
1867
+ }
1868
+
1869
+ class MetricsCalculationService {
1870
+ get onMetricsUpdate$() {
1871
+ return this.metricsUpdated$.asObservable();
1872
+ }
1873
+ constructor(quoteDraftService, flowConfiguration, settingsService) {
1874
+ this.quoteDraftService = quoteDraftService;
1875
+ this.flowConfiguration = flowConfiguration;
1876
+ this.settingsService = settingsService;
1877
+ this.metricsUpdated$ = new Subject();
1878
+ this.quoteMetricsSettings = {};
1879
+ this.metricsCalculationMethodMap = {};
1880
+ this.metricsData = {};
1881
+ this.activeMetricRules = [];
1882
+ this.activeMetricRules = this.flowConfiguration.activeMetricsSnapshot.filter(metricRule => metricRule.metrics.some(metric => !!metric.totalName));
1883
+ combineLatest([
1884
+ this.quoteDraftService.currentState$,
1885
+ this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(take$1(1)),
1886
+ ]).subscribe(([lineItems, setting]) => {
1887
+ let settingsData = {};
1888
+ try {
1889
+ settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
1890
+ }
1891
+ catch (error) {
1892
+ settingsData = {};
1893
+ }
1894
+ this.quoteMetricsSettings = settingsData;
1895
+ this.updateMetrics(lineItems);
1896
+ });
1897
+ }
1898
+ getMetricValue(metric) {
1899
+ return this.metricsData[metric] || 0;
1900
+ }
1901
+ updateMetrics(lineItems) {
1902
+ const metricKeys = this.collectMetricKeys(lineItems).filter(key => !key.includes('Effective_'));
1903
+ this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
1904
+ this.metricsData = metricKeys.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: this.calculateMetric(lineItems, key) })), {});
1905
+ this.metricsUpdated$.next();
1906
+ }
1907
+ calculateMetric(lineItems, metric) {
1908
+ return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
1909
+ }
1910
+ buildMetricsCalculationMethods(metricKeys, initial) {
1911
+ return metricKeys.reduce((acc, name) => {
1912
+ var _a, _b;
1913
+ if (acc[name]) {
1914
+ return acc;
1915
+ }
1916
+ acc = Object.assign(Object.assign({}, acc), { [name]: 'sum' });
1917
+ const metricRule = this.getMetricRuleByTotalMetricName(name);
1918
+ const settingKey = ((_b = (_a = metricRule === null || metricRule === void 0 ? void 0 : metricRule.metrics) === null || _a === void 0 ? void 0 : _a.find(metric => metric.totalName === name)) === null || _b === void 0 ? void 0 : _b.name) || name;
1919
+ if (this.quoteMetricsSettings[settingKey]) {
1920
+ acc = Object.assign(Object.assign({}, acc), { [name]: this.quoteMetricsSettings[settingKey] });
1921
+ }
1922
+ return acc;
1923
+ }, initial);
1924
+ }
1925
+ collectMetricKeys(lineItems) {
1926
+ const keys = [];
1927
+ lineItems.forEach(lineItem => {
1928
+ keys.push(...Object.keys(lineItem.totalMetrics || {}));
1929
+ keys.push(...this.collectMetricKeys(lineItem.lineItems));
1930
+ });
1931
+ return uniq(keys);
1932
+ }
1933
+ getMetricRuleByTotalMetricName(name) {
1934
+ return this.activeMetricRules.find(metricRule => metricRule.metrics.find(metric => metric.totalName === name));
1935
+ }
1936
+ }
1937
+ MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1938
+ MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, providedIn: 'root' });
1939
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, decorators: [{
1940
+ type: Injectable,
1941
+ args: [{ providedIn: 'root' }]
1942
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1.ConfigurationSettingsApiService }]; } });
1943
+
1944
+ class ProductImagesService {
1945
+ constructor(productApiService) {
1946
+ this.productApiService = productApiService;
1947
+ this.imagesMap$ = new BehaviorSubject({});
1948
+ }
1949
+ getImageUrl$(productId) {
1950
+ if (this.imagesMap$.value[productId] == null) {
1951
+ this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
1952
+ this.fetchProductImage(productId);
1953
+ }
1954
+ return this.imagesMap$.pipe(map$1(imagesMap => imagesMap[productId]), distinctUntilChanged());
1955
+ }
1956
+ fetchProductImage(productId) {
1957
+ this.productApiService
1958
+ .fetchImage$(productId)
1959
+ .pipe(map$1(file => URL.createObjectURL(file)), catchError(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
1960
+ .subscribe();
1961
+ }
1962
+ }
1963
+ ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1964
+ ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
1965
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, decorators: [{
1966
+ type: Injectable,
1967
+ args: [{ providedIn: 'root' }]
1968
+ }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
1969
+
1970
+ class RuntimeContextService {
1971
+ constructor(configurationApiService) {
1972
+ this.configurationApiService = configurationApiService;
1973
+ }
1974
+ getRuntimeContext(productId, offeringId) {
1975
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
1976
+ var _a;
1977
+ const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
1978
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
1979
+ const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
1980
+ const uiDefinitionProperties = uiDefinitionContainer === null || uiDefinitionContainer === void 0 ? void 0 : uiDefinitionContainer.source.properties;
1981
+ return {
1982
+ modelId: runtimeData.modelId,
1983
+ uiDefinitionContainer: uiDefinitionContainer,
1984
+ runtimeModel: runtimeModel,
1985
+ runtimeMode: RuntimeMode.PROD,
1986
+ productId: productId,
1987
+ productType: (properties === null || properties === void 0 ? void 0 : properties['displayName']) || productName,
1988
+ offeringId: offeringId,
1989
+ properties: {
1990
+ PricingEnabled: (uiDefinitionProperties === null || uiDefinitionProperties === void 0 ? void 0 : uiDefinitionProperties.pricingEnabled) ? 'true' : 'false',
1991
+ PriceListId: uiDefinitionProperties === null || uiDefinitionProperties === void 0 ? void 0 : uiDefinitionProperties.priceList,
1992
+ },
1993
+ };
1994
+ }));
1995
+ }
1996
+ getUIDefinitionContainer(runtimeData) {
1997
+ var _a;
1998
+ const containers = runtimeData.uiDefinitions.filter(container => isNotLegacyUIDefinition(container.source));
1999
+ return (_a = containers.find(container => container.source.primary)) !== null && _a !== void 0 ? _a : containers[0];
2000
+ }
2001
+ }
2002
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
2003
+ RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService });
2004
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, decorators: [{
2005
+ type: Injectable
2006
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
2007
+
2008
+ class ConfigurationRuntimeService {
2009
+ constructor(apiService, contextService, runtimeContextService) {
2010
+ this.apiService = apiService;
2011
+ this.contextService = contextService;
2012
+ this.runtimeContextService = runtimeContextService;
2013
+ this._isInitialized = false;
2014
+ this.uiDefinitionProperties = {};
2015
+ }
2016
+ reset() {
2017
+ this._isInitialized = false;
2018
+ this._runtimeContext = undefined;
2019
+ this.initializationProps = undefined;
2020
+ this.uiDefinitionProperties = {};
2021
+ }
2022
+ initTestMode(uiDefinitionContainer) {
2023
+ var _a, _b;
2024
+ this.uiDefinitionProperties = (_a = uiDefinitionContainer.source.properties) !== null && _a !== void 0 ? _a : {};
2025
+ const uiDefinitionExternals = (_b = uiDefinitionContainer.source.externals) !== null && _b !== void 0 ? _b : {};
2026
+ return combineLatest([
2027
+ this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
2028
+ this.contextService.initTestMode(),
2029
+ ]).pipe(first(), map(([runtimeData, context]) => {
2030
+ var _a;
2031
+ this.contextService.update({
2032
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: uiDefinitionContainer.modelId, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', PriceListId: this.uiDefinitionProperties.priceList, offeringId: this.uiDefinitionProperties.offeringId }), uiDefinitionExternals),
2033
+ });
2034
+ this._runtimeContext = {
2035
+ modelId: uiDefinitionContainer.modelId,
2036
+ runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
2037
+ runtimeMode: RuntimeMode.TEST,
2038
+ uiDefinitionContainer,
2039
+ };
2040
+ return this._runtimeContext;
2041
+ }), tap(() => (this._isInitialized = true)));
2042
+ }
2043
+ init(props) {
2044
+ this.initializationProps = props;
2045
+ const context = this.contextService.resolve();
2046
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
2047
+ var _a, _b, _c, _d;
2048
+ this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {};
2049
+ const { PriceListId } = (_c = context.properties) !== null && _c !== void 0 ? _c : {};
2050
+ const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
2051
+ this.id15to18('AccountId', mergeContext.properties);
2052
+ this._runtimeContext = mergeContext;
2053
+ if (context.properties && ((_d = this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
2054
+ this.contextService.update({
2055
+ properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
2056
+ });
2057
+ }
2058
+ return this._runtimeContext;
2059
+ }), tap(() => (this._isInitialized = true)));
2060
+ }
2061
+ overrideUIDefinition(uiDefinitionContainer) {
2062
+ var _a;
2063
+ if (!this._runtimeContext) {
2064
+ return;
2065
+ }
2066
+ this._runtimeContext.uiDefinitionContainer = uiDefinitionContainer;
2067
+ this.uiDefinitionProperties = (_a = uiDefinitionContainer.source.properties) !== null && _a !== void 0 ? _a : {};
2068
+ }
2069
+ id15to18(propertyName, source) {
2070
+ if (!source) {
2071
+ return;
2072
+ }
2073
+ const value = source[propertyName];
2074
+ if (typeof value === 'string' && value.length === 15) {
2075
+ source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
2076
+ }
2077
+ }
2078
+ get isInitialized() {
2079
+ return this._isInitialized;
2080
+ }
2081
+ get runtimeModel() {
2082
+ var _a;
2083
+ return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
2084
+ }
2085
+ get runtimeContext() {
2086
+ return this._runtimeContext;
2087
+ }
2088
+ }
2089
+ ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
2090
+ ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService });
2091
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
2092
+ type: Injectable
2093
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
2094
+
2095
+ class ConfigurationState {
2096
+ constructor(statefulConfigurationApiService, runtimeService, configurationService, toastService) {
2097
+ this.statefulConfigurationApiService = statefulConfigurationApiService;
2098
+ this.runtimeService = runtimeService;
2099
+ this.configurationService = configurationService;
2100
+ this.toastService = toastService;
2101
+ this.stateSubj$ = new BehaviorSubject({});
2102
+ this.state$ = this.stateSubj$.asObservable();
2103
+ this.stateId = null;
2104
+ }
2105
+ init$() {
2106
+ return this.configurationService.configure().pipe(switchMap(() => {
2107
+ var _a, _b;
2108
+ if (!this.isStatefulConfiguration) {
2109
+ return of(undefined);
2110
+ }
2111
+ const { actions, selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
2112
+ return this.statefulConfigurationApiService.init({
2113
+ item: this.configurationService.generateRequest(),
2114
+ actions: actions === null || actions === void 0 ? void 0 : actions.map(action => ({ name: action.apiName, script: action.script })),
2115
+ selectors: selectors === null || selectors === void 0 ? void 0 : selectors.map(selector => ({ name: selector.apiName, script: selector.script })),
2116
+ });
2117
+ }), tap$1(stateId => (this.stateId = stateId || null)), map$1(() => undefined));
2118
+ }
2119
+ cleanup() {
2120
+ this.stateId = null;
2121
+ this.configurationService.reset();
2122
+ this.stateSubj$.next({});
2123
+ }
2124
+ execute$(req) {
2125
+ if (this.isStatefulConfiguration) {
2126
+ return this.executeStateful$(req);
2127
+ }
2128
+ else {
2129
+ return this.executeStateless$(req);
2130
+ }
2131
+ }
2132
+ dispatch$(actionName, inputData) {
2133
+ return this.execute$({ actions: [{ name: actionName, inputData }] });
2134
+ }
2135
+ select$(selectorName, inputData) {
2136
+ const requestId = UUID.UUID();
2137
+ return this.execute$({
2138
+ selectors: {
2139
+ [requestId]: {
2140
+ name: selectorName,
2141
+ inputData,
2142
+ },
2143
+ },
2144
+ }).pipe(map$1(() => this.stateSubj$.value[requestId]), tap$1(() => this.stateSubj$.next(omit(this.stateSubj$.value, requestId))));
2145
+ }
2146
+ get isStatefulConfiguration() {
2147
+ var _a;
2148
+ return (_a = this.runtimeService.uiDefinitionProperties.statefulConfigurationEnabled) !== null && _a !== void 0 ? _a : false;
2149
+ }
2150
+ executeStateless$(request) {
2151
+ return of(undefined).pipe(switchMap(() => {
2152
+ var _a;
2153
+ // Apply actions and execute configuration/price call
2154
+ // No need to run configuration if no actions in the request
2155
+ if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
2156
+ return of(undefined);
2157
+ }
2158
+ let configurationRequest = this.configurationService.generateRequest();
2159
+ request.actions.forEach(action => {
2160
+ var _a;
2161
+ configurationRequest = (_a = this.executeActionScript(configurationRequest, action)) !== null && _a !== void 0 ? _a : configurationRequest;
2162
+ });
2163
+ return this.configurationService.configureRequest$(configurationRequest);
2164
+ }), tap$1(() => {
2165
+ if (!request.selectors) {
2166
+ return;
2167
+ }
2168
+ // Run selectors and apply them to the state
2169
+ const finalConfigurationRequest = this.configurationService.generateRequest();
2170
+ const selectorsResult = EntityUtil.entries(request.selectors).reduce((trunk, [key, selector]) => {
2171
+ trunk[key] = this.executeSelectorScript(finalConfigurationRequest, selector);
2172
+ return trunk;
2173
+ }, {});
2174
+ this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.value), selectorsResult));
2175
+ }), map$1(() => undefined));
2176
+ }
2177
+ executeStateful$(request) {
2178
+ if (!this.stateId) {
2179
+ return of(undefined);
2180
+ }
2181
+ return this.statefulConfigurationApiService.execute(this.stateId, request).pipe(tap$1(response => {
2182
+ this.stateId = response.stateId;
2183
+ const updatedState = this.stateSubj$.value;
2184
+ EntityUtil.entries(response.selectors).forEach(([key, value]) => {
2185
+ if (!value.success) {
2186
+ if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
2187
+ this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
2188
+ }
2189
+ return;
2190
+ }
2191
+ updatedState[key] = value.result;
2192
+ });
2193
+ this.stateSubj$.next(updatedState);
2194
+ }), map$1(() => undefined));
2195
+ }
2196
+ executeActionScript(request, processor) {
2197
+ var _a, _b, _c;
2198
+ const { actions } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
2199
+ const script = (_c = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
2200
+ if (!script) {
2201
+ return null;
2202
+ }
2203
+ return this.executeProcessorScript(request, script, processor.inputData);
2204
+ }
2205
+ executeSelectorScript(request, processor) {
2206
+ var _a, _b, _c;
2207
+ const { selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
2208
+ const script = (_c = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
2209
+ if (!script) {
2210
+ return null;
2211
+ }
2212
+ return this.executeProcessorScript(request, script, processor.inputData);
2213
+ }
2214
+ executeProcessorScript(request, script, inputData) {
2215
+ return new Function(`${script}\nreturn transform;`)()({
2216
+ request,
2217
+ inputData: inputData,
2218
+ });
1269
2219
  }
1270
2220
  }
1271
- FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
1272
- FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationService });
1273
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationService, decorators: [{
2221
+ ConfigurationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState, deps: [{ token: i1.StatefulConfigurationApiService }, { token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: i6.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
2222
+ ConfigurationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState });
2223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState, decorators: [{
1274
2224
  type: Injectable
1275
- }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1276
-
1277
- class FlowConfigurationModule {
1278
- }
1279
- FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1280
- FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule });
1281
- FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
1282
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, decorators: [{
1283
- type: NgModule,
1284
- args: [{
1285
- imports: [],
1286
- providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
1287
- }]
1288
- }] });
2225
+ }], ctorParameters: function () { return [{ type: i1.StatefulConfigurationApiService }, { type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: i6.ToastService }]; } });
1289
2226
 
1290
2227
  class ConfigurationModule {
1291
2228
  }
1292
- ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1293
- ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
1294
- ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, providers: [
2229
+ ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2230
+ ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
2231
+ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
1295
2232
  ContextApiService,
1296
2233
  ProductModelApiService,
1297
2234
  ConfigurationApiService,
@@ -1300,7 +2237,7 @@ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
1300
2237
  ConfigurationService,
1301
2238
  ConfigurationState,
1302
2239
  ], imports: [ConfirmationDialogModule] });
1303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, decorators: [{
2240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
1304
2241
  type: NgModule,
1305
2242
  args: [{
1306
2243
  imports: [ConfirmationDialogModule],
@@ -1316,271 +2253,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1316
2253
  }]
1317
2254
  }] });
1318
2255
 
1319
- function calculateMetricByMethod(lineItems, metric, method) {
1320
- const items = getLineItemsByMethod(lineItems, method);
1321
- return items.reduce((acc, li) => {
1322
- let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
1323
- if (method === 'avg' && li.length > 0) {
1324
- value /= li.length;
1325
- }
1326
- return acc + value;
1327
- }, 0);
1328
- }
1329
- function getLineItemsByMethod(lineItems, method) {
1330
- switch (method) {
1331
- case 'first': {
1332
- return lineItems.filter(li => !li.rampInstanceId).map(item => [item]);
1333
- }
1334
- case 'last': {
1335
- const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1336
- const products = rootTermItems.map(lineItem => [
1337
- lineItem,
1338
- ...lineItems.filter(li => li.rampInstanceId === lineItem.id),
1339
- ]);
1340
- return products
1341
- .map(items => [...items].sort((a, b) => getDateValue(a.endDate || '') - getDateValue(b.endDate || '')).pop())
1342
- .filter((li) => Boolean(li))
1343
- .map(item => [item]);
1344
- }
1345
- case 'avg': {
1346
- const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1347
- return rootTermItems.map(lineItem => [lineItem, ...lineItems.filter(li => li.rampInstanceId === lineItem.id)]);
1348
- }
1349
- case 'sum': {
1350
- return lineItems.map(item => [item]);
1351
- }
1352
- default: {
1353
- return lineItems.map(item => [item]);
1354
- }
1355
- }
1356
- }
1357
- function getDateValue(date) {
1358
- return date ? new Date(date).getTime() : 0;
1359
- }
1360
-
1361
- class MetricsCalculationService {
1362
- get onMetricsUpdate$() {
1363
- return this.metricsUpdated$.asObservable();
1364
- }
1365
- constructor(quoteDraftService, flowConfiguration, settingsService) {
1366
- this.quoteDraftService = quoteDraftService;
1367
- this.flowConfiguration = flowConfiguration;
1368
- this.settingsService = settingsService;
1369
- this.metricsUpdated$ = new Subject();
1370
- this.quoteMetricsSettings = {};
1371
- this.metricsCalculationMethodMap = {};
1372
- this.metricsData = {};
1373
- this.activeMetricRules = [];
1374
- this.activeMetricRules = this.flowConfiguration.activeMetricsSnapshot.filter(metricRule => metricRule.metrics.some(metric => !!metric.totalName));
1375
- combineLatest([
1376
- this.quoteDraftService.currentState$,
1377
- this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(take$1(1)),
1378
- ]).subscribe(([lineItems, setting]) => {
1379
- let settingsData = {};
1380
- try {
1381
- settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
1382
- }
1383
- catch (error) {
1384
- settingsData = {};
1385
- }
1386
- this.quoteMetricsSettings = settingsData;
1387
- this.updateMetrics(lineItems);
1388
- });
1389
- }
1390
- getMetricValue(metric) {
1391
- return this.metricsData[metric] || 0;
1392
- }
1393
- updateMetrics(lineItems) {
1394
- const metricKeys = this.collectMetricKeys(lineItems).filter(key => !key.includes('Effective_'));
1395
- this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
1396
- this.metricsData = metricKeys.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: this.calculateMetric(lineItems, key) })), {});
1397
- this.metricsUpdated$.next();
1398
- }
1399
- calculateMetric(lineItems, metric) {
1400
- return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
1401
- }
1402
- buildMetricsCalculationMethods(metricKeys, initial) {
1403
- return metricKeys.reduce((acc, name) => {
1404
- var _a, _b;
1405
- if (acc[name]) {
1406
- return acc;
1407
- }
1408
- acc = Object.assign(Object.assign({}, acc), { [name]: 'sum' });
1409
- const metricRule = this.getMetricRuleByTotalMetricName(name);
1410
- const settingKey = ((_b = (_a = metricRule === null || metricRule === void 0 ? void 0 : metricRule.metrics) === null || _a === void 0 ? void 0 : _a.find(metric => metric.totalName === name)) === null || _b === void 0 ? void 0 : _b.name) || name;
1411
- if (this.quoteMetricsSettings[settingKey]) {
1412
- acc = Object.assign(Object.assign({}, acc), { [name]: this.quoteMetricsSettings[settingKey] });
1413
- }
1414
- return acc;
1415
- }, initial);
1416
- }
1417
- collectMetricKeys(lineItems) {
1418
- const keys = [];
1419
- lineItems.forEach(lineItem => {
1420
- keys.push(...Object.keys(lineItem.totalMetrics || {}));
1421
- keys.push(...this.collectMetricKeys(lineItem.lineItems));
1422
- });
1423
- return uniq(keys);
1424
- }
1425
- getMetricRuleByTotalMetricName(name) {
1426
- return this.activeMetricRules.find(metricRule => metricRule.metrics.find(metric => metric.totalName === name));
1427
- }
1428
- }
1429
- MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1430
- MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MetricsCalculationService, providedIn: 'root' });
1431
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MetricsCalculationService, decorators: [{
1432
- type: Injectable,
1433
- args: [{ providedIn: 'root' }]
1434
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1.ConfigurationSettingsApiService }]; } });
1435
-
1436
- class ProductImagesService {
1437
- constructor(productApiService) {
1438
- this.productApiService = productApiService;
1439
- this.imagesMap$ = new BehaviorSubject({});
1440
- }
1441
- getImageUrl$(productId) {
1442
- if (this.imagesMap$.value[productId] == null) {
1443
- this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
1444
- this.fetchProductImage(productId);
1445
- }
1446
- return this.imagesMap$.pipe(map$2(imagesMap => imagesMap[productId]), distinctUntilChanged());
1447
- }
1448
- fetchProductImage(productId) {
1449
- this.productApiService
1450
- .fetchImage$(productId)
1451
- .pipe(map$2(file => URL.createObjectURL(file)), catchError$1(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
1452
- .subscribe();
1453
- }
1454
- }
1455
- ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1456
- ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
1457
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProductImagesService, decorators: [{
1458
- type: Injectable,
1459
- args: [{ providedIn: 'root' }]
1460
- }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
1461
-
1462
- class RuntimeSettingsService {
1463
- constructor(configurationSettingsApiService) {
1464
- this.configurationSettingsApiService = configurationSettingsApiService;
1465
- this.configurationSettings$ = new BehaviorSubject({});
1466
- this.currencySettings$ = new BehaviorSubject({
1467
- iso: DEFAULT_CURRENCY_ISO_CODE,
1468
- symbol: DEFAULT_CURRENCY_SYMBOL,
1469
- });
1470
- this.getCurrencySymbol = (locale, currency) => {
1471
- return (0)
1472
- .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
1473
- .replace(/\d/g, '')
1474
- .trim();
1475
- };
1476
- }
1477
- create() {
1478
- return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
1479
- this.configurationSettings$.next(configurationSettings);
1480
- this.formattingSettings = this.getFormattingSettings();
1481
- }), map$2(() => undefined));
1482
- }
1483
- initCurrency(iso) {
1484
- if (iso) {
1485
- const symbol = this.getCurrencySymbol('en-US', iso);
1486
- this.currencySettings$.next({ iso, symbol });
1487
- }
1488
- }
1489
- getFormattingSettings() {
1490
- var _a, _b;
1491
- if (this.formattingSettings) {
1492
- return this.formattingSettings;
1493
- }
1494
- const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
1495
- return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
1496
- }, {});
1497
- const currencySettings = this.getCurrencySettings();
1498
- const dateFormat = (validateDateFormat((_b = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT) !== null && _b !== void 0 ? _b : '') && (shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT)) ||
1499
- DEFAULT_DATE_FORMAT;
1500
- const decimalSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR;
1501
- const thousandsSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR;
1502
- // the number of decimal places can be 0
1503
- const priceScale = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE;
1504
- const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
1505
- ? Number(priceScale)
1506
- : DEFAULT_DECIMALS_COUNT;
1507
- return {
1508
- currencySymbol: currencySettings.symbol,
1509
- dateFormats: getSupportedDateFormats(dateFormat),
1510
- decimalsCount,
1511
- decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
1512
- ? decimalSeparator
1513
- : DEFAULT_DECIMAL_SEPARATOR,
1514
- // thousands separator can be a blank value, so it can also be null
1515
- thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
1516
- ? thousandsSeparator || ''
1517
- : DEFAULT_THOUSANDS_SEPARATOR,
1518
- };
1519
- }
1520
- getConfigurationSettings() {
1521
- return this.configurationSettings$.value;
1522
- }
1523
- getCurrencySettings() {
1524
- return this.currencySettings$.value;
1525
- }
1526
- parseConfigurationSettings(settings) {
1527
- return settings.reduce((acc, setting) => {
1528
- switch (setting.key) {
1529
- case 'shopping-cart':
1530
- acc['shopping-cart'] = parseJsonSafely(setting.value, []);
1531
- break;
1532
- case 'navigation':
1533
- acc.navigation = parseJsonSafely(setting.value, {});
1534
- break;
1535
- case 'flows':
1536
- acc.flows = parseJsonSafely(setting.value, []);
1537
- break;
1538
- default:
1539
- acc[setting.key] = setting.value;
1540
- }
1541
- return acc;
1542
- }, {});
1543
- }
1544
- }
1545
- RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1546
- RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
1547
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
1548
- type: Injectable,
1549
- args: [{ providedIn: 'root' }]
1550
- }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
1551
-
1552
2256
  const DEFAULT_FORMATTING_SETTINGS = {
1553
2257
  currencySymbol: DEFAULT_CURRENCY_SYMBOL,
1554
2258
  decimalsCount: DEFAULT_DECIMALS_COUNT,
1555
2259
  dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
1556
2260
  decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
1557
2261
  thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
2262
+ actionCodeLabels: DEFAULT_ACTION_CODE_LABELS,
1558
2263
  };
1559
2264
  class SdkCoreModule {
1560
2265
  }
1561
- SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1562
- SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1563
- SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
1564
- ContextService,
1565
- QuoteDraftService,
1566
- ProductImagesService,
1567
- MetricsCalculationService,
1568
- RuntimeSettingsService,
2266
+ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2267
+ SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
2268
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
2269
+ IntegrationState,
2270
+ FlowStateService,
1569
2271
  {
1570
2272
  provide: FORMATTING_SETTINGS_TOKEN,
1571
2273
  useExisting: RuntimeSettingsService,
1572
2274
  },
1573
2275
  ], imports: [ConfigurationModule, FlowConfigurationModule] });
1574
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
2276
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, decorators: [{
1575
2277
  type: NgModule,
1576
2278
  args: [{
1577
2279
  imports: [ConfigurationModule, FlowConfigurationModule],
1578
2280
  providers: [
1579
- ContextService,
1580
- QuoteDraftService,
1581
- ProductImagesService,
1582
- MetricsCalculationService,
1583
- RuntimeSettingsService,
2281
+ IntegrationState,
2282
+ FlowStateService,
1584
2283
  {
1585
2284
  provide: FORMATTING_SETTINGS_TOKEN,
1586
2285
  useExisting: RuntimeSettingsService,
@@ -1614,9 +2313,9 @@ class CalendarDirective {
1614
2313
  }
1615
2314
  }
1616
2315
  }
1617
- CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1618
- CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
1619
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, decorators: [{
2316
+ CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2317
+ CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
2318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarDirective, decorators: [{
1620
2319
  type: Directive,
1621
2320
  args: [{
1622
2321
  selector: '[vlCalendar]',
@@ -1627,10 +2326,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1627
2326
 
1628
2327
  class SdkDirectivesModule {
1629
2328
  }
1630
- SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1631
- SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
1632
- SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule });
1633
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, decorators: [{
2329
+ SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2330
+ SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
2331
+ SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule });
2332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, decorators: [{
1634
2333
  type: NgModule,
1635
2334
  args: [{
1636
2335
  declarations: [CalendarDirective],
@@ -1650,22 +2349,28 @@ class DatePipe {
1650
2349
  this.destroy$.next();
1651
2350
  this.destroy$.complete();
1652
2351
  }
1653
- transform(date) {
2352
+ transform(date, type = 'date') {
1654
2353
  var _a, _b;
1655
2354
  if (!date) {
1656
2355
  return '';
1657
2356
  }
2357
+ const dateFormat = ((_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.datePipeFormat) || DEFAULT_DATE_FORMAT;
2358
+ const formatMap = {
2359
+ date: dateFormat,
2360
+ time: DEFAULT_TIME_FORMAT,
2361
+ datetime: `${dateFormat} ${DEFAULT_TIME_FORMAT}`,
2362
+ };
1658
2363
  try {
1659
- return formatDate(date, ((_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.datePipeFormat) || DEFAULT_DATE_FORMAT, this.locale, (_b = this.defaultOptions) === null || _b === void 0 ? void 0 : _b.timezone);
2364
+ return formatDate(date, formatMap[type], this.locale, (_b = this.defaultOptions) === null || _b === void 0 ? void 0 : _b.timezone);
1660
2365
  }
1661
2366
  catch (error) {
1662
2367
  return new Date(date).toString();
1663
2368
  }
1664
2369
  }
1665
2370
  }
1666
- DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1667
- DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, name: "vlDate" });
1668
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, decorators: [{
2371
+ DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2372
+ DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, name: "vlDate" });
2373
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, decorators: [{
1669
2374
  type: Pipe,
1670
2375
  args: [{
1671
2376
  name: 'vlDate',
@@ -1687,9 +2392,9 @@ class NumberPipe {
1687
2392
  return formatNumber(price, (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.thousandsSeparator, (_b = this.formattingSettings) === null || _b === void 0 ? void 0 : _b.decimalSeparator, (_c = this.formattingSettings) === null || _c === void 0 ? void 0 : _c.decimalsCount);
1688
2393
  }
1689
2394
  }
1690
- NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1691
- NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, name: "vlNumber" });
1692
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, decorators: [{
2395
+ NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2396
+ NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, name: "vlNumber" });
2397
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, decorators: [{
1693
2398
  type: Pipe,
1694
2399
  args: [{
1695
2400
  name: 'vlNumber',
@@ -1714,25 +2419,44 @@ class PricePipe {
1714
2419
  return `${((_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.currencySymbol) || DEFAULT_CURRENCY_SYMBOL}${formatNumber(price, (_b = this.formattingSettings) === null || _b === void 0 ? void 0 : _b.thousandsSeparator, (_c = this.formattingSettings) === null || _c === void 0 ? void 0 : _c.decimalSeparator, (_d = this.formattingSettings) === null || _d === void 0 ? void 0 : _d.decimalsCount)}`;
1715
2420
  }
1716
2421
  }
1717
- PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1718
- PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, name: "vlPrice" });
1719
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, decorators: [{
2422
+ PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2423
+ PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, name: "vlPrice" });
2424
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, decorators: [{
1720
2425
  type: Pipe,
1721
2426
  args: [{
1722
2427
  name: 'vlPrice',
1723
2428
  }]
1724
2429
  }] });
1725
2430
 
2431
+ class ActionCodePipe {
2432
+ constructor() {
2433
+ var _a;
2434
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
2435
+ }
2436
+ transform(actionCode) {
2437
+ var _a, _b;
2438
+ return (_b = (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.actionCodeLabels[actionCode]) !== null && _b !== void 0 ? _b : actionCode;
2439
+ }
2440
+ }
2441
+ ActionCodePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionCodePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2442
+ ActionCodePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ActionCodePipe, name: "vlActionCode" });
2443
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionCodePipe, decorators: [{
2444
+ type: Pipe,
2445
+ args: [{
2446
+ name: 'vlActionCode',
2447
+ }]
2448
+ }] });
2449
+
1726
2450
  class SdkPipesModule {
1727
2451
  }
1728
- SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1729
- SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
1730
- SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule });
1731
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, decorators: [{
2452
+ SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2453
+ SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe, ActionCodePipe], exports: [NumberPipe, PricePipe, DatePipe, ActionCodePipe] });
2454
+ SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule });
2455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, decorators: [{
1732
2456
  type: NgModule,
1733
2457
  args: [{
1734
- declarations: [NumberPipe, PricePipe, DatePipe],
1735
- exports: [NumberPipe, PricePipe, DatePipe],
2458
+ declarations: [NumberPipe, PricePipe, DatePipe, ActionCodePipe],
2459
+ exports: [NumberPipe, PricePipe, DatePipe, ActionCodePipe],
1736
2460
  }]
1737
2461
  }] });
1738
2462
 
@@ -1740,5 +2464,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1740
2464
  * Generated bundle index. Do not edit.
1741
2465
  */
1742
2466
 
1743
- export { CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
2467
+ export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, FlowUpdateService, IntegrationState, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateConfigurationLineItem, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
1744
2468
  //# sourceMappingURL=veloceapps-sdk-core.mjs.map