@configuratorware/configurator-frontendgui 1.28.3 → 1.29.1
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 +187 -0
- package/App/Modules/Creator/Components/ProductPart/index.story.js +88 -0
- package/App/Modules/Creator/Components/ProductPartsList/index.js +153 -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 +50 -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/__snapshots__/index.test.js.snap +33 -10
- package/src/App/Modules/Creator/Components/ProductPart/index.js +5 -1
- package/src/App/Modules/Creator/Components/ProductPart/index.test.js +14 -1
- package/src/App/Modules/Creator/Components/ProductPartsList/index.js +3 -0
- package/src/App/Modules/Creator/Containers/ProductPartsList/index.js +1 -0
- 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,1130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.ImageEditDialogContainer = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
15
|
+
|
|
16
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
17
|
+
|
|
18
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
19
|
+
|
|
20
|
+
var _size = _interopRequireDefault(require("lodash/size"));
|
|
21
|
+
|
|
22
|
+
var _isMatch = _interopRequireDefault(require("lodash/isMatch"));
|
|
23
|
+
|
|
24
|
+
var _ComponentContainer = _interopRequireDefault(require("../../../../Framework/ComponentContainer"));
|
|
25
|
+
|
|
26
|
+
var _i18n = require("../../../../Framework/i18n");
|
|
27
|
+
|
|
28
|
+
var _ServiceLocator = require("../../../ServiceLocator");
|
|
29
|
+
|
|
30
|
+
var _Selectors = require("../../../Reducers/DesignArea/Selectors");
|
|
31
|
+
|
|
32
|
+
var _Selectors2 = require("../../../Reducers/DesignData/Selectors");
|
|
33
|
+
|
|
34
|
+
var _Selectors3 = require("../../../Reducers/ImageGallery/Selectors");
|
|
35
|
+
|
|
36
|
+
var _Selectors4 = require("../../../Reducers/UI/Selectors");
|
|
37
|
+
|
|
38
|
+
var _Actions = require("../../../Reducers/ImageGallery/Actions");
|
|
39
|
+
|
|
40
|
+
var _ImageEditDialog = _interopRequireDefault(require("../Components/ImageEditDialog"));
|
|
41
|
+
|
|
42
|
+
var _ImageUpload = _interopRequireDefault(require("../Components/ImageEditDialog/ImageUpload"));
|
|
43
|
+
|
|
44
|
+
var _ImageColorize = _interopRequireDefault(require("../Components/ImageColorize"));
|
|
45
|
+
|
|
46
|
+
var _FeedbackNotice = _interopRequireDefault(require("../Components/FeedbackNotice"));
|
|
47
|
+
|
|
48
|
+
var _Progress = _interopRequireDefault(require("../../../Shared/Components/Progress/Progress"));
|
|
49
|
+
|
|
50
|
+
var _DesignDataService = require("../../../Services/DesignDataService");
|
|
51
|
+
|
|
52
|
+
var _AddGalleryImage = _interopRequireDefault(require("./AddGalleryImage"));
|
|
53
|
+
|
|
54
|
+
var _createSelector = _interopRequireDefault(require("../../../../Utils/Function/createSelector"));
|
|
55
|
+
|
|
56
|
+
var _configuration = require("../../../configuration");
|
|
57
|
+
|
|
58
|
+
var _Constant = require("../../../Constant");
|
|
59
|
+
|
|
60
|
+
var _ImageEditUtils = require("../Utils/ImageEditUtils");
|
|
61
|
+
|
|
62
|
+
var _Transformers = require("../Utils/Transformers");
|
|
63
|
+
|
|
64
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
65
|
+
|
|
66
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
67
|
+
|
|
68
|
+
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; } } }; }
|
|
69
|
+
|
|
70
|
+
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); }
|
|
71
|
+
|
|
72
|
+
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; }
|
|
73
|
+
|
|
74
|
+
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); } }
|
|
75
|
+
|
|
76
|
+
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); }); }; }
|
|
77
|
+
|
|
78
|
+
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; }
|
|
79
|
+
|
|
80
|
+
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; }
|
|
81
|
+
|
|
82
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
83
|
+
|
|
84
|
+
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); } }
|
|
85
|
+
|
|
86
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
87
|
+
|
|
88
|
+
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); }
|
|
89
|
+
|
|
90
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
91
|
+
|
|
92
|
+
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); }; }
|
|
93
|
+
|
|
94
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
95
|
+
|
|
96
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
97
|
+
|
|
98
|
+
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; } }
|
|
99
|
+
|
|
100
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
101
|
+
|
|
102
|
+
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; }
|
|
103
|
+
|
|
104
|
+
var getOperationsFromState = function getOperationsFromState(state) {
|
|
105
|
+
var clipping = state.clipping,
|
|
106
|
+
clippingColor = state.clippingColor,
|
|
107
|
+
vectorize = state.vectorize,
|
|
108
|
+
vectorizeThreshold = state.vectorizeThreshold,
|
|
109
|
+
vectorizeColorsMap = state.vectorizeColorsMap;
|
|
110
|
+
return {
|
|
111
|
+
clipping: clipping,
|
|
112
|
+
clippingColor: clippingColor,
|
|
113
|
+
vectorize: vectorize,
|
|
114
|
+
vectorizeThreshold: vectorizeThreshold,
|
|
115
|
+
vectorizeColorsMap: vectorizeColorsMap
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
var getLoadingState = (0, _Selectors4.createBackgroundWorkStateSelector)(_Actions.WN_UPLOAD_IMAGE);
|
|
120
|
+
|
|
121
|
+
var isVectorizableGalleryImage = function isVectorizableGalleryImage(imageData) {
|
|
122
|
+
return Boolean(imageData && !(0, _get["default"])(imageData, 'operations.vectorize') && imageData.gallery && (0, _Selectors3.isEditableVectorImage)(imageData.preview));
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
var getDerivedOperationStateFromImageData = function getDerivedOperationStateFromImageData(imageData) {
|
|
126
|
+
return {
|
|
127
|
+
clipping: (0, _get["default"])(imageData, 'operations.clipping', null),
|
|
128
|
+
clippingColor: (0, _get["default"])(imageData, 'operations.clippingColor', null),
|
|
129
|
+
vectorize: !!(0, _get["default"])(imageData, 'operations.vectorize', false),
|
|
130
|
+
vectorizeThreshold: (0, _get["default"])(imageData, 'operations.vectorizeThreshold', 0),
|
|
131
|
+
vectorizeColorsMap: (0, _get["default"])(imageData, 'operations.vectorizeColorsMap', {}),
|
|
132
|
+
vectorizeOriginalColorsMap: (0, _get["default"])(imageData, 'operations.vectorizeOriginalColorsMap', {}),
|
|
133
|
+
vectorizeMaxColorAmount: (0, _get["default"])(imageData, 'operations.vectorizeMaxColorAmount', undefined)
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
var isImageInvalidatedByChange = function isImageInvalidatedByChange(imageData1, imageData2) {
|
|
138
|
+
return ['operations.clipping', 'operations.clippingColor', 'displayColorPreview'].some(function (key) {
|
|
139
|
+
return (0, _get["default"])(imageData1, key, null) !== (0, _get["default"])(imageData2, key, null);
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
144
|
+
_inherits(ImageEditDialogContainer, _React$Component);
|
|
145
|
+
|
|
146
|
+
var _super = _createSuper(ImageEditDialogContainer);
|
|
147
|
+
|
|
148
|
+
function ImageEditDialogContainer() {
|
|
149
|
+
var _this;
|
|
150
|
+
|
|
151
|
+
_classCallCheck(this, ImageEditDialogContainer);
|
|
152
|
+
|
|
153
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
154
|
+
args[_key] = arguments[_key];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
158
|
+
|
|
159
|
+
_defineProperty(_assertThisInitialized(_this), "colorAmountNoticeRef", /*#__PURE__*/_react["default"].createRef());
|
|
160
|
+
|
|
161
|
+
_defineProperty(_assertThisInitialized(_this), "embroideryNoticeRef", /*#__PURE__*/_react["default"].createRef());
|
|
162
|
+
|
|
163
|
+
_defineProperty(_assertThisInitialized(_this), "imageUploadRef", /*#__PURE__*/_react["default"].createRef());
|
|
164
|
+
|
|
165
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
166
|
+
preview: null,
|
|
167
|
+
clipping: null,
|
|
168
|
+
clippingColor: null,
|
|
169
|
+
vectorize: false,
|
|
170
|
+
vectorizeThreshold: 0,
|
|
171
|
+
vectorizeMaxColorAmount: undefined,
|
|
172
|
+
vectorizeColorsMap: {},
|
|
173
|
+
vectorizeOriginalColorsMap: {},
|
|
174
|
+
activeTabIndex: 0,
|
|
175
|
+
showAddImagePanel: false,
|
|
176
|
+
colorAmount: 0,
|
|
177
|
+
continueButtonDisabled: false,
|
|
178
|
+
originalImagePreview: null,
|
|
179
|
+
upload: null
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
_defineProperty(_assertThisInitialized(_this), "lastImageUpdateData", null);
|
|
183
|
+
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this), "setUpload", function (upload) {
|
|
185
|
+
_this.setState({
|
|
186
|
+
upload: upload
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
_defineProperty(_assertThisInitialized(_this), "resetDerivedImageState", function () {
|
|
191
|
+
_this.setState(_objectSpread({
|
|
192
|
+
originalImagePreview: null
|
|
193
|
+
}, getDerivedOperationStateFromImageData()));
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
_defineProperty(_assertThisInitialized(_this), "changeSelectedBackground", function (value) {
|
|
197
|
+
var partialState = {
|
|
198
|
+
clipping: value
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
if (value !== null && _this.state.clippingColor === null) {
|
|
202
|
+
partialState.clippingColor = '#ffffff';
|
|
203
|
+
} // remove the threshold value to trigger the re-creation of the color map
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if (_this.state.vectorizeThreshold) {
|
|
207
|
+
partialState.vectorizeThreshold = null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
_this.handleStateChange(partialState);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
_defineProperty(_assertThisInitialized(_this), "changeColor", function (color) {
|
|
214
|
+
var partialState = {
|
|
215
|
+
clippingColor: color.hex
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
if (_this.state.clipping === null) {
|
|
219
|
+
partialState.clipping = 'replace';
|
|
220
|
+
} // remove the threshold value to trigger the re-creation of the color map
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
if (_this.state.vectorizeThreshold) {
|
|
224
|
+
partialState.vectorizeThreshold = null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
_this.handleStateChange(partialState);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
_defineProperty(_assertThisInitialized(_this), "handleStateChange", /*#__PURE__*/function () {
|
|
231
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(partialState) {
|
|
232
|
+
var options,
|
|
233
|
+
displayColorPreview,
|
|
234
|
+
image,
|
|
235
|
+
nextState,
|
|
236
|
+
operations,
|
|
237
|
+
result,
|
|
238
|
+
vectorizeColorsMap,
|
|
239
|
+
vectorizeThreshold,
|
|
240
|
+
vectorizeMaxColorAmount,
|
|
241
|
+
vectorizeOriginalColorsMap,
|
|
242
|
+
_args = arguments;
|
|
243
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
244
|
+
while (1) {
|
|
245
|
+
switch (_context.prev = _context.next) {
|
|
246
|
+
case 0:
|
|
247
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
248
|
+
displayColorPreview = options.displayColorPreview;
|
|
249
|
+
image = _this.props.image;
|
|
250
|
+
nextState = _objectSpread(_objectSpread({}, _this.state), partialState);
|
|
251
|
+
|
|
252
|
+
_this.setState(nextState);
|
|
253
|
+
|
|
254
|
+
operations = getOperationsFromState(nextState);
|
|
255
|
+
|
|
256
|
+
if (!(!image || (0, _isMatch["default"])(image.operations, operations) && image.displayColorPreview === displayColorPreview)) {
|
|
257
|
+
_context.next = 8;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return _context.abrupt("return");
|
|
262
|
+
|
|
263
|
+
case 8:
|
|
264
|
+
_this.continueBlocked = true;
|
|
265
|
+
_context.prev = 9;
|
|
266
|
+
_context.next = 12;
|
|
267
|
+
return _this.props.editFile(operations, image, displayColorPreview !== undefined && {
|
|
268
|
+
displayColorPreview: displayColorPreview
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
case 12:
|
|
272
|
+
result = _context.sent;
|
|
273
|
+
vectorizeColorsMap = result.vectorizeColorsMap, vectorizeThreshold = result.vectorizeThreshold, vectorizeMaxColorAmount = result.vectorizeMaxColorAmount, vectorizeOriginalColorsMap = result.vectorizeOriginalColorsMap;
|
|
274
|
+
|
|
275
|
+
_this.setState({
|
|
276
|
+
vectorizeColorsMap: vectorizeColorsMap,
|
|
277
|
+
vectorizeThreshold: vectorizeThreshold,
|
|
278
|
+
vectorizeMaxColorAmount: vectorizeMaxColorAmount,
|
|
279
|
+
vectorizeOriginalColorsMap: vectorizeOriginalColorsMap
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
case 15:
|
|
283
|
+
_context.prev = 15;
|
|
284
|
+
_this.continueBlocked = false;
|
|
285
|
+
return _context.finish(15);
|
|
286
|
+
|
|
287
|
+
case 18:
|
|
288
|
+
case "end":
|
|
289
|
+
return _context.stop();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}, _callee, null, [[9,, 15, 18]]);
|
|
293
|
+
}));
|
|
294
|
+
|
|
295
|
+
return function (_x) {
|
|
296
|
+
return _ref.apply(this, arguments);
|
|
297
|
+
};
|
|
298
|
+
}());
|
|
299
|
+
|
|
300
|
+
_defineProperty(_assertThisInitialized(_this), "onVectorizeToggleChange", function (value) {
|
|
301
|
+
_this.handleStateChange({
|
|
302
|
+
vectorize: value
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
_defineProperty(_assertThisInitialized(_this), "onVectorizeThresholdChange", function (threshold) {
|
|
307
|
+
var image = _this.props.image; // skip if the threshold is the same as the color count
|
|
308
|
+
|
|
309
|
+
var colorCount = (0, _Selectors2.getAggregatedColorCount)(_this.state.vectorizeColorsMap);
|
|
310
|
+
|
|
311
|
+
if (threshold === colorCount) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (threshold !== _this.state.vectorizeThreshold && !image.gallery) {
|
|
316
|
+
return _this.handleStateChange({
|
|
317
|
+
vectorizeThreshold: threshold
|
|
318
|
+
});
|
|
319
|
+
} // if the threshold value is the same, there might be some aggregated colors to restore
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
return _this.handleStateChange(_objectSpread({
|
|
323
|
+
vectorizeColorsMap: (0, _ImageEditUtils.expandVectorizeColorsMap)(_this.state.vectorizeColorsMap, _this.props.colorPalettes, threshold)
|
|
324
|
+
}, image.gallery && {
|
|
325
|
+
vectorizeThreshold: threshold
|
|
326
|
+
}));
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
_defineProperty(_assertThisInitialized(_this), "onColorImageStateReset", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
330
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
331
|
+
while (1) {
|
|
332
|
+
switch (_context2.prev = _context2.next) {
|
|
333
|
+
case 0:
|
|
334
|
+
_context2.next = 2;
|
|
335
|
+
return _this.props.resetColorizing();
|
|
336
|
+
|
|
337
|
+
case 2:
|
|
338
|
+
case "end":
|
|
339
|
+
return _context2.stop();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}, _callee2);
|
|
343
|
+
})));
|
|
344
|
+
|
|
345
|
+
_defineProperty(_assertThisInitialized(_this), "selectColor", /*#__PURE__*/function () {
|
|
346
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(colorKey, newColor) {
|
|
347
|
+
var vectorizeColorsMap, colorKeys, _colorKey, _iterator, _step, _colorKey2;
|
|
348
|
+
|
|
349
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
350
|
+
while (1) {
|
|
351
|
+
switch (_context3.prev = _context3.next) {
|
|
352
|
+
case 0:
|
|
353
|
+
vectorizeColorsMap = (0, _cloneDeep["default"])(_this.state.vectorizeColorsMap);
|
|
354
|
+
colorKeys = (0, _Selectors2.getColorKeysForAggregatedColor)(vectorizeColorsMap, colorKey);
|
|
355
|
+
|
|
356
|
+
if (!_ServiceLocator.Services.designData.changeAllColorsNeeded()) {
|
|
357
|
+
_context3.next = 13;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
_context3.t0 = regeneratorRuntime.keys(vectorizeColorsMap);
|
|
362
|
+
|
|
363
|
+
case 4:
|
|
364
|
+
if ((_context3.t1 = _context3.t0()).done) {
|
|
365
|
+
_context3.next = 11;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
_colorKey = _context3.t1.value;
|
|
370
|
+
|
|
371
|
+
if (vectorizeColorsMap.hasOwnProperty(_colorKey)) {
|
|
372
|
+
_context3.next = 8;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return _context3.abrupt("continue", 4);
|
|
377
|
+
|
|
378
|
+
case 8:
|
|
379
|
+
vectorizeColorsMap[_colorKey] = newColor;
|
|
380
|
+
_context3.next = 4;
|
|
381
|
+
break;
|
|
382
|
+
|
|
383
|
+
case 11:
|
|
384
|
+
_context3.next = 15;
|
|
385
|
+
break;
|
|
386
|
+
|
|
387
|
+
case 13:
|
|
388
|
+
_iterator = _createForOfIteratorHelper(colorKeys);
|
|
389
|
+
|
|
390
|
+
try {
|
|
391
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
392
|
+
_colorKey2 = _step.value;
|
|
393
|
+
vectorizeColorsMap[_colorKey2] = _objectSpread(_objectSpread({}, newColor), {}, {
|
|
394
|
+
isUserColor: true
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
} catch (err) {
|
|
398
|
+
_iterator.e(err);
|
|
399
|
+
} finally {
|
|
400
|
+
_iterator.f();
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
case 15:
|
|
404
|
+
_context3.next = 17;
|
|
405
|
+
return _this.handleStateChange({
|
|
406
|
+
vectorizeColorsMap: vectorizeColorsMap
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
case 17:
|
|
410
|
+
_ServiceLocator.Services.designData.setImageAndTextColor(newColor);
|
|
411
|
+
|
|
412
|
+
_ServiceLocator.Services.analytics.triggerEvent(_Constant.EventTypes.image_edit_colorize_color, newColor.value.replace('#', ''));
|
|
413
|
+
|
|
414
|
+
case 19:
|
|
415
|
+
case "end":
|
|
416
|
+
return _context3.stop();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}, _callee3);
|
|
420
|
+
}));
|
|
421
|
+
|
|
422
|
+
return function (_x2, _x3) {
|
|
423
|
+
return _ref3.apply(this, arguments);
|
|
424
|
+
};
|
|
425
|
+
}());
|
|
426
|
+
|
|
427
|
+
_defineProperty(_assertThisInitialized(_this), "removeColor", /*#__PURE__*/function () {
|
|
428
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(colorKey) {
|
|
429
|
+
var vectorizeColorsMap, closestColor;
|
|
430
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
431
|
+
while (1) {
|
|
432
|
+
switch (_context4.prev = _context4.next) {
|
|
433
|
+
case 0:
|
|
434
|
+
vectorizeColorsMap = _this.state.vectorizeColorsMap;
|
|
435
|
+
|
|
436
|
+
if (vectorizeColorsMap[colorKey]) {
|
|
437
|
+
_context4.next = 3;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
throw new Error('Color key does not exist!');
|
|
442
|
+
|
|
443
|
+
case 3:
|
|
444
|
+
closestColor = (0, _ImageEditUtils.getClosestColorFromMap)(vectorizeColorsMap, vectorizeColorsMap[colorKey].value);
|
|
445
|
+
_context4.next = 6;
|
|
446
|
+
return _this.selectColor(colorKey, closestColor);
|
|
447
|
+
|
|
448
|
+
case 6:
|
|
449
|
+
case "end":
|
|
450
|
+
return _context4.stop();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}, _callee4);
|
|
454
|
+
}));
|
|
455
|
+
|
|
456
|
+
return function (_x4) {
|
|
457
|
+
return _ref4.apply(this, arguments);
|
|
458
|
+
};
|
|
459
|
+
}());
|
|
460
|
+
|
|
461
|
+
_defineProperty(_assertThisInitialized(_this), "onActiveTabChange", function (activeTabIndex) {
|
|
462
|
+
var image = _this.props.image;
|
|
463
|
+
var upload = _this.state.upload;
|
|
464
|
+
|
|
465
|
+
if (upload !== null) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (!image && [1, 2].indexOf(activeTabIndex) !== -1) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
_this.setState({
|
|
474
|
+
activeTabIndex: activeTabIndex
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
_defineProperty(_assertThisInitialized(_this), "updatePreview", /*#__PURE__*/function () {
|
|
479
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(svgContent) {
|
|
480
|
+
var options,
|
|
481
|
+
_options$forceFetch,
|
|
482
|
+
forceFetch,
|
|
483
|
+
image,
|
|
484
|
+
activeTabIndex,
|
|
485
|
+
preview,
|
|
486
|
+
originalImagePreview,
|
|
487
|
+
updateSVG,
|
|
488
|
+
forceUpdate,
|
|
489
|
+
_args5 = arguments;
|
|
490
|
+
|
|
491
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
492
|
+
while (1) {
|
|
493
|
+
switch (_context5.prev = _context5.next) {
|
|
494
|
+
case 0:
|
|
495
|
+
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
496
|
+
_options$forceFetch = options.forceFetch, forceFetch = _options$forceFetch === void 0 ? false : _options$forceFetch;
|
|
497
|
+
image = _this.props.image;
|
|
498
|
+
activeTabIndex = _this.state.activeTabIndex;
|
|
499
|
+
preview = null;
|
|
500
|
+
originalImagePreview = null;
|
|
501
|
+
|
|
502
|
+
if (!image) {
|
|
503
|
+
_context5.next = 20;
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
updateSVG = activeTabIndex !== 1 && (image.displayColorPreview || image.gallery) && (0, _Selectors3.isEditableVectorImage)(image.preview);
|
|
508
|
+
|
|
509
|
+
if (!updateSVG) {
|
|
510
|
+
_context5.next = 16;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (svgContent) {
|
|
515
|
+
_context5.next = 13;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
_context5.next = 12;
|
|
520
|
+
return (0, _DesignDataService.getSvgContent)(image.preview.url, false, forceFetch);
|
|
521
|
+
|
|
522
|
+
case 12:
|
|
523
|
+
svgContent = _context5.sent;
|
|
524
|
+
|
|
525
|
+
case 13:
|
|
526
|
+
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, image.operations, svgContent);
|
|
527
|
+
_context5.next = 20;
|
|
528
|
+
break;
|
|
529
|
+
|
|
530
|
+
case 16:
|
|
531
|
+
forceUpdate = isImageInvalidatedByChange(_this.lastImageUpdateData, image);
|
|
532
|
+
|
|
533
|
+
if (forceUpdate) {
|
|
534
|
+
_this.previewVersion = Math.random();
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
preview = (0, _Transformers.getRasterURL)((0, _Selectors3.getPreviewUrlFromImageData)(image.preview)) + (_this.previewVersion ? "?".concat(_this.previewVersion) : '');
|
|
538
|
+
originalImagePreview = preview;
|
|
539
|
+
|
|
540
|
+
case 20:
|
|
541
|
+
_this.lastImageUpdateData = image;
|
|
542
|
+
|
|
543
|
+
_this.setState({
|
|
544
|
+
preview: preview,
|
|
545
|
+
originalImagePreview: originalImagePreview
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
case 22:
|
|
549
|
+
case "end":
|
|
550
|
+
return _context5.stop();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}, _callee5);
|
|
554
|
+
}));
|
|
555
|
+
|
|
556
|
+
return function (_x5) {
|
|
557
|
+
return _ref5.apply(this, arguments);
|
|
558
|
+
};
|
|
559
|
+
}());
|
|
560
|
+
|
|
561
|
+
_defineProperty(_assertThisInitialized(_this), "closeAddImagePanel", function () {
|
|
562
|
+
return _this.setState({
|
|
563
|
+
showAddImagePanel: false
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
_defineProperty(_assertThisInitialized(_this), "onSelectImage", /*#__PURE__*/function () {
|
|
568
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(file) {
|
|
569
|
+
var addGalleryImageToUserImages, imageUrl, thumbUrl, fileName, vectorizeColorsMap;
|
|
570
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
571
|
+
while (1) {
|
|
572
|
+
switch (_context6.prev = _context6.next) {
|
|
573
|
+
case 0:
|
|
574
|
+
addGalleryImageToUserImages = _this.props.addGalleryImageToUserImages;
|
|
575
|
+
imageUrl = file.imageUrl, thumbUrl = file.thumbUrl;
|
|
576
|
+
fileName = imageUrl.replace(/^.*[\\/]/, '') // get filename
|
|
577
|
+
.replace(/\.[^.$]+$/, ''); // remove extension
|
|
578
|
+
|
|
579
|
+
_context6.next = 5;
|
|
580
|
+
return _ServiceLocator.Services.designData.getGalleryImageColors(imageUrl);
|
|
581
|
+
|
|
582
|
+
case 5:
|
|
583
|
+
vectorizeColorsMap = _context6.sent;
|
|
584
|
+
addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap); // exit image upload if a gallery image is selected
|
|
585
|
+
|
|
586
|
+
_this.setUpload(null);
|
|
587
|
+
|
|
588
|
+
case 8:
|
|
589
|
+
case "end":
|
|
590
|
+
return _context6.stop();
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}, _callee6);
|
|
594
|
+
}));
|
|
595
|
+
|
|
596
|
+
return function (_x6) {
|
|
597
|
+
return _ref6.apply(this, arguments);
|
|
598
|
+
};
|
|
599
|
+
}());
|
|
600
|
+
|
|
601
|
+
_defineProperty(_assertThisInitialized(_this), "continueClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
|
|
602
|
+
var _this$props, colorDisabled, image, shouldAddImageImmediately, colorPreviewRequirementFulfilled, _this$state, activeTabIndex, continueButtonDisabled;
|
|
603
|
+
|
|
604
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
605
|
+
while (1) {
|
|
606
|
+
switch (_context7.prev = _context7.next) {
|
|
607
|
+
case 0:
|
|
608
|
+
if (!_this.continueBlocked) {
|
|
609
|
+
_context7.next = 2;
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return _context7.abrupt("return");
|
|
614
|
+
|
|
615
|
+
case 2:
|
|
616
|
+
_this$props = _this.props, colorDisabled = _this$props.colorDisabled, image = _this$props.image, shouldAddImageImmediately = _this$props.shouldAddImageImmediately, colorPreviewRequirementFulfilled = _this$props.colorPreviewRequirementFulfilled;
|
|
617
|
+
_this$state = _this.state, activeTabIndex = _this$state.activeTabIndex, continueButtonDisabled = _this$state.continueButtonDisabled;
|
|
618
|
+
|
|
619
|
+
if (!(activeTabIndex === 0 && shouldAddImageImmediately(image))) {
|
|
620
|
+
_context7.next = 13;
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
_this.continueBlocked = true;
|
|
625
|
+
_context7.prev = 6;
|
|
626
|
+
_context7.next = 9;
|
|
627
|
+
return _ServiceLocator.Services.designer.imageEditDialogContinueClickHandler();
|
|
628
|
+
|
|
629
|
+
case 9:
|
|
630
|
+
_context7.prev = 9;
|
|
631
|
+
_this.continueBlocked = false;
|
|
632
|
+
return _context7.finish(9);
|
|
633
|
+
|
|
634
|
+
case 12:
|
|
635
|
+
return _context7.abrupt("return");
|
|
636
|
+
|
|
637
|
+
case 13:
|
|
638
|
+
if (!(activeTabIndex === 0)) {
|
|
639
|
+
_context7.next = 16;
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
_this.setState({
|
|
644
|
+
activeTabIndex: image.gallery ? 2 : 1
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
return _context7.abrupt("return");
|
|
648
|
+
|
|
649
|
+
case 16:
|
|
650
|
+
if (!(activeTabIndex === 1 && !colorDisabled)) {
|
|
651
|
+
_context7.next = 19;
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
_this.setState({
|
|
656
|
+
activeTabIndex: 2
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
return _context7.abrupt("return");
|
|
660
|
+
|
|
661
|
+
case 19:
|
|
662
|
+
if (!(activeTabIndex === 2 && !colorPreviewRequirementFulfilled)) {
|
|
663
|
+
_context7.next = 23;
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
if (!(_this.embroideryNoticeRef && _this.embroideryNoticeRef.current)) {
|
|
668
|
+
_context7.next = 23;
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
_this.embroideryNoticeRef.current.scrollIntoView();
|
|
673
|
+
|
|
674
|
+
return _context7.abrupt("return");
|
|
675
|
+
|
|
676
|
+
case 23:
|
|
677
|
+
if (!continueButtonDisabled) {
|
|
678
|
+
_context7.next = 27;
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (!(_this.colorAmountNoticeRef && _this.colorAmountNoticeRef.current)) {
|
|
683
|
+
_context7.next = 27;
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
_this.colorAmountNoticeRef.current.scrollIntoView();
|
|
688
|
+
|
|
689
|
+
return _context7.abrupt("return");
|
|
690
|
+
|
|
691
|
+
case 27:
|
|
692
|
+
_this.continueBlocked = true;
|
|
693
|
+
_context7.prev = 28;
|
|
694
|
+
_context7.next = 31;
|
|
695
|
+
return _ServiceLocator.Services.designer.imageEditDialogContinueClickHandler();
|
|
696
|
+
|
|
697
|
+
case 31:
|
|
698
|
+
_context7.prev = 31;
|
|
699
|
+
_this.continueBlocked = false;
|
|
700
|
+
return _context7.finish(31);
|
|
701
|
+
|
|
702
|
+
case 34:
|
|
703
|
+
case "end":
|
|
704
|
+
return _context7.stop();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}, _callee7, null, [[6,, 9, 12], [28,, 31, 34]]);
|
|
708
|
+
})));
|
|
709
|
+
|
|
710
|
+
_defineProperty(_assertThisInitialized(_this), "onGalleryClick", function () {
|
|
711
|
+
_this.setState({
|
|
712
|
+
showAddImagePanel: true
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
_defineProperty(_assertThisInitialized(_this), "closePreviewDialog", function () {
|
|
717
|
+
_ServiceLocator.Services.designer.imageEditDialogCloseHandler();
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
_defineProperty(_assertThisInitialized(_this), "onOriginalImageAndColorPreviewToggleClick", function () {
|
|
721
|
+
_this.handleStateChange({}, {
|
|
722
|
+
displayColorPreview: !_this.props.displayColorPreview
|
|
723
|
+
});
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
_defineProperty(_assertThisInitialized(_this), "uploadImage", function () {
|
|
727
|
+
return _this.imageUploadRef.current.uploadFile();
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
_defineProperty(_assertThisInitialized(_this), "onNewUploadClick", function () {
|
|
731
|
+
_this.setUpload({
|
|
732
|
+
disabled: true
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
_this.resetDerivedImageState();
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
_defineProperty(_assertThisInitialized(_this), "selectUserImage", function (imageIndex) {
|
|
739
|
+
var _this$props2 = _this.props,
|
|
740
|
+
userImages = _this$props2.userImages,
|
|
741
|
+
setSelectedImage = _this$props2.setSelectedImage;
|
|
742
|
+
setSelectedImage(userImages[imageIndex].identifier);
|
|
743
|
+
|
|
744
|
+
_this.resetDerivedImageState();
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
return _this;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
_createClass(ImageEditDialogContainer, [{
|
|
751
|
+
key: "componentDidMount",
|
|
752
|
+
value: function componentDidMount() {
|
|
753
|
+
this.updatePreview(null);
|
|
754
|
+
var _this$props3 = this.props,
|
|
755
|
+
image = _this$props3.image,
|
|
756
|
+
editMode = _this$props3.editMode,
|
|
757
|
+
hasPlaceHolderImage = _this$props3.hasPlaceHolderImage,
|
|
758
|
+
colorDisabled = _this$props3.colorDisabled;
|
|
759
|
+
var initialState = getDerivedOperationStateFromImageData(image);
|
|
760
|
+
|
|
761
|
+
if (editMode && image && !hasPlaceHolderImage) {
|
|
762
|
+
initialState.activeTabIndex = initialState.vectorize && !colorDisabled ? 2 : 1;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
this.setState(initialState);
|
|
766
|
+
}
|
|
767
|
+
}, {
|
|
768
|
+
key: "componentDidUpdate",
|
|
769
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
770
|
+
var _this$props4 = this.props,
|
|
771
|
+
image = _this$props4.image,
|
|
772
|
+
open = _this$props4.open,
|
|
773
|
+
maxColorAmount = _this$props4.maxColorAmount,
|
|
774
|
+
editMode = _this$props4.editMode,
|
|
775
|
+
hasPlaceHolderImage = _this$props4.hasPlaceHolderImage,
|
|
776
|
+
isImageCompatible = _this$props4.isImageCompatible,
|
|
777
|
+
isColorMappingCompatible = _this$props4.isColorMappingCompatible,
|
|
778
|
+
vectorsRequired = _this$props4.vectorsRequired;
|
|
779
|
+
var _this$state2 = this.state,
|
|
780
|
+
vectorize = _this$state2.vectorize,
|
|
781
|
+
vectorizeColorsMap = _this$state2.vectorizeColorsMap,
|
|
782
|
+
activeTabIndex = _this$state2.activeTabIndex,
|
|
783
|
+
originalImagePreview = _this$state2.originalImagePreview;
|
|
784
|
+
var newState = {};
|
|
785
|
+
var justOpened = open !== prevProps.open && open;
|
|
786
|
+
var imageChanged = !!image && image !== prevProps.image;
|
|
787
|
+
var prevOperationData = getDerivedOperationStateFromImageData(prevProps.image);
|
|
788
|
+
var operationData = getDerivedOperationStateFromImageData(image);
|
|
789
|
+
var operationsChanged = !!image && !(0, _isEqual["default"])(prevOperationData, operationData);
|
|
790
|
+
|
|
791
|
+
if (image && image.preview && image.preview.url && activeTabIndex === 2 && originalImagePreview === null) {
|
|
792
|
+
var previewUrl = "".concat((0, _configuration.getConf)('network.host')).concat(image.preview.url);
|
|
793
|
+
this.setState({
|
|
794
|
+
originalImagePreview: image.gallery ? previewUrl : previewUrl.replace(/.svg$/, '.png')
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
if (operationsChanged) {
|
|
799
|
+
Object.assign(newState, operationData);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
if (justOpened) {
|
|
803
|
+
var _activeTabIndex = 0;
|
|
804
|
+
|
|
805
|
+
if (image && editMode && !hasPlaceHolderImage) {
|
|
806
|
+
_activeTabIndex = (0, _Selectors3.isEditableVectorImage)(image.preview) ? 2 : 1;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
Object.assign(newState, {
|
|
810
|
+
activeTabIndex: _activeTabIndex
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
if (maxColorAmount !== prevProps.maxColorAmount || vectorize !== prevState.vectorize || vectorizeColorsMap !== prevState.vectorizeColorsMap || activeTabIndex !== prevState.activeTabIndex) {
|
|
815
|
+
var colorAmount = (0, _Selectors2.getAggregatedColorCount)(vectorizeColorsMap);
|
|
816
|
+
var continueButtonDisabled = activeTabIndex === 2 && vectorize && !!maxColorAmount && colorAmount > maxColorAmount;
|
|
817
|
+
this.setState({
|
|
818
|
+
colorAmount: colorAmount,
|
|
819
|
+
continueButtonDisabled: continueButtonDisabled
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
if (activeTabIndex === 2 && isVectorizableGalleryImage(image) && (!vectorize || // if the user comes from the background removal tab vectorizing should be performed again
|
|
824
|
+
prevState.activeTabIndex === 1)) {
|
|
825
|
+
Object.assign(newState, {
|
|
826
|
+
vectorize: true
|
|
827
|
+
});
|
|
828
|
+
} // when switching to the colorizing tab the color has to be made compatible
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
if (activeTabIndex === 2 && activeTabIndex !== prevState.activeTabIndex && (!isImageCompatible(image) || !isColorMappingCompatible(vectorizeColorsMap))) {
|
|
832
|
+
Object.assign(newState, {
|
|
833
|
+
vectorizeColorsMap: vectorizeColorsMap
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
if (activeTabIndex === 2 && vectorsRequired && !vectorize && !image.gallery) {
|
|
838
|
+
Object.assign(newState, {
|
|
839
|
+
vectorize: true
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
!(0, _isMatch["default"])(this.state, newState) && this.handleStateChange(newState);
|
|
844
|
+
|
|
845
|
+
if ((justOpened || imageChanged) && !image.incomplete) {
|
|
846
|
+
this.updatePreview(null, {
|
|
847
|
+
forceFetch: operationsChanged
|
|
848
|
+
});
|
|
849
|
+
} else if (activeTabIndex !== prevState.activeTabIndex && vectorize) {
|
|
850
|
+
this.updatePreview(null, {
|
|
851
|
+
forceFetch: true
|
|
852
|
+
});
|
|
853
|
+
} // update upload state if it is just opened
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
if (justOpened) {
|
|
857
|
+
var _this$props5 = this.props,
|
|
858
|
+
userImages = _this$props5.userImages,
|
|
859
|
+
galleryHasImages = _this$props5.galleryHasImages;
|
|
860
|
+
var upload = null; // if no gallery images, default to user upload
|
|
861
|
+
|
|
862
|
+
if (!image && !userImages.length && !galleryHasImages) {
|
|
863
|
+
upload = {
|
|
864
|
+
disabled: true
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
this.setUpload(upload);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}, {
|
|
872
|
+
key: "render",
|
|
873
|
+
value: function render() {
|
|
874
|
+
var _this2 = this;
|
|
875
|
+
|
|
876
|
+
var _this$props6 = this.props,
|
|
877
|
+
loading = _this$props6.loading,
|
|
878
|
+
ProgressComponent = _this$props6.ProgressComponent,
|
|
879
|
+
errorCode = _this$props6.errorCode,
|
|
880
|
+
colorPalettes = _this$props6.colorPalettes,
|
|
881
|
+
maxColorAmount = _this$props6.maxColorAmount,
|
|
882
|
+
colorDisabled = _this$props6.colorDisabled,
|
|
883
|
+
vectorsRequired = _this$props6.vectorsRequired,
|
|
884
|
+
image = _this$props6.image,
|
|
885
|
+
usedColors = _this$props6.usedColors,
|
|
886
|
+
imageColorsWereEdited = _this$props6.imageColorsWereEdited,
|
|
887
|
+
colorPreviewEnabled = _this$props6.colorPreviewEnabled,
|
|
888
|
+
colorPreviewRequirementFulfilled = _this$props6.colorPreviewRequirementFulfilled,
|
|
889
|
+
uploadSize = _this$props6.uploadSize,
|
|
890
|
+
ImageColorizeComponent = _this$props6.ImageColorizeComponent,
|
|
891
|
+
ImageUploadComponent = _this$props6.ImageUploadComponent,
|
|
892
|
+
customControlElements = _this$props6.customControlElements,
|
|
893
|
+
checkOwnership = _this$props6.checkOwnership;
|
|
894
|
+
var _this$state3 = this.state,
|
|
895
|
+
preview = _this$state3.preview,
|
|
896
|
+
clipping = _this$state3.clipping,
|
|
897
|
+
vectorize = _this$state3.vectorize,
|
|
898
|
+
vectorizeColorsMap = _this$state3.vectorizeColorsMap,
|
|
899
|
+
activeTabIndex = _this$state3.activeTabIndex,
|
|
900
|
+
colorAmount = _this$state3.colorAmount,
|
|
901
|
+
continueButtonDisabled = _this$state3.continueButtonDisabled,
|
|
902
|
+
originalImagePreview = _this$state3.originalImagePreview,
|
|
903
|
+
upload = _this$state3.upload;
|
|
904
|
+
var isGalleryImage = image && !!image.gallery;
|
|
905
|
+
var showWarningMessage = (0, _Selectors3.showVectorizeImageQuality)(image);
|
|
906
|
+
var aggregatedColors = (0, _Selectors2.getAggregatedColors)(vectorizeColorsMap);
|
|
907
|
+
var colorAmountList = Array(maxColorAmount).fill(null).map(function (_, i) {
|
|
908
|
+
return i + 1;
|
|
909
|
+
});
|
|
910
|
+
var colorCount = (0, _size["default"])(aggregatedColors);
|
|
911
|
+
var colorPreviewBlockActive = activeTabIndex === 2 && colorCount > 0 && !isGalleryImage && (colorPreviewEnabled || !colorPreviewRequirementFulfilled);
|
|
912
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_ImageEditDialog["default"], _extends({}, this.props, {
|
|
913
|
+
loaderComponent: /*#__PURE__*/_react["default"].createElement(ProgressComponent, {
|
|
914
|
+
loading: loading
|
|
915
|
+
}),
|
|
916
|
+
errorFeedback: errorCode && /*#__PURE__*/_react["default"].createElement(_FeedbackNotice["default"], {
|
|
917
|
+
errorNotice: (0, _i18n.t)("fileUpload.errors.".concat(errorCode))
|
|
918
|
+
}),
|
|
919
|
+
changeSelectedBackground: this.changeSelectedBackground,
|
|
920
|
+
onChangeColor: this.changeColor,
|
|
921
|
+
closePreviewDialog: this.closePreviewDialog,
|
|
922
|
+
backgroundSelected: clipping,
|
|
923
|
+
preview: preview,
|
|
924
|
+
colorPickerEnabled: !!clipping,
|
|
925
|
+
continueButtonDisabled: continueButtonDisabled,
|
|
926
|
+
continueClick: this.continueClick,
|
|
927
|
+
showWarningMessage: showWarningMessage,
|
|
928
|
+
imageColorizeElement: /*#__PURE__*/_react["default"].createElement(ImageColorizeComponent, {
|
|
929
|
+
inputRef: this.colorAmountNoticeRef,
|
|
930
|
+
colorPalettes: colorPalettes,
|
|
931
|
+
usedColors: usedColors,
|
|
932
|
+
vectorizeThreshold: colorCount > maxColorAmount ? 0 : colorCount,
|
|
933
|
+
onVectorizeThresholdChange: this.onVectorizeThresholdChange,
|
|
934
|
+
vectorizeColorsMap: vectorizeColorsMap,
|
|
935
|
+
onColorSelectClick: this.selectColor,
|
|
936
|
+
onColorRemoveClick: this.removeColor,
|
|
937
|
+
aggregatedColors: aggregatedColors,
|
|
938
|
+
disableInputs: !vectorize && !isGalleryImage || colorDisabled,
|
|
939
|
+
maxColorAmount: maxColorAmount,
|
|
940
|
+
colorAmount: colorAmount,
|
|
941
|
+
vectorize: vectorize,
|
|
942
|
+
onVectorizeToggleChange: this.onVectorizeToggleChange,
|
|
943
|
+
vectorizeToggleDisabled: vectorsRequired || isGalleryImage && vectorize,
|
|
944
|
+
onColorImageStateReset: this.onColorImageStateReset,
|
|
945
|
+
isLoading: loading,
|
|
946
|
+
imageColorsWereEdited: imageColorsWereEdited,
|
|
947
|
+
vectorsRequired: vectorsRequired,
|
|
948
|
+
colorAmountList: colorAmountList,
|
|
949
|
+
customControlElements: customControlElements
|
|
950
|
+
}),
|
|
951
|
+
activeTabIndex: activeTabIndex,
|
|
952
|
+
onActiveTabChange: this.onActiveTabChange,
|
|
953
|
+
onGalleryClick: this.onGalleryClick,
|
|
954
|
+
onOriginalImageAndColorPreviewToggleClick: this.onOriginalImageAndColorPreviewToggleClick,
|
|
955
|
+
originalImagePreview: originalImagePreview,
|
|
956
|
+
embroideryNoticeRef: this.embroideryNoticeRef,
|
|
957
|
+
colorPreviewBlockActive: colorPreviewBlockActive,
|
|
958
|
+
onNewUploadClick: this.onNewUploadClick,
|
|
959
|
+
showUploadPanel: upload !== null,
|
|
960
|
+
uploadDisabled: !!(upload && upload.disabled),
|
|
961
|
+
uploadImage: this.uploadImage,
|
|
962
|
+
selectUserImage: this.selectUserImage,
|
|
963
|
+
imageUploadElement: /*#__PURE__*/_react["default"].createElement(ImageUploadComponent, {
|
|
964
|
+
innerRef: this.imageUploadRef,
|
|
965
|
+
uploadSize: uploadSize,
|
|
966
|
+
onValidate: function onValidate(_ref8) {
|
|
967
|
+
var isValid = _ref8.isValid;
|
|
968
|
+
return _this2.setUpload({
|
|
969
|
+
disabled: !isValid
|
|
970
|
+
});
|
|
971
|
+
},
|
|
972
|
+
onUploadFinished: function onUploadFinished() {
|
|
973
|
+
_this2.setUpload(null);
|
|
974
|
+
|
|
975
|
+
_this2.onActiveTabChange(1);
|
|
976
|
+
},
|
|
977
|
+
checkOwnership: checkOwnership
|
|
978
|
+
})
|
|
979
|
+
})), /*#__PURE__*/_react["default"].createElement(_AddGalleryImage["default"], {
|
|
980
|
+
open: this.state.showAddImagePanel,
|
|
981
|
+
onClose: this.closeAddImagePanel,
|
|
982
|
+
onSelectImage: this.onSelectImage
|
|
983
|
+
}));
|
|
984
|
+
}
|
|
985
|
+
}]);
|
|
986
|
+
|
|
987
|
+
return ImageEditDialogContainer;
|
|
988
|
+
}(_react["default"].Component);
|
|
989
|
+
|
|
990
|
+
exports.ImageEditDialogContainer = ImageEditDialogContainer;
|
|
991
|
+
|
|
992
|
+
_defineProperty(ImageEditDialogContainer, "propTypes", {
|
|
993
|
+
image: _propTypes["default"].object,
|
|
994
|
+
open: _propTypes["default"].bool,
|
|
995
|
+
editMode: _propTypes["default"].bool,
|
|
996
|
+
vectorsRequired: _propTypes["default"].bool,
|
|
997
|
+
colorDisabled: _propTypes["default"].bool,
|
|
998
|
+
loading: _propTypes["default"].bool,
|
|
999
|
+
errorCode: _propTypes["default"].string,
|
|
1000
|
+
colorPalettes: _propTypes["default"].array,
|
|
1001
|
+
galleryHasImages: _propTypes["default"].bool,
|
|
1002
|
+
hasPlaceHolderImage: _propTypes["default"].bool,
|
|
1003
|
+
displayColorPreview: _propTypes["default"].bool,
|
|
1004
|
+
imageColorsWereEdited: _propTypes["default"].bool,
|
|
1005
|
+
initialColorMaxAmount: _propTypes["default"].number,
|
|
1006
|
+
originalColorsMap: _propTypes["default"].object,
|
|
1007
|
+
colorPreviewRequirementFulfilled: _propTypes["default"].bool,
|
|
1008
|
+
colorPreviewEnabled: _propTypes["default"].bool,
|
|
1009
|
+
userImages: _propTypes["default"].array.isRequired,
|
|
1010
|
+
editFile: _propTypes["default"].func.isRequired,
|
|
1011
|
+
ProgressComponent: _propTypes["default"].elementType.isRequired,
|
|
1012
|
+
maxColorAmount: _propTypes["default"].number.isRequired,
|
|
1013
|
+
usedColors: _propTypes["default"].array.isRequired,
|
|
1014
|
+
addGalleryImageToUserImages: _propTypes["default"].func.isRequired,
|
|
1015
|
+
setSelectedImage: _propTypes["default"].func.isRequired,
|
|
1016
|
+
shouldAddImageImmediately: _propTypes["default"].func.isRequired,
|
|
1017
|
+
isImageCompatible: _propTypes["default"].func.isRequired,
|
|
1018
|
+
isColorMappingCompatible: _propTypes["default"].func.isRequired,
|
|
1019
|
+
resetColorizing: _propTypes["default"].func.isRequired,
|
|
1020
|
+
uploadSize: _propTypes["default"].number,
|
|
1021
|
+
ImageColorizeComponent: _propTypes["default"].elementType,
|
|
1022
|
+
ImageUploadComponent: _propTypes["default"].elementType,
|
|
1023
|
+
customControlElements: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]),
|
|
1024
|
+
checkOwnership: _propTypes["default"].bool
|
|
1025
|
+
});
|
|
1026
|
+
|
|
1027
|
+
_defineProperty(ImageEditDialogContainer, "defaultProps", {
|
|
1028
|
+
colorPreviewRequirementFulfilled: false,
|
|
1029
|
+
colorPreviewEnabled: false,
|
|
1030
|
+
checkOwnership: true
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
var getUserImages = (0, _createSelector["default"])(function (imageGalleryState) {
|
|
1034
|
+
return imageGalleryState.userImages;
|
|
1035
|
+
}, function (images) {
|
|
1036
|
+
var host = (0, _configuration.getConf)('network.host');
|
|
1037
|
+
var userImages = images.filter(function (image) {
|
|
1038
|
+
return !image.isPlaceHolderImage;
|
|
1039
|
+
});
|
|
1040
|
+
return userImages.map(function (image) {
|
|
1041
|
+
return _objectSpread(_objectSpread({}, image), {}, {
|
|
1042
|
+
url: "".concat(host).concat(image.thumbnail.url)
|
|
1043
|
+
});
|
|
1044
|
+
});
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1047
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
1048
|
+
var ui = state.ui,
|
|
1049
|
+
imageGallery = state.imageGallery;
|
|
1050
|
+
var colorPalettes = (0, _Selectors.getColorPalettes)(state);
|
|
1051
|
+
var designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(state);
|
|
1052
|
+
var vectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
1053
|
+
var colorDisabled = (0, _Selectors.isColoringDisabled)(state);
|
|
1054
|
+
var userImages = getUserImages(imageGallery);
|
|
1055
|
+
var hasPlaceHolderImage = (0, _Selectors.hasPlaceHolderImagesForActiveDesignArea)(state);
|
|
1056
|
+
var firstUserImageToPreSelect = userImages.length > 0 ? userImages[0] : null;
|
|
1057
|
+
var userImage = imageGallery.selectedImage || firstUserImageToPreSelect;
|
|
1058
|
+
var defaultMaxColorAmount = (0, _configuration.getConf)('designer.maxColorAmount', 10);
|
|
1059
|
+
var maxColorAmount = Math.min(+(0, _get["default"])(designProductionMethod, 'options.maxColorAmount') || defaultMaxColorAmount, +(0, _get["default"])(userImage, 'operations.vectorizeMaxColorAmount', defaultMaxColorAmount));
|
|
1060
|
+
var editMode = (0, _Selectors3.isEditMode)(state);
|
|
1061
|
+
var galleryHasImages = imageGallery.gallery.length !== 0;
|
|
1062
|
+
var uploadSize = (0, _Selectors.getMaxUploadSize)(state);
|
|
1063
|
+
var open = !!ui.visibilityMap.imageEditDialog;
|
|
1064
|
+
var usedColors = (0, _Selectors.getDesignDataUsedColors)(state);
|
|
1065
|
+
var displayColorPreview = userImage && !!userImage.displayColorPreview;
|
|
1066
|
+
var colorPreviewEnabled = userImage && !!userImage.colorPreviewEnabled;
|
|
1067
|
+
var imageColorsWereEdited = userImage && !!userImage.imageColorsWereEdited;
|
|
1068
|
+
var initialColorMaxAmount = (0, _Selectors2.getInitialMaxColorAmount)(state);
|
|
1069
|
+
var colorPreviewRequirementFulfilled = (0, _Selectors3.isColorPreviewCompatible)(state, userImage);
|
|
1070
|
+
return {
|
|
1071
|
+
Component: open ? ImageEditDialogContainer : function () {
|
|
1072
|
+
return null;
|
|
1073
|
+
},
|
|
1074
|
+
ProgressComponent: _Progress["default"],
|
|
1075
|
+
ImageColorizeComponent: _ImageColorize["default"],
|
|
1076
|
+
ImageUploadComponent: _ImageUpload["default"],
|
|
1077
|
+
errorCode: imageGallery.lastErrorCode,
|
|
1078
|
+
loading: getLoadingState(ui) || !!(userImage && userImage.incomplete),
|
|
1079
|
+
image: userImage,
|
|
1080
|
+
maxColorAmount: maxColorAmount,
|
|
1081
|
+
displayColorPreview: displayColorPreview,
|
|
1082
|
+
colorPreviewEnabled: colorPreviewEnabled,
|
|
1083
|
+
imageColorsWereEdited: imageColorsWereEdited,
|
|
1084
|
+
editMode: editMode,
|
|
1085
|
+
open: open,
|
|
1086
|
+
userImages: userImages,
|
|
1087
|
+
colorPalettes: colorPalettes,
|
|
1088
|
+
vectorsRequired: vectorsRequired,
|
|
1089
|
+
colorDisabled: colorDisabled,
|
|
1090
|
+
uploadSize: uploadSize,
|
|
1091
|
+
galleryHasImages: galleryHasImages,
|
|
1092
|
+
usedColors: usedColors,
|
|
1093
|
+
hasPlaceHolderImage: hasPlaceHolderImage,
|
|
1094
|
+
initialColorMaxAmount: initialColorMaxAmount,
|
|
1095
|
+
colorPreviewRequirementFulfilled: colorPreviewRequirementFulfilled
|
|
1096
|
+
};
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
1100
|
+
return {
|
|
1101
|
+
editFile: function editFile(operations, image) {
|
|
1102
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1103
|
+
return _ServiceLocator.Services.designData.editFileQueued(operations, image, _objectSpread({
|
|
1104
|
+
addMode: (0, _Selectors3.isAddMode)(_ServiceLocator.Services.store.state)
|
|
1105
|
+
}, options));
|
|
1106
|
+
},
|
|
1107
|
+
setSelectedImage: function setSelectedImage(identifier) {
|
|
1108
|
+
return dispatch((0, _Actions.setSelectedImageByIdentifier)(identifier));
|
|
1109
|
+
},
|
|
1110
|
+
addGalleryImageToUserImages: function addGalleryImageToUserImages(imageUrl, thumbUrl, fileName, vectorizeColorsMap) {
|
|
1111
|
+
return dispatch((0, _Actions.addGalleryImageToUserImages)(imageUrl, thumbUrl, fileName, vectorizeColorsMap));
|
|
1112
|
+
},
|
|
1113
|
+
shouldAddImageImmediately: function shouldAddImageImmediately(imageData) {
|
|
1114
|
+
return (0, _Selectors3.isImageReadyToBeAdded)(_ServiceLocator.Services.store.state, imageData);
|
|
1115
|
+
},
|
|
1116
|
+
isColorMappingCompatible: function isColorMappingCompatible(vectorizeColorsMap) {
|
|
1117
|
+
return (0, _Selectors3.isColorMappingCompatible)((0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state).colorPalettes, vectorizeColorsMap);
|
|
1118
|
+
},
|
|
1119
|
+
isImageCompatible: function isImageCompatible(imageData) {
|
|
1120
|
+
return (0, _Selectors3.isImageCompatible)(_ServiceLocator.Services.store.state, imageData);
|
|
1121
|
+
},
|
|
1122
|
+
resetColorizing: function resetColorizing() {
|
|
1123
|
+
return _ServiceLocator.Services.designData.resetEditedFile();
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
var _default = (0, _ComponentContainer["default"])(mapStateToProps, mapDispatchToProps);
|
|
1129
|
+
|
|
1130
|
+
exports["default"] = _default;
|