@moneylion/react-native-offer-carousel 1.7.1 → 1.8.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.
- package/lib/commonjs/capabilities/errors/types/index.js +20 -0
- package/lib/commonjs/capabilities/errors/types/index.js.map +1 -0
- package/lib/commonjs/capabilities/offer-catalog/src/api/offerCatalogApi.js +41 -2
- package/lib/commonjs/capabilities/offer-catalog/src/api/offerCatalogApi.js.map +1 -1
- package/lib/commonjs/components/ErrorBoundary/index.js +1 -4
- package/lib/commonjs/components/ErrorBoundary/index.js.map +1 -1
- package/lib/commonjs/components/Modal/AllOffersModal.js +15 -6
- package/lib/commonjs/components/Modal/AllOffersModal.js.map +1 -1
- package/lib/commonjs/components/MoneyLionOfferCarousel.js +95 -43
- package/lib/commonjs/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/commonjs/components/utils/errorUtils.js +71 -0
- package/lib/commonjs/components/utils/errorUtils.js.map +1 -0
- package/lib/commonjs/context/ThemeProvider.js +6 -26
- package/lib/commonjs/context/ThemeProvider.js.map +1 -1
- package/lib/commonjs/pageData.js +6 -3
- package/lib/commonjs/pageData.js.map +1 -1
- package/lib/commonjs/services/getDynamicOffers.js +6 -3
- package/lib/commonjs/services/getDynamicOffers.js.map +1 -1
- package/lib/commonjs/services/getProductTypes.js +4 -2
- package/lib/commonjs/services/getProductTypes.js.map +1 -1
- package/lib/commonjs/services/getProductTypesByQuery.js +19 -2
- package/lib/commonjs/services/getProductTypesByQuery.js.map +1 -1
- package/lib/commonjs/utils/getOffersByProductTypes.js +4 -3
- package/lib/commonjs/utils/getOffersByProductTypes.js.map +1 -1
- package/lib/commonjs/utils/resolveProductTypes.js.map +1 -1
- package/lib/module/capabilities/errors/types/index.js +14 -0
- package/lib/module/capabilities/errors/types/index.js.map +1 -0
- package/lib/module/capabilities/offer-catalog/src/api/offerCatalogApi.js +41 -2
- package/lib/module/capabilities/offer-catalog/src/api/offerCatalogApi.js.map +1 -1
- package/lib/module/components/ErrorBoundary/index.js +1 -4
- package/lib/module/components/ErrorBoundary/index.js.map +1 -1
- package/lib/module/components/Modal/AllOffersModal.js +16 -7
- package/lib/module/components/Modal/AllOffersModal.js.map +1 -1
- package/lib/module/components/MoneyLionOfferCarousel.js +96 -44
- package/lib/module/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/module/components/utils/errorUtils.js +63 -0
- package/lib/module/components/utils/errorUtils.js.map +1 -0
- package/lib/module/context/ThemeProvider.js +7 -27
- package/lib/module/context/ThemeProvider.js.map +1 -1
- package/lib/module/pageData.js +6 -3
- package/lib/module/pageData.js.map +1 -1
- package/lib/module/services/getDynamicOffers.js +6 -3
- package/lib/module/services/getDynamicOffers.js.map +1 -1
- package/lib/module/services/getProductTypes.js +4 -2
- package/lib/module/services/getProductTypes.js.map +1 -1
- package/lib/module/services/getProductTypesByQuery.js +19 -2
- package/lib/module/services/getProductTypesByQuery.js.map +1 -1
- package/lib/module/utils/getOffersByProductTypes.js +4 -3
- package/lib/module/utils/getOffersByProductTypes.js.map +1 -1
- package/lib/module/utils/resolveProductTypes.js.map +1 -1
- package/lib/typescript/src/capabilities/errors/types/index.d.ts +26 -0
- package/lib/typescript/src/capabilities/errors/types/index.d.ts.map +1 -0
- package/lib/typescript/src/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts +3 -2
- package/lib/typescript/src/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts.map +1 -1
- package/lib/typescript/src/components/ErrorBoundary/index.d.ts +1 -2
- package/lib/typescript/src/components/ErrorBoundary/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Modal/AllOffersModal.d.ts.map +1 -1
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts +12 -3
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +1 -1
- package/lib/typescript/src/components/utils/errorUtils.d.ts +22 -0
- package/lib/typescript/src/components/utils/errorUtils.d.ts.map +1 -0
- package/lib/typescript/src/context/ThemeProvider.d.ts +0 -3
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/pageData.d.ts +3 -1
- package/lib/typescript/src/pageData.d.ts.map +1 -1
- package/lib/typescript/src/services/getDynamicOffers.d.ts +3 -1
- package/lib/typescript/src/services/getDynamicOffers.d.ts.map +1 -1
- package/lib/typescript/src/services/getProductTypes.d.ts +3 -1
- package/lib/typescript/src/services/getProductTypes.d.ts.map +1 -1
- package/lib/typescript/src/services/getProductTypesByQuery.d.ts +3 -1
- package/lib/typescript/src/services/getProductTypesByQuery.d.ts.map +1 -1
- package/lib/typescript/src/utils/getOffersByProductTypes.d.ts +3 -1
- package/lib/typescript/src/utils/getOffersByProductTypes.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolveProductTypes.d.ts +2 -0
- package/lib/typescript/src/utils/resolveProductTypes.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/capabilities/errors/types/index.ts +39 -0
- package/src/capabilities/offer-catalog/src/api/offerCatalogApi.ts +49 -6
- package/src/components/ErrorBoundary/index.tsx +2 -6
- package/src/components/Modal/AllOffersModal.tsx +18 -8
- package/src/components/MoneyLionOfferCarousel.tsx +130 -49
- package/src/components/utils/errorUtils.ts +70 -0
- package/src/context/ThemeProvider.tsx +16 -36
- package/src/pageData.ts +5 -0
- package/src/services/getDynamicOffers.ts +5 -0
- package/src/services/getProductTypes.ts +4 -0
- package/src/services/getProductTypesByQuery.ts +24 -1
- package/src/utils/getOffersByProductTypes.ts +6 -2
- package/src/utils/resolveProductTypes.ts +2 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare enum ErrorCodes {
|
|
2
|
+
MISSING_CONFIG = "MISSING_CONFIG",
|
|
3
|
+
UI_CRASH = "UI_CRASH",
|
|
4
|
+
FLOW_ERROR = "FLOW_ERROR",
|
|
5
|
+
NETWORK_REQUEST_ERROR = "NETWORK_REQUEST_ERROR",
|
|
6
|
+
NETWORK_SERVER_ERROR = "NETWORK_SERVER_ERROR",
|
|
7
|
+
NETWORK_OTHER_ERROR = "NETWORK_OTHER_ERROR"
|
|
8
|
+
}
|
|
9
|
+
export interface MoneyLionOfferCarouselError {
|
|
10
|
+
code: ErrorCodes;
|
|
11
|
+
severity: "warning" | "error";
|
|
12
|
+
message: string;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
sdkVersion: string;
|
|
15
|
+
error?: Error | unknown;
|
|
16
|
+
statusCode?: number;
|
|
17
|
+
additionalInfo?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
export interface InternalMoneyLionOfferCarouselError extends Omit<MoneyLionOfferCarouselError, "timestamp" | "sdkVersion"> {
|
|
20
|
+
}
|
|
21
|
+
export type OnErrorCallback = (error: MoneyLionOfferCarouselError) => void;
|
|
22
|
+
export type InternalOnErrorCallback = (error: InternalMoneyLionOfferCarouselError) => void;
|
|
23
|
+
export interface ApiError extends Error {
|
|
24
|
+
code?: number;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/errors/types/index.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IAErB,cAAc,mBAAmB;IAGjC,QAAQ,aAAa;IAGrB,UAAU,eAAe;IAGzB,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,mBAAmB,wBAAwB;CAC3C;AAED,MAAM,WAAW,2BAA2B;IAC3C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,mCAChB,SAAQ,IAAI,CAAC,2BAA2B,EAAE,WAAW,GAAG,YAAY,CAAC;CAAG;AAEzE,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,CAAC;AAE3E,MAAM,MAAM,uBAAuB,GAAG,CACrC,KAAK,EAAE,mCAAmC,KACtC,IAAI,CAAC;AAEV,MAAM,WAAW,QAAS,SAAQ,KAAK;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { OffersData } from "../types/offerCatalogSchema";
|
|
2
2
|
import type { UserData } from "../../../configuration/src/userData/types";
|
|
3
3
|
import type { CnfContext } from "../../../core/src/system/cnfContext/CnfContext";
|
|
4
|
-
|
|
4
|
+
import { type InternalOnErrorCallback } from "../../../errors/types";
|
|
5
|
+
export declare const getCachedOffersByProductTypes: (context: CnfContext) => (productTypes: string[], onError?: InternalOnErrorCallback) => Promise<{
|
|
5
6
|
errorCode: number;
|
|
6
7
|
isError?: boolean | undefined;
|
|
7
8
|
uuid: string;
|
|
@@ -15,5 +16,5 @@ export declare const getCachedOffersByProductTypes: (context: CnfContext) => (pr
|
|
|
15
16
|
offers: never[];
|
|
16
17
|
uuid: string;
|
|
17
18
|
}>;
|
|
18
|
-
export declare const getOffersForProductTypes: (context: CnfContext) => (productTypes: string[], customClientTags?: Record<string, string[]>, userData?: UserData, enablePolling?: boolean) => Promise<OffersData>;
|
|
19
|
+
export declare const getOffersForProductTypes: (context: CnfContext) => (productTypes: string[], customClientTags?: Record<string, string[]>, userData?: UserData, enablePolling?: boolean, onError?: InternalOnErrorCallback) => Promise<OffersData>;
|
|
19
20
|
//# sourceMappingURL=offerCatalogApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offerCatalogApi.d.ts","sourceRoot":"","sources":["../../../../../../../src/capabilities/offer-catalog/src/api/offerCatalogApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAY9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"offerCatalogApi.d.ts","sourceRoot":"","sources":["../../../../../../../src/capabilities/offer-catalog/src/api/offerCatalogApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAY9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,6BAA6B,YAC/B,UAAU,oBACC,MAAM,EAAE,YAAY,uBAAuB;;;;;;;;;;;;;EAmF/D,CAAC;AAoDH,eAAO,MAAM,wBAAwB,YAC1B,UAAU,oBAEL,MAAM,EAAE,qBACH,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,aAChC,QAAQ,kBACJ,OAAO,YACZ,uBAAuB,KAC/B,QAAQ,UAAU,CAoJpB,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { Component } from "react";
|
|
2
|
-
import type { CustomError } from "../MoneyLionOfferCarousel";
|
|
3
2
|
interface Props {
|
|
4
3
|
children: React.ReactNode;
|
|
5
4
|
fallbackUI?: React.ReactNode;
|
|
6
|
-
onError: (error:
|
|
5
|
+
onError: (error: Error) => void;
|
|
7
6
|
}
|
|
8
7
|
interface State {
|
|
9
8
|
hasError: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ErrorBoundary/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ErrorBoundary/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,UAAU,KAAK;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC;AAED,UAAU,KAAK;IACd,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,cAAM,aAAc,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBACtC,KAAK,EAAE,KAAK;IAKxB,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,KAAK;;;IAI7C,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAI9B,MAAM;CAON;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllOffersModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Modal/AllOffersModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AllOffersModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Modal/AllOffersModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAgB9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAIxE,KAAK,mBAAmB,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AA0BF,eAAO,MAAM,cAAc,kCAIxB,mBAAmB,sBA8HrB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { type Dispatch, type SetStateAction } from "react";
|
|
2
2
|
import { type FontFamily } from "../context/ThemeProvider";
|
|
3
3
|
import { type EventHandlerContextType } from "../context/EventHandlerProvider";
|
|
4
|
+
import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfContext";
|
|
4
5
|
import type { UserData } from "../capabilities/configuration/src/userData/types";
|
|
6
|
+
import type { InternalOnErrorCallback, OnErrorCallback } from "../capabilities/errors/types";
|
|
5
7
|
export type CustomError = {
|
|
6
8
|
code?: number;
|
|
7
9
|
message: string;
|
|
@@ -25,9 +27,16 @@ export type MoneyLionOfferCarouselProps = {
|
|
|
25
27
|
subtitle?: string;
|
|
26
28
|
isDarkTheme?: boolean;
|
|
27
29
|
fallbackUI?: React.ReactNode;
|
|
28
|
-
onError?:
|
|
30
|
+
onError?: OnErrorCallback;
|
|
29
31
|
onLoad?: (numOffers: number) => void;
|
|
30
32
|
userData?: UserData;
|
|
31
|
-
}
|
|
33
|
+
} & Omit<EventHandlerContextType, "rateTableUuid" | "leadUuid">;
|
|
34
|
+
export interface InternalMoneyLionOfferCarouselProps extends Omit<MoneyLionOfferCarouselProps, "fallbackUI"> {
|
|
35
|
+
context: CnfContext | null;
|
|
36
|
+
pageData: any;
|
|
37
|
+
setContext: Dispatch<SetStateAction<CnfContext | null>>;
|
|
38
|
+
setPageData: Dispatch<SetStateAction<any>>;
|
|
39
|
+
onError?: InternalOnErrorCallback;
|
|
40
|
+
}
|
|
32
41
|
export declare const MoneyLionOfferCarousel: (props: MoneyLionOfferCarouselProps & Omit<EventHandlerContextType, "rateTableUuid" | "leadUuid">) => React.JSX.Element;
|
|
33
42
|
//# sourceMappingURL=MoneyLionOfferCarousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyLionOfferCarousel.d.ts","sourceRoot":"","sources":["../../../../src/components/MoneyLionOfferCarousel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|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AC;IACtB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB,GAAG,IAAI,CAAC,uBAAuB,EAAE,eAAe,GAAG,UAAU,CAAC,CAAC;AAEhE,MAAM,WAAW,mCAChB,SAAQ,IAAI,CAAC,2BAA2B,EAAE,YAAY,CAAC;IACvD,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,GAAG,CAAC;IACd,UAAU,EAAE,QAAQ,CAAC,cAAc,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;IACxD,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAClC;AA4TD,eAAO,MAAM,sBAAsB,UAC3B,2BAA2B,GACjC,KAAK,uBAAuB,EAAE,eAAe,GAAG,UAAU,CAAC,sBA6C5D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { InternalMoneyLionOfferCarouselError } from "../../capabilities/errors/types";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts HTTP status code from the custom Api Error object.
|
|
4
|
+
* Api Error object contains code field which is the HTTP status code.
|
|
5
|
+
*
|
|
6
|
+
* @param error - The error object (can be any type)
|
|
7
|
+
* @returns The HTTP status code if available, null otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare const getCustomApiErrorStatusCode: (error: unknown) => number | null;
|
|
10
|
+
/**
|
|
11
|
+
* Builds API error log properties from an error object.
|
|
12
|
+
* Checks if the error is a network error, and categorizes it as:
|
|
13
|
+
* - Client-side error (4xx status codes)
|
|
14
|
+
* - Server-side error (5xx status codes)
|
|
15
|
+
* - Other network error
|
|
16
|
+
*
|
|
17
|
+
* @param error - The error object (can be any type)
|
|
18
|
+
* @param message - The error message to include in the log properties
|
|
19
|
+
* @returns InternalMoneyLionOfferCarouselError object if it's a network error, null otherwise
|
|
20
|
+
*/
|
|
21
|
+
export declare const getApiErrorLogProperties: (error: Error | unknown) => Omit<InternalMoneyLionOfferCarouselError, "message"> | null;
|
|
22
|
+
//# sourceMappingURL=errorUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorUtils.d.ts","sourceRoot":"","sources":["../../../../../src/components/utils/errorUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,iCAAiC,CAAC;AAE3F;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,UAAW,OAAO,KAAG,MAAM,GAAG,IAQrE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,UAC7B,KAAK,GAAG,OAAO,KACpB,KAAK,mCAAmC,EAAE,SAAS,CAAC,GAAG,IAoCzD,CAAC"}
|
|
@@ -53,9 +53,6 @@ interface ThemeContextType {
|
|
|
53
53
|
theme: ThemeColors;
|
|
54
54
|
fontFamily: FontFamily;
|
|
55
55
|
isDarkTheme: boolean;
|
|
56
|
-
updateTheme: (newTheme: Partial<ThemeColors>) => void;
|
|
57
|
-
updateFontFamily: (newFontFamily: Partial<FontFamily>) => void;
|
|
58
|
-
setIsDarkTheme: (isDark: boolean) => void;
|
|
59
56
|
}
|
|
60
57
|
export declare const ThemeContext: React.Context<ThemeContextType | null>;
|
|
61
58
|
export declare const useTheme: () => ThemeContextType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/context/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEb,KAAK,EAAE,EACP,KAAK,SAAS,EAGd,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,WAAW;IAC3B,iBAAiB,EAAE,MAAM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E,OAAO,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA4BhD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { UserData } from "./capabilities/configuration/src/userData/types";
|
|
2
2
|
import type { CnfContext } from "./capabilities/core/src/system/cnfContext/CnfContext";
|
|
3
|
+
import type { InternalOnErrorCallback } from "./capabilities/errors/types";
|
|
3
4
|
import type { onRateTableSubmitProps } from "./context/EventHandlerProvider";
|
|
4
5
|
export type GetPageDataParams = {
|
|
5
6
|
productType?: string;
|
|
@@ -14,8 +15,9 @@ type GetPageDataProps = {
|
|
|
14
15
|
context: CnfContext;
|
|
15
16
|
params: GetPageDataParams;
|
|
16
17
|
onRateTableSubmit?: (props: onRateTableSubmitProps) => void;
|
|
18
|
+
onError?: InternalOnErrorCallback;
|
|
17
19
|
};
|
|
18
|
-
export declare function getPageData({ context, params, onRateTableSubmit, }: GetPageDataProps): Promise<{
|
|
20
|
+
export declare function getPageData({ context, params, onRateTableSubmit, onError, }: GetPageDataProps): Promise<{
|
|
19
21
|
isError: boolean | undefined;
|
|
20
22
|
errorCode: number | undefined;
|
|
21
23
|
leadUuid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageData.d.ts","sourceRoot":"","sources":["../../../src/pageData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"pageData.d.ts","sourceRoot":"","sources":["../../../src/pageData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAC;AACvF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAG3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAU7E,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACvB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC5D,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAClC,CAAC;AAEF,wBAAsB,WAAW,CAAC,EACjC,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,OAAO,GACP,EAAE,gBAAgB;;;;;;;;;GA2ElB"}
|
|
@@ -2,6 +2,7 @@ import type { GetProductTypesProps, ProductTypesResult } from "./getProductTypes
|
|
|
2
2
|
import type { PartnerOverride, ProductTypeDefinition } from "../capabilities/offer-catalog/src";
|
|
3
3
|
import type { UserData } from "../capabilities/configuration/src/userData/types";
|
|
4
4
|
import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfContext";
|
|
5
|
+
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
5
6
|
export type GetDynamicOffersProps = {
|
|
6
7
|
tags: string;
|
|
7
8
|
productTypes: string[];
|
|
@@ -11,6 +12,7 @@ export type GetDynamicOffersProps = {
|
|
|
11
12
|
partnersOverrideDefinition: PartnerOverride[];
|
|
12
13
|
context: CnfContext;
|
|
13
14
|
userData?: UserData;
|
|
15
|
+
onError?: InternalOnErrorCallback;
|
|
14
16
|
} & Omit<GetProductTypesProps, "context" | "productTypeOrUrl" | "query" | "isDevMode" | "referrer" | "searchAPIToken">;
|
|
15
17
|
/**
|
|
16
18
|
* Retrieves dynamic offers based on the provided parameters.
|
|
@@ -18,7 +20,7 @@ export type GetDynamicOffersProps = {
|
|
|
18
20
|
* @param {GetDynamicOffersProps} params - The parameters for retrieving dynamic offers.
|
|
19
21
|
* @returns {Promise<{ productTypeDisplayName: string; offers: typeof offers }>} An object containing the product type display name and the offers.
|
|
20
22
|
*/
|
|
21
|
-
export declare const getDynamicOffers: ({ tags, defaultProductType, productTypes, resultType, isCachedOffersRequest, productTypesDefinition, partnersOverrideDefinition, context, userData, }: Omit<GetDynamicOffersProps, "isDev">) => Promise<{
|
|
23
|
+
export declare const getDynamicOffers: ({ tags, defaultProductType, productTypes, resultType, isCachedOffersRequest, productTypesDefinition, partnersOverrideDefinition, context, userData, onError, }: Omit<GetDynamicOffersProps, "isDev">) => Promise<{
|
|
22
24
|
offers: import("../capabilities/offer-catalog/src").BaseOffer[];
|
|
23
25
|
isError: boolean | undefined;
|
|
24
26
|
errorCode: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDynamicOffers.d.ts","sourceRoot":"","sources":["../../../../src/services/getDynamicOffers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,oBAAoB,EACpB,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EACX,eAAe,EACf,qBAAqB,EACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"getDynamicOffers.d.ts","sourceRoot":"","sources":["../../../../src/services/getDynamicOffers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,oBAAoB,EACpB,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EACX,eAAe,EACf,qBAAqB,EACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5E,MAAM,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC7C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;IAChD,0BAA0B,EAAE,eAAe,EAAE,CAAC;IAC9C,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAClC,GAAG,IAAI,CACP,oBAAoB,EAClB,SAAS,GACT,kBAAkB,GAClB,OAAO,GACP,WAAW,GACX,UAAU,GACV,gBAAgB,CAClB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,mKAW1B,KAAK,qBAAqB,EAAE,OAAO,CAAC;;;;;;EAkDtC,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
1
2
|
export type GetProductTypesProps = {
|
|
2
3
|
productType?: string;
|
|
3
4
|
query?: string;
|
|
4
5
|
defaultProductType: string;
|
|
5
6
|
searchAPIToken: string;
|
|
6
7
|
isDev: boolean;
|
|
8
|
+
onError?: InternalOnErrorCallback;
|
|
7
9
|
};
|
|
8
10
|
export type ResultType = "STATIC" | "QUERY" | "PRODUCT_TYPE" | "DEFAULT";
|
|
9
11
|
export type ProductTypesResult = {
|
|
@@ -15,5 +17,5 @@ export type ProductTypesResult = {
|
|
|
15
17
|
* @param props - The properties to get the product types
|
|
16
18
|
* @returns The product types
|
|
17
19
|
*/
|
|
18
|
-
export declare const getProductTypes: ({ productType, defaultProductType, query, searchAPIToken, isDev, }: GetProductTypesProps) => Promise<ProductTypesResult>;
|
|
20
|
+
export declare const getProductTypes: ({ productType, defaultProductType, query, searchAPIToken, isDev, onError, }: GetProductTypesProps) => Promise<ProductTypesResult>;
|
|
19
21
|
//# sourceMappingURL=getProductTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/services/getProductTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/services/getProductTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAG5E,MAAM,MAAM,oBAAoB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,GAAG,SAAS,CAAC;AAEzE,MAAM,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAQF;;;;GAIG;AACH,eAAO,MAAM,eAAe,gFAOzB,oBAAoB,KAAG,QAAQ,kBAAkB,CAmBnD,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
1
2
|
type GetProductTypesByQueryProps = {
|
|
2
3
|
query: string;
|
|
3
4
|
searchAPIToken: string;
|
|
4
5
|
isDev: boolean;
|
|
6
|
+
onError?: InternalOnErrorCallback;
|
|
5
7
|
};
|
|
6
8
|
/**
|
|
7
9
|
* Get product types by query
|
|
@@ -23,6 +25,6 @@ type GetProductTypesByQueryProps = {
|
|
|
23
25
|
* // productTypes = []
|
|
24
26
|
* ```
|
|
25
27
|
*/
|
|
26
|
-
export declare const getProductTypesByQuery: ({ query, searchAPIToken, isDev, }: GetProductTypesByQueryProps) => Promise<string[]>;
|
|
28
|
+
export declare const getProductTypesByQuery: ({ query, searchAPIToken, isDev, onError, }: GetProductTypesByQueryProps) => Promise<string[]>;
|
|
27
29
|
export {};
|
|
28
30
|
//# sourceMappingURL=getProductTypesByQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProductTypesByQuery.d.ts","sourceRoot":"","sources":["../../../../src/services/getProductTypesByQuery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getProductTypesByQuery.d.ts","sourceRoot":"","sources":["../../../../src/services/getProductTypesByQuery.ts"],"names":[],"mappings":"AAGA,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,8BAA8B,CAAC;AAGtC,KAAK,2BAA2B,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,sBAAsB,+CAKhC,2BAA2B,sBAgC7B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { UserData } from "../capabilities/configuration/src/userData/types";
|
|
2
2
|
import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfContext";
|
|
3
|
+
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
3
4
|
/**
|
|
4
5
|
* Retrieves offers by product types.
|
|
5
6
|
*
|
|
@@ -10,13 +11,14 @@ import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfC
|
|
|
10
11
|
* @param {UserData} params.userData - Optional user data.
|
|
11
12
|
* @returns {Promise<OffersData>} A promise that resolves to an array of offers or undefined if no offers are found.
|
|
12
13
|
*/
|
|
13
|
-
export declare const getOffersByProductTypes: ({ isCachedOffersRequest, productTypes, tags, context, userData, enablePolling, }: {
|
|
14
|
+
export declare const getOffersByProductTypes: ({ isCachedOffersRequest, productTypes, tags, context, userData, enablePolling, onError, }: {
|
|
14
15
|
isCachedOffersRequest: boolean;
|
|
15
16
|
productTypes: string[];
|
|
16
17
|
tags: string;
|
|
17
18
|
context: CnfContext;
|
|
18
19
|
userData?: UserData | undefined;
|
|
19
20
|
enablePolling?: boolean | undefined;
|
|
21
|
+
onError?: InternalOnErrorCallback | undefined;
|
|
20
22
|
}) => Promise<{
|
|
21
23
|
offers: never[] | import("../capabilities/offer-catalog/src").BaseOffer[];
|
|
22
24
|
rateTableUuid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOffersByProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/utils/getOffersByProductTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"getOffersByProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/utils/getOffersByProductTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAO5E;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB;2BASZ,OAAO;kBAChB,MAAM,EAAE;UAChB,MAAM;aACH,UAAU;;;;;;;;;;EAsBnB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
1
2
|
import { type ResultType } from "../services/getProductTypes";
|
|
2
3
|
type ResolveProductTypesProps = {
|
|
3
4
|
productType?: string;
|
|
@@ -5,6 +6,7 @@ type ResolveProductTypesProps = {
|
|
|
5
6
|
defaultProductType: string;
|
|
6
7
|
searchAPIToken: string;
|
|
7
8
|
isDev: boolean;
|
|
9
|
+
onError?: InternalOnErrorCallback;
|
|
8
10
|
};
|
|
9
11
|
export declare const resolveProductTypes: (props: ResolveProductTypesProps) => Promise<{
|
|
10
12
|
productTypes: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/utils/resolveProductTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE/E,KAAK,wBAAwB,GAAG;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"resolveProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/utils/resolveProductTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE/E,KAAK,wBAAwB,GAAG;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,mBAAmB,UACxB,wBAAwB,KAC7B,QAAQ;IACV,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACvB,CAEA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneylion/react-native-offer-carousel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "React Native components for the Engine by MoneyLion Mobile SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
"lint": "eslint \"**/*.{js,ts,tsx}\" && prettier . --check",
|
|
33
33
|
"lint:fix": "prettier . --write && eslint --fix \"**/*.{js,ts,tsx}\"",
|
|
34
34
|
"clean": "del-cli lib",
|
|
35
|
-
"prepare": "bob build"
|
|
35
|
+
"prepare": "bob build",
|
|
36
|
+
"build:staging": "../scripts/buildStaging.sh --ios-env ./example/build-staging.ios.env --sdk-name offer-carousel",
|
|
37
|
+
"build:staging:ios": "../scripts/buildStaging.ios.sh --env ./example/build-staging.ios.env --sdk-name offer-carousel",
|
|
38
|
+
"build:staging:android": "../scripts/buildStaging.android.sh --sdk-name offer-carousel"
|
|
36
39
|
},
|
|
37
40
|
"author": "",
|
|
38
41
|
"license": "ISC",
|
|
39
42
|
"devDependencies": {
|
|
40
43
|
"@commitlint/config-conventional": "^17.0.2",
|
|
41
|
-
"@evilmartians/lefthook": "^1.5.0",
|
|
42
44
|
"@react-native/eslint-config": "^0.73.1",
|
|
43
45
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
44
46
|
"@types/jest": "^29.5.5",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export enum ErrorCodes {
|
|
2
|
+
// Configuration
|
|
3
|
+
MISSING_CONFIG = "MISSING_CONFIG",
|
|
4
|
+
|
|
5
|
+
// UI
|
|
6
|
+
UI_CRASH = "UI_CRASH",
|
|
7
|
+
|
|
8
|
+
// Flow
|
|
9
|
+
FLOW_ERROR = "FLOW_ERROR",
|
|
10
|
+
|
|
11
|
+
// Network
|
|
12
|
+
NETWORK_REQUEST_ERROR = "NETWORK_REQUEST_ERROR",
|
|
13
|
+
NETWORK_SERVER_ERROR = "NETWORK_SERVER_ERROR",
|
|
14
|
+
NETWORK_OTHER_ERROR = "NETWORK_OTHER_ERROR",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface MoneyLionOfferCarouselError {
|
|
18
|
+
code: ErrorCodes;
|
|
19
|
+
severity: "warning" | "error";
|
|
20
|
+
message: string;
|
|
21
|
+
timestamp: string;
|
|
22
|
+
sdkVersion: string;
|
|
23
|
+
error?: Error | unknown;
|
|
24
|
+
statusCode?: number;
|
|
25
|
+
additionalInfo?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface InternalMoneyLionOfferCarouselError
|
|
29
|
+
extends Omit<MoneyLionOfferCarouselError, "timestamp" | "sdkVersion"> {}
|
|
30
|
+
|
|
31
|
+
export type OnErrorCallback = (error: MoneyLionOfferCarouselError) => void;
|
|
32
|
+
|
|
33
|
+
export type InternalOnErrorCallback = (
|
|
34
|
+
error: InternalMoneyLionOfferCarouselError
|
|
35
|
+
) => void;
|
|
36
|
+
|
|
37
|
+
export interface ApiError extends Error {
|
|
38
|
+
code?: number;
|
|
39
|
+
}
|
|
@@ -13,13 +13,16 @@ import { withDeviceSignals } from "../../../offers/pipeline/src/sources/ratetabl
|
|
|
13
13
|
import { getOfferCatalogApiBaseUrl } from "../../../../apiEnvironment";
|
|
14
14
|
import type { UserData } from "../../../configuration/src/userData/types";
|
|
15
15
|
import type { CnfContext } from "../../../core/src/system/cnfContext/CnfContext";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
import {
|
|
17
|
+
ErrorCodes,
|
|
18
|
+
type ApiError,
|
|
19
|
+
type InternalOnErrorCallback,
|
|
20
|
+
} from "../../../errors/types";
|
|
21
|
+
import { getApiErrorLogProperties } from "../../../../components/utils/errorUtils";
|
|
20
22
|
|
|
21
23
|
export const getCachedOffersByProductTypes =
|
|
22
|
-
(context: CnfContext) =>
|
|
24
|
+
(context: CnfContext) =>
|
|
25
|
+
async (productTypes: string[], onError?: InternalOnErrorCallback) => {
|
|
23
26
|
// const cachedOffersByProductTypesLogger = pinoRootLogger.child({
|
|
24
27
|
// name: "cachedOffersByProductTypesLogger",
|
|
25
28
|
// });
|
|
@@ -81,6 +84,19 @@ export const getCachedOffersByProductTypes =
|
|
|
81
84
|
errorUtil.getErrorForOffersFromProductTypes("DEFAULT");
|
|
82
85
|
console.error(error, errorMessage);
|
|
83
86
|
|
|
87
|
+
onError?.({
|
|
88
|
+
message: "Failed to get cached offers by product types",
|
|
89
|
+
error,
|
|
90
|
+
additionalInfo: {
|
|
91
|
+
productTypes,
|
|
92
|
+
context,
|
|
93
|
+
},
|
|
94
|
+
...(getApiErrorLogProperties(error) || {
|
|
95
|
+
code: ErrorCodes.FLOW_ERROR,
|
|
96
|
+
severity: "error",
|
|
97
|
+
}),
|
|
98
|
+
});
|
|
99
|
+
|
|
84
100
|
return {
|
|
85
101
|
errorCode: (error as ApiError).code,
|
|
86
102
|
isError: true,
|
|
@@ -147,7 +163,8 @@ export const getOffersForProductTypes =
|
|
|
147
163
|
productTypes: string[],
|
|
148
164
|
customClientTags?: Record<string, string[]>,
|
|
149
165
|
userData?: UserData,
|
|
150
|
-
enablePolling: boolean = false
|
|
166
|
+
enablePolling: boolean = false,
|
|
167
|
+
onError?: InternalOnErrorCallback
|
|
151
168
|
): Promise<OffersData> => {
|
|
152
169
|
// const offersFromProductTypesLogger = pinoRootLogger.child({
|
|
153
170
|
// name: "offersFromProductTypesLogger",
|
|
@@ -184,6 +201,18 @@ export const getOffersForProductTypes =
|
|
|
184
201
|
},
|
|
185
202
|
});
|
|
186
203
|
} catch (error) {
|
|
204
|
+
onError?.({
|
|
205
|
+
message: "Failed to add device signals to payload",
|
|
206
|
+
code: ErrorCodes.FLOW_ERROR,
|
|
207
|
+
severity: "error",
|
|
208
|
+
error,
|
|
209
|
+
additionalInfo: {
|
|
210
|
+
payload: fields,
|
|
211
|
+
context,
|
|
212
|
+
productTypes,
|
|
213
|
+
customClientTags,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
187
216
|
// handle error if context is not available. This scenario should not occur in production
|
|
188
217
|
console.error(
|
|
189
218
|
error,
|
|
@@ -262,6 +291,20 @@ export const getOffersForProductTypes =
|
|
|
262
291
|
errorUtil.getErrorForOffersFromProductTypes("DEFAULT");
|
|
263
292
|
console.error(error, errorMessage);
|
|
264
293
|
|
|
294
|
+
onError?.({
|
|
295
|
+
message: "Failed to fetch offers for product types",
|
|
296
|
+
error,
|
|
297
|
+
additionalInfo: {
|
|
298
|
+
context,
|
|
299
|
+
productTypes,
|
|
300
|
+
customClientTags,
|
|
301
|
+
},
|
|
302
|
+
...(getApiErrorLogProperties(error) || {
|
|
303
|
+
code: ErrorCodes.FLOW_ERROR,
|
|
304
|
+
severity: "error",
|
|
305
|
+
}),
|
|
306
|
+
});
|
|
307
|
+
|
|
265
308
|
return {
|
|
266
309
|
errorCode: (error as ApiError).code,
|
|
267
310
|
isError: true,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, { Component } from "react";
|
|
2
|
-
import type { CustomError } from "../MoneyLionOfferCarousel";
|
|
3
2
|
|
|
4
3
|
interface Props {
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
fallbackUI?: React.ReactNode;
|
|
7
|
-
onError: (error:
|
|
6
|
+
onError: (error: Error) => void;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
interface State {
|
|
@@ -22,10 +21,7 @@ class ErrorBoundary extends Component<Props, State> {
|
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
componentDidCatch(error: Error) {
|
|
25
|
-
this.props.onError(
|
|
26
|
-
message: error.message,
|
|
27
|
-
timestamp: new Date().toISOString(),
|
|
28
|
-
});
|
|
24
|
+
this.props.onError(error);
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
render() {
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
type LayoutChangeEvent,
|
|
10
10
|
type NativeScrollEvent,
|
|
11
11
|
type NativeSyntheticEvent,
|
|
12
|
+
StatusBar,
|
|
13
|
+
Platform,
|
|
12
14
|
} from "react-native";
|
|
13
15
|
import Text from "../Text";
|
|
14
16
|
import { DynamicOffersContainer } from "../DynamicOffers/DynamicOffersContainer";
|
|
@@ -51,7 +53,7 @@ export const AllOffersModal = ({
|
|
|
51
53
|
onClose,
|
|
52
54
|
config,
|
|
53
55
|
}: AllOffersModalProps) => {
|
|
54
|
-
const { theme } = useTheme();
|
|
56
|
+
const { theme, isDarkTheme } = useTheme();
|
|
55
57
|
|
|
56
58
|
const { brand, title } = config;
|
|
57
59
|
const footerLinks = brand.links;
|
|
@@ -59,6 +61,9 @@ export const AllOffersModal = ({
|
|
|
59
61
|
const [scrollOffset, setScrollOffset] = useState(0);
|
|
60
62
|
const [scrollViewHeight, setScrollViewHeight] = useState(0);
|
|
61
63
|
|
|
64
|
+
const backgroundColor = theme.backgroundPageFaded;
|
|
65
|
+
const barStyle = isDarkTheme ? "light-content" : "dark-content";
|
|
66
|
+
|
|
62
67
|
const handleScroll = useCallback(
|
|
63
68
|
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
64
69
|
setScrollOffset(event.nativeEvent.contentOffset.y);
|
|
@@ -99,16 +104,20 @@ export const AllOffersModal = ({
|
|
|
99
104
|
return (
|
|
100
105
|
<Modal
|
|
101
106
|
animationType="slide"
|
|
102
|
-
transparent={
|
|
107
|
+
transparent={true}
|
|
103
108
|
visible={visible}
|
|
104
109
|
onRequestClose={onClose}
|
|
110
|
+
statusBarTranslucent={true}
|
|
105
111
|
>
|
|
106
|
-
<SafeAreaView
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
<SafeAreaView style={[styles.modalContainer, { backgroundColor }]}>
|
|
113
|
+
{visible && (
|
|
114
|
+
<StatusBar
|
|
115
|
+
backgroundColor={backgroundColor}
|
|
116
|
+
barStyle={barStyle}
|
|
117
|
+
translucent={false}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
|
|
112
121
|
<View style={styles.modalHeader}>
|
|
113
122
|
<TouchableOpacity
|
|
114
123
|
onPress={onClose}
|
|
@@ -174,6 +183,7 @@ export const AllOffersModal = ({
|
|
|
174
183
|
const styles = StyleSheet.create({
|
|
175
184
|
modalContainer: {
|
|
176
185
|
flex: 1,
|
|
186
|
+
marginTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
|
|
177
187
|
},
|
|
178
188
|
modalHeader: {
|
|
179
189
|
flexDirection: "row",
|