@moneylion/react-native-offer-carousel 1.2.0 → 1.2.2
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/lib/commonjs/capabilities/offer-catalog/src/utils/getEventCallbackContext.js +11 -0
- package/lib/commonjs/capabilities/offer-catalog/src/utils/getEventCallbackContext.js.map +1 -0
- package/lib/commonjs/components/Button/index.js +4 -2
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js +1 -1
- package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
- package/lib/commonjs/components/Common/BaseOfferCard/index.js +15 -8
- package/lib/commonjs/components/Common/BaseOfferCard/index.js.map +1 -1
- package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js +7 -6
- package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
- package/lib/commonjs/components/Common/DynamicOfferCard/index.js +7 -3
- package/lib/commonjs/components/Common/DynamicOfferCard/index.js.map +1 -1
- package/lib/commonjs/components/DynamicOffers/DynamicOffers.js +10 -2
- package/lib/commonjs/components/DynamicOffers/DynamicOffers.js.map +1 -1
- package/lib/commonjs/components/DynamicOffers/Render/DynamicOffersRender.js +180 -63
- package/lib/commonjs/components/DynamicOffers/Render/DynamicOffersRender.js.map +1 -1
- package/lib/commonjs/components/DynamicOffers/Render/FallbackOfferTemplate.js +4 -2
- package/lib/commonjs/components/DynamicOffers/Render/FallbackOfferTemplate.js.map +1 -1
- package/lib/commonjs/components/DynamicOffers/Render/Offer.js +15 -5
- package/lib/commonjs/components/DynamicOffers/Render/Offer.js.map +1 -1
- package/lib/commonjs/components/DynamicOffers/SeeAllButton.js +30 -0
- package/lib/commonjs/components/DynamicOffers/SeeAllButton.js.map +1 -0
- package/lib/commonjs/components/Layouts/CreditCardOfferCard/index.js +9 -4
- package/lib/commonjs/components/Layouts/CreditCardOfferCard/index.js.map +1 -1
- package/lib/commonjs/components/Layouts/DefaultOfferCard/index.js +8 -3
- package/lib/commonjs/components/Layouts/DefaultOfferCard/index.js.map +1 -1
- package/lib/commonjs/components/Layouts/HeadlineWithDescriptionCard/index.js +8 -3
- package/lib/commonjs/components/Layouts/HeadlineWithDescriptionCard/index.js.map +1 -1
- package/lib/commonjs/components/Modal/AllOffersModal.js +180 -0
- package/lib/commonjs/components/Modal/AllOffersModal.js.map +1 -0
- package/lib/commonjs/components/Modal/OfferDetailsModal.js +4 -2
- package/lib/commonjs/components/Modal/OfferDetailsModal.js.map +1 -1
- package/lib/commonjs/components/MoneyLionOfferCarousel.js +2 -1
- package/lib/commonjs/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/commonjs/context/EventHandlerProvider.js.map +1 -1
- package/lib/module/capabilities/offer-catalog/src/utils/getEventCallbackContext.js +4 -0
- package/lib/module/capabilities/offer-catalog/src/utils/getEventCallbackContext.js.map +1 -0
- package/lib/module/components/Button/index.js +4 -2
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js +1 -1
- package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
- package/lib/module/components/Common/BaseOfferCard/index.js +16 -9
- package/lib/module/components/Common/BaseOfferCard/index.js.map +1 -1
- package/lib/module/components/Common/DynamicOfferCard/SeeMore.js +7 -6
- package/lib/module/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
- package/lib/module/components/Common/DynamicOfferCard/index.js +7 -3
- package/lib/module/components/Common/DynamicOfferCard/index.js.map +1 -1
- package/lib/module/components/DynamicOffers/DynamicOffers.js +10 -2
- package/lib/module/components/DynamicOffers/DynamicOffers.js.map +1 -1
- package/lib/module/components/DynamicOffers/Render/DynamicOffersRender.js +180 -63
- package/lib/module/components/DynamicOffers/Render/DynamicOffersRender.js.map +1 -1
- package/lib/module/components/DynamicOffers/Render/FallbackOfferTemplate.js +4 -2
- package/lib/module/components/DynamicOffers/Render/FallbackOfferTemplate.js.map +1 -1
- package/lib/module/components/DynamicOffers/Render/Offer.js +15 -5
- package/lib/module/components/DynamicOffers/Render/Offer.js.map +1 -1
- package/lib/module/components/DynamicOffers/SeeAllButton.js +22 -0
- package/lib/module/components/DynamicOffers/SeeAllButton.js.map +1 -0
- package/lib/module/components/Layouts/CreditCardOfferCard/index.js +9 -4
- package/lib/module/components/Layouts/CreditCardOfferCard/index.js.map +1 -1
- package/lib/module/components/Layouts/DefaultOfferCard/index.js +8 -3
- package/lib/module/components/Layouts/DefaultOfferCard/index.js.map +1 -1
- package/lib/module/components/Layouts/HeadlineWithDescriptionCard/index.js +8 -3
- package/lib/module/components/Layouts/HeadlineWithDescriptionCard/index.js.map +1 -1
- package/lib/module/components/Modal/AllOffersModal.js +170 -0
- package/lib/module/components/Modal/AllOffersModal.js.map +1 -0
- package/lib/module/components/Modal/OfferDetailsModal.js +4 -2
- package/lib/module/components/Modal/OfferDetailsModal.js.map +1 -1
- package/lib/module/components/MoneyLionOfferCarousel.js +2 -1
- package/lib/module/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/module/context/EventHandlerProvider.js.map +1 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/getEventCallbackContext.d.ts +2 -0
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/getEventCallbackContext.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/index.d.ts +3 -0
- package/lib/typescript/src/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts +2 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/CallToAction.d.ts +1 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/CallToAction.d.ts.map +1 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/SeeMore.d.ts +2 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/SeeMore.d.ts.map +1 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/index.d.ts +3 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/index.d.ts.map +1 -1
- package/lib/typescript/src/components/DynamicOffers/DynamicOffers.d.ts +2 -2
- package/lib/typescript/src/components/DynamicOffers/DynamicOffers.d.ts.map +1 -1
- package/lib/typescript/src/components/DynamicOffers/Render/DynamicOffersRender.d.ts +8 -1
- package/lib/typescript/src/components/DynamicOffers/Render/DynamicOffersRender.d.ts.map +1 -1
- package/lib/typescript/src/components/DynamicOffers/Render/FallbackOfferTemplate.d.ts +2 -1
- package/lib/typescript/src/components/DynamicOffers/Render/FallbackOfferTemplate.d.ts.map +1 -1
- package/lib/typescript/src/components/DynamicOffers/Render/Offer.d.ts +7 -2
- package/lib/typescript/src/components/DynamicOffers/Render/Offer.d.ts.map +1 -1
- package/lib/typescript/src/components/DynamicOffers/SeeAllButton.d.ts +7 -0
- package/lib/typescript/src/components/DynamicOffers/SeeAllButton.d.ts.map +1 -0
- package/lib/typescript/src/components/Layouts/CreditCardOfferCard/index.d.ts +3 -1
- package/lib/typescript/src/components/Layouts/CreditCardOfferCard/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Layouts/DefaultOfferCard/index.d.ts +3 -1
- package/lib/typescript/src/components/Layouts/DefaultOfferCard/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Layouts/HeadlineWithDescriptionCard/index.d.ts +3 -1
- package/lib/typescript/src/components/Layouts/HeadlineWithDescriptionCard/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Modal/AllOffersModal.d.ts +10 -0
- package/lib/typescript/src/components/Modal/AllOffersModal.d.ts.map +1 -0
- package/lib/typescript/src/components/Modal/OfferDetailsModal.d.ts +2 -1
- package/lib/typescript/src/components/Modal/OfferDetailsModal.d.ts.map +1 -1
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +1 -1
- package/lib/typescript/src/context/EventHandlerProvider.d.ts +3 -1
- package/lib/typescript/src/context/EventHandlerProvider.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/offer-catalog/src/utils/getEventCallbackContext.ts +3 -0
- package/src/components/Button/index.tsx +7 -3
- package/src/components/Common/BaseOfferCard/Stat/Stat.tsx +1 -1
- package/src/components/Common/BaseOfferCard/index.tsx +19 -14
- package/src/components/Common/DynamicOfferCard/CallToAction.tsx +1 -1
- package/src/components/Common/DynamicOfferCard/SeeMore.tsx +17 -4
- package/src/components/Common/DynamicOfferCard/index.tsx +10 -2
- package/src/components/DynamicOffers/DynamicOffers.tsx +16 -1
- package/src/components/DynamicOffers/Render/DynamicOffersRender.tsx +227 -75
- package/src/components/DynamicOffers/Render/FallbackOfferTemplate.tsx +3 -0
- package/src/components/DynamicOffers/Render/Offer.tsx +17 -0
- package/src/components/DynamicOffers/SeeAllButton.tsx +31 -0
- package/src/components/Layouts/CreditCardOfferCard/index.tsx +15 -3
- package/src/components/Layouts/DefaultOfferCard/index.tsx +13 -1
- package/src/components/Layouts/HeadlineWithDescriptionCard/index.tsx +13 -1
- package/src/components/Modal/AllOffersModal.tsx +213 -0
- package/src/components/Modal/OfferDetailsModal.tsx +4 -1
- package/src/components/MoneyLionOfferCarousel.tsx +1 -0
- package/src/context/EventHandlerProvider.tsx +3 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Modal,
|
|
4
|
+
View,
|
|
5
|
+
SafeAreaView,
|
|
6
|
+
ScrollView,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
Linking,
|
|
10
|
+
type LayoutChangeEvent,
|
|
11
|
+
type NativeScrollEvent,
|
|
12
|
+
type NativeSyntheticEvent,
|
|
13
|
+
} from "react-native";
|
|
14
|
+
import Text from "../Text";
|
|
15
|
+
import { DynamicOffersContainer } from "../DynamicOffers/DynamicOffersContainer";
|
|
16
|
+
import type { DynamicOfferProps } from "../DynamicOffers/DynamicOffers";
|
|
17
|
+
|
|
18
|
+
type AllOffersModalProps = {
|
|
19
|
+
visible: boolean;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
config: DynamicOfferProps;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const FooterLink = ({ text, url }: { text: string; url?: string }) => {
|
|
25
|
+
const onPress = () => {
|
|
26
|
+
if (!url) return;
|
|
27
|
+
|
|
28
|
+
Linking.canOpenURL(url).then((supported) => {
|
|
29
|
+
if (supported) {
|
|
30
|
+
Linking.openURL(url);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<TouchableOpacity onPress={onPress}>
|
|
37
|
+
<Text
|
|
38
|
+
variant="caption-1"
|
|
39
|
+
color="foregroundNeutralFaded"
|
|
40
|
+
style={styles.footerText}
|
|
41
|
+
>
|
|
42
|
+
{text}
|
|
43
|
+
</Text>
|
|
44
|
+
</TouchableOpacity>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const AllOffersModal = ({
|
|
49
|
+
visible,
|
|
50
|
+
onClose,
|
|
51
|
+
config,
|
|
52
|
+
}: AllOffersModalProps) => {
|
|
53
|
+
const { brand, title } = config;
|
|
54
|
+
const footerLinks = brand.links;
|
|
55
|
+
|
|
56
|
+
const [scrollOffset, setScrollOffset] = useState(0);
|
|
57
|
+
const [scrollViewHeight, setScrollViewHeight] = useState(0);
|
|
58
|
+
|
|
59
|
+
const handleScroll = useCallback(
|
|
60
|
+
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
61
|
+
setScrollOffset(event.nativeEvent.contentOffset.y);
|
|
62
|
+
},
|
|
63
|
+
[]
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const handleScrollViewLayout = useCallback((event: LayoutChangeEvent) => {
|
|
67
|
+
setScrollViewHeight(event.nativeEvent.layout.height);
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const footerConfig = useMemo(
|
|
71
|
+
() => [
|
|
72
|
+
{
|
|
73
|
+
text: "Engine by Moneylion",
|
|
74
|
+
url: footerLinks?.home,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
text: "Terms",
|
|
78
|
+
url: footerLinks?.terms,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
text: "Privacy",
|
|
82
|
+
url: footerLinks?.privacy,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
text: "Disclosures",
|
|
86
|
+
url: "https://www.engine.tech/resources/legal#licenses",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
text: "NMLS# 1475872",
|
|
90
|
+
url: "https://www.nmlsconsumeraccess.org/",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
[footerLinks]
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Modal
|
|
98
|
+
animationType="slide"
|
|
99
|
+
transparent={false}
|
|
100
|
+
visible={visible}
|
|
101
|
+
onRequestClose={onClose}
|
|
102
|
+
>
|
|
103
|
+
<SafeAreaView style={styles.modalContainer}>
|
|
104
|
+
<View style={styles.modalHeader}>
|
|
105
|
+
<TouchableOpacity
|
|
106
|
+
onPress={onClose}
|
|
107
|
+
style={styles.closeXButton}
|
|
108
|
+
hitSlop={{ top: 15, right: 15, bottom: 15, left: 15 }}
|
|
109
|
+
>
|
|
110
|
+
<Text style={styles.closeXText}>✕</Text>
|
|
111
|
+
</TouchableOpacity>
|
|
112
|
+
<Text variant="title-3" weight="bold" style={styles.headerTitle}>
|
|
113
|
+
{title}
|
|
114
|
+
</Text>
|
|
115
|
+
</View>
|
|
116
|
+
|
|
117
|
+
<View style={styles.contentWrapper}>
|
|
118
|
+
<ScrollView
|
|
119
|
+
style={styles.scrollView}
|
|
120
|
+
contentContainerStyle={styles.contentContainer}
|
|
121
|
+
onScroll={handleScroll}
|
|
122
|
+
onLayout={handleScrollViewLayout}
|
|
123
|
+
scrollEventThrottle={16} // For accurate tracking
|
|
124
|
+
>
|
|
125
|
+
<View style={styles.mainContent}>
|
|
126
|
+
<Text
|
|
127
|
+
variant={"caption-1"}
|
|
128
|
+
color={"foregroundNeutralFaded"}
|
|
129
|
+
weight={"normal"}
|
|
130
|
+
style={styles.offerOrderDisclaimer}
|
|
131
|
+
>
|
|
132
|
+
{
|
|
133
|
+
"Offer order is based on compensation from our partners, and other factors."
|
|
134
|
+
}
|
|
135
|
+
</Text>
|
|
136
|
+
<DynamicOffersContainer
|
|
137
|
+
config={{
|
|
138
|
+
isHorizontalScroll: false,
|
|
139
|
+
...config,
|
|
140
|
+
parentScrollOffset: scrollOffset,
|
|
141
|
+
parentScrollViewHeight: scrollViewHeight,
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
</View>
|
|
145
|
+
<View style={styles.footer}>
|
|
146
|
+
{footerConfig.map((item) => (
|
|
147
|
+
<FooterLink key={item.text} text={item.text} url={item.url} />
|
|
148
|
+
))}
|
|
149
|
+
</View>
|
|
150
|
+
</ScrollView>
|
|
151
|
+
</View>
|
|
152
|
+
</SafeAreaView>
|
|
153
|
+
</Modal>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const styles = StyleSheet.create({
|
|
158
|
+
modalContainer: {
|
|
159
|
+
flex: 1,
|
|
160
|
+
backgroundColor: "#EEEEEE",
|
|
161
|
+
},
|
|
162
|
+
modalHeader: {
|
|
163
|
+
flexDirection: "row",
|
|
164
|
+
padding: 16,
|
|
165
|
+
position: "relative",
|
|
166
|
+
justifyContent: "center",
|
|
167
|
+
},
|
|
168
|
+
closeXButton: {
|
|
169
|
+
position: "absolute",
|
|
170
|
+
left: 16,
|
|
171
|
+
top: 16,
|
|
172
|
+
zIndex: 10,
|
|
173
|
+
},
|
|
174
|
+
closeXText: {
|
|
175
|
+
fontSize: 20,
|
|
176
|
+
color: "#000000",
|
|
177
|
+
},
|
|
178
|
+
headerTitle: {
|
|
179
|
+
textAlign: "center",
|
|
180
|
+
alignSelf: "center",
|
|
181
|
+
},
|
|
182
|
+
contentWrapper: {
|
|
183
|
+
flex: 1,
|
|
184
|
+
display: "flex",
|
|
185
|
+
flexDirection: "column",
|
|
186
|
+
},
|
|
187
|
+
scrollView: {
|
|
188
|
+
flex: 1,
|
|
189
|
+
},
|
|
190
|
+
contentContainer: {
|
|
191
|
+
flexGrow: 1,
|
|
192
|
+
},
|
|
193
|
+
mainContent: {
|
|
194
|
+
flexGrow: 1,
|
|
195
|
+
},
|
|
196
|
+
offerOrderDisclaimer: {
|
|
197
|
+
textAlign: "center",
|
|
198
|
+
marginHorizontal: 40,
|
|
199
|
+
marginBottom: 16,
|
|
200
|
+
},
|
|
201
|
+
footer: {
|
|
202
|
+
marginVertical: 24,
|
|
203
|
+
justifyContent: "center",
|
|
204
|
+
flexDirection: "row",
|
|
205
|
+
flexWrap: "wrap",
|
|
206
|
+
gap: 8,
|
|
207
|
+
paddingHorizontal: 16,
|
|
208
|
+
paddingVertical: 8,
|
|
209
|
+
},
|
|
210
|
+
footerText: {
|
|
211
|
+
textDecorationLine: "underline",
|
|
212
|
+
},
|
|
213
|
+
});
|
|
@@ -15,12 +15,14 @@ import { Disclaimer } from "./Disclaimer";
|
|
|
15
15
|
import { CallToAction } from "../Common/DynamicOfferCard/CallToAction";
|
|
16
16
|
import Divider from "../Divider";
|
|
17
17
|
import type { BaseOffer } from "../../capabilities/offer-catalog/src";
|
|
18
|
+
import { getEventCallbackContext } from "../../capabilities/offer-catalog/src/utils/getEventCallbackContext";
|
|
18
19
|
|
|
19
20
|
type OfferDetailsModalProps = {
|
|
20
21
|
visible: boolean;
|
|
21
22
|
offer: BaseOffer;
|
|
22
23
|
offerIndex: number;
|
|
23
24
|
onClose: () => void;
|
|
25
|
+
isHorizontalScroll?: boolean;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
const CTA_LABEL = "Continue";
|
|
@@ -30,6 +32,7 @@ export const OfferDetailsModal = ({
|
|
|
30
32
|
offer,
|
|
31
33
|
onClose,
|
|
32
34
|
offerIndex,
|
|
35
|
+
isHorizontalScroll = true,
|
|
33
36
|
}: OfferDetailsModalProps) => {
|
|
34
37
|
const showDescriptionPoints = Boolean(offer?.descriptionPoints?.length);
|
|
35
38
|
|
|
@@ -79,7 +82,7 @@ export const OfferDetailsModal = ({
|
|
|
79
82
|
offer={offer}
|
|
80
83
|
overrideUrl={offer.overrideUrl}
|
|
81
84
|
style={styles.cta}
|
|
82
|
-
context=
|
|
85
|
+
context={getEventCallbackContext(isHorizontalScroll)}
|
|
83
86
|
>
|
|
84
87
|
{CTA_LABEL}
|
|
85
88
|
</CallToAction>
|
|
@@ -28,6 +28,7 @@ interface onOfferDisplayInViewportProps {
|
|
|
28
28
|
leadUuid: string;
|
|
29
29
|
offer: BaseOffer;
|
|
30
30
|
offerIndex: number;
|
|
31
|
+
context: "horizontal_scroll" | "vertical_scroll";
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
interface onOfferClickProps {
|
|
@@ -37,7 +38,7 @@ interface onOfferClickProps {
|
|
|
37
38
|
leadUuid: string;
|
|
38
39
|
offer: BaseOffer;
|
|
39
40
|
offerIndex: number;
|
|
40
|
-
context: "
|
|
41
|
+
context: "horizontal_scroll" | "vertical_scroll";
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
interface onOfferDetailsPageOpenProps {
|
|
@@ -47,6 +48,7 @@ interface onOfferDetailsPageOpenProps {
|
|
|
47
48
|
leadUuid: string;
|
|
48
49
|
offer: BaseOffer;
|
|
49
50
|
offerIndex: number;
|
|
51
|
+
context: "horizontal_scroll" | "vertical_scroll";
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
interface onOfferDetailsPageCloseProps {
|