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