Debian Codegraph @

addons/website_sale/static/src/js/client_actions/configurator/configurator.js

raw symbols SCIP
1 import { patch } from '@web/core/utils/patch';
2
3 import {
4 ApplyConfiguratorScreen,
5 Configurator,
6 FeaturesSelectionScreen,
7 ROUTES,
8 } from '@website/client_actions/configurator/configurator';
9 import {
10 ProductPageSelectionScreen,
11 } from '@website_sale/js/client_actions/configurator/productPageSelectionScreen';
12 import {
13 ShopPageSelectionScreen,
14 } from '@website_sale/js/client_actions/configurator/shopPageSelectionScreen';
15
16 ROUTES.shopPageSelectionScreen = 50;
17 ROUTES.productPageSelectionScreen = 55;
18
19 patch(ApplyConfiguratorScreen.prototype, {
20
21 /**
22 * @override to include eCommerce pages style configuration.
23 */
24 getConfigurationData() {
25 const data = super.getConfigurationData(...arguments);
26 return Object.assign(data, {
27 'shop_page_style_option': this.state.selectedShopPageStyleOption,
28 'product_page_style_option': this.state.selectedProductPageStyleOption,
29 });
30 },
31
32 })
33
34 patch(FeaturesSelectionScreen, {
35
36 /**
37 * @override to redirect to the shop page selection screen.
38 */
39 nextStep() {
40 return ROUTES.shopPageSelectionScreen;
41 },
42
43 });
44
45 patch(Configurator, {
46
47 components: {
48 ...Configurator.components,
49 ShopPageSelectionScreen,
50 ProductPageSelectionScreen,
51 },
52
53 })
54
55 patch(Configurator.prototype, {
56
57 /**
58 * @override to include eCommerce's selection screen components.
59 */
60 get currentComponent() {
61 if (this.state.currentStep === ROUTES.shopPageSelectionScreen) {
62 return ShopPageSelectionScreen;
63 }
64 if (this.state.currentStep === ROUTES.productPageSelectionScreen) {
65 return ProductPageSelectionScreen;
66 }
67 return super.currentComponent;
68 },
69
70 /**
71 * @override to include eCommerce's initial page style values.
72 */
73 async getInitialState() {
74 const initState = await super.getInitialState(...arguments);
75 initState.selectedShopPageStyleOption = undefined;
76 initState.selectedProductPageStyleOption = undefined;
77 return initState;
78 },
79
80 })