@moneylion/react-native-offer-carousel 1.5.1 → 1.6.1
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/configuration/src/userData/types.js +2 -0
- package/lib/commonjs/capabilities/configuration/src/userData/types.js.map +1 -0
- package/lib/commonjs/capabilities/offer-catalog/src/api/offerCatalogApi.js +14 -3
- package/lib/commonjs/capabilities/offer-catalog/src/api/offerCatalogApi.js.map +1 -1
- package/lib/commonjs/components/MoneyLionOfferCarousel.js +43 -10
- package/lib/commonjs/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/commonjs/pageData.js +4 -2
- 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/utils/getOffersByProductTypes.js +4 -2
- package/lib/commonjs/utils/getOffersByProductTypes.js.map +1 -1
- package/lib/module/capabilities/configuration/src/userData/types.js +2 -0
- package/lib/module/capabilities/configuration/src/userData/types.js.map +1 -0
- package/lib/module/capabilities/offer-catalog/src/api/offerCatalogApi.js +14 -3
- package/lib/module/capabilities/offer-catalog/src/api/offerCatalogApi.js.map +1 -1
- package/lib/module/components/MoneyLionOfferCarousel.js +43 -10
- package/lib/module/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/module/pageData.js +4 -2
- 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/utils/getOffersByProductTypes.js +4 -2
- package/lib/module/utils/getOffersByProductTypes.js.map +1 -1
- package/lib/typescript/src/capabilities/configuration/src/userData/types.d.ts +4 -0
- package/lib/typescript/src/capabilities/configuration/src/userData/types.d.ts.map +1 -0
- package/lib/typescript/src/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts +2 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts.map +1 -1
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts +2 -0
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +1 -1
- package/lib/typescript/src/context/EventHandlerProvider.d.ts +5 -6
- package/lib/typescript/src/context/EventHandlerProvider.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/pageData.d.ts +11 -2
- 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/utils/getOffersByProductTypes.d.ts +4 -1
- package/lib/typescript/src/utils/getOffersByProductTypes.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/configuration/src/userData/types.ts +3 -0
- package/src/capabilities/offer-catalog/src/api/offerCatalogApi.ts +16 -2
- package/src/components/MoneyLionOfferCarousel.tsx +58 -19
- package/src/context/EventHandlerProvider.tsx +5 -5
- package/src/index.tsx +11 -0
- package/src/pageData.ts +14 -2
- package/src/services/getDynamicOffers.ts +5 -0
- package/src/utils/getOffersByProductTypes.ts +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getIsDevEnvironment","getDynamicOffers","getDefaultProductType","getProductTypesDefinition","resolveProductTypes","getEnableUseCachedOffers","getPageData","context","params","onRateTableSubmit","productType","query","tags","searchAPIToken","showProductTypeLabel","showCardBorder","resolvedTags","trim","isCachedOffersRequest","defaultProductType","isDev","productTypesDefinition","partnersOverrideDefinition","currentCountry","signals","deviceSignals","country","safeTags","encodeURI","productTypes","resultType","timestamp","Date","toISOString","offers","isError","leadUuid","rateTableUuid","errorCode"],"sourceRoot":"../../src","sources":["pageData.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getIsDevEnvironment","getDynamicOffers","getDefaultProductType","getProductTypesDefinition","resolveProductTypes","getEnableUseCachedOffers","getPageData","context","params","onRateTableSubmit","productType","query","tags","searchAPIToken","showProductTypeLabel","showCardBorder","userData","resolvedTags","trim","isCachedOffersRequest","defaultProductType","isDev","productTypesDefinition","partnersOverrideDefinition","currentCountry","signals","deviceSignals","country","safeTags","encodeURI","productTypes","resultType","timestamp","Date","toISOString","offers","isError","leadUuid","rateTableUuid","errorCode"],"sourceRoot":"../../src","sources":["pageData.ts"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,oDAAoD;AAGxF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D;AACA,SACCC,qBAAqB,EACrBC,yBAAyB,EACzBC,mBAAmB,QACb,SAAS;AAChB,SAASC,wBAAwB,QAAQ,kCAAkC;AAkB3E,OAAO,eAAeC,WAAWA,CAAC;EACjCC,OAAO;EACPC,MAAM;EACNC;AACiB,CAAC,EAAE;EACpB,MAAM;IACLC,WAAW;IACXC,KAAK;IACLC,IAAI;IACJC,cAAc;IACdC,oBAAoB;IACpBC,cAAc;IACdC;EACD,CAAC,GAAGR,MAAM;;EAEV;EACA,MAAMS,YAAY,GAAG,GAAGL,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEM,IAAI,CAAC,CAAC,EAAE;EAEtC,MAAMC,qBAAqB,GAAGd,wBAAwB,CAACE,OAAO,CAAC;EAE/D,MAAMa,kBAAkB,GAAGlB,qBAAqB,CAACK,OAAO,CAAC;;EAEzD;EACA;;EAEA,MAAMc,KAAK,GAAGrB,mBAAmB,CAACO,OAAO,CAAC;EAE1C,MAAM;IAAEe,sBAAsB;IAAEC;EAA2B,CAAC,GAC3DpB,yBAAyB,CAACI,OAAO,CAAC;EAEnC,MAAMiB,cAAc,GAAGjB,OAAO,CAACkB,OAAO,CAACC,aAAa,CAACC,OAAO;EAE5D,MAAMC,QAAQ,GAAGC,SAAS,CAACZ,YAAY,CAAC;;EAExC;EACA,MAAM;IAAEa,YAAY;IAAEC;EAAW,CAAC,GAAG,MAAM3B,mBAAmB,CAAC;IAC9DgB,kBAAkB;IAClBV,WAAW;IACXC,KAAK;IACLE,cAAc;IACdQ;EACD,CAAC,CAAC;EAEFZ,iBAAiB,aAAjBA,iBAAiB,eAAjBA,iBAAiB,CAAG;IACnBuB,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;IACnCJ,YAAY;IACZC,UAAU;IACVX;EACD,CAAC,CAAC;;EAEF;EACA,MAAM;IAAEe,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,aAAa;IAAEC;EAAU,CAAC,GAC5D,MAAMtC,gBAAgB,CAAC;IACtBW,IAAI,EAAEgB,QAAQ;IACdE,YAAY;IACZC,UAAU;IACVZ,qBAAqB;IACrBG,sBAAsB,EAAE,CAAC,GAAGA,sBAAsB,CAAC;IACnDC,0BAA0B,EAAE,CAAC,GAAGA,0BAA0B,CAAC;IAC3DhB,OAAO;IACPa,kBAAkB;IAClBJ;EACD,CAAC,CAAC;EAEH,OAAO;IACNoB,OAAO;IACPG,SAAS;IACTF,QAAQ;IACRC,aAAa;IACb;IACAH,MAAM;IACNX,cAAc;IACd;IACAT,cAAc;IACd;IACAD;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -17,7 +17,8 @@ export const getDynamicOffers = async ({
|
|
|
17
17
|
isCachedOffersRequest,
|
|
18
18
|
productTypesDefinition,
|
|
19
19
|
partnersOverrideDefinition,
|
|
20
|
-
context
|
|
20
|
+
context,
|
|
21
|
+
userData
|
|
21
22
|
}) => {
|
|
22
23
|
// Get the initial offers
|
|
23
24
|
let {
|
|
@@ -30,7 +31,8 @@ export const getDynamicOffers = async ({
|
|
|
30
31
|
isCachedOffersRequest,
|
|
31
32
|
productTypes,
|
|
32
33
|
tags,
|
|
33
|
-
context
|
|
34
|
+
context,
|
|
35
|
+
userData
|
|
34
36
|
});
|
|
35
37
|
|
|
36
38
|
// If no offers found, fall back to the default product type
|
|
@@ -39,7 +41,8 @@ export const getDynamicOffers = async ({
|
|
|
39
41
|
isCachedOffersRequest,
|
|
40
42
|
productTypes: [defaultProductType],
|
|
41
43
|
tags,
|
|
42
|
-
context
|
|
44
|
+
context,
|
|
45
|
+
userData
|
|
43
46
|
});
|
|
44
47
|
|
|
45
48
|
// Update the offers, rateTableUuid, isError, leafUuid and productTypes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isEmpty","addClientTagsToOfferLinks","getOffersByProductTypes","selectDynamicOffers","sortOffersByRecommendationScore","pipe","formatOfferUrl","getDynamicOffers","tags","defaultProductType","productTypes","resultType","isCachedOffersRequest","productTypesDefinition","partnersOverrideDefinition","context","offers","rateTableUuid","isError","leadUuid","errorCode","fallbackResult","sortedOffers"],"sourceRoot":"../../../src","sources":["services/getDynamicOffers.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SACCC,yBAAyB,EACzBC,uBAAuB,EACvBC,mBAAmB,QACb,UAAU;AAKjB,SAASC,+BAA+B,QAAQ,0CAA0C;AAC1F,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,cAAc,QAAQ,yBAAyB;
|
|
1
|
+
{"version":3,"names":["isEmpty","addClientTagsToOfferLinks","getOffersByProductTypes","selectDynamicOffers","sortOffersByRecommendationScore","pipe","formatOfferUrl","getDynamicOffers","tags","defaultProductType","productTypes","resultType","isCachedOffersRequest","productTypesDefinition","partnersOverrideDefinition","context","userData","offers","rateTableUuid","isError","leadUuid","errorCode","fallbackResult","sortedOffers"],"sourceRoot":"../../../src","sources":["services/getDynamicOffers.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SACCC,yBAAyB,EACzBC,uBAAuB,EACvBC,mBAAmB,QACb,UAAU;AAKjB,SAASC,+BAA+B,QAAQ,0CAA0C;AAC1F,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,cAAc,QAAQ,yBAAyB;AA2BxD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAO;EACtCC,IAAI;EACJC,kBAAkB;EAClBC,YAAY;EACZC,UAAU;EACVC,qBAAqB;EACrBC,sBAAsB;EACtBC,0BAA0B;EAC1BC,OAAO;EACPC;AACqC,CAAC,KAAK;EAC3C;EACA,IAAI;IAAEC,MAAM;IAAEC,aAAa;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAU,CAAC,GAC1D,MAAMnB,uBAAuB,CAAC;IAC7BU,qBAAqB;IACrBF,YAAY;IACZF,IAAI;IACJO,OAAO;IACPC;EACD,CAAC,CAAC;;EAEH;EACA,IAAIhB,OAAO,CAACiB,MAAM,CAAC,EAAE;IACpB,MAAMK,cAAc,GAAG,MAAMpB,uBAAuB,CAAC;MACpDU,qBAAqB;MACrBF,YAAY,EAAE,CAACD,kBAAkB,CAAC;MAClCD,IAAI;MACJO,OAAO;MACPC;IACD,CAAC,CAAC;;IAEF;IACAC,MAAM,GAAGK,cAAc,CAACL,MAAM;IAC9BC,aAAa,GAAGI,cAAc,CAACJ,aAAa;IAC5CC,OAAO,GAAGG,cAAc,CAACH,OAAO;IAChCC,QAAQ,GAAGE,cAAc,CAACF,QAAQ;IAClCV,YAAY,GAAG,CAACD,kBAAkB,CAAC;IACnCY,SAAS,GAAGC,cAAc,CAACD,SAAS;EACrC;EAEA,MAAME,YAAY,GACjBZ,UAAU,KAAK,OAAO,GACnBR,mBAAmB,CAACc,MAAM,EAAEP,YAAY,CAAC,GACzCN,+BAA+B,CAACa,MAAM,CAAC;EAE3C,OAAO;IACNA,MAAM,EAAEZ,IAAI,CACXkB,YAAY,EACZjB,cAAc,CAACO,sBAAsB,EAAEC,0BAA0B,CAAC,EAClEb,yBAAyB,CAACW,qBAAqB,EAAEJ,IAAI,CAAC,EACtDJ,+BACD,CAAC;IACDe,OAAO;IACPE,SAAS;IACTD,QAAQ,EAAEA,QAAQ;IAClBF;EACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -8,13 +8,15 @@ import { parseClientTags } from "../capabilities/offer-catalog/src/utils/context
|
|
|
8
8
|
* @param {boolean} params.isCachedOffersRequest - Indicates if the offers should be retrieved from the cache.
|
|
9
9
|
* @param {string[]} params.productTypes - The product types to retrieve offers for.
|
|
10
10
|
* @param {string} params.tags - The tags to use for retrieving offers.
|
|
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
14
|
export const getOffersByProductTypes = async ({
|
|
14
15
|
isCachedOffersRequest,
|
|
15
16
|
productTypes,
|
|
16
17
|
tags,
|
|
17
|
-
context
|
|
18
|
+
context,
|
|
19
|
+
userData
|
|
18
20
|
}) => {
|
|
19
21
|
if (isCachedOffersRequest) {
|
|
20
22
|
const {
|
|
@@ -38,7 +40,7 @@ export const getOffersByProductTypes = async ({
|
|
|
38
40
|
isError,
|
|
39
41
|
leadUuid,
|
|
40
42
|
errorCode
|
|
41
|
-
} = await getOffersForProductTypes(context)(productTypes, parseClientTags(tags));
|
|
43
|
+
} = await getOffersForProductTypes(context)(productTypes, parseClientTags(tags), userData);
|
|
42
44
|
return {
|
|
43
45
|
offers,
|
|
44
46
|
rateTableUuid: uuid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getCachedOffersByProductTypes","getOffersForProductTypes","parseClientTags","getOffersByProductTypes","isCachedOffersRequest","productTypes","tags","context","offers","uuid","isError","leadUuid","errorCode","rateTableUuid"],"sourceRoot":"../../../src","sources":["utils/getOffersByProductTypes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getCachedOffersByProductTypes","getOffersForProductTypes","parseClientTags","getOffersByProductTypes","isCachedOffersRequest","productTypes","tags","context","userData","offers","uuid","isError","leadUuid","errorCode","rateTableUuid"],"sourceRoot":"../../../src","sources":["utils/getOffersByProductTypes.ts"],"mappings":"AAEA,SACCA,6BAA6B,EAC7BC,wBAAwB,QAClB,uDAAuD;AAC9D,SAASC,eAAe,QAAQ,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,MAAAA,CAAO;EAC7CC,qBAAqB;EACrBC,YAAY;EACZC,IAAI;EACJC,OAAO;EACPC;AAOD,CAAC,KAAK;EACL,IAAIJ,qBAAqB,EAAE;IAC1B,MAAM;MAAEK,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC,QAAQ;MAAEC;IAAU,CAAC,GACnD,MAAMb,6BAA6B,CAACO,OAAO,CAAC,CAACF,YAAY,CAAC;IAE3D,OAAO;MAAEI,MAAM;MAAEK,aAAa,EAAEJ,IAAI;MAAEC,OAAO;MAAEC,QAAQ;MAAEC;IAAU,CAAC;EACrE;EAEA,MAAM;IAAEJ,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAU,CAAC,GACnD,MAAMZ,wBAAwB,CAACM,OAAO,CAAC,CACtCF,YAAY,EACZH,eAAe,CAACI,IAAI,CAAC,EACrBE,QACD,CAAC;EAEF,OAAO;IAAEC,MAAM;IAAEK,aAAa,EAAEJ,IAAI;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAU,CAAC;AACrE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/capabilities/configuration/src/userData/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OffersData } from "../types/offerCatalogSchema";
|
|
2
|
+
import type { UserData } from "../../../configuration/src/userData/types";
|
|
2
3
|
import type { CnfContext } from "../../../core/src/system/cnfContext/CnfContext";
|
|
3
4
|
export declare const getCachedOffersByProductTypes: (context: CnfContext) => (productTypes: string[]) => Promise<{
|
|
4
5
|
errorCode: number;
|
|
@@ -14,5 +15,5 @@ export declare const getCachedOffersByProductTypes: (context: CnfContext) => (pr
|
|
|
14
15
|
offers: never[];
|
|
15
16
|
uuid: string;
|
|
16
17
|
}>;
|
|
17
|
-
export declare const getOffersForProductTypes: (context: CnfContext) => (productTypes: string[], customClientTags?: Record<string, string[]
|
|
18
|
+
export declare const getOffersForProductTypes: (context: CnfContext) => (productTypes: string[], customClientTags?: Record<string, string[]>, userData?: UserData) => Promise<OffersData>;
|
|
18
19
|
//# 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,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAMjF,eAAO,MAAM,6BAA6B,YAC/B,UAAU,oBAA0B,MAAM,EAAE;;;;;;;;;;;;;EAsErD,CAAC;AAEH,eAAO,MAAM,wBAAwB,YAC1B,UAAU,oBAEL,MAAM,EAAE,qBACH,OAAO,MAAM,EAAE,MAAM,EAAE,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;AAMjF,eAAO,MAAM,6BAA6B,YAC/B,UAAU,oBAA0B,MAAM,EAAE;;;;;;;;;;;;;EAsErD,CAAC;AAEH,eAAO,MAAM,wBAAwB,YAC1B,UAAU,oBAEL,MAAM,EAAE,qBACH,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,aAChC,QAAQ,KACjB,QAAQ,UAAU,CAuGpB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type FontFamily } from "../context/ThemeProvider";
|
|
3
3
|
import { type EventHandlerContextType } from "../context/EventHandlerProvider";
|
|
4
|
+
import type { UserData } from "../capabilities/configuration/src/userData/types";
|
|
4
5
|
export type CustomError = {
|
|
5
6
|
code?: number;
|
|
6
7
|
message: string;
|
|
@@ -26,6 +27,7 @@ export type MoneyLionOfferCarouselProps = {
|
|
|
26
27
|
fallbackUI?: React.ReactNode;
|
|
27
28
|
onError?: (error: CustomError) => void;
|
|
28
29
|
onLoad?: (numOffers: number) => void;
|
|
30
|
+
userData?: UserData;
|
|
29
31
|
};
|
|
30
32
|
export declare const MoneyLionOfferCarousel: (props: MoneyLionOfferCarouselProps & Omit<EventHandlerContextType, "rateTableUuid" | "leadUuid">) => React.JSX.Element;
|
|
31
33
|
//# sourceMappingURL=MoneyLionOfferCarousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyLionOfferCarousel.d.ts","sourceRoot":"","sources":["../../../../src/components/MoneyLionOfferCarousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAS5D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAEN,KAAK,uBAAuB,EAC5B,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"MoneyLionOfferCarousel.d.ts","sourceRoot":"","sources":["../../../../src/components/MoneyLionOfferCarousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAS5D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAEN,KAAK,uBAAuB,EAC5B,MAAM,iCAAiC,CAAC;AAKzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AAIjF,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB,CAAC;AAoSF,eAAO,MAAM,sBAAsB,UAC3B,2BAA2B,GACjC,KAAK,uBAAuB,EAAE,eAAe,GAAG,UAAU,CAAC,sBAa5D,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ResultType } from "../services/getProductTypes";
|
|
3
3
|
import type { BaseOffer } from "../capabilities/offer-catalog/src";
|
|
4
|
-
interface onInitializeProps {
|
|
4
|
+
export interface onInitializeProps {
|
|
5
5
|
timestamp: string;
|
|
6
6
|
}
|
|
7
7
|
export interface onRateTableSubmitProps {
|
|
@@ -10,14 +10,14 @@ export interface onRateTableSubmitProps {
|
|
|
10
10
|
resultType: ResultType;
|
|
11
11
|
defaultProductType: string;
|
|
12
12
|
}
|
|
13
|
-
interface onRateTableResponseProps {
|
|
13
|
+
export interface onRateTableResponseProps {
|
|
14
14
|
timestamp: string;
|
|
15
15
|
isError: boolean;
|
|
16
16
|
offers: BaseOffer[];
|
|
17
17
|
rateTableUuid: string;
|
|
18
18
|
leadUuid: string;
|
|
19
19
|
}
|
|
20
|
-
interface onOfferDisplayInViewportProps {
|
|
20
|
+
export interface onOfferDisplayInViewportProps {
|
|
21
21
|
timestamp: string;
|
|
22
22
|
offerUuid: string;
|
|
23
23
|
rateTableUuid: string;
|
|
@@ -35,7 +35,7 @@ export interface onOfferClickProps {
|
|
|
35
35
|
offerIndex: number;
|
|
36
36
|
context: "horizontal_scroll" | "vertical_scroll" | "offer_details";
|
|
37
37
|
}
|
|
38
|
-
interface onOfferDetailsPageOpenProps {
|
|
38
|
+
export interface onOfferDetailsPageOpenProps {
|
|
39
39
|
timestamp: string;
|
|
40
40
|
offerUuid: string;
|
|
41
41
|
rateTableUuid: string;
|
|
@@ -44,7 +44,7 @@ interface onOfferDetailsPageOpenProps {
|
|
|
44
44
|
offerIndex: number;
|
|
45
45
|
context: "horizontal_scroll" | "vertical_scroll";
|
|
46
46
|
}
|
|
47
|
-
interface onOfferDetailsPageCloseProps {
|
|
47
|
+
export interface onOfferDetailsPageCloseProps {
|
|
48
48
|
timestamp: string;
|
|
49
49
|
offerUuid: string;
|
|
50
50
|
rateTableUuid: string;
|
|
@@ -69,5 +69,4 @@ export declare const EventHandlerProvider: React.FC<{
|
|
|
69
69
|
eventHandlers: EventHandlerContextType;
|
|
70
70
|
}>;
|
|
71
71
|
export declare const useEventHandler: () => EventHandlerContextType;
|
|
72
|
-
export {};
|
|
73
72
|
//# sourceMappingURL=EventHandlerProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventHandlerProvider.d.ts","sourceRoot":"","sources":["../../../../src/context/EventHandlerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAEnE,
|
|
1
|
+
{"version":3,"file":"EventHandlerProvider.d.ts","sourceRoot":"","sources":["../../../../src/context/EventHandlerProvider.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export * from "./components/MoneyLionOfferCarousel";
|
|
2
|
+
export type { UserData } from "./capabilities/configuration/src/userData/types";
|
|
3
|
+
export type { onInitializeProps, onRateTableSubmitProps, onRateTableResponseProps, onOfferDisplayInViewportProps, onOfferClickProps, onOfferDetailsPageOpenProps, onOfferDetailsPageCloseProps, } from "./context/EventHandlerProvider";
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AAEpD,YAAY,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAChF,YAAY,EACX,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,2BAA2B,EAC3B,4BAA4B,GAC5B,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import type { UserData } from "./capabilities/configuration/src/userData/types";
|
|
1
2
|
import type { CnfContext } from "./capabilities/core/src/system/cnfContext/CnfContext";
|
|
2
|
-
import type { MoneyLionOfferCarouselProps } from "./components/MoneyLionOfferCarousel";
|
|
3
3
|
import type { onRateTableSubmitProps } from "./context/EventHandlerProvider";
|
|
4
|
+
export type GetPageDataParams = {
|
|
5
|
+
productType?: string;
|
|
6
|
+
query?: string;
|
|
7
|
+
tags?: string;
|
|
8
|
+
searchAPIToken: string;
|
|
9
|
+
showProductTypeLabel?: boolean;
|
|
10
|
+
showCardBorder?: boolean;
|
|
11
|
+
userData?: UserData;
|
|
12
|
+
};
|
|
4
13
|
type GetPageDataProps = {
|
|
5
14
|
context: CnfContext;
|
|
6
|
-
params:
|
|
15
|
+
params: GetPageDataParams;
|
|
7
16
|
onRateTableSubmit?: (props: onRateTableSubmitProps) => void;
|
|
8
17
|
};
|
|
9
18
|
export declare function getPageData({ context, params, onRateTableSubmit, }: GetPageDataProps): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageData.d.ts","sourceRoot":"","sources":["../../../src/pageData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
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;AAGvF,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;CAC5D,CAAC;AAEF,wBAAsB,WAAW,CAAC,EACjC,OAAO,EACP,MAAM,EACN,iBAAiB,GACjB,EAAE,gBAAgB;;;;;;;;;GAyElB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GetProductTypesProps, ProductTypesResult } from "./getProductTypes";
|
|
2
2
|
import type { PartnerOverride, ProductTypeDefinition } from "../capabilities/offer-catalog/src";
|
|
3
|
+
import type { UserData } from "../capabilities/configuration/src/userData/types";
|
|
3
4
|
import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfContext";
|
|
4
5
|
export type GetDynamicOffersProps = {
|
|
5
6
|
tags: string;
|
|
@@ -9,6 +10,7 @@ export type GetDynamicOffersProps = {
|
|
|
9
10
|
productTypesDefinition: ProductTypeDefinition[];
|
|
10
11
|
partnersOverrideDefinition: PartnerOverride[];
|
|
11
12
|
context: CnfContext;
|
|
13
|
+
userData?: UserData;
|
|
12
14
|
} & Omit<GetProductTypesProps, "context" | "productTypeOrUrl" | "query" | "isDevMode" | "referrer" | "searchAPIToken">;
|
|
13
15
|
/**
|
|
14
16
|
* Retrieves dynamic offers based on the provided parameters.
|
|
@@ -16,7 +18,7 @@ export type GetDynamicOffersProps = {
|
|
|
16
18
|
* @param {GetDynamicOffersProps} params - The parameters for retrieving dynamic offers.
|
|
17
19
|
* @returns {Promise<{ productTypeDisplayName: string; offers: typeof offers }>} An object containing the product type display name and the offers.
|
|
18
20
|
*/
|
|
19
|
-
export declare const getDynamicOffers: ({ tags, defaultProductType, productTypes, resultType, isCachedOffersRequest, productTypesDefinition, partnersOverrideDefinition, context, }: Omit<GetDynamicOffersProps, "isDev">) => Promise<{
|
|
21
|
+
export declare const getDynamicOffers: ({ tags, defaultProductType, productTypes, resultType, isCachedOffersRequest, productTypesDefinition, partnersOverrideDefinition, context, userData, }: Omit<GetDynamicOffersProps, "isDev">) => Promise<{
|
|
20
22
|
offers: import("../capabilities/offer-catalog/src").BaseOffer[];
|
|
21
23
|
isError: boolean | undefined;
|
|
22
24
|
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,UAAU,EAAE,MAAM,uDAAuD,CAAC;AAExF,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;CACpB,GAAG,IAAI,CACP,oBAAoB,EAClB,SAAS,GACT,kBAAkB,GAClB,OAAO,GACP,WAAW,GACX,UAAU,GACV,gBAAgB,CAClB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,
|
|
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;AAExF,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;CACpB,GAAG,IAAI,CACP,oBAAoB,EAClB,SAAS,GACT,kBAAkB,GAClB,OAAO,GACP,WAAW,GACX,UAAU,GACV,gBAAgB,CAClB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,0JAU1B,KAAK,qBAAqB,EAAE,OAAO,CAAC;;;;;;EA+CtC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UserData } from "../capabilities/configuration/src/userData/types";
|
|
1
2
|
import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfContext";
|
|
2
3
|
/**
|
|
3
4
|
* Retrieves offers by product types.
|
|
@@ -6,13 +7,15 @@ import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfC
|
|
|
6
7
|
* @param {boolean} params.isCachedOffersRequest - Indicates if the offers should be retrieved from the cache.
|
|
7
8
|
* @param {string[]} params.productTypes - The product types to retrieve offers for.
|
|
8
9
|
* @param {string} params.tags - The tags to use for retrieving offers.
|
|
10
|
+
* @param {UserData} params.userData - Optional user data.
|
|
9
11
|
* @returns {Promise<OffersData>} A promise that resolves to an array of offers or undefined if no offers are found.
|
|
10
12
|
*/
|
|
11
|
-
export declare const getOffersByProductTypes: ({ isCachedOffersRequest, productTypes, tags, context, }: {
|
|
13
|
+
export declare const getOffersByProductTypes: ({ isCachedOffersRequest, productTypes, tags, context, userData, }: {
|
|
12
14
|
isCachedOffersRequest: boolean;
|
|
13
15
|
productTypes: string[];
|
|
14
16
|
tags: string;
|
|
15
17
|
context: CnfContext;
|
|
18
|
+
userData?: UserData | undefined;
|
|
16
19
|
}) => Promise<{
|
|
17
20
|
offers: never[] | import("../capabilities/offer-catalog/src").BaseOffer[];
|
|
18
21
|
rateTableUuid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOffersByProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/utils/getOffersByProductTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AAOxF
|
|
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;AAOxF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB;2BAOZ,OAAO;kBAChB,MAAM,EAAE;UAChB,MAAM;aACH,UAAU;;;;;;;;EAkBnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import errorUtil from "../utils/errorUtil";
|
|
|
11
11
|
import type { State } from "../../../offers/pipeline/src/sources/ratetables/types";
|
|
12
12
|
import { withDeviceSignals } from "../../../offers/pipeline/src/sources/ratetables/withDeviceSignals";
|
|
13
13
|
import { getOfferCatalogApiBaseUrl } from "../../../../apiEnvironment";
|
|
14
|
+
import type { UserData } from "../../../configuration/src/userData/types";
|
|
14
15
|
import type { CnfContext } from "../../../core/src/system/cnfContext/CnfContext";
|
|
15
16
|
|
|
16
17
|
interface ApiError extends Error {
|
|
@@ -94,7 +95,8 @@ export const getOffersForProductTypes =
|
|
|
94
95
|
(context: CnfContext) =>
|
|
95
96
|
async (
|
|
96
97
|
productTypes: string[],
|
|
97
|
-
customClientTags?: Record<string, string[]
|
|
98
|
+
customClientTags?: Record<string, string[]>,
|
|
99
|
+
userData?: UserData
|
|
98
100
|
): Promise<OffersData> => {
|
|
99
101
|
// const offersFromProductTypesLogger = pinoRootLogger.child({
|
|
100
102
|
// name: "offersFromProductTypesLogger",
|
|
@@ -105,9 +107,18 @@ export const getOffersForProductTypes =
|
|
|
105
107
|
const leadUuid = getLeadUUID(context);
|
|
106
108
|
const isDev = getIsDevEnvironment(context);
|
|
107
109
|
|
|
110
|
+
const userEmail = userData?.email;
|
|
111
|
+
const userInformation = {
|
|
112
|
+
// If no email passed, do not include in the payload
|
|
113
|
+
...(Boolean(userEmail) && { email: userEmail }),
|
|
114
|
+
};
|
|
115
|
+
|
|
108
116
|
let fields = {
|
|
109
117
|
productTypes,
|
|
110
118
|
clientTags: customClientTags,
|
|
119
|
+
personalInformation: {
|
|
120
|
+
...userInformation,
|
|
121
|
+
},
|
|
111
122
|
};
|
|
112
123
|
|
|
113
124
|
try {
|
|
@@ -116,7 +127,10 @@ export const getOffersForProductTypes =
|
|
|
116
127
|
fields = withDeviceSignals(context, {
|
|
117
128
|
productTypes,
|
|
118
129
|
clientTags: customClientTags,
|
|
119
|
-
personalInformation: {
|
|
130
|
+
personalInformation: {
|
|
131
|
+
state: stateCode as State,
|
|
132
|
+
...userInformation,
|
|
133
|
+
},
|
|
120
134
|
});
|
|
121
135
|
} catch (error) {
|
|
122
136
|
// handle error if context is not available. This scenario should not occur in production
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { localCnfContext } from "../config/mocks/cnfContext";
|
|
3
3
|
import { Text } from "react-native";
|
|
4
|
-
import { getPageData } from "../pageData";
|
|
4
|
+
import { getPageData, type GetPageDataParams } from "../pageData";
|
|
5
5
|
import {
|
|
6
6
|
DynamicOffersContainer,
|
|
7
7
|
DynamicOfferSkeleton,
|
|
@@ -16,6 +16,7 @@ import { getConfigApiBaseUrl } from "../apiEnvironment";
|
|
|
16
16
|
import { ConfigurationProvider } from "../context/ConfigurationProvider";
|
|
17
17
|
import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfContext";
|
|
18
18
|
import { getThemeColors } from "../utils/getThemeColors";
|
|
19
|
+
import type { UserData } from "../capabilities/configuration/src/userData/types";
|
|
19
20
|
import type { ReshapedThemeColors } from "../capabilities/core/src";
|
|
20
21
|
import ErrorBoundary from "./ErrorBoundary";
|
|
21
22
|
|
|
@@ -45,6 +46,7 @@ export type MoneyLionOfferCarouselProps = {
|
|
|
45
46
|
fallbackUI?: React.ReactNode;
|
|
46
47
|
onError?: (error: CustomError) => void;
|
|
47
48
|
onLoad?: (numOffers: number) => void;
|
|
49
|
+
userData?: UserData;
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
const getConfiguration = async ({
|
|
@@ -112,6 +114,13 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
112
114
|
title,
|
|
113
115
|
subtitle,
|
|
114
116
|
isDarkTheme = false,
|
|
117
|
+
productType,
|
|
118
|
+
query,
|
|
119
|
+
tags,
|
|
120
|
+
searchAPIToken,
|
|
121
|
+
showProductTypeLabel: _showProductTypeLabel,
|
|
122
|
+
showCardBorder: _showCardBorder,
|
|
123
|
+
userData,
|
|
115
124
|
} = props;
|
|
116
125
|
|
|
117
126
|
const {
|
|
@@ -134,15 +143,41 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
134
143
|
onOfferDetailsPageClose,
|
|
135
144
|
};
|
|
136
145
|
|
|
146
|
+
const getPageDataParams: GetPageDataParams = useMemo(
|
|
147
|
+
() => ({
|
|
148
|
+
productType,
|
|
149
|
+
query,
|
|
150
|
+
tags,
|
|
151
|
+
searchAPIToken,
|
|
152
|
+
userData: {
|
|
153
|
+
email: userData?.email || "",
|
|
154
|
+
},
|
|
155
|
+
showProductTypeLabel: _showProductTypeLabel,
|
|
156
|
+
showCardBorder: _showCardBorder,
|
|
157
|
+
}),
|
|
158
|
+
[
|
|
159
|
+
productType,
|
|
160
|
+
query,
|
|
161
|
+
tags,
|
|
162
|
+
searchAPIToken,
|
|
163
|
+
_showProductTypeLabel,
|
|
164
|
+
_showCardBorder,
|
|
165
|
+
userData?.email,
|
|
166
|
+
]
|
|
167
|
+
);
|
|
168
|
+
|
|
137
169
|
const [context, setContext] = useState<CnfContext | null>(null);
|
|
138
|
-
const [
|
|
170
|
+
const [isFetchingData, setIsFetchingData] = useState(true);
|
|
171
|
+
const [isFetchingConfig, setIsFetchingConfig] = useState(true);
|
|
139
172
|
const [error, setError] = useState<Error | null>(null);
|
|
140
173
|
const [pageData, setPageData] = useState<any>(null);
|
|
141
174
|
|
|
175
|
+
const isLoading = isFetchingData || isFetchingConfig;
|
|
176
|
+
|
|
142
177
|
useEffect(() => {
|
|
143
178
|
const fetchConfiguration = async () => {
|
|
144
179
|
try {
|
|
145
|
-
|
|
180
|
+
setIsFetchingConfig(true);
|
|
146
181
|
const data = await getConfiguration({
|
|
147
182
|
channel,
|
|
148
183
|
zone,
|
|
@@ -167,26 +202,34 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
167
202
|
});
|
|
168
203
|
}
|
|
169
204
|
} finally {
|
|
170
|
-
|
|
205
|
+
setIsFetchingConfig(false);
|
|
171
206
|
}
|
|
172
207
|
};
|
|
173
208
|
|
|
174
209
|
fetchConfiguration();
|
|
175
|
-
|
|
210
|
+
// Ignoring callback functions in the dependency array
|
|
211
|
+
// to avoid unnecessary re-fetching of page data
|
|
212
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
213
|
+
}, [channel, zone, subAccountToken, isDev]);
|
|
176
214
|
|
|
177
215
|
useEffect(() => {
|
|
178
|
-
if (
|
|
216
|
+
if (isFetchingConfig) {
|
|
179
217
|
onInitialize?.({ timestamp: new Date().toISOString() });
|
|
180
218
|
}
|
|
181
|
-
|
|
219
|
+
// Ignoring callback functions in the dependency array
|
|
220
|
+
// to avoid unnecessary re-fetching of page data
|
|
221
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
222
|
+
}, [isFetchingConfig]);
|
|
182
223
|
|
|
183
224
|
useEffect(() => {
|
|
184
225
|
const fetchPageData = async () => {
|
|
185
|
-
if
|
|
226
|
+
// Should only fetch data if context is done fetching
|
|
227
|
+
if (context && !isFetchingConfig) {
|
|
186
228
|
try {
|
|
229
|
+
setIsFetchingData(true);
|
|
187
230
|
const data = await getPageData({
|
|
188
231
|
context: { ...context, isDev },
|
|
189
|
-
params:
|
|
232
|
+
params: getPageDataParams,
|
|
190
233
|
onRateTableSubmit,
|
|
191
234
|
});
|
|
192
235
|
|
|
@@ -217,21 +260,17 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
217
260
|
message: errorObj.message,
|
|
218
261
|
timestamp: new Date().toISOString(),
|
|
219
262
|
});
|
|
263
|
+
} finally {
|
|
264
|
+
setIsFetchingData(false);
|
|
220
265
|
}
|
|
221
266
|
}
|
|
222
267
|
};
|
|
223
268
|
|
|
224
269
|
fetchPageData();
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
onRateTableSubmit,
|
|
230
|
-
props,
|
|
231
|
-
isLoading,
|
|
232
|
-
onError,
|
|
233
|
-
onLoad,
|
|
234
|
-
]);
|
|
270
|
+
// Ignoring callback functions in the dependency array
|
|
271
|
+
// to avoid unnecessary re-fetching of page data
|
|
272
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
273
|
+
}, [context, isDev, getPageDataParams, isFetchingConfig]);
|
|
235
274
|
|
|
236
275
|
const themeColors = useMemo(
|
|
237
276
|
() =>
|
|
@@ -2,7 +2,7 @@ import React, { createContext, useContext } from "react";
|
|
|
2
2
|
import type { ResultType } from "../services/getProductTypes";
|
|
3
3
|
import type { BaseOffer } from "../capabilities/offer-catalog/src";
|
|
4
4
|
|
|
5
|
-
interface onInitializeProps {
|
|
5
|
+
export interface onInitializeProps {
|
|
6
6
|
timestamp: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export interface onRateTableSubmitProps {
|
|
|
13
13
|
defaultProductType: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
interface onRateTableResponseProps {
|
|
16
|
+
export interface onRateTableResponseProps {
|
|
17
17
|
timestamp: string;
|
|
18
18
|
isError: boolean;
|
|
19
19
|
offers: BaseOffer[];
|
|
@@ -21,7 +21,7 @@ interface onRateTableResponseProps {
|
|
|
21
21
|
leadUuid: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
interface onOfferDisplayInViewportProps {
|
|
24
|
+
export interface onOfferDisplayInViewportProps {
|
|
25
25
|
timestamp: string;
|
|
26
26
|
offerUuid: string;
|
|
27
27
|
rateTableUuid: string;
|
|
@@ -41,7 +41,7 @@ export interface onOfferClickProps {
|
|
|
41
41
|
context: "horizontal_scroll" | "vertical_scroll" | "offer_details";
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
interface onOfferDetailsPageOpenProps {
|
|
44
|
+
export interface onOfferDetailsPageOpenProps {
|
|
45
45
|
timestamp: string;
|
|
46
46
|
offerUuid: string;
|
|
47
47
|
rateTableUuid: string;
|
|
@@ -51,7 +51,7 @@ interface onOfferDetailsPageOpenProps {
|
|
|
51
51
|
context: "horizontal_scroll" | "vertical_scroll";
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
interface onOfferDetailsPageCloseProps {
|
|
54
|
+
export interface onOfferDetailsPageCloseProps {
|
|
55
55
|
timestamp: string;
|
|
56
56
|
offerUuid: string;
|
|
57
57
|
rateTableUuid: string;
|
package/src/index.tsx
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export * from "./components/MoneyLionOfferCarousel";
|
|
2
|
+
|
|
3
|
+
export type { UserData } from "./capabilities/configuration/src/userData/types";
|
|
4
|
+
export type {
|
|
5
|
+
onInitializeProps,
|
|
6
|
+
onRateTableSubmitProps,
|
|
7
|
+
onRateTableResponseProps,
|
|
8
|
+
onOfferDisplayInViewportProps,
|
|
9
|
+
onOfferClickProps,
|
|
10
|
+
onOfferDetailsPageOpenProps,
|
|
11
|
+
onOfferDetailsPageCloseProps,
|
|
12
|
+
} from "./context/EventHandlerProvider";
|
package/src/pageData.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { UserData } from "./capabilities/configuration/src/userData/types";
|
|
1
2
|
import type { CnfContext } from "./capabilities/core/src/system/cnfContext/CnfContext";
|
|
2
3
|
import { getIsDevEnvironment } from "./capabilities/offer-catalog/src/utils/contextUtil";
|
|
3
4
|
|
|
4
|
-
import type { MoneyLionOfferCarouselProps } from "./components/MoneyLionOfferCarousel";
|
|
5
5
|
import type { onRateTableSubmitProps } from "./context/EventHandlerProvider";
|
|
6
6
|
import { getDynamicOffers } from "./services/getDynamicOffers";
|
|
7
7
|
// import { getDynamicOffers } from "./services/getDynamicOffers";
|
|
@@ -12,9 +12,19 @@ import {
|
|
|
12
12
|
} from "./utils";
|
|
13
13
|
import { getEnableUseCachedOffers } from "./utils/getEnableUseCachedOffers";
|
|
14
14
|
|
|
15
|
+
export type GetPageDataParams = {
|
|
16
|
+
productType?: string;
|
|
17
|
+
query?: string;
|
|
18
|
+
tags?: string;
|
|
19
|
+
searchAPIToken: string;
|
|
20
|
+
showProductTypeLabel?: boolean;
|
|
21
|
+
showCardBorder?: boolean;
|
|
22
|
+
userData?: UserData;
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
type GetPageDataProps = {
|
|
16
26
|
context: CnfContext;
|
|
17
|
-
params:
|
|
27
|
+
params: GetPageDataParams;
|
|
18
28
|
onRateTableSubmit?: (props: onRateTableSubmitProps) => void;
|
|
19
29
|
};
|
|
20
30
|
|
|
@@ -30,6 +40,7 @@ export async function getPageData({
|
|
|
30
40
|
searchAPIToken,
|
|
31
41
|
showProductTypeLabel,
|
|
32
42
|
showCardBorder,
|
|
43
|
+
userData,
|
|
33
44
|
} = params;
|
|
34
45
|
|
|
35
46
|
// Resolve Tags
|
|
@@ -78,6 +89,7 @@ export async function getPageData({
|
|
|
78
89
|
partnersOverrideDefinition: [...partnersOverrideDefinition],
|
|
79
90
|
context,
|
|
80
91
|
defaultProductType,
|
|
92
|
+
userData,
|
|
81
93
|
});
|
|
82
94
|
|
|
83
95
|
return {
|