@veloceapps/sdk 8.0.0-11 → 8.0.0-111

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