@veloceapps/sdk 0.0.0-watch

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 (351) hide show
  1. package/README.md +7 -0
  2. package/cms/cms.actions.d.ts +12 -0
  3. package/cms/cms.default.d.ts +5 -0
  4. package/cms/cms.elements.d.ts +4 -0
  5. package/cms/components/element-children/element-children.component.d.ts +10 -0
  6. package/cms/components/element-children/element-children.module.d.ts +8 -0
  7. package/cms/components/element-renderer/element-renderer.component.d.ts +35 -0
  8. package/cms/components/element-renderer/element-renderer.module.d.ts +7 -0
  9. package/cms/components/element.component.d.ts +13 -0
  10. package/cms/components/index.d.ts +1 -0
  11. package/cms/components/plugin.component.d.ts +15 -0
  12. package/cms/components/preview/index.d.ts +2 -0
  13. package/cms/components/preview/preview.component.d.ts +34 -0
  14. package/cms/components/preview/preview.module.d.ts +11 -0
  15. package/cms/decorators/element.decorator.d.ts +2 -0
  16. package/cms/decorators/index.d.ts +1 -0
  17. package/cms/directives/custom-template.directive.d.ts +12 -0
  18. package/cms/engine/models/entity.d.ts +11 -0
  19. package/cms/engine/models/plugin.d.ts +5 -0
  20. package/cms/index.d.ts +11 -0
  21. package/cms/injection-tokens.d.ts +11 -0
  22. package/cms/launcher.module.d.ts +10 -0
  23. package/cms/modules/federated/default-options.d.ts +4 -0
  24. package/cms/modules/federated/export.d.ts +1 -0
  25. package/cms/modules/federated/federated.component.d.ts +26 -0
  26. package/cms/modules/federated/federated.module.d.ts +9 -0
  27. package/cms/modules/federated/federated.types.d.ts +30 -0
  28. package/cms/modules/federated/federated.utils.d.ts +1 -0
  29. package/cms/package.json +10 -0
  30. package/cms/plugins/configuration.plugin.d.ts +23 -0
  31. package/cms/plugins/io.plugin.d.ts +9 -0
  32. package/cms/plugins/script.plugin.d.ts +13 -0
  33. package/cms/services/dynamic-module.service.d.ts +15 -0
  34. package/cms/services/element-context.service.d.ts +8 -0
  35. package/cms/services/index.d.ts +3 -0
  36. package/cms/services/integration.state.d.ts +17 -0
  37. package/cms/services/io-provider.service.d.ts +15 -0
  38. package/cms/services/launcher.service.d.ts +18 -0
  39. package/cms/services/templates.service.d.ts +9 -0
  40. package/cms/types/common.types.d.ts +103 -0
  41. package/cms/types/configuration.types.d.ts +17 -0
  42. package/cms/types/elements.types.d.ts +2 -0
  43. package/cms/types/index.d.ts +5 -0
  44. package/cms/types/integration.types.d.ts +4 -0
  45. package/cms/types/path.types.d.ts +11 -0
  46. package/cms/utils/element.utils.d.ts +15 -0
  47. package/cms/utils/elements-resolver.d.ts +20 -0
  48. package/cms/utils/index.d.ts +3 -0
  49. package/cms/utils/path.utils.d.ts +5 -0
  50. package/cms/veloce-sdk-cms.d.ts +5 -0
  51. package/cms/vendor-map.d.ts +689 -0
  52. package/core/core.module.d.ts +8 -0
  53. package/core/index.d.ts +6 -0
  54. package/core/modules/configuration/configuration.module.d.ts +7 -0
  55. package/core/modules/configuration/helpers.d.ts +3 -0
  56. package/core/modules/configuration/index.d.ts +4 -0
  57. package/core/modules/configuration/services/configuration-runtime.service.d.ts +28 -0
  58. package/core/modules/configuration/services/configuration.service.d.ts +40 -0
  59. package/core/modules/configuration/services/runtime-context.service.d.ts +14 -0
  60. package/core/modules/configuration/types/configuration-runtime.types.d.ts +6 -0
  61. package/core/modules/flow-configuration/flow-configuration.module.d.ts +6 -0
  62. package/core/modules/flow-configuration/index.d.ts +4 -0
  63. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +37 -0
  64. package/core/modules/flow-configuration/services/flow-update.service.d.ts +12 -0
  65. package/core/modules/flow-configuration/types/update.types.d.ts +12 -0
  66. package/core/modules/index.d.ts +2 -0
  67. package/core/package.json +10 -0
  68. package/core/services/context.service.d.ts +17 -0
  69. package/core/services/index.d.ts +3 -0
  70. package/core/services/product-images.service.d.ts +12 -0
  71. package/core/services/quote-draft.service.d.ts +31 -0
  72. package/core/types/index.d.ts +3 -0
  73. package/core/types/quote-states.types.d.ts +6 -0
  74. package/core/types/runtime.types.d.ts +31 -0
  75. package/core/types/ui-definition.types.d.ts +26 -0
  76. package/core/utils/index.d.ts +2 -0
  77. package/core/utils/line-item.utils.d.ts +26 -0
  78. package/core/utils/line-item.worker.d.ts +12 -0
  79. package/core/veloce-sdk-core.d.ts +5 -0
  80. package/esm2015/cms/cms.actions.js +17 -0
  81. package/esm2015/cms/cms.default.js +6 -0
  82. package/esm2015/cms/cms.elements.js +29 -0
  83. package/esm2015/cms/components/element-children/element-children.component.js +23 -0
  84. package/esm2015/cms/components/element-children/element-children.module.js +18 -0
  85. package/esm2015/cms/components/element-renderer/element-renderer.component.js +143 -0
  86. package/esm2015/cms/components/element-renderer/element-renderer.module.js +16 -0
  87. package/esm2015/cms/components/element.component.js +31 -0
  88. package/esm2015/cms/components/index.js +2 -0
  89. package/esm2015/cms/components/plugin.component.js +16 -0
  90. package/esm2015/cms/components/preview/index.js +3 -0
  91. package/esm2015/cms/components/preview/preview.component.js +105 -0
  92. package/esm2015/cms/components/preview/preview.module.js +23 -0
  93. package/esm2015/cms/decorators/element.decorator.js +6 -0
  94. package/esm2015/cms/decorators/index.js +2 -0
  95. package/esm2015/cms/directives/custom-template.directive.js +25 -0
  96. package/esm2015/cms/engine/models/entity.js +18 -0
  97. package/esm2015/cms/engine/models/plugin.js +6 -0
  98. package/esm2015/cms/index.js +11 -0
  99. package/esm2015/cms/injection-tokens.js +8 -0
  100. package/esm2015/cms/launcher.module.js +23 -0
  101. package/esm2015/cms/modules/federated/default-options.js +5 -0
  102. package/esm2015/cms/modules/federated/export.js +2 -0
  103. package/esm2015/cms/modules/federated/federated.component.js +82 -0
  104. package/esm2015/cms/modules/federated/federated.module.js +19 -0
  105. package/esm2015/cms/modules/federated/federated.types.js +2 -0
  106. package/esm2015/cms/modules/federated/federated.utils.js +37 -0
  107. package/esm2015/cms/plugins/configuration.plugin.js +94 -0
  108. package/esm2015/cms/plugins/io.plugin.js +37 -0
  109. package/esm2015/cms/plugins/script.plugin.js +66 -0
  110. package/esm2015/cms/services/dynamic-module.service.js +33 -0
  111. package/esm2015/cms/services/element-context.service.js +10 -0
  112. package/esm2015/cms/services/index.js +4 -0
  113. package/esm2015/cms/services/integration.state.js +40 -0
  114. package/esm2015/cms/services/io-provider.service.js +51 -0
  115. package/esm2015/cms/services/launcher.service.js +57 -0
  116. package/esm2015/cms/services/templates.service.js +19 -0
  117. package/esm2015/cms/types/common.types.js +2 -0
  118. package/esm2015/cms/types/configuration.types.js +2 -0
  119. package/esm2015/cms/types/elements.types.js +2 -0
  120. package/esm2015/cms/types/index.js +6 -0
  121. package/esm2015/cms/types/integration.types.js +2 -0
  122. package/esm2015/cms/types/path.types.js +2 -0
  123. package/esm2015/cms/utils/element.utils.js +149 -0
  124. package/esm2015/cms/utils/elements-resolver.js +108 -0
  125. package/esm2015/cms/utils/index.js +4 -0
  126. package/esm2015/cms/utils/path.utils.js +67 -0
  127. package/esm2015/cms/veloce-sdk-cms.js +5 -0
  128. package/esm2015/cms/vendor-map.js +35 -0
  129. package/esm2015/core/core.module.js +18 -0
  130. package/esm2015/core/index.js +7 -0
  131. package/esm2015/core/modules/configuration/configuration.module.js +34 -0
  132. package/esm2015/core/modules/configuration/helpers.js +10 -0
  133. package/esm2015/core/modules/configuration/index.js +5 -0
  134. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +90 -0
  135. package/esm2015/core/modules/configuration/services/configuration.service.js +153 -0
  136. package/esm2015/core/modules/configuration/services/runtime-context.service.js +61 -0
  137. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +2 -0
  138. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +18 -0
  139. package/esm2015/core/modules/flow-configuration/index.js +5 -0
  140. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +90 -0
  141. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +114 -0
  142. package/esm2015/core/modules/flow-configuration/types/update.types.js +2 -0
  143. package/esm2015/core/modules/index.js +3 -0
  144. package/esm2015/core/services/context.service.js +44 -0
  145. package/esm2015/core/services/index.js +4 -0
  146. package/esm2015/core/services/product-images.service.js +30 -0
  147. package/esm2015/core/services/quote-draft.service.js +88 -0
  148. package/esm2015/core/types/index.js +4 -0
  149. package/esm2015/core/types/quote-states.types.js +2 -0
  150. package/esm2015/core/types/runtime.types.js +16 -0
  151. package/esm2015/core/types/ui-definition.types.js +2 -0
  152. package/esm2015/core/utils/index.js +3 -0
  153. package/esm2015/core/utils/line-item.utils.js +98 -0
  154. package/esm2015/core/utils/line-item.worker.js +19 -0
  155. package/esm2015/core/veloce-sdk-core.js +5 -0
  156. package/esm2015/index.js +2 -0
  157. package/esm2015/runtime/components/component-preview/component-preview.component.js +125 -0
  158. package/esm2015/runtime/components/index.js +5 -0
  159. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +71 -0
  160. package/esm2015/runtime/components/ui-runtime/runtime.component.js +427 -0
  161. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +109 -0
  162. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +68 -0
  163. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +36 -0
  164. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +72 -0
  165. package/esm2015/runtime/execution/components/federated/federated.component.js +81 -0
  166. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +65 -0
  167. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +136 -0
  168. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +80 -0
  169. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +101 -0
  170. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +150 -0
  171. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +121 -0
  172. package/esm2015/runtime/execution/directives/section-script.directive.js +242 -0
  173. package/esm2015/runtime/execution/directives/sf-query.directive.js +34 -0
  174. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +86 -0
  175. package/esm2015/runtime/execution/directives/velo-port.directive.js +373 -0
  176. package/esm2015/runtime/execution/directives/vl-approval.directive.js +22 -0
  177. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +35 -0
  178. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +59 -0
  179. package/esm2015/runtime/execution/directives/vl-quote.directive.js +41 -0
  180. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +51 -0
  181. package/esm2015/runtime/execution/runtime-execution.module.js +163 -0
  182. package/esm2015/runtime/execution/utils/federated.util.js +37 -0
  183. package/esm2015/runtime/index.js +5 -0
  184. package/esm2015/runtime/runtime.module.js +104 -0
  185. package/esm2015/runtime/services/cart.service.js +28 -0
  186. package/esm2015/runtime/services/collapsible-state.service.js +34 -0
  187. package/esm2015/runtime/services/configuration.service.js +102 -0
  188. package/esm2015/runtime/services/current-state.service.js +17 -0
  189. package/esm2015/runtime/services/form-scope.service.js +30 -0
  190. package/esm2015/runtime/services/index.js +4 -0
  191. package/esm2015/runtime/services/product-model-cache.service.js +30 -0
  192. package/esm2015/runtime/services/runtime-context.service.js +56 -0
  193. package/esm2015/runtime/services/runtime-form.service.js +224 -0
  194. package/esm2015/runtime/services/runtime.service.js +108 -0
  195. package/esm2015/runtime/services/section-helper.service.js +27 -0
  196. package/esm2015/runtime/services/section-scope.service.js +36 -0
  197. package/esm2015/runtime/services/section-store.service.js +22 -0
  198. package/esm2015/runtime/services/section.service.js +124 -0
  199. package/esm2015/runtime/types/bound-data.types.js +7 -0
  200. package/esm2015/runtime/types/index.js +2 -0
  201. package/esm2015/runtime/types/runtime.types.js +2 -0
  202. package/esm2015/runtime/types/script-registry.types.js +51 -0
  203. package/esm2015/runtime/utils/line-item.util.js +273 -0
  204. package/esm2015/runtime/utils/section.utils.js +26 -0
  205. package/esm2015/runtime/utils/sections-binder.helper.js +105 -0
  206. package/esm2015/runtime/veloce-sdk-runtime.js +5 -0
  207. package/esm2015/src/components/dialog/dialog.component.js +30 -0
  208. package/esm2015/src/components/dialog/dialog.module.js +19 -0
  209. package/esm2015/src/components/dialog/dialog.types.js +2 -0
  210. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +116 -0
  211. package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +23 -0
  212. package/esm2015/src/components/header/header.component.js +196 -0
  213. package/esm2015/src/components/header/header.module.js +23 -0
  214. package/esm2015/src/components/header/header.types.js +2 -0
  215. package/esm2015/src/constants.js +2 -0
  216. package/esm2015/src/flow-routing.module.js +97 -0
  217. package/esm2015/src/flow.component.js +35 -0
  218. package/esm2015/src/flow.module.js +52 -0
  219. package/esm2015/src/guards/context.guard.js +75 -0
  220. package/esm2015/src/guards/index.js +2 -0
  221. package/esm2015/src/guards/product-unload.guard.js +43 -0
  222. package/esm2015/src/guards/root.guard.js +41 -0
  223. package/esm2015/src/index.js +7 -0
  224. package/esm2015/src/pages/catalog/catalog.component.js +117 -0
  225. package/esm2015/src/pages/catalog/catalog.module.js +20 -0
  226. package/esm2015/src/pages/debug/debug.component.js +65 -0
  227. package/esm2015/src/pages/debug/debug.module.js +48 -0
  228. package/esm2015/src/pages/legacy-product/legacy-product.component.js +132 -0
  229. package/esm2015/src/pages/legacy-product/legacy-product.module.js +21 -0
  230. package/esm2015/src/pages/product/product.component.js +95 -0
  231. package/esm2015/src/pages/product/product.module.js +20 -0
  232. package/esm2015/src/pages/record-not-found/record-not-found.component.js +29 -0
  233. package/esm2015/src/pages/record-not-found/record-not-found.module.js +20 -0
  234. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +117 -0
  235. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +20 -0
  236. package/esm2015/src/resolvers/flow.resolver.js +58 -0
  237. package/esm2015/src/resolvers/quote.resolver.js +45 -0
  238. package/esm2015/src/services/flow-dialog.service.js +80 -0
  239. package/esm2015/src/services/flow-router.service.js +124 -0
  240. package/esm2015/src/services/flow.service.js +67 -0
  241. package/esm2015/src/services/index.js +2 -0
  242. package/esm2015/src/types/context-route.types.js +2 -0
  243. package/esm2015/src/types/flow-customization.types.js +3 -0
  244. package/esm2015/src/types/index.js +3 -0
  245. package/esm2015/src/types/route.types.js +2 -0
  246. package/esm2015/src/utils/flow.utils.js +12 -0
  247. package/esm2015/src/utils/index.js +2 -0
  248. package/esm2015/veloce-sdk.js +5 -0
  249. package/fesm2015/veloce-sdk-cms.js +1301 -0
  250. package/fesm2015/veloce-sdk-cms.js.map +1 -0
  251. package/fesm2015/veloce-sdk-core.js +837 -0
  252. package/fesm2015/veloce-sdk-core.js.map +1 -0
  253. package/fesm2015/veloce-sdk-runtime.js +3895 -0
  254. package/fesm2015/veloce-sdk-runtime.js.map +1 -0
  255. package/fesm2015/veloce-sdk.js +1635 -0
  256. package/fesm2015/veloce-sdk.js.map +1 -0
  257. package/index.d.ts +1 -0
  258. package/package.json +49 -0
  259. package/runtime/components/component-preview/component-preview.component.d.ts +27 -0
  260. package/runtime/components/index.d.ts +4 -0
  261. package/runtime/components/section-renderer/section-renderer.component.d.ts +25 -0
  262. package/runtime/components/ui-runtime/runtime.component.d.ts +53 -0
  263. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +27 -0
  264. package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +30 -0
  265. package/runtime/execution/components/context-provider/context-provider.component.d.ts +14 -0
  266. package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +25 -0
  267. package/runtime/execution/components/federated/federated.component.d.ts +36 -0
  268. package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +19 -0
  269. package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +35 -0
  270. package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +22 -0
  271. package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +22 -0
  272. package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +28 -0
  273. package/runtime/execution/components/velo-type/velo-type.component.d.ts +31 -0
  274. package/runtime/execution/directives/section-script.directive.d.ts +59 -0
  275. package/runtime/execution/directives/sf-query.directive.d.ts +15 -0
  276. package/runtime/execution/directives/velo-attribute.directive.d.ts +26 -0
  277. package/runtime/execution/directives/velo-port.directive.d.ts +74 -0
  278. package/runtime/execution/directives/vl-approval.directive.d.ts +10 -0
  279. package/runtime/execution/directives/vl-document-attachments.directive.d.ts +15 -0
  280. package/runtime/execution/directives/vl-document-templates.directive.d.ts +33 -0
  281. package/runtime/execution/directives/vl-quote.directive.d.ts +14 -0
  282. package/runtime/execution/directives/vl-ramp.directive.d.ts +15 -0
  283. package/runtime/execution/runtime-execution.module.d.ts +27 -0
  284. package/runtime/execution/utils/federated.util.d.ts +6 -0
  285. package/runtime/index.d.ts +4 -0
  286. package/runtime/package.json +10 -0
  287. package/runtime/runtime.module.d.ts +18 -0
  288. package/runtime/services/cart.service.d.ts +15 -0
  289. package/runtime/services/collapsible-state.service.d.ts +15 -0
  290. package/runtime/services/configuration.service.d.ts +19 -0
  291. package/runtime/services/current-state.service.d.ts +8 -0
  292. package/runtime/services/form-scope.service.d.ts +20 -0
  293. package/runtime/services/index.d.ts +3 -0
  294. package/runtime/services/product-model-cache.service.d.ts +14 -0
  295. package/runtime/services/runtime-context.service.d.ts +16 -0
  296. package/runtime/services/runtime-form.service.d.ts +24 -0
  297. package/runtime/services/runtime.service.d.ts +43 -0
  298. package/runtime/services/section-helper.service.d.ts +8 -0
  299. package/runtime/services/section-scope.service.d.ts +14 -0
  300. package/runtime/services/section-store.service.d.ts +11 -0
  301. package/runtime/services/section.service.d.ts +30 -0
  302. package/runtime/types/bound-data.types.d.ts +13 -0
  303. package/runtime/types/index.d.ts +1 -0
  304. package/runtime/types/runtime.types.d.ts +19 -0
  305. package/runtime/types/script-registry.types.d.ts +13 -0
  306. package/runtime/utils/line-item.util.d.ts +34 -0
  307. package/runtime/utils/section.utils.d.ts +2 -0
  308. package/runtime/utils/sections-binder.helper.d.ts +16 -0
  309. package/runtime/veloce-sdk-runtime.d.ts +5 -0
  310. package/src/components/dialog/dialog.component.d.ts +13 -0
  311. package/src/components/dialog/dialog.module.d.ts +9 -0
  312. package/src/components/dialog/dialog.types.d.ts +6 -0
  313. package/src/components/header/cart-overlay/cart-preview.component.d.ts +31 -0
  314. package/src/components/header/cart-overlay/cart-preview.module.d.ts +13 -0
  315. package/src/components/header/header.component.d.ts +48 -0
  316. package/src/components/header/header.module.d.ts +13 -0
  317. package/src/components/header/header.types.d.ts +19 -0
  318. package/src/constants.d.ts +1 -0
  319. package/src/flow-routing.module.d.ts +11 -0
  320. package/src/flow.component.d.ts +17 -0
  321. package/src/flow.module.d.ts +15 -0
  322. package/src/guards/context.guard.d.ts +18 -0
  323. package/src/guards/index.d.ts +1 -0
  324. package/src/guards/product-unload.guard.d.ts +16 -0
  325. package/src/guards/root.guard.d.ts +15 -0
  326. package/src/index.d.ts +6 -0
  327. package/src/pages/catalog/catalog.component.d.ts +32 -0
  328. package/src/pages/catalog/catalog.module.d.ts +10 -0
  329. package/src/pages/debug/debug.component.d.ts +27 -0
  330. package/src/pages/debug/debug.module.d.ts +14 -0
  331. package/src/pages/legacy-product/legacy-product.component.d.ts +37 -0
  332. package/src/pages/legacy-product/legacy-product.module.d.ts +10 -0
  333. package/src/pages/product/product.component.d.ts +30 -0
  334. package/src/pages/product/product.module.d.ts +10 -0
  335. package/src/pages/record-not-found/record-not-found.component.d.ts +11 -0
  336. package/src/pages/record-not-found/record-not-found.module.d.ts +9 -0
  337. package/src/pages/shopping-cart/shopping-cart.component.d.ts +32 -0
  338. package/src/pages/shopping-cart/shopping-cart.module.d.ts +10 -0
  339. package/src/resolvers/flow.resolver.d.ts +14 -0
  340. package/src/resolvers/quote.resolver.d.ts +18 -0
  341. package/src/services/flow-dialog.service.d.ts +20 -0
  342. package/src/services/flow-router.service.d.ts +35 -0
  343. package/src/services/flow.service.d.ts +17 -0
  344. package/src/services/index.d.ts +1 -0
  345. package/src/types/context-route.types.d.ts +5 -0
  346. package/src/types/flow-customization.types.d.ts +11 -0
  347. package/src/types/index.d.ts +2 -0
  348. package/src/types/route.types.d.ts +9 -0
  349. package/src/utils/flow.utils.d.ts +1 -0
  350. package/src/utils/index.d.ts +1 -0
  351. package/veloce-sdk.d.ts +5 -0
@@ -0,0 +1,837 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
3
+ import { UUID, ConfigurationContext, ConfigurationContextMode, RuntimeModel, SalesforceIdUtils, ConfigurationMode } from '@veloce/core';
4
+ import { BehaviorSubject, map as map$1, distinctUntilChanged, catchError, of, tap as tap$1, zip, combineLatest, throwError, shareReplay, noop, switchMap } from 'rxjs';
5
+ import { filter, tap, map, take, first, catchError as catchError$1 } from 'rxjs/operators';
6
+ import * as i1 from '@veloce/api';
7
+ import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloce/api';
8
+ import { merge, flatten, sortBy, cloneDeep } from 'lodash';
9
+ import * as i2 from 'primeng/api';
10
+ import { ConfirmationComponent, ConfirmationDialogModule } from '@veloce/components';
11
+ import * as i5 from 'primeng/dynamicdialog';
12
+ import moment from 'moment';
13
+
14
+ const getDefaultLineItem = (context, uiDefinitionProperties) => {
15
+ var _a, _b, _c;
16
+ const id = UUID.UUID();
17
+ const lineItem = Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty: 1, 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
18
+ ? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
19
+ : {}));
20
+ return lineItem;
21
+ };
22
+
23
+ var RuntimeMode;
24
+ (function (RuntimeMode) {
25
+ RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
26
+ RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
27
+ })(RuntimeMode || (RuntimeMode = {}));
28
+ var RuntimeOperation;
29
+ (function (RuntimeOperation) {
30
+ RuntimeOperation["INIT"] = "INIT";
31
+ RuntimeOperation["UPDATE"] = "UPDATE";
32
+ })(RuntimeOperation || (RuntimeOperation = {}));
33
+ var RuntimeStep;
34
+ (function (RuntimeStep) {
35
+ RuntimeStep["START"] = "START";
36
+ RuntimeStep["UPDATE"] = "UPDATE";
37
+ })(RuntimeStep || (RuntimeStep = {}));
38
+
39
+ class ContextService {
40
+ constructor(contextApiService) {
41
+ this.contextApiService = contextApiService;
42
+ this.context = new BehaviorSubject(null);
43
+ }
44
+ get isInitialized() {
45
+ return Boolean(this.context.value);
46
+ }
47
+ resolve() {
48
+ if (!this.context.value) {
49
+ throw new Error('Context is not initialized yet!');
50
+ }
51
+ return Object.assign({}, this.context.value);
52
+ }
53
+ resolve$() {
54
+ return this.context.pipe(filter((ctx) => Boolean(ctx)));
55
+ }
56
+ create(headerId, mode) {
57
+ return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
58
+ }
59
+ update(partialContext) {
60
+ const originalContext = this.resolve();
61
+ const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
62
+ this.context.next(updatedContext);
63
+ return updatedContext;
64
+ }
65
+ delete() {
66
+ this.context.next(null);
67
+ }
68
+ }
69
+ ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
70
+ ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, providedIn: 'root' });
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, decorators: [{
72
+ type: Injectable,
73
+ args: [{ providedIn: 'root' }]
74
+ }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
75
+
76
+ class ProductImagesService {
77
+ constructor(productApiService) {
78
+ this.productApiService = productApiService;
79
+ this.imagesMap$ = new BehaviorSubject({});
80
+ }
81
+ getImageUrl$(productId) {
82
+ if (this.imagesMap$.value[productId] == null) {
83
+ this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
84
+ this.fetchProductImage(productId);
85
+ }
86
+ return this.imagesMap$.pipe(map$1(imagesMap => imagesMap[productId]), distinctUntilChanged());
87
+ }
88
+ fetchProductImage(productId) {
89
+ this.productApiService
90
+ .fetchImage$(productId)
91
+ .pipe(map$1(file => URL.createObjectURL(file)), catchError(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
92
+ .subscribe();
93
+ }
94
+ }
95
+ ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
96
+ ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
97
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, decorators: [{
98
+ type: Injectable,
99
+ args: [{ providedIn: 'root' }]
100
+ }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
101
+
102
+ class QuoteDraftService {
103
+ constructor(context, quoteApiService, priceApiService) {
104
+ this.context = context;
105
+ this.quoteApiService = quoteApiService;
106
+ this.priceApiService = priceApiService;
107
+ this.quoteSubj$ = new BehaviorSubject(null);
108
+ this.resetSubj$ = new BehaviorSubject(true);
109
+ this.priceLists = [];
110
+ this.isInitialized = false;
111
+ this.hasUnsavedChanges = false;
112
+ this.reset$ = this.resetSubj$.asObservable();
113
+ }
114
+ reset() {
115
+ this.resetSubj$.next(true);
116
+ this.quoteSubj$.next(null);
117
+ }
118
+ init(quoteId, params) {
119
+ return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists(), this.context.resolve$()).pipe(tap(([quote, priceLists, context]) => {
120
+ this.quoteSubj$.next(quote);
121
+ this.priceLists = priceLists;
122
+ this.quotePriceList = priceLists.find(p => p.id === context.properties.PriceListId);
123
+ this.context.update(Object.assign(Object.assign(Object.assign({}, context), quote.context), { properties: Object.assign(Object.assign({}, context.properties), quote.context.properties) }));
124
+ }), map(() => {
125
+ this.isInitialized = true;
126
+ }), take(1));
127
+ }
128
+ setCurrentLineItemState(lineItems) {
129
+ const quote = this.quoteSubj$.value;
130
+ if (!quote) {
131
+ return;
132
+ }
133
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quote), { currentState: lineItems }));
134
+ this.markAsUpdated();
135
+ }
136
+ updateByPriceSummary(priceSummary) {
137
+ const quote = this.quoteSubj$.value;
138
+ if (!quote) {
139
+ return;
140
+ }
141
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quote), { currentState: priceSummary.lineItems, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
142
+ this.markAsUpdated();
143
+ }
144
+ get quote$() {
145
+ return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteSnapshot), filter((quote) => Boolean(quote)));
146
+ }
147
+ get quoteSnapshot() {
148
+ const quote = this.quoteSubj$.value;
149
+ if (!quote) {
150
+ return null;
151
+ }
152
+ return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
153
+ }
154
+ get isStandalone() {
155
+ return this.context.resolve().properties.standalone === 'true';
156
+ }
157
+ isEditMode$() {
158
+ return this.context.resolve$().pipe(map(() => this.isEditMode()));
159
+ }
160
+ isEditMode() {
161
+ const context = this.context.resolve();
162
+ if (context.mode === ConfigurationContextMode.ACCOUNT) {
163
+ return true;
164
+ }
165
+ if (context.mode === ConfigurationContextMode.QUOTE) {
166
+ return context.properties.Status === 'Draft';
167
+ }
168
+ return false;
169
+ }
170
+ markAsUpdated() {
171
+ if (this.isInitialized && !this.hasUnsavedChanges) {
172
+ this.hasUnsavedChanges = true;
173
+ }
174
+ }
175
+ }
176
+ QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
177
+ QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, decorators: [{
179
+ type: Injectable,
180
+ args: [{ providedIn: 'root' }]
181
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
182
+
183
+ class RuntimeContextService {
184
+ constructor(configurationApiService, messageService) {
185
+ this.configurationApiService = configurationApiService;
186
+ this.messageService = messageService;
187
+ }
188
+ getRuntimeContext(productId, offeringId) {
189
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
190
+ var _a, _b, _c;
191
+ const uiDefinition = this.getUIDefinition(runtimeData);
192
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
193
+ const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
194
+ return {
195
+ modelId: runtimeData.modelId,
196
+ uiDefinition: uiDefinition,
197
+ runtimeModel: runtimeModel,
198
+ runtimeMode: RuntimeMode.PROD,
199
+ productId: productId,
200
+ productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
201
+ offeringId: offeringId,
202
+ properties: {
203
+ PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
204
+ PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
205
+ },
206
+ };
207
+ }));
208
+ }
209
+ getUIDefinition(runtimeData) {
210
+ var _a;
211
+ let rawUiDefinitions;
212
+ try {
213
+ rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
214
+ }
215
+ catch (e) {
216
+ return;
217
+ }
218
+ const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
219
+ const uiDefinition = (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[0];
220
+ if (!uiDefinition) {
221
+ const errMsg = `Unable to find Default UI`;
222
+ this.messageService.add({
223
+ severity: 'error',
224
+ summary: 'ERROR',
225
+ });
226
+ throw new Error(errMsg);
227
+ }
228
+ return uiDefinition;
229
+ }
230
+ }
231
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }, { token: i2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
232
+ RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService });
233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, decorators: [{
234
+ type: Injectable
235
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i2.MessageService }]; } });
236
+
237
+ class ConfigurationRuntimeService {
238
+ constructor(apiService, contextService, runtimeContextService) {
239
+ this.apiService = apiService;
240
+ this.contextService = contextService;
241
+ this.runtimeContextService = runtimeContextService;
242
+ this._isInitialized = false;
243
+ this.uiDefinitionProperties = {};
244
+ }
245
+ reset() {
246
+ this._isInitialized = false;
247
+ this._runtimeContext = undefined;
248
+ this._assets = undefined;
249
+ this.uiDefinitionProperties = {};
250
+ }
251
+ initTestMode(modelId, uiDefinition) {
252
+ var _a, _b;
253
+ this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
254
+ const uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
255
+ return combineLatest([
256
+ this.apiService.getRuntimeDataByModelId(modelId),
257
+ this.contextService.create('TestId', ConfigurationContextMode.TEST),
258
+ ]).pipe(first(), tap(([runtimeData, context]) => {
259
+ var _a;
260
+ this._runtimeContext = {
261
+ modelId: modelId,
262
+ runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
263
+ runtimeMode: RuntimeMode.TEST,
264
+ };
265
+ this.contextService.update({
266
+ 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: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
267
+ });
268
+ this._isInitialized = true;
269
+ }));
270
+ }
271
+ init(props) {
272
+ this._assets = props.assets;
273
+ const context = this.contextService.resolve();
274
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
275
+ var _a, _b, _c, _d;
276
+ this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
277
+ const { PriceListId } = (_c = context.properties) !== null && _c !== void 0 ? _c : {};
278
+ const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
279
+ this.id15to18('AccountId', mergeContext.properties);
280
+ this._runtimeContext = mergeContext;
281
+ if (context.properties && ((_d = this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
282
+ this.contextService.update({
283
+ properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
284
+ });
285
+ }
286
+ this._isInitialized = true;
287
+ }));
288
+ }
289
+ id15to18(propertyName, source) {
290
+ if (!source) {
291
+ return;
292
+ }
293
+ const value = source[propertyName];
294
+ if (typeof value === 'string' && value.length === 15) {
295
+ source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
296
+ }
297
+ }
298
+ getAsset(lineItem) {
299
+ return this._assets && this._assets.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
300
+ }
301
+ get isInitialized() {
302
+ return this._isInitialized;
303
+ }
304
+ get runtimeModel() {
305
+ var _a;
306
+ return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
307
+ }
308
+ get runtimeContext() {
309
+ return this._runtimeContext;
310
+ }
311
+ }
312
+ ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
313
+ ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService });
314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
315
+ type: Injectable
316
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
317
+
318
+ const findLineItem = (id, lineItems) => {
319
+ return findLineItemWithComparator(lineItems, (li) => li.id === id);
320
+ };
321
+ const findLineItemWithComparator = (lineItems, comparator) => {
322
+ let currentLevel = lineItems;
323
+ while (currentLevel.length) {
324
+ const found = currentLevel.find(comparator);
325
+ if (found) {
326
+ return found;
327
+ }
328
+ currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
329
+ }
330
+ return;
331
+ };
332
+ const insertLineItem = (lineItem, parentId, toInsert) => {
333
+ const insertData = lineItem.id === parentId ? [toInsert] : [];
334
+ return Object.assign(Object.assign({}, lineItem), { lineItems: [
335
+ ...insertData,
336
+ ...lineItem.lineItems.map(li => {
337
+ return insertLineItem(li, parentId, toInsert);
338
+ }),
339
+ ] });
340
+ };
341
+ const removeLineItem = (lineItem, idToRemove) => {
342
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
343
+ .map(li => {
344
+ if (li.id === idToRemove) {
345
+ return;
346
+ }
347
+ else if (li.lineItems.length) {
348
+ return removeLineItem(li, idToRemove);
349
+ }
350
+ return li;
351
+ })
352
+ .filter(r => !!r) });
353
+ };
354
+ const replaceLineItem = (lineItem, replaceTo) => {
355
+ if (lineItem.id === replaceTo.id) {
356
+ return Object.assign({}, replaceTo);
357
+ }
358
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => {
359
+ if (li.id === replaceTo.id) {
360
+ return replaceTo;
361
+ }
362
+ else if (li.lineItems.length) {
363
+ return replaceLineItem(li, replaceTo);
364
+ }
365
+ return li;
366
+ }) });
367
+ };
368
+ const mapAttributes = (attributes) => {
369
+ return attributes.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: value })), {});
370
+ };
371
+ const getAttributes = (attributes, names = []) => {
372
+ const filtered = attributes.filter(({ name }) => names.includes(name));
373
+ return sortBy(filtered, [({ name }) => names.indexOf(name)]);
374
+ };
375
+ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
376
+ return attributesToUpsert.reduce((acc, { name, value }) => {
377
+ const [origAttr] = getAttributes(acc, [name]);
378
+ return [
379
+ ...acc.filter(attr => attr.name !== name),
380
+ Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name })), { cfgStatus: 'User', value }),
381
+ ];
382
+ }, originalAttributes);
383
+ };
384
+ const patchAttributes = (rootLineItem, id, attrs) => {
385
+ const lineItem = findLineItem(id, [rootLineItem]);
386
+ if (!lineItem) {
387
+ return rootLineItem;
388
+ }
389
+ const attributes = upsertAttributes(lineItem.attributes, attrs);
390
+ return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
391
+ };
392
+ const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
393
+ const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
394
+ return {
395
+ port,
396
+ type,
397
+ actionCode: 'ADD',
398
+ cfgStatus: 'New',
399
+ attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
400
+ lineItems,
401
+ parentId,
402
+ qty: 1,
403
+ };
404
+ };
405
+ const getRecommendedPrices = (portDomain, type) => {
406
+ var _a, _b;
407
+ const domainType = portDomain.domainTypes.find(({ name }) => name === type);
408
+ const [net, list] = (_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(({ chargeMethod }) => chargeMethod === 'ONE_TIME').reduce((acc, rp) => {
409
+ const [netPrice, listPrice] = acc;
410
+ return [netPrice + rp.netPrice, listPrice + rp.listPrice];
411
+ }, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0];
412
+ return { net, list };
413
+ };
414
+
415
+ var lineItem_utils = /*#__PURE__*/Object.freeze({
416
+ __proto__: null,
417
+ findLineItem: findLineItem,
418
+ findLineItemWithComparator: findLineItemWithComparator,
419
+ insertLineItem: insertLineItem,
420
+ removeLineItem: removeLineItem,
421
+ replaceLineItem: replaceLineItem,
422
+ mapAttributes: mapAttributes,
423
+ getAttributes: getAttributes,
424
+ upsertAttributes: upsertAttributes,
425
+ patchAttributes: patchAttributes,
426
+ getAttributeValue: getAttributeValue,
427
+ generateLineItem: generateLineItem,
428
+ getRecommendedPrices: getRecommendedPrices
429
+ });
430
+
431
+ class LineItemWorker {
432
+ constructor(src) {
433
+ this.li = Object.assign({}, src);
434
+ }
435
+ insert(parentId, toInsert) {
436
+ return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
437
+ }
438
+ remove(id) {
439
+ return new LineItemWorker(removeLineItem(this.li, id));
440
+ }
441
+ replace(toReplace) {
442
+ return new LineItemWorker(replaceLineItem(this.li, toReplace));
443
+ }
444
+ patchAttribute(attrs, id) {
445
+ return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
446
+ }
447
+ }
448
+
449
+ class ConfigurationService {
450
+ constructor(runtimeService, contextService, configurationApiService, messageService, dialogService) {
451
+ this.runtimeService = runtimeService;
452
+ this.contextService = contextService;
453
+ this.configurationApiService = configurationApiService;
454
+ this.messageService = messageService;
455
+ this.dialogService = dialogService;
456
+ this.mode = ConfigurationMode.SEARCH;
457
+ this.states = {};
458
+ this.lineItem = new BehaviorSubject(undefined);
459
+ this.charges = new BehaviorSubject({});
460
+ this.hasUnsavedChanges = false;
461
+ }
462
+ reset() {
463
+ this.hasUnsavedChanges = false;
464
+ this.runtimeService.reset();
465
+ this.states = {};
466
+ this.lineItem.next(undefined);
467
+ this.charges.next({});
468
+ }
469
+ patch$(lineItem) {
470
+ if (!this.lineItem.value) {
471
+ return throwError(() => new Error(`Source LineItem not found`));
472
+ }
473
+ this.states.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
474
+ this.states.asset = this.states.configurableRamp
475
+ ? this.runtimeService.getAsset(this.states.configurableRamp)
476
+ : undefined;
477
+ return this.configure().pipe(catchError$1(error => {
478
+ console.error(error);
479
+ if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
480
+ this.messageService.add({ severity: 'error', summary: error });
481
+ }
482
+ // bounce back if configuration call has failed
483
+ this.lineItem.next(this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined);
484
+ return throwError(() => error);
485
+ }), tap(() => {
486
+ if (!this.hasUnsavedChanges) {
487
+ this.hasUnsavedChanges = true;
488
+ }
489
+ }));
490
+ }
491
+ patch(lineItem) {
492
+ this.patch$(lineItem).subscribe();
493
+ }
494
+ updateCurrentStates(update) {
495
+ this.states = Object.assign(Object.assign({}, this.states), update);
496
+ }
497
+ get() {
498
+ return this.lineItem.asObservable().pipe(shareReplay());
499
+ }
500
+ getSnapshot() {
501
+ return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
502
+ }
503
+ getRuntimeModel() {
504
+ return this.runtimeService.runtimeModel;
505
+ }
506
+ getRuntimeContext() {
507
+ return this.runtimeService.runtimeContext;
508
+ }
509
+ get contextSnapshot() {
510
+ return this.contextService.resolve();
511
+ }
512
+ get context$() {
513
+ return this.contextService.resolve$();
514
+ }
515
+ get charges$() {
516
+ return this.charges.asObservable();
517
+ }
518
+ get chargesSnapshot() {
519
+ return this.charges.value;
520
+ }
521
+ configure() {
522
+ var _a, _b, _c, _d, _e;
523
+ const runtimeContext = this.getRuntimeContext();
524
+ const runtimeModel = this.getRuntimeModel();
525
+ if (!runtimeContext || !runtimeModel) {
526
+ return throwError(() => new Error('Runtime context/model not initialized'));
527
+ }
528
+ const 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 : {}));
529
+ const lineItem = (_d = this.states.configurableRamp) !== null && _d !== void 0 ? _d : getDefaultLineItem(runtimeContext, uiDefinitionProperties);
530
+ const configurationRequest = this.createRequest(lineItem);
531
+ configurationRequest.lineItems = this.states.currentState || [];
532
+ configurationRequest.asset = this.states.asset;
533
+ const mainPricingEnabled = (_e = runtimeContext.properties) === null || _e === void 0 ? void 0 : _e.PricingEnabled;
534
+ const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
535
+ return this.configurationApiService
536
+ .configureLineItem({ configurationRequest, runtimeModel, pricingEnabled })
537
+ .pipe(map(({ lineItem, context, charges, deletedLineItems }) => {
538
+ this.contextService.update(context !== null && context !== void 0 ? context : {});
539
+ this.charges.next(charges !== null && charges !== void 0 ? charges : {});
540
+ if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
541
+ this.showInactiveProductsConfirmation();
542
+ }
543
+ return lineItem;
544
+ }))
545
+ .pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError$1(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
546
+ }
547
+ createRequest(lineItem) {
548
+ return {
549
+ lineItem,
550
+ mode: this.mode,
551
+ step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
552
+ attributeDomainMode: 'ALL',
553
+ context: this.contextService.resolve(),
554
+ };
555
+ }
556
+ showInactiveProductsConfirmation() {
557
+ this.dialogService
558
+ .open(ConfirmationComponent, {
559
+ dismissableMask: false,
560
+ closeOnEscape: false,
561
+ closable: false,
562
+ showHeader: true,
563
+ header: `Inactive Products in Quote`,
564
+ width: '440px',
565
+ data: {
566
+ confirmationConfig: {
567
+ title: ' ',
568
+ description: 'This quote contains inactive products. Do you want to remove them?',
569
+ submitBtn: 'Remove products',
570
+ cancelBtn: 'Back to Quote',
571
+ },
572
+ },
573
+ })
574
+ .onClose.subscribe(result => {
575
+ if (!result) {
576
+ const context = this.contextService.resolve();
577
+ window['VELO_BACK_FN'].apply(null, [context.headerId]);
578
+ }
579
+ });
580
+ }
581
+ }
582
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, deps: [{ token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i2.MessageService }, { token: i5.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
583
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService });
584
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, decorators: [{
585
+ type: Injectable
586
+ }], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i2.MessageService }, { type: i5.DialogService }]; } });
587
+
588
+ class FlowUpdateService {
589
+ update(rootLineItems, updates) {
590
+ let remainingUpdates = [...updates];
591
+ let currentLevel = rootLineItems;
592
+ while (currentLevel.length && remainingUpdates.length) {
593
+ currentLevel.forEach(li => {
594
+ const unhandledUpdates = [];
595
+ remainingUpdates.forEach(update => {
596
+ let updated = false;
597
+ switch (update.dataType) {
598
+ case 'LINEITEM':
599
+ updated = this.applyLineItemUpdate(li, update);
600
+ break;
601
+ case 'CHARGE':
602
+ updated = this.applyChargeUpdate(li, update);
603
+ break;
604
+ case 'GROUP_CHARGE':
605
+ updated = this.applyChargeGroupUpdate(li, update);
606
+ break;
607
+ default:
608
+ // Unknown dataType. Do not try to handle it anymore
609
+ updated = true;
610
+ }
611
+ if (!updated) {
612
+ unhandledUpdates.push(update);
613
+ }
614
+ });
615
+ remainingUpdates = unhandledUpdates;
616
+ });
617
+ currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
618
+ }
619
+ }
620
+ delete(lineItems, id) {
621
+ const idsToRemove = [id];
622
+ const topLevelLineItem = lineItems.find(li => li.id === id);
623
+ if (topLevelLineItem) {
624
+ // find term-related line items (which are only top level)
625
+ // expired term line items won't be deleted
626
+ let foundTermLineItem = topLevelLineItem;
627
+ while (foundTermLineItem) {
628
+ foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
629
+ if (foundTermLineItem) {
630
+ idsToRemove.push(foundTermLineItem.id);
631
+ }
632
+ }
633
+ }
634
+ const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
635
+ return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
636
+ }
637
+ applyLineItemUpdate(lineItem, update) {
638
+ if (lineItem.id !== update.id) {
639
+ return false;
640
+ }
641
+ switch (update.attributeType) {
642
+ case 'QTY':
643
+ lineItem.qty = update.newValue;
644
+ break;
645
+ case 'EFFECTIVE_START_DATE':
646
+ lineItem.properties.StartDate = moment(update.newValue).format('YYYY-MM-DD');
647
+ break;
648
+ case 'END_DATE':
649
+ lineItem.properties.EndDate = moment(update.newValue).format('YYYY-MM-DD');
650
+ break;
651
+ case 'PRICE_ADJUSTMENT':
652
+ {
653
+ const [charge] = lineItem.chargeItems;
654
+ if (charge) {
655
+ charge.priceAdjustment = update.newValue;
656
+ }
657
+ }
658
+ break;
659
+ default:
660
+ throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
661
+ }
662
+ return true;
663
+ }
664
+ applyChargeUpdate(lineItem, update) {
665
+ const foundCharge = lineItem.chargeItems.find(({ id }) => id === update.id);
666
+ if (!foundCharge) {
667
+ return false;
668
+ }
669
+ if (update.attributeType === 'PRICE_ADJUSTMENT') {
670
+ foundCharge.priceAdjustment = update.newValue;
671
+ }
672
+ else {
673
+ throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
674
+ }
675
+ return true;
676
+ }
677
+ applyChargeGroupUpdate(lineItem, update) {
678
+ const foundChargeGroup = lineItem.chargeGroupItems.find(({ id }) => id === update.id);
679
+ if (!foundChargeGroup) {
680
+ return false;
681
+ }
682
+ if (update.attributeType === 'PRICE_ADJUSTMENT') {
683
+ foundChargeGroup.priceAdjustment = update.newValue;
684
+ }
685
+ else {
686
+ throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
687
+ }
688
+ return true;
689
+ }
690
+ }
691
+ FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
692
+ FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService });
693
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService, decorators: [{
694
+ type: Injectable
695
+ }] });
696
+
697
+ class FlowConfigurationService {
698
+ constructor(priceApiService, contextService, quoteDraftService, messageService, updateService) {
699
+ this.priceApiService = priceApiService;
700
+ this.contextService = contextService;
701
+ this.quoteDraftService = quoteDraftService;
702
+ this.messageService = messageService;
703
+ this.updateService = updateService;
704
+ this.charges = new BehaviorSubject({});
705
+ this.bounceBackUpdate$ = new BehaviorSubject(true);
706
+ }
707
+ reset() {
708
+ this.charges.next({});
709
+ }
710
+ initialize$() {
711
+ var _a;
712
+ (_a = this.resetSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
713
+ this.resetSubscription = this.quoteDraftService.reset$.subscribe(() => this.reset());
714
+ return this.calculate$(this.getSnapshot()).pipe(map$1(noop));
715
+ }
716
+ calculate$(currentState) {
717
+ const context = this.contextService.resolve();
718
+ return this.priceApiService.calculate({ context, currentState }).pipe(tap$1((result) => {
719
+ this.quoteDraftService.updateByPriceSummary(result);
720
+ this.charges.next(result.charges);
721
+ if (context) {
722
+ this.contextService.update({ properties: context.properties });
723
+ }
724
+ }), this.handleError());
725
+ }
726
+ calculate(currentState) {
727
+ this.calculate$(currentState).subscribe();
728
+ }
729
+ update$(updates) {
730
+ const lineItems = cloneDeep(this.getSnapshot());
731
+ return of([]).pipe(tap$1(() => this.updateService.update(lineItems, updates)), this.handleError(), switchMap(() => this.calculate$(lineItems)));
732
+ }
733
+ update(updates) {
734
+ this.update$(updates).subscribe();
735
+ }
736
+ delete$(ids) {
737
+ return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), this.getSnapshot())), this.handleError(), switchMap(currentState => this.calculate$(currentState)));
738
+ }
739
+ delete(ids) {
740
+ this.delete$(ids).subscribe();
741
+ }
742
+ get() {
743
+ return combineLatest([this.quoteDraftService.quote$, this.bounceBackUpdate$]).pipe(map$1(([quoteDraft]) => quoteDraft.currentState), shareReplay());
744
+ }
745
+ getSnapshot() {
746
+ var _a, _b;
747
+ return (_b = (_a = this.quoteDraftService.quoteSnapshot) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
748
+ }
749
+ get charges$() {
750
+ return this.charges.asObservable();
751
+ }
752
+ get chargesSnapshot() {
753
+ return this.charges.value;
754
+ }
755
+ get contextSnapshot() {
756
+ return this.contextService.resolve();
757
+ }
758
+ get context$() {
759
+ return this.contextService.resolve$();
760
+ }
761
+ handleError() {
762
+ return (source$) => {
763
+ return source$.pipe(catchError(error => {
764
+ console.error(error);
765
+ this.messageService.add({ severity: 'error', summary: error });
766
+ // bounce back if configuration call has failed
767
+ this.bounceBackUpdate$.next(true);
768
+ return throwError(() => error);
769
+ }));
770
+ };
771
+ }
772
+ }
773
+ FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.PriceApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: i2.MessageService }, { token: FlowUpdateService }], target: i0.ɵɵFactoryTarget.Injectable });
774
+ FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService });
775
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService, decorators: [{
776
+ type: Injectable
777
+ }], ctorParameters: function () { return [{ type: i1.PriceApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: i2.MessageService }, { type: FlowUpdateService }]; } });
778
+
779
+ class FlowConfigurationModule {
780
+ }
781
+ FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
782
+ FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule });
783
+ FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService], imports: [[]] });
784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, decorators: [{
785
+ type: NgModule,
786
+ args: [{
787
+ imports: [],
788
+ providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
789
+ }]
790
+ }] });
791
+
792
+ class ConfigurationModule {
793
+ }
794
+ ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
795
+ ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
796
+ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, providers: [
797
+ ContextApiService,
798
+ ProductModelApiService,
799
+ ConfigurationApiService,
800
+ ConfigurationRuntimeService,
801
+ RuntimeContextService,
802
+ ConfigurationService,
803
+ ], imports: [[ConfirmationDialogModule]] });
804
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, decorators: [{
805
+ type: NgModule,
806
+ args: [{
807
+ imports: [ConfirmationDialogModule],
808
+ providers: [
809
+ ContextApiService,
810
+ ProductModelApiService,
811
+ ConfigurationApiService,
812
+ ConfigurationRuntimeService,
813
+ RuntimeContextService,
814
+ ConfigurationService,
815
+ ],
816
+ }]
817
+ }] });
818
+
819
+ class SdkCoreModule {
820
+ }
821
+ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
822
+ SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
823
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, decorators: [{
825
+ type: NgModule,
826
+ args: [{
827
+ imports: [ConfigurationModule, FlowConfigurationModule],
828
+ providers: [ContextService, QuoteDraftService, ProductImagesService],
829
+ }]
830
+ }] });
831
+
832
+ /**
833
+ * Generated bundle index. Do not edit.
834
+ */
835
+
836
+ export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, findLineItem, findLineItemWithComparator, generateLineItem, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, patchAttributes, removeLineItem, replaceLineItem, upsertAttributes };
837
+ //# sourceMappingURL=veloce-sdk-core.js.map