@veloceapps/sdk 4.0.21-0

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