@veloceapps/sdk 5.0.13-0

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