@veloceapps/sdk 7.0.0-9 → 7.0.1-0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (436) hide show
  1. package/cms/README.md +45 -0
  2. package/cms/cms.actions.d.ts +10 -0
  3. package/cms/components/element-children/element-children.component.d.ts +1 -1
  4. package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +1 -1
  5. package/cms/components/element-renderer/element-renderer.component.d.ts +1 -1
  6. package/cms/components/plugin.component.d.ts +2 -2
  7. package/cms/components/preview/preview.component.d.ts +4 -3
  8. package/cms/directives/custom-template.directive.d.ts +1 -1
  9. package/cms/modules/federated/federated-host.directive.d.ts +8 -0
  10. package/cms/modules/federated/federated.component.d.ts +5 -7
  11. package/cms/modules/federated/federated.module.d.ts +4 -3
  12. package/cms/modules/federated/federated.types.d.ts +1 -5
  13. package/cms/modules/migrations/types/migrations.types.d.ts +1 -1
  14. package/cms/plugins/configuration.plugin.d.ts +1 -1
  15. package/cms/plugins/io.plugin.d.ts +1 -1
  16. package/cms/plugins/region.plugin.d.ts +1 -1
  17. package/cms/plugins/script.plugin.d.ts +1 -1
  18. package/cms/services/templates.service.d.ts +1 -1
  19. package/cms/types/common.types.d.ts +2 -2
  20. package/cms/types/elements.types.d.ts +1 -1
  21. package/cms/types/integration.types.d.ts +1 -1
  22. package/cms/types/layouts.types.d.ts +1 -1
  23. package/cms/utils/element.utils.d.ts +2 -2
  24. package/cms/vendor-map.d.ts +2 -1
  25. package/core/README.md +5 -0
  26. package/core/modules/flow-configuration/types/update.types.d.ts +2 -2
  27. package/core/services/metric-calculation/metric-calculation.types.d.ts +1 -1
  28. package/core/types/ui-definition.types.d.ts +2 -2
  29. package/esm2020/cms/cms.actions.mjs +56 -0
  30. package/esm2020/cms/components/element-children/element-children.component.mjs +35 -0
  31. package/esm2020/cms/components/element-children/element-children.module.mjs +20 -0
  32. package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +28 -0
  33. package/esm2020/cms/components/element-drop-handle/element-drop-handle.module.mjs +19 -0
  34. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +160 -0
  35. package/{esm2015/cms/components/element-renderer/element-renderer.module.js → esm2020/cms/components/element-renderer/element-renderer.module.mjs} +5 -5
  36. package/esm2020/cms/components/element.component.mjs +45 -0
  37. package/esm2020/cms/components/plugin.component.mjs +17 -0
  38. package/esm2020/cms/components/preview/preview.component.mjs +103 -0
  39. package/esm2020/cms/components/preview/preview.module.mjs +24 -0
  40. package/esm2020/cms/directives/custom-template.directive.mjs +26 -0
  41. package/esm2020/cms/engine/models/entity.mjs +17 -0
  42. package/esm2020/cms/launcher.module.mjs +24 -0
  43. package/esm2020/cms/modules/federated/federated-host.directive.mjs +16 -0
  44. package/esm2020/cms/modules/federated/federated.component.mjs +64 -0
  45. package/esm2020/cms/modules/federated/federated.module.mjs +20 -0
  46. package/esm2020/cms/modules/federated/federated.types.mjs +2 -0
  47. package/esm2020/cms/modules/migrations/migrations.mjs +15 -0
  48. package/{esm2015/cms/modules/migrations/migrations.module.js → esm2020/cms/modules/migrations/migrations.module.mjs} +5 -5
  49. package/esm2020/cms/modules/migrations/services/migrations.service.mjs +43 -0
  50. package/{esm2015/cms/modules/runtime/runtime.module.js → esm2020/cms/modules/runtime/runtime.module.mjs} +6 -6
  51. package/esm2020/cms/modules/runtime/services/compilation.service.mjs +83 -0
  52. package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +28 -0
  53. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +74 -0
  54. package/esm2020/cms/plugins/configuration.plugin.mjs +105 -0
  55. package/esm2020/cms/plugins/io.plugin.mjs +36 -0
  56. package/esm2020/cms/plugins/region.plugin.mjs +58 -0
  57. package/esm2020/cms/plugins/script.plugin.mjs +65 -0
  58. package/{esm2015/cms/services/element-context.service.js → esm2020/cms/services/element-context.service.mjs} +4 -4
  59. package/esm2020/cms/services/integration.state.mjs +40 -0
  60. package/esm2020/cms/services/io-provider.service.mjs +50 -0
  61. package/esm2020/cms/services/resources.service.mjs +49 -0
  62. package/{esm2015/cms/services/templates.service.js → esm2020/cms/services/templates.service.mjs} +4 -4
  63. package/esm2020/cms/utils/element.utils.mjs +160 -0
  64. package/esm2020/cms/utils/elements-resolver.mjs +189 -0
  65. package/esm2020/cms/utils/path.utils.mjs +53 -0
  66. package/esm2020/cms/utils/ui-definition.utils.mjs +87 -0
  67. package/esm2020/cms/vendor-map.mjs +67 -0
  68. package/esm2020/core/core.module.mjs +18 -0
  69. package/{esm2015/core/modules/configuration/configuration.module.js → esm2020/core/modules/configuration/configuration.module.mjs} +6 -6
  70. package/esm2020/core/modules/configuration/helpers.mjs +18 -0
  71. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +106 -0
  72. package/esm2020/core/modules/configuration/services/configuration.service.mjs +183 -0
  73. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +50 -0
  74. package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +18 -0
  75. package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +150 -0
  76. package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +129 -0
  77. package/esm2020/core/services/context.service.mjs +64 -0
  78. package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +85 -0
  79. package/esm2020/core/services/product-images.service.mjs +31 -0
  80. package/esm2020/core/services/quote-draft.service.mjs +232 -0
  81. package/esm2020/core/utils/line-item.utils.mjs +161 -0
  82. package/esm2020/core/utils/line-item.worker.mjs +19 -0
  83. package/esm2020/runtime/components/component-preview/component-preview.component.mjs +125 -0
  84. package/esm2020/runtime/components/section-renderer/section-renderer.component.mjs +67 -0
  85. package/esm2020/runtime/components/ui-runtime/runtime.component.mjs +440 -0
  86. package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +108 -0
  87. package/esm2020/runtime/execution/components/children-placeholder/children-placeholder.component.mjs +60 -0
  88. package/esm2020/runtime/execution/components/context-provider/context-provider.component.mjs +39 -0
  89. package/esm2020/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.mjs +67 -0
  90. package/esm2020/runtime/execution/components/federated/federated.component.mjs +74 -0
  91. package/esm2020/runtime/execution/components/velo-attribute/velo-attribute.component.mjs +60 -0
  92. package/esm2020/runtime/execution/components/velo-multiselect/velo-multiselect.component.mjs +130 -0
  93. package/esm2020/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.mjs +72 -0
  94. package/esm2020/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.mjs +97 -0
  95. package/esm2020/runtime/execution/components/velo-port-radio/velo-port-radio.component.mjs +142 -0
  96. package/esm2020/runtime/execution/components/velo-type/velo-type.component.mjs +119 -0
  97. package/esm2020/runtime/execution/directives/section-script.directive.mjs +247 -0
  98. package/esm2020/runtime/execution/directives/sf-query.directive.mjs +35 -0
  99. package/esm2020/runtime/execution/directives/velo-attribute.directive.mjs +88 -0
  100. package/esm2020/runtime/execution/directives/velo-port.directive.mjs +376 -0
  101. package/esm2020/runtime/execution/directives/vl-approval.directive.mjs +23 -0
  102. package/esm2020/runtime/execution/directives/vl-document-attachments.directive.mjs +36 -0
  103. package/esm2020/runtime/execution/directives/vl-document-templates.directive.mjs +60 -0
  104. package/esm2020/runtime/execution/directives/vl-quote.directive.mjs +42 -0
  105. package/esm2020/runtime/execution/directives/vl-ramp.directive.mjs +55 -0
  106. package/esm2020/runtime/execution/runtime-execution.module.mjs +133 -0
  107. package/esm2020/runtime/execution/utils/federated.util.mjs +32 -0
  108. package/esm2020/runtime/runtime.module.mjs +74 -0
  109. package/esm2020/runtime/services/cart.service.mjs +29 -0
  110. package/{esm2015/runtime/services/collapsible-state.service.js → esm2020/runtime/services/collapsible-state.service.mjs} +4 -4
  111. package/esm2020/runtime/services/configuration.service.mjs +119 -0
  112. package/{esm2015/runtime/services/current-state.service.js → esm2020/runtime/services/current-state.service.mjs} +4 -4
  113. package/{esm2015/runtime/services/form-scope.service.js → esm2020/runtime/services/form-scope.service.mjs} +4 -4
  114. package/esm2020/runtime/services/product-model-cache.service.mjs +31 -0
  115. package/esm2020/runtime/services/runtime-context.service.mjs +57 -0
  116. package/esm2020/runtime/services/runtime-form.service.mjs +219 -0
  117. package/esm2020/runtime/services/runtime.service.mjs +115 -0
  118. package/{esm2015/runtime/services/section-helper.service.js → esm2020/runtime/services/section-helper.service.mjs} +4 -4
  119. package/{esm2015/runtime/services/section-scope.service.js → esm2020/runtime/services/section-scope.service.mjs} +4 -4
  120. package/{esm2015/runtime/services/section-store.service.js → esm2020/runtime/services/section-store.service.mjs} +4 -4
  121. package/esm2020/runtime/services/section.service.mjs +117 -0
  122. package/esm2020/runtime/types/script-registry.types.mjs +51 -0
  123. package/esm2020/runtime/utils/line-item.util.mjs +270 -0
  124. package/esm2020/src/components/dialog/dialog.component.mjs +36 -0
  125. package/esm2020/src/components/dialog/dialog.module.mjs +19 -0
  126. package/esm2020/src/components/doc-gen/doc-gen.component.mjs +107 -0
  127. package/esm2020/src/components/doc-gen/doc-gen.module.mjs +19 -0
  128. package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +120 -0
  129. package/{esm2015/src/components/header/cart-overlay/cart-preview.module.js → esm2020/src/components/header/cart-overlay/cart-preview.module.mjs} +11 -13
  130. package/esm2020/src/components/header/header.component.mjs +333 -0
  131. package/{esm2015/src/components/header/header.module.js → esm2020/src/components/header/header.module.mjs} +12 -14
  132. package/esm2020/src/components/header/metrics/metrics.component.mjs +227 -0
  133. package/{esm2015/src/components/header/metrics/metrics.module.js → esm2020/src/components/header/metrics/metrics.module.mjs} +17 -19
  134. package/{esm2015/src/flow-routing.module.js → esm2020/src/flow-routing.module.mjs} +12 -14
  135. package/esm2020/src/flow.component.mjs +45 -0
  136. package/esm2020/src/flow.module.mjs +58 -0
  137. package/esm2020/src/guards/context.guard.mjs +93 -0
  138. package/esm2020/src/guards/product-unload.guard.mjs +46 -0
  139. package/esm2020/src/guards/root.guard.mjs +42 -0
  140. package/esm2020/src/pages/assets/assets.component.mjs +111 -0
  141. package/esm2020/src/pages/assets/assets.module.mjs +20 -0
  142. package/esm2020/src/pages/catalog/catalog.component.mjs +111 -0
  143. package/esm2020/src/pages/catalog/catalog.module.mjs +20 -0
  144. package/esm2020/src/pages/debug/debug.component.mjs +62 -0
  145. package/{esm2015/src/pages/debug/debug.module.js → esm2020/src/pages/debug/debug.module.mjs} +12 -14
  146. package/esm2020/src/pages/empty-account/empty-account.component.mjs +12 -0
  147. package/esm2020/src/pages/empty-account/empty-account.module.mjs +20 -0
  148. package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +137 -0
  149. package/esm2020/src/pages/legacy-product/legacy-product.module.mjs +19 -0
  150. package/esm2020/src/pages/product/product.component.mjs +94 -0
  151. package/esm2020/src/pages/product/product.module.mjs +20 -0
  152. package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +25 -0
  153. package/esm2020/src/pages/record-not-found/record-not-found.module.mjs +20 -0
  154. package/esm2020/src/pages/remote/remote.component.mjs +342 -0
  155. package/esm2020/src/pages/remote/remote.module.mjs +20 -0
  156. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +111 -0
  157. package/esm2020/src/pages/shopping-cart/shopping-cart.module.mjs +20 -0
  158. package/esm2020/src/resolvers/flow.resolver.mjs +70 -0
  159. package/esm2020/src/resolvers/quote.resolver.mjs +90 -0
  160. package/esm2020/src/services/doc-gen.service.mjs +33 -0
  161. package/esm2020/src/services/flow-dialog.service.mjs +126 -0
  162. package/esm2020/src/services/flow-router.service.mjs +144 -0
  163. package/esm2020/src/services/flow.service.mjs +86 -0
  164. package/esm2020/src/utils/flow.utils.mjs +21 -0
  165. package/fesm2015/{veloceapps-sdk-cms.js → veloceapps-sdk-cms.mjs} +178 -207
  166. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -0
  167. package/fesm2015/{veloceapps-sdk-core.js → veloceapps-sdk-core.mjs} +76 -76
  168. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -0
  169. package/fesm2015/{veloceapps-sdk-runtime.js → veloceapps-sdk-runtime.mjs} +242 -370
  170. package/fesm2015/veloceapps-sdk-runtime.mjs.map +1 -0
  171. package/fesm2015/veloceapps-sdk.mjs +2877 -0
  172. package/fesm2015/veloceapps-sdk.mjs.map +1 -0
  173. package/fesm2020/veloceapps-sdk-cms.mjs +2036 -0
  174. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -0
  175. package/fesm2020/veloceapps-sdk-core.mjs +1289 -0
  176. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -0
  177. package/fesm2020/veloceapps-sdk-runtime.mjs +3764 -0
  178. package/fesm2020/veloceapps-sdk-runtime.mjs.map +1 -0
  179. package/fesm2020/veloceapps-sdk.mjs +2857 -0
  180. package/fesm2020/veloceapps-sdk.mjs.map +1 -0
  181. package/package.json +59 -33
  182. package/runtime/README.md +5 -0
  183. package/runtime/components/component-preview/component-preview.component.d.ts +2 -2
  184. package/runtime/components/section-renderer/section-renderer.component.d.ts +1 -1
  185. package/runtime/components/ui-runtime/runtime.component.d.ts +1 -1
  186. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +1 -1
  187. package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +2 -2
  188. package/runtime/execution/components/context-provider/context-provider.component.d.ts +1 -1
  189. package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +1 -1
  190. package/runtime/execution/components/federated/federated.component.d.ts +1 -1
  191. package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +1 -1
  192. package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +1 -1
  193. package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +1 -1
  194. package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +1 -1
  195. package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +1 -1
  196. package/runtime/execution/components/velo-type/velo-type.component.d.ts +1 -1
  197. package/runtime/execution/directives/section-script.directive.d.ts +1 -1
  198. package/runtime/execution/directives/sf-query.directive.d.ts +1 -1
  199. package/runtime/execution/directives/velo-attribute.directive.d.ts +1 -1
  200. package/runtime/execution/directives/velo-port.directive.d.ts +6 -6
  201. package/runtime/execution/directives/vl-approval.directive.d.ts +1 -1
  202. package/runtime/execution/directives/vl-document-attachments.directive.d.ts +1 -1
  203. package/runtime/execution/directives/vl-document-templates.directive.d.ts +1 -1
  204. package/runtime/execution/directives/vl-quote.directive.d.ts +1 -1
  205. package/runtime/execution/directives/vl-ramp.directive.d.ts +1 -1
  206. package/runtime/execution/runtime-execution.module.d.ts +3 -5
  207. package/runtime/execution/utils/federated.util.d.ts +1 -1
  208. package/runtime/runtime.module.d.ts +3 -5
  209. package/runtime/services/section.service.d.ts +1 -1
  210. package/src/components/dialog/dialog.component.d.ts +1 -1
  211. package/src/components/doc-gen/doc-gen.component.d.ts +1 -1
  212. package/src/components/header/cart-overlay/cart-preview.component.d.ts +2 -2
  213. package/src/components/header/header.component.d.ts +1 -1
  214. package/src/components/header/metrics/metrics.component.d.ts +1 -1
  215. package/src/flow.component.d.ts +1 -1
  216. package/src/pages/assets/assets.component.d.ts +1 -1
  217. package/src/pages/catalog/catalog.component.d.ts +1 -1
  218. package/src/pages/debug/debug.component.d.ts +5 -3
  219. package/src/pages/empty-account/empty-account.component.d.ts +1 -1
  220. package/src/pages/legacy-product/legacy-product.component.d.ts +1 -1
  221. package/src/pages/legacy-product/legacy-product.module.d.ts +1 -2
  222. package/src/pages/product/product.component.d.ts +1 -1
  223. package/src/pages/record-not-found/record-not-found.component.d.ts +1 -1
  224. package/src/pages/remote/remote.component.d.ts +1 -1
  225. package/src/pages/shopping-cart/shopping-cart.component.d.ts +1 -1
  226. package/bundles/veloceapps-sdk-cms.umd.js +0 -2531
  227. package/bundles/veloceapps-sdk-cms.umd.js.map +0 -1
  228. package/bundles/veloceapps-sdk-core.umd.js +0 -1916
  229. package/bundles/veloceapps-sdk-core.umd.js.map +0 -1
  230. package/bundles/veloceapps-sdk-runtime.umd.js +0 -4415
  231. package/bundles/veloceapps-sdk-runtime.umd.js.map +0 -1
  232. package/bundles/veloceapps-sdk.umd.js +0 -3583
  233. package/bundles/veloceapps-sdk.umd.js.map +0 -1
  234. package/cms/modules/federated/federated.utils.d.ts +0 -1
  235. package/cms/package.json +0 -10
  236. package/cms/veloceapps-sdk-cms.d.ts +0 -5
  237. package/core/package.json +0 -10
  238. package/core/veloceapps-sdk-core.d.ts +0 -5
  239. package/esm2015/cms/cms.actions.js +0 -42
  240. package/esm2015/cms/components/element-children/element-children.component.js +0 -39
  241. package/esm2015/cms/components/element-children/element-children.module.js +0 -20
  242. package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +0 -32
  243. package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +0 -19
  244. package/esm2015/cms/components/element-renderer/element-renderer.component.js +0 -169
  245. package/esm2015/cms/components/element.component.js +0 -44
  246. package/esm2015/cms/components/plugin.component.js +0 -16
  247. package/esm2015/cms/components/preview/preview.component.js +0 -93
  248. package/esm2015/cms/components/preview/preview.module.js +0 -24
  249. package/esm2015/cms/directives/custom-template.directive.js +0 -25
  250. package/esm2015/cms/engine/models/entity.js +0 -18
  251. package/esm2015/cms/launcher.module.js +0 -24
  252. package/esm2015/cms/modules/federated/federated.component.js +0 -82
  253. package/esm2015/cms/modules/federated/federated.module.js +0 -19
  254. package/esm2015/cms/modules/federated/federated.types.js +0 -2
  255. package/esm2015/cms/modules/federated/federated.utils.js +0 -37
  256. package/esm2015/cms/modules/migrations/migrations.js +0 -11
  257. package/esm2015/cms/modules/migrations/services/migrations.service.js +0 -43
  258. package/esm2015/cms/modules/runtime/services/compilation.service.js +0 -84
  259. package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +0 -27
  260. package/esm2015/cms/modules/runtime/services/runtime.service.js +0 -74
  261. package/esm2015/cms/plugins/configuration.plugin.js +0 -106
  262. package/esm2015/cms/plugins/io.plugin.js +0 -37
  263. package/esm2015/cms/plugins/region.plugin.js +0 -58
  264. package/esm2015/cms/plugins/script.plugin.js +0 -66
  265. package/esm2015/cms/services/integration.state.js +0 -40
  266. package/esm2015/cms/services/io-provider.service.js +0 -51
  267. package/esm2015/cms/services/resources.service.js +0 -50
  268. package/esm2015/cms/utils/element.utils.js +0 -157
  269. package/esm2015/cms/utils/elements-resolver.js +0 -163
  270. package/esm2015/cms/utils/path.utils.js +0 -56
  271. package/esm2015/cms/utils/ui-definition.utils.js +0 -82
  272. package/esm2015/cms/vendor-map.js +0 -51
  273. package/esm2015/core/core.module.js +0 -18
  274. package/esm2015/core/modules/configuration/helpers.js +0 -10
  275. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +0 -87
  276. package/esm2015/core/modules/configuration/services/configuration.service.js +0 -177
  277. package/esm2015/core/modules/configuration/services/runtime-context.service.js +0 -51
  278. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +0 -18
  279. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +0 -150
  280. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +0 -129
  281. package/esm2015/core/services/context.service.js +0 -53
  282. package/esm2015/core/services/metric-calculation/metric-calculation.service.js +0 -83
  283. package/esm2015/core/services/product-images.service.js +0 -30
  284. package/esm2015/core/services/quote-draft.service.js +0 -217
  285. package/esm2015/core/utils/line-item.utils.js +0 -143
  286. package/esm2015/core/utils/line-item.worker.js +0 -19
  287. package/esm2015/runtime/components/component-preview/component-preview.component.js +0 -125
  288. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +0 -71
  289. package/esm2015/runtime/components/ui-runtime/runtime.component.js +0 -429
  290. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +0 -109
  291. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +0 -68
  292. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +0 -36
  293. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +0 -72
  294. package/esm2015/runtime/execution/components/federated/federated.component.js +0 -81
  295. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +0 -65
  296. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +0 -136
  297. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +0 -80
  298. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +0 -101
  299. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +0 -150
  300. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +0 -121
  301. package/esm2015/runtime/execution/directives/section-script.directive.js +0 -242
  302. package/esm2015/runtime/execution/directives/sf-query.directive.js +0 -34
  303. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +0 -86
  304. package/esm2015/runtime/execution/directives/velo-port.directive.js +0 -373
  305. package/esm2015/runtime/execution/directives/vl-approval.directive.js +0 -22
  306. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +0 -35
  307. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +0 -59
  308. package/esm2015/runtime/execution/directives/vl-quote.directive.js +0 -41
  309. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +0 -51
  310. package/esm2015/runtime/execution/runtime-execution.module.js +0 -163
  311. package/esm2015/runtime/execution/utils/federated.util.js +0 -37
  312. package/esm2015/runtime/runtime.module.js +0 -104
  313. package/esm2015/runtime/services/cart.service.js +0 -27
  314. package/esm2015/runtime/services/configuration.service.js +0 -101
  315. package/esm2015/runtime/services/product-model-cache.service.js +0 -30
  316. package/esm2015/runtime/services/runtime-context.service.js +0 -56
  317. package/esm2015/runtime/services/runtime-form.service.js +0 -224
  318. package/esm2015/runtime/services/runtime.service.js +0 -108
  319. package/esm2015/runtime/services/section.service.js +0 -124
  320. package/esm2015/runtime/types/script-registry.types.js +0 -51
  321. package/esm2015/runtime/utils/line-item.util.js +0 -273
  322. package/esm2015/src/components/dialog/dialog.component.js +0 -40
  323. package/esm2015/src/components/dialog/dialog.module.js +0 -19
  324. package/esm2015/src/components/doc-gen/doc-gen.component.js +0 -109
  325. package/esm2015/src/components/doc-gen/doc-gen.module.js +0 -19
  326. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +0 -122
  327. package/esm2015/src/components/header/header.component.js +0 -336
  328. package/esm2015/src/components/header/metrics/metrics.component.js +0 -232
  329. package/esm2015/src/flow.component.js +0 -45
  330. package/esm2015/src/flow.module.js +0 -60
  331. package/esm2015/src/guards/context.guard.js +0 -84
  332. package/esm2015/src/guards/product-unload.guard.js +0 -43
  333. package/esm2015/src/guards/root.guard.js +0 -41
  334. package/esm2015/src/pages/assets/assets.component.js +0 -117
  335. package/esm2015/src/pages/assets/assets.module.js +0 -20
  336. package/esm2015/src/pages/catalog/catalog.component.js +0 -117
  337. package/esm2015/src/pages/catalog/catalog.module.js +0 -20
  338. package/esm2015/src/pages/debug/debug.component.js +0 -61
  339. package/esm2015/src/pages/empty-account/empty-account.component.js +0 -17
  340. package/esm2015/src/pages/empty-account/empty-account.module.js +0 -20
  341. package/esm2015/src/pages/legacy-product/legacy-product.component.js +0 -132
  342. package/esm2015/src/pages/legacy-product/legacy-product.module.js +0 -21
  343. package/esm2015/src/pages/product/product.component.js +0 -101
  344. package/esm2015/src/pages/product/product.module.js +0 -20
  345. package/esm2015/src/pages/record-not-found/record-not-found.component.js +0 -29
  346. package/esm2015/src/pages/record-not-found/record-not-found.module.js +0 -20
  347. package/esm2015/src/pages/remote/remote.component.js +0 -350
  348. package/esm2015/src/pages/remote/remote.module.js +0 -20
  349. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +0 -117
  350. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +0 -20
  351. package/esm2015/src/resolvers/flow.resolver.js +0 -62
  352. package/esm2015/src/resolvers/quote.resolver.js +0 -88
  353. package/esm2015/src/services/doc-gen.service.js +0 -33
  354. package/esm2015/src/services/flow-dialog.service.js +0 -124
  355. package/esm2015/src/services/flow-router.service.js +0 -144
  356. package/esm2015/src/services/flow.service.js +0 -84
  357. package/esm2015/src/utils/flow.utils.js +0 -22
  358. package/fesm2015/veloceapps-sdk-cms.js.map +0 -1
  359. package/fesm2015/veloceapps-sdk-core.js.map +0 -1
  360. package/fesm2015/veloceapps-sdk-runtime.js.map +0 -1
  361. package/fesm2015/veloceapps-sdk.js +0 -2953
  362. package/fesm2015/veloceapps-sdk.js.map +0 -1
  363. package/runtime/package.json +0 -10
  364. package/runtime/veloceapps-sdk-runtime.d.ts +0 -5
  365. package/veloceapps-sdk.d.ts +0 -5
  366. /package/{esm2015/cms/cms.default.js → esm2020/cms/cms.default.mjs} +0 -0
  367. /package/{esm2015/cms/cms.elements.js → esm2020/cms/cms.elements.mjs} +0 -0
  368. /package/{esm2015/cms/cms.layouts.js → esm2020/cms/cms.layouts.mjs} +0 -0
  369. /package/{esm2015/cms/components/index.js → esm2020/cms/components/index.mjs} +0 -0
  370. /package/{esm2015/cms/components/preview/index.js → esm2020/cms/components/preview/index.mjs} +0 -0
  371. /package/{esm2015/cms/components/preview/preview.types.js → esm2020/cms/components/preview/preview.types.mjs} +0 -0
  372. /package/{esm2015/cms/decorators/element.decorator.js → esm2020/cms/decorators/element.decorator.mjs} +0 -0
  373. /package/{esm2015/cms/decorators/index.js → esm2020/cms/decorators/index.mjs} +0 -0
  374. /package/{esm2015/cms/engine/models/plugin.js → esm2020/cms/engine/models/plugin.mjs} +0 -0
  375. /package/{esm2015/cms/index.js → esm2020/cms/index.mjs} +0 -0
  376. /package/{esm2015/cms/injection-tokens.js → esm2020/cms/injection-tokens.mjs} +0 -0
  377. /package/{esm2015/cms/modules/federated/default-options.js → esm2020/cms/modules/federated/default-options.mjs} +0 -0
  378. /package/{esm2015/cms/modules/federated/export.js → esm2020/cms/modules/federated/export.mjs} +0 -0
  379. /package/{esm2015/cms/modules/migrations/index.js → esm2020/cms/modules/migrations/index.mjs} +0 -0
  380. /package/{esm2015/cms/modules/migrations/types/migrations.types.js → esm2020/cms/modules/migrations/types/migrations.types.mjs} +0 -0
  381. /package/{esm2015/cms/modules/runtime/index.js → esm2020/cms/modules/runtime/index.mjs} +0 -0
  382. /package/{esm2015/cms/modules/runtime/tokens.js → esm2020/cms/modules/runtime/tokens.mjs} +0 -0
  383. /package/{esm2015/cms/modules/runtime/types/compilation.types.js → esm2020/cms/modules/runtime/types/compilation.types.mjs} +0 -0
  384. /package/{esm2015/cms/modules/runtime/types/runtime.actions.js → esm2020/cms/modules/runtime/types/runtime.actions.mjs} +0 -0
  385. /package/{esm2015/cms/services/index.js → esm2020/cms/services/index.mjs} +0 -0
  386. /package/{esm2015/cms/types/common.types.js → esm2020/cms/types/common.types.mjs} +0 -0
  387. /package/{esm2015/cms/types/configuration.types.js → esm2020/cms/types/configuration.types.mjs} +0 -0
  388. /package/{esm2015/cms/types/elements.types.js → esm2020/cms/types/elements.types.mjs} +0 -0
  389. /package/{esm2015/cms/types/index.js → esm2020/cms/types/index.mjs} +0 -0
  390. /package/{esm2015/cms/types/integration.types.js → esm2020/cms/types/integration.types.mjs} +0 -0
  391. /package/{esm2015/cms/types/layouts.types.js → esm2020/cms/types/layouts.types.mjs} +0 -0
  392. /package/{esm2015/cms/types/path.types.js → esm2020/cms/types/path.types.mjs} +0 -0
  393. /package/{esm2015/cms/utils/index.js → esm2020/cms/utils/index.mjs} +0 -0
  394. /package/{esm2015/cms/veloceapps-sdk-cms.js → esm2020/cms/veloceapps-sdk-cms.mjs} +0 -0
  395. /package/{esm2015/core/index.js → esm2020/core/index.mjs} +0 -0
  396. /package/{esm2015/core/modules/configuration/index.js → esm2020/core/modules/configuration/index.mjs} +0 -0
  397. /package/{esm2015/core/modules/configuration/types/configuration-runtime.types.js → esm2020/core/modules/configuration/types/configuration-runtime.types.mjs} +0 -0
  398. /package/{esm2015/core/modules/flow-configuration/index.js → esm2020/core/modules/flow-configuration/index.mjs} +0 -0
  399. /package/{esm2015/core/modules/flow-configuration/types/update.types.js → esm2020/core/modules/flow-configuration/types/update.types.mjs} +0 -0
  400. /package/{esm2015/core/modules/index.js → esm2020/core/modules/index.mjs} +0 -0
  401. /package/{esm2015/core/services/index.js → esm2020/core/services/index.mjs} +0 -0
  402. /package/{esm2015/core/services/metric-calculation/metric-calculation.types.js → esm2020/core/services/metric-calculation/metric-calculation.types.mjs} +0 -0
  403. /package/{esm2015/core/services/metric-calculation/metric-calculation.utils.js → esm2020/core/services/metric-calculation/metric-calculation.utils.mjs} +0 -0
  404. /package/{esm2015/core/types/index.js → esm2020/core/types/index.mjs} +0 -0
  405. /package/{esm2015/core/types/runtime.types.js → esm2020/core/types/runtime.types.mjs} +0 -0
  406. /package/{esm2015/core/types/ui-definition.types.js → esm2020/core/types/ui-definition.types.mjs} +0 -0
  407. /package/{esm2015/core/utils/index.js → esm2020/core/utils/index.mjs} +0 -0
  408. /package/{esm2015/core/utils/ui-definition.utils.js → esm2020/core/utils/ui-definition.utils.mjs} +0 -0
  409. /package/{esm2015/core/veloceapps-sdk-core.js → esm2020/core/veloceapps-sdk-core.mjs} +0 -0
  410. /package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  411. /package/{esm2015/runtime/components/index.js → esm2020/runtime/components/index.mjs} +0 -0
  412. /package/{esm2015/runtime/index.js → esm2020/runtime/index.mjs} +0 -0
  413. /package/{esm2015/runtime/services/index.js → esm2020/runtime/services/index.mjs} +0 -0
  414. /package/{esm2015/runtime/types/bound-data.types.js → esm2020/runtime/types/bound-data.types.mjs} +0 -0
  415. /package/{esm2015/runtime/types/index.js → esm2020/runtime/types/index.mjs} +0 -0
  416. /package/{esm2015/runtime/types/quote-states.types.js → esm2020/runtime/types/quote-states.types.mjs} +0 -0
  417. /package/{esm2015/runtime/types/runtime.types.js → esm2020/runtime/types/runtime.types.mjs} +0 -0
  418. /package/{esm2015/runtime/utils/section.utils.js → esm2020/runtime/utils/section.utils.mjs} +0 -0
  419. /package/{esm2015/runtime/utils/sections-binder.helper.js → esm2020/runtime/utils/sections-binder.helper.mjs} +0 -0
  420. /package/{esm2015/runtime/veloceapps-sdk-runtime.js → esm2020/runtime/veloceapps-sdk-runtime.mjs} +0 -0
  421. /package/{esm2015/src/components/dialog/dialog.types.js → esm2020/src/components/dialog/dialog.types.mjs} +0 -0
  422. /package/{esm2015/src/components/header/header.types.js → esm2020/src/components/header/header.types.mjs} +0 -0
  423. /package/{esm2015/src/components/header/metrics/index.js → esm2020/src/components/header/metrics/index.mjs} +0 -0
  424. /package/{esm2015/src/components/header/metrics/metrics.definitions.js → esm2020/src/components/header/metrics/metrics.definitions.mjs} +0 -0
  425. /package/{esm2015/src/constants.js → esm2020/src/constants.mjs} +0 -0
  426. /package/{esm2015/src/guards/index.js → esm2020/src/guards/index.mjs} +0 -0
  427. /package/{esm2015/src/index.js → esm2020/src/index.mjs} +0 -0
  428. /package/{esm2015/src/pages/remote/remote.types.js → esm2020/src/pages/remote/remote.types.mjs} +0 -0
  429. /package/{esm2015/src/services/index.js → esm2020/src/services/index.mjs} +0 -0
  430. /package/{esm2015/src/types/context-route.types.js → esm2020/src/types/context-route.types.mjs} +0 -0
  431. /package/{esm2015/src/types/flow-customization.types.js → esm2020/src/types/flow-customization.types.mjs} +0 -0
  432. /package/{esm2015/src/types/index.js → esm2020/src/types/index.mjs} +0 -0
  433. /package/{esm2015/src/types/metrics.types.js → esm2020/src/types/metrics.types.mjs} +0 -0
  434. /package/{esm2015/src/types/route.types.js → esm2020/src/types/route.types.mjs} +0 -0
  435. /package/{esm2015/src/utils/index.js → esm2020/src/utils/index.mjs} +0 -0
  436. /package/{esm2015/veloceapps-sdk.js → esm2020/veloceapps-sdk.mjs} +0 -0
@@ -1,1916 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@veloceapps/core'), require('rxjs'), require('rxjs/operators'), require('@veloceapps/api'), require('lodash'), require('@veloceapps/components'), require('primeng/api'), require('primeng/dynamicdialog'), require('moment')) :
3
- typeof define === 'function' && define.amd ? define('@veloceapps/sdk/core', ['exports', '@angular/core', '@veloceapps/core', 'rxjs', 'rxjs/operators', '@veloceapps/api', 'lodash', '@veloceapps/components', 'primeng/api', 'primeng/dynamicdialog', 'moment'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.core = {}), global.ng.core, global["@veloceapps/core"], global.rxjs, global.rxjs.operators, global["@veloceapps/api"], global.lodash, global["@veloceapps/components"], global["primeng/api"], global["primeng/dynamicdialog"], global.moment));
5
- })(this, (function (exports, i0, core, rxjs, operators, i1, lodash, components, i5, i6, moment) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n["default"] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
30
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
31
- var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
32
-
33
- var getDefaultLineItem = function (context, uiDefinitionProperties, qty) {
34
- if (qty === void 0) { qty = 1; }
35
- var _a, _b, _c;
36
- var id = core.UUID.UUID();
37
- var lineItem = Object.assign({ id: id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty: qty, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
38
- ? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
39
- : {}));
40
- return lineItem;
41
- };
42
-
43
- /******************************************************************************
44
- Copyright (c) Microsoft Corporation.
45
-
46
- Permission to use, copy, modify, and/or distribute this software for any
47
- purpose with or without fee is hereby granted.
48
-
49
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
50
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
51
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
52
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
53
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
54
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
55
- PERFORMANCE OF THIS SOFTWARE.
56
- ***************************************************************************** */
57
- /* global Reflect, Promise */
58
- var extendStatics = function (d, b) {
59
- extendStatics = Object.setPrototypeOf ||
60
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
61
- function (d, b) { for (var p in b)
62
- if (Object.prototype.hasOwnProperty.call(b, p))
63
- d[p] = b[p]; };
64
- return extendStatics(d, b);
65
- };
66
- function __extends(d, b) {
67
- if (typeof b !== "function" && b !== null)
68
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
69
- extendStatics(d, b);
70
- function __() { this.constructor = d; }
71
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
72
- }
73
- var __assign = function () {
74
- __assign = Object.assign || function __assign(t) {
75
- for (var s, i = 1, n = arguments.length; i < n; i++) {
76
- s = arguments[i];
77
- for (var p in s)
78
- if (Object.prototype.hasOwnProperty.call(s, p))
79
- t[p] = s[p];
80
- }
81
- return t;
82
- };
83
- return __assign.apply(this, arguments);
84
- };
85
- function __rest(s, e) {
86
- var t = {};
87
- for (var p in s)
88
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
89
- t[p] = s[p];
90
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
91
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
92
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
93
- t[p[i]] = s[p[i]];
94
- }
95
- return t;
96
- }
97
- function __decorate(decorators, target, key, desc) {
98
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
99
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
100
- r = Reflect.decorate(decorators, target, key, desc);
101
- else
102
- for (var i = decorators.length - 1; i >= 0; i--)
103
- if (d = decorators[i])
104
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
105
- return c > 3 && r && Object.defineProperty(target, key, r), r;
106
- }
107
- function __param(paramIndex, decorator) {
108
- return function (target, key) { decorator(target, key, paramIndex); };
109
- }
110
- function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
111
- function accept(f) { if (f !== void 0 && typeof f !== "function")
112
- throw new TypeError("Function expected"); return f; }
113
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
114
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
115
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
116
- var _, done = false;
117
- for (var i = decorators.length - 1; i >= 0; i--) {
118
- var context = {};
119
- for (var p in contextIn)
120
- context[p] = p === "access" ? {} : contextIn[p];
121
- for (var p in contextIn.access)
122
- context.access[p] = contextIn.access[p];
123
- context.addInitializer = function (f) { if (done)
124
- throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
125
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
126
- if (kind === "accessor") {
127
- if (result === void 0)
128
- continue;
129
- if (result === null || typeof result !== "object")
130
- throw new TypeError("Object expected");
131
- if (_ = accept(result.get))
132
- descriptor.get = _;
133
- if (_ = accept(result.set))
134
- descriptor.set = _;
135
- if (_ = accept(result.init))
136
- initializers.push(_);
137
- }
138
- else if (_ = accept(result)) {
139
- if (kind === "field")
140
- initializers.push(_);
141
- else
142
- descriptor[key] = _;
143
- }
144
- }
145
- if (target)
146
- Object.defineProperty(target, contextIn.name, descriptor);
147
- done = true;
148
- }
149
- ;
150
- function __runInitializers(thisArg, initializers, value) {
151
- var useValue = arguments.length > 2;
152
- for (var i = 0; i < initializers.length; i++) {
153
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
154
- }
155
- return useValue ? value : void 0;
156
- }
157
- ;
158
- function __propKey(x) {
159
- return typeof x === "symbol" ? x : "".concat(x);
160
- }
161
- ;
162
- function __setFunctionName(f, name, prefix) {
163
- if (typeof name === "symbol")
164
- name = name.description ? "[".concat(name.description, "]") : "";
165
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
166
- }
167
- ;
168
- function __metadata(metadataKey, metadataValue) {
169
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
170
- return Reflect.metadata(metadataKey, metadataValue);
171
- }
172
- function __awaiter(thisArg, _arguments, P, generator) {
173
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
174
- return new (P || (P = Promise))(function (resolve, reject) {
175
- function fulfilled(value) { try {
176
- step(generator.next(value));
177
- }
178
- catch (e) {
179
- reject(e);
180
- } }
181
- function rejected(value) { try {
182
- step(generator["throw"](value));
183
- }
184
- catch (e) {
185
- reject(e);
186
- } }
187
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
188
- step((generator = generator.apply(thisArg, _arguments || [])).next());
189
- });
190
- }
191
- function __generator(thisArg, body) {
192
- var _ = { label: 0, sent: function () { if (t[0] & 1)
193
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
194
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
195
- function verb(n) { return function (v) { return step([n, v]); }; }
196
- function step(op) {
197
- if (f)
198
- throw new TypeError("Generator is already executing.");
199
- while (g && (g = 0, op[0] && (_ = 0)), _)
200
- try {
201
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
202
- return t;
203
- if (y = 0, t)
204
- op = [op[0] & 2, t.value];
205
- switch (op[0]) {
206
- case 0:
207
- case 1:
208
- t = op;
209
- break;
210
- case 4:
211
- _.label++;
212
- return { value: op[1], done: false };
213
- case 5:
214
- _.label++;
215
- y = op[1];
216
- op = [0];
217
- continue;
218
- case 7:
219
- op = _.ops.pop();
220
- _.trys.pop();
221
- continue;
222
- default:
223
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
224
- _ = 0;
225
- continue;
226
- }
227
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
228
- _.label = op[1];
229
- break;
230
- }
231
- if (op[0] === 6 && _.label < t[1]) {
232
- _.label = t[1];
233
- t = op;
234
- break;
235
- }
236
- if (t && _.label < t[2]) {
237
- _.label = t[2];
238
- _.ops.push(op);
239
- break;
240
- }
241
- if (t[2])
242
- _.ops.pop();
243
- _.trys.pop();
244
- continue;
245
- }
246
- op = body.call(thisArg, _);
247
- }
248
- catch (e) {
249
- op = [6, e];
250
- y = 0;
251
- }
252
- finally {
253
- f = t = 0;
254
- }
255
- if (op[0] & 5)
256
- throw op[1];
257
- return { value: op[0] ? op[1] : void 0, done: true };
258
- }
259
- }
260
- var __createBinding = Object.create ? (function (o, m, k, k2) {
261
- if (k2 === undefined)
262
- k2 = k;
263
- var desc = Object.getOwnPropertyDescriptor(m, k);
264
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
265
- desc = { enumerable: true, get: function () { return m[k]; } };
266
- }
267
- Object.defineProperty(o, k2, desc);
268
- }) : (function (o, m, k, k2) {
269
- if (k2 === undefined)
270
- k2 = k;
271
- o[k2] = m[k];
272
- });
273
- function __exportStar(m, o) {
274
- for (var p in m)
275
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
276
- __createBinding(o, m, p);
277
- }
278
- function __values(o) {
279
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
280
- if (m)
281
- return m.call(o);
282
- if (o && typeof o.length === "number")
283
- return {
284
- next: function () {
285
- if (o && i >= o.length)
286
- o = void 0;
287
- return { value: o && o[i++], done: !o };
288
- }
289
- };
290
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
291
- }
292
- function __read(o, n) {
293
- var m = typeof Symbol === "function" && o[Symbol.iterator];
294
- if (!m)
295
- return o;
296
- var i = m.call(o), r, ar = [], e;
297
- try {
298
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
299
- ar.push(r.value);
300
- }
301
- catch (error) {
302
- e = { error: error };
303
- }
304
- finally {
305
- try {
306
- if (r && !r.done && (m = i["return"]))
307
- m.call(i);
308
- }
309
- finally {
310
- if (e)
311
- throw e.error;
312
- }
313
- }
314
- return ar;
315
- }
316
- /** @deprecated */
317
- function __spread() {
318
- for (var ar = [], i = 0; i < arguments.length; i++)
319
- ar = ar.concat(__read(arguments[i]));
320
- return ar;
321
- }
322
- /** @deprecated */
323
- function __spreadArrays() {
324
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
325
- s += arguments[i].length;
326
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
327
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
328
- r[k] = a[j];
329
- return r;
330
- }
331
- function __spreadArray(to, from, pack) {
332
- if (pack || arguments.length === 2)
333
- for (var i = 0, l = from.length, ar; i < l; i++) {
334
- if (ar || !(i in from)) {
335
- if (!ar)
336
- ar = Array.prototype.slice.call(from, 0, i);
337
- ar[i] = from[i];
338
- }
339
- }
340
- return to.concat(ar || Array.prototype.slice.call(from));
341
- }
342
- function __await(v) {
343
- return this instanceof __await ? (this.v = v, this) : new __await(v);
344
- }
345
- function __asyncGenerator(thisArg, _arguments, generator) {
346
- if (!Symbol.asyncIterator)
347
- throw new TypeError("Symbol.asyncIterator is not defined.");
348
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
349
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
350
- function verb(n) { if (g[n])
351
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
352
- function resume(n, v) { try {
353
- step(g[n](v));
354
- }
355
- catch (e) {
356
- settle(q[0][3], e);
357
- } }
358
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
359
- function fulfill(value) { resume("next", value); }
360
- function reject(value) { resume("throw", value); }
361
- function settle(f, v) { if (f(v), q.shift(), q.length)
362
- resume(q[0][0], q[0][1]); }
363
- }
364
- function __asyncDelegator(o) {
365
- var i, p;
366
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
367
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
368
- }
369
- function __asyncValues(o) {
370
- if (!Symbol.asyncIterator)
371
- throw new TypeError("Symbol.asyncIterator is not defined.");
372
- var m = o[Symbol.asyncIterator], i;
373
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
374
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
375
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
376
- }
377
- function __makeTemplateObject(cooked, raw) {
378
- if (Object.defineProperty) {
379
- Object.defineProperty(cooked, "raw", { value: raw });
380
- }
381
- else {
382
- cooked.raw = raw;
383
- }
384
- return cooked;
385
- }
386
- ;
387
- var __setModuleDefault = Object.create ? (function (o, v) {
388
- Object.defineProperty(o, "default", { enumerable: true, value: v });
389
- }) : function (o, v) {
390
- o["default"] = v;
391
- };
392
- function __importStar(mod) {
393
- if (mod && mod.__esModule)
394
- return mod;
395
- var result = {};
396
- if (mod != null)
397
- for (var k in mod)
398
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
399
- __createBinding(result, mod, k);
400
- __setModuleDefault(result, mod);
401
- return result;
402
- }
403
- function __importDefault(mod) {
404
- return (mod && mod.__esModule) ? mod : { default: mod };
405
- }
406
- function __classPrivateFieldGet(receiver, state, kind, f) {
407
- if (kind === "a" && !f)
408
- throw new TypeError("Private accessor was defined without a getter");
409
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
410
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
411
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
412
- }
413
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
414
- if (kind === "m")
415
- throw new TypeError("Private method is not writable");
416
- if (kind === "a" && !f)
417
- throw new TypeError("Private accessor was defined without a setter");
418
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
419
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
420
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
421
- }
422
- function __classPrivateFieldIn(state, receiver) {
423
- if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
424
- throw new TypeError("Cannot use 'in' operator on non-object");
425
- return typeof state === "function" ? receiver === state : state.has(receiver);
426
- }
427
-
428
- exports.RuntimeMode = void 0;
429
- (function (RuntimeMode) {
430
- RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
431
- RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
432
- })(exports.RuntimeMode || (exports.RuntimeMode = {}));
433
- exports.RuntimeOperation = void 0;
434
- (function (RuntimeOperation) {
435
- RuntimeOperation["INIT"] = "INIT";
436
- RuntimeOperation["UPDATE"] = "UPDATE";
437
- })(exports.RuntimeOperation || (exports.RuntimeOperation = {}));
438
- exports.RuntimeStep = void 0;
439
- (function (RuntimeStep) {
440
- RuntimeStep["START"] = "START";
441
- RuntimeStep["UPDATE"] = "UPDATE";
442
- })(exports.RuntimeStep || (exports.RuntimeStep = {}));
443
-
444
- var UI_DEFINITION_VERSION = 3;
445
-
446
- var ContextService = /** @class */ (function () {
447
- function ContextService(contextApiService) {
448
- this.contextApiService = contextApiService;
449
- this.context = new rxjs.BehaviorSubject(null);
450
- }
451
- Object.defineProperty(ContextService.prototype, "isInitialized", {
452
- get: function () {
453
- return Boolean(this.context.value);
454
- },
455
- enumerable: false,
456
- configurable: true
457
- });
458
- Object.defineProperty(ContextService.prototype, "mode", {
459
- get: function () {
460
- return this.resolve().properties.mode;
461
- },
462
- enumerable: false,
463
- configurable: true
464
- });
465
- ContextService.prototype.resolve = function () {
466
- if (!this.context.value) {
467
- throw new Error('Context is not initialized yet!');
468
- }
469
- return Object.assign({}, this.context.value);
470
- };
471
- ContextService.prototype.resolve$ = function () {
472
- return this.context.pipe(operators.filter(function (ctx) { return Boolean(ctx); }));
473
- };
474
- ContextService.prototype.create = function (headerId, mode) {
475
- var _this = this;
476
- return this.contextApiService.getContext(headerId, mode).pipe(operators.tap(function (context) { return _this.context.next(lodash.merge(new core.ConfigurationContext(headerId, mode), context)); }), operators.map(function () { return _this.resolve(); }));
477
- };
478
- ContextService.prototype.update = function (partialContext) {
479
- var originalContext = this.resolve();
480
- var updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
481
- this.context.next(updatedContext);
482
- return updatedContext;
483
- };
484
- ContextService.prototype.set = function (context) {
485
- var originalContext = this.resolve();
486
- var updatedContext = Object.assign(Object.assign({}, originalContext), context);
487
- this.context.next(updatedContext);
488
- return updatedContext;
489
- };
490
- ContextService.prototype.delete = function () {
491
- this.context.next(null);
492
- };
493
- return ContextService;
494
- }());
495
- ContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, deps: [{ token: i1__namespace.ContextApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
496
- ContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, providedIn: 'root' });
497
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, decorators: [{
498
- type: i0.Injectable,
499
- args: [{ providedIn: 'root' }]
500
- }], ctorParameters: function () { return [{ type: i1__namespace.ContextApiService }]; } });
501
-
502
- var RuntimeContextService = /** @class */ (function () {
503
- function RuntimeContextService(configurationApiService) {
504
- this.configurationApiService = configurationApiService;
505
- }
506
- RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
507
- var _this = this;
508
- return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(operators.map(function (runtimeData) {
509
- var _a, _b, _c;
510
- var uiDefinition = _this.getUIDefinition(runtimeData);
511
- var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
512
- var _d = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _d.productName, properties = _d.properties;
513
- return {
514
- modelId: runtimeData.modelId,
515
- uiDefinition: uiDefinition,
516
- runtimeModel: runtimeModel,
517
- runtimeMode: exports.RuntimeMode.PROD,
518
- productId: productId,
519
- productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
520
- offeringId: offeringId,
521
- properties: {
522
- PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
523
- PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
524
- },
525
- };
526
- }));
527
- };
528
- RuntimeContextService.prototype.getUIDefinition = function (runtimeData) {
529
- var _a;
530
- var rawUiDefinitions;
531
- try {
532
- rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
533
- }
534
- catch (e) {
535
- return;
536
- }
537
- var uiDefinitions = rawUiDefinitions.filter(function (uiDef) { return uiDef.version; });
538
- var uiDefinition = (_a = uiDefinitions.find(function (uiDef) { return uiDef.primary; })) !== null && _a !== void 0 ? _a : uiDefinitions[0];
539
- return uiDefinition;
540
- };
541
- return RuntimeContextService;
542
- }());
543
- RuntimeContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService, deps: [{ token: i1__namespace.ConfigurationApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
544
- RuntimeContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService });
545
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService, decorators: [{
546
- type: i0.Injectable
547
- }], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }]; } });
548
-
549
- var ConfigurationRuntimeService = /** @class */ (function () {
550
- function ConfigurationRuntimeService(apiService, contextService, runtimeContextService) {
551
- this.apiService = apiService;
552
- this.contextService = contextService;
553
- this.runtimeContextService = runtimeContextService;
554
- this._isInitialized = false;
555
- this.uiDefinitionProperties = {};
556
- }
557
- ConfigurationRuntimeService.prototype.reset = function () {
558
- this._isInitialized = false;
559
- this._runtimeContext = undefined;
560
- this.initializationProps = undefined;
561
- this.uiDefinitionProperties = {};
562
- };
563
- ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
564
- var _this = this;
565
- var _a, _b;
566
- this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
567
- var uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
568
- return rxjs.combineLatest([
569
- this.apiService.getRuntimeDataByModelId(modelId),
570
- this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
571
- ]).pipe(operators.first(), operators.tap(function (_e) {
572
- var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
573
- var _a;
574
- _this._runtimeContext = {
575
- modelId: modelId,
576
- runtimeModel: core.RuntimeModel.create(runtimeData.types, runtimeData.products),
577
- runtimeMode: exports.RuntimeMode.TEST,
578
- };
579
- _this.contextService.update({
580
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: _this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
581
- });
582
- _this._isInitialized = true;
583
- }));
584
- };
585
- ConfigurationRuntimeService.prototype.init = function (props) {
586
- var _this = this;
587
- this.initializationProps = props;
588
- var context = this.contextService.resolve();
589
- return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(operators.tap(function (runtimeContext) {
590
- var _a, _b, _c, _d;
591
- _this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
592
- var PriceListId = ((_c = context.properties) !== null && _c !== void 0 ? _c : {}).PriceListId;
593
- var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
594
- _this.id15to18('AccountId', mergeContext.properties);
595
- _this._runtimeContext = mergeContext;
596
- if (context.properties && ((_d = _this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
597
- _this.contextService.update({
598
- properties: Object.assign(Object.assign({}, _this._runtimeContext.properties), context.properties),
599
- });
600
- }
601
- _this._isInitialized = true;
602
- }));
603
- };
604
- ConfigurationRuntimeService.prototype.id15to18 = function (propertyName, source) {
605
- if (!source) {
606
- return;
607
- }
608
- var value = source[propertyName];
609
- if (typeof value === 'string' && value.length === 15) {
610
- source[propertyName] = core.SalesforceIdUtils.generateId18FromId15(value);
611
- }
612
- };
613
- Object.defineProperty(ConfigurationRuntimeService.prototype, "isInitialized", {
614
- get: function () {
615
- return this._isInitialized;
616
- },
617
- enumerable: false,
618
- configurable: true
619
- });
620
- Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeModel", {
621
- get: function () {
622
- var _a;
623
- return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
624
- },
625
- enumerable: false,
626
- configurable: true
627
- });
628
- Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeContext", {
629
- get: function () {
630
- return this._runtimeContext;
631
- },
632
- enumerable: false,
633
- configurable: true
634
- });
635
- return ConfigurationRuntimeService;
636
- }());
637
- ConfigurationRuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
638
- ConfigurationRuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService });
639
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService, decorators: [{
640
- type: i0.Injectable
641
- }], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
642
-
643
- var findLineItem = function (id, lineItems) {
644
- return findLineItemWithComparator(lineItems, function (li) { return li.id === id; });
645
- };
646
- var findLineItemWithComparator = function (lineItems, comparator) {
647
- var currentLevel = lineItems;
648
- while (currentLevel.length) {
649
- var found = currentLevel.find(comparator);
650
- if (found) {
651
- return found;
652
- }
653
- currentLevel = lodash.flatten(currentLevel.map(function (parent) { return parent.lineItems; }));
654
- }
655
- return;
656
- };
657
- var insertLineItem = function (lineItem, parentId, toInsert) {
658
- var insertData = lineItem.id === parentId ? [toInsert] : [];
659
- return Object.assign(Object.assign({}, lineItem), { lineItems: __spreadArray(__spreadArray([], __read(insertData)), __read(lineItem.lineItems.map(function (li) {
660
- return insertLineItem(li, parentId, toInsert);
661
- }))) });
662
- };
663
- var removeLineItem = function (lineItem, idToRemove) {
664
- return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
665
- .map(function (li) {
666
- if (li.id === idToRemove) {
667
- return;
668
- }
669
- else if (li.lineItems.length) {
670
- return removeLineItem(li, idToRemove);
671
- }
672
- return li;
673
- })
674
- .filter(function (r) { return !!r; }) });
675
- };
676
- var replaceLineItem = function (lineItem, replaceTo) {
677
- if (lineItem.id === replaceTo.id) {
678
- return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
679
- }
680
- return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) { return replaceLineItem(li, replaceTo); }) });
681
- };
682
- var calculateCardinalityVariables = function (lineItems) {
683
- var cardVars = new Map();
684
- lineItems.forEach(function (li) {
685
- var _a;
686
- var cardinalityVariableName = "#CV-" + li.type + "@" + li.port;
687
- cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
688
- });
689
- return cardVars;
690
- };
691
- var recalculateCardinalityVariables = function (original, updated) {
692
- var cardinalityVariables = calculateCardinalityVariables(updated.lineItems);
693
- var originalCardinalityVariables = calculateCardinalityVariables(original.lineItems);
694
- originalCardinalityVariables.forEach(function (value, key) {
695
- if (cardinalityVariables.get(key) === value) {
696
- // no need to update cardinality if no changes
697
- cardinalityVariables.delete(key);
698
- }
699
- else if (!cardinalityVariables.has(key)) {
700
- // remove last item from port
701
- cardinalityVariables.set(key, 0);
702
- }
703
- });
704
- return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, __spreadArray([], __read(cardinalityVariables)).map(function (_c) {
705
- var _d = __read(_c, 2), name = _d[0], value = _d[1];
706
- return ({ name: name, value: value });
707
- })) });
708
- };
709
- var mapAttributes = function (attributes) {
710
- return attributes.reduce(function (acc, _c) {
711
- var _d;
712
- var name = _c.name, value = _c.value;
713
- return (Object.assign(Object.assign({}, acc), (_d = {}, _d[name] = value, _d)));
714
- }, {});
715
- };
716
- var getAttributes = function (attributes, names) {
717
- if (names === void 0) { names = []; }
718
- var filtered = attributes.filter(function (_c) {
719
- var name = _c.name;
720
- return names.includes(name);
721
- });
722
- return lodash.sortBy(filtered, [function (_c) {
723
- var name = _c.name;
724
- return names.indexOf(name);
725
- }]);
726
- };
727
- var upsertAttributes = function (originalAttributes, attributesToUpsert) {
728
- return attributesToUpsert.reduce(function (acc, _c) {
729
- var name = _c.name, value = _c.value;
730
- var _d = __read(getAttributes(acc, [name]), 1), origAttr = _d[0];
731
- return __spreadArray(__spreadArray([], __read(acc.filter(function (attr) { return attr.name !== name; }))), [
732
- Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name: name })), { cfgStatus: 'User', value: value }),
733
- ]);
734
- }, originalAttributes);
735
- };
736
- var patchAttributes = function (rootLineItem, id, attrs) {
737
- var lineItem = findLineItem(id, [rootLineItem]);
738
- if (!lineItem) {
739
- return rootLineItem;
740
- }
741
- var attributes = upsertAttributes(lineItem.attributes, attrs);
742
- return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes: attributes }));
743
- };
744
- var getAttributeValue = function (attributes, name) { var _a; return (_a = attributes.find(function (attr) { return attr.name === name; })) === null || _a === void 0 ? void 0 : _a.value; };
745
- var generateLineItem = function (port, type, parentId, attributes, lineItems) {
746
- if (attributes === void 0) { attributes = []; }
747
- if (lineItems === void 0) { lineItems = []; }
748
- return {
749
- id: core.UUID.UUID(),
750
- port: port,
751
- type: type,
752
- actionCode: 'ADD',
753
- cfgStatus: 'New',
754
- attributes: attributes.map(function (_c) {
755
- var name = _c.name, value = _c.value;
756
- return ({ cfgStatus: 'User', name: name, value: value });
757
- }),
758
- lineItems: lineItems,
759
- parentId: parentId,
760
- qty: 1,
761
- };
762
- };
763
- var getRecommendedPrices = function (portDomain, type) {
764
- var _a, _b;
765
- var domainType = portDomain.domainTypes.find(function (_c) {
766
- var name = _c.name;
767
- return name === type;
768
- });
769
- var _c = __read((_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(function (_c) {
770
- var chargeMethod = _c.chargeMethod;
771
- return chargeMethod === 'ONE_TIME';
772
- }).reduce(function (acc, rp) {
773
- var _c = __read(acc, 2), netPrice = _c[0], listPrice = _c[1];
774
- return [netPrice + rp.netPrice, listPrice + rp.listPrice];
775
- }, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0], 2), net = _c[0], list = _c[1];
776
- return { net: net, list: list };
777
- };
778
- var generateModifiedAssetsMap = function (lineItems) {
779
- return lineItems.reduce(function (acc, li) {
780
- var _a;
781
- if (li.rampInstanceId && li.status !== 'EXIST') {
782
- var target = li;
783
- while (target && target.rampInstanceId) {
784
- target = lineItems.find(function (sub) { return sub.id === li.rampInstanceId; });
785
- }
786
- var id = (_a = target === null || target === void 0 ? void 0 : target.assetId) !== null && _a !== void 0 ? _a : target === null || target === void 0 ? void 0 : target.openOrderLineItemId;
787
- if (id) {
788
- acc[id] = true;
789
- }
790
- }
791
- return acc;
792
- }, {});
793
- };
794
- var multiplyLineItems = function (lineItem, qty, split) {
795
- if (split) {
796
- var unifyIds_1 = function (lineItem) { return (Object.assign(Object.assign({}, lineItem), { id: core.UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds_1) })); };
797
- return lodash.map(new Array(qty), function () { return unifyIds_1(lineItem); });
798
- }
799
- else {
800
- return [
801
- Object.assign(Object.assign({}, lineItem), { qty: qty }),
802
- ];
803
- }
804
- };
805
-
806
- var lineItem_utils = /*#__PURE__*/Object.freeze({
807
- __proto__: null,
808
- findLineItem: findLineItem,
809
- findLineItemWithComparator: findLineItemWithComparator,
810
- insertLineItem: insertLineItem,
811
- removeLineItem: removeLineItem,
812
- replaceLineItem: replaceLineItem,
813
- calculateCardinalityVariables: calculateCardinalityVariables,
814
- recalculateCardinalityVariables: recalculateCardinalityVariables,
815
- mapAttributes: mapAttributes,
816
- getAttributes: getAttributes,
817
- upsertAttributes: upsertAttributes,
818
- patchAttributes: patchAttributes,
819
- getAttributeValue: getAttributeValue,
820
- generateLineItem: generateLineItem,
821
- getRecommendedPrices: getRecommendedPrices,
822
- generateModifiedAssetsMap: generateModifiedAssetsMap,
823
- multiplyLineItems: multiplyLineItems
824
- });
825
-
826
- var LineItemWorker = /** @class */ (function () {
827
- function LineItemWorker(src) {
828
- this.li = Object.assign({}, src);
829
- }
830
- LineItemWorker.prototype.insert = function (parentId, toInsert) {
831
- return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
832
- };
833
- LineItemWorker.prototype.remove = function (id) {
834
- return new LineItemWorker(removeLineItem(this.li, id));
835
- };
836
- LineItemWorker.prototype.replace = function (toReplace) {
837
- return new LineItemWorker(replaceLineItem(this.li, toReplace));
838
- };
839
- LineItemWorker.prototype.patchAttribute = function (attrs, id) {
840
- return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
841
- };
842
- return LineItemWorker;
843
- }());
844
-
845
- var QuoteDraftService = /** @class */ (function () {
846
- function QuoteDraftService(context, quoteApiService, priceApiService) {
847
- var _this = this;
848
- this.context = context;
849
- this.quoteApiService = quoteApiService;
850
- this.priceApiService = priceApiService;
851
- this.quoteSubj$ = new rxjs.BehaviorSubject(null);
852
- this.resetSubj$ = new rxjs.BehaviorSubject(true);
853
- this.isInitializedSubj$ = new rxjs.BehaviorSubject(false);
854
- this.initialCurrentState = [];
855
- this._hasUnsavedChanges = false;
856
- this.allPriceLists = [];
857
- this.assetPriceLists = [];
858
- this.reset$ = this.resetSubj$.asObservable();
859
- this.activePriceList$ = this.context.resolve$().pipe(operators.map(function (ctx) { return _this.allPriceLists.find(function (priceList) { return priceList.id === ctx.properties.PriceListId; }); }), operators.map(function (priceList) { return priceList !== null && priceList !== void 0 ? priceList : null; }));
860
- this.isInitializedSubj$
861
- .pipe(operators.filter(function (isInitialized) { return isInitialized; }), operators.switchMap(function () { return _this.quoteSubj$.asObservable(); }), operators.skip(1), operators.tap(function (quote) { return _this.markAsUpdated(quote); }))
862
- .subscribe();
863
- }
864
- Object.defineProperty(QuoteDraftService.prototype, "isInitialized", {
865
- get: function () {
866
- return this.isInitializedSubj$.getValue();
867
- },
868
- set: function (value) {
869
- if (this.isInitialized !== value) {
870
- this.isInitializedSubj$.next(value);
871
- }
872
- },
873
- enumerable: false,
874
- configurable: true
875
- });
876
- Object.defineProperty(QuoteDraftService.prototype, "hasUnsavedChanges", {
877
- get: function () {
878
- return this._hasUnsavedChanges;
879
- },
880
- set: function (value) {
881
- var _a, _b;
882
- this._hasUnsavedChanges = value;
883
- if (!this._hasUnsavedChanges) {
884
- this.initialCurrentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
885
- }
886
- },
887
- enumerable: false,
888
- configurable: true
889
- });
890
- Object.defineProperty(QuoteDraftService.prototype, "hasProducts$", {
891
- get: function () {
892
- var _this = this;
893
- return this.quoteSubj$.pipe(operators.map(function () { return _this.hasProducts; }));
894
- },
895
- enumerable: false,
896
- configurable: true
897
- });
898
- Object.defineProperty(QuoteDraftService.prototype, "hasProducts", {
899
- get: function () {
900
- var quoteDraft = this.quoteSubj$.value;
901
- return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
902
- },
903
- enumerable: false,
904
- configurable: true
905
- });
906
- QuoteDraftService.prototype.reset = function () {
907
- this.resetSubj$.next(true);
908
- this.quoteSubj$.next(null);
909
- this.hasUnsavedChanges = false;
910
- };
911
- QuoteDraftService.prototype.init = function (quoteId, params) {
912
- var _this = this;
913
- return rxjs.zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(operators.tap(function (_c) {
914
- var _d = __read(_c, 2), quote = _d[0], allPriceLists = _d[1];
915
- _this.allPriceLists = allPriceLists;
916
- _this.quoteSubj$.next(quote);
917
- _this.context.update(quote.context);
918
- _this.populateActivePriceLists$();
919
- }), operators.map(function () { return rxjs.noop(); }), operators.take(1));
920
- };
921
- QuoteDraftService.prototype.setCurrentLineItemState = function (lineItems) {
922
- var quoteDraft = this.quoteSubj$.value;
923
- if (!quoteDraft) {
924
- return;
925
- }
926
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
927
- };
928
- QuoteDraftService.prototype.updateQuoteDraft = function (update) {
929
- var quoteDraft = this.quoteSubj$.value;
930
- if (!quoteDraft) {
931
- return;
932
- }
933
- if (update.context) {
934
- this.context.set(update.context);
935
- }
936
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
937
- };
938
- QuoteDraftService.prototype.updateByPriceSummary = function (priceSummary) {
939
- var quoteDraft = this.quoteSubj$.value;
940
- if (!quoteDraft) {
941
- return;
942
- }
943
- var updatedCurrentState = this.currentState.map(function (lineItem) {
944
- var updated = priceSummary.lineItems.find(function (li) { return li.id === lineItem.id; });
945
- return updated !== null && updated !== void 0 ? updated : lineItem;
946
- });
947
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
948
- };
949
- Object.defineProperty(QuoteDraftService.prototype, "quoteDraft$", {
950
- get: function () {
951
- var _this = this;
952
- return rxjs.combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(operators.map(function () { return _this.quoteDraft; }), operators.filter(function (quote) { return Boolean(quote); }), operators.shareReplay());
953
- },
954
- enumerable: false,
955
- configurable: true
956
- });
957
- Object.defineProperty(QuoteDraftService.prototype, "quoteDraft", {
958
- get: function () {
959
- var quote = this.quoteSubj$.value;
960
- if (!quote) {
961
- return null;
962
- }
963
- return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
964
- },
965
- enumerable: false,
966
- configurable: true
967
- });
968
- Object.defineProperty(QuoteDraftService.prototype, "quoteDraftForActivePriceList", {
969
- get: function () {
970
- var quoteDraft = this.quoteDraft;
971
- if (!quoteDraft) {
972
- return null;
973
- }
974
- return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
975
- },
976
- enumerable: false,
977
- configurable: true
978
- });
979
- Object.defineProperty(QuoteDraftService.prototype, "currentState$", {
980
- get: function () {
981
- return this.quoteDraft$.pipe(operators.map(function (quote) { return quote.currentState; }));
982
- },
983
- enumerable: false,
984
- configurable: true
985
- });
986
- Object.defineProperty(QuoteDraftService.prototype, "currentState", {
987
- get: function () {
988
- var _a, _b;
989
- return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
990
- },
991
- enumerable: false,
992
- configurable: true
993
- });
994
- Object.defineProperty(QuoteDraftService.prototype, "activeCurrentState$", {
995
- /**
996
- * Stream of activeCurrentState
997
- */
998
- get: function () {
999
- var _this = this;
1000
- return this.quoteDraft$.pipe(operators.map(function () { return _this.activeCurrentState; }));
1001
- },
1002
- enumerable: false,
1003
- configurable: true
1004
- });
1005
- Object.defineProperty(QuoteDraftService.prototype, "activeCurrentState", {
1006
- /**
1007
- * activeCurrentState is currentState passed through additional filters
1008
- */
1009
- get: function () {
1010
- var _a, _b;
1011
- var currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
1012
- currentState = this.filterByActivePriceList(currentState);
1013
- return currentState;
1014
- },
1015
- enumerable: false,
1016
- configurable: true
1017
- });
1018
- Object.defineProperty(QuoteDraftService.prototype, "activeInitialState$", {
1019
- /**
1020
- * Stream of activeInitialState
1021
- */
1022
- get: function () {
1023
- var _this = this;
1024
- return this.quoteDraft$.pipe(operators.map(function () { return _this.activeInitialState; }));
1025
- },
1026
- enumerable: false,
1027
- configurable: true
1028
- });
1029
- Object.defineProperty(QuoteDraftService.prototype, "activeInitialState", {
1030
- /**
1031
- * activeInitialState is initialState passed through additional filters
1032
- */
1033
- get: function () {
1034
- var _a, _b;
1035
- var ctx = this.context.resolve();
1036
- var initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
1037
- if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
1038
- initialState = this.filterByActivePriceList(initialState);
1039
- }
1040
- return initialState;
1041
- },
1042
- enumerable: false,
1043
- configurable: true
1044
- });
1045
- Object.defineProperty(QuoteDraftService.prototype, "isStandalone", {
1046
- get: function () {
1047
- return this.context.resolve().properties.standalone === 'true';
1048
- },
1049
- enumerable: false,
1050
- configurable: true
1051
- });
1052
- Object.defineProperty(QuoteDraftService.prototype, "isStandalone$", {
1053
- get: function () {
1054
- var _this = this;
1055
- return this.context.resolve$().pipe(operators.map(function () { return _this.isStandalone; }));
1056
- },
1057
- enumerable: false,
1058
- configurable: true
1059
- });
1060
- QuoteDraftService.prototype.getInitialCurrentState = function () {
1061
- return this.initialCurrentState;
1062
- };
1063
- QuoteDraftService.prototype.isEditMode$ = function () {
1064
- var _this = this;
1065
- return this.context.resolve$().pipe(operators.map(function () { return _this.isEditMode(); }));
1066
- };
1067
- QuoteDraftService.prototype.isEditMode = function () {
1068
- var context = this.context.resolve();
1069
- if (context.mode === core.ConfigurationContextMode.ACCOUNT) {
1070
- return true;
1071
- }
1072
- if (context.mode === core.ConfigurationContextMode.QUOTE) {
1073
- return context.properties.Status === 'Draft';
1074
- }
1075
- return false;
1076
- };
1077
- QuoteDraftService.prototype.updateActivePriceList = function (priceListId) {
1078
- this.context.update({ properties: { PriceListId: priceListId } });
1079
- };
1080
- QuoteDraftService.prototype.populateActivePriceLists$ = function () {
1081
- var _this = this;
1082
- var ctx = this.context.resolve();
1083
- var quoteDraft = this.quoteDraft;
1084
- if (!quoteDraft) {
1085
- return;
1086
- }
1087
- // In ACCOUNT mode populate price lists from related assets
1088
- if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
1089
- // Populate list of price lists
1090
- this.assetPriceLists = quoteDraft.currentState
1091
- .map(function (_c) {
1092
- var priceListId = _c.priceListId;
1093
- return priceListId;
1094
- })
1095
- .reduce(function (trunk, priceListId) {
1096
- var _a, _b;
1097
- if (!priceListId || trunk.some(function (item) { return item.id === priceListId; })) {
1098
- return trunk;
1099
- }
1100
- return __spreadArray(__spreadArray([], __read(trunk)), [
1101
- { id: priceListId, name: (_b = (_a = _this.allPriceLists.find(function (item) { return item.id === priceListId; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
1102
- ]);
1103
- }, []);
1104
- }
1105
- };
1106
- QuoteDraftService.prototype.filterByActivePriceList = function (lineItems) {
1107
- var ctx = this.context.resolve();
1108
- return lineItems.filter(function (li) { return !li.priceListId || li.priceListId === ctx.properties.PriceListId; });
1109
- };
1110
- QuoteDraftService.prototype.markAsUpdated = function (quote) {
1111
- if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === core.ConfigurationContextMode.ACCOUNT) {
1112
- this.hasUnsavedChanges = !!quote && !quote.currentState.every(function (li) { return li.actionCode === 'EXIST'; });
1113
- }
1114
- else {
1115
- this.hasUnsavedChanges = !lodash.isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
1116
- }
1117
- };
1118
- return QuoteDraftService;
1119
- }());
1120
- QuoteDraftService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1__namespace.QuoteApiService }, { token: i1__namespace.PriceApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1121
- QuoteDraftService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, providedIn: 'root' });
1122
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, decorators: [{
1123
- type: i0.Injectable,
1124
- args: [{ providedIn: 'root' }]
1125
- }], ctorParameters: function () { return [{ type: ContextService }, { type: i1__namespace.QuoteApiService }, { type: i1__namespace.PriceApiService }]; } });
1126
-
1127
- var ConfigurationService = /** @class */ (function () {
1128
- function ConfigurationService(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
1129
- this.quoteDraftService = quoteDraftService;
1130
- this.runtimeService = runtimeService;
1131
- this.contextService = contextService;
1132
- this.configurationApiService = configurationApiService;
1133
- this.messageService = messageService;
1134
- this.dialogService = dialogService;
1135
- this.mode = core.ConfigurationMode.SEARCH;
1136
- this.lineItem = new rxjs.BehaviorSubject(undefined);
1137
- this.charges = new rxjs.BehaviorSubject({});
1138
- this.pricePlans = new rxjs.BehaviorSubject({});
1139
- this.hasUnsavedChanges = false;
1140
- }
1141
- ConfigurationService.prototype.reset = function () {
1142
- this.hasUnsavedChanges = false;
1143
- this.runtimeService.reset();
1144
- this.configurableRamp = undefined;
1145
- this.lineItem.next(undefined);
1146
- this.charges.next({});
1147
- this.pricePlans.next({});
1148
- };
1149
- ConfigurationService.prototype.patch$ = function (lineItem) {
1150
- var _this = this;
1151
- if (!this.lineItem.value) {
1152
- return rxjs.throwError(function () { return new Error("Source LineItem not found"); });
1153
- }
1154
- this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
1155
- return this.configure().pipe(operators.catchError(function (error) {
1156
- console.error(error);
1157
- if (!_this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
1158
- _this.messageService.add({ severity: 'error', summary: error });
1159
- }
1160
- // bounce back if configuration call has failed
1161
- _this.lineItem.next(_this.lineItem.value ? Object.assign({}, _this.lineItem.value) : undefined);
1162
- return rxjs.throwError(function () { return error; });
1163
- }), operators.tap(function () {
1164
- if (!_this.hasUnsavedChanges) {
1165
- _this.hasUnsavedChanges = true;
1166
- }
1167
- }));
1168
- };
1169
- ConfigurationService.prototype.patch = function (lineItem) {
1170
- this.patch$(lineItem).subscribe();
1171
- };
1172
- ConfigurationService.prototype.setConfigurableRamp = function (lineItem) {
1173
- this.configurableRamp = lineItem;
1174
- };
1175
- ConfigurationService.prototype.get = function () {
1176
- return this.lineItem.asObservable().pipe(rxjs.shareReplay());
1177
- };
1178
- ConfigurationService.prototype.getSnapshot = function () {
1179
- return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
1180
- };
1181
- ConfigurationService.prototype.getRuntimeModel = function () {
1182
- return this.runtimeService.runtimeModel;
1183
- };
1184
- ConfigurationService.prototype.getRuntimeContext = function () {
1185
- return this.runtimeService.runtimeContext;
1186
- };
1187
- Object.defineProperty(ConfigurationService.prototype, "contextSnapshot", {
1188
- get: function () {
1189
- return this.contextService.resolve();
1190
- },
1191
- enumerable: false,
1192
- configurable: true
1193
- });
1194
- Object.defineProperty(ConfigurationService.prototype, "context$", {
1195
- get: function () {
1196
- return this.contextService.resolve$();
1197
- },
1198
- enumerable: false,
1199
- configurable: true
1200
- });
1201
- Object.defineProperty(ConfigurationService.prototype, "charges$", {
1202
- get: function () {
1203
- return this.charges.asObservable();
1204
- },
1205
- enumerable: false,
1206
- configurable: true
1207
- });
1208
- Object.defineProperty(ConfigurationService.prototype, "chargesSnapshot", {
1209
- get: function () {
1210
- return this.charges.value;
1211
- },
1212
- enumerable: false,
1213
- configurable: true
1214
- });
1215
- Object.defineProperty(ConfigurationService.prototype, "pricePlans$", {
1216
- get: function () {
1217
- return this.pricePlans.asObservable();
1218
- },
1219
- enumerable: false,
1220
- configurable: true
1221
- });
1222
- Object.defineProperty(ConfigurationService.prototype, "pricePlansSnapshot", {
1223
- get: function () {
1224
- return this.pricePlans.value;
1225
- },
1226
- enumerable: false,
1227
- configurable: true
1228
- });
1229
- ConfigurationService.prototype.configure = function () {
1230
- var _this = this;
1231
- var _a, _b, _c, _d, _e, _f;
1232
- var runtimeContext = this.getRuntimeContext();
1233
- var runtimeModel = this.getRuntimeModel();
1234
- if (!runtimeContext || !runtimeModel) {
1235
- return rxjs.throwError(function () { return new Error('Runtime context/model not initialized'); });
1236
- }
1237
- var uiDefinitionProperties = Object.assign(Object.assign({}, ((_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
1238
- var qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
1239
- var lineItem = (_e = this.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
1240
- var configurationRequest = this.createRequest(lineItem);
1241
- var mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
1242
- var pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
1243
- return this.configurationApiService
1244
- .configureLineItem({ configurationRequest: configurationRequest, runtimeModel: runtimeModel, pricingEnabled: pricingEnabled })
1245
- .pipe(operators.map(function (_g) {
1246
- var lineItem = _g.lineItem, context = _g.context, charges = _g.charges, pricePlans = _g.pricePlans, deletedLineItems = _g.deletedLineItems;
1247
- _this.contextService.update(context !== null && context !== void 0 ? context : {});
1248
- _this.charges.next(charges !== null && charges !== void 0 ? charges : {});
1249
- _this.pricePlans.next(pricePlans !== null && pricePlans !== void 0 ? pricePlans : {});
1250
- if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
1251
- _this.showInactiveProductsConfirmation();
1252
- }
1253
- return lineItem;
1254
- }))
1255
- .pipe(operators.tap(function (lineItem) { return lineItem && _this.lineItem.next(lineItem); }), operators.catchError(function (error) { return rxjs.throwError(function () { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); }); }));
1256
- };
1257
- ConfigurationService.prototype.configureExternal$ = function (productId, qty) {
1258
- var _this = this;
1259
- return this.runtimeService.init({ productId: productId, defaultQty: qty }).pipe(operators.switchMap(function () { return _this.configure(); }), operators.first(), operators.catchError(function (error) {
1260
- _this.messageService.add({ severity: components.ToastType.error, summary: error });
1261
- throw error;
1262
- }), operators.finalize(function () { return _this.reset(); }));
1263
- };
1264
- ConfigurationService.prototype.createRequest = function (lineItem) {
1265
- var _a;
1266
- var request = {
1267
- lineItem: lineItem,
1268
- mode: this.mode,
1269
- step: !this.lineItem.value ? exports.RuntimeStep.START : exports.RuntimeStep.UPDATE,
1270
- attributeDomainMode: 'ALL',
1271
- context: this.contextService.resolve(),
1272
- lineItems: ((_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) || [],
1273
- asset: this.getAsset(),
1274
- };
1275
- request = core.ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
1276
- return request;
1277
- };
1278
- ConfigurationService.prototype.showInactiveProductsConfirmation = function () {
1279
- var _this = this;
1280
- var confirmationConfig = {
1281
- title: ' ',
1282
- description: 'This quote contains inactive products. Do you want to remove them?',
1283
- primaryButtonLabel: 'Remove products',
1284
- secondaryButtonLabel: 'Back to Quote',
1285
- };
1286
- this.dialogService
1287
- .open(components.ConfirmationComponent, {
1288
- dismissableMask: false,
1289
- closeOnEscape: false,
1290
- closable: false,
1291
- showHeader: true,
1292
- header: "Inactive Products in Quote",
1293
- width: '440px',
1294
- data: { confirmationConfig: confirmationConfig },
1295
- })
1296
- .onClose.subscribe(function (result) {
1297
- if (!result) {
1298
- var context = _this.contextService.resolve();
1299
- window['VELO_BACK_FN'].apply(null, [context.headerId]);
1300
- }
1301
- });
1302
- };
1303
- ConfigurationService.prototype.getAsset = function () {
1304
- var _a;
1305
- var lineItem = this.configurableRamp;
1306
- if (!lineItem) {
1307
- return;
1308
- }
1309
- return (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
1310
- };
1311
- return ConfigurationService;
1312
- }());
1313
- ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i5__namespace.MessageService }, { token: i6__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1314
- ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService });
1315
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
1316
- type: i0.Injectable
1317
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i5__namespace.MessageService }, { type: i6__namespace.DialogService }]; } });
1318
-
1319
- function extractMetadata(uiDefinition) {
1320
- return lodash.omit(uiDefinition, [
1321
- 'children',
1322
- 'pages',
1323
- 'components',
1324
- ]);
1325
- }
1326
-
1327
- var FlowUpdateService = /** @class */ (function () {
1328
- function FlowUpdateService() {
1329
- }
1330
- FlowUpdateService.prototype.update = function (rootLineItems, updates, charges) {
1331
- var _this = this;
1332
- var remainingUpdates = __spreadArray([], __read(updates));
1333
- var currentLevel = rootLineItems;
1334
- while (currentLevel.length && remainingUpdates.length) {
1335
- currentLevel.forEach(function (li) {
1336
- var unhandledUpdates = [];
1337
- remainingUpdates.forEach(function (update) {
1338
- var updated = false;
1339
- switch (update.dataType) {
1340
- case 'LINEITEM':
1341
- updated = _this.applyLineItemUpdate(li, update, charges);
1342
- break;
1343
- case 'CHARGE':
1344
- updated = _this.applyChargeUpdate(li, update);
1345
- break;
1346
- case 'GROUP_CHARGE':
1347
- updated = _this.applyChargeGroupUpdate(li, update);
1348
- break;
1349
- default:
1350
- // Unknown dataType. Do not try to handle it anymore
1351
- updated = true;
1352
- }
1353
- if (!updated) {
1354
- unhandledUpdates.push(update);
1355
- }
1356
- });
1357
- remainingUpdates = unhandledUpdates;
1358
- });
1359
- currentLevel = lodash.flatten(currentLevel.map(function (parent) { return parent.lineItems; }));
1360
- }
1361
- };
1362
- FlowUpdateService.prototype.delete = function (lineItems, id) {
1363
- var idsToRemove = [id];
1364
- var topLevelLineItem = lineItems.find(function (li) { return li.id === id; });
1365
- if (topLevelLineItem) {
1366
- // find term-related line items (which are only top level)
1367
- // expired term line items won't be deleted
1368
- var foundTermLineItem_1 = topLevelLineItem;
1369
- while (foundTermLineItem_1) {
1370
- foundTermLineItem_1 = lineItems.find(function (li) { return foundTermLineItem_1 && li.rampInstanceId === foundTermLineItem_1.id; });
1371
- if (foundTermLineItem_1) {
1372
- idsToRemove.push(foundTermLineItem_1.id);
1373
- }
1374
- }
1375
- }
1376
- var filtered = lineItems.filter(function (lineItem) { return !idsToRemove.includes(lineItem.id); });
1377
- return filtered.map(function (lineItem) { return new LineItemWorker(lineItem).remove(id).li; });
1378
- };
1379
- FlowUpdateService.prototype.applyLineItemUpdate = function (lineItem, update, charges) {
1380
- if (lineItem.id !== update.id) {
1381
- return false;
1382
- }
1383
- switch (update.attributeType) {
1384
- case 'QTY':
1385
- lineItem.qty = update.newValue;
1386
- break;
1387
- case 'EFFECTIVE_START_DATE':
1388
- lineItem.properties.StartDate = moment__default["default"](update.newValue).format('YYYY-MM-DD');
1389
- break;
1390
- case 'END_DATE':
1391
- lineItem.properties.EndDate = moment__default["default"](update.newValue).format('YYYY-MM-DD');
1392
- break;
1393
- case 'PRICE_ADJUSTMENT':
1394
- {
1395
- var charge = lineItem.chargeItems.find(function (charge) { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
1396
- if (charge) {
1397
- charge.priceAdjustment = update.newValue;
1398
- }
1399
- }
1400
- break;
1401
- case 'LIST_PRICE_ADJUSTMENT':
1402
- {
1403
- var charge = lineItem.chargeItems.find(function (charge) { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
1404
- if (charge) {
1405
- charge.listPriceAdjustment = update.newValue;
1406
- }
1407
- }
1408
- break;
1409
- default:
1410
- throw new Error("Not suppored AttributeType for LineItem update: " + update.attributeType);
1411
- }
1412
- return true;
1413
- };
1414
- FlowUpdateService.prototype.applyChargeUpdate = function (lineItem, update) {
1415
- var foundCharge = lineItem.chargeItems.find(function (_b) {
1416
- var id = _b.id;
1417
- return id === update.id;
1418
- });
1419
- if (!foundCharge) {
1420
- return false;
1421
- }
1422
- if (update.attributeType === 'PRICE_ADJUSTMENT') {
1423
- foundCharge.priceAdjustment = update.newValue;
1424
- }
1425
- else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
1426
- foundCharge.listPriceAdjustment = update.newValue;
1427
- }
1428
- else {
1429
- throw new Error("Not suppored AttributeType for Charge Item update: " + update.attributeType);
1430
- }
1431
- return true;
1432
- };
1433
- FlowUpdateService.prototype.applyChargeGroupUpdate = function (lineItem, update) {
1434
- var foundChargeGroup = core.ChargeGroupUtils.findChargeGroupById(update.id, lineItem);
1435
- if (!foundChargeGroup) {
1436
- return false;
1437
- }
1438
- if (update.attributeType === 'PRICE_ADJUSTMENT') {
1439
- foundChargeGroup.priceAdjustment = update.newValue;
1440
- }
1441
- else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
1442
- foundChargeGroup.listPriceAdjustment = update.newValue;
1443
- }
1444
- else {
1445
- throw new Error("Not suppored AttributeType for Charge Group Item update: " + update.attributeType);
1446
- }
1447
- return true;
1448
- };
1449
- return FlowUpdateService;
1450
- }());
1451
- FlowUpdateService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1452
- FlowUpdateService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService });
1453
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService, decorators: [{
1454
- type: i0.Injectable
1455
- }] });
1456
-
1457
- var FlowConfigurationService = /** @class */ (function () {
1458
- function FlowConfigurationService(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
1459
- this.proceduresApiService = proceduresApiService;
1460
- this.contextService = contextService;
1461
- this.quoteDraftService = quoteDraftService;
1462
- this.updateService = updateService;
1463
- this.configurationService = configurationService;
1464
- }
1465
- FlowConfigurationService.prototype.calculate$ = function (quoteDraft) {
1466
- var _this = this;
1467
- return this.proceduresApiService.apply$(quoteDraft).pipe(rxjs.tap(function (result) {
1468
- // sort the result current state based on the quote draft initial state
1469
- var initialStateIds = quoteDraft.initialState.map(function (lineItem) { return lineItem.integrationId; });
1470
- result.currentState = result.currentState
1471
- .slice()
1472
- .sort(function (a, b) { return initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId); });
1473
- _this.quoteDraftService.updateQuoteDraft(result);
1474
- }), rxjs.map(rxjs.noop));
1475
- };
1476
- FlowConfigurationService.prototype.calculate = function (quoteDraft) {
1477
- this.calculate$(quoteDraft).subscribe();
1478
- };
1479
- FlowConfigurationService.prototype.update$ = function (updates) {
1480
- var _this = this;
1481
- var quoteDraft = this.quoteDraftService.quoteDraft;
1482
- if (!quoteDraft) {
1483
- return rxjs.of(null);
1484
- }
1485
- return rxjs.of([]).pipe(rxjs.map(function () {
1486
- var updatedState = lodash.cloneDeep(quoteDraft.currentState);
1487
- _this.updateService.update(updatedState, updates, quoteDraft.charges);
1488
- return updatedState;
1489
- }), rxjs.switchMap(function (updatedState) { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
1490
- };
1491
- FlowConfigurationService.prototype.update = function (updates) {
1492
- this.update$(updates).subscribe();
1493
- };
1494
- FlowConfigurationService.prototype.revert$ = function (lineItemId) {
1495
- var _this = this;
1496
- var quoteDraft = this.quoteDraftService.quoteDraft;
1497
- var initialCurrentState = this.quoteDraftService.getInitialCurrentState();
1498
- var currentState = this.quoteDraftService.activeCurrentState;
1499
- var currentLineItemIndex = currentState.findIndex(function (_c) {
1500
- var id = _c.id;
1501
- return id === lineItemId;
1502
- });
1503
- var currentLineItem = currentState[currentLineItemIndex];
1504
- var initialLineItem = initialCurrentState.find(function (_c) {
1505
- var integrationId = _c.integrationId;
1506
- return integrationId === (currentLineItem === null || currentLineItem === void 0 ? void 0 : currentLineItem.integrationId);
1507
- });
1508
- if (!quoteDraft || !currentLineItem || !initialLineItem) {
1509
- return rxjs.of(null);
1510
- }
1511
- var updatedState = lodash.cloneDeep(currentState);
1512
- updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1513
- return rxjs.of([]).pipe(rxjs.tap(function () {
1514
- _this.quoteDraftService.setCurrentLineItemState(updatedState);
1515
- }), rxjs.switchMap(function () { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
1516
- };
1517
- FlowConfigurationService.prototype.revert = function (lineItemId) {
1518
- this.revert$(lineItemId).subscribe();
1519
- };
1520
- FlowConfigurationService.prototype.delete$ = function (ids) {
1521
- var _this = this;
1522
- var quoteDraft = this.quoteDraftService.quoteDraft;
1523
- var currentState = this.quoteDraftService.currentState;
1524
- if (!quoteDraft) {
1525
- return rxjs.of(null);
1526
- }
1527
- return rxjs.of([]).pipe(rxjs.map(function () { return ids.reduce(function (result, id) { return _this.updateService.delete(result, id); }, currentState); }), rxjs.switchMap(function (updatedState) { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
1528
- };
1529
- FlowConfigurationService.prototype.delete = function (ids) {
1530
- this.delete$(ids).subscribe();
1531
- };
1532
- FlowConfigurationService.prototype.addTerm$ = function (term) {
1533
- var _this = this;
1534
- var quoteDraft = this.quoteDraftService.quoteDraft;
1535
- if (!quoteDraft) {
1536
- return rxjs.of(null);
1537
- }
1538
- var updatedState = __spreadArray(__spreadArray([], __read(quoteDraft.currentState)), [term]);
1539
- return rxjs.of([]).pipe(rxjs.switchMap(function () { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
1540
- };
1541
- FlowConfigurationService.prototype.addToCart$ = function (productId, qty) {
1542
- var _this = this;
1543
- var quoteDraft = this.quoteDraftService.quoteDraft;
1544
- if (!quoteDraft) {
1545
- return rxjs.of(null);
1546
- }
1547
- return this.configurationService.configureExternal$(productId, qty).pipe(rxjs.map(function (lineItem) {
1548
- var _a, _b;
1549
- var model = _this.configurationService.getRuntimeModel();
1550
- var split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(function (type) { return type.name === lineItem.type; })) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
1551
- var lineItems = multiplyLineItems(lineItem, qty !== null && qty !== void 0 ? qty : 1, split);
1552
- return __spreadArray(__spreadArray([], __read(quoteDraft.currentState)), __read(lineItems));
1553
- }), rxjs.switchMap(function (updatedState) { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
1554
- };
1555
- FlowConfigurationService.prototype.get = function () {
1556
- var _this = this;
1557
- return this.quoteDraftService.quoteDraft$.pipe(rxjs.map(function () { return _this.quoteDraftService.activeCurrentState; }), rxjs.shareReplay());
1558
- };
1559
- FlowConfigurationService.prototype.getSnapshot = function () {
1560
- var _a, _b;
1561
- return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
1562
- };
1563
- Object.defineProperty(FlowConfigurationService.prototype, "charges$", {
1564
- get: function () {
1565
- return this.quoteDraftService.quoteDraft$.pipe(rxjs.map(function (_c) {
1566
- var charges = _c.charges;
1567
- return charges;
1568
- }));
1569
- },
1570
- enumerable: false,
1571
- configurable: true
1572
- });
1573
- Object.defineProperty(FlowConfigurationService.prototype, "pricePlans$", {
1574
- get: function () {
1575
- return this.quoteDraftService.quoteDraft$.pipe(rxjs.map(function (_c) {
1576
- var pricePlans = _c.pricePlans;
1577
- return pricePlans;
1578
- }));
1579
- },
1580
- enumerable: false,
1581
- configurable: true
1582
- });
1583
- Object.defineProperty(FlowConfigurationService.prototype, "activeMetrics$", {
1584
- get: function () {
1585
- return this.quoteDraftService.quoteDraft$.pipe(rxjs.map(function (_c) {
1586
- var activeMetrics = _c.activeMetrics;
1587
- return activeMetrics;
1588
- }));
1589
- },
1590
- enumerable: false,
1591
- configurable: true
1592
- });
1593
- Object.defineProperty(FlowConfigurationService.prototype, "chargesSnapshot", {
1594
- get: function () {
1595
- var _a, _b;
1596
- return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
1597
- },
1598
- enumerable: false,
1599
- configurable: true
1600
- });
1601
- Object.defineProperty(FlowConfigurationService.prototype, "pricePlansSnapshot", {
1602
- get: function () {
1603
- var _a, _b;
1604
- return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
1605
- },
1606
- enumerable: false,
1607
- configurable: true
1608
- });
1609
- Object.defineProperty(FlowConfigurationService.prototype, "activeMetricsSnapshot", {
1610
- get: function () {
1611
- var _a, _b;
1612
- return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.activeMetrics) !== null && _b !== void 0 ? _b : [];
1613
- },
1614
- enumerable: false,
1615
- configurable: true
1616
- });
1617
- Object.defineProperty(FlowConfigurationService.prototype, "contextSnapshot", {
1618
- get: function () {
1619
- return this.contextService.resolve();
1620
- },
1621
- enumerable: false,
1622
- configurable: true
1623
- });
1624
- Object.defineProperty(FlowConfigurationService.prototype, "context$", {
1625
- get: function () {
1626
- return this.contextService.resolve$();
1627
- },
1628
- enumerable: false,
1629
- configurable: true
1630
- });
1631
- FlowConfigurationService.prototype.handleErrorAndBounceBack = function () {
1632
- var _this = this;
1633
- return function (source$) {
1634
- return source$.pipe(rxjs.catchError(function (error) {
1635
- console.error(error);
1636
- // bounce back if configuration call has failed
1637
- var quoteDraft = _this.quoteDraftService.quoteDraft;
1638
- if (quoteDraft) {
1639
- _this.quoteDraftService.updateQuoteDraft(quoteDraft);
1640
- }
1641
- return rxjs.throwError(function () { return error; });
1642
- }));
1643
- };
1644
- };
1645
- return FlowConfigurationService;
1646
- }());
1647
- FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1648
- FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService });
1649
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
1650
- type: i0.Injectable
1651
- }], ctorParameters: function () { return [{ type: i1__namespace.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1652
-
1653
- var FlowConfigurationModule = /** @class */ (function () {
1654
- function FlowConfigurationModule() {
1655
- }
1656
- return FlowConfigurationModule;
1657
- }());
1658
- FlowConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1659
- FlowConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule });
1660
- FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, i1.PriceApiService], imports: [[]] });
1661
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, decorators: [{
1662
- type: i0.NgModule,
1663
- args: [{
1664
- imports: [],
1665
- providers: [FlowConfigurationService, FlowUpdateService, i1.PriceApiService],
1666
- }]
1667
- }] });
1668
-
1669
- var ConfigurationModule = /** @class */ (function () {
1670
- function ConfigurationModule() {
1671
- }
1672
- return ConfigurationModule;
1673
- }());
1674
- ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1675
- ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, imports: [components.ConfirmationDialogModule] });
1676
- ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, providers: [
1677
- i1.ContextApiService,
1678
- i1.ProductModelApiService,
1679
- i1.ConfigurationApiService,
1680
- ConfigurationRuntimeService,
1681
- RuntimeContextService,
1682
- ConfigurationService,
1683
- ], imports: [[components.ConfirmationDialogModule]] });
1684
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, decorators: [{
1685
- type: i0.NgModule,
1686
- args: [{
1687
- imports: [components.ConfirmationDialogModule],
1688
- providers: [
1689
- i1.ContextApiService,
1690
- i1.ProductModelApiService,
1691
- i1.ConfigurationApiService,
1692
- ConfigurationRuntimeService,
1693
- RuntimeContextService,
1694
- ConfigurationService,
1695
- ],
1696
- }]
1697
- }] });
1698
-
1699
- function calculateMetricByMethod(lineItems, metric, method) {
1700
- var items = getLineItemsByMethod(lineItems, method);
1701
- return items.reduce(function (acc, li) {
1702
- var value = li.reduce(function (accProduct, item) { return accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0); }, 0);
1703
- if (method === 'avg' && li.length > 0) {
1704
- value /= li.length;
1705
- }
1706
- return acc + value;
1707
- }, 0);
1708
- }
1709
- function getLineItemsByMethod(lineItems, method) {
1710
- switch (method) {
1711
- case 'first': {
1712
- return lineItems.filter(function (li) { return !li.rampInstanceId; }).map(function (item) { return [item]; });
1713
- }
1714
- case 'last': {
1715
- var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
1716
- var products = rootTermItems.map(function (lineItem) { return __spreadArray([
1717
- lineItem
1718
- ], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
1719
- return products
1720
- .map(function (items) { return __spreadArray([], __read(items)).sort(function (a, b) { return getDateValue(a.endDate || '') - getDateValue(b.endDate || ''); }).pop(); })
1721
- .filter(function (li) { return Boolean(li); })
1722
- .map(function (item) { return [item]; });
1723
- }
1724
- case 'avg': {
1725
- var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
1726
- return rootTermItems.map(function (lineItem) { return __spreadArray([lineItem], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
1727
- }
1728
- case 'sum': {
1729
- return lineItems.map(function (item) { return [item]; });
1730
- }
1731
- default: {
1732
- return lineItems.map(function (item) { return [item]; });
1733
- }
1734
- }
1735
- }
1736
- function getDateValue(date) {
1737
- return date ? new Date(date).getTime() : 0;
1738
- }
1739
-
1740
- var MetricsCalculationService = /** @class */ (function () {
1741
- function MetricsCalculationService(quoteDraftService, flowConfiguration, settingsService) {
1742
- var _this = this;
1743
- this.quoteDraftService = quoteDraftService;
1744
- this.flowConfiguration = flowConfiguration;
1745
- this.settingsService = settingsService;
1746
- this.metricsUpdated$ = new rxjs.Subject();
1747
- this.quoteMetricsSettings = {};
1748
- this.metricsCalculationMethodMap = {};
1749
- this.metricsData = {};
1750
- this.activeMetricRules = [];
1751
- this.activeMetricRules = this.flowConfiguration.activeMetricsSnapshot.filter(function (metricRule) { return metricRule.metrics.some(function (metric) { return !!metric.totalName; }); });
1752
- rxjs.combineLatest([
1753
- this.quoteDraftService.currentState$,
1754
- this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(rxjs.take(1)),
1755
- ]).subscribe(function (_c) {
1756
- var _d = __read(_c, 2), lineItems = _d[0], setting = _d[1];
1757
- var settingsData = {};
1758
- try {
1759
- settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
1760
- }
1761
- catch (error) {
1762
- settingsData = {};
1763
- }
1764
- _this.quoteMetricsSettings = settingsData;
1765
- _this.updateMetrics(lineItems);
1766
- });
1767
- }
1768
- Object.defineProperty(MetricsCalculationService.prototype, "onMetricsUpdate$", {
1769
- get: function () {
1770
- return this.metricsUpdated$.asObservable();
1771
- },
1772
- enumerable: false,
1773
- configurable: true
1774
- });
1775
- MetricsCalculationService.prototype.getMetricValue = function (metric) {
1776
- return this.metricsData[metric] || 0;
1777
- };
1778
- MetricsCalculationService.prototype.updateMetrics = function (lineItems) {
1779
- var _this = this;
1780
- var metricKeys = this.collectMetricKeys(lineItems).filter(function (key) { return !key.includes('Effective_'); });
1781
- this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
1782
- this.metricsData = metricKeys.reduce(function (acc, key) {
1783
- var _c;
1784
- return (Object.assign(Object.assign({}, acc), (_c = {}, _c[key] = _this.calculateMetric(lineItems, key), _c)));
1785
- }, {});
1786
- this.metricsUpdated$.next();
1787
- };
1788
- MetricsCalculationService.prototype.calculateMetric = function (lineItems, metric) {
1789
- return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
1790
- };
1791
- MetricsCalculationService.prototype.buildMetricsCalculationMethods = function (metricKeys, initial) {
1792
- var _this = this;
1793
- return metricKeys.reduce(function (acc, name) {
1794
- var _c, _d;
1795
- var _a, _b;
1796
- if (acc[name]) {
1797
- return acc;
1798
- }
1799
- acc = Object.assign(Object.assign({}, acc), (_c = {}, _c[name] = 'sum', _c));
1800
- var metricRule = _this.getMetricRuleByTotalMetricName(name);
1801
- var settingKey = ((_b = (_a = metricRule === null || metricRule === void 0 ? void 0 : metricRule.metrics) === null || _a === void 0 ? void 0 : _a.find(function (metric) { return metric.totalName === name; })) === null || _b === void 0 ? void 0 : _b.name) || name;
1802
- if (_this.quoteMetricsSettings[settingKey]) {
1803
- acc = Object.assign(Object.assign({}, acc), (_d = {}, _d[name] = _this.quoteMetricsSettings[settingKey], _d));
1804
- }
1805
- return acc;
1806
- }, initial);
1807
- };
1808
- MetricsCalculationService.prototype.collectMetricKeys = function (lineItems) {
1809
- var _this = this;
1810
- var keys = [];
1811
- lineItems.forEach(function (lineItem) {
1812
- keys.push.apply(keys, __spreadArray([], __read(Object.keys(lineItem.totalMetrics || {}))));
1813
- keys.push.apply(keys, __spreadArray([], __read(_this.collectMetricKeys(lineItem.lineItems))));
1814
- });
1815
- return lodash.uniq(keys);
1816
- };
1817
- MetricsCalculationService.prototype.getMetricRuleByTotalMetricName = function (name) {
1818
- return this.activeMetricRules.find(function (metricRule) { return metricRule.metrics.find(function (metric) { return metric.totalName === name; }); });
1819
- };
1820
- return MetricsCalculationService;
1821
- }());
1822
- MetricsCalculationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1__namespace.ConfigurationSettingsApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1823
- MetricsCalculationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, providedIn: 'root' });
1824
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, decorators: [{
1825
- type: i0.Injectable,
1826
- args: [{ providedIn: 'root' }]
1827
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1__namespace.ConfigurationSettingsApiService }]; } });
1828
-
1829
- var ProductImagesService = /** @class */ (function () {
1830
- function ProductImagesService(productApiService) {
1831
- this.productApiService = productApiService;
1832
- this.imagesMap$ = new rxjs.BehaviorSubject({});
1833
- }
1834
- ProductImagesService.prototype.getImageUrl$ = function (productId) {
1835
- var _a;
1836
- if (this.imagesMap$.value[productId] == null) {
1837
- this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), (_a = {}, _a[productId] = '', _a)));
1838
- this.fetchProductImage(productId);
1839
- }
1840
- return this.imagesMap$.pipe(rxjs.map(function (imagesMap) { return imagesMap[productId]; }), rxjs.distinctUntilChanged());
1841
- };
1842
- ProductImagesService.prototype.fetchProductImage = function (productId) {
1843
- var _this = this;
1844
- this.productApiService
1845
- .fetchImage$(productId)
1846
- .pipe(rxjs.map(function (file) { return URL.createObjectURL(file); }), rxjs.catchError(function () { return rxjs.of(''); }), rxjs.tap(function (url) {
1847
- var _a;
1848
- return _this.imagesMap$.next(Object.assign(Object.assign({}, _this.imagesMap$.value), (_a = {}, _a[productId] = url, _a)));
1849
- }))
1850
- .subscribe();
1851
- };
1852
- return ProductImagesService;
1853
- }());
1854
- ProductImagesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, deps: [{ token: i1__namespace.ProductApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1855
- ProductImagesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, providedIn: 'root' });
1856
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, decorators: [{
1857
- type: i0.Injectable,
1858
- args: [{ providedIn: 'root' }]
1859
- }], ctorParameters: function () { return [{ type: i1__namespace.ProductApiService }]; } });
1860
-
1861
- var SdkCoreModule = /** @class */ (function () {
1862
- function SdkCoreModule() {
1863
- }
1864
- return SdkCoreModule;
1865
- }());
1866
- SdkCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1867
- SdkCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1868
- SdkCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
1869
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, decorators: [{
1870
- type: i0.NgModule,
1871
- args: [{
1872
- imports: [ConfigurationModule, FlowConfigurationModule],
1873
- providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService],
1874
- }]
1875
- }] });
1876
-
1877
- /**
1878
- * Generated bundle index. Do not edit.
1879
- */
1880
-
1881
- exports.ConfigurationRuntimeService = ConfigurationRuntimeService;
1882
- exports.ConfigurationService = ConfigurationService;
1883
- exports.ContextService = ContextService;
1884
- exports.FlowConfigurationModule = FlowConfigurationModule;
1885
- exports.FlowConfigurationService = FlowConfigurationService;
1886
- exports.FlowUpdateService = FlowUpdateService;
1887
- exports.LineItemWorker = LineItemWorker;
1888
- exports.MetricsCalculationService = MetricsCalculationService;
1889
- exports.ProductImagesService = ProductImagesService;
1890
- exports.QuoteDraftService = QuoteDraftService;
1891
- exports.SdkCoreModule = SdkCoreModule;
1892
- exports.UI_DEFINITION_VERSION = UI_DEFINITION_VERSION;
1893
- exports.calculateCardinalityVariables = calculateCardinalityVariables;
1894
- exports.extractMetadata = extractMetadata;
1895
- exports.findLineItem = findLineItem;
1896
- exports.findLineItemWithComparator = findLineItemWithComparator;
1897
- exports.generateLineItem = generateLineItem;
1898
- exports.generateModifiedAssetsMap = generateModifiedAssetsMap;
1899
- exports.getAttributeValue = getAttributeValue;
1900
- exports.getAttributes = getAttributes;
1901
- exports.getDefaultLineItem = getDefaultLineItem;
1902
- exports.getRecommendedPrices = getRecommendedPrices;
1903
- exports.insertLineItem = insertLineItem;
1904
- exports.lineItemUtils = lineItem_utils;
1905
- exports.mapAttributes = mapAttributes;
1906
- exports.multiplyLineItems = multiplyLineItems;
1907
- exports.patchAttributes = patchAttributes;
1908
- exports.recalculateCardinalityVariables = recalculateCardinalityVariables;
1909
- exports.removeLineItem = removeLineItem;
1910
- exports.replaceLineItem = replaceLineItem;
1911
- exports.upsertAttributes = upsertAttributes;
1912
-
1913
- Object.defineProperty(exports, '__esModule', { value: true });
1914
-
1915
- }));
1916
- //# sourceMappingURL=veloceapps-sdk-core.umd.js.map