@configuratorware/configurator-frontendgui 1.27.3-beta.1 → 1.27.3-beta.5

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 (458) hide show
  1. package/App/Constant.js +73 -0
  2. package/App/Error/DevelopmentErrorPage/index.js +74 -0
  3. package/App/Error/ErrorBoundary.js +98 -0
  4. package/App/Error/ProductionErrorPage/Style.scss +47 -0
  5. package/App/Error/ProductionErrorPage/index.js +43 -0
  6. package/App/Error/ProductionErrorPage/index.story.js +13 -0
  7. package/App/Error/ProductionErrorPage/res/error_gears.png +0 -0
  8. package/App/Frame.js +95 -0
  9. package/App/Modules/Creator/Components/ConfigurationvariantItem/Styles.scss +33 -0
  10. package/App/Modules/Creator/Components/ConfigurationvariantItem/index.js +118 -0
  11. package/App/Modules/Creator/Components/ConfigurationvariantSelection/Styles.scss +47 -0
  12. package/App/Modules/Creator/Components/ConfigurationvariantSelection/index.js +130 -0
  13. package/App/Modules/Creator/Components/CustomTitleEditor/Styles.scss +43 -0
  14. package/App/Modules/Creator/Components/CustomTitleEditor/index.js +144 -0
  15. package/App/Modules/Creator/Components/ExternalVisualization/index.js +140 -0
  16. package/App/Modules/Creator/Components/FastConfiguration/SelectableRow.js +128 -0
  17. package/App/Modules/Creator/Components/FastConfiguration/Styles.scss +53 -0
  18. package/App/Modules/Creator/Components/FastConfiguration/index.js +280 -0
  19. package/App/Modules/Creator/Components/FastConfigurationRow/Styles.scss +45 -0
  20. package/App/Modules/Creator/Components/FastConfigurationRow/index.js +78 -0
  21. package/App/Modules/Creator/Components/FastConfigurationSelect/Styles.scss +35 -0
  22. package/App/Modules/Creator/Components/FastConfigurationSelect/index.js +251 -0
  23. package/App/Modules/Creator/Components/FormattedNumber/index.js +45 -0
  24. package/App/Modules/Creator/Components/FormattedPrice/index.js +57 -0
  25. package/App/Modules/Creator/Components/FullScreenView/FullScreenView.js +104 -0
  26. package/App/Modules/Creator/Components/Incompatibility/OptionRule/index.js +182 -0
  27. package/App/Modules/Creator/Components/Incompatibility/RuleComponent.js +88 -0
  28. package/App/Modules/Creator/Components/Incompatibility/index.js +251 -0
  29. package/App/Modules/Creator/Components/InvalidConfigurationNotice/index.js +164 -0
  30. package/App/Modules/Creator/Components/LoginForm/Styles.scss +9 -0
  31. package/App/Modules/Creator/Components/LoginForm/index.js +129 -0
  32. package/App/Modules/Creator/Components/Option/index.js +545 -0
  33. package/App/Modules/Creator/Components/Option/index.story.js +154 -0
  34. package/App/Modules/Creator/Components/OptionAmount/index.js +236 -0
  35. package/App/Modules/Creator/Components/OptionGroup/index.js +55 -0
  36. package/App/Modules/Creator/Components/Optiondetail/ZoomImage/index.js +173 -0
  37. package/App/Modules/Creator/Components/Optiondetail/index.js +497 -0
  38. package/App/Modules/Creator/Components/Optiondetail/index.story.js +117 -0
  39. package/App/Modules/Creator/Components/OptionsList/index.js +193 -0
  40. package/App/Modules/Creator/Components/Price/Styles.scss +3 -0
  41. package/App/Modules/Creator/Components/Price/index.js +79 -0
  42. package/App/Modules/Creator/Components/ProductPart/index.js +185 -0
  43. package/App/Modules/Creator/Components/ProductPart/index.story.js +88 -0
  44. package/App/Modules/Creator/Components/ProductPartsList/index.js +150 -0
  45. package/App/Modules/Creator/Components/ProductPartsList/index.story.js +101 -0
  46. package/App/Modules/Creator/Components/SavedConfiguration/Styles.scss +19 -0
  47. package/App/Modules/Creator/Components/SavedConfiguration/index.js +82 -0
  48. package/App/Modules/Creator/Components/ShareConfiguration/Styles.scss +23 -0
  49. package/App/Modules/Creator/Components/ShareConfiguration/index.js +224 -0
  50. package/App/Modules/Creator/Components/StockInformation/index.js +93 -0
  51. package/App/Modules/Creator/Components/StoreConfigurationForm/Styles.scss +5 -0
  52. package/App/Modules/Creator/Components/StoreConfigurationForm/index.js +123 -0
  53. package/App/Modules/Creator/Components/Tools/Styles.scss +44 -0
  54. package/App/Modules/Creator/Components/Tools/index.js +102 -0
  55. package/App/Modules/Creator/Components/ValidationResult/Styles.scss +45 -0
  56. package/App/Modules/Creator/Components/ValidationResult/index.js +165 -0
  57. package/App/Modules/Creator/Components/index.js +84 -0
  58. package/App/Modules/Creator/Containers/AmountPrice/index.js +26 -0
  59. package/App/Modules/Creator/Containers/ConfigurationvariantSelection/index.js +60 -0
  60. package/App/Modules/Creator/Containers/CustomTitleEditor/index.js +52 -0
  61. package/App/Modules/Creator/Containers/FastConfiguration/index.js +62 -0
  62. package/App/Modules/Creator/Containers/FormattedPrice/index.js +31 -0
  63. package/App/Modules/Creator/Containers/Incompatibility/index.js +40 -0
  64. package/App/Modules/Creator/Containers/InvalidConfigurationNotice/index.js +89 -0
  65. package/App/Modules/Creator/Containers/LoadingOverlay/index.js +26 -0
  66. package/App/Modules/Creator/Containers/Optiondetail/index.js +48 -0
  67. package/App/Modules/Creator/Containers/OptionsList/index.js +49 -0
  68. package/App/Modules/Creator/Containers/ProductPart/index.js +26 -0
  69. package/App/Modules/Creator/Containers/ProductPartsList/index.js +49 -0
  70. package/App/Modules/Creator/Containers/SavedConfigurationContainer/index.js +25 -0
  71. package/App/Modules/Creator/Containers/ShareConfiguration/index.js +42 -0
  72. package/App/Modules/Creator/Containers/StockInformation/index.js +33 -0
  73. package/App/Modules/Creator/Containers/Tools/index.js +44 -0
  74. package/App/Modules/Creator/Containers/ValidationResult/index.js +34 -0
  75. package/App/Modules/Creator/Containers/index.js +175 -0
  76. package/App/Modules/Creator/CreatorScreen.js +307 -0
  77. package/App/Modules/Creator/Layouts/DefaultLayout.js +260 -0
  78. package/App/Modules/Creator/Styles.scss +216 -0
  79. package/App/Modules/Designer/Components/AddGalleryImage/index.js +234 -0
  80. package/App/Modules/Designer/Components/AddGalleryImage/index.story.js +94 -0
  81. package/App/Modules/Designer/Components/AddGalleryImage/index.test.js +151 -0
  82. package/App/Modules/Designer/Components/AddVisualElement/Styles.scss +0 -0
  83. package/App/Modules/Designer/Components/AddVisualElement/index.js +278 -0
  84. package/App/Modules/Designer/Components/AddVisualElement/index.story.js +24 -0
  85. package/App/Modules/Designer/Components/AddVisualElement/index.test.js +47 -0
  86. package/App/Modules/Designer/Components/CloseDesignEditor/index.js +130 -0
  87. package/App/Modules/Designer/Components/CloseGraphicsEditorButton/index.js +54 -0
  88. package/App/Modules/Designer/Components/ColorPalettes/ColorPalettesSearch.js +175 -0
  89. package/App/Modules/Designer/Components/ColorPalettes/index.js +814 -0
  90. package/App/Modules/Designer/Components/ColorPalettes/index.story.js +158 -0
  91. package/App/Modules/Designer/Components/ColorPalettes/index.test.js +150 -0
  92. package/App/Modules/Designer/Components/DesignAreaControlbox/Styles.scss +0 -0
  93. package/App/Modules/Designer/Components/DesignAreaControlbox/index.js +460 -0
  94. package/App/Modules/Designer/Components/DesignAreaControlbox/index.story.js +272 -0
  95. package/App/Modules/Designer/Components/DesignAreaControlbox/index.test.js +164 -0
  96. package/App/Modules/Designer/Components/DesignerSelectionToolbox/CustomFontOverlay.js +162 -0
  97. package/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +425 -0
  98. package/App/Modules/Designer/Components/DesignerSelectionToolbox/fontItemUtils.js +48 -0
  99. package/App/Modules/Designer/Components/Dialog/index.js +125 -0
  100. package/App/Modules/Designer/Components/EditDesignButton/index.js +128 -0
  101. package/App/Modules/Designer/Components/FeedbackNotice/index.js +110 -0
  102. package/App/Modules/Designer/Components/FeedbackNotice/index.test.js +16 -0
  103. package/App/Modules/Designer/Components/FullScreenView/FullScreenView.js +63 -0
  104. package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.dev.js +32 -0
  105. package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +430 -0
  106. package/App/Modules/Designer/Components/ImageColorize/index.js +636 -0
  107. package/App/Modules/Designer/Components/ImageColorize/index.story.js +73 -0
  108. package/App/Modules/Designer/Components/ImageControlbox/index.js +302 -0
  109. package/App/Modules/Designer/Components/ImageEditDialog/ImageThumbnail.js +171 -0
  110. package/App/Modules/Designer/Components/ImageEditDialog/ImageUpload.js +478 -0
  111. package/App/Modules/Designer/Components/ImageEditDialog/index.js +716 -0
  112. package/App/Modules/Designer/Components/ImageEditDialog/res/baseline_colorize_black_24dp.png +0 -0
  113. package/App/Modules/Designer/Components/ImageEditDialog/res/checkers_tile.png +0 -0
  114. package/App/Modules/Designer/Components/ImageLibraryFilter/index.js +179 -0
  115. package/App/Modules/Designer/Components/ImageLibraryThumbnail/Styles.scss +14 -0
  116. package/App/Modules/Designer/Components/ImageLibraryThumbnail/index.js +165 -0
  117. package/App/Modules/Designer/Components/ObjectTools/index.js +146 -0
  118. package/App/Modules/Designer/Components/Select/index.js +171 -0
  119. package/App/Modules/Designer/Components/TextControlbox/TextFormatIcon.js +48 -0
  120. package/App/Modules/Designer/Components/TextControlbox/index.js +656 -0
  121. package/App/Modules/Designer/Components/TextControlbox/index.story.js +109 -0
  122. package/App/Modules/Designer/Components/TextControlbox/index.test.js +172 -0
  123. package/App/Modules/Designer/Containers/AddGalleryImage.js +90 -0
  124. package/App/Modules/Designer/Containers/AddVisualElement.js +166 -0
  125. package/App/Modules/Designer/Containers/CloseDesignEditor.js +32 -0
  126. package/App/Modules/Designer/Containers/CloseGraphicsEditorButton.js +32 -0
  127. package/App/Modules/Designer/Containers/ColorPalettes.js +145 -0
  128. package/App/Modules/Designer/Containers/DesignAreaControlbox.js +54 -0
  129. package/App/Modules/Designer/Containers/Designer.js +37 -0
  130. package/App/Modules/Designer/Containers/DesignerSelectionToolbox.js +116 -0
  131. package/App/Modules/Designer/Containers/EditDesignButton.js +35 -0
  132. package/App/Modules/Designer/Containers/ImageEditDialog.js +1130 -0
  133. package/App/Modules/Designer/Designer.js +231 -0
  134. package/App/Modules/Designer/DesignerScreen.js +233 -0
  135. package/App/Modules/Designer/Layouts/DefaultLayout.js +196 -0
  136. package/App/Modules/Designer/Layouts/Mobile/TwoSideBottomBar.js +50 -0
  137. package/App/Modules/Designer/Layouts/PopupAreaProvider.js +186 -0
  138. package/App/Modules/Designer/Utils/FontFaceRepository.js +82 -0
  139. package/App/Modules/Designer/Utils/ImageEditUtils.js +104 -0
  140. package/App/Modules/Designer/Utils/Transformers.js +164 -0
  141. package/App/Modules/Designer/setupDesigner.js +182 -0
  142. package/App/Modules/Designer/withActiveCanvas.js +136 -0
  143. package/App/Modules/Visualization/AlignTargetContainer.js +55 -0
  144. package/App/Modules/Visualization/CreatorAlignTarget.js +41 -0
  145. package/App/Modules/Visualization/DefaultVisualizationProvider.js +105 -0
  146. package/App/Modules/Visualization/DesignerAlignTarget.js +45 -0
  147. package/App/Modules/Visualization/Utils/getFirstDataURLFromScreenshotsObj.js +20 -0
  148. package/App/Reducers/Actions.js +297 -0
  149. package/App/Reducers/ConfigurationMode/Actions.js +21 -0
  150. package/App/Reducers/ConfigurationMode/Reducer.js +80 -0
  151. package/App/Reducers/ConfigurationMode/Selectors.js +84 -0
  152. package/App/Reducers/Configurator/Actions.js +1417 -0
  153. package/App/Reducers/Configurator/AttributeSelectors.js +32 -0
  154. package/App/Reducers/Configurator/Modifiers.js +35 -0
  155. package/App/Reducers/Configurator/Reducer.js +639 -0
  156. package/App/Reducers/Configurator/Selectors.js +242 -0
  157. package/App/Reducers/Confirm/Actions.js +84 -0
  158. package/App/Reducers/Confirm/Reducer.js +30 -0
  159. package/App/Reducers/DesignArea/Actions.js +76 -0
  160. package/App/Reducers/DesignArea/DesignElementSelectors.js +114 -0
  161. package/App/Reducers/DesignArea/MaskSelectors.js +101 -0
  162. package/App/Reducers/DesignArea/Reducer.js +150 -0
  163. package/App/Reducers/DesignArea/Selectors.js +1314 -0
  164. package/App/Reducers/DesignArea/Transformers.js +333 -0
  165. package/App/Reducers/DesignData/Actions.js +232 -0
  166. package/App/Reducers/DesignData/Modifiers.js +328 -0
  167. package/App/Reducers/DesignData/Reducer.js +189 -0
  168. package/App/Reducers/DesignData/Selectors.js +94 -0
  169. package/App/Reducers/DesignData/Transformers.js +27 -0
  170. package/App/Reducers/DesignView/Actions.js +19 -0
  171. package/App/Reducers/DesignView/Reducer.js +165 -0
  172. package/App/Reducers/DesignView/Selectors.js +130 -0
  173. package/App/Reducers/DesignView/Transformers.js +32 -0
  174. package/App/Reducers/Device/Actions.js +16 -0
  175. package/App/Reducers/Device/Reducer.js +51 -0
  176. package/App/Reducers/Fonts/Actions.js +137 -0
  177. package/App/Reducers/Fonts/Reducer.js +39 -0
  178. package/App/Reducers/Fonts/Selectors.js +98 -0
  179. package/App/Reducers/GeneralActions.js +16 -0
  180. package/App/Reducers/ImageGallery/Actions.js +336 -0
  181. package/App/Reducers/ImageGallery/Modifiers.js +67 -0
  182. package/App/Reducers/ImageGallery/Reducer.js +320 -0
  183. package/App/Reducers/ImageGallery/Selectors.js +206 -0
  184. package/App/Reducers/Reducer.js +107 -0
  185. package/App/Reducers/UI/Actions.js +191 -0
  186. package/App/Reducers/UI/Reducer.js +98 -0
  187. package/App/Reducers/UI/Selectors.js +32 -0
  188. package/App/Reducers.js +48 -0
  189. package/App/Routing.js +168 -0
  190. package/App/Screens/Configurator/CalculationWidgetScreen.js +84 -0
  191. package/App/Screens/Configurator/Components/AmountSelection/Styles.scss +17 -0
  192. package/App/Screens/Configurator/Components/AmountSelection/index.js +170 -0
  193. package/App/Screens/Configurator/Components/AmountSelection/index.story.js +36 -0
  194. package/App/Screens/Configurator/Components/CalculationWidget/index.js +652 -0
  195. package/App/Screens/Configurator/Components/CalculationWidget/index.story.js +154 -0
  196. package/App/Screens/Configurator/Components/CalculationWidget/index.test.js +142 -0
  197. package/App/Screens/Configurator/Components/ConfigurationModeSwitch/ConfigurationModeSwitch.js +82 -0
  198. package/App/Screens/Configurator/Components/ConfigurationModeSwitch/index.js +15 -0
  199. package/App/Screens/Configurator/Components/Confirm/Styles.scss +0 -0
  200. package/App/Screens/Configurator/Components/Confirm/index.js +105 -0
  201. package/App/Screens/Configurator/Components/DesignApproval/index.js +76 -0
  202. package/App/Screens/Configurator/Components/DesignApproval/index.story.js +27 -0
  203. package/App/Screens/Configurator/Components/DesignApproval/index.test.js +31 -0
  204. package/App/Screens/Configurator/Components/Error/index.js +106 -0
  205. package/App/Screens/Configurator/Components/FallbackVisualization/FallbackVisualization.js +96 -0
  206. package/App/Screens/Configurator/Components/FileUpload/FileUploadBase.js +1 -0
  207. package/App/Screens/Configurator/Components/FullScreenView/index.js +303 -0
  208. package/App/Screens/Configurator/Components/FullScreenView/index.test.js +28 -0
  209. package/App/Screens/Configurator/Components/ImageLoader/ImageLoader.js +96 -0
  210. package/App/Screens/Configurator/Components/LandscapeInformation/index.js +75 -0
  211. package/App/Screens/Configurator/Components/NoVisualization/NoVisualization.js +35 -0
  212. package/App/Screens/Configurator/Components/PreviewPortal/index.js +246 -0
  213. package/App/Screens/Configurator/Components/Styles.scss +1 -0
  214. package/App/Screens/Configurator/Components/Thumbnail/index.js +394 -0
  215. package/App/Screens/Configurator/Components/Thumbnail/index.test.js +50 -0
  216. package/App/Screens/Configurator/Components/TotalPrice/TotalPrice.js +57 -0
  217. package/App/Screens/Configurator/Containers/AmountPrice.js +84 -0
  218. package/App/Screens/Configurator/Containers/CalculationWidget.js +278 -0
  219. package/App/Screens/Configurator/Containers/ConfigurationModeSwitch.js +81 -0
  220. package/App/Screens/Configurator/Containers/Confirm.js +37 -0
  221. package/App/Screens/Configurator/Containers/DesignApproval.js +129 -0
  222. package/App/Screens/Configurator/Containers/FallbackVisualization.js +32 -0
  223. package/App/Screens/Configurator/Containers/FullScreenView.js +46 -0
  224. package/App/Screens/Configurator/Containers/Thumbnail.js +41 -0
  225. package/App/Screens/Configurator/Containers/Visualization.js +13 -0
  226. package/App/Screens/Configurator/DesignerUI.js +215 -0
  227. package/App/Screens/Configurator/DynamicComponents.js +40 -0
  228. package/App/Screens/Configurator/Screen.js +236 -0
  229. package/App/Screens/Configurator/ScreenPropTypes.js +45 -0
  230. package/App/Screens/Configurator/ThemeProvider.js +298 -0
  231. package/App/Screens/DesignerProductPreview/Constants.js +12 -0
  232. package/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +554 -0
  233. package/App/Screens/DesignerProductPreview/Screen.js +407 -0
  234. package/App/Screens.js +42 -0
  235. package/App/ServiceLocator.js +309 -0
  236. package/App/Services/AdminareaCommunicationService.js +149 -0
  237. package/App/Services/AnalyticsService.js +403 -0
  238. package/App/Services/ConfiguratorService.js +1122 -0
  239. package/App/Services/DesignDataService.js +3249 -0
  240. package/App/Services/DesignerService.js +496 -0
  241. package/App/Services/InteractionService.js +782 -0
  242. package/App/Services/UIService.js +129 -0
  243. package/App/Services/VisualizationService.js +842 -0
  244. package/App/Shared/Components/AcceptDesign/index.js +166 -0
  245. package/App/Shared/Components/AddToBasket/index.js +194 -0
  246. package/App/Shared/Components/AddToBasket/index.story.js +47 -0
  247. package/App/Shared/Components/AlertDialog/index.js +138 -0
  248. package/App/Shared/Components/AmountInput/Styles.scss +6 -0
  249. package/App/Shared/Components/AmountInput/index.js +296 -0
  250. package/App/Shared/Components/AmountInput/index.story.js +29 -0
  251. package/App/Shared/Components/AmountPrice/index.js +925 -0
  252. package/App/Shared/Components/AmountPrice/index.story.js +112 -0
  253. package/App/Shared/Components/AmountPrice/index.test.js +125 -0
  254. package/App/Shared/Components/Analytics/AnalyticsWrapper.js +49 -0
  255. package/App/Shared/Components/BulkNames/index.js +319 -0
  256. package/App/Shared/Components/CallToAction/index.js +220 -0
  257. package/App/Shared/Components/Header/Header.js +150 -0
  258. package/App/Shared/Components/Header/index.js +15 -0
  259. package/App/Shared/Components/Header/index.story.js +143 -0
  260. package/App/Shared/Components/InformationTag/InformationTag.js +155 -0
  261. package/App/Shared/Components/LicenseNotice/LicenseNotice.js +148 -0
  262. package/App/Shared/Components/LicenseNotice/index.js +15 -0
  263. package/App/Shared/Components/LoadConfiguration/index.js +218 -0
  264. package/App/Shared/Components/MessageBox/index.js +84 -0
  265. package/App/Shared/Components/MessageBox/index.story.js +49 -0
  266. package/App/Shared/Components/Notification/index.js +105 -0
  267. package/App/Shared/Components/Notification/index.story.js +55 -0
  268. package/App/Shared/Components/PdfDownload/index.js +150 -0
  269. package/App/Shared/Components/PlusMinusInput/index.js +118 -0
  270. package/App/Shared/Components/PriceList/index.js +237 -0
  271. package/App/Shared/Components/PriceList/index.story.js +114 -0
  272. package/App/Shared/Components/PriceOverview/index.js +177 -0
  273. package/App/Shared/Components/PriceOverview/index.story.js +215 -0
  274. package/App/Shared/Components/ProductVariant/Image.js +75 -0
  275. package/App/Shared/Components/ProductVariant/Styles.scss +11 -0
  276. package/App/Shared/Components/ProductVariant/index.js +477 -0
  277. package/App/Shared/Components/ProductVariant/index.story.js +283 -0
  278. package/App/Shared/Components/Progress/Progress.js +59 -0
  279. package/App/Shared/Components/ReceiveOfferForm/index.js +432 -0
  280. package/App/Shared/Components/ReceiveOfferForm/index.story.js +32 -0
  281. package/App/Shared/Components/ReceiveOfferForm/index.test.js +36 -0
  282. package/App/Shared/Components/SaveConfiguration/index.js +286 -0
  283. package/App/Shared/Components/SendEmail/index.js +103 -0
  284. package/App/Shared/Components/Stepper/index.js +136 -0
  285. package/App/Shared/Components/Stepper/index.story.js +38 -0
  286. package/App/Shared/Components/ToolbarList/index.js +231 -0
  287. package/App/Shared/Components/ToolbarList/index.story.js +33 -0
  288. package/App/Shared/Components/VariantChooser/index.js +270 -0
  289. package/App/Shared/Components/VariantChooser/index.story.js +100 -0
  290. package/App/Shared/Containers/AlertMessages.js +37 -0
  291. package/App/Shared/Containers/AmountPrice/AmountPriceAdminareaWrapper.js +40 -0
  292. package/App/Shared/Containers/AmountPrice/index.js +284 -0
  293. package/App/Shared/Containers/BulkNames.js +310 -0
  294. package/App/Shared/Containers/Error.js +37 -0
  295. package/App/Shared/Containers/GlobalLoader.js +25 -0
  296. package/App/Shared/Containers/Header/index.js +178 -0
  297. package/App/Shared/Containers/LicenseNotice/LicenseNotice.js +26 -0
  298. package/App/Shared/Containers/LicenseNotice/index.js +15 -0
  299. package/App/Shared/Containers/LoadConfiguration/LoadConfiguration.js +146 -0
  300. package/App/Shared/Containers/LoadConfiguration/index.js +15 -0
  301. package/App/Shared/Containers/PdfDownload/index.js +39 -0
  302. package/App/Shared/Containers/ProductVariant/ProductVariant.js +339 -0
  303. package/App/Shared/Containers/ProductVariant/index.js +15 -0
  304. package/App/Shared/Containers/SaveConfiguration.js +49 -0
  305. package/App/Shared/Containers/SendEmail/SendEmail.js +45 -0
  306. package/App/Shared/Containers/SendEmail/index.js +15 -0
  307. package/App/Shared/Providers/DefaultCanvasProvider.js +86 -0
  308. package/App/Storage.js +17 -0
  309. package/App/Store.js +87 -0
  310. package/App/Styles.scss +0 -0
  311. package/App/Translations.js +88 -0
  312. package/App/Utils/createMessageInterface.js +52 -0
  313. package/App/Utils/customClassName.js +12 -0
  314. package/App/Utils/getContrastText.js +27 -0
  315. package/App/Utils/getImageUrl.js +32 -0
  316. package/App/Variables.scss +84 -0
  317. package/App/configuration.js +421 -0
  318. package/App/index.js +52 -0
  319. package/App/initServices.js +67 -0
  320. package/App/setup.js +22 -0
  321. package/App/versionInfo.js +8 -0
  322. package/Framework/Api.js +178 -0
  323. package/Framework/ComponentContainer.js +165 -0
  324. package/Framework/Components/Carousel/Styles.scss +85 -0
  325. package/Framework/Components/Carousel/index.js +322 -0
  326. package/Framework/Components/Dialog/Style.scss +79 -0
  327. package/Framework/Components/Dialog/index.js +721 -0
  328. package/Framework/Components/DialogSelect/Styles.scss +53 -0
  329. package/Framework/Components/DialogSelect/index.js +331 -0
  330. package/Framework/Components/Input/index.js +147 -0
  331. package/Framework/Components/LoadingOverlay/Styles.scss +37 -0
  332. package/Framework/Components/LoadingOverlay/index.js +33 -0
  333. package/Framework/Components/Markdown/index.js +62 -0
  334. package/Framework/Components/Mobile/index.js +33 -0
  335. package/Framework/CustomError.js +51 -0
  336. package/Framework/Helpers/TransitionDetect.js +116 -0
  337. package/Framework/Helpers/isLandscapeMobile.js +14 -0
  338. package/Framework/Helpers/isMobileDevice.js +17 -0
  339. package/Framework/Helpers/isMobileSize.js +13 -0
  340. package/Framework/Mixins.scss +235 -0
  341. package/Framework/Services/AbstractAdminareaCommunicationService.js +48 -0
  342. package/Framework/Services/AbstractAsyncService.js +44 -0
  343. package/Framework/Services/AbstractConfiguratorService.js +47 -0
  344. package/Framework/Services/AbstractInteractionService.js +50 -0
  345. package/Framework/Services/AbstractStoreService.js +42 -0
  346. package/Framework/Services/AbstractUIService.js +53 -0
  347. package/Framework/Services/AbstractVisualizationService.js +47 -0
  348. package/Framework/Services/AsyncService.js +93 -0
  349. package/Framework/Services/StoreService.js +237 -0
  350. package/Framework/Variables.scss +22 -0
  351. package/Framework/bindDecorator.js +173 -0
  352. package/Framework/i18n.js +383 -0
  353. package/README.md +5 -26
  354. package/Resources/Icons/MaterialUI/Icons/AddCircle.js +13 -0
  355. package/Resources/Icons/MaterialUI/Icons/RemoveCircle.js +13 -0
  356. package/Resources/Icons/MaterialUI/fontFace.scss +37 -0
  357. package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.eot +0 -0
  358. package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.svg +2373 -0
  359. package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.ttf +0 -0
  360. package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.woff +0 -0
  361. package/Resources/Icons/MaterialUI/fonts/MaterialIcons-Regular.woff2 +0 -0
  362. package/Resources/Icons/fonts/ionicons.eot +0 -0
  363. package/Resources/Icons/fonts/ionicons.svg +2230 -0
  364. package/Resources/Icons/fonts/ionicons.ttf +0 -0
  365. package/Resources/Icons/fonts/ionicons.woff +0 -0
  366. package/Resources/Icons/ionicons.scss +1489 -0
  367. package/Resources/Icons/ioniconsExtend.scss +1469 -0
  368. package/Resources/Icons/v4/fontFace.scss +11 -0
  369. package/Resources/Icons/v4/fonts/ionicons.eot +0 -0
  370. package/Resources/Icons/v4/fonts/ionicons.svg +2090 -0
  371. package/Resources/Icons/v4/fonts/ionicons.ttf +0 -0
  372. package/Resources/Icons/v4/fonts/ionicons.woff +0 -0
  373. package/Resources/Icons/v4/fonts/ionicons.woff2 +0 -0
  374. package/Resources/Icons/v4/icons.scss +15 -0
  375. package/Resources/Icons/v4/iconsExtend.scss +7 -0
  376. package/Resources/Images/designer_placeholder_logo.svg +1 -0
  377. package/Resources/Masks/circle.svg +4 -0
  378. package/Shared/Components/CustomDialog.js +132 -0
  379. package/Shared/Components/CustomDialogSelect.js +161 -0
  380. package/Shared/Components/MainButton.js +81 -0
  381. package/Shared/ErrorTypes/DeferredError.js +51 -0
  382. package/Shared/HOCs/ResizeDetect/ResizeDetect.dev.js +60 -0
  383. package/Shared/HOCs/ResizeDetect/ResizeDetect.js +217 -0
  384. package/Shared/HOCs/getDisplayName.js +10 -0
  385. package/Shared/HOCs/withFixedChangeHandler.js +46 -0
  386. package/Shared/PropTypes/ReactComponent.js +13 -0
  387. package/Shared/Styles/absoluteCenter.js +17 -0
  388. package/Utils/Array/isIdentical.js +38 -0
  389. package/Utils/Async/AsyncManager.js +128 -0
  390. package/Utils/Async/Deferred.js +146 -0
  391. package/Utils/Async/ObjectLock.js +38 -0
  392. package/Utils/Decorators/Observable.js +130 -0
  393. package/Utils/Dev/HOCs/withFilePicker.js +101 -0
  394. package/Utils/Dev/isDev.js +21 -0
  395. package/Utils/Events/pointerEvent.js +199 -0
  396. package/Utils/Events/preventEventDoubling.js +23 -0
  397. package/Utils/Function/cached.js +64 -0
  398. package/Utils/Function/createDebounceManager.js +77 -0
  399. package/Utils/Function/createSelector.js +62 -0
  400. package/Utils/Function/memoize.js +46 -0
  401. package/Utils/Function/sendMessage.js +22 -0
  402. package/Utils/Helper/createSelectionRangeMemo.js +45 -0
  403. package/Utils/Immutable/set.js +81 -0
  404. package/Utils/Math/conversions.js +13 -0
  405. package/Utils/Math/isPositiveNumber.js +12 -0
  406. package/Utils/Redux/createActionWithGlobalState.js +23 -0
  407. package/Utils/Styles/combineMediaQueries.js +24 -0
  408. package/Utils/Styles/createCheckerBoardBackground.js +22 -0
  409. package/Utils/Test/CallOrderChecker.js +29 -0
  410. package/Utils/Test/createStoreProvider.js +33 -0
  411. package/Utils/Test/formDataToJSON.js +20 -0
  412. package/Utils/Test/mountWithState.js +40 -0
  413. package/index.js +8 -0
  414. package/package.json +20 -102
  415. package/scripts/cpPublic.js +3 -3
  416. package/scripts/getDefaultWebpackConfig.js +11 -10
  417. package/src/App/Error/ProductionErrorPage/Style.scss +1 -1
  418. package/src/App/Modules/Creator/Components/Option/index.js +1 -0
  419. package/src/App/Modules/Creator/Components/Option/index.test.js +1 -1
  420. package/src/App/Modules/Creator/Components/OptionAmount/index.test.js +1 -1
  421. package/src/App/Modules/Creator/Components/ProductPart/index.js +1 -0
  422. package/src/App/Modules/Creator/Components/ProductPart/index.test.js +1 -1
  423. package/src/App/Modules/Designer/Components/AddGalleryImage/index.story.js +1 -1
  424. package/src/App/Modules/Designer/Components/ColorPalettes/index.test.jsx +1 -1
  425. package/src/App/Modules/Designer/Components/DesignAreaControlbox/index.test.jsx +1 -1
  426. package/src/App/Modules/Designer/Components/TextControlbox/index.test.jsx +1 -1
  427. package/src/App/Reducers/Configurator/Actions.js +13 -3
  428. package/src/App/Reducers/DesignArea/Selectors.js +9 -7
  429. package/src/App/Reducers/DesignView/Actions.js +1 -2
  430. package/src/App/Reducers/DesignView/Reducer.js +2 -10
  431. package/src/App/Reducers/DesignView/__mocks__/designerViewData.js +0 -1
  432. package/src/App/Reducers/DesignView/__tests__/Reducer.test.js +0 -22
  433. package/src/App/Reducers/ImageGallery/Actions.js +1 -1
  434. package/src/App/Reducers/UI/Actions.js +8 -0
  435. package/src/App/Reducers/UI/Reducer.js +3 -1
  436. package/src/App/Screens/Configurator/Components/CalculationWidget/index.test.jsx +1 -1
  437. package/src/App/Screens/Configurator/Components/DesignApproval/index.test.jsx +1 -1
  438. package/src/App/Screens/Configurator/Components/FullScreenView/index.test.jsx +1 -1
  439. package/src/App/Screens/Configurator/Containers/AmountPrice.js +1 -1
  440. package/src/App/Screens/Configurator/Containers/Confirm.js +1 -1
  441. package/src/App/Screens/Configurator/Screen.js +1 -1
  442. package/src/App/Screens/Configurator/ThemeProvider.js +1 -0
  443. package/src/App/Services/__tests__/DesignDataService.selectViewForComponent.test.js +0 -53
  444. package/src/App/Shared/Containers/AlertMessages.js +1 -1
  445. package/src/App/Shared/Containers/AmountPrice/index.test.js +1 -1
  446. package/src/App/Shared/Containers/Error.js +1 -1
  447. package/src/App/Shared/Containers/SaveConfiguration.js +1 -1
  448. package/src/App/Translations.js +1 -1
  449. package/src/Framework/Components/Carousel/index.js +29 -8
  450. package/src/Framework/i18n.js +2 -3
  451. package/babel.config.js +0 -46
  452. package/public/ConfigurationMessagingDemo.html +0 -55
  453. package/scripts/cpPath.js +0 -135
  454. package/scripts/moveLibToPackageRoot.js +0 -40
  455. package/scripts/rmDir.js +0 -29
  456. package/scripts/updateLocalPackages.js +0 -68
  457. package/scripts/utils/process.js +0 -19
  458. package/tsconfig.json +0 -22
@@ -0,0 +1,1122 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _get = _interopRequireDefault(require("lodash/get"));
9
+
10
+ var _has = _interopRequireDefault(require("lodash/has"));
11
+
12
+ var _find = _interopRequireDefault(require("lodash/find"));
13
+
14
+ var _map = _interopRequireDefault(require("lodash/map"));
15
+
16
+ var _keys2 = _interopRequireDefault(require("lodash/keys"));
17
+
18
+ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
19
+
20
+ var _difference = _interopRequireDefault(require("lodash/difference"));
21
+
22
+ var _omit = _interopRequireDefault(require("lodash/omit"));
23
+
24
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
25
+
26
+ var _AbstractConfiguratorService = _interopRequireDefault(require("../../Framework/Services/AbstractConfiguratorService"));
27
+
28
+ var configuratorActions = _interopRequireWildcard(require("../Reducers/Configurator/Actions"));
29
+
30
+ var _Selectors = require("../Reducers/Configurator/Selectors");
31
+
32
+ var _Selectors2 = require("../Reducers/DesignArea/Selectors");
33
+
34
+ var _Actions2 = require("../Reducers/UI/Actions");
35
+
36
+ var _Selectors3 = require("../Reducers/Fonts/Selectors");
37
+
38
+ var _ServiceLocator = require("../ServiceLocator");
39
+
40
+ var _configuration2 = require("../configuration");
41
+
42
+ var _Reducer = require("../Reducers/DesignData/Reducer");
43
+
44
+ var _cached = require("../../Utils/Function/cached");
45
+
46
+ var _getFirstDataURLFromScreenshotsObj = require("../Modules/Visualization/Utils/getFirstDataURLFromScreenshotsObj");
47
+
48
+ var _Selectors4 = require("../Reducers/DesignData/Selectors");
49
+
50
+ var _createMessageInterface = _interopRequireDefault(require("../Utils/createMessageInterface"));
51
+
52
+ var _excluded = ["code"];
53
+
54
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
55
+
56
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
57
+
58
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
59
+
60
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
61
+
62
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
63
+
64
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
65
+
66
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
67
+
68
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
69
+
70
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
71
+
72
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
73
+
74
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
75
+
76
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
77
+
78
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
79
+
80
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
81
+
82
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
83
+
84
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
85
+
86
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
87
+
88
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
89
+
90
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
91
+
92
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
93
+
94
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
95
+
96
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
97
+
98
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
99
+
100
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
101
+
102
+ var getSelectedAmountsBySizes = function getSelectedAmountsBySizes(item, selectedAmounts) {
103
+ var itemGroupMap = function itemGroupMap(rootItem, fn) {
104
+ var data = [];
105
+
106
+ if ((0, _get["default"])(rootItem, 'itemGroup.children.length', 0) > 0) {
107
+ var _iterator = _createForOfIteratorHelper(rootItem.itemGroup.children),
108
+ _step;
109
+
110
+ try {
111
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
112
+ var _item = _step.value;
113
+ var mappedData = fn(_item, data);
114
+ mappedData && data.push(mappedData);
115
+ }
116
+ } catch (err) {
117
+ _iterator.e(err);
118
+ } finally {
119
+ _iterator.f();
120
+ }
121
+ }
122
+
123
+ return data;
124
+ };
125
+
126
+ return itemGroupMap(item, function (colorGroupItem) {
127
+ return {
128
+ identifier: colorGroupItem.identifier,
129
+ amount: (0, _get["default"])(selectedAmounts, colorGroupItem.identifier, 0),
130
+ sizes: itemGroupMap(colorGroupItem, function (sizeGroupItem) {
131
+ return {
132
+ amount: (0, _get["default"])(selectedAmounts, sizeGroupItem.identifier, 0),
133
+ identifier: sizeGroupItem.identifier
134
+ };
135
+ })
136
+ };
137
+ });
138
+ };
139
+
140
+ var ConfiguratorService = /*#__PURE__*/function (_AbstractConfigurator) {
141
+ _inherits(ConfiguratorService, _AbstractConfigurator);
142
+
143
+ var _super = _createSuper(ConfiguratorService);
144
+
145
+ function ConfiguratorService() {
146
+ var _this;
147
+
148
+ _classCallCheck(this, ConfiguratorService);
149
+
150
+ _this = _super.call(this);
151
+
152
+ _ServiceLocator.Services.store.observeStore(function (state) {
153
+ return state.configurator.configuration;
154
+ }, function () {
155
+ // since it's debounced, the prevConfiguration should be the configuration from the latest call
156
+ var prevConfiguration = {};
157
+ return (0, _debounce["default"])(function (configuration) {
158
+ _this.onConfigurationChange(configuration, prevConfiguration);
159
+
160
+ prevConfiguration = configuration;
161
+ }, 300);
162
+ }());
163
+
164
+ return _this;
165
+ }
166
+
167
+ _createClass(ConfiguratorService, [{
168
+ key: "init",
169
+ value: function init() {
170
+ var adminMode = (0, _configuration2.getConf)('adminMode');
171
+
172
+ if (!adminMode) {
173
+ var messageInterface = (0, _createMessageInterface["default"])();
174
+ messageInterface.addListener('switch_options', /*#__PURE__*/function () {
175
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(event) {
176
+ var optionsJSON, optionsToSelect;
177
+ return regeneratorRuntime.wrap(function _callee$(_context) {
178
+ while (1) {
179
+ switch (_context.prev = _context.next) {
180
+ case 0:
181
+ optionsJSON = (0, _get["default"])(event, 'data.options');
182
+
183
+ try {
184
+ optionsToSelect = JSON.parse(optionsJSON);
185
+
186
+ _ServiceLocator.Services.store.dispatch((0, configuratorActions.selectMultipleOptions)(optionsToSelect));
187
+ } catch (e) {
188
+ // eslint-disable-next-line no-console
189
+ console.error('Wrong JSON provided for switch_options:', optionsJSON);
190
+ }
191
+
192
+ case 2:
193
+ case "end":
194
+ return _context.stop();
195
+ }
196
+ }
197
+ }, _callee);
198
+ }));
199
+
200
+ return function (_x) {
201
+ return _ref.apply(this, arguments);
202
+ };
203
+ }());
204
+ }
205
+ } // state selector
206
+
207
+ }, {
208
+ key: "state",
209
+ get: function get() {
210
+ return _ServiceLocator.Services.store.state.configurator;
211
+ }
212
+ }, {
213
+ key: "initialize",
214
+ value: function initialize() {
215
+ var params = {};
216
+ var basePath = (0, _configuration2.getConf)('routingBasePath', '/');
217
+ var itemRegex = new RegExp("".concat(basePath, "(code|identifier):([^/]+)"));
218
+ var results = itemRegex.exec(location.pathname);
219
+
220
+ if (results) {
221
+ params[results[1]] = results[2];
222
+ }
223
+
224
+ if (params.identifier) {
225
+ this.setLoadIdentifier(params.identifier);
226
+ } else if (params.code) {
227
+ this.setLoadCode(params.code);
228
+ }
229
+
230
+ this.loadClientData();
231
+ }
232
+ }, {
233
+ key: "prepareConfigurationForSave",
234
+ value: function prepareConfigurationForSave() {
235
+ var overwrite = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
236
+ var extraData = arguments.length > 1 ? arguments[1] : undefined;
237
+ var configuration = this.state.configuration;
238
+
239
+ var updatedConfiguration = _ServiceLocator.Services.designData.removeAllDesignAreaPlaceholders(configuration); // remove the code by default (to prevent overwriting the current configuration)
240
+
241
+
242
+ var code = updatedConfiguration.code,
243
+ otherData = _objectWithoutProperties(updatedConfiguration, _excluded); // always remove parentCode from customdata
244
+
245
+
246
+ var customdata = (0, _omit["default"])(updatedConfiguration.customdata || {}, ['parentCode']); // add parentCode only when it's set in the config
247
+
248
+ if ((0, _configuration2.getConf)('addParentCodeOnSave')) {
249
+ customdata.parentCode = code;
250
+ }
251
+
252
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, otherData), overwrite ? {
253
+ code: code
254
+ } : {}), extraData), {}, {
255
+ customdata: customdata
256
+ });
257
+ }
258
+ }, {
259
+ key: "setCalculationAutoResolveEnabled",
260
+ value: function setCalculationAutoResolveEnabled(enabled) {
261
+ _ServiceLocator.Services.store.dispatch((0, configuratorActions.setCalculationAutoResolveEnabled)(enabled));
262
+ }
263
+ }, {
264
+ key: "skipNextCalculationAutoResolve",
265
+ value: function skipNextCalculationAutoResolve() {
266
+ _ServiceLocator.Services.store.dispatch((0, configuratorActions.skipNextAutoResolve)());
267
+ }
268
+ }, {
269
+ key: "onConfigurationChange",
270
+ value: function () {
271
+ var _onConfigurationChange = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(configuration, prevConfiguration) {
272
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
273
+ while (1) {
274
+ switch (_context2.prev = _context2.next) {
275
+ case 0:
276
+ if (!(this.state.calculationIsEnabled && (!configuration.check_results || // no check results
277
+ configuration.check_results.status) && // or the check result status is ok
278
+ this.shouldInvalidateCalculation(prevConfiguration, configuration))) {
279
+ _context2.next = 11;
280
+ break;
281
+ }
282
+
283
+ if (!(0, _Selectors.isCalculationAutoResolveEnabled)(this.state)) {
284
+ _context2.next = 9;
285
+ break;
286
+ }
287
+
288
+ // disable automatic price updates to take direct control over error handling
289
+ _ServiceLocator.Services.store.dispatch((0, configuratorActions.setCalculationEnabled)(false)); // triggering the calculation directly to make sure it's synced
290
+
291
+
292
+ _context2.next = 5;
293
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.doCalculation());
294
+
295
+ case 5:
296
+ _ServiceLocator.Services.store.dispatch((0, configuratorActions.setCalculationEnabled)(true));
297
+
298
+ _ServiceLocator.Services.configurator.resolveCalculationErrors();
299
+
300
+ _context2.next = 11;
301
+ break;
302
+
303
+ case 9:
304
+ _ServiceLocator.Services.store.dispatch(configuratorActions.invalidateCalculation());
305
+
306
+ _ServiceLocator.Services.store.dispatch(configuratorActions.doCalculation());
307
+
308
+ case 11:
309
+ if (this.shouldUpdateVisualization(prevConfiguration, configuration)) {
310
+ _ServiceLocator.Services.visualization.update(configuration);
311
+ }
312
+
313
+ case 12:
314
+ case "end":
315
+ return _context2.stop();
316
+ }
317
+ }
318
+ }, _callee2, this);
319
+ }));
320
+
321
+ function onConfigurationChange(_x2, _x3) {
322
+ return _onConfigurationChange.apply(this, arguments);
323
+ }
324
+
325
+ return onConfigurationChange;
326
+ }()
327
+ }, {
328
+ key: "shouldInvalidateCalculation",
329
+ value: function shouldInvalidateCalculation(prevConfiguration, configuration) {
330
+ return this.isRoughEqual(configuration, prevConfiguration);
331
+ }
332
+ }, {
333
+ key: "shouldUpdateVisualization",
334
+ value: function shouldUpdateVisualization(prevConfiguration, configuration) {
335
+ return this.isRoughEqual(configuration, prevConfiguration);
336
+ }
337
+ }, {
338
+ key: "isRoughEqual",
339
+ value: function isRoughEqual(configuration, prevConfiguration) {
340
+ // calculation should be invalidated only when one of the relevant properties has changed
341
+ var pc = this.getRoughConfiguration(prevConfiguration);
342
+ var cc = this.getRoughConfiguration(configuration);
343
+ return !(0, _isEqual["default"])(cc, pc);
344
+ }
345
+ /**
346
+ * Returns the configuration core values
347
+ * Use this method to create a more simple comparable object that represents the same
348
+ * configuration
349
+ * @param configuration
350
+ * @returns {{item: {identifier: *, price: *}, optionclassifications: Array, designdata: {}, customdata: {}}}
351
+ */
352
+
353
+ }, {
354
+ key: "getRoughConfiguration",
355
+ value: function getRoughConfiguration(configuration) {
356
+ var item = configuration.item,
357
+ optionclassifications = configuration.optionclassifications,
358
+ designdata = configuration.designdata;
359
+ var customdata = configuration.customdata && (0, _omit["default"])(configuration.customdata, ['comment']);
360
+ return {
361
+ item: item && {
362
+ identifier: item.identifier,
363
+ price: item.price
364
+ },
365
+ optionclassifications: optionclassifications && (0, _map["default"])(optionclassifications, function (oc) {
366
+ return {
367
+ identifier: oc.identifier,
368
+ selectedoptions: (0, _map["default"])(oc.selectedoptions, function (o) {
369
+ return {
370
+ identifier: o.identifier,
371
+ amount: o.amount,
372
+ price: o.price
373
+ };
374
+ })
375
+ };
376
+ }),
377
+ designdata: designdata && this.getRoughDesignData(designdata),
378
+ customdata: customdata
379
+ };
380
+ }
381
+ /**
382
+ * The design data can also invalidate the calculation if any of the relevant properties have changed.
383
+ * (Eg. an object is added or removed, or a design area related option has changed.)
384
+ * @param designData
385
+ * @returns {null|object}
386
+ */
387
+
388
+ }, {
389
+ key: "getRoughDesignData",
390
+ value: function getRoughDesignData(designData) {
391
+ if (!designData) {
392
+ return null;
393
+ }
394
+
395
+ var designAreas = Object.keys(designData);
396
+ var roughDesignData = {};
397
+
398
+ for (var _i = 0, _designAreas = designAreas; _i < _designAreas.length; _i++) {
399
+ var designAreaIdentifier = _designAreas[_i];
400
+ var designAreaData = designData[designAreaIdentifier];
401
+ var canvasData = designAreaData.canvasData,
402
+ designProductionMethodIdentifier = designAreaData.designProductionMethodIdentifier,
403
+ colorAmount = designAreaData.colorAmount;
404
+ roughDesignData[designAreaIdentifier] = {
405
+ objectCount: (0, _get["default"])(canvasData, 'objects.length'),
406
+ designProductionMethodIdentifier: designProductionMethodIdentifier,
407
+ colorAmount: colorAmount
408
+ };
409
+ }
410
+
411
+ return roughDesignData;
412
+ } //// <-- ACTIONS -->
413
+
414
+ }, {
415
+ key: "saveConfiguration",
416
+ value: function () {
417
+ var _saveConfiguration = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(configuration, configurationtype) {
418
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
419
+ while (1) {
420
+ switch (_context3.prev = _context3.next) {
421
+ case 0:
422
+ return _context3.abrupt("return", _ServiceLocator.Services.store.dispatch(configuratorActions.saveConfiguration(configuration, configurationtype)));
423
+
424
+ case 1:
425
+ case "end":
426
+ return _context3.stop();
427
+ }
428
+ }
429
+ }, _callee3);
430
+ }));
431
+
432
+ function saveConfiguration(_x4, _x5) {
433
+ return _saveConfiguration.apply(this, arguments);
434
+ }
435
+
436
+ return saveConfiguration;
437
+ }()
438
+ }, {
439
+ key: "getPreviewImagesForVariants",
440
+ value: function () {
441
+ var _getPreviewImagesForVariants = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
442
+ var options,
443
+ _options$size,
444
+ size,
445
+ designData,
446
+ configurationOptions,
447
+ cached,
448
+ memo,
449
+ designAreas,
450
+ defaultDesignAreaIdentifier,
451
+ areasWithDesign,
452
+ screenshotAreaIdentifier,
453
+ screenshotArea,
454
+ usedAreas,
455
+ firstDesignViewIdentifier,
456
+ usedViews,
457
+ variants,
458
+ screenshots,
459
+ images,
460
+ _args4 = arguments;
461
+
462
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
463
+ while (1) {
464
+ switch (_context4.prev = _context4.next) {
465
+ case 0:
466
+ options = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
467
+
468
+ _ServiceLocator.Services.designData.closeDesignAreaEditor();
469
+
470
+ _ServiceLocator.Services.designData.clearDesignAreaSelection();
471
+
472
+ _options$size = options.size, size = _options$size === void 0 ? {
473
+ width: 100,
474
+ height: 100
475
+ } : _options$size;
476
+ designData = (0, _Reducer.getDesignData)(this.state);
477
+ configurationOptions = (0, _Selectors.getConfiguration)(this.state).optionclassifications;
478
+ cached = (0, _cached.getCached)('variantPreviewImages', designData, configurationOptions);
479
+
480
+ if (!cached.validate()) {
481
+ _context4.next = 9;
482
+ break;
483
+ }
484
+
485
+ return _context4.abrupt("return", cached.getValue());
486
+
487
+ case 9:
488
+ memo = _ServiceLocator.Services.designData.createHighlightMemo(false);
489
+ designAreas = _ServiceLocator.Services.store.state.designArea.filteredDesignAreas; // use the first area as default if it's not defined through the production methods
490
+
491
+ defaultDesignAreaIdentifier = (0, _Selectors2.getDefaultDesignAreaIdentifierFromProductionMethod)(_ServiceLocator.Services.store.state) || (designAreas.length ? designAreas[0].identifier : null);
492
+ areasWithDesign = designData && Object.keys(designData).filter(function (designAreaIdentifier) {
493
+ return (0, _get["default"])(designData[designAreaIdentifier], 'canvasData.objects.length');
494
+ }); // use the default design area, or the first that contains a design
495
+
496
+ screenshotAreaIdentifier = areasWithDesign && (areasWithDesign.indexOf(defaultDesignAreaIdentifier) !== -1 ? defaultDesignAreaIdentifier : areasWithDesign[0]) || defaultDesignAreaIdentifier;
497
+ screenshotArea = (0, _find["default"])(designAreas, {
498
+ identifier: screenshotAreaIdentifier
499
+ });
500
+ usedAreas = screenshotAreaIdentifier && [screenshotAreaIdentifier];
501
+ firstDesignViewIdentifier = (0, _get["default"])(_ServiceLocator.Services.store.state.designView, 'designViews[0].identifier');
502
+ usedViews = [screenshotArea ? screenshotArea.designView.identifier : firstDesignViewIdentifier];
503
+ variants = (0, _Selectors.getChildren)(this.state).map(function (_ref2) {
504
+ var identifier = _ref2.identifier;
505
+ return identifier;
506
+ });
507
+
508
+ if (!variants[0]) {
509
+ variants = [(0, _Selectors.getItem)(this.state).identifier];
510
+ }
511
+
512
+ _context4.prev = 20;
513
+ _context4.next = 23;
514
+ return _ServiceLocator.Services.visualization.getScreenshots({
515
+ areaList: usedAreas,
516
+ viewList: usedViews,
517
+ variantList: variants,
518
+ size: size
519
+ });
520
+
521
+ case 23:
522
+ screenshots = _context4.sent;
523
+
524
+ if (screenshots) {
525
+ _context4.next = 26;
526
+ break;
527
+ }
528
+
529
+ return _context4.abrupt("return", {});
530
+
531
+ case 26:
532
+ images = {};
533
+ Object.keys(screenshots).forEach(function (identifier) {
534
+ images[variants.length === 1 ? variants[0] : identifier] = (0, _getFirstDataURLFromScreenshotsObj.getFirstDataURLFromScreenshotsObj)(screenshots[identifier]);
535
+ });
536
+ cached.setValue(images);
537
+ return _context4.abrupt("return", images);
538
+
539
+ case 32:
540
+ _context4.prev = 32;
541
+ _context4.t0 = _context4["catch"](20);
542
+ // eslint-disable-next-line no-console
543
+ console.error('Error occurred while generating preview images:', _context4.t0);
544
+
545
+ case 35:
546
+ _context4.prev = 35;
547
+ memo.restore();
548
+ return _context4.finish(35);
549
+
550
+ case 38:
551
+ case "end":
552
+ return _context4.stop();
553
+ }
554
+ }
555
+ }, _callee4, this, [[20, 32, 35, 38]]);
556
+ }));
557
+
558
+ function getPreviewImagesForVariants() {
559
+ return _getPreviewImagesForVariants.apply(this, arguments);
560
+ }
561
+
562
+ return getPreviewImagesForVariants;
563
+ }()
564
+ }, {
565
+ key: "togglePlaceholders",
566
+ value: function togglePlaceholders(show) {
567
+ var _this2 = this;
568
+
569
+ var canvases = _ServiceLocator.Services.designData.getDesignAreaCanvases();
570
+
571
+ canvases.forEach(function (_ref3) {
572
+ var canvas = _ref3.canvas;
573
+
574
+ var _iterator2 = _createForOfIteratorHelper(canvas.objects),
575
+ _step2;
576
+
577
+ try {
578
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
579
+ var obj = _step2.value;
580
+
581
+ if ((0, _Selectors4.isPlaceholderObject)(obj)) {
582
+ obj.wrappedObject.visible = show;
583
+ }
584
+ }
585
+ } catch (err) {
586
+ _iterator2.e(err);
587
+ } finally {
588
+ _iterator2.f();
589
+ }
590
+ });
591
+ return function () {
592
+ return _this2.togglePlaceholders(true);
593
+ };
594
+ }
595
+ }, {
596
+ key: "createMediaDataForConfiguration",
597
+ value: function () {
598
+ var _createMediaDataForConfiguration = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(configuration) {
599
+ var mediaData, restorePlaceholderVisibility, memo, fontMapping, svgs, fullSvgs, usedAreas, designArea, filteredDesignAreas, usedViews, item, selectedAmounts, selectedVariants, selectedVariant, designViewList, screenshots, _iterator4, _step4, variant, variantImages, _keys, orderedImages, index, key;
600
+
601
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
602
+ while (1) {
603
+ switch (_context5.prev = _context5.next) {
604
+ case 0:
605
+ mediaData = {};
606
+ restorePlaceholderVisibility = this.togglePlaceholders(false);
607
+ memo = _ServiceLocator.Services.designData.createHighlightMemo(false);
608
+ fontMapping = (0, _Selectors3.getFontMapping)(_ServiceLocator.Services.store.state);
609
+ _context5.next = 6;
610
+ return _ServiceLocator.Services.designData.getScreenshotsOfElements(fontMapping);
611
+
612
+ case 6:
613
+ svgs = _context5.sent;
614
+ mediaData.designDataSnapshots = svgs;
615
+ _context5.next = 10;
616
+ return _ServiceLocator.Services.designData.getScreenshots(fontMapping);
617
+
618
+ case 10:
619
+ fullSvgs = _context5.sent;
620
+ mediaData.printDesignData = fullSvgs;
621
+ usedAreas = Object.keys(fullSvgs);
622
+ designArea = _ServiceLocator.Services.store.state.designArea;
623
+ filteredDesignAreas = designArea.filteredDesignAreas;
624
+ usedViews = (0, _Selectors2.getCameraViewListForDesignAreaList)(filteredDesignAreas, usedAreas);
625
+ item = (0, _Selectors.getItem)(this.state);
626
+ selectedAmounts = (0, _Selectors.getSelectedAmounts)(this.state);
627
+ selectedVariants = getSelectedAmountsBySizes(item, selectedAmounts).filter(function (item) {
628
+ if (item.sizes.length > 0) {
629
+ var _iterator3 = _createForOfIteratorHelper(item.sizes),
630
+ _step3;
631
+
632
+ try {
633
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
634
+ var size = _step3.value;
635
+
636
+ if (size.amount > 0) {
637
+ return true;
638
+ }
639
+ }
640
+ } catch (err) {
641
+ _iterator3.e(err);
642
+ } finally {
643
+ _iterator3.f();
644
+ }
645
+ } else {
646
+ if (item.amount > 0) {
647
+ return true;
648
+ }
649
+ }
650
+
651
+ return false;
652
+ }).map(function (item) {
653
+ return item.identifier;
654
+ });
655
+ selectedVariant = (0, _Selectors.getSelectedVariantIdentifier)(this.state);
656
+
657
+ if (selectedVariants.length === 0) {
658
+ selectedVariants.push(selectedVariant);
659
+ }
660
+
661
+ designViewList = (0, _Selectors2.getDesignViewListForDesignAreas)(_ServiceLocator.Services.store.state);
662
+ mediaData.screenshots = {};
663
+ _context5.prev = 23;
664
+ _context5.next = 26;
665
+ return _ServiceLocator.Services.visualization.getScreenshots({
666
+ areaList: usedAreas,
667
+ // used in 2D visualization
668
+ viewList: usedViews,
669
+ // used in 3D visualization
670
+ variantList: selectedVariants,
671
+ designViewList: designViewList // used in 2D visualization
672
+
673
+ });
674
+
675
+ case 26:
676
+ screenshots = _context5.sent;
677
+
678
+ if (screenshots) {
679
+ // make sure the order is kept on the server side
680
+ _iterator4 = _createForOfIteratorHelper(selectedVariants);
681
+
682
+ try {
683
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
684
+ variant = _step4.value;
685
+ variantImages = screenshots[variant];
686
+
687
+ if (variantImages) {
688
+ _keys = Object.keys(variantImages);
689
+ orderedImages = {};
690
+
691
+ for (index = 0; index < _keys.length; index++) {
692
+ key = _keys[index];
693
+ orderedImages[index + key] = variantImages[key];
694
+ }
695
+
696
+ screenshots[variant] = orderedImages;
697
+ }
698
+ }
699
+ } catch (err) {
700
+ _iterator4.e(err);
701
+ } finally {
702
+ _iterator4.f();
703
+ }
704
+ }
705
+
706
+ mediaData.screenshots = screenshots;
707
+ _context5.next = 34;
708
+ break;
709
+
710
+ case 31:
711
+ _context5.prev = 31;
712
+ _context5.t0 = _context5["catch"](23);
713
+ // do not save in case of an error while generating screenshots
714
+ // eslint-disable-next-line no-console
715
+ console.error('Error occurred while generating screenshots:', _context5.t0);
716
+
717
+ case 34:
718
+ memo.restore();
719
+
720
+ if (_typeof(configuration) === 'object') {
721
+ Object.assign(configuration, mediaData);
722
+ }
723
+
724
+ restorePlaceholderVisibility();
725
+ return _context5.abrupt("return", mediaData);
726
+
727
+ case 38:
728
+ case "end":
729
+ return _context5.stop();
730
+ }
731
+ }
732
+ }, _callee5, this, [[23, 31]]);
733
+ }));
734
+
735
+ function createMediaDataForConfiguration(_x6) {
736
+ return _createMediaDataForConfiguration.apply(this, arguments);
737
+ }
738
+
739
+ return createMediaDataForConfiguration;
740
+ }()
741
+ }, {
742
+ key: "captureAndSaveConfiguration",
743
+ value: function () {
744
+ var _captureAndSaveConfiguration = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(saveType) {
745
+ var extraData,
746
+ configuration,
747
+ _args6 = arguments;
748
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
749
+ while (1) {
750
+ switch (_context6.prev = _context6.next) {
751
+ case 0:
752
+ extraData = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
753
+ _context6.prev = 1;
754
+ _context6.next = 4;
755
+ return this.editNameAsync(saveType);
756
+
757
+ case 4:
758
+ _context6.next = 10;
759
+ break;
760
+
761
+ case 6:
762
+ _context6.prev = 6;
763
+ _context6.t0 = _context6["catch"](1);
764
+ // do not save if the name is not entered / confirmed
765
+ // eslint-disable-next-line no-console
766
+ console.error('Custom name editor not confirmed!');
767
+ return _context6.abrupt("return");
768
+
769
+ case 10:
770
+ configuration = this.prepareConfigurationForSave(false, extraData);
771
+ _context6.next = 13;
772
+ return this.createMediaDataForConfiguration(configuration);
773
+
774
+ case 13:
775
+ return _context6.abrupt("return", this.saveConfiguration(configuration, saveType));
776
+
777
+ case 14:
778
+ case "end":
779
+ return _context6.stop();
780
+ }
781
+ }
782
+ }, _callee6, this, [[1, 6]]);
783
+ }));
784
+
785
+ function captureAndSaveConfiguration(_x7) {
786
+ return _captureAndSaveConfiguration.apply(this, arguments);
787
+ }
788
+
789
+ return captureAndSaveConfiguration;
790
+ }()
791
+ }, {
792
+ key: "editNameAsync",
793
+ value: function editNameAsync(saveType) {
794
+ if ((0, _configuration2.getConf)('editCustomTitleBeforeSave') && (0, _configuration2.getConf)('customTitleSaveTypes').indexOf(saveType) !== -1) {
795
+ _ServiceLocator.Services.ui.show('customTitleEditor');
796
+
797
+ return _ServiceLocator.Services.async.create('customEditorConfirm');
798
+ }
799
+ }
800
+ }, {
801
+ key: "validateConfiguration",
802
+ value: function validateConfiguration() {
803
+ return _ServiceLocator.Services.store.dispatch((0, _Actions2.withGlobalLoader)(configuratorActions.validateConfiguration(this.state.configuration)));
804
+ }
805
+ }, {
806
+ key: "saveAndReloadConfiguration",
807
+ value: function () {
808
+ var _saveAndReloadConfiguration = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(saveType) {
809
+ var tmpConfiguration, _configuration, _this$state, selectedoptionclassification, configuration, loadIdentifier, itemIdentifier;
810
+
811
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
812
+ while (1) {
813
+ switch (_context7.prev = _context7.next) {
814
+ case 0:
815
+ if (!this.state.configuration.item.identifier) {
816
+ _context7.next = 6;
817
+ break;
818
+ }
819
+
820
+ tmpConfiguration = (0, _omit["default"])(this.state.configuration, ['code', 'date_created']);
821
+ _context7.next = 4;
822
+ return this.saveConfiguration(tmpConfiguration, saveType);
823
+
824
+ case 4:
825
+ _configuration = this.state.configuration;
826
+ this.setLoadCode(_configuration.code);
827
+
828
+ case 6:
829
+ _this$state = this.state, selectedoptionclassification = _this$state.selectedoptionclassification, configuration = _this$state.configuration, loadIdentifier = _this$state.loadIdentifier;
830
+ itemIdentifier = configuration.item.identifier || loadIdentifier; // item identifier is required for the following actions
831
+
832
+ if (itemIdentifier) {
833
+ _context7.next = 10;
834
+ break;
835
+ }
836
+
837
+ return _context7.abrupt("return");
838
+
839
+ case 10:
840
+ // reload inspirations
841
+ if ((0, _configuration2.getConf)('loadInspirations')) {
842
+ this.loadInspirations(itemIdentifier);
843
+ } // reload configuration variants
844
+
845
+
846
+ this.loadConfigurationVariants(itemIdentifier); // the optionlist should be reloaded as well if open
847
+
848
+ if (configuration.item.identifier && selectedoptionclassification.identifier) {
849
+ this.loadOptions(configuration.item.identifier, selectedoptionclassification.identifier, configuration);
850
+ }
851
+
852
+ case 13:
853
+ case "end":
854
+ return _context7.stop();
855
+ }
856
+ }
857
+ }, _callee7, this);
858
+ }));
859
+
860
+ function saveAndReloadConfiguration(_x8) {
861
+ return _saveAndReloadConfiguration.apply(this, arguments);
862
+ }
863
+
864
+ return saveAndReloadConfiguration;
865
+ }()
866
+ }, {
867
+ key: "setLoadCode",
868
+ value: function setLoadCode(code) {
869
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.setLoadCode(code));
870
+ }
871
+ }, {
872
+ key: "setLoadIdentifier",
873
+ value: function setLoadIdentifier(identifier) {
874
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.setLoadIdentifier(identifier));
875
+ }
876
+ }, {
877
+ key: "loadInspirations",
878
+ value: function loadInspirations(itemIdentifier) {
879
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.fetchInspirations(itemIdentifier));
880
+ }
881
+ }, {
882
+ key: "loadConfigurationVariants",
883
+ value: function loadConfigurationVariants(itemIdentifier) {
884
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.fetchConfigurationVariants(itemIdentifier));
885
+ }
886
+ }, {
887
+ key: "loadOptions",
888
+ value: function loadOptions(itemIdentifier, optionClassificationIdentifier, configuration) {
889
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.fetchOptions(itemIdentifier, optionClassificationIdentifier, configuration));
890
+ }
891
+ }, {
892
+ key: "loadInitialOptions",
893
+ value: function loadInitialOptions() {
894
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.loadInitialOptionclassification(this.state.configuration));
895
+ }
896
+ }, {
897
+ key: "loadInitialConfiguration",
898
+ value: function loadInitialConfiguration() {
899
+ return _ServiceLocator.Services.store.dispatch((0, _Actions2.withGlobalLoader)(configuratorActions.fetchInitialConfiguration()));
900
+ }
901
+ }, {
902
+ key: "loadConfigurationForDesignerProductPreview",
903
+ value: function loadConfigurationForDesignerProductPreview() {
904
+ return _ServiceLocator.Services.store.dispatch((0, _Actions2.withGlobalLoader)(configuratorActions.fetchConfigurationForDesignerProductPreview()));
905
+ }
906
+ }, {
907
+ key: "loadCodeSnippets",
908
+ value: function loadCodeSnippets() {
909
+ var _this3 = this;
910
+
911
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.fetchCodesnippets()).then(function (codeSnippets) {
912
+ return _this3.attachCodeSnippets(codeSnippets);
913
+ });
914
+ }
915
+ }, {
916
+ key: "loadClientData",
917
+ value: function loadClientData() {
918
+ return _ServiceLocator.Services.store.dispatch((0, _Actions2.withGlobalLoader)(configuratorActions.fetchClientData()));
919
+ }
920
+ }, {
921
+ key: "attachCodeSnippets",
922
+ value: function attachCodeSnippets(codeSnippets) {
923
+ if (codeSnippets.data.length > 0) {
924
+ codeSnippets.data.forEach(function (_ref4) {
925
+ var code = _ref4.code;
926
+ var fragment = document.createRange().createContextualFragment(code);
927
+
928
+ while (fragment.children.length > 0) {
929
+ document.head.insertBefore(fragment.children[0], document.head.firstElementChild);
930
+ }
931
+ });
932
+ window.dataLayer && _ServiceLocator.Services.analytics.setDataLayer(window.dataLayer);
933
+ }
934
+ }
935
+ }, {
936
+ key: "setSelectedAmount",
937
+ value: function setSelectedAmount(identifier, amount) {
938
+ var isUpdatedByUser = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
939
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.setSelectedAmount(identifier || (0, _Selectors.getSelectedVariantIdentifier)(this.state) || this.state.configuration.item.identifier, amount, isUpdatedByUser));
940
+ }
941
+ }, {
942
+ key: "resolveCalculationErrors",
943
+ value: function resolveCalculationErrors() {
944
+ var configuratorstate = _ServiceLocator.Services.store.state.configurator;
945
+ var configurationItem = (0, _get["default"])(configuratorstate, 'configuration.item', {});
946
+
947
+ if ((0, _Selectors.createCalculationErrorChecker)(configuratorstate).isMinOrderAmountError()) {
948
+ var calculation = (0, _Selectors.getCalculation)(configuratorstate);
949
+ calculation.errors.forEach(function (error) {
950
+ var variant = '';
951
+ var amount = 0;
952
+
953
+ if (error.itemIdentifier === configurationItem.parentItemIdentifier) {
954
+ var selectedAmounts = (0, _Selectors.getSelectedAmounts)(configuratorstate);
955
+
956
+ if ((0, _keys2["default"])(selectedAmounts).length > 1) {
957
+ variant = configuratorstate.selectedVariantIdentifier;
958
+ var selectedVariantAmount = (0, _has["default"])(selectedAmounts, configuratorstate.selectedVariantIdentifier) ? selectedAmounts[configuratorstate.selectedVariantIdentifier] : 0;
959
+ amount = error.minimumAmount - error.selectedAmount + selectedVariantAmount;
960
+ } else {
961
+ variant = configuratorstate.selectedVariantIdentifier;
962
+ amount = error.minimumAmount;
963
+ }
964
+ } else {
965
+ variant = error.itemIdentifier;
966
+ amount = error.minimumAmount;
967
+ }
968
+
969
+ _ServiceLocator.Services.store.dispatch(configuratorActions.setSelectedAmount(variant, amount, false));
970
+ });
971
+ }
972
+
973
+ _ServiceLocator.Services.store.dispatch(configuratorActions.setCalculationErrorsResolved());
974
+ }
975
+ }, {
976
+ key: "updateSelectedAmount",
977
+ value: function updateSelectedAmount(oldVariant, newVariant) {
978
+ if (!(0, _Selectors.isSelectedAmountsUpdated)(this.state) && !(0, _Selectors.hasMultipleVariantsSelected)(this.state)) {
979
+ if (!oldVariant.children && !newVariant.children && !oldVariant.itemGroup && !newVariant.itemGroup) {
980
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.switchSelectedAmount(oldVariant.identifier, newVariant.identifier));
981
+ }
982
+
983
+ var oldIdentifiers = (0, _Selectors.getDeepestChildIdentifiers)(oldVariant);
984
+ var newIdentifiers = (0, _Selectors.getDeepestChildIdentifiers)(newVariant);
985
+ var oldIdentifierKeys = (0, _keys2["default"])(oldIdentifiers);
986
+ var newIdentifierKeys = (0, _keys2["default"])(newIdentifiers);
987
+ var sortedOldIdentifierKeys = oldIdentifierKeys.sort(function (a, b) {
988
+ return a.localeCompare(b, 0, {
989
+ numeric: false
990
+ });
991
+ });
992
+ var sortedNewIdentifierKeys = newIdentifierKeys.sort(function (a, b) {
993
+ return a.localeCompare(b, 0, {
994
+ numeric: false
995
+ });
996
+ });
997
+ var identifierDiffs = (0, _difference["default"])(sortedOldIdentifierKeys, sortedNewIdentifierKeys);
998
+
999
+ if (identifierDiffs.length === 0 && (0, _isEqual["default"])(sortedOldIdentifierKeys, sortedNewIdentifierKeys)) {
1000
+ for (var key in oldIdentifiers) {
1001
+ if (!oldIdentifiers.hasOwnProperty(key)) {
1002
+ continue;
1003
+ }
1004
+
1005
+ if (newIdentifiers[key]) {
1006
+ _ServiceLocator.Services.store.dispatch(configuratorActions.switchSelectedAmount(oldIdentifiers[key], newIdentifiers[key]));
1007
+ }
1008
+ }
1009
+ }
1010
+ }
1011
+ }
1012
+ }, {
1013
+ key: "clearBulkNames",
1014
+ value: function clearBulkNames() {
1015
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.clearBulkNames());
1016
+ }
1017
+ }, {
1018
+ key: "saveBulkNames",
1019
+ value: function saveBulkNames(identifier, bulkNamesData) {
1020
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.saveBulkNames(identifier, bulkNamesData));
1021
+ }
1022
+ }, {
1023
+ key: "switchSelectedAmount",
1024
+ value: function switchSelectedAmount(oldIdentifier, newIdentifier) {
1025
+ this.setSelectedVariantIdentifier(newIdentifier);
1026
+ var item = this.state.configuration.item;
1027
+ var oldVariant = (0, _find["default"])(item.itemGroup.children, function (o) {
1028
+ return o.identifier === oldIdentifier;
1029
+ });
1030
+ var newVariant = (0, _find["default"])(item.itemGroup.children, function (o) {
1031
+ return o.identifier === newIdentifier;
1032
+ });
1033
+ var selectedAmounts = (0, _Selectors.getSelectedAmounts)(this.state);
1034
+ var firstSelectedAmountIdentifier = (0, _keys2["default"])(selectedAmounts)[0];
1035
+ var oldSelectedAmountVariant = (0, _find["default"])(item.itemGroup.children, function (o) {
1036
+ if (o.itemGroup) {
1037
+ var children = o.itemGroup.children;
1038
+ return children.find(function (child) {
1039
+ return child.identifier === firstSelectedAmountIdentifier;
1040
+ });
1041
+ } else {
1042
+ return o.identifier === firstSelectedAmountIdentifier;
1043
+ }
1044
+ });
1045
+
1046
+ if (!(0, _configuration2.getConf)('restrictAmountselectionToSelectedVariant', false)) {
1047
+ // Updates selected Amounts from previous selectedVariant amount to new variant
1048
+ this.updateSelectedAmount(oldSelectedAmountVariant, newVariant);
1049
+ return;
1050
+ }
1051
+
1052
+ if (!oldVariant.children && !newVariant.children) {
1053
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.switchSelectedAmount(oldVariant.identifier, newVariant.identifier));
1054
+ }
1055
+
1056
+ var oldIdentifiers = (0, _Selectors.getDeepestChildIdentifiers)(oldVariant);
1057
+ var newIdentifiers = (0, _Selectors.getDeepestChildIdentifiers)(newVariant);
1058
+
1059
+ for (var key in oldIdentifiers) {
1060
+ if (!oldIdentifiers.hasOwnProperty(key)) {
1061
+ continue;
1062
+ }
1063
+
1064
+ if (newIdentifiers[key]) {
1065
+ _ServiceLocator.Services.store.dispatch(configuratorActions.switchSelectedAmount(oldIdentifiers[key], newIdentifiers[key]));
1066
+ }
1067
+ }
1068
+ }
1069
+ }, {
1070
+ key: "setConfigurationComment",
1071
+ value: function setConfigurationComment(comment) {
1072
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.setComment(comment));
1073
+ }
1074
+ }, {
1075
+ key: "setSelectedCalculation",
1076
+ value: function setSelectedCalculation(identifier, value) {
1077
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.setSelectedCalculation(identifier, value));
1078
+ }
1079
+ }, {
1080
+ key: "setSelectedVariantIdentifier",
1081
+ value: function setSelectedVariantIdentifier(identifier) {
1082
+ return _ServiceLocator.Services.store.dispatch(configuratorActions.setSelectedVariantIdentifier(identifier));
1083
+ }
1084
+ /**
1085
+ * A simple method for saving the configuration without any additional design data or screenshot
1086
+ * @param {string} saveType
1087
+ * @param {object} extraData
1088
+ * @returns {Promise}
1089
+ */
1090
+
1091
+ }, {
1092
+ key: "prepareAndSaveConfiguration",
1093
+ value: function prepareAndSaveConfiguration(saveType) {
1094
+ var extraData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1095
+ var configuration = this.prepareConfigurationForSave(false, extraData);
1096
+ return this.saveConfiguration(configuration, saveType);
1097
+ }
1098
+ }, {
1099
+ key: "addToCartCallback",
1100
+ value: function addToCartCallback(configuration) {
1101
+ // after saving call parent function if existing or send postMessage (depending on the configuration)
1102
+ if (window.parent !== undefined) {
1103
+ var addToCartMethod = (0, _configuration2.getConf)('addToCartMethod');
1104
+
1105
+ if (addToCartMethod === 'postMessage' && window.parent.postMessage !== undefined) {
1106
+ var appConf = (0, _configuration2.getConf)();
1107
+ var targetOrigin = (0, _get["default"])(appConf, 'addToCartPostMessageTargetOrigin', '*');
1108
+ window.parent.postMessage({
1109
+ method: 'addtocart',
1110
+ code: configuration.code
1111
+ }, targetOrigin);
1112
+ } else if (addToCartMethod === 'functionCall' && window.parent.addToCart !== undefined) {
1113
+ window.parent.addToCart(configuration.code);
1114
+ }
1115
+ }
1116
+ }
1117
+ }]);
1118
+
1119
+ return ConfiguratorService;
1120
+ }(_AbstractConfiguratorService["default"]);
1121
+
1122
+ exports["default"] = ConfiguratorService;