@veloceapps/sdk 5.0.13-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/README.md +3 -0
  2. package/bundles/veloceapps-sdk-cms.umd.js +1975 -0
  3. package/bundles/veloceapps-sdk-cms.umd.js.map +1 -0
  4. package/bundles/veloceapps-sdk-core.umd.js +1610 -0
  5. package/bundles/veloceapps-sdk-core.umd.js.map +1 -0
  6. package/bundles/veloceapps-sdk-runtime.umd.js +4349 -0
  7. package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -0
  8. package/bundles/veloceapps-sdk.umd.js +3307 -0
  9. package/bundles/veloceapps-sdk.umd.js.map +1 -0
  10. package/cms/cms.actions.d.ts +28 -0
  11. package/cms/cms.default.d.ts +5 -0
  12. package/cms/cms.elements.d.ts +4 -0
  13. package/cms/components/element-children/element-children.component.d.ts +10 -0
  14. package/cms/components/element-children/element-children.module.d.ts +8 -0
  15. package/cms/components/element-renderer/element-renderer.component.d.ts +36 -0
  16. package/cms/components/element-renderer/element-renderer.module.d.ts +7 -0
  17. package/cms/components/element.component.d.ts +17 -0
  18. package/cms/components/index.d.ts +1 -0
  19. package/cms/components/plugin.component.d.ts +15 -0
  20. package/cms/components/preview/index.d.ts +2 -0
  21. package/cms/components/preview/preview.component.d.ts +34 -0
  22. package/cms/components/preview/preview.module.d.ts +11 -0
  23. package/cms/decorators/element.decorator.d.ts +2 -0
  24. package/cms/decorators/index.d.ts +1 -0
  25. package/cms/directives/custom-template.directive.d.ts +12 -0
  26. package/cms/engine/models/entity.d.ts +11 -0
  27. package/cms/engine/models/plugin.d.ts +5 -0
  28. package/cms/index.d.ts +11 -0
  29. package/cms/injection-tokens.d.ts +11 -0
  30. package/cms/launcher.module.d.ts +10 -0
  31. package/cms/modules/federated/default-options.d.ts +4 -0
  32. package/cms/modules/federated/export.d.ts +1 -0
  33. package/cms/modules/federated/federated.component.d.ts +26 -0
  34. package/cms/modules/federated/federated.module.d.ts +9 -0
  35. package/cms/modules/federated/federated.types.d.ts +30 -0
  36. package/cms/modules/federated/federated.utils.d.ts +1 -0
  37. package/cms/package.json +10 -0
  38. package/cms/plugins/configuration.plugin.d.ts +23 -0
  39. package/cms/plugins/io.plugin.d.ts +9 -0
  40. package/cms/plugins/script.plugin.d.ts +13 -0
  41. package/cms/services/dynamic-module.service.d.ts +15 -0
  42. package/cms/services/element-context.service.d.ts +8 -0
  43. package/cms/services/index.d.ts +3 -0
  44. package/cms/services/integration.state.d.ts +17 -0
  45. package/cms/services/io-provider.service.d.ts +15 -0
  46. package/cms/services/launcher.service.d.ts +18 -0
  47. package/cms/services/templates.service.d.ts +14 -0
  48. package/cms/types/common.types.d.ts +108 -0
  49. package/cms/types/compilation.types.d.ts +6 -0
  50. package/cms/types/configuration.types.d.ts +20 -0
  51. package/cms/types/elements.types.d.ts +2 -0
  52. package/cms/types/index.d.ts +7 -0
  53. package/cms/types/integration.types.d.ts +4 -0
  54. package/cms/types/metrics.types.d.ts +5 -0
  55. package/cms/types/path.types.d.ts +11 -0
  56. package/cms/utils/element.utils.d.ts +17 -0
  57. package/cms/utils/elements-resolver.d.ts +24 -0
  58. package/cms/utils/index.d.ts +3 -0
  59. package/cms/utils/path.utils.d.ts +5 -0
  60. package/cms/veloceapps-sdk-cms.d.ts +5 -0
  61. package/cms/vendor-map.d.ts +708 -0
  62. package/core/core.module.d.ts +8 -0
  63. package/core/index.d.ts +6 -0
  64. package/core/modules/configuration/configuration.module.d.ts +7 -0
  65. package/core/modules/configuration/helpers.d.ts +3 -0
  66. package/core/modules/configuration/index.d.ts +4 -0
  67. package/core/modules/configuration/services/configuration-runtime.service.d.ts +29 -0
  68. package/core/modules/configuration/services/configuration.service.d.ts +45 -0
  69. package/core/modules/configuration/services/runtime-context.service.d.ts +12 -0
  70. package/core/modules/configuration/types/configuration-runtime.types.d.ts +7 -0
  71. package/core/modules/flow-configuration/flow-configuration.module.d.ts +6 -0
  72. package/core/modules/flow-configuration/index.d.ts +4 -0
  73. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +38 -0
  74. package/core/modules/flow-configuration/services/flow-update.service.d.ts +12 -0
  75. package/core/modules/flow-configuration/types/update.types.d.ts +12 -0
  76. package/core/modules/index.d.ts +2 -0
  77. package/core/package.json +10 -0
  78. package/core/services/context.service.d.ts +18 -0
  79. package/core/services/index.d.ts +3 -0
  80. package/core/services/product-images.service.d.ts +12 -0
  81. package/core/services/quote-draft.service.d.ts +62 -0
  82. package/core/types/index.d.ts +3 -0
  83. package/core/types/quote-states.types.d.ts +6 -0
  84. package/core/types/runtime.types.d.ts +31 -0
  85. package/core/types/ui-definition.types.d.ts +26 -0
  86. package/core/utils/index.d.ts +2 -0
  87. package/core/utils/line-item.utils.d.ts +26 -0
  88. package/core/utils/line-item.worker.d.ts +12 -0
  89. package/core/veloceapps-sdk-core.d.ts +5 -0
  90. package/esm2015/cms/cms.actions.js +47 -0
  91. package/esm2015/cms/cms.default.js +6 -0
  92. package/esm2015/cms/cms.elements.js +29 -0
  93. package/esm2015/cms/components/element-children/element-children.component.js +23 -0
  94. package/esm2015/cms/components/element-children/element-children.module.js +18 -0
  95. package/esm2015/cms/components/element-renderer/element-renderer.component.js +169 -0
  96. package/esm2015/cms/components/element-renderer/element-renderer.module.js +16 -0
  97. package/esm2015/cms/components/element.component.js +44 -0
  98. package/esm2015/cms/components/index.js +2 -0
  99. package/esm2015/cms/components/plugin.component.js +16 -0
  100. package/esm2015/cms/components/preview/index.js +3 -0
  101. package/esm2015/cms/components/preview/preview.component.js +108 -0
  102. package/esm2015/cms/components/preview/preview.module.js +23 -0
  103. package/esm2015/cms/decorators/element.decorator.js +6 -0
  104. package/esm2015/cms/decorators/index.js +2 -0
  105. package/esm2015/cms/directives/custom-template.directive.js +25 -0
  106. package/esm2015/cms/engine/models/entity.js +18 -0
  107. package/esm2015/cms/engine/models/plugin.js +6 -0
  108. package/esm2015/cms/index.js +11 -0
  109. package/esm2015/cms/injection-tokens.js +8 -0
  110. package/esm2015/cms/launcher.module.js +23 -0
  111. package/esm2015/cms/modules/federated/default-options.js +5 -0
  112. package/esm2015/cms/modules/federated/export.js +2 -0
  113. package/esm2015/cms/modules/federated/federated.component.js +82 -0
  114. package/esm2015/cms/modules/federated/federated.module.js +19 -0
  115. package/esm2015/cms/modules/federated/federated.types.js +2 -0
  116. package/esm2015/cms/modules/federated/federated.utils.js +37 -0
  117. package/esm2015/cms/plugins/configuration.plugin.js +98 -0
  118. package/esm2015/cms/plugins/io.plugin.js +37 -0
  119. package/esm2015/cms/plugins/script.plugin.js +66 -0
  120. package/esm2015/cms/services/dynamic-module.service.js +33 -0
  121. package/esm2015/cms/services/element-context.service.js +10 -0
  122. package/esm2015/cms/services/index.js +4 -0
  123. package/esm2015/cms/services/integration.state.js +40 -0
  124. package/esm2015/cms/services/io-provider.service.js +51 -0
  125. package/esm2015/cms/services/launcher.service.js +57 -0
  126. package/esm2015/cms/services/templates.service.js +31 -0
  127. package/esm2015/cms/types/common.types.js +2 -0
  128. package/esm2015/cms/types/compilation.types.js +2 -0
  129. package/esm2015/cms/types/configuration.types.js +2 -0
  130. package/esm2015/cms/types/elements.types.js +2 -0
  131. package/esm2015/cms/types/index.js +8 -0
  132. package/esm2015/cms/types/integration.types.js +2 -0
  133. package/esm2015/cms/types/metrics.types.js +2 -0
  134. package/esm2015/cms/types/path.types.js +2 -0
  135. package/esm2015/cms/utils/element.utils.js +161 -0
  136. package/esm2015/cms/utils/elements-resolver.js +147 -0
  137. package/esm2015/cms/utils/index.js +4 -0
  138. package/esm2015/cms/utils/path.utils.js +67 -0
  139. package/esm2015/cms/veloceapps-sdk-cms.js +5 -0
  140. package/esm2015/cms/vendor-map.js +34 -0
  141. package/esm2015/core/core.module.js +18 -0
  142. package/esm2015/core/index.js +7 -0
  143. package/esm2015/core/modules/configuration/configuration.module.js +34 -0
  144. package/esm2015/core/modules/configuration/helpers.js +10 -0
  145. package/esm2015/core/modules/configuration/index.js +5 -0
  146. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +92 -0
  147. package/esm2015/core/modules/configuration/services/configuration.service.js +173 -0
  148. package/esm2015/core/modules/configuration/services/runtime-context.service.js +51 -0
  149. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +2 -0
  150. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +18 -0
  151. package/esm2015/core/modules/flow-configuration/index.js +5 -0
  152. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +135 -0
  153. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +129 -0
  154. package/esm2015/core/modules/flow-configuration/types/update.types.js +2 -0
  155. package/esm2015/core/modules/index.js +3 -0
  156. package/esm2015/core/services/context.service.js +50 -0
  157. package/esm2015/core/services/index.js +4 -0
  158. package/esm2015/core/services/product-images.service.js +30 -0
  159. package/esm2015/core/services/quote-draft.service.js +207 -0
  160. package/esm2015/core/types/index.js +4 -0
  161. package/esm2015/core/types/quote-states.types.js +2 -0
  162. package/esm2015/core/types/runtime.types.js +16 -0
  163. package/esm2015/core/types/ui-definition.types.js +2 -0
  164. package/esm2015/core/utils/index.js +3 -0
  165. package/esm2015/core/utils/line-item.utils.js +100 -0
  166. package/esm2015/core/utils/line-item.worker.js +19 -0
  167. package/esm2015/core/veloceapps-sdk-core.js +5 -0
  168. package/esm2015/index.js +2 -0
  169. package/esm2015/runtime/components/component-preview/component-preview.component.js +125 -0
  170. package/esm2015/runtime/components/index.js +5 -0
  171. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +71 -0
  172. package/esm2015/runtime/components/ui-runtime/runtime.component.js +429 -0
  173. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +109 -0
  174. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +68 -0
  175. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +36 -0
  176. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +72 -0
  177. package/esm2015/runtime/execution/components/federated/federated.component.js +81 -0
  178. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +65 -0
  179. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +136 -0
  180. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +80 -0
  181. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +101 -0
  182. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +150 -0
  183. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +121 -0
  184. package/esm2015/runtime/execution/directives/section-script.directive.js +242 -0
  185. package/esm2015/runtime/execution/directives/sf-query.directive.js +34 -0
  186. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +86 -0
  187. package/esm2015/runtime/execution/directives/velo-port.directive.js +373 -0
  188. package/esm2015/runtime/execution/directives/vl-approval.directive.js +22 -0
  189. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +35 -0
  190. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +59 -0
  191. package/esm2015/runtime/execution/directives/vl-quote.directive.js +41 -0
  192. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +51 -0
  193. package/esm2015/runtime/execution/runtime-execution.module.js +163 -0
  194. package/esm2015/runtime/execution/utils/federated.util.js +37 -0
  195. package/esm2015/runtime/index.js +5 -0
  196. package/esm2015/runtime/runtime.module.js +104 -0
  197. package/esm2015/runtime/services/cart.service.js +27 -0
  198. package/esm2015/runtime/services/collapsible-state.service.js +34 -0
  199. package/esm2015/runtime/services/configuration.service.js +102 -0
  200. package/esm2015/runtime/services/current-state.service.js +17 -0
  201. package/esm2015/runtime/services/form-scope.service.js +30 -0
  202. package/esm2015/runtime/services/index.js +4 -0
  203. package/esm2015/runtime/services/product-model-cache.service.js +30 -0
  204. package/esm2015/runtime/services/runtime-context.service.js +56 -0
  205. package/esm2015/runtime/services/runtime-form.service.js +224 -0
  206. package/esm2015/runtime/services/runtime.service.js +108 -0
  207. package/esm2015/runtime/services/section-helper.service.js +27 -0
  208. package/esm2015/runtime/services/section-scope.service.js +36 -0
  209. package/esm2015/runtime/services/section-store.service.js +22 -0
  210. package/esm2015/runtime/services/section.service.js +124 -0
  211. package/esm2015/runtime/types/bound-data.types.js +7 -0
  212. package/esm2015/runtime/types/index.js +2 -0
  213. package/esm2015/runtime/types/runtime.types.js +2 -0
  214. package/esm2015/runtime/types/script-registry.types.js +51 -0
  215. package/esm2015/runtime/utils/line-item.util.js +273 -0
  216. package/esm2015/runtime/utils/section.utils.js +26 -0
  217. package/esm2015/runtime/utils/sections-binder.helper.js +105 -0
  218. package/esm2015/runtime/veloceapps-sdk-runtime.js +5 -0
  219. package/esm2015/src/components/dialog/dialog.component.js +30 -0
  220. package/esm2015/src/components/dialog/dialog.module.js +19 -0
  221. package/esm2015/src/components/dialog/dialog.types.js +2 -0
  222. package/esm2015/src/components/doc-gen/doc-gen.component.js +109 -0
  223. package/esm2015/src/components/doc-gen/doc-gen.module.js +19 -0
  224. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +122 -0
  225. package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +46 -0
  226. package/esm2015/src/components/header/header.component.js +310 -0
  227. package/esm2015/src/components/header/header.module.js +50 -0
  228. package/esm2015/src/components/header/header.types.js +2 -0
  229. package/esm2015/src/components/header/metrics/index.js +2 -0
  230. package/esm2015/src/components/header/metrics/metrics.component.js +216 -0
  231. package/esm2015/src/components/header/metrics/metrics.definitions.js +9 -0
  232. package/esm2015/src/components/header/metrics/metrics.module.js +67 -0
  233. package/esm2015/src/constants.js +2 -0
  234. package/esm2015/src/flow-routing.module.js +137 -0
  235. package/esm2015/src/flow.component.js +45 -0
  236. package/esm2015/src/flow.module.js +60 -0
  237. package/esm2015/src/guards/context.guard.js +84 -0
  238. package/esm2015/src/guards/index.js +2 -0
  239. package/esm2015/src/guards/product-unload.guard.js +43 -0
  240. package/esm2015/src/guards/root.guard.js +41 -0
  241. package/esm2015/src/index.js +7 -0
  242. package/esm2015/src/pages/catalog/catalog.component.js +117 -0
  243. package/esm2015/src/pages/catalog/catalog.module.js +20 -0
  244. package/esm2015/src/pages/debug/debug.component.js +61 -0
  245. package/esm2015/src/pages/debug/debug.module.js +48 -0
  246. package/esm2015/src/pages/empty-account/empty-account.component.js +17 -0
  247. package/esm2015/src/pages/empty-account/empty-account.module.js +20 -0
  248. package/esm2015/src/pages/legacy-product/legacy-product.component.js +132 -0
  249. package/esm2015/src/pages/legacy-product/legacy-product.module.js +21 -0
  250. package/esm2015/src/pages/product/product.component.js +108 -0
  251. package/esm2015/src/pages/product/product.module.js +20 -0
  252. package/esm2015/src/pages/record-not-found/record-not-found.component.js +29 -0
  253. package/esm2015/src/pages/record-not-found/record-not-found.module.js +20 -0
  254. package/esm2015/src/pages/remote/remote.component.js +353 -0
  255. package/esm2015/src/pages/remote/remote.module.js +20 -0
  256. package/esm2015/src/pages/remote/remote.types.js +2 -0
  257. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +117 -0
  258. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +20 -0
  259. package/esm2015/src/resolvers/flow.resolver.js +62 -0
  260. package/esm2015/src/resolvers/quote.resolver.js +74 -0
  261. package/esm2015/src/services/doc-gen.service.js +33 -0
  262. package/esm2015/src/services/flow-dialog.service.js +123 -0
  263. package/esm2015/src/services/flow-router.service.js +136 -0
  264. package/esm2015/src/services/flow.service.js +77 -0
  265. package/esm2015/src/services/index.js +2 -0
  266. package/esm2015/src/types/context-route.types.js +2 -0
  267. package/esm2015/src/types/flow-customization.types.js +3 -0
  268. package/esm2015/src/types/index.js +3 -0
  269. package/esm2015/src/types/route.types.js +2 -0
  270. package/esm2015/src/utils/flow.utils.js +22 -0
  271. package/esm2015/src/utils/index.js +2 -0
  272. package/esm2015/veloceapps-sdk.js +5 -0
  273. package/fesm2015/veloceapps-sdk-cms.js +1443 -0
  274. package/fesm2015/veloceapps-sdk-cms.js.map +1 -0
  275. package/fesm2015/veloceapps-sdk-core.js +1035 -0
  276. package/fesm2015/veloceapps-sdk-core.js.map +1 -0
  277. package/fesm2015/veloceapps-sdk-runtime.js +3896 -0
  278. package/fesm2015/veloceapps-sdk-runtime.js.map +1 -0
  279. package/fesm2015/veloceapps-sdk.js +2758 -0
  280. package/fesm2015/veloceapps-sdk.js.map +1 -0
  281. package/index.d.ts +1 -0
  282. package/package.json +50 -0
  283. package/runtime/components/component-preview/component-preview.component.d.ts +27 -0
  284. package/runtime/components/index.d.ts +4 -0
  285. package/runtime/components/section-renderer/section-renderer.component.d.ts +25 -0
  286. package/runtime/components/ui-runtime/runtime.component.d.ts +53 -0
  287. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +27 -0
  288. package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +30 -0
  289. package/runtime/execution/components/context-provider/context-provider.component.d.ts +14 -0
  290. package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +25 -0
  291. package/runtime/execution/components/federated/federated.component.d.ts +36 -0
  292. package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +19 -0
  293. package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +35 -0
  294. package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +22 -0
  295. package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +22 -0
  296. package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +28 -0
  297. package/runtime/execution/components/velo-type/velo-type.component.d.ts +31 -0
  298. package/runtime/execution/directives/section-script.directive.d.ts +59 -0
  299. package/runtime/execution/directives/sf-query.directive.d.ts +15 -0
  300. package/runtime/execution/directives/velo-attribute.directive.d.ts +26 -0
  301. package/runtime/execution/directives/velo-port.directive.d.ts +74 -0
  302. package/runtime/execution/directives/vl-approval.directive.d.ts +10 -0
  303. package/runtime/execution/directives/vl-document-attachments.directive.d.ts +15 -0
  304. package/runtime/execution/directives/vl-document-templates.directive.d.ts +33 -0
  305. package/runtime/execution/directives/vl-quote.directive.d.ts +14 -0
  306. package/runtime/execution/directives/vl-ramp.directive.d.ts +15 -0
  307. package/runtime/execution/runtime-execution.module.d.ts +27 -0
  308. package/runtime/execution/utils/federated.util.d.ts +6 -0
  309. package/runtime/index.d.ts +4 -0
  310. package/runtime/package.json +10 -0
  311. package/runtime/runtime.module.d.ts +18 -0
  312. package/runtime/services/cart.service.d.ts +15 -0
  313. package/runtime/services/collapsible-state.service.d.ts +15 -0
  314. package/runtime/services/configuration.service.d.ts +19 -0
  315. package/runtime/services/current-state.service.d.ts +8 -0
  316. package/runtime/services/form-scope.service.d.ts +20 -0
  317. package/runtime/services/index.d.ts +3 -0
  318. package/runtime/services/product-model-cache.service.d.ts +14 -0
  319. package/runtime/services/runtime-context.service.d.ts +16 -0
  320. package/runtime/services/runtime-form.service.d.ts +24 -0
  321. package/runtime/services/runtime.service.d.ts +43 -0
  322. package/runtime/services/section-helper.service.d.ts +8 -0
  323. package/runtime/services/section-scope.service.d.ts +14 -0
  324. package/runtime/services/section-store.service.d.ts +11 -0
  325. package/runtime/services/section.service.d.ts +30 -0
  326. package/runtime/types/bound-data.types.d.ts +13 -0
  327. package/runtime/types/index.d.ts +1 -0
  328. package/runtime/types/runtime.types.d.ts +19 -0
  329. package/runtime/types/script-registry.types.d.ts +13 -0
  330. package/runtime/utils/line-item.util.d.ts +34 -0
  331. package/runtime/utils/section.utils.d.ts +2 -0
  332. package/runtime/utils/sections-binder.helper.d.ts +16 -0
  333. package/runtime/veloceapps-sdk-runtime.d.ts +5 -0
  334. package/src/components/dialog/dialog.component.d.ts +13 -0
  335. package/src/components/dialog/dialog.module.d.ts +9 -0
  336. package/src/components/dialog/dialog.types.d.ts +6 -0
  337. package/src/components/doc-gen/doc-gen.component.d.ts +26 -0
  338. package/src/components/doc-gen/doc-gen.module.d.ts +9 -0
  339. package/src/components/header/cart-overlay/cart-preview.component.d.ts +36 -0
  340. package/src/components/header/cart-overlay/cart-preview.module.d.ts +14 -0
  341. package/src/components/header/header.component.d.ts +64 -0
  342. package/src/components/header/header.module.d.ts +15 -0
  343. package/src/components/header/header.types.d.ts +20 -0
  344. package/src/components/header/metrics/index.d.ts +1 -0
  345. package/src/components/header/metrics/metrics.component.d.ts +49 -0
  346. package/src/components/header/metrics/metrics.definitions.d.ts +4 -0
  347. package/src/components/header/metrics/metrics.module.d.ts +17 -0
  348. package/src/constants.d.ts +1 -0
  349. package/src/flow-routing.module.d.ts +13 -0
  350. package/src/flow.component.d.ts +23 -0
  351. package/src/flow.module.d.ts +16 -0
  352. package/src/guards/context.guard.d.ts +19 -0
  353. package/src/guards/index.d.ts +1 -0
  354. package/src/guards/product-unload.guard.d.ts +17 -0
  355. package/src/guards/root.guard.d.ts +15 -0
  356. package/src/index.d.ts +6 -0
  357. package/src/pages/catalog/catalog.component.d.ts +32 -0
  358. package/src/pages/catalog/catalog.module.d.ts +10 -0
  359. package/src/pages/debug/debug.component.d.ts +25 -0
  360. package/src/pages/debug/debug.module.d.ts +14 -0
  361. package/src/pages/empty-account/empty-account.component.d.ts +5 -0
  362. package/src/pages/empty-account/empty-account.module.d.ts +10 -0
  363. package/src/pages/legacy-product/legacy-product.component.d.ts +37 -0
  364. package/src/pages/legacy-product/legacy-product.module.d.ts +10 -0
  365. package/src/pages/product/product.component.d.ts +32 -0
  366. package/src/pages/product/product.module.d.ts +10 -0
  367. package/src/pages/record-not-found/record-not-found.component.d.ts +11 -0
  368. package/src/pages/record-not-found/record-not-found.module.d.ts +9 -0
  369. package/src/pages/remote/remote.component.d.ts +47 -0
  370. package/src/pages/remote/remote.module.d.ts +10 -0
  371. package/src/pages/remote/remote.types.d.ts +4 -0
  372. package/src/pages/shopping-cart/shopping-cart.component.d.ts +32 -0
  373. package/src/pages/shopping-cart/shopping-cart.module.d.ts +10 -0
  374. package/src/resolvers/flow.resolver.d.ts +16 -0
  375. package/src/resolvers/quote.resolver.d.ts +20 -0
  376. package/src/services/doc-gen.service.d.ts +13 -0
  377. package/src/services/flow-dialog.service.d.ts +26 -0
  378. package/src/services/flow-router.service.d.ts +36 -0
  379. package/src/services/flow.service.d.ts +17 -0
  380. package/src/services/index.d.ts +1 -0
  381. package/src/types/context-route.types.d.ts +5 -0
  382. package/src/types/flow-customization.types.d.ts +11 -0
  383. package/src/types/index.d.ts +2 -0
  384. package/src/types/route.types.d.ts +9 -0
  385. package/src/utils/flow.utils.d.ts +8 -0
  386. package/src/utils/index.d.ts +1 -0
  387. package/veloceapps-sdk.d.ts +5 -0
@@ -0,0 +1,1975 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('lodash'), require('@angular/common'), require('@veloceapps/core'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('@veloceapps/sdk/core'), require('@veloceapps/components'), require('@babel/standalone'), require('@veloceapps/api'), require('rxjs/operators'), require('primeng/api'), require('primeng/dynamicdialog')) :
3
+ typeof define === 'function' && define.amd ? define('@veloceapps/sdk/cms', ['exports', '@angular/core', 'rxjs', 'lodash', '@angular/common', '@veloceapps/core', '@angular/cdk/drag-drop', '@angular/forms', '@veloceapps/sdk/core', '@veloceapps/components', '@babel/standalone', '@veloceapps/api', 'rxjs/operators', 'primeng/api', 'primeng/dynamicdialog'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.cms = {}), global.ng.core, global.rxjs, global.lodash, global.ng.common, global["@veloceapps/core"], global.ng.cdk.dragDrop, global.ng.forms, global.veloceapps.sdk.core, global["@veloceapps/components"], global["@babel/standalone"], global["@veloceapps/api"], global.rxjs.operators, global["primeng/api"], global["primeng/dynamicdialog"]));
5
+ })(this, (function (exports, i0, rxjs, lodash, i7, core, dragDrop, angularForms, i2, i1, standalone, api, rxjsOperators, i3, dynamicdialog) { '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 rxjs__namespace = /*#__PURE__*/_interopNamespace(rxjs);
27
+ var lodash__namespace = /*#__PURE__*/_interopNamespace(lodash);
28
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
29
+ var angularForms__namespace = /*#__PURE__*/_interopNamespace(angularForms);
30
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
32
+ var rxjsOperators__namespace = /*#__PURE__*/_interopNamespace(rxjsOperators);
33
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
34
+
35
+ exports.FlowAction = void 0;
36
+ (function (FlowAction) {
37
+ FlowAction["FLOW_CONFIGURE_PRODUCT"] = "FLOW_CONFIGURE_PRODUCT";
38
+ FlowAction["FLOW_NAVIGATE_BACK"] = "FLOW_NAVIGATE_BACK";
39
+ FlowAction["FLOW_NAVIGATE_TO_CATALOG"] = "FLOW_NAVIGATE_TO_CATALOG";
40
+ FlowAction["FLOW_APPLY_PRODUCT_CONFIGURATION"] = "FLOW_APPLY_PRODUCT_CONFIGURATION";
41
+ FlowAction["FLOW_OPEN_DOC_GEN"] = "FLOW_OPEN_DOC_GEN";
42
+ FlowAction["FLOW_CLOSE_DOC_GEN"] = "FLOW_CLOSE_DOC_GEN";
43
+ FlowAction["FLOW_SWITCH_OBJECT"] = "FLOW_SWITCH_OBJECT";
44
+ FlowAction["REMOTE_APPLY"] = "REMOTE_APPLY";
45
+ FlowAction["REMOTE_CANCEL"] = "REMOTE_CANCEL";
46
+ FlowAction["SET_DEFAULT_METRICS"] = "SET_DEFAULT_METRICS";
47
+ })(exports.FlowAction || (exports.FlowAction = {}));
48
+ var ConfigureProductAction = function (_a) {
49
+ var lineItemId = _a.lineItemId, productId = _a.productId;
50
+ return ({
51
+ type: exports.FlowAction.FLOW_CONFIGURE_PRODUCT,
52
+ payload: { lineItemId: lineItemId, productId: productId },
53
+ });
54
+ };
55
+ var NavigateBackAction = function () { return ({
56
+ type: exports.FlowAction.FLOW_NAVIGATE_BACK,
57
+ }); };
58
+ var NavigateToCatalogAction = function () { return ({
59
+ type: exports.FlowAction.FLOW_NAVIGATE_TO_CATALOG,
60
+ }); };
61
+ var ApplyProductConfigurationAction = function () { return ({
62
+ type: exports.FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION,
63
+ }); };
64
+ var OpenDocGenAction = function () { return ({
65
+ type: exports.FlowAction.FLOW_OPEN_DOC_GEN,
66
+ }); };
67
+ var CloseDocGenAction = function () { return ({
68
+ type: exports.FlowAction.FLOW_CLOSE_DOC_GEN,
69
+ }); };
70
+ var RemoteApplyAction = function () { return ({
71
+ type: exports.FlowAction.REMOTE_APPLY,
72
+ }); };
73
+ var RemoteCancelAction = function () { return ({
74
+ type: exports.FlowAction.REMOTE_CANCEL,
75
+ }); };
76
+ var SwitchObjectAction = function (payload) { return ({
77
+ type: exports.FlowAction.FLOW_SWITCH_OBJECT,
78
+ payload: payload,
79
+ }); };
80
+ var SetDefaultMetrics = function (metrics) { return ({
81
+ type: exports.FlowAction.SET_DEFAULT_METRICS,
82
+ payload: { metrics: metrics },
83
+ }); };
84
+
85
+ var cmsActions = /*#__PURE__*/Object.freeze({
86
+ __proto__: null,
87
+ get FlowAction () { return exports.FlowAction; },
88
+ ConfigureProductAction: ConfigureProductAction,
89
+ NavigateBackAction: NavigateBackAction,
90
+ NavigateToCatalogAction: NavigateToCatalogAction,
91
+ ApplyProductConfigurationAction: ApplyProductConfigurationAction,
92
+ OpenDocGenAction: OpenDocGenAction,
93
+ CloseDocGenAction: CloseDocGenAction,
94
+ RemoteApplyAction: RemoteApplyAction,
95
+ RemoteCancelAction: RemoteCancelAction,
96
+ SwitchObjectAction: SwitchObjectAction,
97
+ SetDefaultMetrics: SetDefaultMetrics
98
+ });
99
+
100
+ /*! *****************************************************************************
101
+ Copyright (c) Microsoft Corporation.
102
+
103
+ Permission to use, copy, modify, and/or distribute this software for any
104
+ purpose with or without fee is hereby granted.
105
+
106
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
107
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
108
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
109
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
110
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
111
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
112
+ PERFORMANCE OF THIS SOFTWARE.
113
+ ***************************************************************************** */
114
+ /* global Reflect, Promise */
115
+ var extendStatics = function (d, b) {
116
+ extendStatics = Object.setPrototypeOf ||
117
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
118
+ function (d, b) { for (var p in b)
119
+ if (Object.prototype.hasOwnProperty.call(b, p))
120
+ d[p] = b[p]; };
121
+ return extendStatics(d, b);
122
+ };
123
+ function __extends(d, b) {
124
+ if (typeof b !== "function" && b !== null)
125
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
126
+ extendStatics(d, b);
127
+ function __() { this.constructor = d; }
128
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
129
+ }
130
+ var __assign = function () {
131
+ __assign = Object.assign || function __assign(t) {
132
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
133
+ s = arguments[i];
134
+ for (var p in s)
135
+ if (Object.prototype.hasOwnProperty.call(s, p))
136
+ t[p] = s[p];
137
+ }
138
+ return t;
139
+ };
140
+ return __assign.apply(this, arguments);
141
+ };
142
+ function __rest(s, e) {
143
+ var t = {};
144
+ for (var p in s)
145
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
146
+ t[p] = s[p];
147
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
148
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
149
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
150
+ t[p[i]] = s[p[i]];
151
+ }
152
+ return t;
153
+ }
154
+ function __decorate(decorators, target, key, desc) {
155
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
156
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
157
+ r = Reflect.decorate(decorators, target, key, desc);
158
+ else
159
+ for (var i = decorators.length - 1; i >= 0; i--)
160
+ if (d = decorators[i])
161
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
162
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
163
+ }
164
+ function __param(paramIndex, decorator) {
165
+ return function (target, key) { decorator(target, key, paramIndex); };
166
+ }
167
+ function __metadata(metadataKey, metadataValue) {
168
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
169
+ return Reflect.metadata(metadataKey, metadataValue);
170
+ }
171
+ function __awaiter(thisArg, _arguments, P, generator) {
172
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
173
+ return new (P || (P = Promise))(function (resolve, reject) {
174
+ function fulfilled(value) { try {
175
+ step(generator.next(value));
176
+ }
177
+ catch (e) {
178
+ reject(e);
179
+ } }
180
+ function rejected(value) { try {
181
+ step(generator["throw"](value));
182
+ }
183
+ catch (e) {
184
+ reject(e);
185
+ } }
186
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
187
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
188
+ });
189
+ }
190
+ function __generator(thisArg, body) {
191
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
192
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
193
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
194
+ function verb(n) { return function (v) { return step([n, v]); }; }
195
+ function step(op) {
196
+ if (f)
197
+ throw new TypeError("Generator is already executing.");
198
+ while (_)
199
+ try {
200
+ 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)
201
+ return t;
202
+ if (y = 0, t)
203
+ op = [op[0] & 2, t.value];
204
+ switch (op[0]) {
205
+ case 0:
206
+ case 1:
207
+ t = op;
208
+ break;
209
+ case 4:
210
+ _.label++;
211
+ return { value: op[1], done: false };
212
+ case 5:
213
+ _.label++;
214
+ y = op[1];
215
+ op = [0];
216
+ continue;
217
+ case 7:
218
+ op = _.ops.pop();
219
+ _.trys.pop();
220
+ continue;
221
+ default:
222
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
223
+ _ = 0;
224
+ continue;
225
+ }
226
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
227
+ _.label = op[1];
228
+ break;
229
+ }
230
+ if (op[0] === 6 && _.label < t[1]) {
231
+ _.label = t[1];
232
+ t = op;
233
+ break;
234
+ }
235
+ if (t && _.label < t[2]) {
236
+ _.label = t[2];
237
+ _.ops.push(op);
238
+ break;
239
+ }
240
+ if (t[2])
241
+ _.ops.pop();
242
+ _.trys.pop();
243
+ continue;
244
+ }
245
+ op = body.call(thisArg, _);
246
+ }
247
+ catch (e) {
248
+ op = [6, e];
249
+ y = 0;
250
+ }
251
+ finally {
252
+ f = t = 0;
253
+ }
254
+ if (op[0] & 5)
255
+ throw op[1];
256
+ return { value: op[0] ? op[1] : void 0, done: true };
257
+ }
258
+ }
259
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
260
+ if (k2 === undefined)
261
+ k2 = k;
262
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
263
+ }) : (function (o, m, k, k2) {
264
+ if (k2 === undefined)
265
+ k2 = k;
266
+ o[k2] = m[k];
267
+ });
268
+ function __exportStar(m, o) {
269
+ for (var p in m)
270
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
271
+ __createBinding(o, m, p);
272
+ }
273
+ function __values(o) {
274
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
275
+ if (m)
276
+ return m.call(o);
277
+ if (o && typeof o.length === "number")
278
+ return {
279
+ next: function () {
280
+ if (o && i >= o.length)
281
+ o = void 0;
282
+ return { value: o && o[i++], done: !o };
283
+ }
284
+ };
285
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
286
+ }
287
+ function __read(o, n) {
288
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
289
+ if (!m)
290
+ return o;
291
+ var i = m.call(o), r, ar = [], e;
292
+ try {
293
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
294
+ ar.push(r.value);
295
+ }
296
+ catch (error) {
297
+ e = { error: error };
298
+ }
299
+ finally {
300
+ try {
301
+ if (r && !r.done && (m = i["return"]))
302
+ m.call(i);
303
+ }
304
+ finally {
305
+ if (e)
306
+ throw e.error;
307
+ }
308
+ }
309
+ return ar;
310
+ }
311
+ /** @deprecated */
312
+ function __spread() {
313
+ for (var ar = [], i = 0; i < arguments.length; i++)
314
+ ar = ar.concat(__read(arguments[i]));
315
+ return ar;
316
+ }
317
+ /** @deprecated */
318
+ function __spreadArrays() {
319
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
320
+ s += arguments[i].length;
321
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
322
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
323
+ r[k] = a[j];
324
+ return r;
325
+ }
326
+ function __spreadArray(to, from, pack) {
327
+ if (pack || arguments.length === 2)
328
+ for (var i = 0, l = from.length, ar; i < l; i++) {
329
+ if (ar || !(i in from)) {
330
+ if (!ar)
331
+ ar = Array.prototype.slice.call(from, 0, i);
332
+ ar[i] = from[i];
333
+ }
334
+ }
335
+ return to.concat(ar || Array.prototype.slice.call(from));
336
+ }
337
+ function __await(v) {
338
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
339
+ }
340
+ function __asyncGenerator(thisArg, _arguments, generator) {
341
+ if (!Symbol.asyncIterator)
342
+ throw new TypeError("Symbol.asyncIterator is not defined.");
343
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
344
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
345
+ function verb(n) { if (g[n])
346
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
347
+ function resume(n, v) { try {
348
+ step(g[n](v));
349
+ }
350
+ catch (e) {
351
+ settle(q[0][3], e);
352
+ } }
353
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
354
+ function fulfill(value) { resume("next", value); }
355
+ function reject(value) { resume("throw", value); }
356
+ function settle(f, v) { if (f(v), q.shift(), q.length)
357
+ resume(q[0][0], q[0][1]); }
358
+ }
359
+ function __asyncDelegator(o) {
360
+ var i, p;
361
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
362
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
363
+ }
364
+ function __asyncValues(o) {
365
+ if (!Symbol.asyncIterator)
366
+ throw new TypeError("Symbol.asyncIterator is not defined.");
367
+ var m = o[Symbol.asyncIterator], i;
368
+ 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);
369
+ 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); }); }; }
370
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
371
+ }
372
+ function __makeTemplateObject(cooked, raw) {
373
+ if (Object.defineProperty) {
374
+ Object.defineProperty(cooked, "raw", { value: raw });
375
+ }
376
+ else {
377
+ cooked.raw = raw;
378
+ }
379
+ return cooked;
380
+ }
381
+ ;
382
+ var __setModuleDefault = Object.create ? (function (o, v) {
383
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
384
+ }) : function (o, v) {
385
+ o["default"] = v;
386
+ };
387
+ function __importStar(mod) {
388
+ if (mod && mod.__esModule)
389
+ return mod;
390
+ var result = {};
391
+ if (mod != null)
392
+ for (var k in mod)
393
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
394
+ __createBinding(result, mod, k);
395
+ __setModuleDefault(result, mod);
396
+ return result;
397
+ }
398
+ function __importDefault(mod) {
399
+ return (mod && mod.__esModule) ? mod : { default: mod };
400
+ }
401
+ function __classPrivateFieldGet(receiver, state, kind, f) {
402
+ if (kind === "a" && !f)
403
+ throw new TypeError("Private accessor was defined without a getter");
404
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
405
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
406
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
407
+ }
408
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
409
+ if (kind === "m")
410
+ throw new TypeError("Private method is not writable");
411
+ if (kind === "a" && !f)
412
+ throw new TypeError("Private accessor was defined without a setter");
413
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
414
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
415
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
416
+ }
417
+
418
+ var DEFAULT_PLUGINS_TOKEN = new i0.InjectionToken('DEFAULT_PLUGINS_TOKEN');
419
+ var UI_DEFINITION_METADATA = new i0.InjectionToken('UI_DEFINITION_METADATA_TOKEN');
420
+ var ELEMENT_METADATA = new i0.InjectionToken('ELEMENT_METADATA_TOKEN');
421
+ var SHARED_ELEMENT_METADATA = new i0.InjectionToken('SHARED_ELEMENT_METADATA_TOKEN');
422
+ var ELEMENT_CONFIG = new i0.InjectionToken('ELEMENT_CONFIG_TOKEN');
423
+ var VENDOR_MAP = new i0.InjectionToken('VENDOR_MAP');
424
+
425
+ var cmsInjectionTokens = /*#__PURE__*/Object.freeze({
426
+ __proto__: null,
427
+ DEFAULT_PLUGINS_TOKEN: DEFAULT_PLUGINS_TOKEN,
428
+ UI_DEFINITION_METADATA: UI_DEFINITION_METADATA,
429
+ ELEMENT_METADATA: ELEMENT_METADATA,
430
+ SHARED_ELEMENT_METADATA: SHARED_ELEMENT_METADATA,
431
+ ELEMENT_CONFIG: ELEMENT_CONFIG,
432
+ VENDOR_MAP: VENDOR_MAP
433
+ });
434
+
435
+ var Entity = /** @class */ (function () {
436
+ function Entity(injector) {
437
+ this.injector = injector;
438
+ this.plugins = [];
439
+ this.config = this.injector.get(ELEMENT_CONFIG);
440
+ this.defaultPlugins = this.injector.get(DEFAULT_PLUGINS_TOKEN);
441
+ }
442
+ Entity.prototype.initPlugins = function () {
443
+ var _this = this;
444
+ var _a;
445
+ this.defaultPlugins.forEach(function (plugin) { return _this.registerPlugin(new plugin(_this)); });
446
+ (_a = this.config.plugins) === null || _a === void 0 ? void 0 : _a.forEach(function (plugin) { return _this.registerPlugin(new plugin(_this)); });
447
+ };
448
+ Entity.prototype.registerPlugin = function (plugin) {
449
+ this.plugins.push(plugin);
450
+ };
451
+ return Entity;
452
+ }());
453
+
454
+ exports.ElementComponent = /** @class */ (function (_super) {
455
+ __extends(ElementComponent, _super);
456
+ function ElementComponent(injector) {
457
+ var _this = _super.call(this, injector) || this;
458
+ _this.injector = injector;
459
+ _this.model$ = new rxjs.BehaviorSubject(undefined);
460
+ _super.prototype.initPlugins.call(_this);
461
+ return _this;
462
+ }
463
+ ElementComponent.prototype.ngOnChanges = function (changes) {
464
+ this.plugins.forEach(function (plugin) { var _a; return (_a = plugin.ngOnChanges) === null || _a === void 0 ? void 0 : _a.call(plugin, changes); });
465
+ };
466
+ ElementComponent.prototype.ngOnInit = function () {
467
+ this.plugins.forEach(function (plugin) { var _a; return (_a = plugin.ngOnInit) === null || _a === void 0 ? void 0 : _a.call(plugin); });
468
+ };
469
+ ElementComponent.prototype.ngDoCheck = function () {
470
+ this.plugins.forEach(function (plugin) { var _a; return (_a = plugin.ngDoCheck) === null || _a === void 0 ? void 0 : _a.call(plugin); });
471
+ };
472
+ ElementComponent.prototype.ngAfterContentInit = function () {
473
+ this.plugins.forEach(function (plugin) { var _a; return (_a = plugin.ngAfterContentInit) === null || _a === void 0 ? void 0 : _a.call(plugin); });
474
+ };
475
+ ElementComponent.prototype.ngAfterViewInit = function () {
476
+ this.plugins.forEach(function (plugin) { var _a; return (_a = plugin.ngAfterViewInit) === null || _a === void 0 ? void 0 : _a.call(plugin); });
477
+ };
478
+ ElementComponent.prototype.ngAfterViewChecked = function () {
479
+ this.plugins.forEach(function (plugin) { var _a; return (_a = plugin.ngAfterViewChecked) === null || _a === void 0 ? void 0 : _a.call(plugin); });
480
+ };
481
+ ElementComponent.prototype.ngOnDestroy = function () {
482
+ this.plugins.forEach(function (plugin) { var _a; return (_a = plugin.ngOnDestroy) === null || _a === void 0 ? void 0 : _a.call(plugin); });
483
+ };
484
+ return ElementComponent;
485
+ }(Entity));
486
+ exports.ElementComponent = __decorate([
487
+ i0.Component({
488
+ template: '',
489
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
490
+ jit: true,
491
+ }),
492
+ __param(0, i0.Inject(i0.Injector))
493
+ ], exports.ElementComponent);
494
+
495
+ var parseBoundPath = function (path) {
496
+ var _a, _b;
497
+ var regexp = new RegExp("(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)", 'g');
498
+ var blocks = (_b = (_a = path.match(regexp)) === null || _a === void 0 ? void 0 : _a.map(function (match) {
499
+ var _e = __read(lodash.compact(match.split('/')), 3), type = _e[0], property = _e[1], name = _e[2];
500
+ return { type: type, property: property, name: name };
501
+ })) !== null && _b !== void 0 ? _b : [];
502
+ return blocks;
503
+ };
504
+ var parsePath = function (path) {
505
+ var _a, _b, _c, _d;
506
+ var segments = path.split('/');
507
+ var module;
508
+ var variable;
509
+ if ((_a = segments[0]) === null || _a === void 0 ? void 0 : _a.startsWith('@')) {
510
+ module = (_b = segments.shift()) === null || _b === void 0 ? void 0 : _b.substring(1);
511
+ }
512
+ if (((_c = segments[segments.length - 1]) === null || _c === void 0 ? void 0 : _c[0]) === ':') {
513
+ variable = (_d = segments.pop()) === null || _d === void 0 ? void 0 : _d.substring(1);
514
+ }
515
+ var isAbsolute = !segments[0];
516
+ var nonEmptySegments = segments.filter(Boolean);
517
+ if (!isAbsolute && nonEmptySegments[0] === '.') {
518
+ nonEmptySegments.shift();
519
+ }
520
+ return {
521
+ isAbsolute: isAbsolute,
522
+ segments: nonEmptySegments,
523
+ module: module,
524
+ variable: variable,
525
+ };
526
+ };
527
+ var findElementByModule = function (elements, module, elementName) {
528
+ var e_1, _e;
529
+ try {
530
+ for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
531
+ var el = elements_1_1.value;
532
+ if (el.module === module && el.name === elementName) {
533
+ return el;
534
+ }
535
+ var child = findElementByModule(el.children, module, elementName);
536
+ if (child) {
537
+ return child;
538
+ }
539
+ }
540
+ }
541
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
542
+ finally {
543
+ try {
544
+ if (elements_1_1 && !elements_1_1.done && (_e = elements_1.return)) _e.call(elements_1);
545
+ }
546
+ finally { if (e_1) throw e_1.error; }
547
+ }
548
+ return;
549
+ };
550
+ var getAbsolutePath = function (elements, subject, path) {
551
+ var _a, _b, _c;
552
+ if (path.module) {
553
+ return (_a = findElementByModule(elements, path.module, path.segments[0])) === null || _a === void 0 ? void 0 : _a.path;
554
+ }
555
+ var subjectSegments = (_c = (_b = subject.path) === null || _b === void 0 ? void 0 : _b.split('/')) !== null && _c !== void 0 ? _c : [];
556
+ var segments = __spreadArray([], __read(path.segments));
557
+ if (path.isAbsolute) {
558
+ return segments.join('/');
559
+ }
560
+ while (segments.length) {
561
+ var segment = segments.shift();
562
+ if (segment === '..') {
563
+ subjectSegments.pop();
564
+ }
565
+ else if (segment) {
566
+ subjectSegments.push(segment);
567
+ }
568
+ }
569
+ return subjectSegments.join('/');
570
+ };
571
+
572
+ var DynamicModuleService = /** @class */ (function () {
573
+ function DynamicModuleService() {
574
+ this._elementsTree = [];
575
+ this._componentFactories = [];
576
+ }
577
+ Object.defineProperty(DynamicModuleService.prototype, "componentFactories", {
578
+ get: function () {
579
+ return this._componentFactories;
580
+ },
581
+ set: function (data) {
582
+ this._componentFactories = data;
583
+ },
584
+ enumerable: false,
585
+ configurable: true
586
+ });
587
+ DynamicModuleService.prototype.getComponentFactory = function (element) {
588
+ return this.componentFactories.find(function (f) { return f.componentType.path === element.path; });
589
+ };
590
+ Object.defineProperty(DynamicModuleService.prototype, "elementsTree", {
591
+ get: function () {
592
+ return this._elementsTree;
593
+ },
594
+ set: function (tree) {
595
+ this._elementsTree = tree;
596
+ },
597
+ enumerable: false,
598
+ configurable: true
599
+ });
600
+ DynamicModuleService.prototype.clear = function () {
601
+ this._elementsTree = [];
602
+ this.componentFactories = [];
603
+ };
604
+ return DynamicModuleService;
605
+ }());
606
+ DynamicModuleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
607
+ DynamicModuleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService });
608
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService, decorators: [{
609
+ type: i0.Injectable
610
+ }] });
611
+
612
+ var IOProviderService = /** @class */ (function () {
613
+ function IOProviderService(dynamicModuleService) {
614
+ this.dynamicModuleService = dynamicModuleService;
615
+ this.inputs = {};
616
+ }
617
+ IOProviderService.prototype.connect = function (el, name, target) {
618
+ var _a;
619
+ return (_a = this.resolveTarget(el, name, target)) === null || _a === void 0 ? void 0 : _a.asObservable();
620
+ };
621
+ IOProviderService.prototype.provide = function (el, name, target) {
622
+ return this.resolveTarget(el, name, target);
623
+ };
624
+ IOProviderService.prototype.resolveTarget = function (el, name, target) {
625
+ var _a, _b;
626
+ var isHost = !target;
627
+ if (isHost) {
628
+ return this.createSubjectSafe((_a = el.path) !== null && _a !== void 0 ? _a : '', name);
629
+ }
630
+ var elPath = parsePath(target);
631
+ var pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
632
+ var finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
633
+ var value = pathIsValue ? new rxjs.BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
634
+ var absolutePath = !pathIsValue ? getAbsolutePath(this.dynamicModuleService.elementsTree, el, elPath) : el.path;
635
+ return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
636
+ };
637
+ IOProviderService.prototype.createSubjectSafe = function (path, name, subject) {
638
+ var _this = this;
639
+ if (!this.inputs[path]) {
640
+ this.inputs[path] = {};
641
+ }
642
+ var subjectAlreadyExists = Boolean(this.inputs[path][name]);
643
+ if (!this.inputs[path][name]) {
644
+ this.inputs[path][name] = subject !== null && subject !== void 0 ? subject : new rxjs.BehaviorSubject(undefined);
645
+ }
646
+ if (subject && subjectAlreadyExists) {
647
+ // push delayed value to workaround 'changed after it was checked' issue
648
+ setTimeout(function () { return _this.inputs[path][name].next(subject.value); });
649
+ }
650
+ return this.inputs[path][name];
651
+ };
652
+ return IOProviderService;
653
+ }());
654
+ IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOProviderService, deps: [{ token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
655
+ IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOProviderService });
656
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOProviderService, decorators: [{
657
+ type: i0.Injectable
658
+ }], ctorParameters: function () { return [{ type: DynamicModuleService }]; } });
659
+
660
+ var TemplatesService = /** @class */ (function () {
661
+ function TemplatesService() {
662
+ this.templates = {};
663
+ }
664
+ TemplatesService.prototype.register = function (name, templateRef) {
665
+ this.ensureStorage(name);
666
+ this.templates[name].next(templateRef);
667
+ };
668
+ TemplatesService.prototype.get = function (name) {
669
+ this.ensureStorage(name);
670
+ return this.templates[name].value;
671
+ };
672
+ TemplatesService.prototype.get$ = function (name) {
673
+ this.ensureStorage(name);
674
+ return this.templates[name].asObservable();
675
+ };
676
+ TemplatesService.prototype.ensureStorage = function (name) {
677
+ if (!this.templates[name]) {
678
+ this.templates[name] = new rxjs.BehaviorSubject(undefined);
679
+ }
680
+ };
681
+ return TemplatesService;
682
+ }());
683
+ TemplatesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TemplatesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
684
+ TemplatesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TemplatesService });
685
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TemplatesService, decorators: [{
686
+ type: i0.Injectable
687
+ }] });
688
+
689
+ var IOPlugin = /** @class */ (function () {
690
+ function IOPlugin(host) {
691
+ var _this = this;
692
+ var _a, _b;
693
+ this.host = host;
694
+ var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
695
+ var inputProvider = this.host.injector.get(IOProviderService);
696
+ var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
697
+ var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
698
+ inputs.forEach(function (_c) {
699
+ var _d = __read(_c, 2), key = _d[0], path = _d[1];
700
+ var _a;
701
+ if (path && typeof path !== 'string') {
702
+ console.error("The value of '" + key + "' input should be a string");
703
+ }
704
+ if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
705
+ console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
706
+ }
707
+ _this.host[key] = inputProvider.connect(elementMetadata, key, path);
708
+ });
709
+ outputs.forEach(function (_c) {
710
+ var _d = __read(_c, 2), key = _d[0], path = _d[1];
711
+ if (path && typeof path !== 'string') {
712
+ console.error("The value of '" + key + "' output should be a string");
713
+ }
714
+ _this.host[key] = inputProvider.provide(elementMetadata, key, path);
715
+ });
716
+ }
717
+ return IOPlugin;
718
+ }());
719
+ IOPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
720
+ IOPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: IOPlugin, ngImport: i0__namespace });
721
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOPlugin, decorators: [{
722
+ type: i0.Directive
723
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
724
+
725
+ var ScriptPlugin = /** @class */ (function () {
726
+ function ScriptPlugin(host) {
727
+ var _this = this;
728
+ this.host = host;
729
+ this.normalizeImports = function (script, elementPath) {
730
+ var regexp = new RegExp("import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t\"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['\"])([^'\"\\n]+)(?:['\"]);", 'g');
731
+ var result = script.replace(regexp, function (match, g1, g2, src) {
732
+ var imports = g1
733
+ .trim()
734
+ .slice(1, -1)
735
+ .split(',')
736
+ .map(function (item) { return item.trim(); });
737
+ imports.forEach(function (item) {
738
+ var _a;
739
+ if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
740
+ throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
741
+ }
742
+ });
743
+ return "const " + g1 + " = vendor['" + src + "'];";
744
+ });
745
+ return result;
746
+ };
747
+ this.document = this.host.injector.get(i7.DOCUMENT);
748
+ this.vendorMap = this.host.injector.get(VENDOR_MAP);
749
+ var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
750
+ var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
751
+ this.addScript(sharedElementMetadata);
752
+ this.addScript(elementMetadata);
753
+ }
754
+ ScriptPlugin.prototype.addScript = function (metadata) {
755
+ var _a;
756
+ if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
757
+ return;
758
+ }
759
+ var id = btoa(core.UUID.UUID());
760
+ var script = this.document.createElement('script');
761
+ script.type = "text/javascript";
762
+ var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
763
+ var classMatch = /export class (\S+)/.exec(scriptContent);
764
+ var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
765
+ if (!classMatch || !className) {
766
+ console.error("Script doesn't have exported class");
767
+ return;
768
+ }
769
+ scriptContent = scriptContent.replace(classMatch[0], "class " + className);
770
+ script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
771
+ this.document.body.appendChild(script);
772
+ var ScriptClass = window[id](this.vendorMap);
773
+ if (ScriptClass instanceof Object) {
774
+ this.host.registerPlugin(new ScriptClass(this.host));
775
+ }
776
+ this.document.body.removeChild(script);
777
+ };
778
+ return ScriptPlugin;
779
+ }());
780
+ ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
781
+ ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ScriptPlugin, ngImport: i0__namespace });
782
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
783
+ type: i0.Directive
784
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
785
+
786
+ /*
787
+ * ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
788
+ */
789
+ var CONFIG = {
790
+ CUSTOM: {
791
+ component: exports.ElementComponent,
792
+ plugins: [IOPlugin, ScriptPlugin],
793
+ },
794
+ CONTAINER: {
795
+ component: exports.ElementComponent,
796
+ defaultTemplate: '<element-children></element-children>',
797
+ plugins: [ScriptPlugin],
798
+ },
799
+ SERVICE: {
800
+ component: exports.ElementComponent,
801
+ plugins: [IOPlugin, ScriptPlugin],
802
+ suppressTemplate: true,
803
+ suppressStyles: true,
804
+ },
805
+ REFERENCE: {
806
+ component: exports.ElementComponent,
807
+ plugins: [IOPlugin, ScriptPlugin],
808
+ suppressTemplate: true,
809
+ },
810
+ };
811
+
812
+ var EXPORTED_CLASS_REGEX = /export class (\S+)/;
813
+ var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
814
+ var UiBuildError = /** @class */ (function (_super) {
815
+ __extends(UiBuildError, _super);
816
+ function UiBuildError(message, affectedMetadata) {
817
+ var _this = _super.call(this, message) || this;
818
+ _this.name = _this.constructor.name;
819
+ _this.affectedMetadata = affectedMetadata;
820
+ return _this;
821
+ }
822
+ return UiBuildError;
823
+ }(Error));
824
+ var elementToMetadata = function (el, parentPath) {
825
+ var _a;
826
+ var script = el.script && window.atob(el.script);
827
+ var template = el.template && window.atob(el.template);
828
+ var styles = el.styles && window.atob(el.styles);
829
+ var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
830
+ if (!exportedClassName) {
831
+ throw new Error("Script doesn't have exported class");
832
+ }
833
+ var elementMetadata = extractElementMetadata(script || '');
834
+ var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
835
+ return Object.assign(Object.assign({}, elementMetadata), { path: path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template: template, styles: styles, children: el.children.map(function (child) { return elementToMetadata(child, path); }) });
836
+ };
837
+ var metadataToElement = function (metadata, recursive) {
838
+ if (recursive === void 0) { recursive = true; }
839
+ var elMetadata = {
840
+ name: metadata.name,
841
+ isShared: metadata.isShared,
842
+ type: metadata.type,
843
+ model: metadata.model,
844
+ module: metadata.module,
845
+ reference: metadata.reference,
846
+ inputs: metadata.inputs,
847
+ outputs: metadata.outputs,
848
+ children: metadata.children.map(function (_e) {
849
+ var name = _e.name;
850
+ return name;
851
+ }),
852
+ configuredStyles: metadata.configuredStyles,
853
+ };
854
+ var normalizedElMetadata = normalizeElementMetadata(elMetadata);
855
+ if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
856
+ throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
857
+ }
858
+ var script = metadata.script &&
859
+ window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
860
+ var template = metadata.template && window.btoa(metadata.template);
861
+ var styles = metadata.styles && window.btoa(metadata.styles);
862
+ return {
863
+ script: script,
864
+ template: template,
865
+ styles: styles,
866
+ children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
867
+ };
868
+ };
869
+ var normalizeElementMetadata = function (elementMetadata) {
870
+ var _a, _b, _c, _d;
871
+ var metadata = Object.assign({}, elementMetadata);
872
+ // model
873
+ var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
874
+ var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
875
+ if (model) {
876
+ metadata.model = model;
877
+ }
878
+ else {
879
+ delete metadata.model;
880
+ }
881
+ // module
882
+ if (!metadata.module) {
883
+ delete metadata.module;
884
+ }
885
+ // reference
886
+ if (!metadata.reference) {
887
+ delete metadata.reference;
888
+ }
889
+ // inputs
890
+ var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
891
+ var _f;
892
+ var _g = __read(_e, 2), key = _g[0], value = _g[1];
893
+ return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
894
+ }, {});
895
+ if (inputs && Object.keys(inputs).length > 0) {
896
+ metadata.inputs = inputs;
897
+ }
898
+ else {
899
+ delete metadata.inputs;
900
+ }
901
+ // outputs
902
+ var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
903
+ var _f;
904
+ var _g = __read(_e, 2), key = _g[0], value = _g[1];
905
+ return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
906
+ }, {});
907
+ if (outputs && Object.keys(outputs).length > 0) {
908
+ metadata.outputs = outputs;
909
+ }
910
+ else {
911
+ delete metadata.outputs;
912
+ }
913
+ // children
914
+ if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
915
+ delete metadata.children;
916
+ }
917
+ // isShared
918
+ if (!metadata.isShared) {
919
+ delete metadata.isShared;
920
+ }
921
+ // configuredStyles
922
+ if (!metadata.configuredStyles) {
923
+ delete metadata.configuredStyles;
924
+ }
925
+ return metadata;
926
+ };
927
+ var extractElementMetadata = function (script) {
928
+ var _a;
929
+ var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
930
+ // need to reset regex last index to prevent null result for next execution
931
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
932
+ return new Function("return " + metadataString)();
933
+ };
934
+ var extendElementMetadata = function (script, extend) {
935
+ var _a;
936
+ var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
937
+ // need to reset regex last index to prevent null result for next execution
938
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
939
+ if (!metadataString) {
940
+ return script;
941
+ }
942
+ var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
943
+ return script.replace(metadataString, stringifyElementMetadata(updated));
944
+ };
945
+ var getElementConfig = function (type) {
946
+ return CONFIG[type];
947
+ };
948
+ var doesElementSupportIO = function (type) {
949
+ var _a, _b;
950
+ return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
951
+ };
952
+ function stringifyElementMetadata(elementMetadata) {
953
+ var cleaned = JSON.stringify(elementMetadata, null, 2);
954
+ return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
955
+ return match.replace(/"/g, '');
956
+ });
957
+ }
958
+ var isValidScript = function (script) {
959
+ var _a;
960
+ if (!script) {
961
+ return false;
962
+ }
963
+ var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
964
+ if (!exportedClassName) {
965
+ return false;
966
+ }
967
+ var meta = extractElementMetadata(script);
968
+ if (!meta.name || !meta.type) {
969
+ return false;
970
+ }
971
+ return true;
972
+ };
973
+ function flattenElements(elements) {
974
+ return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
975
+ }
976
+ function isSharedElement(el) {
977
+ return Boolean(el.isShared) && el.type !== 'REFERENCE';
978
+ }
979
+
980
+ var ElementContextService = /** @class */ (function () {
981
+ function ElementContextService() {
982
+ }
983
+ return ElementContextService;
984
+ }());
985
+ ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
986
+ ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementContextService });
987
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementContextService, decorators: [{
988
+ type: i0.Injectable
989
+ }] });
990
+
991
+ var ElementRendererComponent = /** @class */ (function () {
992
+ function ElementRendererComponent(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
993
+ this.parentInjector = parentInjector;
994
+ this.dynamicModuleService = dynamicModuleService;
995
+ this.elementContext = elementContext;
996
+ this.ioProviderService = ioProviderService;
997
+ this.configurationService = configurationService;
998
+ this.elementRef = elementRef;
999
+ this.cdr = cdr;
1000
+ this.refs = {};
1001
+ this.destroy$ = new rxjs.Subject();
1002
+ }
1003
+ ElementRendererComponent.prototype.ngOnInit = function () {
1004
+ this.elementContext.metadata = this.meta;
1005
+ this.factory = this.dynamicModuleService.getComponentFactory(this.meta);
1006
+ this.createComponents();
1007
+ };
1008
+ ElementRendererComponent.prototype.ngOnDestroy = function () {
1009
+ this.destroyComponents();
1010
+ this.destroy$.next();
1011
+ this.destroy$.complete();
1012
+ };
1013
+ ElementRendererComponent.prototype.createComponents = function () {
1014
+ var modelMeta = this.meta.model;
1015
+ if (!modelMeta) {
1016
+ this.refs[core.UUID.UUID()] = this.createComponent();
1017
+ return;
1018
+ }
1019
+ if (modelMeta.lineItem) {
1020
+ this.createFromLineItem(modelMeta.lineItem);
1021
+ }
1022
+ else if (modelMeta.path) {
1023
+ this.createFromPath(modelMeta.path);
1024
+ }
1025
+ };
1026
+ ElementRendererComponent.prototype.createFromPath = function (path) {
1027
+ var _this = this;
1028
+ var array$ = this.ioProviderService.connect(this.meta, 'children$', path);
1029
+ array$ === null || array$ === void 0 ? void 0 : array$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (children) {
1030
+ if (!lodash.isArray(children)) {
1031
+ return;
1032
+ }
1033
+ _this.processChildren(children);
1034
+ });
1035
+ };
1036
+ ElementRendererComponent.prototype.getModelComponent = function () {
1037
+ var component = null;
1038
+ var injector = this.parentInjector;
1039
+ while (!component) {
1040
+ var parentComp = injector.get(ElementRendererComponent, null);
1041
+ if (parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) {
1042
+ component = parentComp;
1043
+ break;
1044
+ }
1045
+ if (parentComp) {
1046
+ injector = parentComp.parentInjector;
1047
+ }
1048
+ else {
1049
+ break;
1050
+ }
1051
+ }
1052
+ return component;
1053
+ };
1054
+ ElementRendererComponent.prototype.createFromLineItem = function (path) {
1055
+ var _this = this;
1056
+ var _a, _b;
1057
+ var parentComp = this.getModelComponent();
1058
+ var parentPath = (_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) === null || _a === void 0 ? void 0 : _a.lineItem;
1059
+ var pathBlocks = parseBoundPath(path).reverse();
1060
+ var _c = (_b = pathBlocks[1]) !== null && _b !== void 0 ? _b : {}, property = _c.property, name = _c.name;
1061
+ var finalPath = pathBlocks[0];
1062
+ var children$ = this.getParentLineItem$(parentComp).pipe(rxjs.map(function (model) {
1063
+ var _a;
1064
+ if (!model) {
1065
+ return [];
1066
+ }
1067
+ if (property === 'ports' && !finalPath.property && parentPath !== path) {
1068
+ return (_a = model.lineItems.filter(function (_c) {
1069
+ var port = _c.port;
1070
+ return port === name;
1071
+ })) !== null && _a !== void 0 ? _a : [];
1072
+ }
1073
+ return [model];
1074
+ }));
1075
+ children$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (children) {
1076
+ _this.processChildren(children);
1077
+ });
1078
+ };
1079
+ ElementRendererComponent.prototype.processChildren = function (children) {
1080
+ var _this = this;
1081
+ var refs = children.reduce(function (acc, data, index) {
1082
+ var _c;
1083
+ var _a;
1084
+ var key = String((_a = data === null || data === void 0 ? void 0 : data.id) !== null && _a !== void 0 ? _a : core.UUID.UUID());
1085
+ var existingRef = _this.refs[key];
1086
+ var ref = existingRef !== null && existingRef !== void 0 ? existingRef : _this.createComponent(data, index);
1087
+ if (existingRef) {
1088
+ _this.updateComponent(existingRef, data, index);
1089
+ }
1090
+ return ref ? Object.assign(Object.assign({}, acc), (_c = {}, _c[key] = ref, _c)) : acc;
1091
+ }, {});
1092
+ var existingKeys = Object.keys(this.refs);
1093
+ var newKeys = Object.keys(refs);
1094
+ lodash.pull.apply(void 0, __spreadArray([existingKeys], __read(newKeys))).forEach(function (key) {
1095
+ _this.destroyComponent(key);
1096
+ });
1097
+ this.refs = refs;
1098
+ this.cdr.detectChanges();
1099
+ };
1100
+ ElementRendererComponent.prototype.getParentLineItem$ = function (parentComp) {
1101
+ var _this = this;
1102
+ var _a;
1103
+ var parentRefs = Object.values((_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.refs) !== null && _a !== void 0 ? _a : {});
1104
+ var parentRef = parentRefs.find(function (ref) { var _a; return (_a = ref === null || ref === void 0 ? void 0 : ref.location.nativeElement) === null || _a === void 0 ? void 0 : _a.contains(_this.elementRef.nativeElement); });
1105
+ var parentModel$ = parentRef === null || parentRef === void 0 ? void 0 : parentRef.instance.model$;
1106
+ return parentModel$ !== null && parentModel$ !== void 0 ? parentModel$ : this.configurationService.get();
1107
+ };
1108
+ ElementRendererComponent.prototype.createComponent = function (data, index) {
1109
+ var _a, _b;
1110
+ if (!this.factory) {
1111
+ return;
1112
+ }
1113
+ var componentRef = (_a = this.el) === null || _a === void 0 ? void 0 : _a.createComponent(this.factory, index);
1114
+ if (componentRef) {
1115
+ componentRef.location.nativeElement.setAttribute('name', this.meta.name);
1116
+ componentRef.location.nativeElement.setAttribute('path', this.meta.path);
1117
+ (_b = componentRef.instance) === null || _b === void 0 ? void 0 : _b.model$.next(data);
1118
+ }
1119
+ return componentRef;
1120
+ };
1121
+ ElementRendererComponent.prototype.updateComponent = function (ref, data, index) {
1122
+ ref.instance.model$.next(data);
1123
+ if (this.el && this.el.indexOf(ref.hostView) !== index) {
1124
+ this.el.move(ref.hostView, index);
1125
+ }
1126
+ };
1127
+ ElementRendererComponent.prototype.destroyComponent = function (key) {
1128
+ var _a;
1129
+ (_a = this.refs[key]) === null || _a === void 0 ? void 0 : _a.destroy();
1130
+ delete this.refs[key];
1131
+ };
1132
+ ElementRendererComponent.prototype.destroyComponents = function () {
1133
+ Object.values(this.refs).forEach(function (ref) { return ref === null || ref === void 0 ? void 0 : ref.destroy(); });
1134
+ this.refs = {};
1135
+ };
1136
+ return ElementRendererComponent;
1137
+ }());
1138
+ ElementRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererComponent, deps: [{ token: i0__namespace.Injector, skipSelf: true }, { token: DynamicModuleService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2__namespace.ConfigurationService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1139
+ ElementRendererComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: { meta: "meta" }, providers: [ElementContextService], viewQueries: [{ propertyName: "el", first: true, predicate: ["el"], descendants: true, read: i0.ViewContainerRef, static: true }], ngImport: i0__namespace, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1140
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
1141
+ type: i0.Component,
1142
+ args: [{
1143
+ selector: 'vl-cms-element-renderer',
1144
+ templateUrl: './element-renderer.component.html',
1145
+ styleUrls: ['./element-renderer.component.scss'],
1146
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1147
+ providers: [ElementContextService],
1148
+ }]
1149
+ }], ctorParameters: function () {
1150
+ return [{ type: i0__namespace.Injector, decorators: [{
1151
+ type: i0.SkipSelf
1152
+ }] }, { type: DynamicModuleService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2__namespace.ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
1153
+ }, propDecorators: { el: [{
1154
+ type: i0.ViewChild,
1155
+ args: ['el', { read: i0.ViewContainerRef, static: true }]
1156
+ }], meta: [{
1157
+ type: i0.Input
1158
+ }] } });
1159
+
1160
+ var ElementChildrenComponent = /** @class */ (function () {
1161
+ function ElementChildrenComponent(elementContext) {
1162
+ this.elementContext = elementContext;
1163
+ this.metadata = this.elementContext.metadata;
1164
+ }
1165
+ return ElementChildrenComponent;
1166
+ }());
1167
+ ElementChildrenComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1168
+ ElementChildrenComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ElementChildrenComponent, selector: "element-children", ngImport: i0__namespace, template: "<ng-container *ngIf=\"metadata?.children.length\">\n <ng-container *ngFor=\"let child of metadata.children\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1169
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
1170
+ type: i0.Component,
1171
+ args: [{
1172
+ // eslint-disable-next-line @angular-eslint/component-selector
1173
+ selector: 'element-children',
1174
+ templateUrl: 'element-children.component.html',
1175
+ styleUrls: ['./element-children.component.scss'],
1176
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1177
+ }]
1178
+ }], ctorParameters: function () { return [{ type: ElementContextService }]; } });
1179
+
1180
+ // eslint-disable-next-line @angular-eslint/directive-selector
1181
+ var CustomTemplateDirective = /** @class */ (function () {
1182
+ function CustomTemplateDirective(templateRef, templatesService) {
1183
+ this.templateRef = templateRef;
1184
+ this.templatesService = templatesService;
1185
+ }
1186
+ CustomTemplateDirective.prototype.ngAfterViewInit = function () {
1187
+ if (!this.customTemplate) {
1188
+ return;
1189
+ }
1190
+ this.templatesService.register(this.customTemplate, this.templateRef);
1191
+ };
1192
+ return CustomTemplateDirective;
1193
+ }());
1194
+ CustomTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CustomTemplateDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: TemplatesService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1195
+ CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
1196
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
1197
+ type: i0.Directive,
1198
+ args: [{ selector: '[customTemplate]' }]
1199
+ }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
1200
+ type: i0.Input
1201
+ }] } });
1202
+
1203
+ var defaultOptions = {
1204
+ suppressLoading: false,
1205
+ loadingLabel: 'LOADING',
1206
+ };
1207
+
1208
+ var moduleMap = {};
1209
+ function loadRemoteEntry(remoteEntry) {
1210
+ return new Promise(function (resolve, reject) {
1211
+ if (moduleMap[remoteEntry]) {
1212
+ resolve();
1213
+ return;
1214
+ }
1215
+ var script = document.createElement('script');
1216
+ script.src = remoteEntry;
1217
+ script.onerror = reject;
1218
+ script.onload = function () {
1219
+ moduleMap[remoteEntry] = true;
1220
+ resolve(); // window is the global namespace
1221
+ };
1222
+ document.body.append(script);
1223
+ });
1224
+ }
1225
+ function lookupExposedModule(remoteName, exposedModule) {
1226
+ return __awaiter(this, void 0, void 0, function () {
1227
+ var container, factory, Module;
1228
+ return __generator(this, function (_a) {
1229
+ switch (_a.label) {
1230
+ case 0:
1231
+ // Initializes the share scope. This fills it with known provided modules from this build and all remotes
1232
+ return [4 /*yield*/, __webpack_init_sharing__('default')];
1233
+ case 1:
1234
+ // Initializes the share scope. This fills it with known provided modules from this build and all remotes
1235
+ _a.sent();
1236
+ container = window[remoteName];
1237
+ // Initialize the container, it may provide shared modules
1238
+ return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
1239
+ case 2:
1240
+ // Initialize the container, it may provide shared modules
1241
+ _a.sent();
1242
+ return [4 /*yield*/, container.get(exposedModule)];
1243
+ case 3:
1244
+ factory = _a.sent();
1245
+ Module = factory();
1246
+ return [2 /*return*/, Module];
1247
+ }
1248
+ });
1249
+ });
1250
+ }
1251
+ function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
1252
+ return __awaiter(this, void 0, void 0, function () {
1253
+ return __generator(this, function (_a) {
1254
+ switch (_a.label) {
1255
+ case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
1256
+ case 1:
1257
+ _a.sent();
1258
+ return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
1259
+ case 2: return [2 /*return*/, _a.sent()];
1260
+ }
1261
+ });
1262
+ });
1263
+ }
1264
+
1265
+ var FederatedComponent = /** @class */ (function () {
1266
+ function FederatedComponent(injector, compiler, appRef, renderer) {
1267
+ this.injector = injector;
1268
+ this.compiler = compiler;
1269
+ this.appRef = appRef;
1270
+ this.renderer = renderer;
1271
+ this.isLoading$ = new rxjs.BehaviorSubject(false);
1272
+ // configs
1273
+ this.suppressLoading = defaultOptions.suppressLoading;
1274
+ this.loadingLabel = defaultOptions.loadingLabel;
1275
+ }
1276
+ FederatedComponent.prototype.ngOnChanges = function (changes) {
1277
+ var _a, _b, _c, _d;
1278
+ if (changes.data && this.instance) {
1279
+ this.instance.data = this.data;
1280
+ }
1281
+ if (changes.options) {
1282
+ this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
1283
+ this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
1284
+ }
1285
+ };
1286
+ FederatedComponent.prototype.ngOnInit = function () {
1287
+ this.isLoading$.next(true);
1288
+ };
1289
+ FederatedComponent.prototype.ngAfterViewInit = function () {
1290
+ var _this = this;
1291
+ var _a, _b, _c, _d, _e, _f;
1292
+ var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
1293
+ var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
1294
+ var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
1295
+ if (!remoteEntry || !remoteName || !exposedModule) {
1296
+ return;
1297
+ }
1298
+ loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
1299
+ _this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
1300
+ var _a, _b, _c;
1301
+ var rootModuleRef = moduleFactory.create(_this.injector);
1302
+ var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
1303
+ var node = document.createElement('div');
1304
+ var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
1305
+ _this.instance = instance;
1306
+ _this.instance.data = _this.data;
1307
+ _this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
1308
+ _this.appRef.attachView(hostView);
1309
+ (_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
1310
+ _this.isLoading$.next(false);
1311
+ });
1312
+ });
1313
+ };
1314
+ return FederatedComponent;
1315
+ }());
1316
+ FederatedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedComponent, deps: [{ token: i0__namespace.Injector }, { token: i0__namespace.Compiler }, { token: i0__namespace.ApplicationRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Component });
1317
+ FederatedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #moduleHost></div>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], components: [{ type: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1318
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
1319
+ type: i0.Component,
1320
+ args: [{
1321
+ // eslint-disable-next-line @angular-eslint/component-selector
1322
+ selector: 'veloce-host-federated',
1323
+ templateUrl: './federated.component.html',
1324
+ styleUrls: ['./federated.component.scss'],
1325
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1326
+ }]
1327
+ }], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
1328
+ type: i0.ViewChild,
1329
+ args: ['moduleHost', { static: false }]
1330
+ }], remoteEntry: [{
1331
+ type: i0.Input
1332
+ }], remoteName: [{
1333
+ type: i0.Input
1334
+ }], exposedModule: [{
1335
+ type: i0.Input
1336
+ }], data: [{
1337
+ type: i0.Input
1338
+ }], options: [{
1339
+ type: i0.Input
1340
+ }] } });
1341
+
1342
+ var FederatedModule = /** @class */ (function () {
1343
+ function FederatedModule() {
1344
+ }
1345
+ return FederatedModule;
1346
+ }());
1347
+ FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1348
+ FederatedModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, declarations: [FederatedComponent], imports: [i7.CommonModule, i1.LoaderModule], exports: [FederatedComponent] });
1349
+ FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, imports: [[i7.CommonModule, i1.LoaderModule]] });
1350
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, decorators: [{
1351
+ type: i0.NgModule,
1352
+ args: [{
1353
+ declarations: [FederatedComponent],
1354
+ imports: [i7.CommonModule, i1.LoaderModule],
1355
+ exports: [FederatedComponent],
1356
+ }]
1357
+ }] });
1358
+
1359
+ var ConfigurationPlugin = /** @class */ (function () {
1360
+ function ConfigurationPlugin(host) {
1361
+ var _this = this;
1362
+ var _a, _b;
1363
+ this.host = host;
1364
+ this.destroy$ = new rxjs.Subject();
1365
+ this.elementMetadata = this.host.injector.get(ELEMENT_METADATA);
1366
+ this.configurationService = this.host.injector.get(i2.ConfigurationService);
1367
+ if ((_a = this.elementMetadata.model) === null || _a === void 0 ? void 0 : _a.lineItem) {
1368
+ this.host.model$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (model) { return (_this.modelSnapshot = model); });
1369
+ var pathBlocks = parseBoundPath((_b = this.elementMetadata.model) === null || _b === void 0 ? void 0 : _b.lineItem);
1370
+ var _c = pathBlocks.reverse()[0], type = _c.type, property = _c.property, name = _c.name;
1371
+ this.host.boundName = name !== null && name !== void 0 ? name : type;
1372
+ this.register(type, property, name);
1373
+ }
1374
+ }
1375
+ ConfigurationPlugin.prototype.ngOnDestroy = function () {
1376
+ this.destroy$.next();
1377
+ this.destroy$.complete();
1378
+ };
1379
+ ConfigurationPlugin.prototype.register = function (type, property, name) {
1380
+ if (!type) {
1381
+ return;
1382
+ }
1383
+ if (!property) {
1384
+ this.registerType();
1385
+ }
1386
+ else if (property === 'ports' && name) {
1387
+ this.registerPort(name);
1388
+ }
1389
+ else if (property === 'attributes' && name) {
1390
+ this.registerAttribute(name);
1391
+ }
1392
+ };
1393
+ ConfigurationPlugin.prototype.registerType = function () {
1394
+ var _this = this;
1395
+ var remove = function () {
1396
+ var rootLineItem = _this.configurationService.getSnapshot();
1397
+ if (!rootLineItem || !_this.modelSnapshot) {
1398
+ return;
1399
+ }
1400
+ _this.configurationService.patch(new i2.LineItemWorker(rootLineItem).remove(_this.modelSnapshot.id).li);
1401
+ };
1402
+ this.typeHost.remove = remove;
1403
+ };
1404
+ ConfigurationPlugin.prototype.registerPort = function (name) {
1405
+ var _this = this;
1406
+ var model$ = this.host.model$;
1407
+ var portItems$ = model$.pipe(rxjs.map(function (model) { var _a; return (_a = model === null || model === void 0 ? void 0 : model.lineItems.filter(function (li) { return li.port === _this.host.boundName; })) !== null && _a !== void 0 ? _a : []; }));
1408
+ var portDomain$ = model$.pipe(rxjs.map(function (model) { return model === null || model === void 0 ? void 0 : model.portDomains[_this.host.boundName]; }));
1409
+ var add = function (type, attributes) {
1410
+ if (attributes === void 0) { attributes = []; }
1411
+ if (!_this.modelSnapshot) {
1412
+ return;
1413
+ }
1414
+ var portDomain = _this.modelSnapshot.portDomains[name];
1415
+ if (!portDomain) {
1416
+ return;
1417
+ }
1418
+ var generated = i2.generateLineItem(portDomain.name, type, _this.modelSnapshot.id, attributes);
1419
+ _this.configurationService.patch(new i2.LineItemWorker(_this.modelSnapshot).insert(_this.modelSnapshot.id, generated).li);
1420
+ };
1421
+ this.portHost.portItems$ = portItems$;
1422
+ this.portHost.portDomain$ = portDomain$;
1423
+ this.portHost.addPortItem = add;
1424
+ };
1425
+ ConfigurationPlugin.prototype.registerAttribute = function (name) {
1426
+ var _this = this;
1427
+ if (!this.host.model$) {
1428
+ return;
1429
+ }
1430
+ var value$ = this.host.model$.pipe(rxjs.map(function (model) { var _a; return i2.getAttributeValue((_a = model === null || model === void 0 ? void 0 : model.attributes) !== null && _a !== void 0 ? _a : [], name); }));
1431
+ var patch = function (value) {
1432
+ if (!_this.modelSnapshot) {
1433
+ return;
1434
+ }
1435
+ _this.configurationService.patch(new i2.LineItemWorker(_this.modelSnapshot).patchAttribute([{ name: name, value: value }]).li);
1436
+ };
1437
+ this.attributeHost.value$ = value$;
1438
+ this.attributeHost.patch = patch;
1439
+ };
1440
+ Object.defineProperty(ConfigurationPlugin.prototype, "attributeHost", {
1441
+ get: function () {
1442
+ return this.host;
1443
+ },
1444
+ enumerable: false,
1445
+ configurable: true
1446
+ });
1447
+ Object.defineProperty(ConfigurationPlugin.prototype, "typeHost", {
1448
+ get: function () {
1449
+ return this.host;
1450
+ },
1451
+ enumerable: false,
1452
+ configurable: true
1453
+ });
1454
+ Object.defineProperty(ConfigurationPlugin.prototype, "portHost", {
1455
+ get: function () {
1456
+ return this.host;
1457
+ },
1458
+ enumerable: false,
1459
+ configurable: true
1460
+ });
1461
+ return ConfigurationPlugin;
1462
+ }());
1463
+ ConfigurationPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationPlugin, deps: "invalid", target: i0__namespace.ɵɵFactoryTarget.Directive });
1464
+ ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ConfigurationPlugin, ngImport: i0__namespace });
1465
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationPlugin, decorators: [{
1466
+ type: i0.Directive
1467
+ }], ctorParameters: function () { return [{ type: undefined }]; } });
1468
+
1469
+ var DEFAULT_PLUGINS = {
1470
+ CONFIGURATION: [ConfigurationPlugin],
1471
+ DEFAULT: [],
1472
+ };
1473
+
1474
+ var InitAction = { type: 'INIT' };
1475
+ var ClearAction = { type: 'CLEAR' };
1476
+ var IntegrationState = /** @class */ (function () {
1477
+ function IntegrationState() {
1478
+ this.stateSubj$ = new rxjs.BehaviorSubject({});
1479
+ this.action$ = new rxjs.BehaviorSubject(InitAction);
1480
+ }
1481
+ Object.defineProperty(IntegrationState.prototype, "state$", {
1482
+ get: function () {
1483
+ return this.stateSubj$.asObservable();
1484
+ },
1485
+ enumerable: false,
1486
+ configurable: true
1487
+ });
1488
+ Object.defineProperty(IntegrationState.prototype, "state", {
1489
+ get: function () {
1490
+ return this.stateSubj$.getValue();
1491
+ },
1492
+ enumerable: false,
1493
+ configurable: true
1494
+ });
1495
+ IntegrationState.prototype.patchState = function (update) {
1496
+ this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
1497
+ };
1498
+ IntegrationState.prototype.dispatch = function (action) {
1499
+ this.action$.next(action);
1500
+ };
1501
+ IntegrationState.prototype.listen$ = function (actionType) {
1502
+ return this.action$.pipe(rxjs.filter(function (action) { return action.type === actionType; }), rxjs.map(function (action) { return action.payload; }));
1503
+ };
1504
+ IntegrationState.prototype.listenAll$ = function () {
1505
+ return this.action$.asObservable();
1506
+ };
1507
+ IntegrationState.prototype.clear = function () {
1508
+ this.stateSubj$.next({});
1509
+ this.action$.next(ClearAction);
1510
+ };
1511
+ return IntegrationState;
1512
+ }());
1513
+ IntegrationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1514
+ IntegrationState.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, providedIn: 'root' });
1515
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, decorators: [{
1516
+ type: i0.Injectable,
1517
+ args: [{ providedIn: 'root' }]
1518
+ }] });
1519
+
1520
+ var VELOCE_LIBS = {
1521
+ '@veloceapps/sdk/core': Object.assign({ ConfigurationService: i2.ConfigurationService, QuoteDraftService: i2.QuoteDraftService, FlowConfigurationService: i2.FlowConfigurationService, LineItemWorker: i2.LineItemWorker, ProductImagesService: i2.ProductImagesService }, i2.lineItemUtils),
1522
+ '@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState }),
1523
+ '@veloceapps/api': {
1524
+ SalesforceApiService: api.SalesforceApiService,
1525
+ QuoteApiService: api.QuoteApiService,
1526
+ DocumentTemplatesApiService: api.DocumentTemplatesApiService,
1527
+ DocumentAttachmentApiService: api.DocumentAttachmentApiService,
1528
+ RampApiService: api.RampApiService,
1529
+ CatalogApiService: api.CatalogApiService,
1530
+ DeltaApiService: api.DeltaApiService,
1531
+ PicklistsApiService: api.PicklistsApiService,
1532
+ PriceApiService: api.PriceApiService,
1533
+ },
1534
+ };
1535
+ var VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce(function (trunk, _a) {
1536
+ var _b;
1537
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
1538
+ return (Object.assign(Object.assign({}, trunk), (_b = {}, _b[key.replace('@veloceapps/', '@veloce/')] = value, _b)));
1539
+ }, {});
1540
+ var vendorMap = Object.assign(Object.assign(Object.assign({}, VELOCE_LIBS), VELOCE_LIBS_BACKWARDS_COMPATIBLE), { '@angular/core': i0__namespace, '@angular/forms': angularForms__namespace, rxjs: rxjs__namespace, 'rxjs/operators': rxjsOperators__namespace, lodash: lodash__namespace });
1541
+
1542
+ var ElementsResolver = /** @class */ (function () {
1543
+ function ElementsResolver(uiDef, elements) {
1544
+ var _this = this;
1545
+ this.uiDef = uiDef;
1546
+ this.renderableElements = [];
1547
+ this.sharedElements = [];
1548
+ var transpiledElements = this.transpileScripts(elements);
1549
+ this.sharedElements = this.flattenElements(transpiledElements).filter(function (el) { return _this.isSharedElement(el); });
1550
+ this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(Boolean);
1551
+ this.renderableElements = this.getRenderableElements(this.elements);
1552
+ }
1553
+ ElementsResolver.prototype.getNgComponents = function () {
1554
+ var _this = this;
1555
+ return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(Boolean);
1556
+ };
1557
+ ElementsResolver.prototype.transpile = function (el) {
1558
+ var _a;
1559
+ if (!el.script) {
1560
+ return;
1561
+ }
1562
+ var transformed = standalone.transform(el.script, {
1563
+ filename: el.name + '.ts',
1564
+ presets: ['typescript'],
1565
+ sourceMaps: 'inline',
1566
+ });
1567
+ return (_a = transformed.code) !== null && _a !== void 0 ? _a : undefined;
1568
+ };
1569
+ ElementsResolver.prototype.transpileScripts = function (elements) {
1570
+ var _this = this;
1571
+ return elements.map(function (el) { return (Object.assign(Object.assign({}, el), { script: _this.transpile(el), children: _this.transpileScripts(el.children) })); });
1572
+ };
1573
+ ElementsResolver.prototype.flattenElements = function (elements) {
1574
+ var _this = this;
1575
+ return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(_this.flattenElements(el.children))); }));
1576
+ };
1577
+ ElementsResolver.prototype.isSharedElement = function (el) {
1578
+ return Boolean(el.isShared) && el.type !== 'REFERENCE';
1579
+ };
1580
+ ElementsResolver.prototype.getRenderableElements = function (elements) {
1581
+ var e_1, _c;
1582
+ var _this = this;
1583
+ var renderable = [];
1584
+ try {
1585
+ for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
1586
+ var el = elements_1_1.value;
1587
+ if (!this.isSharedElement(el)) {
1588
+ var children = el.children.filter(function (child) { return !_this.isSharedElement(child); });
1589
+ var renderableChildren = this.getRenderableElements(children);
1590
+ renderable.push.apply(renderable, __spreadArray([Object.assign(Object.assign({}, el), { children: children })], __read(renderableChildren)));
1591
+ }
1592
+ }
1593
+ }
1594
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1595
+ finally {
1596
+ try {
1597
+ if (elements_1_1 && !elements_1_1.done && (_c = elements_1.return)) _c.call(elements_1);
1598
+ }
1599
+ finally { if (e_1) throw e_1.error; }
1600
+ }
1601
+ return renderable;
1602
+ };
1603
+ ElementsResolver.prototype.getSharedElement = function (element) {
1604
+ if (!element.reference) {
1605
+ return;
1606
+ }
1607
+ return this.sharedElements.find(function (el) { return element.reference === el.name; });
1608
+ };
1609
+ ElementsResolver.prototype.resolveElementTemplate = function (element) {
1610
+ var config = CONFIG[element.type];
1611
+ var template = !config.suppressTemplate ? element.template : '';
1612
+ return template || config.defaultTemplate || '';
1613
+ };
1614
+ ElementsResolver.prototype.resolveElementStyles = function (element) {
1615
+ var _a;
1616
+ var config = CONFIG[element.type];
1617
+ return !config.suppressStyles ? (_a = element.styles) !== null && _a !== void 0 ? _a : '' : '';
1618
+ };
1619
+ ElementsResolver.prototype.processElementMetadata = function (sourceElement) {
1620
+ var _this = this;
1621
+ var _a, _b;
1622
+ var finalElement;
1623
+ if (sourceElement.type === 'REFERENCE') {
1624
+ var sharedElement = this.getSharedElement(sourceElement);
1625
+ if (!sharedElement) {
1626
+ console.warn("Shared element \"" + sourceElement.reference + "\" not found");
1627
+ return;
1628
+ }
1629
+ finalElement = Object.assign(Object.assign({}, sourceElement), { children: this.getSharedChildren(sharedElement.children, sourceElement.path), type: sharedElement.type, template: sharedElement.template, styles: ((_a = sharedElement.styles) !== null && _a !== void 0 ? _a : '') + '\n' + ((_b = sourceElement.styles) !== null && _b !== void 0 ? _b : ''), inputs: Object.assign(Object.assign({}, sharedElement.inputs), sourceElement.inputs), outputs: Object.assign(Object.assign({}, sharedElement.outputs), sourceElement.outputs) });
1630
+ }
1631
+ else {
1632
+ finalElement = sourceElement;
1633
+ delete sourceElement.reference;
1634
+ }
1635
+ finalElement.template = this.resolveElementTemplate(finalElement);
1636
+ finalElement.styles = this.resolveElementStyles(finalElement);
1637
+ return Object.assign(Object.assign({}, finalElement), { children: finalElement.children
1638
+ .map(function (child) { return _this.processElementMetadata(child); })
1639
+ .filter(Boolean) });
1640
+ };
1641
+ ElementsResolver.prototype.getSharedChildren = function (children, parentPath) {
1642
+ var _this = this;
1643
+ return children.map(function (c) {
1644
+ if (!c.path) {
1645
+ return c;
1646
+ }
1647
+ var _c = __read(c.path.split('/').reverse(), 1), elName = _c[0];
1648
+ var path = parentPath + '/' + elName;
1649
+ return Object.assign(Object.assign({}, c), { path: path, children: _this.getSharedChildren(c.children, path) });
1650
+ });
1651
+ };
1652
+ ElementsResolver.prototype.resolveElement = function (element) {
1653
+ var _a;
1654
+ var config = CONFIG[element.type];
1655
+ var defaultPlugins = (_a = DEFAULT_PLUGINS[this.uiDef.type]) !== null && _a !== void 0 ? _a : [];
1656
+ if (!config) {
1657
+ console.warn("Unknown element type \"" + element.type + "\"");
1658
+ return;
1659
+ }
1660
+ var styles = this.getElementStyles(element);
1661
+ var component = Object.assign(Object.assign({ selector: 'vl-element', template: element.template }, (styles ? { styles: [styles] } : {})), { providers: [
1662
+ { provide: DEFAULT_PLUGINS_TOKEN, useValue: defaultPlugins },
1663
+ { provide: UI_DEFINITION_METADATA, useValue: this.uiDef },
1664
+ { provide: ELEMENT_METADATA, useValue: element },
1665
+ { provide: SHARED_ELEMENT_METADATA, useValue: this.getSharedElement(element) },
1666
+ { provide: ELEMENT_CONFIG, useValue: config },
1667
+ { provide: VENDOR_MAP, useValue: vendorMap },
1668
+ ] });
1669
+ var cmp = i0.Component(component)(/** @class */ (function (_super) {
1670
+ __extends(C, _super);
1671
+ function C() {
1672
+ return _super !== null && _super.apply(this, arguments) || this;
1673
+ }
1674
+ return C;
1675
+ }(config.component)));
1676
+ lodash.set(cmp, 'path', element.path);
1677
+ return cmp;
1678
+ };
1679
+ ElementsResolver.prototype.getElementStyles = function (element) {
1680
+ var result = '';
1681
+ var configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
1682
+ if (configuredStyles) {
1683
+ // order is important: styles written by user in CSS code should has higher priority
1684
+ result += configuredStyles;
1685
+ }
1686
+ if (element.styles) {
1687
+ result += element.styles;
1688
+ }
1689
+ return result || undefined;
1690
+ };
1691
+ ElementsResolver.prototype.convertInlineStylesToCSS = function (styles) {
1692
+ if (!styles) {
1693
+ return '';
1694
+ }
1695
+ var entries = Object.entries(styles);
1696
+ var result = ':host {\n';
1697
+ entries.forEach(function (_c) {
1698
+ var _d = __read(_c, 2), style = _d[0], value = _d[1];
1699
+ result += " " + lodash.kebabCase(style) + ":" + value + ";\n";
1700
+ });
1701
+ result += '}\n';
1702
+ return result;
1703
+ };
1704
+ return ElementsResolver;
1705
+ }());
1706
+
1707
+ var LauncherService = /** @class */ (function () {
1708
+ function LauncherService(compiler, dynamicModuleService) {
1709
+ this.compiler = compiler;
1710
+ this.dynamicModuleService = dynamicModuleService;
1711
+ }
1712
+ LauncherService.prototype.compileModule = function (uiDef, elements) {
1713
+ var _this = this;
1714
+ var elementsResolver = new ElementsResolver(uiDef, elements);
1715
+ this.dynamicModuleService.elementsTree = elementsResolver.elements;
1716
+ this.module = this.getModule(elementsResolver.getNgComponents());
1717
+ return rxjs.from(this.compiler.compileModuleAndAllComponentsAsync(this.module)).pipe(rxjs.tap(function (m) {
1718
+ _this.dynamicModuleService.componentFactories = m.componentFactories;
1719
+ _this.moduleInstance = m;
1720
+ }), rxjs.map(function (m) { return ({ module: m, elements: elementsResolver.elements }); }));
1721
+ };
1722
+ LauncherService.prototype.destroy = function () {
1723
+ if (this.moduleInstance) {
1724
+ this.dynamicModuleService.clear();
1725
+ this.moduleInstance = undefined;
1726
+ }
1727
+ if (this.module) {
1728
+ this.compiler.clearCacheFor(this.module);
1729
+ this.module = undefined;
1730
+ }
1731
+ };
1732
+ LauncherService.prototype.getModule = function (components) {
1733
+ var staticComponents = [ElementChildrenComponent, ElementRendererComponent, CustomTemplateDirective];
1734
+ var DynamicModule = /** @class */ (function () {
1735
+ function DynamicModule() {
1736
+ }
1737
+ return DynamicModule;
1738
+ }());
1739
+ DynamicModule = __decorate([
1740
+ i0.NgModule({
1741
+ imports: [i7.CommonModule, angularForms.FormsModule, angularForms.ReactiveFormsModule, FederatedModule, dragDrop.DragDropModule],
1742
+ declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
1743
+ jit: true,
1744
+ })
1745
+ ], DynamicModule);
1746
+ return DynamicModule;
1747
+ };
1748
+ return LauncherService;
1749
+ }());
1750
+ LauncherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService, deps: [{ token: i0__namespace.Compiler }, { token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1751
+ LauncherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService });
1752
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService, decorators: [{
1753
+ type: i0.Injectable
1754
+ }], ctorParameters: function () { return [{ type: i0__namespace.Compiler }, { type: DynamicModuleService }]; } });
1755
+
1756
+ var PreviewComponent = /** @class */ (function () {
1757
+ function PreviewComponent(launcherService, configurationService, messageService, runtimeService, integrationState) {
1758
+ this.launcherService = launcherService;
1759
+ this.configurationService = configurationService;
1760
+ this.messageService = messageService;
1761
+ this.runtimeService = runtimeService;
1762
+ this.integrationState = integrationState;
1763
+ this.clearState = false;
1764
+ this.state$ = new rxjs.BehaviorSubject({ loading: true, failure: false });
1765
+ this.elements = [];
1766
+ this.destroy$ = new rxjs.Subject();
1767
+ }
1768
+ PreviewComponent.prototype.ngOnInit = function () {
1769
+ if (this.clearState) {
1770
+ this.integrationState.clear();
1771
+ }
1772
+ this.startPreview();
1773
+ };
1774
+ PreviewComponent.prototype.ngOnDestroy = function () {
1775
+ this.destroy$.next();
1776
+ this.destroy$.complete();
1777
+ this.configurationService.reset();
1778
+ };
1779
+ PreviewComponent.prototype.initializeConfiguration$ = function () {
1780
+ var _this = this;
1781
+ var isAlreadyInitialized = this.runtimeService.isInitialized;
1782
+ if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
1783
+ return rxjs.of({});
1784
+ }
1785
+ if (!this.modelId) {
1786
+ console.warn("No modelId is given for uiDefinition with '" + this.uiDefinition.type + "' type");
1787
+ return rxjs.of({});
1788
+ }
1789
+ // If still not initialized - init configuration in Test mode
1790
+ return this.runtimeService
1791
+ .initTestMode(this.modelId, this.uiDefinition)
1792
+ .pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
1793
+ };
1794
+ PreviewComponent.prototype.elementToMetadataSafe = function (elements) {
1795
+ var _a, _b;
1796
+ try {
1797
+ return elements.map(function (element) { return elementToMetadata(element); });
1798
+ }
1799
+ catch (e) {
1800
+ console.error(e);
1801
+ if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1802
+ this.messageService.add({ severity: 'error', summary: String(e) });
1803
+ }
1804
+ return [];
1805
+ }
1806
+ };
1807
+ PreviewComponent.prototype.startPreview = function () {
1808
+ var _this = this;
1809
+ if (!this.uiDefinition) {
1810
+ return;
1811
+ }
1812
+ var _a = this.uiDefinition, children = _a.children, uiDefinitionMeta = __rest(_a, ["children"]);
1813
+ var elements = this.elementToMetadataSafe(children);
1814
+ var compilation$ = this.launcherService.compileModule(uiDefinitionMeta, elements);
1815
+ rxjs.forkJoin([compilation$, this.initializeConfiguration$()])
1816
+ .pipe(rxjs.tap(function (_c) {
1817
+ var _d = __read(_c, 1), result = _d[0];
1818
+ _this.elements = result.elements;
1819
+ _this.state$.next({ loading: false, failure: false });
1820
+ }), rxjs.catchError(function (error) {
1821
+ var _a, _b;
1822
+ console.error(error);
1823
+ if (!((_b = (_a = _this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1824
+ _this.messageService.add({ severity: 'error', summary: error });
1825
+ }
1826
+ _this.state$.next({ loading: false, failure: true });
1827
+ return rxjs.of();
1828
+ }), rxjs.takeUntil(this.destroy$))
1829
+ .subscribe();
1830
+ };
1831
+ return PreviewComponent;
1832
+ }());
1833
+ PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: LauncherService }, { token: i2__namespace.ConfigurationService }, { token: i3__namespace.MessageService }, { token: i2__namespace.ConfigurationRuntimeService }, { token: IntegrationState }], target: i0__namespace.ɵɵFactoryTarget.Component });
1834
+ PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", clearState: "clearState" }, providers: [IOProviderService, TemplatesService], ngImport: i0__namespace, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer *ngFor=\"let el of elements\" [meta]=\"el\"></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.ShadowDom });
1835
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
1836
+ type: i0.Component,
1837
+ args: [{
1838
+ selector: 'vl-cms-preview',
1839
+ templateUrl: './preview.component.html',
1840
+ styleUrls: ['./preview.component.scss'],
1841
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1842
+ providers: [IOProviderService, TemplatesService],
1843
+ // use shadow DOM to prevent UI from being affected by global styles
1844
+ encapsulation: i0.ViewEncapsulation.ShadowDom,
1845
+ }]
1846
+ }], ctorParameters: function () { return [{ type: LauncherService }, { type: i2__namespace.ConfigurationService }, { type: i3__namespace.MessageService }, { type: i2__namespace.ConfigurationRuntimeService }, { type: IntegrationState }]; }, propDecorators: { modelId: [{
1847
+ type: i0.Input
1848
+ }], uiDefinition: [{
1849
+ type: i0.Input
1850
+ }], clearState: [{
1851
+ type: i0.Input
1852
+ }] } });
1853
+
1854
+ var ElementRendererModule = /** @class */ (function () {
1855
+ function ElementRendererModule() {
1856
+ }
1857
+ return ElementRendererModule;
1858
+ }());
1859
+ ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1860
+ ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
1861
+ ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule });
1862
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
1863
+ type: i0.NgModule,
1864
+ args: [{
1865
+ declarations: [ElementRendererComponent],
1866
+ exports: [ElementRendererComponent],
1867
+ }]
1868
+ }] });
1869
+
1870
+ var ElementChildrenModule = /** @class */ (function () {
1871
+ function ElementChildrenModule() {
1872
+ }
1873
+ return ElementChildrenModule;
1874
+ }());
1875
+ ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1876
+ ElementChildrenModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [ElementRendererModule], exports: [ElementChildrenComponent] });
1877
+ ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[ElementRendererModule]] });
1878
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
1879
+ type: i0.NgModule,
1880
+ args: [{
1881
+ declarations: [ElementChildrenComponent],
1882
+ imports: [ElementRendererModule],
1883
+ exports: [ElementChildrenComponent],
1884
+ }]
1885
+ }] });
1886
+
1887
+ var PreviewModule = /** @class */ (function () {
1888
+ function PreviewModule() {
1889
+ }
1890
+ return PreviewModule;
1891
+ }());
1892
+ PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1893
+ PreviewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, declarations: [PreviewComponent], imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule], exports: [PreviewComponent] });
1894
+ PreviewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, providers: [IntegrationState], imports: [[i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule]] });
1895
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, decorators: [{
1896
+ type: i0.NgModule,
1897
+ args: [{
1898
+ declarations: [PreviewComponent],
1899
+ imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule],
1900
+ providers: [IntegrationState],
1901
+ exports: [PreviewComponent],
1902
+ }]
1903
+ }] });
1904
+
1905
+ function ElementDefinition(definition) {
1906
+ return function (constructor) {
1907
+ return constructor;
1908
+ };
1909
+ }
1910
+
1911
+ var LauncherModule = /** @class */ (function () {
1912
+ function LauncherModule() {
1913
+ }
1914
+ return LauncherModule;
1915
+ }());
1916
+ LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1917
+ LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule] });
1918
+ LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule]] });
1919
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, decorators: [{
1920
+ type: i0.NgModule,
1921
+ args: [{
1922
+ imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule],
1923
+ providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService],
1924
+ }]
1925
+ }] });
1926
+
1927
+ /**
1928
+ * Generated bundle index. Do not edit.
1929
+ */
1930
+
1931
+ exports.ApplyProductConfigurationAction = ApplyProductConfigurationAction;
1932
+ exports.CloseDocGenAction = CloseDocGenAction;
1933
+ exports.ConfigureProductAction = ConfigureProductAction;
1934
+ exports.DEFAULT_PLUGINS_TOKEN = DEFAULT_PLUGINS_TOKEN;
1935
+ exports.ELEMENT_CONFIG = ELEMENT_CONFIG;
1936
+ exports.ELEMENT_METADATA = ELEMENT_METADATA;
1937
+ exports.ElementDefinition = ElementDefinition;
1938
+ exports.ElementsResolver = ElementsResolver;
1939
+ exports.IntegrationState = IntegrationState;
1940
+ exports.LauncherModule = LauncherModule;
1941
+ exports.LauncherService = LauncherService;
1942
+ exports.NavigateBackAction = NavigateBackAction;
1943
+ exports.NavigateToCatalogAction = NavigateToCatalogAction;
1944
+ exports.OpenDocGenAction = OpenDocGenAction;
1945
+ exports.PreviewComponent = PreviewComponent;
1946
+ exports.PreviewModule = PreviewModule;
1947
+ exports.RemoteApplyAction = RemoteApplyAction;
1948
+ exports.RemoteCancelAction = RemoteCancelAction;
1949
+ exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;
1950
+ exports.SetDefaultMetrics = SetDefaultMetrics;
1951
+ exports.SwitchObjectAction = SwitchObjectAction;
1952
+ exports.TemplatesService = TemplatesService;
1953
+ exports.UI_DEFINITION_METADATA = UI_DEFINITION_METADATA;
1954
+ exports.UiBuildError = UiBuildError;
1955
+ exports.VENDOR_MAP = VENDOR_MAP;
1956
+ exports.doesElementSupportIO = doesElementSupportIO;
1957
+ exports.elementToMetadata = elementToMetadata;
1958
+ exports.extendElementMetadata = extendElementMetadata;
1959
+ exports.extractElementMetadata = extractElementMetadata;
1960
+ exports.findElementByModule = findElementByModule;
1961
+ exports.flattenElements = flattenElements;
1962
+ exports.getAbsolutePath = getAbsolutePath;
1963
+ exports.getElementConfig = getElementConfig;
1964
+ exports.isSharedElement = isSharedElement;
1965
+ exports.isValidScript = isValidScript;
1966
+ exports.metadataToElement = metadataToElement;
1967
+ exports.normalizeElementMetadata = normalizeElementMetadata;
1968
+ exports.parseBoundPath = parseBoundPath;
1969
+ exports.parsePath = parsePath;
1970
+ exports.stringifyElementMetadata = stringifyElementMetadata;
1971
+
1972
+ Object.defineProperty(exports, '__esModule', { value: true });
1973
+
1974
+ }));
1975
+ //# sourceMappingURL=veloceapps-sdk-cms.umd.js.map