@whatmore-repo/whatmore-reactnative-sdk 1.0.27 → 1.0.29

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/index.js CHANGED
@@ -24,7 +24,7 @@ export function WhatmoreBase(props){
24
24
  // );
25
25
 
26
26
  return (
27
- <WhatmoreRootComponent shopId={props.shopId} onAction={props.onAction} />
27
+ <WhatmoreRootComponent shopId={props.shopId} onAction={props.onAction} customStyles={props.customStyles} />
28
28
  );
29
29
  }
30
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatmore-repo/whatmore-reactnative-sdk",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "index.js",
@@ -13,7 +13,7 @@ function handleClick(product, props){
13
13
  })
14
14
  }
15
15
 
16
- export async function navigateToProductPage(product, brandDomainContext, whatmoreShopId, props) {
16
+ export async function navigateToProductPage(product, brandDomainContext, whatmoreShopId, props, navigation) {
17
17
  const _ACTIVATE_MOCK_ = getGlobalState("activateMock");
18
18
  if (_ACTIVATE_MOCK_) {
19
19
  return Promise.resolve(true);
@@ -26,6 +26,14 @@ export async function navigateToProductPage(product, brandDomainContext, whatmor
26
26
  if(isAppMaker(brandDomainContext)){
27
27
  return handleClick(product, props);
28
28
  }
29
-
29
+ else {
30
+ const parts = product?.product_link?.split('/');
31
+ const sku = parts?.[parts?.length - 1];
32
+ navigation.navigate(
33
+ 'ProductDetail',
34
+ {url: sku}
35
+ )
36
+ props.setIsModalOpen(false);
37
+ }
30
38
  return Promise.resolve(false);
31
39
  }
@@ -89,7 +89,7 @@ export default function WhatmoreRootComponent(props) {
89
89
 
90
90
  return (
91
91
  <>
92
- {isInstaReelView.includes(brandId) && <EventTileWithProduct isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} events={data} setInitialEventIndex={setInitialEventIndex} />}
92
+ {isInstaReelView.includes(brandId) && <EventTileWithProduct customStyles={props.customStyles} isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} events={data} setInitialEventIndex={setInitialEventIndex} />}
93
93
  {(isModalOpen) && <EventClickComponent isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} events={data} initialEventIndex={initialEventIndex} onAction={props.onAction} /> }
94
94
  </>
95
95
  );
@@ -10,18 +10,20 @@ export default function EventTileWithProduct(props) {
10
10
  const [activeIndex, setActiveIndex] = useState(1);
11
11
  const [renderedEvents, setRenderedEvents] = useState(5)
12
12
  const { width } = Dimensions.get('window');
13
+ const customStyles = props.customStyles;
13
14
  const ITEM_WIDTH = width * 0.33;
14
- const CARD_HEIGHT = 200;
15
+ const CARD_HEIGHT = 40*(customStyles?.videoTileSize ?? 5);
15
16
 
16
17
  const styles = StyleSheet.create({
17
18
  container: {
18
19
  position: 'relative',
19
20
  width: '100%',
20
- height: 250,
21
+ height: CARD_HEIGHT + 50,
21
22
  },
22
23
  arrowContainerRight: {
23
24
  position: 'absolute',
24
- top: 90,
25
+ top: '50%',
26
+ transform: [{ translateY: -30 }],
25
27
  right: 0,
26
28
  width: 28,
27
29
  height: 28,
@@ -29,7 +31,8 @@ export default function EventTileWithProduct(props) {
29
31
  },
30
32
  arrowContainerLeft: {
31
33
  position: 'absolute',
32
- top: 90,
34
+ top: '50%',
35
+ transform: [{ translateY: -30 }],
33
36
  width: 28,
34
37
  height: 28,
35
38
  marginHorizontal: 5,
@@ -40,7 +43,7 @@ export default function EventTileWithProduct(props) {
40
43
  setInitialEventIndex(index);
41
44
  setIsModalOpen(true);
42
45
  };
43
-
46
+
44
47
  const { events, isModalOpen, setInitialEventIndex, setIsModalOpen } = props;
45
48
  // const [pausedVideos, setPausedVideos] = useState({});
46
49
  // const handleVideoLoad = (index) => {
@@ -96,7 +99,7 @@ export default function EventTileWithProduct(props) {
96
99
  transform: [{ scale: 1.1 }],
97
100
  width: ITEM_WIDTH,
98
101
  height: CARD_HEIGHT,
99
- marginHorizontal: 8,
102
+ marginHorizontal: 5*(customStyles?.videoTileSpacing ?? 3),
100
103
  top: 20,
101
104
  // elevation: 1
102
105
  }}
@@ -110,7 +113,6 @@ export default function EventTileWithProduct(props) {
110
113
  <SafeAreaView style={styles.container}>
111
114
  <Animated.FlatList
112
115
  horizontal
113
- style={{paddingLeft: 10}}
114
116
  data={events.slice(0,renderedEvents)}
115
117
  renderItem={renderItem}
116
118
  contentInsetAdjustmentBehavior="never"
@@ -124,7 +126,7 @@ export default function EventTileWithProduct(props) {
124
126
  <TouchableOpacity style={styles.arrowContainerLeft} onPress={scrollLeft}>
125
127
  <ChevronLeftIcon />
126
128
  </TouchableOpacity>
127
- <TouchableOpacity style={styles.arrowContainerRight} onPress={scrollRight}>
129
+ <TouchableOpacity style={styles.arrowContainerRight} onPress={scrollRight}>
128
130
  <ChevronRightIcon />
129
131
  </TouchableOpacity>
130
132
  </SafeAreaView>
@@ -8,8 +8,10 @@ import useAddToCartStates from '../../hooks/useAddToCartStates.js';
8
8
  import * as Animatable from 'react-native-animatable';
9
9
  import ShopNow from '../cta-buttons/ShopNowButton.jsx';
10
10
  import { navigateToProductPage } from '../../api/navigation-commands/NavigationCommands.js';
11
+ import { useNavigation } from '@react-navigation/native';
11
12
 
12
13
  export default function ProductTileV1(props) {
14
+ const navigation = useNavigation();
13
15
  const event = props.event;
14
16
  const product = props.product;
15
17
  const [tileTapAnimate, setTileTapAnimate] = useState(false);
@@ -31,7 +33,7 @@ export default function ProductTileV1(props) {
31
33
  <TouchableWithoutFeedback
32
34
  onPress={() => {
33
35
  setTileTapAnimate(true);
34
- navigateToProductPage(product, brandDomainContext, whatmoreShopId, props);
36
+ navigateToProductPage(product, brandDomainContext, whatmoreShopId, props, navigation);
35
37
  }}
36
38
  >
37
39
  <Animatable.View