From 074b1e58e6f17ad0436281e03af06d58b1f22ccf Mon Sep 17 00:00:00 2001 From: levenecav Date: Tue, 19 Feb 2019 17:16:24 +0300 Subject: [PATCH] Leve/hotfix/19 02 release testing (#940) * fix edits by release testing * rr view edits --- src/pages/Store/Product/Product.js | 20 ++++++++++++- src/pages/Store/Product/RRElement/index.js | 35 +++++++++++++--------- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/pages/Store/Product/Product.js b/src/pages/Store/Product/Product.js index e25de233..74e15db9 100644 --- a/src/pages/Store/Product/Product.js +++ b/src/pages/Store/Product/Product.js @@ -569,11 +569,29 @@ class Product extends Component { {this.makeTabs(longDescription)} + {/* + +
+ +
+
+ */} + {/* + +
+ +
+
+ */}
- +
diff --git a/src/pages/Store/Product/RRElement/index.js b/src/pages/Store/Product/RRElement/index.js index 73fb1602..75f0929a 100644 --- a/src/pages/Store/Product/RRElement/index.js +++ b/src/pages/Store/Product/RRElement/index.js @@ -1,7 +1,7 @@ // @flow strict import React, { Component } from 'react'; -import { map, isEmpty, dissoc, take, filter, isNil } from 'ramda'; +import { map, isEmpty, dissoc, take, filter, isNil, assoc } from 'ramda'; import { Environment } from 'relay-runtime'; import classNames from 'classnames'; // $FlowIgnore @@ -59,6 +59,8 @@ type PropsType = { productId: number, fullWidth?: boolean, environment: Environment, + dataVendor?: string, + title?: string, }; class RRElement extends Component { @@ -72,22 +74,25 @@ class RRElement extends Component { componentDidMount() { this.isMount = true; - const { productId } = this.props; + const { productId, dataVendor } = this.props; + let params = { + itemIds: `${productId}`, + format: 'json', + }; + + if (dataVendor === 'brand') { + params = assoc('vendor', 'brand', params); + } axios .get( 'https://api.retailrocket.net/api/2.0/recommendation/alternative/5ba8ba0797a5281c5c422860', - { - params: { - itemIds: `${productId}`, - format: 'json', - }, - }, + { params }, ) .then(({ data }) => { if (data && !isEmpty(data)) { const ids = map(item => item.ItemId, data); - this.fetchData(take(4, ids)); + this.fetchData(ids); } return true; }) @@ -123,7 +128,7 @@ class RRElement extends Component { }, }; // $FlowIgnore - }, filter(item => !isNil(item.baseProduct), products)), + }, take(4, filter(item => !isNil(item.baseProduct), products))), }); return true; }) @@ -134,16 +139,18 @@ class RRElement extends Component { }; render() { - const { fullWidth } = this.props; + const { fullWidth, title } = this.props; const { items } = this.state; if (isEmpty(items)) { return null; } return (
-
- Similar goods -
+ {!isNil(title) && ( +
+ Similar goods +
+ )}
{map( item => (