@veloceapps/sdk 0.0.0-watch

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/README.md +7 -0
  2. package/cms/cms.actions.d.ts +12 -0
  3. package/cms/cms.default.d.ts +5 -0
  4. package/cms/cms.elements.d.ts +4 -0
  5. package/cms/components/element-children/element-children.component.d.ts +10 -0
  6. package/cms/components/element-children/element-children.module.d.ts +8 -0
  7. package/cms/components/element-renderer/element-renderer.component.d.ts +35 -0
  8. package/cms/components/element-renderer/element-renderer.module.d.ts +7 -0
  9. package/cms/components/element.component.d.ts +13 -0
  10. package/cms/components/index.d.ts +1 -0
  11. package/cms/components/plugin.component.d.ts +15 -0
  12. package/cms/components/preview/index.d.ts +2 -0
  13. package/cms/components/preview/preview.component.d.ts +34 -0
  14. package/cms/components/preview/preview.module.d.ts +11 -0
  15. package/cms/decorators/element.decorator.d.ts +2 -0
  16. package/cms/decorators/index.d.ts +1 -0
  17. package/cms/directives/custom-template.directive.d.ts +12 -0
  18. package/cms/engine/models/entity.d.ts +11 -0
  19. package/cms/engine/models/plugin.d.ts +5 -0
  20. package/cms/index.d.ts +11 -0
  21. package/cms/injection-tokens.d.ts +11 -0
  22. package/cms/launcher.module.d.ts +10 -0
  23. package/cms/modules/federated/default-options.d.ts +4 -0
  24. package/cms/modules/federated/export.d.ts +1 -0
  25. package/cms/modules/federated/federated.component.d.ts +26 -0
  26. package/cms/modules/federated/federated.module.d.ts +9 -0
  27. package/cms/modules/federated/federated.types.d.ts +30 -0
  28. package/cms/modules/federated/federated.utils.d.ts +1 -0
  29. package/cms/package.json +10 -0
  30. package/cms/plugins/configuration.plugin.d.ts +23 -0
  31. package/cms/plugins/io.plugin.d.ts +9 -0
  32. package/cms/plugins/script.plugin.d.ts +13 -0
  33. package/cms/services/dynamic-module.service.d.ts +15 -0
  34. package/cms/services/element-context.service.d.ts +8 -0
  35. package/cms/services/index.d.ts +3 -0
  36. package/cms/services/integration.state.d.ts +17 -0
  37. package/cms/services/io-provider.service.d.ts +15 -0
  38. package/cms/services/launcher.service.d.ts +18 -0
  39. package/cms/services/templates.service.d.ts +9 -0
  40. package/cms/types/common.types.d.ts +103 -0
  41. package/cms/types/configuration.types.d.ts +17 -0
  42. package/cms/types/elements.types.d.ts +2 -0
  43. package/cms/types/index.d.ts +5 -0
  44. package/cms/types/integration.types.d.ts +4 -0
  45. package/cms/types/path.types.d.ts +11 -0
  46. package/cms/utils/element.utils.d.ts +15 -0
  47. package/cms/utils/elements-resolver.d.ts +20 -0
  48. package/cms/utils/index.d.ts +3 -0
  49. package/cms/utils/path.utils.d.ts +5 -0
  50. package/cms/veloce-sdk-cms.d.ts +5 -0
  51. package/cms/vendor-map.d.ts +689 -0
  52. package/core/core.module.d.ts +8 -0
  53. package/core/index.d.ts +6 -0
  54. package/core/modules/configuration/configuration.module.d.ts +7 -0
  55. package/core/modules/configuration/helpers.d.ts +3 -0
  56. package/core/modules/configuration/index.d.ts +4 -0
  57. package/core/modules/configuration/services/configuration-runtime.service.d.ts +28 -0
  58. package/core/modules/configuration/services/configuration.service.d.ts +40 -0
  59. package/core/modules/configuration/services/runtime-context.service.d.ts +14 -0
  60. package/core/modules/configuration/types/configuration-runtime.types.d.ts +6 -0
  61. package/core/modules/flow-configuration/flow-configuration.module.d.ts +6 -0
  62. package/core/modules/flow-configuration/index.d.ts +4 -0
  63. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +37 -0
  64. package/core/modules/flow-configuration/services/flow-update.service.d.ts +12 -0
  65. package/core/modules/flow-configuration/types/update.types.d.ts +12 -0
  66. package/core/modules/index.d.ts +2 -0
  67. package/core/package.json +10 -0
  68. package/core/services/context.service.d.ts +17 -0
  69. package/core/services/index.d.ts +3 -0
  70. package/core/services/product-images.service.d.ts +12 -0
  71. package/core/services/quote-draft.service.d.ts +31 -0
  72. package/core/types/index.d.ts +3 -0
  73. package/core/types/quote-states.types.d.ts +6 -0
  74. package/core/types/runtime.types.d.ts +31 -0
  75. package/core/types/ui-definition.types.d.ts +26 -0
  76. package/core/utils/index.d.ts +2 -0
  77. package/core/utils/line-item.utils.d.ts +26 -0
  78. package/core/utils/line-item.worker.d.ts +12 -0
  79. package/core/veloce-sdk-core.d.ts +5 -0
  80. package/esm2015/cms/cms.actions.js +17 -0
  81. package/esm2015/cms/cms.default.js +6 -0
  82. package/esm2015/cms/cms.elements.js +29 -0
  83. package/esm2015/cms/components/element-children/element-children.component.js +23 -0
  84. package/esm2015/cms/components/element-children/element-children.module.js +18 -0
  85. package/esm2015/cms/components/element-renderer/element-renderer.component.js +143 -0
  86. package/esm2015/cms/components/element-renderer/element-renderer.module.js +16 -0
  87. package/esm2015/cms/components/element.component.js +31 -0
  88. package/esm2015/cms/components/index.js +2 -0
  89. package/esm2015/cms/components/plugin.component.js +16 -0
  90. package/esm2015/cms/components/preview/index.js +3 -0
  91. package/esm2015/cms/components/preview/preview.component.js +105 -0
  92. package/esm2015/cms/components/preview/preview.module.js +23 -0
  93. package/esm2015/cms/decorators/element.decorator.js +6 -0
  94. package/esm2015/cms/decorators/index.js +2 -0
  95. package/esm2015/cms/directives/custom-template.directive.js +25 -0
  96. package/esm2015/cms/engine/models/entity.js +18 -0
  97. package/esm2015/cms/engine/models/plugin.js +6 -0
  98. package/esm2015/cms/index.js +11 -0
  99. package/esm2015/cms/injection-tokens.js +8 -0
  100. package/esm2015/cms/launcher.module.js +23 -0
  101. package/esm2015/cms/modules/federated/default-options.js +5 -0
  102. package/esm2015/cms/modules/federated/export.js +2 -0
  103. package/esm2015/cms/modules/federated/federated.component.js +82 -0
  104. package/esm2015/cms/modules/federated/federated.module.js +19 -0
  105. package/esm2015/cms/modules/federated/federated.types.js +2 -0
  106. package/esm2015/cms/modules/federated/federated.utils.js +37 -0
  107. package/esm2015/cms/plugins/configuration.plugin.js +94 -0
  108. package/esm2015/cms/plugins/io.plugin.js +37 -0
  109. package/esm2015/cms/plugins/script.plugin.js +66 -0
  110. package/esm2015/cms/services/dynamic-module.service.js +33 -0
  111. package/esm2015/cms/services/element-context.service.js +10 -0
  112. package/esm2015/cms/services/index.js +4 -0
  113. package/esm2015/cms/services/integration.state.js +40 -0
  114. package/esm2015/cms/services/io-provider.service.js +51 -0
  115. package/esm2015/cms/services/launcher.service.js +57 -0
  116. package/esm2015/cms/services/templates.service.js +19 -0
  117. package/esm2015/cms/types/common.types.js +2 -0
  118. package/esm2015/cms/types/configuration.types.js +2 -0
  119. package/esm2015/cms/types/elements.types.js +2 -0
  120. package/esm2015/cms/types/index.js +6 -0
  121. package/esm2015/cms/types/integration.types.js +2 -0
  122. package/esm2015/cms/types/path.types.js +2 -0
  123. package/esm2015/cms/utils/element.utils.js +149 -0
  124. package/esm2015/cms/utils/elements-resolver.js +108 -0
  125. package/esm2015/cms/utils/index.js +4 -0
  126. package/esm2015/cms/utils/path.utils.js +67 -0
  127. package/esm2015/cms/veloce-sdk-cms.js +5 -0
  128. package/esm2015/cms/vendor-map.js +35 -0
  129. package/esm2015/core/core.module.js +18 -0
  130. package/esm2015/core/index.js +7 -0
  131. package/esm2015/core/modules/configuration/configuration.module.js +34 -0
  132. package/esm2015/core/modules/configuration/helpers.js +10 -0
  133. package/esm2015/core/modules/configuration/index.js +5 -0
  134. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +90 -0
  135. package/esm2015/core/modules/configuration/services/configuration.service.js +153 -0
  136. package/esm2015/core/modules/configuration/services/runtime-context.service.js +61 -0
  137. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +2 -0
  138. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +18 -0
  139. package/esm2015/core/modules/flow-configuration/index.js +5 -0
  140. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +90 -0
  141. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +114 -0
  142. package/esm2015/core/modules/flow-configuration/types/update.types.js +2 -0
  143. package/esm2015/core/modules/index.js +3 -0
  144. package/esm2015/core/services/context.service.js +44 -0
  145. package/esm2015/core/services/index.js +4 -0
  146. package/esm2015/core/services/product-images.service.js +30 -0
  147. package/esm2015/core/services/quote-draft.service.js +88 -0
  148. package/esm2015/core/types/index.js +4 -0
  149. package/esm2015/core/types/quote-states.types.js +2 -0
  150. package/esm2015/core/types/runtime.types.js +16 -0
  151. package/esm2015/core/types/ui-definition.types.js +2 -0
  152. package/esm2015/core/utils/index.js +3 -0
  153. package/esm2015/core/utils/line-item.utils.js +98 -0
  154. package/esm2015/core/utils/line-item.worker.js +19 -0
  155. package/esm2015/core/veloce-sdk-core.js +5 -0
  156. package/esm2015/index.js +2 -0
  157. package/esm2015/runtime/components/component-preview/component-preview.component.js +125 -0
  158. package/esm2015/runtime/components/index.js +5 -0
  159. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +71 -0
  160. package/esm2015/runtime/components/ui-runtime/runtime.component.js +427 -0
  161. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +109 -0
  162. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +68 -0
  163. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +36 -0
  164. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +72 -0
  165. package/esm2015/runtime/execution/components/federated/federated.component.js +81 -0
  166. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +65 -0
  167. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +136 -0
  168. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +80 -0
  169. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +101 -0
  170. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +150 -0
  171. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +121 -0
  172. package/esm2015/runtime/execution/directives/section-script.directive.js +242 -0
  173. package/esm2015/runtime/execution/directives/sf-query.directive.js +34 -0
  174. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +86 -0
  175. package/esm2015/runtime/execution/directives/velo-port.directive.js +373 -0
  176. package/esm2015/runtime/execution/directives/vl-approval.directive.js +22 -0
  177. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +35 -0
  178. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +59 -0
  179. package/esm2015/runtime/execution/directives/vl-quote.directive.js +41 -0
  180. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +51 -0
  181. package/esm2015/runtime/execution/runtime-execution.module.js +163 -0
  182. package/esm2015/runtime/execution/utils/federated.util.js +37 -0
  183. package/esm2015/runtime/index.js +5 -0
  184. package/esm2015/runtime/runtime.module.js +104 -0
  185. package/esm2015/runtime/services/cart.service.js +28 -0
  186. package/esm2015/runtime/services/collapsible-state.service.js +34 -0
  187. package/esm2015/runtime/services/configuration.service.js +102 -0
  188. package/esm2015/runtime/services/current-state.service.js +17 -0
  189. package/esm2015/runtime/services/form-scope.service.js +30 -0
  190. package/esm2015/runtime/services/index.js +4 -0
  191. package/esm2015/runtime/services/product-model-cache.service.js +30 -0
  192. package/esm2015/runtime/services/runtime-context.service.js +56 -0
  193. package/esm2015/runtime/services/runtime-form.service.js +224 -0
  194. package/esm2015/runtime/services/runtime.service.js +108 -0
  195. package/esm2015/runtime/services/section-helper.service.js +27 -0
  196. package/esm2015/runtime/services/section-scope.service.js +36 -0
  197. package/esm2015/runtime/services/section-store.service.js +22 -0
  198. package/esm2015/runtime/services/section.service.js +124 -0
  199. package/esm2015/runtime/types/bound-data.types.js +7 -0
  200. package/esm2015/runtime/types/index.js +2 -0
  201. package/esm2015/runtime/types/runtime.types.js +2 -0
  202. package/esm2015/runtime/types/script-registry.types.js +51 -0
  203. package/esm2015/runtime/utils/line-item.util.js +273 -0
  204. package/esm2015/runtime/utils/section.utils.js +26 -0
  205. package/esm2015/runtime/utils/sections-binder.helper.js +105 -0
  206. package/esm2015/runtime/veloce-sdk-runtime.js +5 -0
  207. package/esm2015/src/components/dialog/dialog.component.js +30 -0
  208. package/esm2015/src/components/dialog/dialog.module.js +19 -0
  209. package/esm2015/src/components/dialog/dialog.types.js +2 -0
  210. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +116 -0
  211. package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +23 -0
  212. package/esm2015/src/components/header/header.component.js +196 -0
  213. package/esm2015/src/components/header/header.module.js +23 -0
  214. package/esm2015/src/components/header/header.types.js +2 -0
  215. package/esm2015/src/constants.js +2 -0
  216. package/esm2015/src/flow-routing.module.js +97 -0
  217. package/esm2015/src/flow.component.js +35 -0
  218. package/esm2015/src/flow.module.js +52 -0
  219. package/esm2015/src/guards/context.guard.js +75 -0
  220. package/esm2015/src/guards/index.js +2 -0
  221. package/esm2015/src/guards/product-unload.guard.js +43 -0
  222. package/esm2015/src/guards/root.guard.js +41 -0
  223. package/esm2015/src/index.js +7 -0
  224. package/esm2015/src/pages/catalog/catalog.component.js +117 -0
  225. package/esm2015/src/pages/catalog/catalog.module.js +20 -0
  226. package/esm2015/src/pages/debug/debug.component.js +65 -0
  227. package/esm2015/src/pages/debug/debug.module.js +48 -0
  228. package/esm2015/src/pages/legacy-product/legacy-product.component.js +132 -0
  229. package/esm2015/src/pages/legacy-product/legacy-product.module.js +21 -0
  230. package/esm2015/src/pages/product/product.component.js +95 -0
  231. package/esm2015/src/pages/product/product.module.js +20 -0
  232. package/esm2015/src/pages/record-not-found/record-not-found.component.js +29 -0
  233. package/esm2015/src/pages/record-not-found/record-not-found.module.js +20 -0
  234. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +117 -0
  235. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +20 -0
  236. package/esm2015/src/resolvers/flow.resolver.js +58 -0
  237. package/esm2015/src/resolvers/quote.resolver.js +45 -0
  238. package/esm2015/src/services/flow-dialog.service.js +80 -0
  239. package/esm2015/src/services/flow-router.service.js +124 -0
  240. package/esm2015/src/services/flow.service.js +67 -0
  241. package/esm2015/src/services/index.js +2 -0
  242. package/esm2015/src/types/context-route.types.js +2 -0
  243. package/esm2015/src/types/flow-customization.types.js +3 -0
  244. package/esm2015/src/types/index.js +3 -0
  245. package/esm2015/src/types/route.types.js +2 -0
  246. package/esm2015/src/utils/flow.utils.js +12 -0
  247. package/esm2015/src/utils/index.js +2 -0
  248. package/esm2015/veloce-sdk.js +5 -0
  249. package/fesm2015/veloce-sdk-cms.js +1301 -0
  250. package/fesm2015/veloce-sdk-cms.js.map +1 -0
  251. package/fesm2015/veloce-sdk-core.js +837 -0
  252. package/fesm2015/veloce-sdk-core.js.map +1 -0
  253. package/fesm2015/veloce-sdk-runtime.js +3895 -0
  254. package/fesm2015/veloce-sdk-runtime.js.map +1 -0
  255. package/fesm2015/veloce-sdk.js +1635 -0
  256. package/fesm2015/veloce-sdk.js.map +1 -0
  257. package/index.d.ts +1 -0
  258. package/package.json +49 -0
  259. package/runtime/components/component-preview/component-preview.component.d.ts +27 -0
  260. package/runtime/components/index.d.ts +4 -0
  261. package/runtime/components/section-renderer/section-renderer.component.d.ts +25 -0
  262. package/runtime/components/ui-runtime/runtime.component.d.ts +53 -0
  263. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +27 -0
  264. package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +30 -0
  265. package/runtime/execution/components/context-provider/context-provider.component.d.ts +14 -0
  266. package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +25 -0
  267. package/runtime/execution/components/federated/federated.component.d.ts +36 -0
  268. package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +19 -0
  269. package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +35 -0
  270. package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +22 -0
  271. package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +22 -0
  272. package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +28 -0
  273. package/runtime/execution/components/velo-type/velo-type.component.d.ts +31 -0
  274. package/runtime/execution/directives/section-script.directive.d.ts +59 -0
  275. package/runtime/execution/directives/sf-query.directive.d.ts +15 -0
  276. package/runtime/execution/directives/velo-attribute.directive.d.ts +26 -0
  277. package/runtime/execution/directives/velo-port.directive.d.ts +74 -0
  278. package/runtime/execution/directives/vl-approval.directive.d.ts +10 -0
  279. package/runtime/execution/directives/vl-document-attachments.directive.d.ts +15 -0
  280. package/runtime/execution/directives/vl-document-templates.directive.d.ts +33 -0
  281. package/runtime/execution/directives/vl-quote.directive.d.ts +14 -0
  282. package/runtime/execution/directives/vl-ramp.directive.d.ts +15 -0
  283. package/runtime/execution/runtime-execution.module.d.ts +27 -0
  284. package/runtime/execution/utils/federated.util.d.ts +6 -0
  285. package/runtime/index.d.ts +4 -0
  286. package/runtime/package.json +10 -0
  287. package/runtime/runtime.module.d.ts +18 -0
  288. package/runtime/services/cart.service.d.ts +15 -0
  289. package/runtime/services/collapsible-state.service.d.ts +15 -0
  290. package/runtime/services/configuration.service.d.ts +19 -0
  291. package/runtime/services/current-state.service.d.ts +8 -0
  292. package/runtime/services/form-scope.service.d.ts +20 -0
  293. package/runtime/services/index.d.ts +3 -0
  294. package/runtime/services/product-model-cache.service.d.ts +14 -0
  295. package/runtime/services/runtime-context.service.d.ts +16 -0
  296. package/runtime/services/runtime-form.service.d.ts +24 -0
  297. package/runtime/services/runtime.service.d.ts +43 -0
  298. package/runtime/services/section-helper.service.d.ts +8 -0
  299. package/runtime/services/section-scope.service.d.ts +14 -0
  300. package/runtime/services/section-store.service.d.ts +11 -0
  301. package/runtime/services/section.service.d.ts +30 -0
  302. package/runtime/types/bound-data.types.d.ts +13 -0
  303. package/runtime/types/index.d.ts +1 -0
  304. package/runtime/types/runtime.types.d.ts +19 -0
  305. package/runtime/types/script-registry.types.d.ts +13 -0
  306. package/runtime/utils/line-item.util.d.ts +34 -0
  307. package/runtime/utils/section.utils.d.ts +2 -0
  308. package/runtime/utils/sections-binder.helper.d.ts +16 -0
  309. package/runtime/veloce-sdk-runtime.d.ts +5 -0
  310. package/src/components/dialog/dialog.component.d.ts +13 -0
  311. package/src/components/dialog/dialog.module.d.ts +9 -0
  312. package/src/components/dialog/dialog.types.d.ts +6 -0
  313. package/src/components/header/cart-overlay/cart-preview.component.d.ts +31 -0
  314. package/src/components/header/cart-overlay/cart-preview.module.d.ts +13 -0
  315. package/src/components/header/header.component.d.ts +48 -0
  316. package/src/components/header/header.module.d.ts +13 -0
  317. package/src/components/header/header.types.d.ts +19 -0
  318. package/src/constants.d.ts +1 -0
  319. package/src/flow-routing.module.d.ts +11 -0
  320. package/src/flow.component.d.ts +17 -0
  321. package/src/flow.module.d.ts +15 -0
  322. package/src/guards/context.guard.d.ts +18 -0
  323. package/src/guards/index.d.ts +1 -0
  324. package/src/guards/product-unload.guard.d.ts +16 -0
  325. package/src/guards/root.guard.d.ts +15 -0
  326. package/src/index.d.ts +6 -0
  327. package/src/pages/catalog/catalog.component.d.ts +32 -0
  328. package/src/pages/catalog/catalog.module.d.ts +10 -0
  329. package/src/pages/debug/debug.component.d.ts +27 -0
  330. package/src/pages/debug/debug.module.d.ts +14 -0
  331. package/src/pages/legacy-product/legacy-product.component.d.ts +37 -0
  332. package/src/pages/legacy-product/legacy-product.module.d.ts +10 -0
  333. package/src/pages/product/product.component.d.ts +30 -0
  334. package/src/pages/product/product.module.d.ts +10 -0
  335. package/src/pages/record-not-found/record-not-found.component.d.ts +11 -0
  336. package/src/pages/record-not-found/record-not-found.module.d.ts +9 -0
  337. package/src/pages/shopping-cart/shopping-cart.component.d.ts +32 -0
  338. package/src/pages/shopping-cart/shopping-cart.module.d.ts +10 -0
  339. package/src/resolvers/flow.resolver.d.ts +14 -0
  340. package/src/resolvers/quote.resolver.d.ts +18 -0
  341. package/src/services/flow-dialog.service.d.ts +20 -0
  342. package/src/services/flow-router.service.d.ts +35 -0
  343. package/src/services/flow.service.d.ts +17 -0
  344. package/src/services/index.d.ts +1 -0
  345. package/src/types/context-route.types.d.ts +5 -0
  346. package/src/types/flow-customization.types.d.ts +11 -0
  347. package/src/types/index.d.ts +2 -0
  348. package/src/types/route.types.d.ts +9 -0
  349. package/src/utils/flow.utils.d.ts +1 -0
  350. package/src/utils/index.d.ts +1 -0
  351. package/veloce-sdk.d.ts +5 -0
@@ -0,0 +1,3895 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, ViewContainerRef, Component, Input, ViewChild, Inject, EventEmitter, TemplateRef, ChangeDetectionStrategy, Output, Directive, HostBinding, NgModule, ViewChildren, ViewEncapsulation } from '@angular/core';
3
+ import * as i4 from '@angular/forms';
4
+ import { FormGroup, FormControl, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import * as i7 from '@veloce/core';
6
+ import { EntityUtil, UUID, SectionPathUtil, TypeValidators, ConfigurationMode, RuntimeModel, OrderByPipe, PricingUtils, PagedEntity, CoreModule, SalesforceIdUtils, SearchFilterPipe, ConfigurationContextMode } from '@veloce/core';
7
+ import * as i2 from '@veloce/sdk/core';
8
+ import { RuntimeMode, RuntimeStep, SdkCoreModule } from '@veloce/sdk/core';
9
+ import * as rxjs from 'rxjs';
10
+ import { Subject, BehaviorSubject, of, merge, combineLatest } from 'rxjs';
11
+ import * as _ from 'lodash';
12
+ import { keys, isUndefined, isNull, isString, isDate, set, values } from 'lodash';
13
+ import * as rxjsOperators from 'rxjs/operators';
14
+ import { map, take, tap, shareReplay, takeUntil } from 'rxjs/operators';
15
+ import * as i8 from '@veloce/components';
16
+ import { ConfirmationComponent, LoaderModule } from '@veloce/components';
17
+ import * as i1 from '@veloce/api';
18
+ import { ApiModule } from '@veloce/api';
19
+ import * as i3 from 'primeng/dynamicdialog';
20
+ import { DialogService } from 'primeng/dynamicdialog';
21
+ import * as i3$1 from 'primeng/api';
22
+ import { MessageService } from 'primeng/api';
23
+ import { __awaiter, __decorate } from 'tslib';
24
+ import { ScrollingModule as ScrollingModule$1 } from '@angular/cdk-experimental/scrolling';
25
+ import { ScrollingModule } from '@angular/cdk/scrolling';
26
+ import * as i5 from '@angular/common';
27
+ import { CurrencyPipe, DOCUMENT, CommonModule, DatePipe } from '@angular/common';
28
+ import '@angular/compiler';
29
+ import { VeloceElementsModule } from '@veloce/elements';
30
+ import * as i5$1 from 'ngx-bootstrap/popover';
31
+ import { PopoverModule } from 'ngx-bootstrap/popover';
32
+ import { TemplatePortal } from '@angular/cdk/portal';
33
+ import * as i1$1 from '@angular/cdk/overlay';
34
+ import * as moment from 'moment';
35
+ import { HttpErrorResponse } from '@angular/common/http';
36
+
37
+ class CollapsibleStateService {
38
+ constructor() {
39
+ this._collapsedSections = {}; // By Line Item Id
40
+ this.collapseSectionSubject = new Subject();
41
+ this.collapseSectionEvent = this.collapseSectionSubject.asObservable();
42
+ }
43
+ toggleCollapse(sectionId, silently) {
44
+ this._collapsedSections[sectionId] = !this.isCollapsedSection(sectionId);
45
+ if (!silently) {
46
+ this.collapseSectionSubject.next([sectionId, this._collapsedSections[sectionId]]);
47
+ }
48
+ }
49
+ collapse(sectionId) {
50
+ this._collapsedSections[sectionId] = true;
51
+ }
52
+ expand(sectionId) {
53
+ this._collapsedSections[sectionId] = false;
54
+ }
55
+ clearState(sectionId) {
56
+ delete this._collapsedSections[sectionId];
57
+ }
58
+ isCollapsedSection(sectionId) {
59
+ return this._collapsedSections[sectionId];
60
+ }
61
+ }
62
+ CollapsibleStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CollapsibleStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
63
+ CollapsibleStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CollapsibleStateService });
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CollapsibleStateService, decorators: [{
65
+ type: Injectable
66
+ }], ctorParameters: function () { return []; } });
67
+
68
+ class ScriptRegistry {
69
+ constructor() {
70
+ this.store = new Map();
71
+ this.scope = new Map();
72
+ }
73
+ exists(scriptId) {
74
+ const sectionIds = this.store.get(scriptId);
75
+ return !EntityUtil.isEmpty(sectionIds);
76
+ }
77
+ isRegistered(scriptId, sectionId) {
78
+ const sectionIds = this.store.get(scriptId);
79
+ return !EntityUtil.isEmpty(sectionIds) && (sectionIds === null || sectionIds === void 0 ? void 0 : sectionIds.findIndex(entryId => entryId === sectionId)) !== -1;
80
+ }
81
+ doRegister(scriptId, sectionId) {
82
+ const sectionIds = this.store.get(scriptId);
83
+ if (!EntityUtil.isPresent(sectionIds)) {
84
+ this.store.set(scriptId, [sectionId]);
85
+ }
86
+ else if ((sectionIds === null || sectionIds === void 0 ? void 0 : sectionIds.findIndex(entryId => entryId === sectionId)) === -1) {
87
+ sectionIds.push(sectionId);
88
+ }
89
+ }
90
+ unRegister(scriptId, sectionId) {
91
+ const sectionIds = this.store.get(scriptId);
92
+ if (!sectionIds) {
93
+ return;
94
+ }
95
+ const index = sectionIds === null || sectionIds === void 0 ? void 0 : sectionIds.findIndex(entryId => entryId === sectionId);
96
+ if (index !== -1) {
97
+ sectionIds.splice(index, 1);
98
+ // Remove orphan
99
+ if (sectionIds.length < 1) {
100
+ this.store.delete(scriptId);
101
+ }
102
+ }
103
+ }
104
+ hasGlobalForScript(globalId) {
105
+ return this.scope.has(globalId);
106
+ }
107
+ getGlobalForScript(globalId) {
108
+ return this.scope.get(globalId);
109
+ }
110
+ setGlobalForScript(globalId, globalVariable) {
111
+ this.scope.set(globalId, globalVariable);
112
+ }
113
+ removeGlobalForScript(globalId) {
114
+ this.scope.delete(globalId);
115
+ }
116
+ }
117
+
118
+ // TODO ALE RENAME TO SESSION SCOPE
119
+ class FormScopeService {
120
+ constructor() {
121
+ this.scriptRegistry = new ScriptRegistry();
122
+ this.scriptSessionScope = {};
123
+ this.formSubmitSubject = new Subject();
124
+ this._form = new FormGroup({});
125
+ this.formSubmitEvent = this.formSubmitSubject.asObservable();
126
+ }
127
+ get form() {
128
+ return this._form;
129
+ }
130
+ set form(value) {
131
+ this._form = value;
132
+ }
133
+ publishFormUpdate(value) {
134
+ this.formSubmitSubject.next(value);
135
+ }
136
+ }
137
+ FormScopeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FormScopeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
138
+ FormScopeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FormScopeService });
139
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FormScopeService, decorators: [{
140
+ type: Injectable
141
+ }], ctorParameters: function () { return []; } });
142
+
143
+ var BoundDataType;
144
+ (function (BoundDataType) {
145
+ BoundDataType[BoundDataType["TYPE"] = 0] = "TYPE";
146
+ BoundDataType[BoundDataType["ATTRIBUTE"] = 1] = "ATTRIBUTE";
147
+ BoundDataType[BoundDataType["PORT"] = 2] = "PORT";
148
+ })(BoundDataType || (BoundDataType = {}));
149
+
150
+ class LineItemPath {
151
+ constructor(path) {
152
+ this._relativePath = '';
153
+ this._relativeAbstractPath = '';
154
+ this._abstractPath = '';
155
+ this.path = path.toLowerCase();
156
+ }
157
+ set relativePath(relativePath) {
158
+ this._relativePath = relativePath.toLowerCase();
159
+ }
160
+ get relativePath() {
161
+ return this._relativePath;
162
+ }
163
+ set abstractPath(abstractPath) {
164
+ this._abstractPath = abstractPath.toLowerCase();
165
+ }
166
+ get abstractPath() {
167
+ return this._abstractPath || this.path;
168
+ }
169
+ set relativeAbstractPath(relativeAbstractPath) {
170
+ this._relativeAbstractPath = relativeAbstractPath.toLowerCase();
171
+ }
172
+ isEqualTo(sectionPath) {
173
+ if (!sectionPath || !this.path || !sectionPath.path) {
174
+ return false;
175
+ }
176
+ const otherPath = sectionPath.path.toLowerCase();
177
+ const isEqual = this.path === otherPath || this._relativePath === otherPath || this._relativeAbstractPath === otherPath;
178
+ //TODO ALE SORT OUT SEARCH
179
+ if (!isEqual) {
180
+ const abstractPathMatch = this._abstractPath === sectionPath.abstractPath.toLowerCase();
181
+ const relativePathMatch = this._relativePath
182
+ ? this._relativePath === sectionPath.relativePath.toLowerCase()
183
+ : false;
184
+ const relativeAbstractPathMatch = this._relativeAbstractPath && sectionPath.relativeAbstractPath
185
+ ? sectionPath.relativeAbstractPath.toLowerCase() === sectionPath.relativePath.toLowerCase() &&
186
+ this._relativeAbstractPath === sectionPath.relativePath.toLowerCase()
187
+ : false;
188
+ return abstractPathMatch && (relativePathMatch || relativeAbstractPathMatch);
189
+ }
190
+ return isEqual;
191
+ }
192
+ }
193
+ class LineItemUtil {
194
+ static removeDeletedItems(original) {
195
+ var _a;
196
+ const root = EntityUtil.clone(original);
197
+ if (root) {
198
+ let items = [root];
199
+ for (let i = 0; i < items.length; i++) {
200
+ const item = items[i];
201
+ item.lineItems = ((_a = item.lineItems) !== null && _a !== void 0 ? _a : []).filter(l => l.actionCode !== 'DELETE');
202
+ items = items.concat(item.lineItems);
203
+ }
204
+ }
205
+ return root;
206
+ }
207
+ static replaceLineItemKeys(rootLineItem) {
208
+ const replaceFn = (item) => {
209
+ item.id = item.id ? 'DUMMY-' + item.id : item.id;
210
+ item.rootId = item.rootId ? 'DUMMY-' + item.rootId : item.rootId;
211
+ item.parentId = item.parentId ? 'DUMMY-' + item.parentId : item.parentId;
212
+ item.offeringInstanceId = item.offeringInstanceId ? 'DUMMY-' + item.offeringInstanceId : void 0;
213
+ item.offeringItemId = item.offeringItemId ? 'DUMMY-' + item.offeringItemId : void 0;
214
+ item.rampInstanceId = item.rampInstanceId ? 'DUMMY-' + item.rampInstanceId : void 0;
215
+ };
216
+ const traverseFn = (lineItem, callbackFn) => {
217
+ if (lineItem.lineItems && lineItem.lineItems.length > 0) {
218
+ lineItem.lineItems.forEach(childLineItem => {
219
+ callbackFn.apply(null, [childLineItem]);
220
+ traverseFn.apply(null, [childLineItem, callbackFn]);
221
+ });
222
+ }
223
+ };
224
+ replaceFn.apply(null, [rootLineItem]);
225
+ // rootLineItem.rootId = rootLineItem.id;
226
+ traverseFn.apply(null, [rootLineItem, replaceFn]);
227
+ }
228
+ static enrichPricingInfo(source, pricingDto) {
229
+ var _a;
230
+ const result = Object.assign({}, source);
231
+ if (pricingDto) {
232
+ result.productName = ((_a = pricingDto.properties) === null || _a === void 0 ? void 0 : _a.displayName) || pricingDto.productName;
233
+ result.type = pricingDto.type;
234
+ result.rootId = pricingDto.rootId;
235
+ result.assetId = pricingDto.assetId;
236
+ result.openOrderLineItemId = pricingDto.openOrderLineItemId;
237
+ result.activated = pricingDto.activated;
238
+ result.actionCode = pricingDto.actionCode;
239
+ result.serviceStartDate = pricingDto.serviceStartDate;
240
+ result.effectiveDate = pricingDto.effectiveDate;
241
+ result.startDate = pricingDto.startDate;
242
+ result.endDate = pricingDto.endDate;
243
+ result.offeringId = pricingDto.offeringId;
244
+ result.offeringItemId = pricingDto.offeringItemId;
245
+ result.offeringInstanceId = pricingDto.offeringInstanceId;
246
+ result.rampInstanceId = pricingDto.rampInstanceId;
247
+ result.planId = pricingDto.planId;
248
+ if (!result.chargeItems) {
249
+ result.chargeItems = pricingDto.chargeItems;
250
+ }
251
+ result.chargeGroupItems = [];
252
+ }
253
+ if (source.lineItems && source.lineItems.length > 0) {
254
+ result.lineItems = [];
255
+ source.lineItems.forEach((childSource) => {
256
+ const childDto = pricingDto && pricingDto.lineItems && pricingDto.lineItems.find(c => childSource.id === c.id);
257
+ const childItem = LineItemUtil.enrichPricingInfo(childSource, childDto);
258
+ result.lineItems.push(childItem);
259
+ });
260
+ }
261
+ return result;
262
+ }
263
+ static getLineItemPath(lineItem, rootLineItem) {
264
+ let path;
265
+ if (!lineItem.parentId) {
266
+ path = new LineItemPath('/' + lineItem.type);
267
+ path.abstractPath = path.path;
268
+ path.relativePath = path.path;
269
+ path.relativeAbstractPath = path.path;
270
+ }
271
+ else {
272
+ //TOODO ALE SORT OUT PATENT ITEM
273
+ const parentItem = EntityUtil.findByFieldHierarchically('id', lineItem.parentId, [rootLineItem], 'lineItems');
274
+ const portType = lineItem.port && (parentItem === null || parentItem === void 0 ? void 0 : parentItem.portDomains[lineItem.port].type);
275
+ const parentPath = parentItem && LineItemUtil.getLineItemPath(parentItem, rootLineItem);
276
+ if (parentPath) {
277
+ path = new LineItemPath(parentPath.path + '/ports/' + lineItem.port + '/' + lineItem.type);
278
+ path.abstractPath = parentPath.abstractPath + '/ports/' + (lineItem.port + '/' + portType);
279
+ path.relativePath = '/' + lineItem.type;
280
+ path.relativeAbstractPath = '/' + portType;
281
+ }
282
+ else {
283
+ throw 'Could not construct line item path';
284
+ }
285
+ }
286
+ return path;
287
+ }
288
+ static findById(parentId, lineItems) {
289
+ return EntityUtil.findByFieldHierarchically('id', parentId, lineItems, 'lineItems');
290
+ }
291
+ static countAttributeValues(scale, attributeDomain) {
292
+ const precision = LineItemUtil.precision(scale);
293
+ let count = 0;
294
+ attributeDomain.forEach(d => (count += d.max - d.min + precision));
295
+ return count;
296
+ }
297
+ static precision(scale) {
298
+ if (!scale) {
299
+ return 1;
300
+ }
301
+ let s = '1';
302
+ while (s.length < scale) {
303
+ s = '0' + s;
304
+ }
305
+ return Number('0.' + s);
306
+ }
307
+ static splitDomainToValues(scale, attributeDomain) {
308
+ const precision = this.precision(scale);
309
+ let values = [];
310
+ attributeDomain.forEach(interval => (values = values.concat(LineItemUtil.splitIntervalToValues(precision, interval))));
311
+ return values;
312
+ }
313
+ static splitIntervalToValues(precision, interval) {
314
+ const values = [];
315
+ for (let i = interval.min; i <= interval.max; i += precision) {
316
+ values.push(i);
317
+ }
318
+ return values;
319
+ }
320
+ static findLineItemsByPath(runtimeModel, lineItem, path) {
321
+ if (!runtimeModel.isEquals(lineItem.type, path.types[0])) {
322
+ return [];
323
+ }
324
+ let lineItems = [lineItem];
325
+ for (let i = 1; i < path.types.length; i++) {
326
+ const portName = path.ports[i - 1];
327
+ const typeName = path.types[i];
328
+ lineItems = LineItemUtil.findLineItemChildren(runtimeModel, lineItems, portName, typeName);
329
+ }
330
+ return lineItems;
331
+ }
332
+ static findLineItemChildren(runtimeModel, lineItems, portName, typeName) {
333
+ var _a;
334
+ const result = [];
335
+ for (const lineItem of lineItems) {
336
+ for (const childItem of lineItem.lineItems) {
337
+ if (((_a = childItem.port) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === portName.toLowerCase() &&
338
+ runtimeModel.isEquals(childItem.type, typeName)) {
339
+ result.push(childItem);
340
+ }
341
+ }
342
+ }
343
+ return result;
344
+ }
345
+ static findLineItemsByType(runtimeModel, lineItem, typeName) {
346
+ const result = [];
347
+ let lineItems = [lineItem];
348
+ for (let i = 0; i < lineItems.length; i++) {
349
+ const lineItem = lineItems[i];
350
+ if (runtimeModel.isEquals(lineItem.type, typeName)) {
351
+ result.push(lineItem);
352
+ }
353
+ lineItems = lineItems.concat(lineItem.lineItems);
354
+ }
355
+ return result;
356
+ }
357
+ static findLineItemForValue(model, valueOption) {
358
+ if (!EntityUtil.isPresent(model) || !EntityUtil.isPresent(model.lineItems)) {
359
+ return;
360
+ }
361
+ return model.lineItems.find(li => li.type && li.type.toLowerCase() === valueOption.toLowerCase());
362
+ }
363
+ // TODO: add Product typings
364
+ static create(product, qty) {
365
+ var _a;
366
+ return {
367
+ id: UUID.UUID(),
368
+ type: product.typeName,
369
+ name: ((_a = product.properties) === null || _a === void 0 ? void 0 : _a.displayName) || product.name,
370
+ productName: product.name,
371
+ productId: product.id,
372
+ cfgStatus: 'User',
373
+ actionCode: 'ADD',
374
+ qty: qty || 1,
375
+ };
376
+ }
377
+ static upsert(value, collection) {
378
+ const index = collection.findIndex(item => item.id === value.id);
379
+ if (index > -1) {
380
+ collection[index] = value;
381
+ }
382
+ else {
383
+ collection.push(value);
384
+ }
385
+ }
386
+ static compareSortOrder(a, b) {
387
+ const orderA = Number(a.properties['SortOrder']);
388
+ const orderB = Number(b.properties['SortOrder']);
389
+ if (!orderA && !orderB) {
390
+ return LineItemUtil.compareProductName(a, b);
391
+ }
392
+ if (!orderA) {
393
+ return 1;
394
+ }
395
+ else if (!orderB) {
396
+ return -1;
397
+ }
398
+ const result = orderA - orderB;
399
+ if (result === 0) {
400
+ return LineItemUtil.compareProductName(a, b);
401
+ }
402
+ return result;
403
+ }
404
+ static sort(lineItems) {
405
+ if (lineItems) {
406
+ lineItems.sort((a, b) => LineItemUtil.compareSortOrder(a, b));
407
+ lineItems.forEach(i => LineItemUtil.sort(i.lineItems));
408
+ }
409
+ }
410
+ static compareProductName(a, b) {
411
+ var _a, _b;
412
+ if (a.productName) {
413
+ return ((_a = a.productName) !== null && _a !== void 0 ? _a : '').localeCompare((_b = b.productName) !== null && _b !== void 0 ? _b : '');
414
+ }
415
+ else if (b.productName) {
416
+ return 1;
417
+ }
418
+ return 0;
419
+ }
420
+ }
421
+
422
+ class SectionsBinderHelper {
423
+ static setLineItemsPath(runtimeModel, rootLineItem, sections, sourceSections, filterFn, pricingEnabled) {
424
+ const filtered = sections.filter(filterFn);
425
+ filtered.forEach(section => {
426
+ const path = section.boundData.path;
427
+ let foundLineItems;
428
+ if (path.relative) {
429
+ foundLineItems = LineItemUtil.findLineItemsByType(runtimeModel, rootLineItem, path.types[0]);
430
+ }
431
+ else {
432
+ const remainder = rootLineItem.path ? SectionPathUtil.cut(runtimeModel, path, rootLineItem.path) : undefined;
433
+ if (!remainder) {
434
+ return [];
435
+ }
436
+ foundLineItems = LineItemUtil.findLineItemsByPath(runtimeModel, rootLineItem, remainder);
437
+ }
438
+ if (section.boundData.entityType === BoundDataType[BoundDataType.TYPE]) {
439
+ SectionsBinderHelper.bindMatchingLineItems(runtimeModel, foundLineItems, section, sections, sourceSections, pricingEnabled);
440
+ }
441
+ else if (section.boundData.entityType === BoundDataType[BoundDataType.ATTRIBUTE]) {
442
+ foundLineItems = foundLineItems.filter(item => item.attributes &&
443
+ item.attributes.findIndex(a => a.name.toLowerCase() === section.boundData.name.toLowerCase()) !== -1);
444
+ foundLineItems.forEach(lineItem => {
445
+ SectionsBinderHelper.bindLineItem(section, sections, sourceSections, lineItem, pricingEnabled);
446
+ });
447
+ }
448
+ else if (section.boundData.entityType === BoundDataType[BoundDataType.PORT]) {
449
+ foundLineItems = foundLineItems.filter(item => item.portDomains && item.portDomains[section.boundData.name]);
450
+ SectionsBinderHelper.bindMatchingLineItems(runtimeModel, foundLineItems, section, sections, sourceSections, pricingEnabled);
451
+ }
452
+ return;
453
+ });
454
+ return sections;
455
+ }
456
+ static isAddAllowed(model, portName, quantityToAdd = 1) {
457
+ const quantity = this.getQuantity(model, portName);
458
+ return quantity + quantityToAdd <= +this.getPortMax(model, portName);
459
+ }
460
+ static isRemoveAllowed(model, portName, quantityToRemove = 1) {
461
+ const quantity = this.getQuantity(model, portName);
462
+ return quantity - quantityToRemove >= +this.getPortMin(model, portName);
463
+ }
464
+ static getMaxAllowed(lineItem, portName) {
465
+ return +this.getPortMax(lineItem, portName) - this.getQuantity(lineItem, portName);
466
+ }
467
+ static getQuantityGroupByValue(model, portName) {
468
+ const quantities = {};
469
+ if (model && portName) {
470
+ model.lineItems
471
+ .filter(li => li.port === portName)
472
+ .forEach(li => {
473
+ let quantity = (EntityUtil.isPresent(li.qty) && li.qty) || 1;
474
+ if (EntityUtil.isPresent(quantities[li.type])) {
475
+ quantity += quantities[li.type];
476
+ }
477
+ quantities[li.type] = quantity;
478
+ });
479
+ }
480
+ return quantities;
481
+ }
482
+ static bindMatchingLineItems(runtimeModel, foundLineItems, section, sections, sourceSections, pricingEnabled) {
483
+ foundLineItems.forEach(lineItem => {
484
+ const boundSection = SectionsBinderHelper.bindLineItem(section, sections, sourceSections, lineItem, pricingEnabled);
485
+ SectionsBinderHelper.setLineItemsPath(runtimeModel, lineItem, sections, sourceSections, (sec) => {
486
+ return sec.boundData && sec.parentId === boundSection.id;
487
+ }, pricingEnabled);
488
+ });
489
+ }
490
+ static bindLineItem(section, sections, sourceSections, lineItem, pricingEnabled) {
491
+ const boundSection = section.model ? SectionsBinderHelper.doClone(section, sections, sourceSections) : section;
492
+ boundSection.model = lineItem;
493
+ boundSection.pricingEnabled = pricingEnabled;
494
+ return boundSection;
495
+ }
496
+ static doClone(source, sections, sourceSections, parent) {
497
+ const sourceClass = sourceSections.find(s => s.classId === source.classId);
498
+ const clone = EntityUtil.clone(sourceClass);
499
+ clone.id = UUID.UUID();
500
+ clone.parentId = parent ? parent.id : source.parentId;
501
+ sections.splice(sections.findIndex(s => s.id === source.id) + 1, 0, clone);
502
+ sourceSections
503
+ .filter(s => s.parentId === sourceClass.id)
504
+ .forEach(s => SectionsBinderHelper.doClone(s, sections, sourceSections, clone));
505
+ return clone;
506
+ }
507
+ static getQuantity(model, portName) {
508
+ let quantity = 0;
509
+ model.lineItems
510
+ .filter(li => li.port === portName)
511
+ .forEach(li => {
512
+ quantity += li.qty;
513
+ });
514
+ return quantity;
515
+ }
516
+ static getPortMax(model, portName) {
517
+ return model.portDomains[portName].maxCard;
518
+ }
519
+ static getPortMin(model, portName) {
520
+ return model.portDomains[portName].minCard;
521
+ }
522
+ }
523
+
524
+ class RuntimeFormService {
525
+ constructor() {
526
+ this.sections = [];
527
+ }
528
+ initForm(sections, solutionLineItem) {
529
+ this.sections = sections;
530
+ this.solutionLineItem = solutionLineItem;
531
+ const form = new FormGroup({});
532
+ sections
533
+ .filter(section => section.model && section.template && section.boundData)
534
+ .forEach(section => {
535
+ this.populateSectionValue(section);
536
+ this.populateSectionPrice(section);
537
+ this.populateFormControls(section, form);
538
+ });
539
+ return form;
540
+ }
541
+ populateSectionValue(section) {
542
+ var _a, _b, _c, _d, _e, _f, _g;
543
+ let value;
544
+ let valueOptions = [];
545
+ let displayValues = {};
546
+ let properties = {};
547
+ if (FormServiceUtils.isPortSection(section)) {
548
+ const portDomain = (_a = section.model) === null || _a === void 0 ? void 0 : _a.portDomains[section.boundData.name];
549
+ valueOptions = (_b = portDomain === null || portDomain === void 0 ? void 0 : portDomain.domainTypes.map(dt => dt.name)) !== null && _b !== void 0 ? _b : [];
550
+ properties =
551
+ (_c = portDomain === null || portDomain === void 0 ? void 0 : portDomain.domainTypes.reduce(function (map, dt) {
552
+ map[dt.name] = dt.properties;
553
+ return map;
554
+ }, {})) !== null && _c !== void 0 ? _c : {};
555
+ displayValues =
556
+ (_d = portDomain === null || portDomain === void 0 ? void 0 : portDomain.domainTypes.reduce(function (map, dt) {
557
+ map[dt.name] = dt.displayName;
558
+ return map;
559
+ }, {})) !== null && _d !== void 0 ? _d : {};
560
+ value = (_e = section.model) === null || _e === void 0 ? void 0 : _e.lineItems.map(li => li.type);
561
+ }
562
+ if (FormServiceUtils.isAttributeSection(section)) {
563
+ const attribute = (_f = section.model) === null || _f === void 0 ? void 0 : _f.attributes.find(attr => attr.name.toLowerCase() === section.boundData.name.toLowerCase());
564
+ if (attribute) {
565
+ value = attribute.value;
566
+ }
567
+ const attributeDomain = (_g = section.model) === null || _g === void 0 ? void 0 : _g.attributeDomains[section.boundData.name];
568
+ if (!(attribute === null || attribute === void 0 ? void 0 : attribute.type.match('GENERIC|BOOLEAN')) && attributeDomain) {
569
+ const count = attribute && attribute.scale != null
570
+ ? LineItemUtil.countAttributeValues(attribute.scale, attributeDomain)
571
+ : undefined;
572
+ if (attribute && attribute.scale != null && count && count <= 100) {
573
+ valueOptions = LineItemUtil.splitDomainToValues(attribute.scale, attributeDomain);
574
+ }
575
+ else {
576
+ valueOptions = attributeDomain;
577
+ }
578
+ }
579
+ else if (attributeDomain) {
580
+ valueOptions = attributeDomain;
581
+ }
582
+ }
583
+ if (!EntityUtil.isPresent(value)) {
584
+ value = '';
585
+ }
586
+ section.sectionValue = {
587
+ value,
588
+ valueOptions,
589
+ displayValues,
590
+ properties,
591
+ };
592
+ }
593
+ populateSectionPrice(section) {
594
+ var _a;
595
+ const priceValue = { priceOptions: {} };
596
+ if (FormServiceUtils.isPortSection(section)) {
597
+ const portDomain = (_a = section.model) === null || _a === void 0 ? void 0 : _a.portDomains[section.boundData.name];
598
+ if (portDomain) {
599
+ portDomain.domainTypes.forEach(dt => {
600
+ if (dt.recommendedPrices && dt.recommendedPrices.length > 0) {
601
+ priceValue.priceOptions[dt.name] = dt.recommendedPrices;
602
+ }
603
+ else {
604
+ delete priceValue.priceOptions[dt.name];
605
+ }
606
+ });
607
+ }
608
+ }
609
+ section.priceValue = priceValue;
610
+ }
611
+ populateFormControls(section, form) {
612
+ form.controls[section.id] = this.createFormControl(section);
613
+ if (FormServiceUtils.isPortSection(section) || FormServiceUtils.isTypeSection(section)) {
614
+ form.controls[section.id.concat('qty')] = this.createQtyControl(section);
615
+ }
616
+ }
617
+ createFormControl(section) {
618
+ var _a;
619
+ const value = FormServiceUtils.isPortSection(section) ? void 0 : (_a = section.sectionValue) === null || _a === void 0 ? void 0 : _a.value;
620
+ return new FormControl(value, this.getFormControlValidators(section));
621
+ }
622
+ createQtyControl(section) {
623
+ var _a, _b, _c;
624
+ const isTypeSection = FormServiceUtils.isTypeSection(section);
625
+ const validators = [];
626
+ const maxAllowed = this.getMaxAllowed(section);
627
+ //TODO TEMPORARY SOLUTION (WILL BE DISABLED ONCE RADIO CONTROLS IMPLEMENTED)
628
+ if (maxAllowed > 0) {
629
+ validators.push(this.getQuantityValidator(maxAllowed, isTypeSection ? (_b = (_a = section.model) === null || _a === void 0 ? void 0 : _a.qty) !== null && _b !== void 0 ? _b : 0 : 0));
630
+ }
631
+ const qtyValue = isTypeSection ? (_c = section.model) === null || _c === void 0 ? void 0 : _c.qty : 1;
632
+ return new FormControl(qtyValue, validators);
633
+ }
634
+ getMaxAllowed(section) {
635
+ let lineItem = section.model;
636
+ let portName = section.boundData.name;
637
+ if (FormServiceUtils.isTypeSection(section)) {
638
+ if (section.model && EntityUtil.isPresent(section.model.parentId) && this.solutionLineItem) {
639
+ if (section.model.parentId) {
640
+ lineItem = LineItemUtil.findById(section.model.parentId, [this.solutionLineItem]);
641
+ }
642
+ portName = section.model.port;
643
+ }
644
+ else {
645
+ return 0;
646
+ }
647
+ }
648
+ if (!lineItem) {
649
+ return 0;
650
+ }
651
+ return SectionsBinderHelper.getMaxAllowed(lineItem, portName);
652
+ }
653
+ //TODO ALE TO SUPPORT EMPTY VALUES FOR INTERVAL ATTRIBUTES OUT OF DOMAIN
654
+ getFormControlValidators(section) {
655
+ if (!FormServiceUtils.isAttributeSection(section)) {
656
+ return null;
657
+ }
658
+ const validators = [];
659
+ const parentLineItem = section.model && this.solutionLineItem && FormServiceUtils.findParent(section.model.id, [this.solutionLineItem]);
660
+ const attribute = parentLineItem &&
661
+ parentLineItem.attributes.find(attr => attr.name.toLowerCase() === section.boundData.name.toLowerCase());
662
+ if (!attribute || !attribute.type) {
663
+ return null;
664
+ }
665
+ const primitiveTypesValidators = {
666
+ INT: TypeValidators.integerValidator(),
667
+ 'DOUBLE|DECIMAL': TypeValidators.decimalValidator(10),
668
+ };
669
+ keys(primitiveTypesValidators).forEach(types => {
670
+ if (types.match(attribute.type)) {
671
+ const validator = primitiveTypesValidators[types];
672
+ validators.push(validator);
673
+ }
674
+ });
675
+ if (!attribute.type.match('GENERIC|BOOLEAN|MULTIPLE')) {
676
+ const sectionLabel = section.label;
677
+ const intervalValidator = function (control) {
678
+ var _a;
679
+ if (isUndefined(control.value) || isNull(control.value) || isNaN(+control.value)) {
680
+ return { interval: { message: sectionLabel + ' is not in domain' } };
681
+ }
682
+ if (!isUndefined(control.value) && isString(control.value) && control.value.length === 0) {
683
+ return null;
684
+ }
685
+ const attributeDomain = (_a = section.model) === null || _a === void 0 ? void 0 : _a.attributeDomains[section.boundData.name];
686
+ const valid = attributeDomain === null || attributeDomain === void 0 ? void 0 : attributeDomain.some(valueOption => {
687
+ const min = +valueOption.min;
688
+ const max = +valueOption.max;
689
+ return +control.value <= max && +control.value >= min;
690
+ });
691
+ if (!valid) {
692
+ return { interval: { message: sectionLabel + ' is not in domain' } };
693
+ }
694
+ return null;
695
+ };
696
+ validators.push(intervalValidator);
697
+ }
698
+ if (section.required) {
699
+ validators.push(TypeValidators.requiredValidator(section.label + ' is required '));
700
+ }
701
+ return validators.length !== 0 ? validators : null;
702
+ }
703
+ getQuantityValidator(max, originalQty) {
704
+ return control => {
705
+ if (!control.value) {
706
+ return { quantity: { message: 'Required' } };
707
+ }
708
+ else if (isNaN(+control.value) || +control.value < 1) {
709
+ return { quantity: { message: 'Invalid value' } };
710
+ }
711
+ else if (+control.value > max + originalQty) {
712
+ return { quantity: { message: 'Max quantity ' + (max + originalQty) } };
713
+ }
714
+ else {
715
+ return null;
716
+ }
717
+ };
718
+ }
719
+ }
720
+ RuntimeFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
721
+ RuntimeFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeFormService });
722
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeFormService, decorators: [{
723
+ type: Injectable
724
+ }] });
725
+ class FormServiceUtils {
726
+ static isPortSection(section) {
727
+ return section && section.boundData && section.boundData.entityType === BoundDataType[BoundDataType.PORT];
728
+ }
729
+ static isTypeSection(section) {
730
+ return section && section.boundData && section.boundData.entityType === BoundDataType[BoundDataType.TYPE];
731
+ }
732
+ static isAttributeSection(section) {
733
+ return section && section.boundData && section.boundData.entityType === BoundDataType[BoundDataType.ATTRIBUTE];
734
+ }
735
+ static findParent(parentId, lineItems) {
736
+ return EntityUtil.findByFieldHierarchically('id', parentId, lineItems, 'lineItems');
737
+ }
738
+ }
739
+
740
+ class ConfigurationService {
741
+ constructor(configurationApiService, contextService, dialogService) {
742
+ this.configurationApiService = configurationApiService;
743
+ this.contextService = contextService;
744
+ this.dialogService = dialogService;
745
+ }
746
+ configure(runtimeContext, states, resolve) {
747
+ var _a;
748
+ const lineItem = (states && states.configurableRamp) || this.getDefaultLineItem(runtimeContext);
749
+ const configurationMode = resolve ? ConfigurationMode.RESOLVE : ConfigurationMode.SEARCH;
750
+ const configurationRequest = this.createRequest(lineItem, runtimeContext, configurationMode);
751
+ configurationRequest.lineItems = states.currentState || [];
752
+ configurationRequest.asset = states.asset;
753
+ const runtimeModel = runtimeContext.runtimeModel;
754
+ const pricingEnabled = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.pricingEnabled;
755
+ return this.configurationApiService
756
+ .configureLineItem({
757
+ configurationRequest,
758
+ runtimeModel,
759
+ pricingEnabled,
760
+ })
761
+ .pipe(map(({ lineItem, context, deletedLineItems }) => {
762
+ if (context) {
763
+ this.contextService.update({ properties: context.properties });
764
+ }
765
+ if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
766
+ this.showInactiveProductsConfirmation();
767
+ }
768
+ return lineItem;
769
+ }));
770
+ }
771
+ createRequest(lineItem, runtimeContext, configurationMode) {
772
+ var _a, _b, _c, _d, _e;
773
+ if (runtimeContext.runtimeMode === RuntimeMode.TEST) {
774
+ const properties = Object.assign(Object.assign({}, runtimeContext.properties), { ModelId: runtimeContext.modelId, RuntimeMode: 'TEST', PricingEnabled: String((_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.pricingEnabled), StartDate: (_c = (_b = runtimeContext.properties) === null || _b === void 0 ? void 0 : _b.StartDate) !== null && _c !== void 0 ? _c : new Date().toISOString().substring(0, 10), PriceListId: (_d = runtimeContext.uiDefinition) === null || _d === void 0 ? void 0 : _d.priceList });
775
+ this.contextService.update({ properties });
776
+ }
777
+ else {
778
+ const context = this.contextService.resolve();
779
+ if (context.properties && ((_e = runtimeContext.properties) === null || _e === void 0 ? void 0 : _e.StartDate)) {
780
+ this.contextService.update({
781
+ properties: Object.assign(Object.assign({}, context.properties), runtimeContext.properties),
782
+ });
783
+ }
784
+ }
785
+ return {
786
+ lineItem,
787
+ mode: configurationMode,
788
+ step: runtimeContext.invocationContext && runtimeContext.invocationContext.runtimeStep,
789
+ attributeDomainMode: 'ALL',
790
+ context: this.contextService.resolve(),
791
+ };
792
+ }
793
+ getDefaultLineItem(context) {
794
+ var _a, _b, _c, _d;
795
+ const id = UUID.UUID();
796
+ const lineItem = Object.assign({ id, type: (_b = (_a = context.uiDefinition) === null || _a === void 0 ? void 0 : _a.rootType) !== null && _b !== void 0 ? _b : '', cfgStatus: 'Default', qty: 1, productName: ((_c = context.properties) === null || _c === void 0 ? void 0 : _c.displayName) || context.productName, productId: (_d = context.productId) !== null && _d !== void 0 ? _d : '', offeringId: context.offeringId }, (context.offeringId
797
+ ? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
798
+ : {}));
799
+ return lineItem;
800
+ }
801
+ showInactiveProductsConfirmation() {
802
+ this.dialogService
803
+ .open(ConfirmationComponent, {
804
+ dismissableMask: false,
805
+ closeOnEscape: false,
806
+ closable: false,
807
+ showHeader: true,
808
+ header: `Inactive Products in Quote`,
809
+ width: '440px',
810
+ data: {
811
+ confirmationConfig: {
812
+ title: ' ',
813
+ description: 'This quote contains inactive products. Do you want to remove them?',
814
+ submitBtn: 'Remove products',
815
+ cancelBtn: 'Back to Quote',
816
+ },
817
+ },
818
+ })
819
+ .onClose.subscribe(result => {
820
+ if (!result) {
821
+ const context = this.contextService.resolve();
822
+ window['VELO_BACK_FN'].apply(null, [context.headerId]);
823
+ }
824
+ });
825
+ }
826
+ }
827
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.ConfigurationApiService }, { token: i2.ContextService }, { token: i3.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
828
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService });
829
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, decorators: [{
830
+ type: Injectable
831
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i2.ContextService }, { type: i3.DialogService }]; } });
832
+
833
+ class RuntimeService {
834
+ constructor(configurationService, contextService, messageService) {
835
+ this.configurationService = configurationService;
836
+ this.contextService = contextService;
837
+ this.messageService = messageService;
838
+ this.solutionReadySubject = new Subject();
839
+ this.onSolutionReadyEvent = this.solutionReadySubject.asObservable();
840
+ this.solutionUpdateStartedSubject = new Subject();
841
+ this.onSolutionUpdateStartedEvent = this.solutionUpdateStartedSubject.asObservable();
842
+ this.solutionUpdatedSubject = new Subject();
843
+ this.onSolutionUpdatedEvent = this.solutionUpdatedSubject.asObservable();
844
+ this.solutionProcessedSubject = new Subject();
845
+ this.onSolutionProcessed = this.solutionProcessedSubject.asObservable();
846
+ this.solutionStopSubject = new Subject();
847
+ this.onSolutionStopEvent = this.solutionStopSubject.asObservable();
848
+ this.solutionCancelSubject = new Subject();
849
+ this.onSolutionCancelEvent = this.solutionCancelSubject.asObservable();
850
+ this.uiRefreshSubject = new Subject();
851
+ this.onUIRefreshEvent = this.uiRefreshSubject.asObservable();
852
+ }
853
+ displayErrorMessage(error) {
854
+ var _a;
855
+ this.messageService.add({
856
+ severity: 'error',
857
+ summary: ((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error),
858
+ });
859
+ }
860
+ startRuntime(context, states, resolve) {
861
+ this.setRuntimeContext(context);
862
+ this.setRuntimeStep(RuntimeStep.START);
863
+ this.configurationService
864
+ .configure(context, states, resolve)
865
+ .pipe(take(1))
866
+ .subscribe(lineItem => {
867
+ this.solutionReadySubject.next(lineItem);
868
+ }, error => {
869
+ this.displayErrorMessage(error);
870
+ this.solutionUpdatedSubject.next(error);
871
+ });
872
+ }
873
+ updateRuntime(states, configurationContextProperties) {
874
+ if (!this.runtimeContext) {
875
+ return;
876
+ }
877
+ this.solutionUpdateStartedSubject.next();
878
+ this.setRuntimeStep(RuntimeStep.UPDATE);
879
+ this.updateRuntimeContext(configurationContextProperties);
880
+ this.configurationService
881
+ .configure(this.runtimeContext, states)
882
+ .pipe(take(1))
883
+ .subscribe(lineItem => {
884
+ const context = this.contextService.resolve();
885
+ this.updateRuntimeContext(context.properties);
886
+ this.solutionUpdatedSubject.next(lineItem);
887
+ }, error => {
888
+ this.displayErrorMessage(error);
889
+ this.solutionUpdatedSubject.next(error);
890
+ });
891
+ }
892
+ stopRuntime(solutionLineItem) {
893
+ this.solutionStopSubject.next(solutionLineItem);
894
+ }
895
+ cancelRuntime() {
896
+ this.solutionCancelSubject.next();
897
+ }
898
+ setRuntimeContext(runtimeContext) {
899
+ this.runtimeContext = runtimeContext;
900
+ }
901
+ getRuntimeContext() {
902
+ return this.runtimeContext;
903
+ }
904
+ solutionProcessed(lineItem) {
905
+ this.solutionProcessedSubject.next(lineItem);
906
+ }
907
+ refreshUI(uiDefinition) {
908
+ if (!this.runtimeContext) {
909
+ return;
910
+ }
911
+ this.runtimeContext = Object.assign(Object.assign({}, this.runtimeContext), { uiDefinition });
912
+ this.uiRefreshSubject.next();
913
+ }
914
+ updateRuntimeContext(configurationContextProperties) {
915
+ if (!this.runtimeContext || !configurationContextProperties) {
916
+ return;
917
+ }
918
+ this.runtimeContext = Object.assign(Object.assign({}, this.runtimeContext), { properties: configurationContextProperties });
919
+ }
920
+ setRuntimeStep(runtimeStep) {
921
+ if (!this.runtimeContext) {
922
+ return;
923
+ }
924
+ this.runtimeContext.invocationContext = Object.assign(Object.assign({}, this.runtimeContext.invocationContext), { runtimeStep });
925
+ }
926
+ }
927
+ RuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService, deps: [{ token: ConfigurationService }, { token: i2.ContextService }, { token: i3$1.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
928
+ RuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService });
929
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService, decorators: [{
930
+ type: Injectable
931
+ }], ctorParameters: function () { return [{ type: ConfigurationService }, { type: i2.ContextService }, { type: i3$1.MessageService }]; } });
932
+
933
+ class ShoppingCartService {
934
+ constructor(priceApiService, contextService, quoteService) {
935
+ this.priceApiService = priceApiService;
936
+ this.contextService = contextService;
937
+ this.quoteService = quoteService;
938
+ }
939
+ setCartExternally(currentState) {
940
+ const context = this.contextService.resolve();
941
+ return this.priceApiService.calculate({ context, currentState }).pipe(take(1), tap(({ lineItems }) => {
942
+ this.quoteService.setCurrentLineItemState(lineItems);
943
+ }));
944
+ }
945
+ getCurrentState() {
946
+ var _a;
947
+ return (_a = this.quoteService.quoteSnapshot) === null || _a === void 0 ? void 0 : _a.currentState;
948
+ }
949
+ }
950
+ ShoppingCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ShoppingCartService, deps: [{ token: i1.PriceApiService }, { token: i2.ContextService }, { token: i2.QuoteDraftService }], target: i0.ɵɵFactoryTarget.Injectable });
951
+ ShoppingCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ShoppingCartService });
952
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ShoppingCartService, decorators: [{
953
+ type: Injectable
954
+ }], ctorParameters: function () { return [{ type: i1.PriceApiService }, { type: i2.ContextService }, { type: i2.QuoteDraftService }]; } });
955
+
956
+ class CurrentStateService {
957
+ constructor() {
958
+ this.currentState = [];
959
+ }
960
+ update(state) {
961
+ this.currentState = state;
962
+ }
963
+ }
964
+ CurrentStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CurrentStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
965
+ CurrentStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CurrentStateService, providedIn: 'root' });
966
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CurrentStateService, decorators: [{
967
+ type: Injectable,
968
+ args: [{ providedIn: 'root' }]
969
+ }] });
970
+
971
+ class ProductModelCacheService {
972
+ constructor(productModelApiService) {
973
+ this.productModelApiService = productModelApiService;
974
+ this.cachedModel = new Map();
975
+ }
976
+ getProductModel(currentModelId, version) {
977
+ if (!this.cachedModel.has(currentModelId) || version) {
978
+ this.clearCache();
979
+ this.cachedModel.set(currentModelId, this.productModelApiService.load(currentModelId, version).pipe(shareReplay(1)));
980
+ }
981
+ return this.cachedModel.get(currentModelId);
982
+ }
983
+ getCachedModel() {
984
+ const ids = Array.from(this.cachedModel.keys());
985
+ return this.cachedModel.get(ids[0]);
986
+ }
987
+ clearCache() {
988
+ this.cachedModel.clear();
989
+ }
990
+ }
991
+ ProductModelCacheService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductModelCacheService, deps: [{ token: i1.ProductModelApiService }], target: i0.ɵɵFactoryTarget.Injectable });
992
+ ProductModelCacheService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductModelCacheService });
993
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductModelCacheService, decorators: [{
994
+ type: Injectable
995
+ }], ctorParameters: function () { return [{ type: i1.ProductModelApiService }]; } });
996
+
997
+ class RuntimeContextService {
998
+ constructor(configurationApiService, messageService, contextService) {
999
+ this.configurationApiService = configurationApiService;
1000
+ this.messageService = messageService;
1001
+ this.contextService = contextService;
1002
+ }
1003
+ getRuntimeContext(productId, offeringId) {
1004
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
1005
+ var _a;
1006
+ const uiDefinition = this.getUIDefinition(runtimeData.uiDefinitions);
1007
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
1008
+ const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
1009
+ return {
1010
+ modelId: runtimeData.modelId,
1011
+ uiDefinition: uiDefinition,
1012
+ runtimeModel: runtimeModel,
1013
+ runtimeMode: RuntimeMode.PROD,
1014
+ productId: productId,
1015
+ productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
1016
+ offeringId: offeringId,
1017
+ properties: {
1018
+ PricingEnabled: uiDefinition.pricingEnabled ? 'true' : 'false',
1019
+ },
1020
+ };
1021
+ }));
1022
+ }
1023
+ getUIDefinition(uiDefinitions = []) {
1024
+ const { uiDefinitionId } = this.contextService.resolve();
1025
+ const findByFn = (uiDef) => (uiDefinitionId ? uiDefinitionId === uiDef.id : uiDef.primary);
1026
+ const uiDefinition = uiDefinitions.find(findByFn) || (uiDefinitions.length === 1 && Object.assign({}, uiDefinitions[0]));
1027
+ if (!uiDefinition) {
1028
+ const errMsg = `Unable to find ${uiDefinitionId ? uiDefinitionId : 'Default'} UI`;
1029
+ this.messageService.add({
1030
+ severity: 'error',
1031
+ summary: 'ERROR',
1032
+ });
1033
+ throw new Error(errMsg);
1034
+ }
1035
+ SectionPathUtil.updateSectionsPath(uiDefinition.sections);
1036
+ return uiDefinition;
1037
+ }
1038
+ }
1039
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }, { token: i3$1.MessageService }, { token: i2.ContextService }], target: i0.ɵɵFactoryTarget.Injectable });
1040
+ RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService });
1041
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, decorators: [{
1042
+ type: Injectable
1043
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i3$1.MessageService }, { type: i2.ContextService }]; } });
1044
+
1045
+ class SectionStoreService {
1046
+ constructor() {
1047
+ this._componentFactories = [];
1048
+ }
1049
+ set componentFactories(data) {
1050
+ this._componentFactories = data;
1051
+ }
1052
+ get componentFactories() {
1053
+ return this._componentFactories;
1054
+ }
1055
+ getComponentFactory(section) {
1056
+ return this.componentFactories.find(f => f.selector === section.dynamicSelector);
1057
+ }
1058
+ }
1059
+ SectionStoreService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1060
+ SectionStoreService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionStoreService });
1061
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionStoreService, decorators: [{
1062
+ type: Injectable
1063
+ }] });
1064
+
1065
+ class SectionScopeService {
1066
+ constructor() {
1067
+ this.indent = 1;
1068
+ this.templates = new BehaviorSubject([]);
1069
+ }
1070
+ get section() {
1071
+ return this._section;
1072
+ }
1073
+ set section(value) {
1074
+ this._section = value;
1075
+ this.indent = this.getIndent(value);
1076
+ }
1077
+ getIndent(section) {
1078
+ if (!section || !section.parentId) {
1079
+ return 1;
1080
+ }
1081
+ else {
1082
+ let current = section;
1083
+ let indent = 1;
1084
+ while (current && current.parent) {
1085
+ current = current.parent;
1086
+ indent++;
1087
+ }
1088
+ return indent;
1089
+ }
1090
+ }
1091
+ }
1092
+ SectionScopeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionScopeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1093
+ SectionScopeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionScopeService });
1094
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionScopeService, decorators: [{
1095
+ type: Injectable
1096
+ }] });
1097
+
1098
+ class ExecutionSectionRendererComponent {
1099
+ constructor(_injector, _m, sectionScope, sectionStore) {
1100
+ this._injector = _injector;
1101
+ this._m = _m;
1102
+ this.sectionScope = sectionScope;
1103
+ this.sectionStore = sectionStore;
1104
+ this.componentRef = null;
1105
+ }
1106
+ set section(value) {
1107
+ this._section = value;
1108
+ this.sectionScope.section = value;
1109
+ }
1110
+ get section() {
1111
+ return this._section;
1112
+ }
1113
+ ngOnInit() {
1114
+ this.renderSection();
1115
+ }
1116
+ ngAfterViewInit() {
1117
+ var _a, _b;
1118
+ if (this.componentRef) {
1119
+ this.sectionScope.templates.next((_b = (_a = this.componentRef.instance['templates']) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : []);
1120
+ }
1121
+ }
1122
+ ngOnDestroy() {
1123
+ if (this.componentRef) {
1124
+ this.componentRef.destroy();
1125
+ this.componentRef = null;
1126
+ }
1127
+ }
1128
+ renderSection() {
1129
+ var _a;
1130
+ if (this.componentRef) {
1131
+ this.componentRef.destroy();
1132
+ this.componentRef = null;
1133
+ }
1134
+ const componentFactory = this.sectionStore.getComponentFactory(this._section);
1135
+ if (!componentFactory) {
1136
+ return;
1137
+ }
1138
+ this.componentRef = componentFactory.create(this._injector, [], null, this._m);
1139
+ this.componentRef.location.nativeElement.setAttribute('sectionId', `${(_a = this._section.model) === null || _a === void 0 ? void 0 : _a.id}${this._section.label}`);
1140
+ this.componentRef.instance['form'] = this.form;
1141
+ this.componentRef.instance['section'] = this.section;
1142
+ this.container.insert(this.componentRef.hostView);
1143
+ }
1144
+ }
1145
+ ExecutionSectionRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ExecutionSectionRendererComponent, deps: [{ token: i0.Injector }, { token: i0.NgModuleRef }, { token: SectionScopeService }, { token: SectionStoreService }], target: i0.ɵɵFactoryTarget.Component });
1146
+ ExecutionSectionRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ExecutionSectionRendererComponent, selector: "section-renderer", inputs: { section: "section", form: "form" }, providers: [SectionScopeService], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #container></ng-template>", styles: [":host{display:contents}\n"] });
1147
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ExecutionSectionRendererComponent, decorators: [{
1148
+ type: Component,
1149
+ args: [{
1150
+ // eslint-disable-next-line @angular-eslint/component-selector
1151
+ selector: 'section-renderer',
1152
+ templateUrl: 'execution-section-renderer.component.html',
1153
+ styleUrls: ['execution-section-renderer.component.scss'],
1154
+ providers: [SectionScopeService],
1155
+ }]
1156
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.NgModuleRef }, { type: SectionScopeService }, { type: SectionStoreService }]; }, propDecorators: { section: [{
1157
+ type: Input
1158
+ }], form: [{
1159
+ type: Input
1160
+ }], container: [{
1161
+ type: ViewChild,
1162
+ args: ['container', { read: ViewContainerRef, static: true }]
1163
+ }] } });
1164
+
1165
+ class ChildrenPlaceholderComponent {
1166
+ constructor(sectionScope, formScope, collapsibleState) {
1167
+ this.sectionScope = sectionScope;
1168
+ this.formScope = formScope;
1169
+ this.collapsibleState = collapsibleState;
1170
+ this._children = [];
1171
+ this.collapsed = false;
1172
+ }
1173
+ ngOnInit() {
1174
+ this.section = this.sectionScope.section;
1175
+ this.form = this.formScope.form;
1176
+ this.collapsed = this.section.model ? this.collapsibleState.isCollapsedSection(this.section.model.id) : true;
1177
+ this.sub = this.collapsibleState.collapseSectionEvent.subscribe(e => {
1178
+ var _a;
1179
+ const lineItemId = e[0];
1180
+ if (((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.id) === lineItemId) {
1181
+ this.collapsed = e[1];
1182
+ }
1183
+ });
1184
+ this.setChildren();
1185
+ }
1186
+ ngOnChanges(changes) {
1187
+ var _a, _b;
1188
+ if (!this.children || ((_a = changes.children) === null || _a === void 0 ? void 0 : _a.currentValue) !== ((_b = changes.children) === null || _b === void 0 ? void 0 : _b.previousValue)) {
1189
+ this.setChildren();
1190
+ }
1191
+ }
1192
+ setChildren() {
1193
+ this._children = this.children ? this.children : this.section.children;
1194
+ }
1195
+ ngOnDestroy() {
1196
+ this.sub.unsubscribe();
1197
+ }
1198
+ }
1199
+ ChildrenPlaceholderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChildrenPlaceholderComponent, deps: [{ token: SectionScopeService }, { token: FormScopeService }, { token: CollapsibleStateService }], target: i0.ɵɵFactoryTarget.Component });
1200
+ ChildrenPlaceholderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ChildrenPlaceholderComponent, selector: "children-placeholder", inputs: { children: "children" }, providers: [OrderByPipe], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"!collapsed\">\n <ng-container *ngFor=\"let child of _children\">\n <section-renderer [section]=\"child\" [form]=\"form\" *ngIf=\"!child.hidden\"></section-renderer>\n </ng-container>\n</ng-container>\n", components: [{ type: ExecutionSectionRendererComponent, selector: "section-renderer", inputs: ["section", "form"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ChildrenPlaceholderComponent, decorators: [{
1202
+ type: Component,
1203
+ args: [{
1204
+ // eslint-disable-next-line @angular-eslint/component-selector
1205
+ selector: 'children-placeholder',
1206
+ templateUrl: 'children-placeholder.component.html',
1207
+ providers: [OrderByPipe],
1208
+ }]
1209
+ }], ctorParameters: function () { return [{ type: SectionScopeService }, { type: FormScopeService }, { type: CollapsibleStateService }]; }, propDecorators: { children: [{
1210
+ type: Input
1211
+ }] } });
1212
+ class TemplateComponent extends ChildrenPlaceholderComponent {
1213
+ }
1214
+ TemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1215
+ TemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TemplateComponent, selector: "template-component", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"!collapsed\">\n <ng-container *ngFor=\"let child of _children\">\n <section-renderer [section]=\"child\" [form]=\"form\" *ngIf=\"!child.hidden\"></section-renderer>\n </ng-container>\n</ng-container>\n", components: [{ type: ExecutionSectionRendererComponent, selector: "section-renderer", inputs: ["section", "form"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplateComponent, decorators: [{
1217
+ type: Component,
1218
+ args: [{
1219
+ // eslint-disable-next-line @angular-eslint/component-selector
1220
+ selector: 'template-component',
1221
+ templateUrl: 'children-placeholder.component.html',
1222
+ }]
1223
+ }] });
1224
+
1225
+ class ContextProviderComponent {
1226
+ constructor(runtimeService) {
1227
+ this.runtimeService = runtimeService;
1228
+ this.types = [];
1229
+ this.products = {};
1230
+ }
1231
+ ngOnInit() {
1232
+ const context = this.runtimeService.getRuntimeContext();
1233
+ if (!context) {
1234
+ return;
1235
+ }
1236
+ this.runtimeService.setRuntimeContext(Object.assign(Object.assign({}, context), { runtimeModel: RuntimeModel.create(this.types, this.products) }));
1237
+ }
1238
+ }
1239
+ ContextProviderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextProviderComponent, deps: [{ token: RuntimeService }], target: i0.ɵɵFactoryTarget.Component });
1240
+ ContextProviderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ContextProviderComponent, selector: "vl-context-provider", inputs: { types: "types", products: "products" }, ngImport: i0, template: '', isInline: true });
1241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextProviderComponent, decorators: [{
1242
+ type: Component,
1243
+ args: [{
1244
+ selector: 'vl-context-provider',
1245
+ template: '',
1246
+ }]
1247
+ }], ctorParameters: function () { return [{ type: RuntimeService, decorators: [{
1248
+ type: Inject,
1249
+ args: [RuntimeService]
1250
+ }] }]; }, propDecorators: { types: [{
1251
+ type: Input
1252
+ }], products: [{
1253
+ type: Input
1254
+ }] } });
1255
+
1256
+ const moduleMap = {};
1257
+ function loadRemoteEntry(remoteEntry) {
1258
+ return new Promise((resolve, reject) => {
1259
+ if (moduleMap[remoteEntry]) {
1260
+ resolve();
1261
+ return;
1262
+ }
1263
+ const script = document.createElement('script');
1264
+ script.src = remoteEntry;
1265
+ script.onerror = reject;
1266
+ script.onload = () => {
1267
+ moduleMap[remoteEntry] = true;
1268
+ resolve(); // window is the global namespace
1269
+ };
1270
+ document.body.append(script);
1271
+ });
1272
+ }
1273
+ function lookupExposedModule(remoteName, exposedModule) {
1274
+ return __awaiter(this, void 0, void 0, function* () {
1275
+ // Initializes the share scope. This fills it with known provided modules from this build and all remotes
1276
+ yield __webpack_init_sharing__('default');
1277
+ const container = window[remoteName]; // or get the container somewhere else
1278
+ // Initialize the container, it may provide shared modules
1279
+ yield container.init(__webpack_share_scopes__.default);
1280
+ const factory = yield container.get(exposedModule);
1281
+ const Module = factory();
1282
+ return Module;
1283
+ });
1284
+ }
1285
+ function loadRemoteModule(options) {
1286
+ return __awaiter(this, void 0, void 0, function* () {
1287
+ yield loadRemoteEntry(options.remoteEntry);
1288
+ return yield lookupExposedModule(options.remoteName, options.exposedModule);
1289
+ });
1290
+ }
1291
+
1292
+ var IntegrationEvent;
1293
+ (function (IntegrationEvent) {
1294
+ IntegrationEvent["Init"] = "Init";
1295
+ })(IntegrationEvent || (IntegrationEvent = {}));
1296
+ class FederatedComponent {
1297
+ constructor(injector, compiler, appRef, renderer) {
1298
+ this.injector = injector;
1299
+ this.compiler = compiler;
1300
+ this.appRef = appRef;
1301
+ this.renderer = renderer;
1302
+ this.integrationEvent = new EventEmitter();
1303
+ this.moduleReady = false;
1304
+ }
1305
+ ngAfterViewInit() {
1306
+ if (!this.remoteEntry || !this.remoteName || !this.exposedModule) {
1307
+ return;
1308
+ }
1309
+ loadRemoteModule({
1310
+ remoteEntry: this.remoteEntry,
1311
+ remoteName: this.remoteName,
1312
+ exposedModule: this.exposedModule,
1313
+ }).then(federated => {
1314
+ this.compiler.compileModuleAsync(federated[this.exposedModule]).then(moduleFactory => {
1315
+ var _a;
1316
+ const rootModuleRef = moduleFactory.create(this.injector);
1317
+ const rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[this.exposedModule].rootComponent);
1318
+ const node = document.createElement('div');
1319
+ const { instance, hostView } = rootComponentFactory.create(this.injector, [], node);
1320
+ this.instance = instance;
1321
+ this.instance.data = this.data;
1322
+ this.instance.eventData = this.eventData;
1323
+ this.instance.integrationEvent = this.integrationEvent;
1324
+ this.renderer.appendChild((_a = this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
1325
+ this.appRef.attachView(hostView);
1326
+ });
1327
+ });
1328
+ }
1329
+ ngOnChanges(changes) {
1330
+ if (!this.instance) {
1331
+ return;
1332
+ }
1333
+ this.instance.ngOnChanges(changes);
1334
+ }
1335
+ }
1336
+ FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }, { token: i0.Compiler }, { token: i0.ApplicationRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1337
+ FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", eventData: "eventData" }, outputs: { integrationEvent: "integrationEvent" }, viewQueries: [{ propertyName: "federatedComponent", first: true, predicate: ["federatedComponent"], descendants: true, read: ViewContainerRef }, { propertyName: "foo", first: true, predicate: ["foo"], descendants: true, read: TemplateRef }, { propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #moduleHost></div>\n", styles: [":host{display:block}div{height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, decorators: [{
1339
+ type: Component,
1340
+ args: [{
1341
+ // eslint-disable-next-line @angular-eslint/component-selector
1342
+ selector: 'veloce-host-federated',
1343
+ templateUrl: './federated.component.html',
1344
+ styleUrls: ['./federated.component.scss'],
1345
+ changeDetection: ChangeDetectionStrategy.OnPush,
1346
+ }]
1347
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }, { type: i0.ApplicationRef }, { type: i0.Renderer2 }]; }, propDecorators: { federatedComponent: [{
1348
+ type: ViewChild,
1349
+ args: ['federatedComponent', { read: ViewContainerRef }]
1350
+ }], foo: [{
1351
+ type: ViewChild,
1352
+ args: ['foo', { read: TemplateRef }]
1353
+ }], moduleHostRef: [{
1354
+ type: ViewChild,
1355
+ args: ['moduleHost', { static: false }]
1356
+ }], remoteEntry: [{
1357
+ type: Input
1358
+ }], remoteName: [{
1359
+ type: Input
1360
+ }], exposedModule: [{
1361
+ type: Input
1362
+ }], data: [{
1363
+ type: Input
1364
+ }], eventData: [{
1365
+ type: Input
1366
+ }], integrationEvent: [{
1367
+ type: Output
1368
+ }] } });
1369
+
1370
+ //TODO ALE WE ARE EXTENDING COMPONENT HERE IN PORTS WE ARE EXTENDING DEDICATED CLASS!! TYPES HANDLER IS NO IMPLEMENTED YET
1371
+ class VeloAttributeDirective {
1372
+ constructor(formScope, sectionScope) {
1373
+ this.formScope = formScope;
1374
+ this.sectionScope = sectionScope;
1375
+ this.valueQuantities = {};
1376
+ this.form = this.formScope.form;
1377
+ this.section = this.sectionScope.section;
1378
+ }
1379
+ ngOnInit() {
1380
+ this.initQuantity();
1381
+ }
1382
+ handleChange(valueOption) {
1383
+ const updateData = {
1384
+ id: this.section.id,
1385
+ action: 'update',
1386
+ valueOption,
1387
+ };
1388
+ this.formScope.publishFormUpdate(updateData);
1389
+ }
1390
+ handleChangDate(valueOption) {
1391
+ const oldValue = this.form.controls[this.section.id].value || '';
1392
+ const newValue = isDate(valueOption) ? valueOption.toLocaleDateString('en-us') : '';
1393
+ if (oldValue !== newValue) {
1394
+ this.handleChange(newValue);
1395
+ }
1396
+ }
1397
+ handleRemove() {
1398
+ const updateData = {
1399
+ id: this.section.id,
1400
+ action: 'remove',
1401
+ };
1402
+ this.formScope.publishFormUpdate(updateData);
1403
+ }
1404
+ // TODO ALE THIS IS SPECIFIC STEPPER FUNCTIONS
1405
+ nextVal() {
1406
+ const currentIndex = this.getCurrentValueIndex();
1407
+ const nextValIndex = currentIndex + 1;
1408
+ if (currentIndex != -1 &&
1409
+ this.section.sectionValue &&
1410
+ this.section.sectionValue.valueOptions.length >= nextValIndex) {
1411
+ this.handleChange(this.section.sectionValue.valueOptions[nextValIndex]);
1412
+ }
1413
+ }
1414
+ prevVal() {
1415
+ const currentIndex = this.getCurrentValueIndex();
1416
+ const prevValIndex = currentIndex - 1;
1417
+ if (currentIndex != -1 &&
1418
+ this.section.sectionValue &&
1419
+ this.section.sectionValue.valueOptions.length >= prevValIndex) {
1420
+ this.handleChange(this.section.sectionValue.valueOptions[prevValIndex]);
1421
+ }
1422
+ }
1423
+ initQuantity() {
1424
+ this.valueQuantities = this.section.model
1425
+ ? SectionsBinderHelper.getQuantityGroupByValue(this.section.model, this.section.boundData.name)
1426
+ : {};
1427
+ }
1428
+ getCurrentValueIndex() {
1429
+ const index = -1;
1430
+ const valueOptions = this.section.sectionValue && this.section.sectionValue.valueOptions;
1431
+ const currentValue = this.form.controls[this.section.id].value;
1432
+ if (valueOptions && EntityUtil.isPresent(currentValue)) {
1433
+ return valueOptions.findIndex(valueOption => currentValue === valueOption);
1434
+ }
1435
+ return index;
1436
+ }
1437
+ }
1438
+ VeloAttributeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloAttributeDirective, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Directive });
1439
+ VeloAttributeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: VeloAttributeDirective, selector: "velo-attribute-directive", exportAs: ["attributeApi"], ngImport: i0 });
1440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloAttributeDirective, decorators: [{
1441
+ type: Directive,
1442
+ args: [{
1443
+ // eslint-disable-next-line @angular-eslint/directive-selector
1444
+ selector: 'velo-attribute-directive',
1445
+ exportAs: 'attributeApi',
1446
+ }]
1447
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
1448
+
1449
+ class MultiselectComponent {
1450
+ constructor(elRef, viewContainerRef, overlay) {
1451
+ this.elRef = elRef;
1452
+ this.viewContainerRef = viewContainerRef;
1453
+ this.overlay = overlay;
1454
+ this.selectionChange = new EventEmitter();
1455
+ this.selected = [];
1456
+ this.displayValue = '';
1457
+ this.touched = false;
1458
+ this.disabled = false;
1459
+ this.opened = false;
1460
+ this.onChange = () => {
1461
+ return;
1462
+ };
1463
+ this.onTouched = () => {
1464
+ return;
1465
+ };
1466
+ }
1467
+ ngOnDestroy() {
1468
+ this.destroyDropdown();
1469
+ }
1470
+ writeValue(selected) {
1471
+ this.selected = selected;
1472
+ this.getDisplayValue();
1473
+ }
1474
+ registerOnChange(onChange) {
1475
+ this.onChange = onChange;
1476
+ }
1477
+ registerOnTouched(onTouched) {
1478
+ this.onTouched = onTouched;
1479
+ }
1480
+ setDisabledState(disabled) {
1481
+ this.disabled = disabled;
1482
+ }
1483
+ handleSelection(value) {
1484
+ const selectedItem = this.selected.find(item => item === value);
1485
+ if (selectedItem) {
1486
+ this.selected = this.selected.filter(item => item !== value);
1487
+ }
1488
+ else {
1489
+ this.selected = [...this.selected, value];
1490
+ }
1491
+ this.getDisplayValue();
1492
+ this.selectionChange.emit(this.selected);
1493
+ this.onChange(this.selected);
1494
+ }
1495
+ toggleOpened() {
1496
+ this.opened ? this.destroyDropdown() : this.openDropdown();
1497
+ }
1498
+ getDisplayValue() {
1499
+ const joinedValue = this.selected.join(', ');
1500
+ this.displayValue = joinedValue.length > 24 ? `${this.selected.length} options selected` : joinedValue;
1501
+ }
1502
+ openDropdown() {
1503
+ this.opened = true;
1504
+ this.overlayRef = this.overlay.create({
1505
+ hasBackdrop: true,
1506
+ backdropClass: 'cdk-overlay-transparent-backdrop',
1507
+ scrollStrategy: this.overlay.scrollStrategies.close(),
1508
+ positionStrategy: this.overlay
1509
+ .position()
1510
+ .flexibleConnectedTo(this.elRef)
1511
+ .withPositions([
1512
+ {
1513
+ originX: 'end',
1514
+ originY: 'bottom',
1515
+ overlayX: 'end',
1516
+ overlayY: 'top',
1517
+ offsetY: 8,
1518
+ },
1519
+ ]),
1520
+ });
1521
+ const templatePortal = new TemplatePortal(this.overlayTemplate, this.viewContainerRef);
1522
+ this.overlayRef.attach(templatePortal);
1523
+ this.dropdownClosingActionsSub = this.dropdownClosingActions().subscribe(() => this.destroyDropdown());
1524
+ }
1525
+ dropdownClosingActions() {
1526
+ if (!this.overlayRef) {
1527
+ return of();
1528
+ }
1529
+ const backdropClick$ = this.overlayRef.backdropClick();
1530
+ const detachment$ = this.overlayRef.detachments();
1531
+ return merge(backdropClick$, detachment$);
1532
+ }
1533
+ destroyDropdown() {
1534
+ var _a;
1535
+ if (!this.overlayRef || !this.opened) {
1536
+ return;
1537
+ }
1538
+ (_a = this.dropdownClosingActionsSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1539
+ this.opened = false;
1540
+ this.overlayRef.detach();
1541
+ }
1542
+ }
1543
+ MultiselectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MultiselectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i1$1.Overlay }], target: i0.ɵɵFactoryTarget.Component });
1544
+ MultiselectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: MultiselectComponent, selector: "velo-multiselect", inputs: { options: "options" }, outputs: { selectionChange: "selectionChange" }, host: { properties: { "class.opened": "this.opened" } }, providers: [
1545
+ {
1546
+ provide: NG_VALUE_ACCESSOR,
1547
+ multi: true,
1548
+ useExisting: MultiselectComponent,
1549
+ },
1550
+ ], viewQueries: [{ propertyName: "overlayTemplate", first: true, predicate: ["overlayTemplate"], descendants: true }], ngImport: i0, template: "<div class=\"value-wrapper\" (click)=\"toggleOpened()\">\n <span class=\"value\">{{ displayValue }}</span>\n <i class=\"fa fa-chevron-down\"></i>\n</div>\n\n<ng-template #overlayTemplate>\n <div class=\"dropdown\">\n <div class=\"checkbox-select\" *ngFor=\"let option of options\">\n <label>\n <input\n type=\"checkbox\"\n [checked]=\"selected.includes(option)\"\n (change)=\"handleSelection(option)\"\n [value]=\"option\"\n />\n\n <i class=\"input-helper\"></i>\n {{ option }}\n </label>\n </div>\n </div>\n</ng-template>\n", styles: [":host{display:block;width:172px}:host[disabled] .value-wrapper{pointer-events:none;background:rgba(0,0,0,.06);border-color:#0003}:host.opened .value-wrapper{border-color:#0e8fff}:host.opened i{transform:rotate(180deg)}:host .value-wrapper{cursor:pointer;display:flex;align-items:center;justify-content:space-between;height:34px;padding:0 10px;border:1px solid #ddd;border-radius:3px;background:#fff}:host .value-wrapper .value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dropdown{width:172px;max-height:200px;background:#fff;border:1px solid #ddd;border-radius:3px;overflow:auto}.dropdown .checkbox-select{padding:0 10px;width:100%}.dropdown .checkbox-select label{width:100%;height:36px;line-height:36px}.dropdown .checkbox-select .input-helper:before{top:10px}.dropdown .checkbox-select .input-helper:after{top:12px}.dropdown .checkbox-select:hover{background:#d5dddf}\n"], directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1551
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MultiselectComponent, decorators: [{
1552
+ type: Component,
1553
+ args: [{
1554
+ // eslint-disable-next-line @angular-eslint/component-selector
1555
+ selector: 'velo-multiselect',
1556
+ templateUrl: 'velo-multiselect.component.html',
1557
+ styleUrls: ['./velo-multiselect.component.scss'],
1558
+ providers: [
1559
+ {
1560
+ provide: NG_VALUE_ACCESSOR,
1561
+ multi: true,
1562
+ useExisting: MultiselectComponent,
1563
+ },
1564
+ ],
1565
+ }]
1566
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i1$1.Overlay }]; }, propDecorators: { options: [{
1567
+ type: Input
1568
+ }], selectionChange: [{
1569
+ type: Output
1570
+ }], overlayTemplate: [{
1571
+ type: ViewChild,
1572
+ args: ['overlayTemplate']
1573
+ }], opened: [{
1574
+ type: HostBinding,
1575
+ args: ['class.opened']
1576
+ }] } });
1577
+
1578
+ class VeloAttributeComponent extends VeloAttributeDirective {
1579
+ constructor(formScope, sectionScope) {
1580
+ var _a, _b;
1581
+ super(formScope, sectionScope);
1582
+ this.controlName = this.section.id;
1583
+ this.displayName = this.getDisplayName();
1584
+ this.isMultiselect =
1585
+ ((_b = (_a = this.section.model) === null || _a === void 0 ? void 0 : _a.attributes.find(attr => attr.name === this.section.boundData.entity.name)) === null || _b === void 0 ? void 0 : _b.type) ===
1586
+ 'MULTIPLE';
1587
+ }
1588
+ getValueOptions(valueOptions) {
1589
+ return this.isBooleanType(valueOptions) ? [0, 1] : valueOptions;
1590
+ }
1591
+ getValueText(valueOptions, value) {
1592
+ if (this.isBooleanType(valueOptions)) {
1593
+ return value === 0 ? 'False' : 'True';
1594
+ }
1595
+ return value;
1596
+ }
1597
+ handleMultiselectChange(value) {
1598
+ var _a;
1599
+ const formControl = this.form.get(this.controlName);
1600
+ if (!formControl) {
1601
+ return;
1602
+ }
1603
+ const currentValue = (_a = formControl.value) !== null && _a !== void 0 ? _a : [];
1604
+ const newValue = currentValue.includes(value) ? currentValue.filter(v => v !== value) : [...currentValue, value];
1605
+ formControl.setValue(newValue);
1606
+ super.handleChange();
1607
+ }
1608
+ handleMultipleDropdownChange(event) {
1609
+ const formControl = this.form.get(this.controlName);
1610
+ if (!formControl) {
1611
+ return;
1612
+ }
1613
+ formControl.setValue(event);
1614
+ super.handleChange();
1615
+ }
1616
+ isBooleanType(value) {
1617
+ return Array.isArray(value) && value.length === 1 && value[0].min === 0 && value[0].max === 1;
1618
+ }
1619
+ getDisplayName() {
1620
+ var _a, _b;
1621
+ return ((((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.properties) && this.section.model.properties['displayName']) || ((_b = this.section.model) === null || _b === void 0 ? void 0 : _b.type) || '');
1622
+ }
1623
+ }
1624
+ VeloAttributeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloAttributeComponent, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Component });
1625
+ VeloAttributeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloAttributeComponent, selector: "velo-attribute", usesInheritance: true, ngImport: i0, template: "<div class=\"form-group div-inline\" [formGroup]=\"form\">\n <div class=\"input-form-input div-inline\" [class.input-form-input--required]=\"section.required\">\n <label>\n <ng-container *ngIf=\"section.required\"> * </ng-container>\n\n {{ section.label }}\n </label>\n <div [ngSwitch]=\"section.controlType\" class=\"form-control-wrapper\">\n <div *ngSwitchCase=\"'DROPDOWN'\">\n <select\n [id]=\"controlName\"\n [formControlName]=\"controlName\"\n class=\"form-control\"\n (change)=\"handleChange()\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n >\n <option\n *ngFor=\"let valueOption of getValueOptions(section.sectionValue?.valueOptions) || []\"\n [ngValue]=\"valueOption\"\n >\n {{ getValueText(section.sectionValue?.valueOptions, valueOption) }}\n </option>\n </select>\n </div>\n\n <div *ngSwitchCase=\"'MULTISELECT'\">\n <velo-multiselect\n [id]=\"controlName\"\n [formControlName]=\"controlName\"\n [options]=\"getValueOptions(section.sectionValue?.valueOptions)\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n (selectionChange)=\"handleMultipleDropdownChange($event)\"\n ></velo-multiselect>\n </div>\n\n <div *ngSwitchCase=\"'RADIO'\">\n <div\n *ngFor=\"let valueOption of getValueOptions(section.sectionValue?.valueOptions)\"\n class=\"radio-button\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n >\n <label>\n <input\n type=\"radio\"\n [id]=\"controlName\"\n [formControlName]=\"controlName\"\n [value]=\"valueOption\"\n (change)=\"handleChange()\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n />\n <i class=\"input-helper\"></i>\n {{ getValueText(section.sectionValue?.valueOptions, valueOption) }}\n </label>\n </div>\n </div>\n\n <div *ngSwitchCase=\"'CHECKBOX'\">\n <ng-container *ngIf=\"!isMultiselect; else multiselect\">\n <div class=\"checkbox-select\" [attr.disabled]=\"section.readOnly ? true : null\">\n <label>\n <input\n type=\"checkbox\"\n [id]=\"controlName\"\n [formControlName]=\"controlName\"\n [checked]=\"section.sectionValue?.value === 1\"\n (change)=\"handleChange()\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n />\n\n <i class=\"input-helper\"></i>\n &nbsp;\n </label>\n </div>\n </ng-container>\n\n <ng-template #multiselect>\n <div\n *ngFor=\"let valueOption of getValueOptions(section.sectionValue?.valueOptions)\"\n class=\"checkbox-select\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n >\n <label>\n <input\n type=\"checkbox\"\n [id]=\"controlName\"\n [checked]=\"section.sectionValue?.value.includes(valueOption)\"\n (change)=\"handleMultiselectChange(valueOption)\"\n [value]=\"valueOption\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n />\n\n <i class=\"input-helper\"></i>\n {{ valueOption }}\n </label>\n </div>\n </ng-template>\n </div>\n\n <div *ngSwitchCase=\"'DATE'\">\n <input\n type=\"text\"\n class=\"form-control\"\n [id]=\"controlName\"\n [formControlName]=\"controlName\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n (bsValueChange)=\"handleChangDate($event)\"\n bsDatepicker\n />\n </div>\n\n <div *ngSwitchDefault>\n <input\n type=\"text\"\n class=\"form-control\"\n [id]=\"controlName\"\n [formControlName]=\"controlName\"\n (blur)=\"form.controls[controlName].dirty && handleChange()\"\n [attr.disabled]=\"section.readOnly ? true : null\"\n />\n </div>\n\n <!-- Add validation messages -->\n <!-- <div validation-messages [form]=\"form\" [controlId]=\"controlName\" [showForPristine]=\"true\"></div> -->\n </div>\n </div>\n</div>\n", components: [{ type: MultiselectComponent, selector: "velo-multiselect", inputs: ["options"], outputs: ["selectionChange"] }], directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i4.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i5.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
1626
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloAttributeComponent, decorators: [{
1627
+ type: Component,
1628
+ args: [{
1629
+ // eslint-disable-next-line @angular-eslint/component-selector
1630
+ selector: 'velo-attribute',
1631
+ templateUrl: 'velo-attribute.component.html',
1632
+ }]
1633
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
1634
+
1635
+ class VeloPortCheckBoxComponent {
1636
+ constructor(formScope, sectionScope) {
1637
+ var _a;
1638
+ this.formScope = formScope;
1639
+ this.sectionScope = sectionScope;
1640
+ this.showSelectAll = false;
1641
+ this.form = this.formScope.form;
1642
+ this.section = this.sectionScope.section;
1643
+ this.controlName = this.section.id;
1644
+ (_a = this.section.sectionValue) === null || _a === void 0 ? void 0 : _a.valueOptions.forEach(item => {
1645
+ if (this.hasValueFor(item)) {
1646
+ this.form.controls[this.controlName].setValue(item);
1647
+ }
1648
+ });
1649
+ }
1650
+ handleChange(valueOption) {
1651
+ const updateData = {
1652
+ id: this.section.id,
1653
+ action: this.hasValueFor(valueOption)
1654
+ ? 'remove'
1655
+ : this.section.model && SectionsBinderHelper.isAddAllowed(this.section.model, this.section.boundData.name)
1656
+ ? 'create'
1657
+ : 'update',
1658
+ valueOption,
1659
+ };
1660
+ this.formScope.publishFormUpdate(updateData);
1661
+ }
1662
+ hasValueFor(valueOption) {
1663
+ return !!this.findLineItemForValue(valueOption);
1664
+ }
1665
+ selectAllChange() {
1666
+ var _a;
1667
+ const portDomain = (_a = this.section.model) === null || _a === void 0 ? void 0 : _a.portDomains[this.section.boundData.name];
1668
+ const updateData = {
1669
+ id: this.section.id,
1670
+ action: 'upsert',
1671
+ selectedValueOptions: this.isAllSelected() ? [] : portDomain ? portDomain.domainTypes.map(t => t.name) : [],
1672
+ };
1673
+ this.formScope.publishFormUpdate(updateData);
1674
+ }
1675
+ isAllSelected() {
1676
+ var _a, _b;
1677
+ const selected = (_a = this.section.model) === null || _a === void 0 ? void 0 : _a.lineItems.filter(li => li.port && li.port === this.section.boundData.name);
1678
+ const portDomain = (_b = this.section.model) === null || _b === void 0 ? void 0 : _b.portDomains[this.section.boundData.name];
1679
+ return portDomain ? portDomain.domainTypes.length === (selected === null || selected === void 0 ? void 0 : selected.length) : false;
1680
+ }
1681
+ getMessages(valueOption) {
1682
+ var _a, _b, _c;
1683
+ if ((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.lineItems) {
1684
+ return (_c = (_b = this.findLineItemForValue(valueOption)) === null || _b === void 0 ? void 0 : _b.messages) !== null && _c !== void 0 ? _c : [];
1685
+ }
1686
+ return [];
1687
+ }
1688
+ findLineItemForValue(valueOption) {
1689
+ var _a;
1690
+ return (((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.lineItems) &&
1691
+ this.section.model.lineItems.find(li => li.type && li.type.toLowerCase() === valueOption.toLowerCase()));
1692
+ }
1693
+ }
1694
+ VeloPortCheckBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortCheckBoxComponent, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Component });
1695
+ VeloPortCheckBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloPortCheckBoxComponent, selector: "velo-port-checkbox", inputs: { showSelectAll: "showSelectAll" }, ngImport: i0, template: "<div [formGroup]=\"form\">\n <!--TODO ALE replace divs with ng-templates-->\n <div *ngIf=\"showSelectAll\">\n <div class=\"row no-gutter clearfix\">\n <div class=\"col-md-12\">\n <div class=\"content\">\n <div class=\"container-box container-box-bordered container-box-checkbox collapsed\">\n <div class=\"box-title\">\n <div class=\"header clearfix\">\n <div class=\"checkbox-select\">\n <label>\n <input type=\"checkbox\" (change)=\"selectAllChange()\" [checked]=\"isAllSelected()\" />\n\n <i class=\"input-helper\"></i>\n Select All\n </label>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div *ngFor=\"let valueOption of section.sectionValue?.valueOptions\">\n <div class=\"unchecked\">\n <div class=\"row no-gutter clearfix\">\n <div class=\"col-md-12\">\n <div class=\"content\">\n <div class=\"container-box container-box-bordered container-box-checkbox collapsed\">\n <div class=\"box-title\" (click)=\"handleChange(valueOption)\">\n <div class=\"header clearfix\">\n <div class=\"checkbox-select\">\n <label>\n <input\n type=\"checkbox\"\n [class.checkbox--checked]=\"valueOption === form.controls[controlName].value\"\n />\n\n <i class=\"input-helper\"></i>\n {{section.sectionValue?.displayValues?.[valueOption] || valueOption}}\n </label>\n </div>\n </div>\n\n <div class=\"box-actions\" *ngIf=\"hasValueFor(valueOption)\">\n <ng-template #msgTemplate>\n <div class=\"runtime-info-message\">\n <ul class=\"message-text\">\n <li *ngFor=\"let message of getMessages(valueOption)\">{{ message }}</li>\n </ul>\n </div>\n </ng-template>\n <div\n class=\"box-action-button\"\n *ngIf=\"getMessages(valueOption).length > 0\"\n [popover]=\"msgTemplate\"\n placement=\"left\"\n container=\"body\"\n [isOpen]=\"true\"\n >\n <a href=\"javascript:void(0);\">\n <i class=\"fa fa-info check-icon\"></i>\n </a>\n </div>\n </div>\n </div>\n <div class=\"box-content-wrapper\">\n <div class=\"box-content\">&nbsp;</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n<ng-content></ng-content>\n", directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.PopoverDirective, selector: "[popover]", inputs: ["outsideClick", "containerClass", "isOpen", "adaptivePosition", "popover", "popoverContext", "popoverTitle", "placement", "triggers", "container", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }] });
1696
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortCheckBoxComponent, decorators: [{
1697
+ type: Component,
1698
+ args: [{
1699
+ // eslint-disable-next-line @angular-eslint/component-selector
1700
+ selector: 'velo-port-checkbox',
1701
+ templateUrl: 'velo-port-checkbox.component.html',
1702
+ }]
1703
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; }, propDecorators: { showSelectAll: [{
1704
+ type: Input
1705
+ }] } });
1706
+
1707
+ class VeloPortDropdownComponent {
1708
+ constructor(formScope, sectionScope) {
1709
+ var _a;
1710
+ this.formScope = formScope;
1711
+ this.sectionScope = sectionScope;
1712
+ this.prices = {};
1713
+ this.form = this.formScope.form;
1714
+ this.section = this.sectionScope.section;
1715
+ this.controlName = this.section.id;
1716
+ this.qtyControlName = this.section.id + 'qty';
1717
+ if (this.section.pricingEnabled) {
1718
+ (_a = this.section.sectionValue) === null || _a === void 0 ? void 0 : _a.valueOptions.forEach(valueOption => {
1719
+ this.prices[valueOption] = this.findPriceItemsForValue(valueOption);
1720
+ });
1721
+ }
1722
+ }
1723
+ isAddAllowed() {
1724
+ if (!EntityUtil.isPresent(this.form.controls[this.controlName].value)) {
1725
+ return false;
1726
+ }
1727
+ return this.section.model
1728
+ ? SectionsBinderHelper.isAddAllowed(this.section.model, this.section.boundData.name)
1729
+ : false;
1730
+ }
1731
+ handleCreate() {
1732
+ if (this.form.invalid || !this.isAddAllowed()) {
1733
+ return;
1734
+ }
1735
+ const updateData = {
1736
+ id: this.section.id,
1737
+ action: 'create',
1738
+ };
1739
+ this.formScope.publishFormUpdate(updateData);
1740
+ }
1741
+ findPriceItemsForValue(valueOption) {
1742
+ var _a;
1743
+ let prices = [];
1744
+ if (valueOption) {
1745
+ const portDomain = (_a = this.section.model) === null || _a === void 0 ? void 0 : _a.portDomains[this.section.boundData.name];
1746
+ const domainType = portDomain === null || portDomain === void 0 ? void 0 : portDomain.domainTypes.find(d => d.name.toLowerCase() === valueOption.toLowerCase());
1747
+ if (domainType && domainType.recommendedPrices) {
1748
+ prices = domainType.recommendedPrices;
1749
+ }
1750
+ }
1751
+ const oneTime = {
1752
+ chargeMethod: 'ONE_TIME',
1753
+ netPrice: 0,
1754
+ listPrice: 0,
1755
+ chargeType: '',
1756
+ };
1757
+ const recurring = {
1758
+ chargeMethod: 'RECURRING',
1759
+ netPrice: 0,
1760
+ listPrice: 0,
1761
+ chargeType: '',
1762
+ };
1763
+ prices.forEach(p => {
1764
+ if (p.chargeMethod === oneTime.chargeMethod) {
1765
+ this.add(oneTime, p);
1766
+ }
1767
+ if (p.chargeMethod === recurring.chargeMethod) {
1768
+ this.add(recurring, p);
1769
+ }
1770
+ });
1771
+ const result = [];
1772
+ if (oneTime.listPrice > 0) {
1773
+ result.push(oneTime);
1774
+ }
1775
+ if (recurring.listPrice > 0) {
1776
+ result.push(recurring);
1777
+ }
1778
+ return result;
1779
+ }
1780
+ add(target, src) {
1781
+ target.netPrice = target.netPrice + src.netPrice;
1782
+ target.listPrice = target.listPrice + src.listPrice;
1783
+ if (src.explanation) {
1784
+ target.explanation = src.explanation;
1785
+ }
1786
+ }
1787
+ }
1788
+ VeloPortDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortDropdownComponent, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Component });
1789
+ VeloPortDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloPortDropdownComponent, selector: "velo-port-dropdown", ngImport: i0, template: "<div class=\"form-group col-md-12\" [formGroup]=\"form\">\n <div class=\"input-form-input div-inline\">\n <label [for]=\"controlName\">{{ section.label }}</label>\n <div class=\"form-control-wrapper\">\n <select [id]=\"controlName\" [formControlName]=\"controlName\" class=\"form-control\">\n <option *ngFor=\"let valueOption of section.sectionValue?.valueOptions\" [ngValue]=\"valueOption\">\n {{section.sectionValue?.displayValues?.[valueOption] || valueOption}}\n <span *ngIf=\"prices[valueOption] && prices[valueOption].length > 0\">\n <span>${{ prices[valueOption][0].netPrice }}</span>\n <span *ngIf=\"prices[valueOption].length > 1\">\n <span>, </span>\n <span>${{ prices[valueOption][1].netPrice }}</span>\n </span>\n </span>\n </option>\n </select>\n </div>\n </div>\n <div class=\"input-form-input div-inline quantity-form-input\">\n <label [for]=\"qtyControlName\"> Quantity </label>\n <div class=\"form-control-wrapper\">\n <input [id]=\"qtyControlName\" [formControlName]=\"qtyControlName\" type=\"text\" class=\"form-control\" size=\"3\" />\n\n <div\n class=\"validation-message\"\n [hidden]=\"form.controls[qtyControlName].valid || form.controls[qtyControlName].pristine\"\n >\n <div *ngFor=\"let key of form.controls[qtyControlName].errors | values\">\n <span> {{form.controls[qtyControlName]?.errors?.[key].message}}</span>\n </div>\n </div>\n\n <a href=\"javascript:void(0);\" (click)=\"handleCreate()\">\n <div class=\"add-config-control\" [attr.disabled]=\"form.valid && isAddAllowed() ? null : true\">\n <i class=\"fa fa-plus plus-icon\"></i>\n </div>\n </a>\n </div>\n </div>\n</div>\n<ng-content></ng-content>\n", directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }], pipes: { "values": i7.ValuesPipe } });
1790
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortDropdownComponent, decorators: [{
1791
+ type: Component,
1792
+ args: [{
1793
+ // eslint-disable-next-line @angular-eslint/component-selector
1794
+ selector: 'velo-port-dropdown',
1795
+ templateUrl: 'velo-port-dropdown.component.html',
1796
+ }]
1797
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
1798
+
1799
+ class VeloPortRadioComponent {
1800
+ constructor(formScope, sectionScope) {
1801
+ this.formScope = formScope;
1802
+ this.sectionScope = sectionScope;
1803
+ this.prices = {};
1804
+ this.form = this.formScope.form;
1805
+ this.section = this.sectionScope.section;
1806
+ this.controlName = this.section.id;
1807
+ }
1808
+ ngOnInit() {
1809
+ var _a;
1810
+ this.initPriceItems();
1811
+ (_a = this.section.sectionValue) === null || _a === void 0 ? void 0 : _a.valueOptions.forEach(item => {
1812
+ if (this.hasValueFor(item)) {
1813
+ this.form.controls[this.controlName].setValue(item);
1814
+ }
1815
+ });
1816
+ }
1817
+ handleChange(event, valueOption) {
1818
+ event.preventDefault();
1819
+ event.stopPropagation();
1820
+ const updateData = {
1821
+ id: this.section.id,
1822
+ action: this.hasPreviousValue() ? 'update' : 'create',
1823
+ valueOption,
1824
+ };
1825
+ this.form.controls[this.controlName].setValue(valueOption);
1826
+ this.form.controls[this.controlName].markAsDirty();
1827
+ this.formScope.publishFormUpdate(updateData);
1828
+ }
1829
+ hasValueFor(valueOption) {
1830
+ return !!this.findLineItemForValue(valueOption);
1831
+ }
1832
+ getMessages(valueOption) {
1833
+ var _a;
1834
+ const lineItem = this.findLineItemForValue(valueOption);
1835
+ if (((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.lineItems) && lineItem) {
1836
+ return lineItem.messages;
1837
+ }
1838
+ return [];
1839
+ }
1840
+ toString(price) {
1841
+ let result = '';
1842
+ if (price.listPrice > price.netPrice) {
1843
+ result += '<strike>' + price.listPrice + '</strike>';
1844
+ }
1845
+ result += price.netPrice;
1846
+ if (price.explanation) {
1847
+ result += '(' + price.explanation + ')';
1848
+ }
1849
+ return result;
1850
+ }
1851
+ hasPreviousValue() {
1852
+ var _a;
1853
+ const previous = (_a = this.section.model) === null || _a === void 0 ? void 0 : _a.lineItems.filter(li => li.port && li.port === this.section.boundData.name);
1854
+ return previous ? previous.length > 0 : false;
1855
+ }
1856
+ findLineItemForValue(valueOption) {
1857
+ return this.section.model ? LineItemUtil.findLineItemForValue(this.section.model, valueOption) : undefined;
1858
+ }
1859
+ initPriceItems() {
1860
+ var _a;
1861
+ this.prices = {};
1862
+ if (this.section.pricingEnabled) {
1863
+ (_a = this.section.sectionValue) === null || _a === void 0 ? void 0 : _a.valueOptions.forEach(valueOption => {
1864
+ this.prices[valueOption] = this.findPriceItemsForValue(valueOption);
1865
+ });
1866
+ }
1867
+ }
1868
+ findPriceItemsForValue(valueOption) {
1869
+ var _a, _b;
1870
+ let prices = [];
1871
+ if (valueOption) {
1872
+ const lineItem = ((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.lineItems) &&
1873
+ this.section.model.lineItems.find(li => li.type && li.type.toLowerCase() === valueOption.toLowerCase());
1874
+ if (lineItem && lineItem.chargeItems) {
1875
+ prices = lineItem.chargeItems.map(pi => {
1876
+ const price = {
1877
+ listPrice: pi.listPrice,
1878
+ netPrice: pi.netPrice,
1879
+ chargeMethod: pi.chargeMethod,
1880
+ chargeType: pi.chargeType,
1881
+ };
1882
+ return price;
1883
+ });
1884
+ }
1885
+ else {
1886
+ const portDomain = (_b = this.section.model) === null || _b === void 0 ? void 0 : _b.portDomains[this.section.boundData.name];
1887
+ const domainType = portDomain === null || portDomain === void 0 ? void 0 : portDomain.domainTypes.find(d => d.name.toLowerCase() === valueOption.toLowerCase());
1888
+ if (domainType && domainType.recommendedPrices) {
1889
+ prices = domainType.recommendedPrices;
1890
+ }
1891
+ }
1892
+ }
1893
+ const oneTime = {
1894
+ chargeMethod: 'ONE_TIME',
1895
+ netPrice: 0,
1896
+ listPrice: 0,
1897
+ chargeType: '',
1898
+ };
1899
+ const recurring = {
1900
+ chargeMethod: 'RECURRING',
1901
+ netPrice: 0,
1902
+ listPrice: 0,
1903
+ chargeType: '',
1904
+ };
1905
+ prices.forEach(p => {
1906
+ if (p.chargeMethod === oneTime.chargeMethod) {
1907
+ this.add(oneTime, p);
1908
+ }
1909
+ if (p.chargeMethod === recurring.chargeMethod) {
1910
+ this.add(recurring, p);
1911
+ }
1912
+ });
1913
+ const result = [];
1914
+ if (oneTime.listPrice > 0) {
1915
+ result.push(oneTime);
1916
+ }
1917
+ if (recurring.listPrice > 0) {
1918
+ result.push(recurring);
1919
+ }
1920
+ return result;
1921
+ }
1922
+ add(target, src) {
1923
+ target.netPrice = target.netPrice + src.netPrice;
1924
+ target.listPrice = target.listPrice + src.listPrice;
1925
+ if (src.explanation) {
1926
+ target.explanation = src.explanation;
1927
+ }
1928
+ }
1929
+ }
1930
+ VeloPortRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortRadioComponent, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Component });
1931
+ VeloPortRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloPortRadioComponent, selector: "velo-port-radio", ngImport: i0, template: "<div [formGroup]=\"form\">\n <!--TODO ALE replace divs with ng-templates-->\n <ng-container *ngFor=\"let valueOption of section.sectionValue?.valueOptions\">\n <div class=\"unchecked\">\n <div class=\"row no-gutter clearfix\">\n <div class=\"col-md-12\">\n <div class=\"content\">\n <div class=\"container-box container-box-bordered container-box-radio\">\n <div class=\"box-title\" (click)=\"handleChange($event, valueOption)\">\n <div class=\"header clearfix\">\n <div class=\"radio-button\">\n <label>\n <input type=\"radio\" [id]=\"controlName\" [value]=\"valueOption\" [formControlName]=\"controlName\" />\n\n <i class=\"input-helper\"></i>\n\n {{ section.sectionValue?.displayValues?.[valueOption] || valueOption }}\n\n <span *ngIf=\"prices[valueOption] && prices[valueOption].length > 0\">\n <span>${{ prices[valueOption][0].netPrice }}</span>\n\n <span *ngIf=\"prices[valueOption].length > 1\">\n <span>, </span>\n\n <span>${{ prices[valueOption][1].netPrice }}</span>\n </span>\n </span>\n </label>\n <span *ngIf=\"prices[valueOption] && prices[valueOption].length > 0\">\n <div>{{ prices[valueOption][0].explanation }}</div>\n\n <span *ngIf=\"prices[valueOption].length > 1 && prices[valueOption][1].explanation\">\n <div>{{ prices[valueOption][1].explanation }}</div>\n </span>\n </span>\n </div>\n </div>\n </div>\n </div>\n\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n</div>\n<ng-content></ng-content>\n", directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1932
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortRadioComponent, decorators: [{
1933
+ type: Component,
1934
+ args: [{
1935
+ // tslint:disable-next-line:component-selector
1936
+ // eslint-disable-next-line @angular-eslint/component-selector
1937
+ selector: 'velo-port-radio',
1938
+ templateUrl: 'velo-port-radio.component.html',
1939
+ }]
1940
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
1941
+
1942
+ class VeloTypeComponent {
1943
+ constructor(formScope, collapsibleState, sectionScope, messageService) {
1944
+ var _a, _b;
1945
+ this.formScope = formScope;
1946
+ this.collapsibleState = collapsibleState;
1947
+ this.sectionScope = sectionScope;
1948
+ this.messageService = messageService;
1949
+ this.messageBucketId = 'ui-runtime';
1950
+ this.indent = 1;
1951
+ this.prices = [];
1952
+ this.form = this.formScope.form;
1953
+ this.section = this.sectionScope.section;
1954
+ this.indent = this.sectionScope.indent;
1955
+ this.controlName = this.section.id;
1956
+ this.qtyControlName = this.section.id + 'qty';
1957
+ this.displayName =
1958
+ (((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.properties) && this.section.model.properties.displayName) || ((_b = this.section.model) === null || _b === void 0 ? void 0 : _b.type) || '';
1959
+ }
1960
+ ngOnInit() {
1961
+ var _a, _b;
1962
+ if (this.section.pricingEnabled) {
1963
+ this.prices = this.getPrices();
1964
+ }
1965
+ if (this.section.controlType === 'MESSAGE') {
1966
+ this.messageService.clear(this.messageBucketId);
1967
+ (_b = (_a = this.section.model) === null || _a === void 0 ? void 0 : _a.messages) === null || _b === void 0 ? void 0 : _b.forEach(message => {
1968
+ this.messageService.add({ key: this.messageBucketId, summary: message });
1969
+ });
1970
+ }
1971
+ }
1972
+ handleRemove() {
1973
+ const updateData = {
1974
+ id: this.section.id,
1975
+ action: 'remove',
1976
+ };
1977
+ this.formScope.publishFormUpdate(updateData);
1978
+ }
1979
+ handleQuantityUpdate() {
1980
+ const updateData = {
1981
+ id: this.section.id,
1982
+ action: 'qtyUpdate',
1983
+ };
1984
+ this.formScope.publishFormUpdate(updateData);
1985
+ }
1986
+ toggleCollapse() {
1987
+ if (this.section.model) {
1988
+ this.collapsibleState.toggleCollapse(this.section.model.id);
1989
+ }
1990
+ }
1991
+ getPrices() {
1992
+ var _a;
1993
+ let prices = [];
1994
+ if ((_a = this.section.model) === null || _a === void 0 ? void 0 : _a.chargeItems) {
1995
+ prices = this.section.model.chargeItems.map(pi => {
1996
+ const price = {
1997
+ listPrice: pi.listPrice,
1998
+ netPrice: pi.netPrice,
1999
+ chargeMethod: pi.chargeMethod,
2000
+ chargeType: pi.chargeType,
2001
+ };
2002
+ return price;
2003
+ });
2004
+ }
2005
+ const oneTime = {
2006
+ chargeMethod: 'ONE_TIME',
2007
+ netPrice: 0,
2008
+ listPrice: 0,
2009
+ chargeType: '',
2010
+ };
2011
+ const recurring = {
2012
+ chargeMethod: 'RECURRING',
2013
+ netPrice: 0,
2014
+ listPrice: 0,
2015
+ chargeType: '',
2016
+ };
2017
+ prices.forEach(p => {
2018
+ if (p.chargeMethod === oneTime.chargeMethod) {
2019
+ this.add(oneTime, p);
2020
+ }
2021
+ if (p.chargeMethod === recurring.chargeMethod) {
2022
+ this.add(recurring, p);
2023
+ }
2024
+ });
2025
+ const result = [];
2026
+ if (oneTime.listPrice > 0) {
2027
+ result.push(oneTime);
2028
+ }
2029
+ if (recurring.listPrice > 0) {
2030
+ result.push(recurring);
2031
+ }
2032
+ return result;
2033
+ }
2034
+ add(target, src) {
2035
+ target.netPrice = target.netPrice + src.netPrice;
2036
+ target.listPrice = target.listPrice + src.listPrice;
2037
+ if (src.explanation) {
2038
+ target.explanation = src.explanation;
2039
+ }
2040
+ }
2041
+ }
2042
+ VeloTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloTypeComponent, deps: [{ token: FormScopeService }, { token: CollapsibleStateService }, { token: SectionScopeService }, { token: i3$1.MessageService }], target: i0.ɵɵFactoryTarget.Component });
2043
+ VeloTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloTypeComponent, selector: "velo-type", ngImport: i0, template: "<div class=\"container-box div-block collapsed container-box-bordered\" [formGroup]=\"form\">\n <div class=\"box-title\">\n <div class=\"header clearfix\">\n <div>\n <div class=\"header-label div-inline\">\n {{ displayName }}\n <span *ngIf=\"prices.length > 0\">\n <span>${{ prices[0].netPrice }}</span>\n <span *ngIf=\"prices.length > 1\">\n <span>, </span>\n <span>${{ prices[1].netPrice }}</span>\n </span>\n </span>\n </div>\n\n <div class=\"header-qty-container input-form-input\">\n <input\n [id]=\"qtyControlName\"\n [formControlName]=\"qtyControlName\"\n (blur)=\"form.controls[qtyControlName].valid && handleQuantityUpdate()\"\n type=\"text\"\n class=\"form-control\"\n size=\"3\"\n />\n <div class=\"validation-message\">\n <div *ngFor=\"let key of form.controls[qtyControlName].errors | values\">\n <span>\n {{ form.controls[qtyControlName]?.errors?.[key].message }}\n </span>\n </div>\n <span *ngIf=\"form.controls[qtyControlName].valid\"> &nbsp; </span>\n </div>\n <span *ngIf=\"prices.length > 0\">\n <div>{{ prices[0].explanation }}</div>\n <span *ngIf=\"prices.length > 1 && prices[1].explanation\">\n <div>{{ prices[1].explanation }}</div>\n </span>\n </span>\n </div>\n </div>\n </div>\n\n <div class=\"box-actions\">\n <ng-container *ngIf=\"section.controlType !== 'MESSAGE'\">\n <ng-template #msgTemplate>\n <div class=\"runtime-info-message\">\n <ul class=\"message-text\">\n <li *ngFor=\"let message of section.model?.messages\">{{ message }}</li>\n </ul>\n </div>\n </ng-template>\n\n <div\n class=\"box-action-button\"\n *ngIf=\"(section.model?.messages?.length ?? 0) > 0\"\n [popover]=\"msgTemplate\"\n placement=\"left\"\n container=\"body\"\n [isOpen]=\"true\"\n >\n <a href=\"javascript:void(0);\">\n <i class=\"fa fa-info check-icon\"></i>\n </a>\n </div>\n </ng-container>\n\n <div\n class=\"box-action-button\"\n (click)=\"toggleCollapse()\"\n [hidden]=\"!section.children || section.children.length < 1\"\n >\n <a><i class=\"fa fa-chevron-down check-icon\"></i></a>\n </div>\n\n <div class=\"box-action-button\" (click)=\"handleRemove()\">\n <a><i class=\"fa fa-trash-o check-icon\"></i></a>\n </div>\n </div>\n </div>\n\n <ng-content></ng-content>\n</div>\n", directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.PopoverDirective, selector: "[popover]", inputs: ["outsideClick", "containerClass", "isOpen", "adaptivePosition", "popover", "popoverContext", "popoverTitle", "placement", "triggers", "container", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }], pipes: { "values": i7.ValuesPipe } });
2044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloTypeComponent, decorators: [{
2045
+ type: Component,
2046
+ args: [{
2047
+ // eslint-disable-next-line @angular-eslint/component-selector
2048
+ selector: 'velo-type',
2049
+ templateUrl: 'velo-type.component.html',
2050
+ }]
2051
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: CollapsibleStateService }, { type: SectionScopeService }, { type: i3$1.MessageService }]; } });
2052
+
2053
+ class SfQueryDirective {
2054
+ constructor(apiService) {
2055
+ this.apiService = apiService;
2056
+ }
2057
+ query(searchRequest, objectName) {
2058
+ return this.apiService.query(searchRequest, objectName).toPromise();
2059
+ }
2060
+ describe(objectName, fieldName) {
2061
+ return this.apiService.describe(objectName, fieldName).toPromise();
2062
+ }
2063
+ describe2(objectName, fieldsNames) {
2064
+ return this.apiService.describe2(objectName, fieldsNames).toPromise();
2065
+ }
2066
+ apexGetRequest(path, params) {
2067
+ return this.apiService.apexGetRequest(path, params).toPromise();
2068
+ }
2069
+ apexPostRequest(path, body) {
2070
+ return this.apiService.apexPostRequest(path, body).toPromise();
2071
+ }
2072
+ }
2073
+ SfQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SfQueryDirective, deps: [{ token: i1.SalesforceApiService }], target: i0.ɵɵFactoryTarget.Directive });
2074
+ SfQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: SfQueryDirective, selector: "sf-query", exportAs: ["sfApi"], ngImport: i0 });
2075
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SfQueryDirective, decorators: [{
2076
+ type: Directive,
2077
+ args: [{
2078
+ // eslint-disable-next-line @angular-eslint/directive-selector
2079
+ selector: 'sf-query',
2080
+ exportAs: 'sfApi',
2081
+ }]
2082
+ }], ctorParameters: function () { return [{ type: i1.SalesforceApiService }]; } });
2083
+
2084
+ class SectionHelperService {
2085
+ static findSectionForValue(section, valueOption) {
2086
+ if (!EntityUtil.isPresent(section) || !EntityUtil.isPresent(section.children) || EntityUtil.isBlank(valueOption)) {
2087
+ return;
2088
+ }
2089
+ const found = EntityUtil.filterHierarchically(section.children, 'children', ({ model }) => model && model.type.toLowerCase() === valueOption.toLowerCase());
2090
+ return found && found.pop();
2091
+ }
2092
+ getTotalPrices(section) {
2093
+ if (!section || !section.model || !section.model.chargeGroupItems) {
2094
+ return new Map();
2095
+ }
2096
+ return PricingUtils.sumPriceByProperty(section.model.chargeGroupItems, 'netPrice', [
2097
+ 'chargeMethod',
2098
+ 'sellingFrequency',
2099
+ ]);
2100
+ }
2101
+ }
2102
+ SectionHelperService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionHelperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2103
+ SectionHelperService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionHelperService });
2104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionHelperService, decorators: [{
2105
+ type: Injectable
2106
+ }] });
2107
+
2108
+ class SectionContextAware {
2109
+ constructor(formScope, sectionScope) {
2110
+ this.formScope = formScope;
2111
+ this.sectionScope = sectionScope;
2112
+ }
2113
+ ngOnInit() {
2114
+ this.form = this.formScope.form;
2115
+ this.section = this.sectionScope.section;
2116
+ this.initControlNames();
2117
+ }
2118
+ initControlNames() {
2119
+ this.controlName = this.section.id;
2120
+ this.qtyControlName = this.section.id + 'qty';
2121
+ }
2122
+ //TODO ALE CONSIDER STORE INSTEAD OF CALCULATE EVERY TIME
2123
+ isAddAllowed(quantityToAdd = 1) {
2124
+ return this.section.model
2125
+ ? SectionsBinderHelper.isAddAllowed(this.section.model, this.section.boundData.name, quantityToAdd)
2126
+ : false;
2127
+ }
2128
+ isRemoveAllowed(quantityToRemove = 1) {
2129
+ return this.section.model
2130
+ ? SectionsBinderHelper.isRemoveAllowed(this.section.model, this.section.boundData.name, quantityToRemove)
2131
+ : false;
2132
+ }
2133
+ handleCreate(valueOption) {
2134
+ if (!this.isAddAllowed()) {
2135
+ return;
2136
+ }
2137
+ const updateData = {
2138
+ id: this.section.id,
2139
+ action: 'create',
2140
+ valueOption: EntityUtil.isPresent(valueOption) ? valueOption : void 0,
2141
+ };
2142
+ this.formScope.publishFormUpdate(updateData);
2143
+ }
2144
+ handleChange(valueOption) {
2145
+ const updateData = {
2146
+ id: this.section.id,
2147
+ action: 'update',
2148
+ valueOption: EntityUtil.isPresent(valueOption) ? valueOption : void 0,
2149
+ };
2150
+ this.formScope.publishFormUpdate(updateData);
2151
+ }
2152
+ handleQtyChange(valueOption) {
2153
+ const updateData = {
2154
+ id: this.section.id,
2155
+ action: 'qtyUpdate',
2156
+ valueOption: valueOption,
2157
+ };
2158
+ this.formScope.publishFormUpdate(updateData);
2159
+ }
2160
+ handleRemove(valueOption) {
2161
+ const updateData = {
2162
+ id: this.section.id,
2163
+ action: 'remove',
2164
+ valueOption: valueOption,
2165
+ };
2166
+ this.formScope.publishFormUpdate(updateData);
2167
+ }
2168
+ handleCopy(valueOption) {
2169
+ const updateData = {
2170
+ id: this.section.id,
2171
+ action: 'copy',
2172
+ valueOption: valueOption,
2173
+ };
2174
+ this.formScope.publishFormUpdate(updateData);
2175
+ }
2176
+ }
2177
+ SectionContextAware.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionContextAware, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Directive });
2178
+ SectionContextAware.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: SectionContextAware, ngImport: i0 });
2179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionContextAware, decorators: [{
2180
+ type: Directive
2181
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
2182
+ class LineItemDirective {
2183
+ constructor(formScope, sectionScope, configurationService) {
2184
+ this.formScope = formScope;
2185
+ this.sectionScope = sectionScope;
2186
+ this.configurationService = configurationService;
2187
+ }
2188
+ ngOnInit() {
2189
+ this.section = this.sectionScope.section;
2190
+ this.lineItem = this.section.model;
2191
+ }
2192
+ handlePatch(rootLineItem) {
2193
+ const updateData = {
2194
+ id: this.sectionScope.section.id,
2195
+ action: 'patch',
2196
+ valueOption: rootLineItem,
2197
+ };
2198
+ this.formScope.publishFormUpdate(updateData);
2199
+ }
2200
+ configure(runtimeContext, configurableRamp) {
2201
+ return this.configurationService
2202
+ .configure(runtimeContext, { configurableRamp })
2203
+ .pipe(take(1))
2204
+ .toPromise();
2205
+ }
2206
+ }
2207
+ LineItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LineItemDirective, deps: [{ token: FormScopeService }, { token: SectionScopeService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Directive });
2208
+ LineItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: LineItemDirective, selector: "line-item", exportAs: ["liApi"], ngImport: i0 });
2209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LineItemDirective, decorators: [{
2210
+ type: Directive,
2211
+ args: [{
2212
+ // eslint-disable-next-line @angular-eslint/directive-selector
2213
+ selector: 'line-item',
2214
+ exportAs: 'liApi',
2215
+ }]
2216
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }, { type: ConfigurationService }]; } });
2217
+ class VeloPortDirective extends SectionContextAware {
2218
+ constructor(formScope, sectionScope) {
2219
+ super(formScope, sectionScope);
2220
+ this.valueQuantities = {};
2221
+ }
2222
+ handlePriceAdjustment(action, valueOption, amount) {
2223
+ const updateData = {
2224
+ id: this.section.id,
2225
+ action,
2226
+ valueOption,
2227
+ options: { amount },
2228
+ };
2229
+ this.formScope.publishFormUpdate(updateData);
2230
+ }
2231
+ ngOnInit() {
2232
+ super.ngOnInit();
2233
+ this.initQuantity();
2234
+ }
2235
+ handleUpsert(valueOption, event) {
2236
+ if (EntityUtil.isPresent(this.valueQuantities[valueOption]) && EntityUtil.isPresent(event)) {
2237
+ event === null || event === void 0 ? void 0 : event.preventDefault();
2238
+ return;
2239
+ }
2240
+ else if (Object.keys(this.valueQuantities).length > 0) {
2241
+ this.handleChange(valueOption);
2242
+ }
2243
+ else {
2244
+ this.handleCreate(valueOption);
2245
+ }
2246
+ }
2247
+ isActive(valueOption) {
2248
+ return EntityUtil.isPresent(this.valueQuantities[valueOption]);
2249
+ }
2250
+ initQuantity() {
2251
+ this.valueQuantities = this.section.model
2252
+ ? SectionsBinderHelper.getQuantityGroupByValue(this.section.model, this.section.boundData.name)
2253
+ : {};
2254
+ }
2255
+ //Quantity Stepper Functions
2256
+ handleNextVal(valueOption) {
2257
+ let initQty = this.valueQuantities[valueOption] || 0;
2258
+ if (this.isAddAllowed()) {
2259
+ if (initQty > 0) {
2260
+ const typeSection = SectionHelperService.findSectionForValue(this.section, valueOption);
2261
+ if (typeSection) {
2262
+ this.form.controls[typeSection.id + 'qty'].setValue(++initQty);
2263
+ this.handleQtyChange(valueOption);
2264
+ }
2265
+ }
2266
+ else {
2267
+ this.handleCreate(valueOption);
2268
+ }
2269
+ }
2270
+ }
2271
+ handlePrevVal(valueOption) {
2272
+ let initQty = this.valueQuantities[valueOption] || 0;
2273
+ if (this.isRemoveAllowed()) {
2274
+ if (initQty < 2) {
2275
+ this.handleRemove(valueOption);
2276
+ }
2277
+ else {
2278
+ const typeSection = SectionHelperService.findSectionForValue(this.section, valueOption);
2279
+ if (typeSection) {
2280
+ this.form.controls[typeSection.id + 'qty'].setValue(--initQty);
2281
+ this.handleQtyChange(valueOption);
2282
+ }
2283
+ }
2284
+ }
2285
+ }
2286
+ handleManualQtyChange(valueOption, qtyVal) {
2287
+ const initQty = this.valueQuantities[valueOption] || 0;
2288
+ if (isNaN(+qtyVal) || +qtyVal < 0 || initQty === +qtyVal) {
2289
+ return;
2290
+ }
2291
+ const newQty = +qtyVal;
2292
+ if (initQty === 0) {
2293
+ if (this.isAddAllowed(newQty)) {
2294
+ this.form.controls[this.qtyControlName].setValue(newQty);
2295
+ this.handleCreate(valueOption);
2296
+ }
2297
+ }
2298
+ else if (newQty === 0) {
2299
+ if (this.isRemoveAllowed()) {
2300
+ this.handleRemove(valueOption);
2301
+ }
2302
+ }
2303
+ else {
2304
+ const typeSection = SectionHelperService.findSectionForValue(this.section, valueOption);
2305
+ if (typeSection) {
2306
+ const dif = newQty - initQty;
2307
+ const isAllowed = dif > 0 ? this.isAddAllowed(dif) : this.isRemoveAllowed(dif * -1);
2308
+ if (isAllowed) {
2309
+ this.form.controls[typeSection.id + 'qty'].setValue(newQty);
2310
+ this.handleQtyChange(valueOption);
2311
+ }
2312
+ }
2313
+ }
2314
+ }
2315
+ handleNetPriceAdjustment(valueOption, amount) {
2316
+ this.handlePriceAdjustment('adjustNetPrice', valueOption, amount);
2317
+ }
2318
+ handleListPriceAdjustment(valueOption, amount) {
2319
+ this.handlePriceAdjustment('adjustListPrice', valueOption, amount);
2320
+ }
2321
+ }
2322
+ VeloPortDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortDirective, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Directive });
2323
+ VeloPortDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: VeloPortDirective, selector: "velo-port", exportAs: ["portApi"], usesInheritance: true, ngImport: i0 });
2324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloPortDirective, decorators: [{
2325
+ type: Directive,
2326
+ args: [{
2327
+ // eslint-disable-next-line @angular-eslint/directive-selector
2328
+ selector: 'velo-port',
2329
+ exportAs: 'portApi',
2330
+ }]
2331
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
2332
+ class VeloDropdownComponent extends SectionContextAware {
2333
+ constructor(formScope, sectionScope) {
2334
+ super(formScope, sectionScope);
2335
+ }
2336
+ }
2337
+ VeloDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloDropdownComponent, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Component });
2338
+ VeloDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloDropdownComponent, selector: "velo-dropdown", usesInheritance: true, ngImport: i0, template: `
2339
+ <div class="input-form-input div-inline" [formGroup]="form">
2340
+ <label [for]="controlName">{{ section.label }}</label>
2341
+ <div class="form-control-wrapper">
2342
+ <select [id]="controlName" [formControlName]="controlName" class="form-control">
2343
+ <option *ngFor="let valueOption of section.sectionValue?.valueOptions" [ngValue]="valueOption">
2344
+ {{ section.sectionValue?.displayValues?.[valueOption] || valueOption }}
2345
+ </option>
2346
+ </select>
2347
+ </div>
2348
+ </div>
2349
+ `, isInline: true, directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }] });
2350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloDropdownComponent, decorators: [{
2351
+ type: Component,
2352
+ args: [{
2353
+ moduleId: module.id,
2354
+ // eslint-disable-next-line @angular-eslint/component-selector
2355
+ selector: 'velo-dropdown',
2356
+ template: `
2357
+ <div class="input-form-input div-inline" [formGroup]="form">
2358
+ <label [for]="controlName">{{ section.label }}</label>
2359
+ <div class="form-control-wrapper">
2360
+ <select [id]="controlName" [formControlName]="controlName" class="form-control">
2361
+ <option *ngFor="let valueOption of section.sectionValue?.valueOptions" [ngValue]="valueOption">
2362
+ {{ section.sectionValue?.displayValues?.[valueOption] || valueOption }}
2363
+ </option>
2364
+ </select>
2365
+ </div>
2366
+ </div>
2367
+ `,
2368
+ }]
2369
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
2370
+ class VeloQuantityComponent extends SectionContextAware {
2371
+ constructor(formScope, sectionScope) {
2372
+ super(formScope, sectionScope);
2373
+ }
2374
+ }
2375
+ VeloQuantityComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloQuantityComponent, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Component });
2376
+ VeloQuantityComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloQuantityComponent, selector: "velo-quantity", usesInheritance: true, ngImport: i0, template: `
2377
+ <div class="input-form-input div-inline quantity-form-input" [formGroup]="form">
2378
+ <label [for]="qtyControlName"> Quantity </label>
2379
+ <div class="form-control-wrapper">
2380
+ <input
2381
+ [id]="controlName"
2382
+ [formControlName]="qtyControlName"
2383
+ [attr.disabled]="isAddAllowed() === true ? null : true"
2384
+ type="text"
2385
+ class="form-control"
2386
+ size="3"
2387
+ />
2388
+
2389
+ <div
2390
+ class="validation-message"
2391
+ [hidden]="form.controls[qtyControlName].valid || form.controls[qtyControlName].pristine"
2392
+ >
2393
+ <div *ngFor="let key of form.controls[qtyControlName].errors | values">
2394
+ <span> {{ form.controls[qtyControlName].errors?.[key].message }}</span>
2395
+ </div>
2396
+ </div>
2397
+ </div>
2398
+ </div>
2399
+ `, isInline: true, directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "values": i7.ValuesPipe } });
2400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloQuantityComponent, decorators: [{
2401
+ type: Component,
2402
+ args: [{
2403
+ moduleId: module.id,
2404
+ // eslint-disable-next-line @angular-eslint/component-selector
2405
+ selector: 'velo-quantity',
2406
+ template: `
2407
+ <div class="input-form-input div-inline quantity-form-input" [formGroup]="form">
2408
+ <label [for]="qtyControlName"> Quantity </label>
2409
+ <div class="form-control-wrapper">
2410
+ <input
2411
+ [id]="controlName"
2412
+ [formControlName]="qtyControlName"
2413
+ [attr.disabled]="isAddAllowed() === true ? null : true"
2414
+ type="text"
2415
+ class="form-control"
2416
+ size="3"
2417
+ />
2418
+
2419
+ <div
2420
+ class="validation-message"
2421
+ [hidden]="form.controls[qtyControlName].valid || form.controls[qtyControlName].pristine"
2422
+ >
2423
+ <div *ngFor="let key of form.controls[qtyControlName].errors | values">
2424
+ <span> {{ form.controls[qtyControlName].errors?.[key].message }}</span>
2425
+ </div>
2426
+ </div>
2427
+ </div>
2428
+ </div>
2429
+ `,
2430
+ }]
2431
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
2432
+ class VeloQuantityButtonComponent extends SectionContextAware {
2433
+ constructor(formScope, sectionScope) {
2434
+ super(formScope, sectionScope);
2435
+ }
2436
+ }
2437
+ VeloQuantityButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloQuantityButtonComponent, deps: [{ token: FormScopeService }, { token: SectionScopeService }], target: i0.ɵɵFactoryTarget.Component });
2438
+ VeloQuantityButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloQuantityButtonComponent, selector: "velo-quantity-button", usesInheritance: true, ngImport: i0, template: `
2439
+ <div class="input-form-input div-inline quantity-form-input">
2440
+ <div class="form-control-wrapper">
2441
+ <a href="javascript:void(0);" (click)="handleCreate()">
2442
+ <div class="add-config-control" [attr.disabled]="isAddAllowed() === true ? null : true">
2443
+ <i class="fa fa-plus plus-icon"></i>
2444
+ </div>
2445
+ </a>
2446
+ </div>
2447
+ </div>
2448
+ `, isInline: true });
2449
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloQuantityButtonComponent, decorators: [{
2450
+ type: Component,
2451
+ args: [{
2452
+ moduleId: module.id,
2453
+ // eslint-disable-next-line @angular-eslint/component-selector
2454
+ selector: 'velo-quantity-button',
2455
+ template: `
2456
+ <div class="input-form-input div-inline quantity-form-input">
2457
+ <div class="form-control-wrapper">
2458
+ <a href="javascript:void(0);" (click)="handleCreate()">
2459
+ <div class="add-config-control" [attr.disabled]="isAddAllowed() === true ? null : true">
2460
+ <i class="fa fa-plus plus-icon"></i>
2461
+ </div>
2462
+ </a>
2463
+ </div>
2464
+ </div>
2465
+ `,
2466
+ }]
2467
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: SectionScopeService }]; } });
2468
+
2469
+ class VlApprovalDirective {
2470
+ constructor(repo) {
2471
+ this.repo = repo;
2472
+ }
2473
+ submitQuote(quoteDraft) {
2474
+ return this.repo.submitQuote(quoteDraft).toPromise();
2475
+ }
2476
+ }
2477
+ VlApprovalDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlApprovalDirective, deps: [{ token: i1.QuoteApiService }], target: i0.ɵɵFactoryTarget.Directive });
2478
+ VlApprovalDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: VlApprovalDirective, selector: "vl-approval", exportAs: ["approvalApi"], ngImport: i0 });
2479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlApprovalDirective, decorators: [{
2480
+ type: Directive,
2481
+ args: [{
2482
+ // eslint-disable-next-line @angular-eslint/directive-selector
2483
+ selector: 'vl-approval',
2484
+ exportAs: 'approvalApi',
2485
+ }]
2486
+ }], ctorParameters: function () { return [{ type: i1.QuoteApiService }]; } });
2487
+
2488
+ class VlDocumentAttachmentsDirective {
2489
+ constructor(service) {
2490
+ this.service = service;
2491
+ }
2492
+ getAttachments(searchRequest) {
2493
+ return this.service.getAttachments(searchRequest).toPromise();
2494
+ }
2495
+ createAttachment(attachment, file, reportProgress) {
2496
+ const observable = this.service.createAttachment(attachment, file, reportProgress);
2497
+ return reportProgress ? observable : observable.toPromise();
2498
+ }
2499
+ updateAttachment(id, attachment) {
2500
+ return this.service.updateAttachment(id, attachment).toPromise();
2501
+ }
2502
+ getAttachmentFile(id, isPreventDownload) {
2503
+ return this.service.getAttachmentFile(id, isPreventDownload).toPromise();
2504
+ }
2505
+ removeAttachment(id) {
2506
+ return this.service.removeAttachment(id).toPromise();
2507
+ }
2508
+ }
2509
+ VlDocumentAttachmentsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlDocumentAttachmentsDirective, deps: [{ token: i1.DocumentAttachmentApiService }], target: i0.ɵɵFactoryTarget.Directive });
2510
+ VlDocumentAttachmentsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: VlDocumentAttachmentsDirective, selector: "vl-document-attachments", exportAs: ["documentAttachmentsApi"], ngImport: i0 });
2511
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlDocumentAttachmentsDirective, decorators: [{
2512
+ type: Directive,
2513
+ args: [{
2514
+ // eslint-disable-next-line @angular-eslint/directive-selector
2515
+ selector: 'vl-document-attachments',
2516
+ exportAs: 'documentAttachmentsApi',
2517
+ }]
2518
+ }], ctorParameters: function () { return [{ type: i1.DocumentAttachmentApiService }]; } });
2519
+
2520
+ class VlDocumentTemplatesDirective {
2521
+ constructor(documentTemplatesApiService) {
2522
+ this.documentTemplatesApiService = documentTemplatesApiService;
2523
+ /**
2524
+ * @deprecated Use `generateDocument` instead
2525
+ */
2526
+ // eslint-disable-next-line @typescript-eslint/member-ordering
2527
+ this.generateDocumentNew = this.generateDocument;
2528
+ }
2529
+ getTemplates(tag) {
2530
+ return this.documentTemplatesApiService.getTemplates(tag).toPromise();
2531
+ }
2532
+ upsertTemplate(template, templateFile) {
2533
+ return this.documentTemplatesApiService
2534
+ .upsertTemplate(template, templateFile)
2535
+ .toPromise();
2536
+ }
2537
+ removeTemplate(id) {
2538
+ return this.documentTemplatesApiService.removeTemplate(id).toPromise();
2539
+ }
2540
+ cloneTemplate(id) {
2541
+ return this.documentTemplatesApiService.cloneTemplate(id).toPromise();
2542
+ }
2543
+ downloadTemplate(id) {
2544
+ return this.documentTemplatesApiService.downloadTemplateFile(id).toPromise();
2545
+ }
2546
+ generateDocument(template, quoteDraft, params) {
2547
+ return this.documentTemplatesApiService.generateDocument(template, quoteDraft, params).pipe(take(1));
2548
+ }
2549
+ generateDocumentData(template, quoteDraft, params) {
2550
+ return this.documentTemplatesApiService.generateDocumentData(template, quoteDraft, params).pipe(take(1));
2551
+ }
2552
+ getAttachments(searchRequest) {
2553
+ return this.documentTemplatesApiService.getAttachments(searchRequest).toPromise();
2554
+ }
2555
+ getAttachmentFile(id) {
2556
+ return this.documentTemplatesApiService.getAttachmentFile(id).toPromise();
2557
+ }
2558
+ createAttachment(attachment, file) {
2559
+ return this.documentTemplatesApiService.createAttachment(attachment, file).toPromise();
2560
+ }
2561
+ removeAttachment(id) {
2562
+ return this.documentTemplatesApiService.removeAttachment(id).toPromise();
2563
+ }
2564
+ }
2565
+ VlDocumentTemplatesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlDocumentTemplatesDirective, deps: [{ token: i1.DocumentTemplatesApiService }], target: i0.ɵɵFactoryTarget.Directive });
2566
+ VlDocumentTemplatesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: VlDocumentTemplatesDirective, selector: "[vlQuoteTemplates]", exportAs: ["quoteTemplateApi"], ngImport: i0 });
2567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlDocumentTemplatesDirective, decorators: [{
2568
+ type: Directive,
2569
+ args: [{
2570
+ selector: '[vlQuoteTemplates]',
2571
+ exportAs: 'quoteTemplateApi',
2572
+ }]
2573
+ }], ctorParameters: function () { return [{ type: i1.DocumentTemplatesApiService }]; } });
2574
+
2575
+ class VlQuoteDirective {
2576
+ constructor(quoteApiService, runtimeService) {
2577
+ this.quoteApiService = quoteApiService;
2578
+ this.runtimeService = runtimeService;
2579
+ }
2580
+ getQuote(quoteId) {
2581
+ return this.quoteApiService.getQuoteDraft(quoteId).toPromise();
2582
+ }
2583
+ upsertQuote(quoteDraft) {
2584
+ return this.quoteApiService.upsertQuote(quoteDraft).toPromise();
2585
+ }
2586
+ configureQuote(quoteDraft, rootLineItemId) {
2587
+ var _a;
2588
+ const rootLineItem = EntityUtil.findById(rootLineItemId, quoteDraft.currentState);
2589
+ const asset = (_a = quoteDraft.initialState) === null || _a === void 0 ? void 0 : _a.find(a => a.id === rootLineItem.assetId);
2590
+ const { context } = quoteDraft;
2591
+ const states = {
2592
+ configurableRamp: LineItemUtil.removeDeletedItems(rootLineItem),
2593
+ currentState: quoteDraft.currentState,
2594
+ asset,
2595
+ };
2596
+ this.runtimeService.updateRuntime(states, context.properties);
2597
+ }
2598
+ }
2599
+ VlQuoteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlQuoteDirective, deps: [{ token: i1.QuoteApiService }, { token: RuntimeService }], target: i0.ɵɵFactoryTarget.Directive });
2600
+ VlQuoteDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: VlQuoteDirective, selector: "vl-quote", exportAs: ["quoteApi"], ngImport: i0 });
2601
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlQuoteDirective, decorators: [{
2602
+ type: Directive,
2603
+ args: [{
2604
+ // eslint-disable-next-line @angular-eslint/directive-selector
2605
+ selector: 'vl-quote',
2606
+ exportAs: 'quoteApi',
2607
+ }]
2608
+ }], ctorParameters: function () { return [{ type: i1.QuoteApiService }, { type: RuntimeService }]; } });
2609
+
2610
+ class VlRampDirective {
2611
+ constructor(contextService, rampApiService, priceApiService) {
2612
+ this.contextService = contextService;
2613
+ this.rampApiService = rampApiService;
2614
+ this.priceApiService = priceApiService;
2615
+ }
2616
+ createRamp(sourceItems, currentRamps, term) {
2617
+ const context = this.contextService.resolve();
2618
+ return this.rampApiService
2619
+ .next({
2620
+ context,
2621
+ sourceItems,
2622
+ currentItems: currentRamps || [],
2623
+ term,
2624
+ })
2625
+ .pipe(tap(data => {
2626
+ if (data.context) {
2627
+ this.contextService.update({
2628
+ properties: Object.assign({}, data.context.properties),
2629
+ });
2630
+ }
2631
+ }))
2632
+ .toPromise();
2633
+ }
2634
+ calculateRampTermByEndDate(lineItem, endDate) {
2635
+ return this.priceApiService
2636
+ .getSellingTermByEndDate(lineItem.planId, lineItem.offeringId, lineItem.startDate, endDate, lineItem.sellingFrequencyUnit, lineItem.sellingFrequencyDuration)
2637
+ .toPromise();
2638
+ }
2639
+ calculateRampTermByTerm(lineItem, term) {
2640
+ return this.priceApiService
2641
+ .getSellingTermByTerm(lineItem.planId, lineItem.offeringId, lineItem.startDate, term, lineItem.sellingFrequencyUnit, lineItem.sellingFrequencyDuration)
2642
+ .toPromise();
2643
+ }
2644
+ }
2645
+ VlRampDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlRampDirective, deps: [{ token: i2.ContextService }, { token: i1.RampApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Directive });
2646
+ VlRampDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: VlRampDirective, selector: "vl-ramp", exportAs: ["rampApi"], ngImport: i0 });
2647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VlRampDirective, decorators: [{
2648
+ type: Directive,
2649
+ args: [{
2650
+ // eslint-disable-next-line @angular-eslint/directive-selector
2651
+ selector: 'vl-ramp',
2652
+ exportAs: 'rampApi',
2653
+ }]
2654
+ }], ctorParameters: function () { return [{ type: i2.ContextService }, { type: i1.RampApiService }, { type: i1.PriceApiService }]; } });
2655
+
2656
+ const SHA1$1 = UUID.SHA1();
2657
+ const SCRIPT_GLOBAL_NAME = `$velo`;
2658
+ class SectionScriptDirective {
2659
+ constructor(_document, sfQueryDirective, lineItemDirective, quoteDirective, documentTemplatesDirective, rampDirective, approvalDirective, documentAttachmentsDirective, formScope, sectionScope, renderer, formBuilder, runtimeService, cdr, cartService, contextService, currentStateService, quoteService) {
2660
+ this._document = _document;
2661
+ this.sfQueryDirective = sfQueryDirective;
2662
+ this.lineItemDirective = lineItemDirective;
2663
+ this.quoteDirective = quoteDirective;
2664
+ this.documentTemplatesDirective = documentTemplatesDirective;
2665
+ this.rampDirective = rampDirective;
2666
+ this.approvalDirective = approvalDirective;
2667
+ this.documentAttachmentsDirective = documentAttachmentsDirective;
2668
+ this.formScope = formScope;
2669
+ this.sectionScope = sectionScope;
2670
+ this.renderer = renderer;
2671
+ this.formBuilder = formBuilder;
2672
+ this.runtimeService = runtimeService;
2673
+ this.cdr = cdr;
2674
+ this.cartService = cartService;
2675
+ this.contextService = contextService;
2676
+ this.currentStateService = currentStateService;
2677
+ this.quoteService = quoteService;
2678
+ this.scriptId = '';
2679
+ this.sessionScope = {};
2680
+ }
2681
+ ngOnInit() {
2682
+ if (!this.scriptExists()) {
2683
+ return;
2684
+ }
2685
+ this.scriptId = this.generateScriptId();
2686
+ this.registry = this.getScriptRegistry();
2687
+ this.sessionScope = this.getSessionScope();
2688
+ if (!this.registry.exists(this.scriptId)) {
2689
+ this.appendScriptElementToDom();
2690
+ }
2691
+ this.initScript();
2692
+ this.registry.doRegister(this.scriptId, this.sectionScope.section.id);
2693
+ }
2694
+ ngAfterViewInit() {
2695
+ var _a;
2696
+ const sharedScriptGlobal = (_a = this.registry) === null || _a === void 0 ? void 0 : _a.getGlobalForScript(this.sectionScope.section.id);
2697
+ if (sharedScriptGlobal) {
2698
+ this.methodApply('afterViewInit', sharedScriptGlobal);
2699
+ }
2700
+ }
2701
+ ngOnDestroy() {
2702
+ if (!this.scriptId) {
2703
+ return;
2704
+ }
2705
+ this.registry.unRegister(this.scriptId, this.sectionScope.section.id);
2706
+ if (!this.registry.exists(this.scriptId)) {
2707
+ this.removeScript();
2708
+ this.registry.removeGlobalForScript(this.scriptId);
2709
+ }
2710
+ }
2711
+ get scope() {
2712
+ if (!this.scriptId || !this.sectionScope.section) {
2713
+ return {};
2714
+ }
2715
+ return Object.assign({}, this.registry.getGlobalForScript(this.sectionScope.section.id) || {}, this.sessionScope);
2716
+ }
2717
+ scriptExists() {
2718
+ var _a, _b, _c, _d;
2719
+ return ((_d = (_c = (_b = (_a = this.sectionScope) === null || _a === void 0 ? void 0 : _a.section) === null || _b === void 0 ? void 0 : _b.script) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0;
2720
+ }
2721
+ encodeScriptBody() {
2722
+ return this.sectionScope.section.script ? atob(this.sectionScope.section.script) : '';
2723
+ }
2724
+ generateScriptId() {
2725
+ return '_' + SHA1$1.hex(this.encodeScriptBody());
2726
+ }
2727
+ getScriptRegistry() {
2728
+ return this.formScope.scriptRegistry;
2729
+ }
2730
+ getSessionScope() {
2731
+ return this.formScope.scriptSessionScope;
2732
+ }
2733
+ initScript() {
2734
+ let sharedScriptGlobal = this.registry.getGlobalForScript(this.sectionScope.section.id);
2735
+ if (!EntityUtil.isPresent(sharedScriptGlobal)) {
2736
+ sharedScriptGlobal = {};
2737
+ this.registry.setGlobalForScript(this.sectionScope.section.id, sharedScriptGlobal);
2738
+ }
2739
+ this.methodApply('init', sharedScriptGlobal);
2740
+ }
2741
+ removeScript() {
2742
+ const sharedScriptGlobal = this.registry.getGlobalForScript(this.sectionScope.section.id);
2743
+ this.methodApply('destroy', sharedScriptGlobal);
2744
+ this.removeScriptElementFromDom();
2745
+ }
2746
+ appendScriptElementToDom() {
2747
+ const script = this.scriptFromTemplate(this.encodeScriptBody(), this.scriptId, this.sectionScope.section);
2748
+ this.scriptElement = this.renderer.createElement('script');
2749
+ this.scriptElement.type = `text/javascript`;
2750
+ this.scriptElement.text = script;
2751
+ this.scriptElement.setAttribute('id', this.scriptId);
2752
+ this.renderer.appendChild(this._document.body, this.scriptElement);
2753
+ }
2754
+ removeScriptElementFromDom() {
2755
+ if (!this.scriptElement) {
2756
+ this.scriptElement = this._document.getElementById(this.scriptId);
2757
+ }
2758
+ this.scriptElement.remove();
2759
+ }
2760
+ scriptFromTemplate(scriptBody, scriptId, section) {
2761
+ return `var ${scriptId} = (function (${SCRIPT_GLOBAL_NAME}, form, { section, templates }, sessionScope, formBuilder, runtimeContext, cdr, apis) {
2762
+ ${SCRIPT_GLOBAL_NAME}["form"] = form;
2763
+ ${SCRIPT_GLOBAL_NAME}["section"] = section;
2764
+ ${SCRIPT_GLOBAL_NAME}["templates"] = templates;
2765
+ ${SCRIPT_GLOBAL_NAME}["sessionScope"] = sessionScope;
2766
+ ${SCRIPT_GLOBAL_NAME}["formBuilder"] = formBuilder;
2767
+ ${SCRIPT_GLOBAL_NAME}["runtimeContext"] = runtimeContext;
2768
+ ${SCRIPT_GLOBAL_NAME}["cdr"] = cdr;
2769
+ ${SCRIPT_GLOBAL_NAME}["apis"] = apis;
2770
+
2771
+ ${scriptBody}
2772
+ return ${SCRIPT_GLOBAL_NAME};
2773
+ });
2774
+
2775
+ //# sourceURL=${_.kebabCase(section.label)}.js`;
2776
+ }
2777
+ methodApply(methodName, sharedScriptGlobal) {
2778
+ const args = [
2779
+ sharedScriptGlobal,
2780
+ this.formScope.form,
2781
+ this.sectionScope,
2782
+ this.sessionScope,
2783
+ this.formBuilder,
2784
+ this.runtimeService.getRuntimeContext(),
2785
+ this.cdr,
2786
+ this.getExposedApis(),
2787
+ ];
2788
+ const fnInit = window[`${this.scriptId}`](...args);
2789
+ fnInit && fnInit[methodName] && fnInit[methodName].apply();
2790
+ }
2791
+ getExposedApis() {
2792
+ return {
2793
+ 'sf-query': this.sfQueryDirective,
2794
+ 'line-item': this.lineItemDirective,
2795
+ 'quote-directive': this.quoteDirective,
2796
+ 'templates-directive': this.documentTemplatesDirective,
2797
+ 'attachments-directive': this.documentAttachmentsDirective,
2798
+ 'ramp-directive': this.rampDirective,
2799
+ 'approval-directive': this.approvalDirective,
2800
+ entityUtil: EntityUtil,
2801
+ moment,
2802
+ lodash: _,
2803
+ rxjs: Object.assign(Object.assign({}, rxjsOperators), rxjs),
2804
+ PagedEntity,
2805
+ pipes: {
2806
+ currency: CurrencyPipe,
2807
+ },
2808
+ solutionUpdateStarted: this.runtimeService.onSolutionUpdateStartedEvent,
2809
+ solutionUpdated: this.runtimeService.onSolutionProcessed,
2810
+ cartService: this.cartService,
2811
+ configurationContextService: this.contextService,
2812
+ quoteDraft: this.quoteService.quoteSnapshot,
2813
+ currentStateService: this.currentStateService,
2814
+ };
2815
+ }
2816
+ }
2817
+ SectionScriptDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionScriptDirective, deps: [{ token: DOCUMENT }, { token: SfQueryDirective }, { token: LineItemDirective }, { token: VlQuoteDirective }, { token: VlDocumentTemplatesDirective }, { token: VlRampDirective }, { token: VlApprovalDirective }, { token: VlDocumentAttachmentsDirective }, { token: FormScopeService }, { token: SectionScopeService }, { token: i0.Renderer2 }, { token: i4.FormBuilder }, { token: RuntimeService }, { token: i0.ChangeDetectorRef }, { token: ShoppingCartService }, { token: i2.ContextService }, { token: CurrentStateService }, { token: i2.QuoteDraftService }], target: i0.ɵɵFactoryTarget.Directive });
2818
+ SectionScriptDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: SectionScriptDirective, selector: "section-script", providers: [
2819
+ SfQueryDirective,
2820
+ LineItemDirective,
2821
+ VlQuoteDirective,
2822
+ VlDocumentTemplatesDirective,
2823
+ VlRampDirective,
2824
+ VlApprovalDirective,
2825
+ VlDocumentAttachmentsDirective,
2826
+ ], exportAs: ["scriptApi"], ngImport: i0 });
2827
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionScriptDirective, decorators: [{
2828
+ type: Directive,
2829
+ args: [{
2830
+ // eslint-disable-next-line @angular-eslint/directive-selector
2831
+ selector: 'section-script',
2832
+ exportAs: 'scriptApi',
2833
+ providers: [
2834
+ SfQueryDirective,
2835
+ LineItemDirective,
2836
+ VlQuoteDirective,
2837
+ VlDocumentTemplatesDirective,
2838
+ VlRampDirective,
2839
+ VlApprovalDirective,
2840
+ VlDocumentAttachmentsDirective,
2841
+ ],
2842
+ }]
2843
+ }], ctorParameters: function () { return [{ type: Document, decorators: [{
2844
+ type: Inject,
2845
+ args: [DOCUMENT]
2846
+ }] }, { type: SfQueryDirective, decorators: [{
2847
+ type: Inject,
2848
+ args: [SfQueryDirective]
2849
+ }] }, { type: LineItemDirective, decorators: [{
2850
+ type: Inject,
2851
+ args: [LineItemDirective]
2852
+ }] }, { type: VlQuoteDirective, decorators: [{
2853
+ type: Inject,
2854
+ args: [VlQuoteDirective]
2855
+ }] }, { type: VlDocumentTemplatesDirective, decorators: [{
2856
+ type: Inject,
2857
+ args: [VlDocumentTemplatesDirective]
2858
+ }] }, { type: VlRampDirective, decorators: [{
2859
+ type: Inject,
2860
+ args: [VlRampDirective]
2861
+ }] }, { type: VlApprovalDirective, decorators: [{
2862
+ type: Inject,
2863
+ args: [VlApprovalDirective]
2864
+ }] }, { type: VlDocumentAttachmentsDirective, decorators: [{
2865
+ type: Inject,
2866
+ args: [VlDocumentAttachmentsDirective]
2867
+ }] }, { type: FormScopeService }, { type: SectionScopeService }, { type: i0.Renderer2 }, { type: i4.FormBuilder }, { type: RuntimeService }, { type: i0.ChangeDetectorRef }, { type: ShoppingCartService }, { type: i2.ContextService }, { type: CurrentStateService }, { type: i2.QuoteDraftService }]; } });
2868
+
2869
+ class RuntimeExecutionModule {
2870
+ }
2871
+ RuntimeExecutionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeExecutionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2872
+ RuntimeExecutionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeExecutionModule, declarations: [ExecutionSectionRendererComponent,
2873
+ ChildrenPlaceholderComponent,
2874
+ SectionScriptDirective,
2875
+ VeloPortDirective,
2876
+ LineItemDirective,
2877
+ VeloDropdownComponent,
2878
+ VeloQuantityButtonComponent,
2879
+ VeloQuantityComponent,
2880
+ VeloAttributeDirective,
2881
+ MultiselectComponent,
2882
+ VeloAttributeComponent,
2883
+ VeloPortRadioComponent,
2884
+ VeloTypeComponent,
2885
+ VeloPortDropdownComponent,
2886
+ VeloPortCheckBoxComponent,
2887
+ FederatedComponent,
2888
+ TemplateComponent,
2889
+ ContextProviderComponent], imports: [CommonModule,
2890
+ FormsModule,
2891
+ ReactiveFormsModule,
2892
+ CoreModule,
2893
+ ApiModule,
2894
+ VeloceElementsModule,
2895
+ PopoverModule,
2896
+ LoaderModule,
2897
+ SdkCoreModule], exports: [FormsModule,
2898
+ ReactiveFormsModule,
2899
+ ChildrenPlaceholderComponent,
2900
+ SectionScriptDirective,
2901
+ LineItemDirective,
2902
+ VeloPortDirective,
2903
+ VeloAttributeDirective,
2904
+ MultiselectComponent,
2905
+ VeloAttributeComponent,
2906
+ VeloPortRadioComponent,
2907
+ VeloTypeComponent,
2908
+ VeloPortDropdownComponent,
2909
+ VeloPortCheckBoxComponent,
2910
+ FederatedComponent,
2911
+ TemplateComponent,
2912
+ ContextProviderComponent] });
2913
+ RuntimeExecutionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeExecutionModule, providers: [
2914
+ ShoppingCartService,
2915
+ RuntimeService,
2916
+ ConfigurationService,
2917
+ RuntimeContextService,
2918
+ RuntimeFormService,
2919
+ CurrentStateService,
2920
+ ProductModelCacheService,
2921
+ DatePipe,
2922
+ SectionStoreService,
2923
+ ], imports: [[
2924
+ CommonModule,
2925
+ FormsModule,
2926
+ ReactiveFormsModule,
2927
+ CoreModule,
2928
+ ApiModule,
2929
+ VeloceElementsModule,
2930
+ PopoverModule,
2931
+ LoaderModule,
2932
+ SdkCoreModule,
2933
+ ], FormsModule,
2934
+ ReactiveFormsModule] });
2935
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeExecutionModule, decorators: [{
2936
+ type: NgModule,
2937
+ args: [{
2938
+ declarations: [
2939
+ ExecutionSectionRendererComponent,
2940
+ ChildrenPlaceholderComponent,
2941
+ SectionScriptDirective,
2942
+ VeloPortDirective,
2943
+ LineItemDirective,
2944
+ VeloDropdownComponent,
2945
+ VeloQuantityButtonComponent,
2946
+ VeloQuantityComponent,
2947
+ VeloAttributeDirective,
2948
+ MultiselectComponent,
2949
+ VeloAttributeComponent,
2950
+ VeloPortRadioComponent,
2951
+ VeloTypeComponent,
2952
+ VeloPortDropdownComponent,
2953
+ VeloPortCheckBoxComponent,
2954
+ FederatedComponent,
2955
+ TemplateComponent,
2956
+ ContextProviderComponent,
2957
+ ],
2958
+ providers: [
2959
+ ShoppingCartService,
2960
+ RuntimeService,
2961
+ ConfigurationService,
2962
+ RuntimeContextService,
2963
+ RuntimeFormService,
2964
+ CurrentStateService,
2965
+ ProductModelCacheService,
2966
+ DatePipe,
2967
+ SectionStoreService,
2968
+ ],
2969
+ imports: [
2970
+ CommonModule,
2971
+ FormsModule,
2972
+ ReactiveFormsModule,
2973
+ CoreModule,
2974
+ ApiModule,
2975
+ VeloceElementsModule,
2976
+ PopoverModule,
2977
+ LoaderModule,
2978
+ SdkCoreModule,
2979
+ ],
2980
+ exports: [
2981
+ FormsModule,
2982
+ ReactiveFormsModule,
2983
+ ChildrenPlaceholderComponent,
2984
+ SectionScriptDirective,
2985
+ LineItemDirective,
2986
+ VeloPortDirective,
2987
+ VeloAttributeDirective,
2988
+ MultiselectComponent,
2989
+ VeloAttributeComponent,
2990
+ VeloPortRadioComponent,
2991
+ VeloTypeComponent,
2992
+ VeloPortDropdownComponent,
2993
+ VeloPortCheckBoxComponent,
2994
+ FederatedComponent,
2995
+ TemplateComponent,
2996
+ ContextProviderComponent,
2997
+ ],
2998
+ }]
2999
+ }] });
3000
+
3001
+ const SHA1 = UUID.SHA1();
3002
+ class BaseSectionComponent {
3003
+ }
3004
+ BaseSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BaseSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3005
+ BaseSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: BaseSectionComponent, selector: "ng-component", inputs: { form: "form", section: "section" }, viewQueries: [{ propertyName: "templates", predicate: ["customTemplate"], descendants: true }], ngImport: i0, template: '', isInline: true });
3006
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: BaseSectionComponent, decorators: [{
3007
+ type: Component,
3008
+ args: [{ template: '' }]
3009
+ }], propDecorators: { form: [{
3010
+ type: Input
3011
+ }], section: [{
3012
+ type: Input
3013
+ }], templates: [{
3014
+ type: ViewChildren,
3015
+ args: ['customTemplate']
3016
+ }] } });
3017
+ class SectionsService {
3018
+ constructor(compiler, m, sectionStore) {
3019
+ this.compiler = compiler;
3020
+ this.m = m;
3021
+ this.sectionStore = sectionStore;
3022
+ this.moduleType = null;
3023
+ this.moduleInstance = null;
3024
+ }
3025
+ compileModule(sections, isViewEncapsulated) {
3026
+ const uniqueSections = this.getUniqueSections(sections);
3027
+ this.moduleType = this.getModuleType(uniqueSections, isViewEncapsulated);
3028
+ this.moduleInstance = this.compiler.compileModuleAndAllComponentsSync(this.moduleType);
3029
+ this.sectionStore.componentFactories = this.moduleInstance.componentFactories;
3030
+ }
3031
+ destroy() {
3032
+ if (this.moduleInstance) {
3033
+ this.sectionStore.componentFactories = [];
3034
+ this.moduleInstance = null;
3035
+ }
3036
+ if (this.moduleType) {
3037
+ this.compiler.clearCacheFor(this.moduleType);
3038
+ this.moduleType = null;
3039
+ }
3040
+ }
3041
+ getDecoratedComponents(sections, isViewEncapsulated = false) {
3042
+ const result = [];
3043
+ sections.forEach(section => {
3044
+ var _a;
3045
+ const transpiledTemplate = this.getTranspiledTemplate(section);
3046
+ const DynamicComponent = Component({
3047
+ selector: section.dynamicSelector,
3048
+ template: transpiledTemplate,
3049
+ styles: [atob(section.styles || '')],
3050
+ providers: [SectionHelperService],
3051
+ encapsulation: isViewEncapsulated ? ViewEncapsulation.ShadowDom : ViewEncapsulation.Emulated,
3052
+ jit: true,
3053
+ })(class C extends BaseSectionComponent {
3054
+ });
3055
+ this.applySelectorField(DynamicComponent, (_a = section.dynamicSelector) !== null && _a !== void 0 ? _a : '');
3056
+ result.push(DynamicComponent);
3057
+ });
3058
+ return result;
3059
+ }
3060
+ getModuleType(sections, isViewEncapsulated) {
3061
+ const decoratedComponents = this.getDecoratedComponents(sections, isViewEncapsulated);
3062
+ let DynamicModule = class DynamicModule {
3063
+ };
3064
+ DynamicModule = __decorate([
3065
+ NgModule({
3066
+ imports: [
3067
+ CommonModule,
3068
+ RuntimeExecutionModule,
3069
+ CoreModule,
3070
+ VeloceElementsModule,
3071
+ ScrollingModule,
3072
+ ScrollingModule$1,
3073
+ ],
3074
+ declarations: [decoratedComponents],
3075
+ jit: true,
3076
+ })
3077
+ ], DynamicModule);
3078
+ return DynamicModule;
3079
+ }
3080
+ applySelectorField(target, dynamicSelector) {
3081
+ set(target, '$$dynamicSelector', dynamicSelector);
3082
+ }
3083
+ getUniqueSections(sections) {
3084
+ const uniqueSections = {};
3085
+ sections.forEach(section => {
3086
+ section.hash = SHA1.hex(section.template);
3087
+ const existingSection = section.hash ? uniqueSections[section.hash] : undefined;
3088
+ if (existingSection && existingSection.template === section.template) {
3089
+ section.dynamicSelector = existingSection.dynamicSelector;
3090
+ }
3091
+ else if (section.hash) {
3092
+ section.dynamicSelector = `section-${section.id}`;
3093
+ uniqueSections[section.hash] = section;
3094
+ }
3095
+ });
3096
+ return values(uniqueSections);
3097
+ }
3098
+ getTranspiledTemplate(section) {
3099
+ let template = section.template ? atob(section.template) : '';
3100
+ if (!EntityUtil.isEmpty(section.script) && template.indexOf('<section-script') === -1) {
3101
+ template = `<section-script></section-script>`.concat(template);
3102
+ }
3103
+ return template;
3104
+ }
3105
+ }
3106
+ SectionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionsService, deps: [{ token: i0.Compiler }, { token: i0.NgModuleRef }, { token: SectionStoreService }], target: i0.ɵɵFactoryTarget.Injectable });
3107
+ SectionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionsService });
3108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionsService, decorators: [{
3109
+ type: Injectable
3110
+ }], ctorParameters: function () { return [{ type: i0.Compiler }, { type: i0.NgModuleRef }, { type: SectionStoreService }]; } });
3111
+
3112
+ class SectionRendererComponent {
3113
+ constructor(_injector, _m, sectionScope, sectionStore) {
3114
+ this._injector = _injector;
3115
+ this._m = _m;
3116
+ this.sectionScope = sectionScope;
3117
+ this.sectionStore = sectionStore;
3118
+ this.componentRef = null;
3119
+ }
3120
+ set section(value) {
3121
+ this._section = value;
3122
+ this.sectionScope.section = value;
3123
+ }
3124
+ get section() {
3125
+ return this._section;
3126
+ }
3127
+ ngOnInit() {
3128
+ this.renderSection();
3129
+ }
3130
+ ngAfterViewInit() {
3131
+ var _a, _b;
3132
+ if (this.componentRef) {
3133
+ this.sectionScope.templates.next((_b = (_a = this.componentRef.instance['templates']) === null || _a === void 0 ? void 0 : _a.toArray()) !== null && _b !== void 0 ? _b : []);
3134
+ }
3135
+ }
3136
+ ngOnDestroy() {
3137
+ if (this.componentRef) {
3138
+ this.componentRef.destroy();
3139
+ this.componentRef = null;
3140
+ }
3141
+ }
3142
+ renderSection() {
3143
+ var _a;
3144
+ if (this.componentRef) {
3145
+ this.componentRef.destroy();
3146
+ this.componentRef = null;
3147
+ }
3148
+ const componentFactory = this.sectionStore.getComponentFactory(this._section);
3149
+ if (!componentFactory) {
3150
+ return;
3151
+ }
3152
+ this.componentRef = componentFactory.create(this._injector, [], null, this._m);
3153
+ this.componentRef.location.nativeElement.setAttribute('sectionId', `${(_a = this._section.model) === null || _a === void 0 ? void 0 : _a.id}${this._section.label}`);
3154
+ this.componentRef.instance['form'] = this.form;
3155
+ this.componentRef.instance['section'] = this.section;
3156
+ this.container.insert(this.componentRef.hostView);
3157
+ }
3158
+ }
3159
+ SectionRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionRendererComponent, deps: [{ token: i0.Injector }, { token: i0.NgModuleRef }, { token: SectionScopeService }, { token: SectionStoreService }], target: i0.ɵɵFactoryTarget.Component });
3160
+ SectionRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: SectionRendererComponent, selector: "vl-section-renderer", inputs: { section: "section", form: "form" }, providers: [SectionScopeService], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #container></ng-template>", styles: [":host{display:contents}\n"] });
3161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SectionRendererComponent, decorators: [{
3162
+ type: Component,
3163
+ args: [{
3164
+ selector: 'vl-section-renderer',
3165
+ templateUrl: 'section-renderer.component.html',
3166
+ styleUrls: ['section-renderer.component.scss'],
3167
+ providers: [SectionScopeService],
3168
+ }]
3169
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.NgModuleRef }, { type: SectionScopeService }, { type: SectionStoreService }]; }, propDecorators: { section: [{
3170
+ type: Input
3171
+ }], form: [{
3172
+ type: Input
3173
+ }], container: [{
3174
+ type: ViewChild,
3175
+ args: ['container', { read: ViewContainerRef, static: true }]
3176
+ }] } });
3177
+
3178
+ const defaultTemplate = btoa('<template-component></template-component>');
3179
+ class ComponentPreviewComponent {
3180
+ constructor(sectionsService, runtimeFormService, formScope, runtimeService, cdr) {
3181
+ this.sectionsService = sectionsService;
3182
+ this.runtimeFormService = runtimeFormService;
3183
+ this.formScope = formScope;
3184
+ this.runtimeService = runtimeService;
3185
+ this.cdr = cdr;
3186
+ this.form = new FormGroup({});
3187
+ this.showPreview = false;
3188
+ this.isNoPreviewAvailable = false;
3189
+ this.isPreviewFailed = false;
3190
+ }
3191
+ ngOnChanges(changes) {
3192
+ if (changes.data) {
3193
+ this.sectionsService.destroy();
3194
+ this.showPreview = false;
3195
+ this.isNoPreviewAvailable = false;
3196
+ this.isPreviewFailed = false;
3197
+ setTimeout(() => {
3198
+ var _a, _b;
3199
+ try {
3200
+ this.runPreview(this.data);
3201
+ this.cdr.detectChanges();
3202
+ }
3203
+ catch (e) {
3204
+ console.error((_b = (_a = e === null || e === void 0 ? void 0 : e.stack) !== null && _a !== void 0 ? _a : e === null || e === void 0 ? void 0 : e.error) !== null && _b !== void 0 ? _b : 'Error occured');
3205
+ this.showPreview = false;
3206
+ this.isPreviewFailed = true;
3207
+ this.cdr.detectChanges();
3208
+ }
3209
+ });
3210
+ }
3211
+ }
3212
+ runPreview(data) {
3213
+ var _a;
3214
+ const section = data.section && JSON.parse(data.section);
3215
+ if (!section) {
3216
+ this.isNoPreviewAvailable = true;
3217
+ return;
3218
+ }
3219
+ const model = Object.assign(Object.assign({}, ((_a = section === null || section === void 0 ? void 0 : section.model) !== null && _a !== void 0 ? _a : {
3220
+ attributes: [],
3221
+ lineItems: [],
3222
+ })), { id: UUID.UUID() });
3223
+ const componentSection = Object.assign(Object.assign({}, section), { script: data.componentScript ? btoa(data.componentScript) : '', styles: data.componentStyles ? btoa(data.componentStyles) : '', template: data.componentTemplate ? btoa(data.componentTemplate) : '', properties: data.componentProperties ? JSON.stringify(data.componentProperties) : {}, id: UUID.UUID(), model });
3224
+ const storySection = {
3225
+ id: UUID.UUID(),
3226
+ template: data.template ? btoa(data.template) : defaultTemplate,
3227
+ styles: data.styles ? btoa(data.styles) : '',
3228
+ script: data.script ? btoa(data.script) : '',
3229
+ children: [componentSection],
3230
+ model,
3231
+ };
3232
+ const sections = [storySection, componentSection];
3233
+ this.form = this.formScope.form = this.runtimeFormService.initForm(sections, model);
3234
+ this.createRuntimeContext(componentSection);
3235
+ this.sectionsService.compileModule(sections);
3236
+ this.section = storySection;
3237
+ this.showPreview = true;
3238
+ }
3239
+ createRuntimeContext(section) {
3240
+ const runtimeModel = RuntimeModel.create([], {});
3241
+ const rootType = Array.from(runtimeModel.components.values()).find(c => {
3242
+ var _a;
3243
+ return ((_a = section.model) === null || _a === void 0 ? void 0 : _a.type) &&
3244
+ runtimeModel.isEquals(c.typeName, section.model.type) &&
3245
+ EntityUtil.isPresent(c.productId);
3246
+ });
3247
+ const contextProductId = rootType ? rootType.productId : undefined;
3248
+ const context = {
3249
+ modelId: '',
3250
+ runtimeModel,
3251
+ runtimeMode: RuntimeMode.TEST,
3252
+ productId: contextProductId,
3253
+ properties: {},
3254
+ };
3255
+ this.runtimeService.setRuntimeContext(context);
3256
+ }
3257
+ }
3258
+ ComponentPreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ComponentPreviewComponent, deps: [{ token: SectionsService }, { token: RuntimeFormService }, { token: FormScopeService }, { token: RuntimeService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3259
+ ComponentPreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ComponentPreviewComponent, selector: "vl-component-preview", inputs: { data: "data" }, providers: [
3260
+ SectionsService,
3261
+ FormScopeService,
3262
+ CollapsibleStateService,
3263
+ RuntimeFormService,
3264
+ FormScopeService,
3265
+ RuntimeService,
3266
+ ], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"showPreview\">\n <vl-section-renderer [section]=\"section!\" [form]=\"form\"></vl-section-renderer>\n</ng-container>\n\n<span class=\"info\" *ngIf=\"isNoPreviewAvailable\">No preview available</span>\n<span class=\"info error\" *ngIf=\"isPreviewFailed\">Preview has failed</span>\n", styles: ["@charset \"UTF-8\";body.veloce-apex-index,body.veloce-index,body.sfdcBody{overflow:hidden;margin:0;padding:0}:host ::ng-deep .velo-app .modal.in .modal-dialog.runtime-modal{margin-left:5%;margin-right:5%;padding:0;position:relative;width:auto}:host ::ng-deep .modal-body.runtime-modal.main-container{height:100%;margin:0;padding:0}:host ::ng-deep .modal-body.runtime-modal.main-container .content-wrapper{display:flex;flex-direction:column;height:100%}:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper{display:flex;flex-direction:column;flex-grow:1;padding:0}:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid{height:100%;margin:0;padding:0;overflow:auto}:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid .input-form.form-horizontal,:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid .input-form.form-horizontal .form-horizontal,:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid section-script>:first-child{height:100%}:host ::ng-deep .runtime-modal .modal-content,:host ::ng-deep .gu-mirror .modal-content{background-color:--vl-input-background}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a{color:#333333b3;font-weight:600;text-transform:uppercase;letter-spacing:.85px;font-size:10px}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a.active,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a.active{color:#333}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a.disabled,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a.disabled{color:#33333380}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a.active:after,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a.active:after{background-color:#f36;bottom:-1px;content:\"\";height:1px;left:0;position:absolute;width:100%}:host ::ng-deep .runtime-modal .modal-content .modal-header,:host ::ng-deep .gu-mirror .modal-content .modal-header{background:transparent;color:#fff}:host ::ng-deep .runtime-modal .runtime-group-divider,:host ::ng-deep .gu-mirror .runtime-group-divider{border-bottom:1px solid #e5e5e5}:host ::ng-deep .runtime-modal .input-form-input,:host ::ng-deep .gu-mirror .input-form-input{position:relative;padding-left:0;padding-top:0}:host ::ng-deep .runtime-modal .input-form-input--required>label,:host ::ng-deep .gu-mirror .input-form-input--required>label{color:#ff4233;font-weight:bold}:host ::ng-deep .form-control-wrapper{position:relative}:host ::ng-deep .add-config-control:hover{background-color:#e96099;color:#fff;border:1px solid transparent}:host ::ng-deep .remove-config-control:hover{background-color:#828c9e;color:#fff}:host ::ng-deep .add-config-control[disabled],:host ::ng-deep .remove-config-control[disabled]{background-color:transparent;color:#ccc;border:1px dashed #ccc}:host ::ng-deep .add-config-control[disabled]:hover,:host ::ng-deep .remove-config-control[disabled]:hover{cursor:default}:host ::ng-deep .add-config-control{height:36px;width:36px;line-height:36px;font-size:14px;text-align:center;border-radius:50%;float:left;position:absolute;top:0;right:-57px;z-index:500;background-color:#e3337c;color:#fff;border:1px solid #e3337c;transition:all .5s ease 0s}:host ::ng-deep .add-config-control .plus-icon{line-height:36px}:host ::ng-deep .remove-config-control{height:36px;width:36px;line-height:36px;font-size:14px;text-align:center;margin-right:25px;border-radius:50%;float:left;position:absolute;top:33px;right:51px;z-index:500;background-color:transparent;color:#687285;border:1px solid transparent;transition:all .5s ease 0s}:host ::ng-deep .remove-config-control .plus-icon{line-height:36px}:host ::ng-deep .sidebar .new-wrapper{min-height:96px;margin-bottom:25px}:host ::ng-deep .sidebar .new-wrapper .add-container .add-card{left:0;margin-left:15px}:host ::ng-deep .ui-settings{height:100%;display:flex;flex-direction:column}:host ::ng-deep .runtime-modal .form-horizontal form,:host ::ng-deep .gu-mirror form{margin:0}:host ::ng-deep .runtime-modal .form-horizontal .form-group,:host ::ng-deep .gu-mirror .form-group{margin:0;padding:0}:host ::ng-deep .runtime-modal .form-horizontal .control.form-group,:host ::ng-deep .gu-mirror .control.form-group{margin-bottom:25px}:host ::ng-deep .runtime-modal .form-horizontal .form-control-wrapper,:host ::ng-deep .gu-mirror .form-control-wrapper{min-width:172px;margin-bottom:25px}:host ::ng-deep .runtime-modal .form-horizontal .quantity-form-input .form-control-wrapper,:host ::ng-deep .gu-mirror .quantity-form-input .form-control-wrapper{min-width:50px}:host ::ng-deep .runtime-modal .form-horizontal .quantity-form-input .form-control-wrapper .form-control,:host ::ng-deep .gu-mirror .quantity-form-input .form-control-wrapper .form-control{width:50px}:host ::ng-deep .runtime-left-side{height:calc(100% - 97px);background:#fff;padding:48px 56px 0}:host ::ng-deep .ui-controls-group{margin-left:-8px;margin-right:-8px}:host ::ng-deep .ui-controls-group .ui-control-type:hover{border-color:#3384ff}:host ::ng-deep .ui-controls-group .ui-control-type{position:relative;min-width:140px;float:left;border-radius:3px;border:1px solid #c4c4c4;background-color:#fff;width:calc(50% - 16px);padding:12px 13px;margin-bottom:16px;margin-right:8px;margin-left:8px;cursor:pointer}:host ::ng-deep .ui-controls-group .ui-control-type span{padding-left:3px}:host ::ng-deep .sidebar-header{letter-spacing:-.5px;padding-bottom:24px;padding-top:0;line-height:32px;font-size:24px;font-weight:700;color:#333}:host ::ng-deep .sidebar-header small{display:block;color:#333;font-size:11px;font-weight:300;line-height:20px;margin:0}:host ::ng-deep .sidebar-menu-list{color:#333333b3;margin:0;width:100%;list-style:none;font-size:12px}:host ::ng-deep .sidebar-menu-list li.active a,:host ::ng-deep .sidebar-menu-list li.active i{color:#005ee3}:host ::ng-deep .sidebar-menu-list li:hover{cursor:pointer}:host ::ng-deep .sidebar-menu-list li{text-align:right;padding-left:16px}:host ::ng-deep .sidebar-menu-list li a{padding:0 8px;margin-left:-8px;cursor:pointer;white-space:nowrap;color:inherit;font-weight:700;display:inline-block;line-height:32px}:host ::ng-deep .sidebar-menu-list li i{display:none;padding-right:5px}:host ::ng-deep .runtime-builder-content{min-height:100%}:host ::ng-deep .runtime-builder-content .input-form{margin:0;padding:18px 11px 0}:host ::ng-deep .runtime-builder-content .input-form .form-group{border:3px dashed transparent}:host ::ng-deep .runtime-builder-content .input-form .form-group:hover{border:3px dashed #dedede}:host ::ng-deep .runtime-right-side{background:#fff}:host ::ng-deep .sidebar-section .section-title{color:#a1a1a1;background:#fff;position:relative;display:inline-block;padding-right:16px;text-transform:uppercase;font-size:10px;letter-spacing:.2px}:host ::ng-deep .sidebar-section:before{content:\" \";position:absolute;top:50%;left:0;right:0;border-top:1px solid #e6e6e6}:host ::ng-deep .sidebar-section{position:relative;margin-top:16px;margin-bottom:16px}:host ::ng-deep .sidebar-section .section-title{color:#a1a1a1;background-color:var(--vl-input-background);position:relative;display:inline-block;padding-right:16px;padding-left:8px;text-transform:uppercase;font-size:6px;letter-spacing:.2px}:host ::ng-deep .section-wrapper{top:-21px;position:absolute;right:0;left:12px}:host ::ng-deep .container-box.container-box-bordered{border:1px solid rgba(0,0,0,.2);margin-bottom:25px;padding-left:25px}:host ::ng-deep .container-box.container-box-radio{margin-left:0}:host ::ng-deep .container-box.container-box-radio:hover,:host ::ng-deep .container-box.container-box-checkbox:hover{cursor:pointer}:host ::ng-deep .container-box{position:relative;overflow:auto;border:1px solid transparent;background:var(--vl-input-background)}:host ::ng-deep .container-box .container-box{border:1px solid rgba(0,0,0,.2);margin-left:25px;margin-right:25px;margin-bottom:25px}:host ::ng-deep .container-box .container-box:hover{border-color:var(--vl-primary-color)}:host ::ng-deep .container-box .box-title .header .header-label{color:#333;margin:0;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px;line-height:75px}:host ::ng-deep .container-box .box-title .header .header-label small{padding-left:21px;color:#757575;font-weight:400;font-size:10px;line-height:75px}:host ::ng-deep .container-box .box-title .header .header-qty-container,:host ::ng-deep .container-box .box-title .header .radio-button,:host ::ng-deep .container-box .box-title .header .checkbox-select{display:table-cell;vertical-align:middle;height:75px;padding-left:21px}:host ::ng-deep .container-box .box-title .header .header-qty-container .form-control,:host ::ng-deep .container-box .box-title .header .radio-button .form-control,:host ::ng-deep .container-box .box-title .header .checkbox-select .form-control{height:auto;color:#333;width:50px;border:1px solid #dddddd}:host ::ng-deep .container-box .box-title .header .header-qty-container .form-control:focus,:host ::ng-deep .container-box .box-title .header .radio-button .form-control:focus,:host ::ng-deep .container-box .box-title .header .checkbox-select .form-control:focus{border:1px solid #c4c4c4}:host ::ng-deep .container-box .box-title .header .header-qty-container .validation-message,:host ::ng-deep .container-box .box-title .header .radio-button .validation-message,:host ::ng-deep .container-box .box-title .header .checkbox-select .validation-message{position:absolute;margin-top:3px}:host ::ng-deep .container-box .box-title .header .radio-button,:host ::ng-deep .container-box .box-title .header .checkbox-select{padding-left:0;vertical-align:middle}:host ::ng-deep .container-box .box-content{padding:25px 0 25px 33px}:host ::ng-deep .container-box .timeline-item{clear:both;display:block;width:100%;position:relative}:host ::ng-deep .container-box .timeline-item:before{display:block!important;content:\"\";position:absolute;left:25px;top:-25px;bottom:25px;width:1px;border-left:1px dashed rgba(0,0,0,.2)}:host ::ng-deep .container-box .timeline-item .icon{background:#90c7ec;width:35px;height:35px;border-radius:50%;position:absolute;left:24px;top:4px}:host ::ng-deep .container-box .timeline-item .icon .fa.fa-upload{left:11px;top:10px}:host ::ng-deep .container-box .timeline-item .icon .fa{color:#fff;position:absolute}:host ::ng-deep .container-box .timeline-item .message .content{float:left;width:80%}:host ::ng-deep .container-box .container-group-control{background:transparent;text-transform:uppercase}:host ::ng-deep .container-box-custom{margin-bottom:25px}:host ::ng-deep .unchecked .container-box{border-color:#0003}:host ::ng-deep .unchecked .container-box:hover{border-color:var(--vl-primary-color)}:host ::ng-deep .unchecked.timeline-item .icon-circle{background-color:#6e6e6e}:host ::ng-deep .collapsed .box-content-wrapper{opacity:0;display:none;transition:max-height .3s .1s}:host ::ng-deep .box-content-wrapper{transition:opacity .5s .1s;display:block;opacity:1}:host ::ng-deep .box-actions{position:absolute;right:25px;z-index:2;top:21px;opacity:1;transition:height .3s ease-out,opacity .5s .1s}:host ::ng-deep .box-action-button{height:32px;width:32px;line-height:32px;font-size:12px;text-align:center;float:left;margin-left:5px;border-radius:50%;transition:all .25s ease 0s}:host ::ng-deep .box-action-button a{color:#0000008a}:host ::ng-deep .box-action-button .check-icon{line-height:32px}:host ::ng-deep .box-actions-group{top:18px;right:45px}:host ::ng-deep .box-action-button:hover,:host ::ng-deep .box-action-button:focus{background-color:#0000001a;cursor:pointer;outline:none}:host ::ng-deep .box-action-button:active{background-color:#0003;cursor:pointer}:host ::ng-deep .box-action-button.active{background-color:#0000001a}:host ::ng-deep .div-block{clear:both;display:block}:host ::ng-deep .div-inline{float:left}:host ::ng-deep .checkbox-select{position:relative;display:block}:host ::ng-deep .checkbox-select label{color:#333;margin:0;line-height:16px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px;padding-left:25px;position:relative;min-height:16px;cursor:pointer}:host ::ng-deep .checkbox-select input[type=checkbox]{position:absolute;width:16px;height:16px;top:0;left:0;z-index:1;cursor:pointer;opacity:0;filter:alpha(opacity=0);margin:0;line-height:normal}:host ::ng-deep .checkbox-select .input-helper:before{position:absolute;content:\"\";top:-1px;width:12px;height:12px;border-radius:2px;left:0;border:2px solid rgba(0,0,0,.54);transition:all;transition-duration:.25s}:host ::ng-deep .checkbox-select .input-helper:after{font-weight:100;line-height:12px;font-size:10px;color:#fff;font-family:FontAwesome;position:absolute;content:\"\\f00c\";width:12px;height:12px;background:#0065ff;border-radius:0;top:1px;left:2px;transform:scale(0);transition:all;transition-duration:.15s}:host ::ng-deep .checkbox-select input[type=checkbox]:checked+.input-helper:before,:host ::ng-deep .checkbox-select input[type=checkbox].checkbox--checked+.input-helper:before{border-color:var(--vl-primary-color)}:host ::ng-deep .checkbox-select input[type=checkbox]:checked+.input-helper:after,:host ::ng-deep .checkbox-select input[type=checkbox].checkbox--checked+.input-helper:after{transform:scale(1)}:host ::ng-deep .radio-button{position:relative;display:block}:host ::ng-deep .radio-button label{color:#333;margin:0;line-height:16px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px;padding-left:25px;position:relative;min-height:16px;cursor:pointer}:host ::ng-deep .radio-button input[type=radio]{position:absolute;width:16px;height:16px;top:0;left:0;z-index:1;cursor:pointer;opacity:0;filter:alpha(opacity=0);margin:0;line-height:normal}:host ::ng-deep .radio-button .input-helper:before{position:absolute;content:\"\";top:-1px;width:12px;height:12px;border-radius:50%;left:0;border:2px solid rgba(0,0,0,.54);transition:all;transition-duration:.25s}:host ::ng-deep .radio-button .input-helper:after{position:absolute;content:\"\";width:6px;height:6px;background:var(--vl-primary-color);border-radius:50%;top:4px;left:5px;transform:scale(0);transition:all;transition-duration:.25s}:host ::ng-deep .radio-button input[type=radio]:checked+.input-helper:before{border-color:var(--vl-primary-color)}:host ::ng-deep .radio-button input[type=radio]:checked+.input-helper:after{transform:scale(1)}:host ::ng-deep .radio-button[disabled] input[type=radio]+.input-helper:before,:host ::ng-deep .checkbox-select[disabled] input[type=radio]+.input-helper:before{border-color:#0003}:host ::ng-deep .radio-button[disabled] input[type=checkbox]+.input-helper:before,:host ::ng-deep .checkbox-select[disabled] input[type=checkbox]+.input-helper:before{border-color:#0003}:host ::ng-deep .radio-button[disabled] input[type=radio]+.input-helper:after,:host ::ng-deep .checkbox-select[disabled] input[type=radio]+.input-helper:after{background:rgba(0,0,0,.2)}:host ::ng-deep .radio-button[disabled] input[type=checkbox]+.input-helper:after,:host ::ng-deep .checkbox-select[disabled] input[type=checkbox]+.input-helper:after{background:rgba(0,0,0,.2)}:host ::ng-deep .form-control-wrapper .checkbox-select,:host ::ng-deep .form-control-wrapper .radio-button{padding-top:10px}:host ::ng-deep .shopping-bag-sidebar.open{transform:translate(-100%)}:host ::ng-deep .shopping-bag-sidebar{position:fixed;top:0;bottom:0;z-index:1051;width:420px;right:-420px;background-color:#2a2b30;transition:.3s transform}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart{color:#abacae;position:absolute;top:20%;width:50px;height:50px;line-height:50px;text-align:center;right:100%;left:auto;background:#2a2b30;border-radius:3px 0 0 3px;display:block}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:before{font-family:FontAwesome;content:\"\\f291\"}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:hover{text-decoration:none;color:#abacae}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:active,:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:focus,:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:visited{text-decoration:none;color:#abacae}:host ::ng-deep .shopping-bag-sidebar .cart-count{font-size:9px;font-weight:bold;line-height:15px;position:absolute;top:50%;right:8px;width:15px;height:15px;margin:-16px 0 0;text-align:center;color:#fff;border-radius:50%;background:var(--vl-primary-color)}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-container{overflow:auto;display:block;height:100%;padding:0 25px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item{color:#abacae;background-color:#000;position:relative;overflow:auto;margin-bottom:10px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title{position:relative;padding-right:25px;padding-left:25px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title .header{float:left;color:#abacae;margin:0;line-height:48px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title .box-actions{height:48px;float:right;top:0}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title .box-action-button{height:32px;width:32px;line-height:32px;font-size:10px;font-weight:700;margin-top:8px;text-align:center;transition:all .25s ease 0s;color:#fff;background-color:var(--vl-primary-color)}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-title{color:#cecece;font-size:11px;text-transform:uppercase;line-height:64px;font-weight:600;padding-top:0;margin-top:25px;margin-bottom:25px;text-align:right}:host ::ng-deep .container-box.hovered:before,:host ::ng-deep .box-title.hovered:before,:host ::ng-deep .container-box.selected:before,:host ::ng-deep .box-title.selected:before{top:0;right:0;left:0;bottom:0}:host ::ng-deep .selectable{position:relative;cursor:pointer}:host ::ng-deep .container-box.hovered:before{border-color:transparent}:host ::ng-deep .container-box.hovered{border-color:var(--vl-primary-color)}:host ::ng-deep .container-box.selected:before{border-color:transparent}:host ::ng-deep .container-box.selected{border-color:var(--vl-primary-color)}:host ::ng-deep .hovered:before{display:block!important;position:absolute;content:\" \";top:-15px;bottom:15px;left:-15px;right:15px;border:1px solid var(--vl-primary-color)}:host ::ng-deep .hovered .box-action-button{opacity:1!important}:host ::ng-deep .opacity-1{opacity:1!important}:host ::ng-deep .overflow-y--auto{overflow-y:auto}:host ::ng-deep .gu-mirror{position:fixed!important;margin:0!important;z-index:9999!important;opacity:.8;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)\";filter:alpha(opacity=80)}:host ::ng-deep .gu-hide{display:none!important}:host ::ng-deep .gu-unselectable{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}:host ::ng-deep .gu-transit{opacity:.2;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)\";filter:alpha(opacity=20)}:host ::ng-deep .top-nav-msg{margin-top:-30px}:host ::ng-deep .runtime-info-message ul{margin-bottom:0;list-style:none}:host ::ng-deep .runtime-info-message ul li{margin-bottom:10px}:host ::ng-deep .runtime-info-message ul li:last-child{margin-bottom:0}:host ::ng-deep .runtime-info-message .message-text{font-family:\"Open Sans\",Tahoma,sans-serif!important;overflow:hidden;padding:0;font-size:11px}:host ::ng-deep .runtime-attributes-popover .popover-arrow{display:none}:host ::ng-deep .runtime-attributes-popover .popover-content{padding:0}:host ::ng-deep .runtime-attributes-popover .runtime-content-wrapper{padding:0}:host ::ng-deep .runtime-attributes-popover .container-box-custom{margin-bottom:0}:host ::ng-deep .runtime-attributes-popover .input-form{margin:0;padding:0}:host ::ng-deep .runtime-attributes-popover .input-form form{margin-bottom:0}:host ::ng-deep .runtime-attributes-popover .input-form form .div-inline{display:block;float:none}:host ::ng-deep .runtime-attributes-popover .input-form form .form-group{padding:0;margin:0}:host ::ng-deep .runtime-attributes-popover .container-box .box-content{padding:0}:host ::ng-deep .v-custom-title,:host ::ng-deep .v-custom-description,:host ::ng-deep .v-custom-image{display:none}:host ::ng-deep .dropdown{position:relative}:host ::ng-deep .dropdown-toggle:focus{outline:0}:host ::ng-deep .dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;box-shadow:0 6px 12px #0000002d}:host ::ng-deep .dropdown-menu.pull-right{right:0;left:auto}:host ::ng-deep .dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}:host ::ng-deep .dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}:host ::ng-deep .dropdown-menu>li>a:hover,:host ::ng-deep .dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}:host ::ng-deep .dropdown-menu>.active>a,:host ::ng-deep .dropdown-menu>.active>a:hover,:host ::ng-deep .dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}:host ::ng-deep .dropdown-menu>.disabled>a,:host ::ng-deep .dropdown-menu>.disabled>a:hover,:host ::ng-deep .dropdown-menu>.disabled>a:focus{color:#777}:host ::ng-deep .dropdown-menu>.disabled>a:hover,:host ::ng-deep .dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)}:host ::ng-deep .open>.dropdown-menu{display:block}:host ::ng-deep .open>a{outline:0}:host ::ng-deep .dropdown-menu-right{right:0;left:auto}:host ::ng-deep .dropdown-menu-left{right:auto;left:0}:host ::ng-deep .dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}:host ::ng-deep .dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}\n", ".info{color:var(--vl-text-color-secondary);font-weight:300;font-size:13px;line-height:20px}.info.error{color:var(--vl-error-color)}\n"], components: [{ type: SectionRendererComponent, selector: "vl-section-renderer", inputs: ["section", "form"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ComponentPreviewComponent, decorators: [{
3268
+ type: Component,
3269
+ args: [{
3270
+ selector: 'vl-component-preview',
3271
+ templateUrl: './component-preview.component.html',
3272
+ styleUrls: ['../ui-runtime/runtime-legacy-styles.scss', './component-preview.component.scss'],
3273
+ changeDetection: ChangeDetectionStrategy.OnPush,
3274
+ providers: [
3275
+ SectionsService,
3276
+ FormScopeService,
3277
+ CollapsibleStateService,
3278
+ RuntimeFormService,
3279
+ FormScopeService,
3280
+ RuntimeService,
3281
+ ],
3282
+ }]
3283
+ }], ctorParameters: function () { return [{ type: SectionsService }, { type: RuntimeFormService }, { type: FormScopeService }, { type: RuntimeService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { data: [{
3284
+ type: Input
3285
+ }] } });
3286
+
3287
+ const getSectionTree = (src) => {
3288
+ const sections = EntityUtil.clone(src);
3289
+ const sectionIdMap = new Map();
3290
+ sections.forEach(section => sectionIdMap.set(section.id, section));
3291
+ const sectionTree = [];
3292
+ sections.forEach(section => {
3293
+ if (section.parentId) {
3294
+ const parentSection = sectionIdMap.get(section.parentId);
3295
+ if (parentSection) {
3296
+ const sectionFromMap = sectionIdMap.get(section.id);
3297
+ if (sectionFromMap) {
3298
+ parentSection.addChild(sectionFromMap);
3299
+ }
3300
+ }
3301
+ }
3302
+ else {
3303
+ const s = sectionIdMap.get(section.id);
3304
+ if (s) {
3305
+ sectionTree.push(s);
3306
+ }
3307
+ }
3308
+ });
3309
+ return sectionTree;
3310
+ };
3311
+
3312
+ class RuntimeComponent {
3313
+ constructor(sectionsService, formScope, collapsibleState, formService, runtimeService, messageService, contextService, orderByPipe, searchFilterPipe, cdr) {
3314
+ this.sectionsService = sectionsService;
3315
+ this.formScope = formScope;
3316
+ this.collapsibleState = collapsibleState;
3317
+ this.formService = formService;
3318
+ this.runtimeService = runtimeService;
3319
+ this.messageService = messageService;
3320
+ this.contextService = contextService;
3321
+ this.orderByPipe = orderByPipe;
3322
+ this.searchFilterPipe = searchFilterPipe;
3323
+ this.cdr = cdr;
3324
+ this.messageBucketId = 'ui.runtime';
3325
+ this.sortedSections = [];
3326
+ this.staticSections = [];
3327
+ this.form = new FormGroup({});
3328
+ this.solutionIsReady = false;
3329
+ this.unsubscribe = new Subject();
3330
+ this.solutionUpdated = new EventEmitter();
3331
+ }
3332
+ adjustPrice(valueOption, section, solutionLineItem, patch) {
3333
+ const parentLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3334
+ if (!parentLineItem) {
3335
+ return;
3336
+ }
3337
+ parentLineItem.lineItems = parentLineItem.lineItems.map(lineItem => {
3338
+ const { productId, chargeItems } = lineItem;
3339
+ if (productId !== valueOption) {
3340
+ return lineItem;
3341
+ }
3342
+ const chargeItem = chargeItems.shift();
3343
+ const updatedChargeItem = Object.assign(Object.assign({}, chargeItem), patch);
3344
+ return Object.assign(Object.assign({}, lineItem), { chargeItems: [updatedChargeItem, ...chargeItems] });
3345
+ });
3346
+ this.updateRuntime(solutionLineItem);
3347
+ }
3348
+ ngOnInit() {
3349
+ this.formScope.formSubmitEvent.pipe(takeUntil(this.unsubscribe)).subscribe((e) => {
3350
+ var _a, _b, _c, _d, _e, _f, _g;
3351
+ try {
3352
+ this.form.updateValueAndValidity();
3353
+ const solutionLineItem = EntityUtil.clone(this.solutionLineItem);
3354
+ const section = this.findSection(e.id);
3355
+ if (!section) {
3356
+ throw 'Section not found';
3357
+ }
3358
+ const entityType = section.boundData.entityType;
3359
+ if (entityType === BoundDataType[BoundDataType.PORT] || entityType === BoundDataType[BoundDataType.TYPE]) {
3360
+ if (e.action === 'patch' && EntityUtil.isPresent(e.valueOption)) {
3361
+ const valueOption = e['valueOption'];
3362
+ if (!((_a = section.model) === null || _a === void 0 ? void 0 : _a.parentId)) {
3363
+ this.collapsibleState.clearState(section.id);
3364
+ this.updateRuntime(valueOption);
3365
+ }
3366
+ else {
3367
+ const parentLineItem = LineItemUtil.findById(section.model.parentId, [solutionLineItem]);
3368
+ if (parentLineItem) {
3369
+ const indx = parentLineItem.lineItems.findIndex(item => { var _a; return item.id === ((_a = section.model) === null || _a === void 0 ? void 0 : _a.id); });
3370
+ parentLineItem.lineItems.splice(indx, 1, valueOption);
3371
+ this.collapsibleState.clearState(section.id);
3372
+ this.updateRuntime(solutionLineItem);
3373
+ }
3374
+ }
3375
+ }
3376
+ }
3377
+ if (entityType === BoundDataType[BoundDataType.PORT]) {
3378
+ if (e.action === 'upsert') {
3379
+ const parentLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3380
+ if (parentLineItem) {
3381
+ parentLineItem.lineItems.forEach(i => {
3382
+ if (e.selectedValueOptions &&
3383
+ e.selectedValueOptions.findIndex(v => v.toLowerCase() === i.type.toLowerCase()) < 0) {
3384
+ this.updateCardinalityVariable(parentLineItem, i, 0);
3385
+ }
3386
+ });
3387
+ const lineItems = parentLineItem === null || parentLineItem === void 0 ? void 0 : parentLineItem.lineItems.filter(i => e.selectedValueOptions &&
3388
+ e.selectedValueOptions.findIndex(v => v.toLowerCase() === i.type.toLowerCase()) > -1);
3389
+ (_b = e.selectedValueOptions) === null || _b === void 0 ? void 0 : _b.forEach(v => {
3390
+ if ((lineItems === null || lineItems === void 0 ? void 0 : lineItems.findIndex(item => item.type.toLowerCase() === v.toLowerCase())) === -1) {
3391
+ const lineItem = this.createLineItem(section, v, parentLineItem);
3392
+ this.updateCardinalityVariable(parentLineItem, lineItem);
3393
+ lineItems.push(lineItem);
3394
+ }
3395
+ });
3396
+ this.updateRuntime(solutionLineItem);
3397
+ }
3398
+ }
3399
+ if (e.action === 'create') {
3400
+ const parentLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3401
+ if (parentLineItem) {
3402
+ const valueOption = e.valueOption;
3403
+ const lineItem = this.createLineItem(section, valueOption, parentLineItem);
3404
+ parentLineItem.lineItems.push(lineItem);
3405
+ this.updateCardinalityVariable(parentLineItem, lineItem);
3406
+ this.updateRuntime(solutionLineItem);
3407
+ }
3408
+ }
3409
+ if (e.action === 'copy') {
3410
+ const parentLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3411
+ if (parentLineItem) {
3412
+ const valueOption = e.valueOption;
3413
+ const lineItemToCopy = parentLineItem.lineItems.find(li => li.id === valueOption);
3414
+ if (lineItemToCopy) {
3415
+ const lineItem = Object.assign(Object.assign({}, lineItemToCopy), { id: '' });
3416
+ parentLineItem.lineItems.push(lineItem);
3417
+ this.updateCardinalityVariable(parentLineItem, lineItem);
3418
+ this.updateRuntime(solutionLineItem);
3419
+ }
3420
+ }
3421
+ }
3422
+ if (e.action === 'update') {
3423
+ const parentLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3424
+ if (parentLineItem) {
3425
+ //Assuming that radio control is the only control, that 'updates' values
3426
+ const previous = (_c = section.model) === null || _c === void 0 ? void 0 : _c.lineItems.filter(li => li.port && li.port === section.boundData.name)[0];
3427
+ if (previous) {
3428
+ this.updateCardinalityVariable(parentLineItem, previous, 0);
3429
+ }
3430
+ const index = parentLineItem.lineItems.findIndex(li => li.id === (previous === null || previous === void 0 ? void 0 : previous.id));
3431
+ const lineItem = {
3432
+ id: UUID.UUID(),
3433
+ qty: previous === null || previous === void 0 ? void 0 : previous.qty,
3434
+ port: previous === null || previous === void 0 ? void 0 : previous.port,
3435
+ type: EntityUtil.isPresent(e.valueOption) ? e.valueOption : this.form.controls[e.id].value,
3436
+ cfgStatus: 'New',
3437
+ parentId: previous === null || previous === void 0 ? void 0 : previous.parentId,
3438
+ };
3439
+ this.updateCardinalityVariable(parentLineItem, lineItem);
3440
+ parentLineItem.lineItems[index] = lineItem;
3441
+ this.updateRuntime(solutionLineItem);
3442
+ }
3443
+ }
3444
+ if (e.action === 'remove') {
3445
+ const parentLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3446
+ if (parentLineItem &&
3447
+ SectionsBinderHelper.isRemoveAllowed(parentLineItem, section.boundData.name, (_d = section.model) === null || _d === void 0 ? void 0 : _d.qty)) {
3448
+ const index = parentLineItem.lineItems.findIndex(item => { var _a; return item.type.toLowerCase() === ((_a = e.valueOption) === null || _a === void 0 ? void 0 : _a.toLowerCase()); });
3449
+ if (index > -1) {
3450
+ const removed = parentLineItem.lineItems.splice(index, 1)[0];
3451
+ this.updateCardinalityVariable(parentLineItem, removed, 0);
3452
+ this.updateRuntime(solutionLineItem);
3453
+ }
3454
+ }
3455
+ }
3456
+ if (e.action === 'qtyUpdate') {
3457
+ const typeSection = e.valueOption
3458
+ ? SectionHelperService.findSectionForValue(section, e.valueOption)
3459
+ : undefined;
3460
+ const typeLineItem = (typeSection === null || typeSection === void 0 ? void 0 : typeSection.model) && LineItemUtil.findById(typeSection.model.id, [solutionLineItem]);
3461
+ if (typeSection && typeLineItem) {
3462
+ typeLineItem.qty = +this.form.controls[typeSection.id + 'qty'].value;
3463
+ typeLineItem.cfgStatus = 'User';
3464
+ this.updateRuntime(solutionLineItem);
3465
+ }
3466
+ }
3467
+ if (e.action === 'adjustNetPrice') {
3468
+ const { valueOption, options } = e;
3469
+ const { amount } = options !== null && options !== void 0 ? options : {};
3470
+ const priceAdjustment = {
3471
+ type: 'OVERRIDE_AMOUNT',
3472
+ explanation: 'Manual net price adjustment',
3473
+ amount,
3474
+ };
3475
+ this.adjustPrice(valueOption, section, solutionLineItem, { priceAdjustment });
3476
+ }
3477
+ if (e.action === 'adjustListPrice') {
3478
+ const { valueOption, options } = e;
3479
+ const { amount } = options !== null && options !== void 0 ? options : {};
3480
+ const listPriceAdjustment = {
3481
+ type: 'OVERRIDE_AMOUNT',
3482
+ explanation: 'Manual list price adjustment',
3483
+ amount,
3484
+ };
3485
+ this.adjustPrice(valueOption, section, solutionLineItem, { listPriceAdjustment });
3486
+ }
3487
+ }
3488
+ if (entityType === BoundDataType[BoundDataType.TYPE]) {
3489
+ if (e.action === 'remove') {
3490
+ const parentLineItem = ((_e = section.model) === null || _e === void 0 ? void 0 : _e.parentId) && LineItemUtil.findById(section.model.parentId, [solutionLineItem]);
3491
+ if (parentLineItem &&
3492
+ section.model &&
3493
+ section.model.port &&
3494
+ SectionsBinderHelper.isRemoveAllowed(parentLineItem, section.model.port, (_f = section.model) === null || _f === void 0 ? void 0 : _f.qty)) {
3495
+ const index = parentLineItem.lineItems.findIndex(item => { var _a; return item.id === ((_a = section.model) === null || _a === void 0 ? void 0 : _a.id); });
3496
+ if (index > -1) {
3497
+ const removed = parentLineItem.lineItems.splice(index, 1)[0];
3498
+ this.updateCardinalityVariable(parentLineItem, removed, 0);
3499
+ this.collapsibleState.clearState(section.id);
3500
+ this.updateRuntime(solutionLineItem);
3501
+ }
3502
+ }
3503
+ }
3504
+ if (e.action === 'qtyUpdate') {
3505
+ const typeLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3506
+ if (typeLineItem) {
3507
+ const qty = +this.form.controls[e.id + 'qty'].value;
3508
+ if (typeLineItem.parentId) {
3509
+ const parentLineItem = LineItemUtil.findById(typeLineItem.parentId, [solutionLineItem]);
3510
+ if (parentLineItem) {
3511
+ this.updateCardinalityVariable(parentLineItem, typeLineItem, qty);
3512
+ }
3513
+ }
3514
+ typeLineItem.qty = qty;
3515
+ typeLineItem.cfgStatus = 'User';
3516
+ this.updateRuntime(solutionLineItem);
3517
+ }
3518
+ }
3519
+ }
3520
+ if (entityType === BoundDataType[BoundDataType.ATTRIBUTE]) {
3521
+ if (e.action === 'update') {
3522
+ const parentLineItem = section.model && LineItemUtil.findById(section.model.id, [solutionLineItem]);
3523
+ const attribute = parentLineItem === null || parentLineItem === void 0 ? void 0 : parentLineItem.attributes.find(attr => attr.name.toLowerCase() === section.boundData.name.toLowerCase());
3524
+ if (attribute) {
3525
+ //Explicitly set value always win
3526
+ let value = typeof e.valueOption !== 'undefined' ? e.valueOption : this.form.controls[e.id].value;
3527
+ if (attribute.type === 'BOOLEAN') {
3528
+ value = value ? 1 : 0;
3529
+ }
3530
+ attribute.value = value;
3531
+ attribute.cfgStatus = 'User';
3532
+ this.updateRuntime(solutionLineItem);
3533
+ }
3534
+ }
3535
+ }
3536
+ }
3537
+ catch (e) {
3538
+ console.log(e);
3539
+ this.messageService.add({ key: this.messageBucketId, summary: `Configuration failed ${(_g = e) === null || _g === void 0 ? void 0 : _g.message}` });
3540
+ }
3541
+ });
3542
+ this.runtimeService.onSolutionReadyEvent
3543
+ .pipe(takeUntil(this.unsubscribe))
3544
+ .subscribe(lineItem => this.onSolutionReady(lineItem));
3545
+ this.runtimeService.onSolutionUpdatedEvent
3546
+ .pipe(takeUntil(this.unsubscribe))
3547
+ .subscribe((data) => {
3548
+ if (!(data instanceof HttpErrorResponse)) {
3549
+ return this.handleSolutionUpdate(data);
3550
+ }
3551
+ this.handleSolutionFailedUpdate(data);
3552
+ });
3553
+ this.runtimeService.onUIRefreshEvent.pipe(takeUntil(this.unsubscribe)).subscribe(() => {
3554
+ var _a;
3555
+ const { uiDefinition } = (_a = this.runtimeService.getRuntimeContext()) !== null && _a !== void 0 ? _a : {};
3556
+ this.runtimeContext.uiDefinition = uiDefinition;
3557
+ this.formScope.scriptSessionScope = {};
3558
+ this.startRuntime();
3559
+ });
3560
+ }
3561
+ onSolutionReady(lineItem) {
3562
+ var _a;
3563
+ const context = this.runtimeService.getRuntimeContext();
3564
+ const configurationContext = this.contextService.resolve();
3565
+ const mergeContext = Object.assign(Object.assign({}, context), { properties: Object.assign(Object.assign({}, context.properties), configurationContext.properties) });
3566
+ const accountId = (_a = mergeContext.properties) === null || _a === void 0 ? void 0 : _a.AccountId;
3567
+ if (accountId && accountId.length === 15) {
3568
+ this.runtimeContext = Object.assign(Object.assign({}, mergeContext), { properties: Object.assign(Object.assign({}, mergeContext.properties), { AccountId: SalesforceIdUtils.generateId18FromId15(accountId) }) });
3569
+ }
3570
+ else {
3571
+ this.runtimeContext = mergeContext;
3572
+ }
3573
+ this.solutionLineItem = lineItem;
3574
+ this.runtimeService.setRuntimeContext(this.runtimeContext);
3575
+ this.startRuntime();
3576
+ }
3577
+ handleSolutionUpdate(updatedLineItem) {
3578
+ this.solutionLineItem = updatedLineItem;
3579
+ this.processSolution(true);
3580
+ this.runtimeService.solutionProcessed(this.solutionLineItem);
3581
+ this.cdr.detectChanges();
3582
+ }
3583
+ handleSolutionFailedUpdate(error) {
3584
+ var _a;
3585
+ const hasErrorMessage = EntityUtil.isPresent(error.error) && EntityUtil.isPresent(error.error.message);
3586
+ const message = hasErrorMessage ? error.error.message : 'Configuration failed';
3587
+ const { isHandlingConfigurationErrors } = (_a = this.runtimeContext.uiDefinition) !== null && _a !== void 0 ? _a : {};
3588
+ if (isHandlingConfigurationErrors) {
3589
+ this.messageService.add({ key: this.messageBucketId, summary: message });
3590
+ }
3591
+ this.solutionLineItem = Object.assign(Object.assign({}, this.solutionLineItem), { messages: [...this.solutionLineItem.messages, `E:${message}`] });
3592
+ this.processSolution(true, true);
3593
+ this.runtimeService.solutionProcessed(this.solutionLineItem);
3594
+ this.cdr.detectChanges();
3595
+ }
3596
+ updateCardinalityVariable(parent, updated, newQuantity) {
3597
+ var _a;
3598
+ const portDomain = updated.port ? parent.portDomains[updated.port] : undefined;
3599
+ const domainType = portDomain === null || portDomain === void 0 ? void 0 : portDomain.domainTypes.find(t => t.name === updated.type);
3600
+ const cardinality = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.cardinality) !== null && _a !== void 0 ? _a : 0;
3601
+ let qty;
3602
+ if (!Number.isFinite(domainType === null || domainType === void 0 ? void 0 : domainType.cardinality)) {
3603
+ qty = Number.isFinite(newQuantity) ? newQuantity : updated.qty;
3604
+ }
3605
+ else {
3606
+ qty = EntityUtil.isPresent(newQuantity)
3607
+ ? cardinality - updated.qty + newQuantity
3608
+ : cardinality + updated.qty;
3609
+ }
3610
+ const cardinalityName = '#CV-' + updated.type + '@' + updated.port;
3611
+ let cardinalityVariable = parent.attributes.find(a => a.name === cardinalityName);
3612
+ if (!cardinalityVariable) {
3613
+ cardinalityVariable = {
3614
+ id: UUID.UUID(),
3615
+ name: cardinalityName,
3616
+ };
3617
+ parent.attributes.push(cardinalityVariable);
3618
+ }
3619
+ cardinalityVariable.value = qty;
3620
+ cardinalityVariable.cfgStatus = 'User';
3621
+ }
3622
+ createLineItem(section, valueOption, parentLineItem) {
3623
+ return {
3624
+ qty: +this.form.controls[section.id + 'qty'].value,
3625
+ port: section.boundData.name,
3626
+ type: EntityUtil.isPresent(valueOption) ? valueOption : this.form.controls[section.id].value,
3627
+ cfgStatus: 'New',
3628
+ parentId: parentLineItem === null || parentLineItem === void 0 ? void 0 : parentLineItem.id,
3629
+ };
3630
+ }
3631
+ ngOnDestroy() {
3632
+ this.unsubscribe.next();
3633
+ this.sectionsService.destroy();
3634
+ }
3635
+ startRuntime() {
3636
+ var _a, _b, _c;
3637
+ const uiDefinition = this.runtimeContext.uiDefinition;
3638
+ const defaultTab = (_a = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.tabs) === null || _a === void 0 ? void 0 : _a.find(tab => tab.isDefault);
3639
+ this.activeUITab = EntityUtil.isPresent(defaultTab) ? defaultTab : (_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.tabs) === null || _b === void 0 ? void 0 : _b[0];
3640
+ this.sectionsService.compileModule((_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.sections) !== null && _c !== void 0 ? _c : [], uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.isViewEncapsulated);
3641
+ this.processSolution();
3642
+ this.solutionIsReady = true;
3643
+ this.cdr.detectChanges();
3644
+ }
3645
+ updateRuntime(lineItem) {
3646
+ this.solutionUpdated.emit(lineItem);
3647
+ }
3648
+ addToCart() {
3649
+ const lineItem = EntityUtil.clone(this.solutionLineItem);
3650
+ this.runtimeService.stopRuntime(lineItem);
3651
+ }
3652
+ processSolution(isUpdate, isError) {
3653
+ var _a, _b, _c, _d, _e, _f;
3654
+ //1. Bind sections to solution
3655
+ let sections = (_b = EntityUtil.clone((_a = this.runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.sections)) !== null && _b !== void 0 ? _b : [];
3656
+ const sourceSections = (_d = EntityUtil.clone((_c = this.runtimeContext.uiDefinition) === null || _c === void 0 ? void 0 : _c.sections)) !== null && _d !== void 0 ? _d : [];
3657
+ this.updateLineItemsSectionPath(this.solutionLineItem);
3658
+ SectionsBinderHelper.setLineItemsPath(this.runtimeContext.runtimeModel, this.solutionLineItem, sections, sourceSections, (sec) => !sec.parentId && sec.boundData, (_f = (_e = this.runtimeContext.uiDefinition) === null || _e === void 0 ? void 0 : _e.pricingEnabled) !== null && _f !== void 0 ? _f : false);
3659
+ sections = sections.filter(s => s.model && s.template);
3660
+ //2. Init form
3661
+ this.form = this.formService.initForm(sections, this.solutionLineItem);
3662
+ this.formScope.form = this.form;
3663
+ this.sortedSections = this.filterAndSort(getSectionTree(sections.filter(s => !s.isStatic)));
3664
+ if (!isUpdate) {
3665
+ this.staticSections = this.filterAndSort(getSectionTree(sections.filter(s => s.isStatic)));
3666
+ }
3667
+ if (!isError) {
3668
+ this.messageService.clear(this.messageBucketId);
3669
+ }
3670
+ }
3671
+ hideModal() {
3672
+ this.runtimeService.cancelRuntime();
3673
+ }
3674
+ updateLineItemsSectionPath(lineItem, parent) {
3675
+ const path = {
3676
+ types: parent ? parent.types.concat([lineItem.type]) : [lineItem.type],
3677
+ ports: parent ? parent.ports.concat(lineItem.port ? [lineItem.port] : []) : [],
3678
+ };
3679
+ lineItem.path = path;
3680
+ for (const child of lineItem.lineItems) {
3681
+ this.updateLineItemsSectionPath(child, lineItem.path);
3682
+ }
3683
+ }
3684
+ filterAndSort(sections) {
3685
+ var _a;
3686
+ const filtered = this.searchFilterPipe.transform(sections, (_a = this.activeUITab) === null || _a === void 0 ? void 0 : _a.id, 'page');
3687
+ const ordered = this.orderByPipe.transform(filtered, 'order', 'asc');
3688
+ return ordered;
3689
+ }
3690
+ findSection(id) {
3691
+ return EntityUtil.findByFieldHierarchically('id', id, [...this.sortedSections, ...this.staticSections], 'children');
3692
+ }
3693
+ }
3694
+ RuntimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeComponent, deps: [{ token: SectionsService }, { token: FormScopeService }, { token: CollapsibleStateService }, { token: RuntimeFormService }, { token: RuntimeService }, { token: MessageService }, { token: i2.ContextService }, { token: i7.OrderByPipe }, { token: i7.SearchFilterPipe }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3695
+ RuntimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: RuntimeComponent, selector: "vl-runtime", outputs: { solutionUpdated: "solutionUpdated" }, providers: [FormScopeService, CollapsibleStateService, OrderByPipe, SearchFilterPipe], ngImport: i0, template: "<vl-loader label=\"Loading UI\" *ngIf=\"!solutionIsReady; else content\"></vl-loader>\n\n<ng-template #content>\n <!-- TODO: Add validation messages -->\n\n <div\n class=\"sidebar-tabs\"\n [ngClass]=\"{ hidden: !runtimeContext?.uiDefinition?.defaultPanels }\"\n #uiTabs=\"sidebarTabs\"\n sidebarTabs=\"{{ activeUITab?.id }}\"\n id=\"vl-default-sidebar-tabs\"\n >\n <ul>\n <li\n *ngFor=\"let tab of runtimeContext?.uiDefinition?.tabs | orderBy: 'order':'asc'\"\n [ngClass]=\"{ active: uiTabs.activeTab === tab.id }\"\n (click)=\"uiTabs.switchTab(tab.id)\"\n >\n <a href=\"javascript:void(0);\">{{ tab.name }}</a>\n </li>\n </ul>\n </div>\n\n <div class=\"sections-wrapper\">\n <form role=\"form\" name=\"form\" class=\"form-horizontal\" [formGroup]=\"form\" novalidate autocomplete=\"off\">\n <ng-container *ngFor=\"let section of staticSections; let i = index\">\n <ng-container *ngIf=\"section.model && section.template && !section.hidden\">\n <vl-section-renderer [section]=\"section\" [form]=\"form\"></vl-section-renderer>\n </ng-container>\n </ng-container>\n\n <ng-container *ngFor=\"let section of sortedSections; let i = index\">\n <ng-container *ngIf=\"section.model && section.template && !section.hidden\">\n <vl-section-renderer [section]=\"section\" [form]=\"form\"></vl-section-renderer>\n </ng-container>\n </ng-container>\n </form>\n\n <div\n class=\"modal-footer\"\n *ngIf=\"runtimeContext?.runtimeMode === 1\"\n id=\"vl-runtime-default-footer\"\n [ngClass]=\"{ hidden: !runtimeContext?.uiDefinition?.defaultPanels }\"\n >\n <div class=\"col-md-12 input-form-input\">\n <a href=\"javascript:void(0);\" class=\"btn btn-default\" (click)=\"form.valid && addToCart()\" id=\"add-to-cart-btn\"\n >Add to cart</a\n >\n <a href=\"javascript:void(0);\" class=\"btn btn-link\" (click)=\"hideModal()\" id=\"cancel-btn\">Cancel</a>\n </div>\n </div>\n </div>\n\n <div style=\"position: relative\">\n <!-- TODO: Add validation messages -->\n </div>\n</ng-template>\n", styles: ["@charset \"UTF-8\";body.veloce-apex-index,body.veloce-index,body.sfdcBody{overflow:hidden;margin:0;padding:0}:host ::ng-deep .velo-app .modal.in .modal-dialog.runtime-modal{margin-left:5%;margin-right:5%;padding:0;position:relative;width:auto}:host ::ng-deep .modal-body.runtime-modal.main-container{height:100%;margin:0;padding:0}:host ::ng-deep .modal-body.runtime-modal.main-container .content-wrapper{display:flex;flex-direction:column;height:100%}:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper{display:flex;flex-direction:column;flex-grow:1;padding:0}:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid{height:100%;margin:0;padding:0;overflow:auto}:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid .input-form.form-horizontal,:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid .input-form.form-horizontal .form-horizontal,:host ::ng-deep .modal-body.runtime-modal.main-container .sections-wrapper .modal-body.runtime-modal.container-fluid section-script>:first-child{height:100%}:host ::ng-deep .runtime-modal .modal-content,:host ::ng-deep .gu-mirror .modal-content{background-color:--vl-input-background}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a{color:#333333b3;font-weight:600;text-transform:uppercase;letter-spacing:.85px;font-size:10px}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a.active,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a.active{color:#333}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a.disabled,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a.disabled{color:#33333380}:host ::ng-deep .runtime-modal .modal-content .modal-header-menu ul li a.active:after,:host ::ng-deep .gu-mirror .modal-content .modal-header-menu ul li a.active:after{background-color:#f36;bottom:-1px;content:\"\";height:1px;left:0;position:absolute;width:100%}:host ::ng-deep .runtime-modal .modal-content .modal-header,:host ::ng-deep .gu-mirror .modal-content .modal-header{background:transparent;color:#fff}:host ::ng-deep .runtime-modal .runtime-group-divider,:host ::ng-deep .gu-mirror .runtime-group-divider{border-bottom:1px solid #e5e5e5}:host ::ng-deep .runtime-modal .input-form-input,:host ::ng-deep .gu-mirror .input-form-input{position:relative;padding-left:0;padding-top:0}:host ::ng-deep .runtime-modal .input-form-input--required>label,:host ::ng-deep .gu-mirror .input-form-input--required>label{color:#ff4233;font-weight:bold}:host ::ng-deep .form-control-wrapper{position:relative}:host ::ng-deep .add-config-control:hover{background-color:#e96099;color:#fff;border:1px solid transparent}:host ::ng-deep .remove-config-control:hover{background-color:#828c9e;color:#fff}:host ::ng-deep .add-config-control[disabled],:host ::ng-deep .remove-config-control[disabled]{background-color:transparent;color:#ccc;border:1px dashed #ccc}:host ::ng-deep .add-config-control[disabled]:hover,:host ::ng-deep .remove-config-control[disabled]:hover{cursor:default}:host ::ng-deep .add-config-control{height:36px;width:36px;line-height:36px;font-size:14px;text-align:center;border-radius:50%;float:left;position:absolute;top:0;right:-57px;z-index:500;background-color:#e3337c;color:#fff;border:1px solid #e3337c;transition:all .5s ease 0s}:host ::ng-deep .add-config-control .plus-icon{line-height:36px}:host ::ng-deep .remove-config-control{height:36px;width:36px;line-height:36px;font-size:14px;text-align:center;margin-right:25px;border-radius:50%;float:left;position:absolute;top:33px;right:51px;z-index:500;background-color:transparent;color:#687285;border:1px solid transparent;transition:all .5s ease 0s}:host ::ng-deep .remove-config-control .plus-icon{line-height:36px}:host ::ng-deep .sidebar .new-wrapper{min-height:96px;margin-bottom:25px}:host ::ng-deep .sidebar .new-wrapper .add-container .add-card{left:0;margin-left:15px}:host ::ng-deep .ui-settings{height:100%;display:flex;flex-direction:column}:host ::ng-deep .runtime-modal .form-horizontal form,:host ::ng-deep .gu-mirror form{margin:0}:host ::ng-deep .runtime-modal .form-horizontal .form-group,:host ::ng-deep .gu-mirror .form-group{margin:0;padding:0}:host ::ng-deep .runtime-modal .form-horizontal .control.form-group,:host ::ng-deep .gu-mirror .control.form-group{margin-bottom:25px}:host ::ng-deep .runtime-modal .form-horizontal .form-control-wrapper,:host ::ng-deep .gu-mirror .form-control-wrapper{min-width:172px;margin-bottom:25px}:host ::ng-deep .runtime-modal .form-horizontal .quantity-form-input .form-control-wrapper,:host ::ng-deep .gu-mirror .quantity-form-input .form-control-wrapper{min-width:50px}:host ::ng-deep .runtime-modal .form-horizontal .quantity-form-input .form-control-wrapper .form-control,:host ::ng-deep .gu-mirror .quantity-form-input .form-control-wrapper .form-control{width:50px}:host ::ng-deep .runtime-left-side{height:calc(100% - 97px);background:#fff;padding:48px 56px 0}:host ::ng-deep .ui-controls-group{margin-left:-8px;margin-right:-8px}:host ::ng-deep .ui-controls-group .ui-control-type:hover{border-color:#3384ff}:host ::ng-deep .ui-controls-group .ui-control-type{position:relative;min-width:140px;float:left;border-radius:3px;border:1px solid #c4c4c4;background-color:#fff;width:calc(50% - 16px);padding:12px 13px;margin-bottom:16px;margin-right:8px;margin-left:8px;cursor:pointer}:host ::ng-deep .ui-controls-group .ui-control-type span{padding-left:3px}:host ::ng-deep .sidebar-header{letter-spacing:-.5px;padding-bottom:24px;padding-top:0;line-height:32px;font-size:24px;font-weight:700;color:#333}:host ::ng-deep .sidebar-header small{display:block;color:#333;font-size:11px;font-weight:300;line-height:20px;margin:0}:host ::ng-deep .sidebar-menu-list{color:#333333b3;margin:0;width:100%;list-style:none;font-size:12px}:host ::ng-deep .sidebar-menu-list li.active a,:host ::ng-deep .sidebar-menu-list li.active i{color:#005ee3}:host ::ng-deep .sidebar-menu-list li:hover{cursor:pointer}:host ::ng-deep .sidebar-menu-list li{text-align:right;padding-left:16px}:host ::ng-deep .sidebar-menu-list li a{padding:0 8px;margin-left:-8px;cursor:pointer;white-space:nowrap;color:inherit;font-weight:700;display:inline-block;line-height:32px}:host ::ng-deep .sidebar-menu-list li i{display:none;padding-right:5px}:host ::ng-deep .runtime-builder-content{min-height:100%}:host ::ng-deep .runtime-builder-content .input-form{margin:0;padding:18px 11px 0}:host ::ng-deep .runtime-builder-content .input-form .form-group{border:3px dashed transparent}:host ::ng-deep .runtime-builder-content .input-form .form-group:hover{border:3px dashed #dedede}:host ::ng-deep .runtime-right-side{background:#fff}:host ::ng-deep .sidebar-section .section-title{color:#a1a1a1;background:#fff;position:relative;display:inline-block;padding-right:16px;text-transform:uppercase;font-size:10px;letter-spacing:.2px}:host ::ng-deep .sidebar-section:before{content:\" \";position:absolute;top:50%;left:0;right:0;border-top:1px solid #e6e6e6}:host ::ng-deep .sidebar-section{position:relative;margin-top:16px;margin-bottom:16px}:host ::ng-deep .sidebar-section .section-title{color:#a1a1a1;background-color:var(--vl-input-background);position:relative;display:inline-block;padding-right:16px;padding-left:8px;text-transform:uppercase;font-size:6px;letter-spacing:.2px}:host ::ng-deep .section-wrapper{top:-21px;position:absolute;right:0;left:12px}:host ::ng-deep .container-box.container-box-bordered{border:1px solid rgba(0,0,0,.2);margin-bottom:25px;padding-left:25px}:host ::ng-deep .container-box.container-box-radio{margin-left:0}:host ::ng-deep .container-box.container-box-radio:hover,:host ::ng-deep .container-box.container-box-checkbox:hover{cursor:pointer}:host ::ng-deep .container-box{position:relative;overflow:auto;border:1px solid transparent;background:var(--vl-input-background)}:host ::ng-deep .container-box .container-box{border:1px solid rgba(0,0,0,.2);margin-left:25px;margin-right:25px;margin-bottom:25px}:host ::ng-deep .container-box .container-box:hover{border-color:var(--vl-primary-color)}:host ::ng-deep .container-box .box-title .header .header-label{color:#333;margin:0;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px;line-height:75px}:host ::ng-deep .container-box .box-title .header .header-label small{padding-left:21px;color:#757575;font-weight:400;font-size:10px;line-height:75px}:host ::ng-deep .container-box .box-title .header .header-qty-container,:host ::ng-deep .container-box .box-title .header .radio-button,:host ::ng-deep .container-box .box-title .header .checkbox-select{display:table-cell;vertical-align:middle;height:75px;padding-left:21px}:host ::ng-deep .container-box .box-title .header .header-qty-container .form-control,:host ::ng-deep .container-box .box-title .header .radio-button .form-control,:host ::ng-deep .container-box .box-title .header .checkbox-select .form-control{height:auto;color:#333;width:50px;border:1px solid #dddddd}:host ::ng-deep .container-box .box-title .header .header-qty-container .form-control:focus,:host ::ng-deep .container-box .box-title .header .radio-button .form-control:focus,:host ::ng-deep .container-box .box-title .header .checkbox-select .form-control:focus{border:1px solid #c4c4c4}:host ::ng-deep .container-box .box-title .header .header-qty-container .validation-message,:host ::ng-deep .container-box .box-title .header .radio-button .validation-message,:host ::ng-deep .container-box .box-title .header .checkbox-select .validation-message{position:absolute;margin-top:3px}:host ::ng-deep .container-box .box-title .header .radio-button,:host ::ng-deep .container-box .box-title .header .checkbox-select{padding-left:0;vertical-align:middle}:host ::ng-deep .container-box .box-content{padding:25px 0 25px 33px}:host ::ng-deep .container-box .timeline-item{clear:both;display:block;width:100%;position:relative}:host ::ng-deep .container-box .timeline-item:before{display:block!important;content:\"\";position:absolute;left:25px;top:-25px;bottom:25px;width:1px;border-left:1px dashed rgba(0,0,0,.2)}:host ::ng-deep .container-box .timeline-item .icon{background:#90c7ec;width:35px;height:35px;border-radius:50%;position:absolute;left:24px;top:4px}:host ::ng-deep .container-box .timeline-item .icon .fa.fa-upload{left:11px;top:10px}:host ::ng-deep .container-box .timeline-item .icon .fa{color:#fff;position:absolute}:host ::ng-deep .container-box .timeline-item .message .content{float:left;width:80%}:host ::ng-deep .container-box .container-group-control{background:transparent;text-transform:uppercase}:host ::ng-deep .container-box-custom{margin-bottom:25px}:host ::ng-deep .unchecked .container-box{border-color:#0003}:host ::ng-deep .unchecked .container-box:hover{border-color:var(--vl-primary-color)}:host ::ng-deep .unchecked.timeline-item .icon-circle{background-color:#6e6e6e}:host ::ng-deep .collapsed .box-content-wrapper{opacity:0;display:none;transition:max-height .3s .1s}:host ::ng-deep .box-content-wrapper{transition:opacity .5s .1s;display:block;opacity:1}:host ::ng-deep .box-actions{position:absolute;right:25px;z-index:2;top:21px;opacity:1;transition:height .3s ease-out,opacity .5s .1s}:host ::ng-deep .box-action-button{height:32px;width:32px;line-height:32px;font-size:12px;text-align:center;float:left;margin-left:5px;border-radius:50%;transition:all .25s ease 0s}:host ::ng-deep .box-action-button a{color:#0000008a}:host ::ng-deep .box-action-button .check-icon{line-height:32px}:host ::ng-deep .box-actions-group{top:18px;right:45px}:host ::ng-deep .box-action-button:hover,:host ::ng-deep .box-action-button:focus{background-color:#0000001a;cursor:pointer;outline:none}:host ::ng-deep .box-action-button:active{background-color:#0003;cursor:pointer}:host ::ng-deep .box-action-button.active{background-color:#0000001a}:host ::ng-deep .div-block{clear:both;display:block}:host ::ng-deep .div-inline{float:left}:host ::ng-deep .checkbox-select{position:relative;display:block}:host ::ng-deep .checkbox-select label{color:#333;margin:0;line-height:16px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px;padding-left:25px;position:relative;min-height:16px;cursor:pointer}:host ::ng-deep .checkbox-select input[type=checkbox]{position:absolute;width:16px;height:16px;top:0;left:0;z-index:1;cursor:pointer;opacity:0;filter:alpha(opacity=0);margin:0;line-height:normal}:host ::ng-deep .checkbox-select .input-helper:before{position:absolute;content:\"\";top:-1px;width:12px;height:12px;border-radius:2px;left:0;border:2px solid rgba(0,0,0,.54);transition:all;transition-duration:.25s}:host ::ng-deep .checkbox-select .input-helper:after{font-weight:100;line-height:12px;font-size:10px;color:#fff;font-family:FontAwesome;position:absolute;content:\"\\f00c\";width:12px;height:12px;background:#0065ff;border-radius:0;top:1px;left:2px;transform:scale(0);transition:all;transition-duration:.15s}:host ::ng-deep .checkbox-select input[type=checkbox]:checked+.input-helper:before,:host ::ng-deep .checkbox-select input[type=checkbox].checkbox--checked+.input-helper:before{border-color:var(--vl-primary-color)}:host ::ng-deep .checkbox-select input[type=checkbox]:checked+.input-helper:after,:host ::ng-deep .checkbox-select input[type=checkbox].checkbox--checked+.input-helper:after{transform:scale(1)}:host ::ng-deep .radio-button{position:relative;display:block}:host ::ng-deep .radio-button label{color:#333;margin:0;line-height:16px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px;padding-left:25px;position:relative;min-height:16px;cursor:pointer}:host ::ng-deep .radio-button input[type=radio]{position:absolute;width:16px;height:16px;top:0;left:0;z-index:1;cursor:pointer;opacity:0;filter:alpha(opacity=0);margin:0;line-height:normal}:host ::ng-deep .radio-button .input-helper:before{position:absolute;content:\"\";top:-1px;width:12px;height:12px;border-radius:50%;left:0;border:2px solid rgba(0,0,0,.54);transition:all;transition-duration:.25s}:host ::ng-deep .radio-button .input-helper:after{position:absolute;content:\"\";width:6px;height:6px;background:var(--vl-primary-color);border-radius:50%;top:4px;left:5px;transform:scale(0);transition:all;transition-duration:.25s}:host ::ng-deep .radio-button input[type=radio]:checked+.input-helper:before{border-color:var(--vl-primary-color)}:host ::ng-deep .radio-button input[type=radio]:checked+.input-helper:after{transform:scale(1)}:host ::ng-deep .radio-button[disabled] input[type=radio]+.input-helper:before,:host ::ng-deep .checkbox-select[disabled] input[type=radio]+.input-helper:before{border-color:#0003}:host ::ng-deep .radio-button[disabled] input[type=checkbox]+.input-helper:before,:host ::ng-deep .checkbox-select[disabled] input[type=checkbox]+.input-helper:before{border-color:#0003}:host ::ng-deep .radio-button[disabled] input[type=radio]+.input-helper:after,:host ::ng-deep .checkbox-select[disabled] input[type=radio]+.input-helper:after{background:rgba(0,0,0,.2)}:host ::ng-deep .radio-button[disabled] input[type=checkbox]+.input-helper:after,:host ::ng-deep .checkbox-select[disabled] input[type=checkbox]+.input-helper:after{background:rgba(0,0,0,.2)}:host ::ng-deep .form-control-wrapper .checkbox-select,:host ::ng-deep .form-control-wrapper .radio-button{padding-top:10px}:host ::ng-deep .shopping-bag-sidebar.open{transform:translate(-100%)}:host ::ng-deep .shopping-bag-sidebar{position:fixed;top:0;bottom:0;z-index:1051;width:420px;right:-420px;background-color:#2a2b30;transition:.3s transform}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart{color:#abacae;position:absolute;top:20%;width:50px;height:50px;line-height:50px;text-align:center;right:100%;left:auto;background:#2a2b30;border-radius:3px 0 0 3px;display:block}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:before{font-family:FontAwesome;content:\"\\f291\"}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:hover{text-decoration:none;color:#abacae}:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:active,:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:focus,:host ::ng-deep .shopping-bag-sidebar .close-shopping-cart:visited{text-decoration:none;color:#abacae}:host ::ng-deep .shopping-bag-sidebar .cart-count{font-size:9px;font-weight:bold;line-height:15px;position:absolute;top:50%;right:8px;width:15px;height:15px;margin:-16px 0 0;text-align:center;color:#fff;border-radius:50%;background:var(--vl-primary-color)}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-container{overflow:auto;display:block;height:100%;padding:0 25px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item{color:#abacae;background-color:#000;position:relative;overflow:auto;margin-bottom:10px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title{position:relative;padding-right:25px;padding-left:25px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title .header{float:left;color:#abacae;margin:0;line-height:48px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.2px}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title .box-actions{height:48px;float:right;top:0}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-item .item-title .box-action-button{height:32px;width:32px;line-height:32px;font-size:10px;font-weight:700;margin-top:8px;text-align:center;transition:all .25s ease 0s;color:#fff;background-color:var(--vl-primary-color)}:host ::ng-deep .shopping-bag-sidebar .shopping-bag-title{color:#cecece;font-size:11px;text-transform:uppercase;line-height:64px;font-weight:600;padding-top:0;margin-top:25px;margin-bottom:25px;text-align:right}:host ::ng-deep .container-box.hovered:before,:host ::ng-deep .box-title.hovered:before,:host ::ng-deep .container-box.selected:before,:host ::ng-deep .box-title.selected:before{top:0;right:0;left:0;bottom:0}:host ::ng-deep .selectable{position:relative;cursor:pointer}:host ::ng-deep .container-box.hovered:before{border-color:transparent}:host ::ng-deep .container-box.hovered{border-color:var(--vl-primary-color)}:host ::ng-deep .container-box.selected:before{border-color:transparent}:host ::ng-deep .container-box.selected{border-color:var(--vl-primary-color)}:host ::ng-deep .hovered:before{display:block!important;position:absolute;content:\" \";top:-15px;bottom:15px;left:-15px;right:15px;border:1px solid var(--vl-primary-color)}:host ::ng-deep .hovered .box-action-button{opacity:1!important}:host ::ng-deep .opacity-1{opacity:1!important}:host ::ng-deep .overflow-y--auto{overflow-y:auto}:host ::ng-deep .gu-mirror{position:fixed!important;margin:0!important;z-index:9999!important;opacity:.8;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)\";filter:alpha(opacity=80)}:host ::ng-deep .gu-hide{display:none!important}:host ::ng-deep .gu-unselectable{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}:host ::ng-deep .gu-transit{opacity:.2;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)\";filter:alpha(opacity=20)}:host ::ng-deep .top-nav-msg{margin-top:-30px}:host ::ng-deep .runtime-info-message ul{margin-bottom:0;list-style:none}:host ::ng-deep .runtime-info-message ul li{margin-bottom:10px}:host ::ng-deep .runtime-info-message ul li:last-child{margin-bottom:0}:host ::ng-deep .runtime-info-message .message-text{font-family:\"Open Sans\",Tahoma,sans-serif!important;overflow:hidden;padding:0;font-size:11px}:host ::ng-deep .runtime-attributes-popover .popover-arrow{display:none}:host ::ng-deep .runtime-attributes-popover .popover-content{padding:0}:host ::ng-deep .runtime-attributes-popover .runtime-content-wrapper{padding:0}:host ::ng-deep .runtime-attributes-popover .container-box-custom{margin-bottom:0}:host ::ng-deep .runtime-attributes-popover .input-form{margin:0;padding:0}:host ::ng-deep .runtime-attributes-popover .input-form form{margin-bottom:0}:host ::ng-deep .runtime-attributes-popover .input-form form .div-inline{display:block;float:none}:host ::ng-deep .runtime-attributes-popover .input-form form .form-group{padding:0;margin:0}:host ::ng-deep .runtime-attributes-popover .container-box .box-content{padding:0}:host ::ng-deep .v-custom-title,:host ::ng-deep .v-custom-description,:host ::ng-deep .v-custom-image{display:none}:host ::ng-deep .dropdown{position:relative}:host ::ng-deep .dropdown-toggle:focus{outline:0}:host ::ng-deep .dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;box-shadow:0 6px 12px #0000002d}:host ::ng-deep .dropdown-menu.pull-right{right:0;left:auto}:host ::ng-deep .dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}:host ::ng-deep .dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}:host ::ng-deep .dropdown-menu>li>a:hover,:host ::ng-deep .dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}:host ::ng-deep .dropdown-menu>.active>a,:host ::ng-deep .dropdown-menu>.active>a:hover,:host ::ng-deep .dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}:host ::ng-deep .dropdown-menu>.disabled>a,:host ::ng-deep .dropdown-menu>.disabled>a:hover,:host ::ng-deep .dropdown-menu>.disabled>a:focus{color:#777}:host ::ng-deep .dropdown-menu>.disabled>a:hover,:host ::ng-deep .dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)}:host ::ng-deep .open>.dropdown-menu{display:block}:host ::ng-deep .open>a{outline:0}:host ::ng-deep .dropdown-menu-right{right:0;left:auto}:host ::ng-deep .dropdown-menu-left{right:auto;left:0}:host ::ng-deep .dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}:host ::ng-deep .dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}\n", ":host{height:100%;display:flex;flex-direction:column}.sections-wrapper{flex-grow:1;display:flex;flex-direction:column}form{flex-grow:1;display:flex;flex-direction:column}.hidden{display:none}\n"], components: [{ type: i8.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: SectionRendererComponent, selector: "vl-section-renderer", inputs: ["section", "form"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7.SidebarTabsDirective, selector: "[sidebarTabs]", inputs: ["sidebarTabs"], exportAs: ["sidebarTabs"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }], pipes: { "orderBy": i7.OrderByPipe } });
3696
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeComponent, decorators: [{
3697
+ type: Component,
3698
+ args: [{
3699
+ selector: 'vl-runtime',
3700
+ moduleId: module.id,
3701
+ templateUrl: 'runtime.component.html',
3702
+ styleUrls: ['./runtime-legacy-styles.scss', 'runtime.component.scss'],
3703
+ providers: [FormScopeService, CollapsibleStateService, OrderByPipe, SearchFilterPipe],
3704
+ }]
3705
+ }], ctorParameters: function () { return [{ type: SectionsService }, { type: FormScopeService }, { type: CollapsibleStateService }, { type: RuntimeFormService }, { type: RuntimeService }, { type: i3$1.MessageService, decorators: [{
3706
+ type: Inject,
3707
+ args: [MessageService]
3708
+ }] }, { type: i2.ContextService }, { type: i7.OrderByPipe }, { type: i7.SearchFilterPipe }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { solutionUpdated: [{
3709
+ type: Output
3710
+ }] } });
3711
+
3712
+ class RuntimePreviewComponent {
3713
+ constructor(runtimeService, modelCacheService, configurationApiService, contextService) {
3714
+ this.runtimeService = runtimeService;
3715
+ this.modelCacheService = modelCacheService;
3716
+ this.configurationApiService = configurationApiService;
3717
+ this.contextService = contextService;
3718
+ this.destroy$ = new Subject();
3719
+ }
3720
+ set uiDefinition(value) {
3721
+ this._uiDefinition = value;
3722
+ this.initDefinition(value);
3723
+ }
3724
+ ngOnInit() {
3725
+ if (!this.modelId) {
3726
+ return;
3727
+ }
3728
+ this.modelCacheService
3729
+ .getProductModel(this.modelId)
3730
+ .pipe(takeUntil(this.destroy$))
3731
+ .subscribe(container => {
3732
+ this.productModelContainer = container;
3733
+ if (this._uiDefinition) {
3734
+ this.initDefinition(this._uiDefinition);
3735
+ }
3736
+ });
3737
+ }
3738
+ ngOnDestroy() {
3739
+ this.destroy$.next();
3740
+ this.destroy$.complete();
3741
+ }
3742
+ initDefinition(uiDefinition) {
3743
+ if (!this.productModelContainer) {
3744
+ return;
3745
+ }
3746
+ const initialisedUiDefinition = EntityUtil.clone(uiDefinition);
3747
+ const externals = this.productModelContainer.main.externals;
3748
+ if (externals) {
3749
+ initialisedUiDefinition.externals = externals.reduce((trunk, variable) => {
3750
+ var _a, _b;
3751
+ return Object.assign(Object.assign({}, trunk), { [variable.name]: (_b = (_a = initialisedUiDefinition.externals) === null || _a === void 0 ? void 0 : _a[variable.name]) !== null && _b !== void 0 ? _b : '' });
3752
+ }, {});
3753
+ }
3754
+ else {
3755
+ delete initialisedUiDefinition.externals;
3756
+ }
3757
+ this.initialisedUiDefinition = initialisedUiDefinition;
3758
+ this.launchRuntime();
3759
+ }
3760
+ onSolutionUpdated(lineItem) {
3761
+ this.runtimeService.updateRuntime({ configurableRamp: lineItem });
3762
+ }
3763
+ launchRuntime() {
3764
+ if (!this.modelId || !this.initialisedUiDefinition) {
3765
+ return;
3766
+ }
3767
+ SectionPathUtil.updateSectionsPath(this.initialisedUiDefinition.sections);
3768
+ const uiDefinition = EntityUtil.clone(this.initialisedUiDefinition);
3769
+ combineLatest([
3770
+ this.configurationApiService.getRuntimeDataByModelId(this.modelId),
3771
+ this.contextService.create('TestId', ConfigurationContextMode.TEST),
3772
+ ]).subscribe(([runtimeData]) => {
3773
+ var _a;
3774
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
3775
+ const rootType = Array.from(runtimeModel.components.values()).find(c => uiDefinition.rootType &&
3776
+ runtimeModel.isEquals(c.typeName, uiDefinition.rootType) &&
3777
+ EntityUtil.isPresent(c.productId));
3778
+ if (rootType === null || rootType === void 0 ? void 0 : rootType.typeName) {
3779
+ uiDefinition.rootType = rootType.typeName;
3780
+ }
3781
+ const contextProductId = rootType ? rootType.productId : undefined;
3782
+ const context = {
3783
+ modelId: (_a = this.modelId) !== null && _a !== void 0 ? _a : '',
3784
+ uiDefinition: uiDefinition,
3785
+ runtimeModel,
3786
+ runtimeMode: RuntimeMode.TEST,
3787
+ productId: contextProductId,
3788
+ properties: uiDefinition.externals,
3789
+ };
3790
+ this.runtimeService.startRuntime(context, {});
3791
+ });
3792
+ }
3793
+ }
3794
+ RuntimePreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimePreviewComponent, deps: [{ token: RuntimeService }, { token: ProductModelCacheService }, { token: i1.ConfigurationApiService }, { token: i2.ContextService }], target: i0.ɵɵFactoryTarget.Component });
3795
+ RuntimePreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: RuntimePreviewComponent, selector: "vl-runtime-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition" }, ngImport: i0, template: "<vl-runtime (solutionUpdated)=\"onSolutionUpdated($event)\"></vl-runtime>\n", styles: [":host{flex-grow:1}\n"], components: [{ type: RuntimeComponent, selector: "vl-runtime", outputs: ["solutionUpdated"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3796
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimePreviewComponent, decorators: [{
3797
+ type: Component,
3798
+ args: [{
3799
+ selector: 'vl-runtime-preview',
3800
+ templateUrl: 'runtime-preview.component.html',
3801
+ styleUrls: ['runtime-preview.component.scss'],
3802
+ changeDetection: ChangeDetectionStrategy.OnPush,
3803
+ }]
3804
+ }], ctorParameters: function () { return [{ type: RuntimeService }, { type: ProductModelCacheService }, { type: i1.ConfigurationApiService }, { type: i2.ContextService }]; }, propDecorators: { modelId: [{
3805
+ type: Input
3806
+ }], uiDefinition: [{
3807
+ type: Input
3808
+ }] } });
3809
+
3810
+ class RuntimeModule {
3811
+ }
3812
+ RuntimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3813
+ RuntimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeModule, declarations: [RuntimeComponent, RuntimePreviewComponent, SectionRendererComponent, ComponentPreviewComponent], imports: [CommonModule,
3814
+ FormsModule,
3815
+ ReactiveFormsModule,
3816
+ CoreModule,
3817
+ ApiModule,
3818
+ VeloceElementsModule,
3819
+ PopoverModule,
3820
+ LoaderModule,
3821
+ SdkCoreModule], exports: [FormsModule,
3822
+ ReactiveFormsModule,
3823
+ RuntimeComponent,
3824
+ RuntimePreviewComponent,
3825
+ SectionRendererComponent,
3826
+ ComponentPreviewComponent] });
3827
+ RuntimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeModule, providers: [
3828
+ ShoppingCartService,
3829
+ RuntimeService,
3830
+ ConfigurationService,
3831
+ RuntimeContextService,
3832
+ RuntimeFormService,
3833
+ CurrentStateService,
3834
+ ProductModelCacheService,
3835
+ DatePipe,
3836
+ SectionsService,
3837
+ SectionStoreService,
3838
+ DialogService,
3839
+ ], imports: [[
3840
+ CommonModule,
3841
+ FormsModule,
3842
+ ReactiveFormsModule,
3843
+ CoreModule,
3844
+ ApiModule,
3845
+ VeloceElementsModule,
3846
+ PopoverModule,
3847
+ LoaderModule,
3848
+ SdkCoreModule,
3849
+ ], FormsModule,
3850
+ ReactiveFormsModule] });
3851
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeModule, decorators: [{
3852
+ type: NgModule,
3853
+ args: [{
3854
+ declarations: [RuntimeComponent, RuntimePreviewComponent, SectionRendererComponent, ComponentPreviewComponent],
3855
+ providers: [
3856
+ ShoppingCartService,
3857
+ RuntimeService,
3858
+ ConfigurationService,
3859
+ RuntimeContextService,
3860
+ RuntimeFormService,
3861
+ CurrentStateService,
3862
+ ProductModelCacheService,
3863
+ DatePipe,
3864
+ SectionsService,
3865
+ SectionStoreService,
3866
+ DialogService,
3867
+ ],
3868
+ imports: [
3869
+ CommonModule,
3870
+ FormsModule,
3871
+ ReactiveFormsModule,
3872
+ CoreModule,
3873
+ ApiModule,
3874
+ VeloceElementsModule,
3875
+ PopoverModule,
3876
+ LoaderModule,
3877
+ SdkCoreModule,
3878
+ ],
3879
+ exports: [
3880
+ FormsModule,
3881
+ ReactiveFormsModule,
3882
+ RuntimeComponent,
3883
+ RuntimePreviewComponent,
3884
+ SectionRendererComponent,
3885
+ ComponentPreviewComponent,
3886
+ ],
3887
+ }]
3888
+ }] });
3889
+
3890
+ /**
3891
+ * Generated bundle index. Do not edit.
3892
+ */
3893
+
3894
+ export { ComponentPreviewComponent, CurrentStateService, RuntimeComponent, RuntimeContextService, RuntimeModule, RuntimePreviewComponent, RuntimeService, SectionRendererComponent };
3895
+ //# sourceMappingURL=veloce-sdk-runtime.js.map