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