@whatmore-repo/whatmore-reactnative-sdk 1.0.17 → 1.0.19

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} />
27
+ <WhatmoreRootComponent shopId={props.shopId} onAction={props.onAction} />
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.17",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "index.js",
@@ -22,7 +22,7 @@ export default function EventClickComponent(props) {
22
22
  {
23
23
  modalUsed
24
24
  ?
25
- <EventsVerticalSwipeView events={props.events} initialEventIndex={props.initialEventIndex} />
25
+ <EventsVerticalSwipeView events={props.events} onAction={props.onAction} initialEventIndex={props.initialEventIndex} />
26
26
  :
27
27
  <EventsVerticalSwipeViewNoModal events={props.events} initialEventIndex={props.initialEventIndex} />
28
28
  }
@@ -60,7 +60,7 @@ export default function EventShoppingOverlay(props) {
60
60
  {
61
61
  event.products.map((product, index) => {
62
62
  return (
63
- index == 0 && <ProductTileV1 key={index} event={event} product={product} />
63
+ index == 0 && <ProductTileV1 key={index} setModalVisible={props.setModalVisible} onAction={props.onAction} event={event} product={product} />
64
64
  );
65
65
  })
66
66
  }
@@ -29,7 +29,7 @@ export default function EventShoppingView(props) {
29
29
  backgroundColor: 'transparent',
30
30
  }}
31
31
  >
32
- <EventShoppingOverlay event={event} />
32
+ <EventShoppingOverlay setModalVisible={props.setModalVisible} event={event} onAction={props.onAction} />
33
33
  </View>
34
34
  </View>
35
35
  );
@@ -48,7 +48,7 @@ export default function EventsVerticalSwipeView(props) {
48
48
  backgroundColor: 'transparent'
49
49
  }}
50
50
  >
51
- <EventShoppingView event={event} eventIndex={eventIndex} />
51
+ <EventShoppingView setModalVisible={setModalVisible} onAction={props.onAction} event={event} eventIndex={eventIndex} />
52
52
  </View>
53
53
  )
54
54
  })
@@ -84,6 +84,6 @@ export default function WhatmoreRootComponent(props) {
84
84
  logEventData && console.log("valid events size : " + data.length);
85
85
 
86
86
  return (
87
- <EventClickComponent events={data} initialEventIndex={0} />
87
+ <EventClickComponent events={data} initialEventIndex={0} onAction={props.onAction} />
88
88
  );
89
89
  }
@@ -129,7 +129,7 @@ function AddToCartInitialButton(props){
129
129
  color: 'white'
130
130
  }}
131
131
  >
132
- &nbsp;{"SHOP NOW"}&nbsp;
132
+ &nbsp;{"ADD TO CART"}&nbsp;
133
133
  </Text>
134
134
  </View>
135
135
  </TouchableOpacity>
@@ -26,15 +26,15 @@ function ShopNow(props){
26
26
  <View
27
27
  style={{
28
28
  width: '100%',
29
- height: 'auto',
29
+ height: '100%',
30
30
  alignItems: 'center',
31
31
  justifyContent: 'center',
32
- paddingVertical: 5
32
+ // paddingVertical: 5
33
33
  }}
34
34
  >
35
35
  <Text
36
36
  style={{
37
- fontSize: 26,
37
+ fontSize: props.fontSize,
38
38
  fontWeight: 'bold',
39
39
  fontFamily: whatmorePrimaryFont,
40
40
  color: 'white'
@@ -28,7 +28,7 @@ export default function ProductPriceBadge(props) {
28
28
  color: color
29
29
  }}
30
30
  >
31
- {getPriceStringWithCurrency(product.price)}
31
+ {getPriceStringWithCurrency(product.price, "",product.currency ?? "INR")}
32
32
  </Text>
33
33
  <Text
34
34
  numberOfLines={1}
@@ -43,7 +43,7 @@ export default function ProductPriceBadge(props) {
43
43
  fontSize: fontSize
44
44
  }}
45
45
  >
46
- {getPriceStringWithCurrency(product.compare_price)}
46
+ {getPriceStringWithCurrency(product.compare_price, "", product.currency ?? "INR")}
47
47
  </Text>
48
48
 
49
49
  </View>
@@ -1,36 +1,19 @@
1
- import { getGlobalState, setGlobalState, useGlobalState } from '../../globals/useAppState_APP.js';
1
+ import { getGlobalState } from '../../globals/useAppState_APP.js';
2
2
  import { Image, Text} from 'react-native';
3
3
  import ProductPriceBadge from './ProductPriceBadge.js';
4
4
 
5
- import React, { useEffect, useRef, useState } from 'react';
6
- import { View, TouchableOpacity, ScrollView, Dimensions, TouchableWithoutFeedback } from 'react-native';
7
- import SelectVariantComponent from './SelectVariantComponent';
5
+ import React, { useEffect, useState } from 'react';
6
+ import { View, Dimensions, TouchableWithoutFeedback } from 'react-native';
8
7
  import useAddToCartStates from '../../hooks/useAddToCartStates.js';
9
- import AddToCartButton from '../cta-buttons/AddToCartButton.jsx';
10
8
  import * as Animatable from 'react-native-animatable';
11
- import { navigateToProductPage } from '../../api/navigation-commands/NavigationCommands.js';
12
- import {handleAction} from '@appmaker-xyz/react-native';
13
9
  import ShopNow from '../cta-buttons/ShopNowButton.jsx';
14
10
 
15
11
  export default function ProductTileV1(props) {
16
12
  const event = props.event;
17
13
  const product = props.product;
18
-
19
- const [cartState, productVariantOptions, initiateVariantSelection, initiateAtcApiCall, getPriceDetailsFromSelectedOption, initiateAtcCartIconClickAction] = useAddToCartStates(0, product, props.event);
20
- const [selectedOptions, setSelectedOptions] = useState(null);
21
14
  const [tileTapAnimate, setTileTapAnimate] = useState(false);
22
-
23
- const [productVariantPrice, setProductVariantPrice] = useState(parseFloat(product.price));
24
- const [productVariantComparePrice, setProductVariantComparePrice] = useState(parseFloat(product.compare_price));
25
-
26
- const whatmorePrimaryColor = getGlobalState('whatmorePrimaryColor');
27
15
  const whatmorePrimaryFont = getGlobalState('whatmorePrimaryFont');
28
-
29
- const brandDomainContext = getGlobalState('brandDomainContext');
30
- const whatmoreShopId = getGlobalState('whatmoreShopId');
31
-
32
16
  const PRODUCT_TILE_TOTAL_HEIGHT = Dimensions.get('window').height * 0.2;
33
- const SELECT_VARIANT_TILE_HEIGHT_FACTOR = 3.0;
34
17
  const BASE_FONT_SIZE = 20;
35
18
 
36
19
  useEffect(() => {
@@ -41,19 +24,11 @@ export default function ProductTileV1(props) {
41
24
  }
42
25
  }, [tileTapAnimate]);
43
26
 
44
- function _updateSelectedOptions(_selectedOptions){
45
- setSelectedOptions(_selectedOptions);
46
-
47
- // set price to selected option
48
- const optionPriceDetails = getPriceDetailsFromSelectedOption(_selectedOptions);
49
27
 
50
- if(optionPriceDetails){
51
- setProductVariantPrice(optionPriceDetails['price']);
52
- setProductVariantComparePrice(optionPriceDetails['compare_price']);
53
- }
54
- }
55
28
  function handleClick(){
56
- handleAction({
29
+ console.log('click')
30
+ props.setModalVisible(false);
31
+ props.onAction({
57
32
  action: "OPEN_PRODUCT",
58
33
  params:{
59
34
  productId: 'gid://shopify/Product/' + product.client_product_id
@@ -64,7 +39,7 @@ export default function ProductTileV1(props) {
64
39
  <TouchableWithoutFeedback
65
40
  onPress={() => {
66
41
  setTileTapAnimate(true);
67
- navigateToProductPage(product, brandDomainContext, whatmoreShopId);
42
+ // navigateToProductPage(product, brandDomainContext, whatmoreShopId);
68
43
  handleClick();
69
44
  }}
70
45
  >
@@ -89,7 +64,9 @@ export default function ProductTileV1(props) {
89
64
  duration={100} iterationCount={1}
90
65
  easing="ease-out"
91
66
  style={{
92
- width: '100%', height: 'auto',
67
+ width: '90%', // Adjust width as needed, e.g., '80%'
68
+ alignSelf: 'center',
69
+ height: 'auto',
93
70
  flexDirection: 'column', justifyContent: 'flex-start', alignItems: 'center',
94
71
  borderRadius: 5, overflow: 'hidden',
95
72
  shadowColor: 'black', shadowOpacity: 1, shadowOffset: {width: 0, height: 0},
@@ -129,7 +106,7 @@ export default function ProductTileV1(props) {
129
106
 
130
107
  fontWeight: 'normal',
131
108
  fontFamily: whatmorePrimaryFont,
132
- fontSize: BASE_FONT_SIZE * 1,
109
+ fontSize: BASE_FONT_SIZE * 0.9,
133
110
  color: 'black',
134
111
  overflow: 'hidden',
135
112
 
@@ -144,10 +121,7 @@ export default function ProductTileV1(props) {
144
121
  }}
145
122
  ></View>
146
123
 
147
- <ProductPriceBadge product={product} event={event} fontSize={BASE_FONT_SIZE * 1} color={'black'} />
148
- {/* <Text>
149
- {product.price.toString()}
150
- </Text> */}
124
+ <ProductPriceBadge product={product} event={event} fontSize={BASE_FONT_SIZE * 0.9} color={'black'} />
151
125
  </View>
152
126
 
153
127
 
@@ -156,46 +130,17 @@ export default function ProductTileV1(props) {
156
130
  <View
157
131
  style={{
158
132
  width: '100%', height: 'auto',
159
- backgroundColor: '#ffffffdd',
133
+ backgroundColor: '#fff',
160
134
  overflow: 'hidden'
161
135
  }}
162
136
 
163
137
  >
164
- {cartState['state'] === "awaitingVariantSelection" && productVariantOptions &&
165
- <ScrollView
166
- style={{
167
- width: '100%',
168
- height: 'auto',
169
- marginTop: 5,
170
- marginBottom: 10,
171
- maxHeight: PRODUCT_TILE_TOTAL_HEIGHT * SELECT_VARIANT_TILE_HEIGHT_FACTOR
172
- }}
173
- >
174
- <Animatable.View
175
- animation="fadeIn"
176
- duration={500} iterationCount={1}
177
- easing="ease-in-out"
178
- style={{
179
- height: 'auto', width: '100%'
180
- }}
181
- >
182
- <SelectVariantComponent
183
- width='100%'
184
- height='auto'
185
- event={event}
186
- product={product}
187
- productVariantOptions={productVariantOptions}
188
- baseFontSize={BASE_FONT_SIZE * 0.9}
189
- onOptionSelected={_updateSelectedOptions}
190
- />
191
- </Animatable.View>
192
- </ScrollView>
193
- }
194
138
 
195
139
  <View style={{ flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center'}}>
196
140
  <ShopNow
197
141
  height={PRODUCT_TILE_TOTAL_HEIGHT * 0.3}
198
142
  onClick={handleClick}
143
+ fontSize={BASE_FONT_SIZE*1.1}
199
144
  />
200
145
  </View>
201
146
  </View>
@@ -35,7 +35,7 @@ export default function AppVideoPlayer(props) {
35
35
  right: 0,
36
36
  width: '100%', height: '100%'
37
37
  }}
38
- onLoad={handleLoad} // Call handleLoad when video is loaded
38
+ onLoad={handleLoad}
39
39
  />
40
40
  </>
41
41
  )
@@ -13,7 +13,7 @@ function roundedPrice(price){
13
13
  if(priceAsString.split('.')[0].length >= 4){
14
14
  return parseInt(price);
15
15
  }
16
- return price.toFixed(2);
16
+ return parseFloat(price)?.toFixed(2);
17
17
  }
18
18
 
19
19
  return parseInt(price);