@whatmore-repo/whatmore-reactnative-sdk 1.0.19 → 1.0.20
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whatmore-repo/whatmore-reactnative-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"react-hooks-global-state": "^2.1.0",
|
|
16
16
|
"react-native-animatable": "^1.3.3",
|
|
17
17
|
"react-native-intersection-observer": "^0.0.9",
|
|
18
|
-
"react-native-
|
|
18
|
+
"react-native-snap-carousel": "^3.9.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/core": "^7.20.0"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.2.0",
|
|
25
25
|
"react-native": "^0.72.1",
|
|
26
|
-
"react-native-
|
|
27
|
-
"react-native-
|
|
26
|
+
"react-native-svg": "13.9.0",
|
|
27
|
+
"react-native-video": "^5.2.1"
|
|
28
28
|
},
|
|
29
29
|
"author": "Shyam",
|
|
30
30
|
"license": "ISC"
|
|
@@ -3,7 +3,17 @@ import { getGlobalState } from "../../globals/useAppState_APP.js";
|
|
|
3
3
|
import { isAppBrew, isAppMaker, isPlobalApps } from "../partners/PartnerUtils.js";
|
|
4
4
|
import { appbrewNavigateToProductPageCommand } from "../partners/appbrew/AppbrewCommands.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function handleClick(product, props){
|
|
7
|
+
props.setModalVisible(false);
|
|
8
|
+
props.onAction({
|
|
9
|
+
action: "OPEN_PRODUCT",
|
|
10
|
+
params:{
|
|
11
|
+
productId: 'gid://shopify/Product/' + product.client_product_id
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function navigateToProductPage(product, brandDomainContext, whatmoreShopId, props) {
|
|
7
17
|
const _ACTIVATE_MOCK_ = getGlobalState("activateMock");
|
|
8
18
|
if (_ACTIVATE_MOCK_) {
|
|
9
19
|
return Promise.resolve(true);
|
|
@@ -13,5 +23,9 @@ export async function navigateToProductPage(product, brandDomainContext, whatmor
|
|
|
13
23
|
return await appbrewNavigateToProductPageCommand(product, whatmoreShopId);
|
|
14
24
|
}
|
|
15
25
|
|
|
26
|
+
if(isAppMaker(brandDomainContext)){
|
|
27
|
+
return handleClick(product, props);
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
return Promise.resolve(false);
|
|
17
31
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Text, TouchableOpacity, View, StyleSheet, Image, SafeAreaView, FlatList, Dimensions } from "react-native";
|
|
3
|
+
import { getGlobalState } from '../../globals/useAppState_APP';
|
|
4
|
+
import Swiper from 'react-native-swiper';
|
|
5
|
+
import Video from 'react-native-video';
|
|
6
|
+
import { useState, useEffect } from 'react';
|
|
7
|
+
import Carousel from 'react-native-snap-carousel'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default function EventTileWithProduct(props) {
|
|
11
|
+
|
|
12
|
+
const events = props.events;
|
|
13
|
+
const { width } = Dimensions.get('window');
|
|
14
|
+
const isCarousel = React.useRef(null)
|
|
15
|
+
const SLIDER_WIDTH = Dimensions.get('window').width + 80
|
|
16
|
+
const ITEM_WIDTH = Math.round(SLIDER_WIDTH * 0.7)
|
|
17
|
+
|
|
18
|
+
function handleClick(props, index){
|
|
19
|
+
console.log('hello', index)
|
|
20
|
+
props.setInitialEventIndex(index);
|
|
21
|
+
props.setIsModalOpen(true);
|
|
22
|
+
}
|
|
23
|
+
return (
|
|
24
|
+
<SafeAreaView style={{
|
|
25
|
+
width: '100%',
|
|
26
|
+
height: '100%'
|
|
27
|
+
}}>
|
|
28
|
+
<View>
|
|
29
|
+
<Carousel
|
|
30
|
+
layout="tinder"
|
|
31
|
+
layoutCardOffset={9}
|
|
32
|
+
ref={isCarousel}
|
|
33
|
+
// data={data}
|
|
34
|
+
// renderItem={CarouselCardItem}
|
|
35
|
+
sliderWidth={SLIDER_WIDTH}
|
|
36
|
+
itemWidth={ITEM_WIDTH}
|
|
37
|
+
inactiveSlideShift={0}
|
|
38
|
+
useScrollView={true}
|
|
39
|
+
/>
|
|
40
|
+
</View>
|
|
41
|
+
{/* <View
|
|
42
|
+
style={{
|
|
43
|
+
flex: 1,
|
|
44
|
+
height: '100%',
|
|
45
|
+
width: '100%'
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<FlatList
|
|
49
|
+
data={events}
|
|
50
|
+
horizontal
|
|
51
|
+
keyExtractor={(item, index) => index.toString()}
|
|
52
|
+
renderItem={({ item, index }) => (
|
|
53
|
+
<TouchableOpacity onPress={()=>handleClick(props, index)} style={{ width: width / 2.5, height: width / 2 }}>
|
|
54
|
+
<Video
|
|
55
|
+
source={{ uri: item.thumbnail_image }}
|
|
56
|
+
style={{ width: '100%', height: '100%' }}
|
|
57
|
+
controls={false}
|
|
58
|
+
muted
|
|
59
|
+
repeat
|
|
60
|
+
/>
|
|
61
|
+
</TouchableOpacity>
|
|
62
|
+
)}
|
|
63
|
+
/> */}
|
|
64
|
+
{/* <Swiper horizontal={true}
|
|
65
|
+
style={{}}
|
|
66
|
+
|
|
67
|
+
loop={true}
|
|
68
|
+
showsPagination={false}
|
|
69
|
+
loadMinimal={true}
|
|
70
|
+
loadMinimalSize={1}
|
|
71
|
+
>
|
|
72
|
+
{
|
|
73
|
+
events.map((event, index) => {
|
|
74
|
+
// console.log(event.thumbnail_image,'p')
|
|
75
|
+
return (
|
|
76
|
+
<View
|
|
77
|
+
key={index}
|
|
78
|
+
style={{
|
|
79
|
+
width: '100%', height: '100%', backgroundColor: 'gray'
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<Video source = {{uri: event.thumbnail_image}}
|
|
83
|
+
style={{
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
top: 0,
|
|
86
|
+
left: 0,
|
|
87
|
+
bottom: 0,
|
|
88
|
+
right: 0,
|
|
89
|
+
width: '100%', height: '100%'
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
</View>
|
|
94
|
+
)
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
</Swiper> */}
|
|
98
|
+
{/* </View> */}
|
|
99
|
+
</SafeAreaView>
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
@@ -5,23 +5,23 @@ function ShopNow(props){
|
|
|
5
5
|
const whatmorePrimaryColor = getGlobalState('whatmorePrimaryColor');
|
|
6
6
|
const whatmorePrimaryFont = getGlobalState('whatmorePrimaryFont');
|
|
7
7
|
|
|
8
|
-
const onClick = props.onClick;
|
|
8
|
+
// const onClick = props.onClick;
|
|
9
9
|
const height = props.height;
|
|
10
10
|
|
|
11
11
|
const BOX_PADDING = 2;
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<
|
|
14
|
+
<View
|
|
15
15
|
style={{
|
|
16
16
|
width: '100%',
|
|
17
17
|
height: height,
|
|
18
18
|
padding: BOX_PADDING,
|
|
19
19
|
backgroundColor: whatmorePrimaryColor
|
|
20
20
|
}}
|
|
21
|
-
onPress={(e) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}}
|
|
21
|
+
// onPress={(e) => {
|
|
22
|
+
// e.stopPropagation();
|
|
23
|
+
// // onClick();
|
|
24
|
+
// }}
|
|
25
25
|
>
|
|
26
26
|
<View
|
|
27
27
|
style={{
|
|
@@ -43,7 +43,7 @@ function ShopNow(props){
|
|
|
43
43
|
{"SHOP NOW"}
|
|
44
44
|
</Text>
|
|
45
45
|
</View>
|
|
46
|
-
</
|
|
46
|
+
</View>
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -7,12 +7,15 @@ import { View, Dimensions, TouchableWithoutFeedback } from 'react-native';
|
|
|
7
7
|
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
|
+
import { navigateToProductPage } from '../../api/navigation-commands/NavigationCommands.js';
|
|
10
11
|
|
|
11
12
|
export default function ProductTileV1(props) {
|
|
12
13
|
const event = props.event;
|
|
13
14
|
const product = props.product;
|
|
14
15
|
const [tileTapAnimate, setTileTapAnimate] = useState(false);
|
|
15
16
|
const whatmorePrimaryFont = getGlobalState('whatmorePrimaryFont');
|
|
17
|
+
const brandDomainContext = getGlobalState('brandDomainContext');
|
|
18
|
+
const whatmoreShopId = getGlobalState('whatmoreShopId');
|
|
16
19
|
const PRODUCT_TILE_TOTAL_HEIGHT = Dimensions.get('window').height * 0.2;
|
|
17
20
|
const BASE_FONT_SIZE = 20;
|
|
18
21
|
|
|
@@ -24,23 +27,11 @@ export default function ProductTileV1(props) {
|
|
|
24
27
|
}
|
|
25
28
|
}, [tileTapAnimate]);
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
function handleClick(){
|
|
29
|
-
console.log('click')
|
|
30
|
-
props.setModalVisible(false);
|
|
31
|
-
props.onAction({
|
|
32
|
-
action: "OPEN_PRODUCT",
|
|
33
|
-
params:{
|
|
34
|
-
productId: 'gid://shopify/Product/' + product.client_product_id
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
30
|
return (
|
|
39
31
|
<TouchableWithoutFeedback
|
|
40
32
|
onPress={() => {
|
|
41
33
|
setTileTapAnimate(true);
|
|
42
|
-
|
|
43
|
-
handleClick();
|
|
34
|
+
navigateToProductPage(product, brandDomainContext, whatmoreShopId, props);
|
|
44
35
|
}}
|
|
45
36
|
>
|
|
46
37
|
<Animatable.View
|
|
@@ -139,7 +130,6 @@ export default function ProductTileV1(props) {
|
|
|
139
130
|
<View style={{ flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center'}}>
|
|
140
131
|
<ShopNow
|
|
141
132
|
height={PRODUCT_TILE_TOTAL_HEIGHT * 0.3}
|
|
142
|
-
onClick={handleClick}
|
|
143
133
|
fontSize={BASE_FONT_SIZE*1.1}
|
|
144
134
|
/>
|
|
145
135
|
</View>
|