@moneylion/react-native-offer-carousel 1.0.10 → 1.2.0

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.
Files changed (81) hide show
  1. package/lib/commonjs/capabilities/offer-catalog/src/api/offerCatalogApi.js +22 -6
  2. package/lib/commonjs/capabilities/offer-catalog/src/api/offerCatalogApi.js.map +1 -1
  3. package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js +1 -1
  4. package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
  5. package/lib/commonjs/components/Common/BaseOfferCard/index.js +6 -1
  6. package/lib/commonjs/components/Common/BaseOfferCard/index.js.map +1 -1
  7. package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js +5 -3
  8. package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
  9. package/lib/commonjs/components/Common/DynamicOfferCard/index.js +1 -1
  10. package/lib/commonjs/components/DynamicOffers/DynamicOffers.js +2 -0
  11. package/lib/commonjs/components/DynamicOffers/DynamicOffers.js.map +1 -1
  12. package/lib/commonjs/components/DynamicOffers/DynamicOffersContainer.js +1 -8
  13. package/lib/commonjs/components/DynamicOffers/DynamicOffersContainer.js.map +1 -1
  14. package/lib/commonjs/components/DynamicOffers/Render/DynamicOffersRender.js +34 -14
  15. package/lib/commonjs/components/DynamicOffers/Render/DynamicOffersRender.js.map +1 -1
  16. package/lib/commonjs/components/MoneyLionOfferCarousel.js +72 -26
  17. package/lib/commonjs/components/MoneyLionOfferCarousel.js.map +1 -1
  18. package/lib/commonjs/components/Text/index.js +4 -4
  19. package/lib/commonjs/pageData.js +3 -1
  20. package/lib/commonjs/pageData.js.map +1 -1
  21. package/lib/commonjs/services/getDynamicOffers.js +5 -2
  22. package/lib/commonjs/services/getDynamicOffers.js.map +1 -1
  23. package/lib/commonjs/utils/getOffersByProductTypes.js +8 -4
  24. package/lib/commonjs/utils/getOffersByProductTypes.js.map +1 -1
  25. package/lib/module/capabilities/offer-catalog/src/api/offerCatalogApi.js +22 -6
  26. package/lib/module/capabilities/offer-catalog/src/api/offerCatalogApi.js.map +1 -1
  27. package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js +1 -1
  28. package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
  29. package/lib/module/components/Common/BaseOfferCard/index.js +6 -1
  30. package/lib/module/components/Common/BaseOfferCard/index.js.map +1 -1
  31. package/lib/module/components/Common/DynamicOfferCard/SeeMore.js +5 -3
  32. package/lib/module/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
  33. package/lib/module/components/Common/DynamicOfferCard/index.js +1 -1
  34. package/lib/module/components/DynamicOffers/DynamicOffers.js +2 -0
  35. package/lib/module/components/DynamicOffers/DynamicOffers.js.map +1 -1
  36. package/lib/module/components/DynamicOffers/DynamicOffersContainer.js +1 -8
  37. package/lib/module/components/DynamicOffers/DynamicOffersContainer.js.map +1 -1
  38. package/lib/module/components/DynamicOffers/Render/DynamicOffersRender.js +33 -14
  39. package/lib/module/components/DynamicOffers/Render/DynamicOffersRender.js.map +1 -1
  40. package/lib/module/components/MoneyLionOfferCarousel.js +72 -26
  41. package/lib/module/components/MoneyLionOfferCarousel.js.map +1 -1
  42. package/lib/module/components/Text/index.js +4 -4
  43. package/lib/module/pageData.js +3 -1
  44. package/lib/module/pageData.js.map +1 -1
  45. package/lib/module/services/getDynamicOffers.js +5 -2
  46. package/lib/module/services/getDynamicOffers.js.map +1 -1
  47. package/lib/module/utils/getOffersByProductTypes.js +8 -4
  48. package/lib/module/utils/getOffersByProductTypes.js.map +1 -1
  49. package/lib/typescript/src/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts +14 -1
  50. package/lib/typescript/src/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts.map +1 -1
  51. package/lib/typescript/src/capabilities/offer-catalog/src/types/offerCatalogSchema.d.ts +1 -0
  52. package/lib/typescript/src/capabilities/offer-catalog/src/types/offerCatalogSchema.d.ts.map +1 -1
  53. package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts.map +1 -1
  54. package/lib/typescript/src/components/DynamicOffers/DynamicOffers.d.ts +3 -2
  55. package/lib/typescript/src/components/DynamicOffers/DynamicOffers.d.ts.map +1 -1
  56. package/lib/typescript/src/components/DynamicOffers/DynamicOffersContainer.d.ts.map +1 -1
  57. package/lib/typescript/src/components/DynamicOffers/Render/DynamicOffersRender.d.ts +3 -2
  58. package/lib/typescript/src/components/DynamicOffers/Render/DynamicOffersRender.d.ts.map +1 -1
  59. package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts +8 -0
  60. package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +1 -1
  61. package/lib/typescript/src/pageData.d.ts +1 -0
  62. package/lib/typescript/src/pageData.d.ts.map +1 -1
  63. package/lib/typescript/src/services/getDynamicOffers.d.ts +1 -0
  64. package/lib/typescript/src/services/getDynamicOffers.d.ts.map +1 -1
  65. package/lib/typescript/src/utils/getOffersByProductTypes.d.ts +2 -1
  66. package/lib/typescript/src/utils/getOffersByProductTypes.d.ts.map +1 -1
  67. package/package.json +1 -1
  68. package/src/capabilities/offer-catalog/src/api/offerCatalogApi.ts +24 -6
  69. package/src/capabilities/offer-catalog/src/types/offerCatalogSchema.ts +1 -0
  70. package/src/components/Common/BaseOfferCard/Stat/Stat.tsx +1 -1
  71. package/src/components/Common/BaseOfferCard/index.tsx +4 -0
  72. package/src/components/Common/DynamicOfferCard/SeeMore.tsx +4 -3
  73. package/src/components/Common/DynamicOfferCard/index.tsx +1 -1
  74. package/src/components/DynamicOffers/DynamicOffers.tsx +4 -1
  75. package/src/components/DynamicOffers/DynamicOffersContainer.tsx +1 -8
  76. package/src/components/DynamicOffers/Render/DynamicOffersRender.tsx +31 -5
  77. package/src/components/MoneyLionOfferCarousel.tsx +96 -22
  78. package/src/components/Text/index.tsx +6 -6
  79. package/src/pageData.ts +13 -11
  80. package/src/services/getDynamicOffers.ts +4 -2
  81. package/src/utils/getOffersByProductTypes.ts +8 -6
@@ -99,6 +99,7 @@ export type ProductTypes =
99
99
  | (string & {});
100
100
 
101
101
  export type OffersData = {
102
+ errorCode?: number;
102
103
  isError?: boolean;
103
104
  uuid: string;
104
105
  leadUuid: string;
@@ -24,7 +24,7 @@ function smartCapitalize(text: string): string {
24
24
  const VerticalStat = (props: StatProps) => {
25
25
  return (
26
26
  <View style={styles.verticalStatContainer}>
27
- <Text variant="featured-2" color={"foregroundNeutral"} weight={"bold"}>
27
+ <Text variant="title-4" color={"foregroundNeutral"} weight={"bold"}>
28
28
  {String(props.content).trim()}
29
29
  </Text>
30
30
  <MarkdownText
@@ -108,6 +108,7 @@ const PartnerImage = (
108
108
  resizeMode={"contain"}
109
109
  height={32}
110
110
  {...props}
111
+ style={styles.partnerImage}
111
112
  />
112
113
  );
113
114
  };
@@ -297,4 +298,7 @@ const styles = StyleSheet.create({
297
298
  marginTop: "auto",
298
299
  },
299
300
  chosenBy: { justifyContent: "center", alignItems: "center" },
301
+ partnerImage: {
302
+ marginBottom: 16,
303
+ },
300
304
  });
@@ -49,7 +49,7 @@ export const SeeMore = ({ offer, offerIndex }: SeeMoreProps) => {
49
49
  <Text
50
50
  variant={"body-3"}
51
51
  color={"foregroundNeutral"}
52
- weight={"medium"}
52
+ weight={"normal"}
53
53
  style={styles.text}
54
54
  >
55
55
  See details
@@ -68,9 +68,10 @@ export const SeeMore = ({ offer, offerIndex }: SeeMoreProps) => {
68
68
 
69
69
  const styles = StyleSheet.create({
70
70
  container: {
71
- marginTop: 12,
71
+ marginTop: 16,
72
72
  },
73
73
  text: {
74
- textDecorationLine: "underline",
74
+ alignSelf: "flex-start", // Makes container only as wide as text
75
+ borderBottomWidth: 1,
75
76
  },
76
77
  });
@@ -61,5 +61,5 @@ function DynamicOfferCard({
61
61
  export { DynamicOfferCard };
62
62
 
63
63
  const styles = StyleSheet.create({
64
- cta: { marginTop: 20 },
64
+ cta: { marginTop: 16 },
65
65
  });
@@ -6,7 +6,8 @@ import type { Layout } from "../../utils";
6
6
  import { View } from "react-native";
7
7
 
8
8
  export type DynamicOfferProps = {
9
- title: string;
9
+ title?: string;
10
+ subtitle?: string;
10
11
  displayLayout: Layout;
11
12
  showCardBorder: boolean;
12
13
  showProductTypeLabel?: boolean;
@@ -15,6 +16,7 @@ export type DynamicOfferProps = {
15
16
 
16
17
  export const DynamicOffers = ({
17
18
  title,
19
+ subtitle,
18
20
  displayLayout,
19
21
  showCardBorder,
20
22
  showProductTypeLabel,
@@ -33,6 +35,7 @@ export const DynamicOffers = ({
33
35
  */}
34
36
  <DynamicOffersRender
35
37
  title={title}
38
+ subtitle={subtitle}
36
39
  offers={offers}
37
40
  displayLayout={displayLayout}
38
41
  fallbackTemplate={FallbackOfferTemplate}
@@ -23,14 +23,7 @@ export const DynamicOffersContainer = React.memo(
23
23
  <Suspense
24
24
  fallback={<DynamicOfferSkeleton displayLayout={config.displayLayout} />}
25
25
  >
26
- <DynamicOffers
27
- offers={config.offers}
28
- title={config.title}
29
- showProductTypeLabel={config.showProductTypeLabel}
30
- displayLayout={config.displayLayout}
31
- showCardBorder={config.showCardBorder}
32
- shouldHideFooter={config.shouldHideFooter}
33
- />
26
+ <DynamicOffers {...config} />
34
27
  </Suspense>
35
28
  );
36
29
  }
@@ -19,9 +19,11 @@ import {
19
19
  } from "react-native";
20
20
  import { useEventHandler } from "../../../context/EventHandlerProvider";
21
21
  import type { BaseOffer } from "../../../capabilities/offer-catalog/src";
22
+ import Text from "../../Text";
22
23
 
23
24
  export type DynamicOffersRenderProps = {
24
- title: string;
25
+ title?: string;
26
+ subtitle?: string;
25
27
  offers: BaseOffer[];
26
28
  displayLayout: Layout;
27
29
  fallbackTemplate?: React.FC<{
@@ -36,6 +38,7 @@ export type DynamicOffersRenderProps = {
36
38
 
37
39
  export const DynamicOffersRender = ({
38
40
  title,
41
+ subtitle,
39
42
  offers,
40
43
  displayLayout,
41
44
  productTypeBuilder = builder,
@@ -233,10 +236,24 @@ export const DynamicOffersRender = ({
233
236
  return () => clearTimeout(timeoutId);
234
237
  }, [checkVisibleOffers, scrollOffset, scrollViewWidth, cardLayouts]);
235
238
 
239
+ const showTitle = Boolean(title?.trim());
240
+ const showSubtitle = Boolean(subtitle?.trim());
241
+ const showHeaderText = showTitle || showSubtitle;
242
+
236
243
  return (
237
- // <OffersCarousel title={title} displayLayout={displayLayout}>
238
244
  <>
239
- {title}
245
+ <View style={styles.header}>
246
+ {showHeaderText && (
247
+ <View style={styles.headerTextContainer}>
248
+ {showTitle && (
249
+ <Text variant="featured-3" weight="bold">
250
+ {title}
251
+ </Text>
252
+ )}
253
+ {showSubtitle && <Text variant="body-3">{subtitle}</Text>}
254
+ </View>
255
+ )}
256
+ </View>
240
257
  <ScrollView
241
258
  horizontal={true}
242
259
  showsHorizontalScrollIndicator={false}
@@ -248,8 +265,6 @@ export const DynamicOffersRender = ({
248
265
  {wrappedOfferComponents}
249
266
  </ScrollView>
250
267
  </>
251
-
252
- // </OffersCarousel>
253
268
  );
254
269
  };
255
270
 
@@ -258,4 +273,15 @@ const styles = StyleSheet.create({
258
273
  columnGap: 20,
259
274
  paddingHorizontal: 16,
260
275
  },
276
+ header: {
277
+ marginHorizontal: 16,
278
+ marginBottom: 16,
279
+ flexDirection: "row",
280
+ justifyContent: "space-between",
281
+ alignItems: "center",
282
+ },
283
+ headerTextContainer: {
284
+ flex: 1,
285
+ gap: 4,
286
+ },
261
287
  });
@@ -32,6 +32,14 @@ export type MoneyLionOfferCarouselProps = {
32
32
  isDev: boolean;
33
33
  showCardBorder?: boolean;
34
34
  showDescriptionPoints?: boolean;
35
+ title?: string;
36
+ subtitle?: string;
37
+ onError?: (error: {
38
+ code?: number;
39
+ message: string;
40
+ timestamp: string;
41
+ }) => void;
42
+ onLoad?: (numOffers: number) => void;
35
43
  };
36
44
 
37
45
  const getConfiguration = async ({
@@ -39,9 +47,10 @@ const getConfiguration = async ({
39
47
  zone,
40
48
  subAccountToken,
41
49
  isDev,
50
+ onError,
42
51
  }: Pick<
43
52
  MoneyLionOfferCarouselProps,
44
- "channel" | "zone" | "subAccountToken" | "isDev"
53
+ "channel" | "zone" | "subAccountToken" | "isDev" | "onError"
45
54
  >) => {
46
55
  const url = `${getConfigApiBaseUrl(isDev)}/network/${channel}/${zone}/api/configuration`;
47
56
 
@@ -51,13 +60,33 @@ const getConfiguration = async ({
51
60
  try {
52
61
  const response = await fetch(url, { headers });
53
62
  if (!response.ok) {
54
- throw new Error();
63
+ const errorCode = response.status;
64
+
65
+ onError?.({
66
+ code: errorCode,
67
+ message: `Configuration request failed with status: ${response.status}`,
68
+ timestamp: new Date().toISOString(),
69
+ });
70
+
71
+ throw new Error(
72
+ `Configuration request failed with status: ${response.status}`
73
+ );
55
74
  }
75
+
56
76
  const data = await response.json();
57
77
 
58
78
  return data;
59
79
  } catch (error) {
60
80
  console.error("Error fetching configuration", error);
81
+
82
+ if (!(error instanceof Error && error.message.includes("status"))) {
83
+ // Call if network error not already reported
84
+ onError?.({
85
+ message: "Network request failed",
86
+ timestamp: new Date().toISOString(),
87
+ });
88
+ }
89
+
61
90
  return localCnfContext;
62
91
  }
63
92
  };
@@ -73,6 +102,10 @@ export const MoneyLionOfferCarousel = (
73
102
  fontFamily,
74
103
  isDev,
75
104
  showDescriptionPoints = true,
105
+ onError,
106
+ onLoad,
107
+ title,
108
+ subtitle,
76
109
  } = props;
77
110
 
78
111
  const {
@@ -109,21 +142,31 @@ export const MoneyLionOfferCarousel = (
109
142
  zone,
110
143
  subAccountToken,
111
144
  isDev,
145
+ onError,
112
146
  });
113
147
  setContext(data.serializableContext as CnfContext);
114
148
  } catch (err) {
115
- setError(
149
+ const errorObj =
116
150
  err instanceof Error
117
151
  ? err
118
- : new Error("Failed to fetch configuration")
119
- );
152
+ : new Error("Failed to fetch configuration");
153
+
154
+ setError(errorObj);
155
+
156
+ // Only call onError if not already called in getConfiguration
157
+ if (!errorObj.message.includes("status")) {
158
+ onError?.({
159
+ message: errorObj.message,
160
+ timestamp: new Date().toISOString(),
161
+ });
162
+ }
120
163
  } finally {
121
164
  setIsLoading(false);
122
165
  }
123
166
  };
124
167
 
125
168
  fetchConfiguration();
126
- }, [channel, zone, subAccountToken, isDev]);
169
+ }, [channel, zone, subAccountToken, isDev, onError]);
127
170
 
128
171
  useEffect(() => {
129
172
  if (isLoading) {
@@ -134,24 +177,55 @@ export const MoneyLionOfferCarousel = (
134
177
  useEffect(() => {
135
178
  const fetchPageData = async () => {
136
179
  if (context) {
137
- const data = await getPageData({
138
- context: { ...context, isDev },
139
- params: props,
140
- onRateTableSubmit,
141
- });
142
- onRateTableResponse?.({
143
- timestamp: new Date().toISOString(),
144
- isError: Boolean(data.isError),
145
- offers: data.offers,
146
- rateTableUuid: data.rateTableUuid,
147
- leadUuid: data.leadUuid,
148
- });
149
- setPageData(data);
180
+ try {
181
+ const data = await getPageData({
182
+ context: { ...context, isDev },
183
+ params: props,
184
+ onRateTableSubmit,
185
+ });
186
+
187
+ // Check for API errors in the response
188
+ if (data.isError) {
189
+ onError?.({
190
+ code: data.errorCode,
191
+ message: "Rate table error occurred",
192
+ timestamp: new Date().toISOString(),
193
+ });
194
+ }
195
+
196
+ onRateTableResponse?.({
197
+ timestamp: new Date().toISOString(),
198
+ isError: Boolean(data.isError),
199
+ offers: data.offers,
200
+ rateTableUuid: data.rateTableUuid,
201
+ leadUuid: data.leadUuid,
202
+ });
203
+
204
+ setPageData(data);
205
+ onLoad?.(data.offers.length);
206
+ } catch (err) {
207
+ const errorObj =
208
+ err instanceof Error ? err : new Error("Failed to fetch page data");
209
+
210
+ onError?.({
211
+ message: errorObj.message,
212
+ timestamp: new Date().toISOString(),
213
+ });
214
+ }
150
215
  }
151
216
  };
152
217
 
153
218
  fetchPageData();
154
- }, [context, isDev, onRateTableResponse, onRateTableSubmit, props]);
219
+ }, [
220
+ context,
221
+ isDev,
222
+ onRateTableResponse,
223
+ onRateTableSubmit,
224
+ props,
225
+ isLoading,
226
+ onError,
227
+ onLoad,
228
+ ]);
155
229
 
156
230
  if (isLoading) {
157
231
  return <DynamicOfferSkeleton displayLayout={"fixed"} />;
@@ -162,7 +236,7 @@ export const MoneyLionOfferCarousel = (
162
236
  }
163
237
 
164
238
  if (!context) {
165
- return <Text>{"Context is null"}</Text>; // Replace with your error component
239
+ return <Text>{"Context is null"}</Text>;
166
240
  }
167
241
 
168
242
  if (!pageData) {
@@ -174,7 +248,6 @@ export const MoneyLionOfferCarousel = (
174
248
  displayLayout,
175
249
  showProductTypeLabel,
176
250
  showCardBorder,
177
- title,
178
251
  offers,
179
252
  rateTableUuid,
180
253
  leadUuid,
@@ -187,6 +260,7 @@ export const MoneyLionOfferCarousel = (
187
260
  showProductTypeLabel,
188
261
  showCardBorder,
189
262
  title,
263
+ subtitle,
190
264
  };
191
265
 
192
266
  const themeColor = {
@@ -18,10 +18,10 @@ export type Variant =
18
18
  | "title-6"
19
19
  | "featured-1"
20
20
  | "featured-2" // Vertical stat content
21
- | "featured-3"
21
+ | "featured-3" // Title for the horizontal scroll
22
22
  | "body-1"
23
23
  | "body-2" // CTA Text
24
- | "body-3" // Vertical Stat label , Horizontal Stat label and content, See Details.
24
+ | "body-3" // Vertical Stat label , Horizontal Stat label and content, See Details., Subtitle for the horizontal scroll
25
25
  | "caption-1"
26
26
  | "caption-2"; // Credit Card Offer Card Tip
27
27
 
@@ -113,9 +113,9 @@ const styles = StyleSheet.create({
113
113
  lineHeight: 32,
114
114
  },
115
115
  "title-4": {
116
- fontSize: 20,
116
+ fontSize: 24,
117
117
  fontWeight: "bold",
118
- lineHeight: 28,
118
+ lineHeight: 32,
119
119
  },
120
120
  "title-5": {
121
121
  fontSize: 18,
@@ -136,8 +136,8 @@ const styles = StyleSheet.create({
136
136
  lineHeight: 32,
137
137
  },
138
138
  "featured-3": {
139
- fontSize: 18,
140
- lineHeight: 24,
139
+ fontSize: 20,
140
+ lineHeight: 28,
141
141
  },
142
142
  "body-1": {
143
143
  fontSize: 18,
package/src/pageData.ts CHANGED
@@ -72,20 +72,22 @@ export async function getPageData({
72
72
  });
73
73
 
74
74
  // Get offers
75
- const { offers, isError, leadUuid, rateTableUuid } = await getDynamicOffers({
76
- tags: safeTags,
77
- displayLayout: safeDisplayLayout,
78
- productTypes,
79
- resultType,
80
- isCachedOffersRequest,
81
- productTypesDefinition: [...productTypesDefinition],
82
- partnersOverrideDefinition: [...partnersOverrideDefinition],
83
- context,
84
- defaultProductType,
85
- });
75
+ const { offers, isError, leadUuid, rateTableUuid, errorCode } =
76
+ await getDynamicOffers({
77
+ tags: safeTags,
78
+ displayLayout: safeDisplayLayout,
79
+ productTypes,
80
+ resultType,
81
+ isCachedOffersRequest,
82
+ productTypesDefinition: [...productTypesDefinition],
83
+ partnersOverrideDefinition: [...partnersOverrideDefinition],
84
+ context,
85
+ defaultProductType,
86
+ });
86
87
 
87
88
  return {
88
89
  isError,
90
+ errorCode,
89
91
  leadUuid,
90
92
  rateTableUuid,
91
93
  // title,
@@ -56,7 +56,7 @@ export const getDynamicOffers = async ({
56
56
  context,
57
57
  }: Omit<GetDynamicOffersProps, "isDev">) => {
58
58
  // Get the initial offers
59
- let { offers, rateTableUuid, isError, leadUuid } =
59
+ let { offers, rateTableUuid, isError, leadUuid, errorCode } =
60
60
  await getOffersByProductTypes({
61
61
  isCachedOffersRequest,
62
62
  productTypes,
@@ -79,6 +79,7 @@ export const getDynamicOffers = async ({
79
79
  isError = fallbackResult.isError;
80
80
  leadUuid = fallbackResult.leadUuid;
81
81
  productTypes = [defaultProductType];
82
+ errorCode = fallbackResult.errorCode;
82
83
  }
83
84
 
84
85
  const sortedOffers =
@@ -93,7 +94,8 @@ export const getDynamicOffers = async ({
93
94
  addClientTagsToOfferLinks(isCachedOffersRequest, tags),
94
95
  getOffersBasedOnLayout(displayLayout)
95
96
  ),
96
- isError: isError,
97
+ isError,
98
+ errorCode,
97
99
  leadUuid: leadUuid,
98
100
  rateTableUuid,
99
101
  };
@@ -26,15 +26,17 @@ export const getOffersByProductTypes = async ({
26
26
  context: CnfContext;
27
27
  }) => {
28
28
  if (isCachedOffersRequest) {
29
- const { offers, uuid, isError, leadUuid } =
29
+ const { offers, uuid, isError, leadUuid, errorCode } =
30
30
  await getCachedOffersByProductTypes(context)(productTypes);
31
31
 
32
- return { offers, rateTableUuid: uuid, isError, leadUuid };
32
+ return { offers, rateTableUuid: uuid, isError, leadUuid, errorCode };
33
33
  }
34
34
 
35
- const { offers, uuid, isError, leadUuid } = await getOffersForProductTypes(
36
- context
37
- )(productTypes, parseClientTags(tags));
35
+ const { offers, uuid, isError, leadUuid, errorCode } =
36
+ await getOffersForProductTypes(context)(
37
+ productTypes,
38
+ parseClientTags(tags)
39
+ );
38
40
 
39
- return { offers, rateTableUuid: uuid, isError, leadUuid };
41
+ return { offers, rateTableUuid: uuid, isError, leadUuid, errorCode };
40
42
  };