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