@veloceapps/sdk 8.0.0-12 → 8.0.0-121

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