@moneylion/react-native-offer-carousel 1.9.0 → 1.9.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/CHANGELOG.md +6 -0
- package/lib/commonjs/apiEnvironment.js +1 -7
- package/lib/commonjs/apiEnvironment.js.map +1 -1
- package/lib/commonjs/components/MoneyLionOfferCarousel.js +3 -8
- package/lib/commonjs/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/commonjs/pageData.js +1 -12
- package/lib/commonjs/pageData.js.map +1 -1
- package/lib/commonjs/services/getDynamicOffers.js +1 -2
- package/lib/commonjs/services/getDynamicOffers.js.map +1 -1
- package/lib/commonjs/services/getProductTypes.js +3 -22
- package/lib/commonjs/services/getProductTypes.js.map +1 -1
- package/lib/commonjs/utils/index.js +0 -11
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/resolveProductTypes.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/apiEnvironment.js +0 -5
- package/lib/module/apiEnvironment.js.map +1 -1
- package/lib/module/components/MoneyLionOfferCarousel.js +3 -8
- package/lib/module/components/MoneyLionOfferCarousel.js.map +1 -1
- package/lib/module/pageData.js +1 -11
- package/lib/module/pageData.js.map +1 -1
- package/lib/module/services/getDynamicOffers.js +2 -3
- package/lib/module/services/getDynamicOffers.js.map +1 -1
- package/lib/module/services/getProductTypes.js +3 -22
- package/lib/module/services/getProductTypes.js.map +1 -1
- package/lib/module/utils/index.js +0 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/resolveProductTypes.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/apiEnvironment.d.ts +0 -4
- package/lib/typescript/src/apiEnvironment.d.ts.map +1 -1
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts +0 -2
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +1 -1
- package/lib/typescript/src/pageData.d.ts +0 -2
- package/lib/typescript/src/pageData.d.ts.map +1 -1
- package/lib/typescript/src/services/getDynamicOffers.d.ts +3 -4
- package/lib/typescript/src/services/getDynamicOffers.d.ts.map +1 -1
- package/lib/typescript/src/services/getProductTypes.d.ts +2 -7
- package/lib/typescript/src/services/getProductTypes.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +0 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolveProductTypes.d.ts +0 -5
- package/lib/typescript/src/utils/resolveProductTypes.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/apiEnvironment.ts +0 -6
- package/src/components/MoneyLionOfferCarousel.tsx +2 -11
- package/src/pageData.ts +2 -20
- package/src/services/getDynamicOffers.ts +4 -21
- package/src/services/getProductTypes.ts +5 -28
- package/src/utils/index.ts +0 -1
- package/src/utils/resolveProductTypes.ts +0 -5
- package/src/version.ts +1 -1
- package/lib/commonjs/capabilities/core/src/domain/third-party-search/index.js +0 -17
- package/lib/commonjs/capabilities/core/src/domain/third-party-search/index.js.map +0 -1
- package/lib/commonjs/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.js +0 -33
- package/lib/commonjs/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.js.map +0 -1
- package/lib/commonjs/services/getProductTypesByQuery.js +0 -72
- package/lib/commonjs/services/getProductTypesByQuery.js.map +0 -1
- package/lib/commonjs/utils/selectDynamicOffers.js +0 -13
- package/lib/commonjs/utils/selectDynamicOffers.js.map +0 -1
- package/lib/module/capabilities/core/src/domain/third-party-search/index.js +0 -2
- package/lib/module/capabilities/core/src/domain/third-party-search/index.js.map +0 -1
- package/lib/module/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.js +0 -26
- package/lib/module/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.js.map +0 -1
- package/lib/module/services/getProductTypesByQuery.js +0 -65
- package/lib/module/services/getProductTypesByQuery.js.map +0 -1
- package/lib/module/utils/selectDynamicOffers.js +0 -6
- package/lib/module/utils/selectDynamicOffers.js.map +0 -1
- package/lib/typescript/src/capabilities/core/src/domain/third-party-search/index.d.ts +0 -2
- package/lib/typescript/src/capabilities/core/src/domain/third-party-search/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.d.ts +0 -19
- package/lib/typescript/src/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.d.ts.map +0 -1
- package/lib/typescript/src/services/getProductTypesByQuery.d.ts +0 -30
- package/lib/typescript/src/services/getProductTypesByQuery.d.ts.map +0 -1
- package/lib/typescript/src/utils/selectDynamicOffers.d.ts +0 -3
- package/lib/typescript/src/utils/selectDynamicOffers.d.ts.map +0 -1
- package/src/capabilities/core/src/domain/third-party-search/index.ts +0 -1
- package/src/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.ts +0 -33
- package/src/services/getProductTypesByQuery.ts +0 -76
- package/src/utils/selectDynamicOffers.ts +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["parseProductTypes","productType","includes","split","map","productTypeSlug","trim","getProductTypes","defaultProductType","length","productTypes","resultType"],"sourceRoot":"../../../src","sources":["services/getProductTypes.ts"],"mappings":"AAYA,MAAMA,iBAAiB,GAAIC,WAAmB,IAAe;EAC5D,OAAOA,WAAW,CAACC,QAAQ,CAAC,GAAG,CAAC,GAC7BD,WAAW,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAEC,eAAe,IAAKA,eAAe,CAACC,IAAI,CAAC,CAAC,CAAC,GACvE,CAACL,WAAW,CAAC;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,eAAe,GAAG,MAAAA,CAAO;EACrCN,WAAW;EACXO;AACqB,CAAC,KAAkC;EACxD,IAAIP,WAAW,IAAIA,WAAW,CAACK,IAAI,CAAC,CAAC,CAACG,MAAM,GAAG,CAAC,EAAE;IACjD,MAAMC,YAAY,GAAG,MAAMV,iBAAiB,CAACC,WAAW,CAAC;IACzD,OAAO;MAAES,YAAY;MAAEC,UAAU,EAAE;IAAe,CAAC;EACpD;EAEA,OAAO;IAAED,YAAY,EAAE,CAACF,kBAAkB,CAAC;IAAEG,UAAU,EAAE;EAAU,CAAC;AACrE,CAAC","ignoreList":[]}
|
|
@@ -3,7 +3,6 @@ export * from "./getDefaultProductType";
|
|
|
3
3
|
export * from "./getOffersByProductTypes";
|
|
4
4
|
export * from "./getProductTypesDefinition";
|
|
5
5
|
export * from "./resolveProductTypes";
|
|
6
|
-
export * from "./selectDynamicOffers";
|
|
7
6
|
export * from "./sortOffersByRecommendationScore";
|
|
8
7
|
export * from "./parseStringProductTypes";
|
|
9
8
|
export * from "./getEnableUseCachedOffers";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,cAAc,6BAA6B;AAC3C,cAAc,yBAAyB;AACvC,cAAc,2BAA2B;AACzC,cAAc,6BAA6B;AAC3C,cAAc,uBAAuB;AACrC,cAAc,
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,cAAc,6BAA6B;AAC3C,cAAc,yBAAyB;AACvC,cAAc,2BAA2B;AACzC,cAAc,6BAA6B;AAC3C,cAAc,uBAAuB;AACrC,cAAc,mCAAmC;AACjD,cAAc,2BAA2B;AACzC,cAAc,4BAA4B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getProductTypes","resolveProductTypes","props"],"sourceRoot":"../../../src","sources":["utils/resolveProductTypes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getProductTypes","resolveProductTypes","props"],"sourceRoot":"../../../src","sources":["utils/resolveProductTypes.ts"],"mappings":"AAAA,SAASA,eAAe,QAAyB,6BAA6B;AAO9E,OAAO,MAAMC,mBAAmB,GAAG,MAClCC,KAA+B,IAI1B;EACL,OAAO,MAAMF,eAAe,CAACE,KAAK,CAAC;AACpC,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -6,8 +6,4 @@ export declare const getConfigApiBaseUrl: (isDev: boolean) => string;
|
|
|
6
6
|
* Gets the base URL for the Offer Catalog API.
|
|
7
7
|
*/
|
|
8
8
|
export declare const getOfferCatalogApiBaseUrl: (isDev: boolean) => string;
|
|
9
|
-
/**
|
|
10
|
-
* Gets the base URL for the EWS Search API.
|
|
11
|
-
*/
|
|
12
|
-
export declare const getEwsSearchApiBaseUrl: (isDev: boolean) => string;
|
|
13
9
|
//# sourceMappingURL=apiEnvironment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiEnvironment.d.ts","sourceRoot":"","sources":["../../../src/apiEnvironment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,MACa,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,OAAO,KAAG,MACO,CAAC
|
|
1
|
+
{"version":3,"file":"apiEnvironment.d.ts","sourceRoot":"","sources":["../../../src/apiEnvironment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,MACa,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,OAAO,KAAG,MACO,CAAC"}
|
|
@@ -13,9 +13,7 @@ export type MoneyLionOfferCarouselProps = {
|
|
|
13
13
|
channel: string;
|
|
14
14
|
zone: string;
|
|
15
15
|
subAccountToken: string;
|
|
16
|
-
searchAPIToken: string;
|
|
17
16
|
productType?: string;
|
|
18
|
-
query?: string;
|
|
19
17
|
tags?: string;
|
|
20
18
|
staticProductTypes?: string;
|
|
21
19
|
fontFamily?: Partial<FontFamily>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyLionOfferCarousel.d.ts","sourceRoot":"","sources":["../../../../src/components/MoneyLionOfferCarousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKb,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,MAAM,OAAO,CAAC;AASf,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAEN,KAAK,uBAAuB,EAC5B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AAExF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AAIjF,OAAO,KAAK,EAGX,uBAAuB,EACvB,eAAe,EACf,MAAM,8BAA8B,CAAC;AAItC,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,
|
|
1
|
+
{"version":3,"file":"MoneyLionOfferCarousel.d.ts","sourceRoot":"","sources":["../../../../src/components/MoneyLionOfferCarousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKb,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,MAAM,OAAO,CAAC;AASf,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAEN,KAAK,uBAAuB,EAC5B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AAExF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AAIjF,OAAO,KAAK,EAGX,uBAAuB,EACvB,eAAe,EACf,MAAM,8BAA8B,CAAC;AAItC,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,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,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,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,mCAAoC,SAAQ,IAAI,CAChE,2BAA2B,EAC3B,YAAY,CACZ;IACA,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;AA0VD,eAAO,MAAM,sBAAsB,GAClC,OAAO,2BAA2B,GACjC,IAAI,CAAC,uBAAuB,EAAE,eAAe,GAAG,UAAU,CAAC,sBA6C5D,CAAC"}
|
|
@@ -4,9 +4,7 @@ import type { InternalOnErrorCallback } from "./capabilities/errors/types";
|
|
|
4
4
|
import type { onRateTableSubmitProps } from "./context/EventHandlerProvider";
|
|
5
5
|
export type GetPageDataParams = {
|
|
6
6
|
productType?: string;
|
|
7
|
-
query?: string;
|
|
8
7
|
tags?: string;
|
|
9
|
-
searchAPIToken: string;
|
|
10
8
|
showProductTypeLabel?: boolean;
|
|
11
9
|
showCardBorder?: boolean;
|
|
12
10
|
userData?: UserData;
|
|
@@ -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;AACvF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,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;AAE3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAS7E,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,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;;;;;;;;;GA6DlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetProductTypesProps
|
|
1
|
+
import type { GetProductTypesProps } 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";
|
|
@@ -6,21 +6,20 @@ import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
|
6
6
|
export type GetDynamicOffersProps = {
|
|
7
7
|
tags: string;
|
|
8
8
|
productTypes: string[];
|
|
9
|
-
resultType: ProductTypesResult["resultType"];
|
|
10
9
|
isCachedOffersRequest: boolean;
|
|
11
10
|
productTypesDefinition: ProductTypeDefinition[];
|
|
12
11
|
partnersOverrideDefinition: PartnerOverride[];
|
|
13
12
|
context: CnfContext;
|
|
14
13
|
userData?: UserData;
|
|
15
14
|
onError?: InternalOnErrorCallback;
|
|
16
|
-
} & Omit<GetProductTypesProps, "context" | "productTypeOrUrl" | "
|
|
15
|
+
} & Omit<GetProductTypesProps, "context" | "productTypeOrUrl" | "isDevMode" | "referrer">;
|
|
17
16
|
/**
|
|
18
17
|
* Retrieves dynamic offers based on the provided parameters.
|
|
19
18
|
*
|
|
20
19
|
* @param {GetDynamicOffersProps} params - The parameters for retrieving dynamic offers.
|
|
21
20
|
* @returns {Promise<{ productTypeDisplayName: string; offers: typeof offers }>} An object containing the product type display name and the offers.
|
|
22
21
|
*/
|
|
23
|
-
export declare const getDynamicOffers: ({ tags, defaultProductType, productTypes,
|
|
22
|
+
export declare const getDynamicOffers: ({ tags, defaultProductType, productTypes, isCachedOffersRequest, productTypesDefinition, partnersOverrideDefinition, context, userData, onError, }: Omit<GetDynamicOffersProps, "isDev">) => Promise<{
|
|
24
23
|
offers: import("../capabilities/offer-catalog/src").BaseOffer[];
|
|
25
24
|
isError: boolean | undefined;
|
|
26
25
|
errorCode: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDynamicOffers.d.ts","sourceRoot":"","sources":["../../../../src/services/getDynamicOffers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDynamicOffers.d.ts","sourceRoot":"","sources":["../../../../src/services/getDynamicOffers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAI9D,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,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,EACpB,SAAS,GAAG,kBAAkB,GAAG,WAAW,GAAG,UAAU,CACzD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAU,oJAUpC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC;;;;;;EA+CtC,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
2
1
|
export type GetProductTypesProps = {
|
|
3
2
|
productType?: string;
|
|
4
|
-
query?: string;
|
|
5
3
|
defaultProductType: string;
|
|
6
|
-
searchAPIToken: string;
|
|
7
|
-
isDev: boolean;
|
|
8
|
-
onError?: InternalOnErrorCallback;
|
|
9
4
|
};
|
|
10
|
-
export type ResultType = "STATIC" | "
|
|
5
|
+
export type ResultType = "STATIC" | "PRODUCT_TYPE" | "DEFAULT";
|
|
11
6
|
export type ProductTypesResult = {
|
|
12
7
|
productTypes: string[];
|
|
13
8
|
resultType: ResultType;
|
|
@@ -17,5 +12,5 @@ export type ProductTypesResult = {
|
|
|
17
12
|
* @param props - The properties to get the product types
|
|
18
13
|
* @returns The product types
|
|
19
14
|
*/
|
|
20
|
-
export declare const getProductTypes: ({ productType, defaultProductType,
|
|
15
|
+
export declare const getProductTypes: ({ productType, defaultProductType, }: GetProductTypesProps) => Promise<ProductTypesResult>;
|
|
21
16
|
//# sourceMappingURL=getProductTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/services/getProductTypes.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"getProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/services/getProductTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC;AAE/D,MAAM,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAQF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,sCAGnC,oBAAoB,KAAG,OAAO,CAAC,kBAAkB,CAOnD,CAAC"}
|
|
@@ -3,7 +3,6 @@ export * from "./getDefaultProductType";
|
|
|
3
3
|
export * from "./getOffersByProductTypes";
|
|
4
4
|
export * from "./getProductTypesDefinition";
|
|
5
5
|
export * from "./resolveProductTypes";
|
|
6
|
-
export * from "./selectDynamicOffers";
|
|
7
6
|
export * from "./sortOffersByRecommendationScore";
|
|
8
7
|
export * from "./parseStringProductTypes";
|
|
9
8
|
export * from "./getEnableUseCachedOffers";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
2
1
|
import { type ResultType } from "../services/getProductTypes";
|
|
3
2
|
type ResolveProductTypesProps = {
|
|
4
3
|
productType?: string;
|
|
5
|
-
query?: string;
|
|
6
4
|
defaultProductType: string;
|
|
7
|
-
searchAPIToken: string;
|
|
8
|
-
isDev: boolean;
|
|
9
|
-
onError?: InternalOnErrorCallback;
|
|
10
5
|
};
|
|
11
6
|
export declare const resolveProductTypes: (props: ResolveProductTypesProps) => Promise<{
|
|
12
7
|
productTypes: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveProductTypes.d.ts","sourceRoot":"","sources":["../../../../src/utils/resolveProductTypes.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,kBAAkB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC/B,OAAO,wBAAwB,KAC7B,OAAO,CAAC;IACV,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACvB,CAEA,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.9.
|
|
1
|
+
export declare const VERSION = "1.9.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
package/src/apiEnvironment.ts
CHANGED
|
@@ -9,9 +9,3 @@ export const getConfigApiBaseUrl = (isDev: boolean): string =>
|
|
|
9
9
|
*/
|
|
10
10
|
export const getOfferCatalogApiBaseUrl = (isDev: boolean): string =>
|
|
11
11
|
isDev ? "https://dev-api.engine.tech" : "https://api.engine.tech";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Gets the base URL for the EWS Search API.
|
|
15
|
-
*/
|
|
16
|
-
export const getEwsSearchApiBaseUrl = (isDev: boolean): string =>
|
|
17
|
-
isDev ? "https://api.dev-ews.engine.tech" : "https://api.ews.engine.tech";
|
|
@@ -46,9 +46,7 @@ export type MoneyLionOfferCarouselProps = {
|
|
|
46
46
|
channel: string;
|
|
47
47
|
zone: string;
|
|
48
48
|
subAccountToken: string;
|
|
49
|
-
searchAPIToken: string;
|
|
50
49
|
productType?: string;
|
|
51
|
-
query?: string;
|
|
52
50
|
tags?: string;
|
|
53
51
|
staticProductTypes?: string;
|
|
54
52
|
fontFamily?: Partial<FontFamily>;
|
|
@@ -141,9 +139,7 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
141
139
|
subtitle,
|
|
142
140
|
isDarkTheme = false,
|
|
143
141
|
productType,
|
|
144
|
-
query,
|
|
145
142
|
tags,
|
|
146
|
-
searchAPIToken,
|
|
147
143
|
showProductTypeLabel: _showProductTypeLabel,
|
|
148
144
|
showCardBorder: _showCardBorder,
|
|
149
145
|
userData,
|
|
@@ -176,9 +172,7 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
176
172
|
const getPageDataParams: GetPageDataParams = useMemo(
|
|
177
173
|
() => ({
|
|
178
174
|
productType,
|
|
179
|
-
query,
|
|
180
175
|
tags,
|
|
181
|
-
searchAPIToken,
|
|
182
176
|
userData: {
|
|
183
177
|
email: userData?.email || "",
|
|
184
178
|
_mockUserCountry: userData?._mockUserCountry || "",
|
|
@@ -188,9 +182,7 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
188
182
|
}),
|
|
189
183
|
[
|
|
190
184
|
productType,
|
|
191
|
-
query,
|
|
192
185
|
tags,
|
|
193
|
-
searchAPIToken,
|
|
194
186
|
_showProductTypeLabel,
|
|
195
187
|
_showCardBorder,
|
|
196
188
|
userData?.email,
|
|
@@ -268,12 +260,11 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
268
260
|
}, [isFetchingConfig]);
|
|
269
261
|
|
|
270
262
|
useEffect(() => {
|
|
271
|
-
if (!channel || !zone || !subAccountToken
|
|
263
|
+
if (!channel || !zone || !subAccountToken) {
|
|
272
264
|
const missingParams: string[] = [];
|
|
273
265
|
if (!channel) missingParams.push("channel");
|
|
274
266
|
if (!zone) missingParams.push("zone");
|
|
275
267
|
if (!subAccountToken) missingParams.push("subAccountToken");
|
|
276
|
-
if (!searchAPIToken) missingParams.push("searchAPIToken");
|
|
277
268
|
|
|
278
269
|
onError?.({
|
|
279
270
|
code: ErrorCodes.MISSING_CONFIG,
|
|
@@ -282,7 +273,7 @@ const InternalMoneyLionOfferCarousel = (
|
|
|
282
273
|
});
|
|
283
274
|
}
|
|
284
275
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
285
|
-
}, [channel, zone, subAccountToken
|
|
276
|
+
}, [channel, zone, subAccountToken]);
|
|
286
277
|
|
|
287
278
|
useEffect(() => {
|
|
288
279
|
const fetchPageData = async () => {
|
package/src/pageData.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { UserData } from "./capabilities/configuration/src/userData/types";
|
|
2
2
|
import type { CnfContext } from "./capabilities/core/src/system/cnfContext/CnfContext";
|
|
3
3
|
import type { InternalOnErrorCallback } from "./capabilities/errors/types";
|
|
4
|
-
import { getIsDevEnvironment } from "./capabilities/offer-catalog/src/utils/contextUtil";
|
|
5
4
|
|
|
6
5
|
import type { onRateTableSubmitProps } from "./context/EventHandlerProvider";
|
|
7
6
|
import { getDynamicOffers } from "./services/getDynamicOffers";
|
|
8
|
-
// import { getDynamicOffers } from "./services/getDynamicOffers";
|
|
9
7
|
import {
|
|
10
8
|
getDefaultProductType,
|
|
11
9
|
getProductTypesDefinition,
|
|
@@ -15,9 +13,7 @@ import { getEnableUseCachedOffers } from "./utils/getEnableUseCachedOffers";
|
|
|
15
13
|
|
|
16
14
|
export type GetPageDataParams = {
|
|
17
15
|
productType?: string;
|
|
18
|
-
query?: string;
|
|
19
16
|
tags?: string;
|
|
20
|
-
searchAPIToken: string;
|
|
21
17
|
showProductTypeLabel?: boolean;
|
|
22
18
|
showCardBorder?: boolean;
|
|
23
19
|
userData?: UserData;
|
|
@@ -36,15 +32,8 @@ export async function getPageData({
|
|
|
36
32
|
onRateTableSubmit,
|
|
37
33
|
onError,
|
|
38
34
|
}: GetPageDataProps) {
|
|
39
|
-
const {
|
|
40
|
-
|
|
41
|
-
query,
|
|
42
|
-
tags,
|
|
43
|
-
searchAPIToken,
|
|
44
|
-
showProductTypeLabel,
|
|
45
|
-
showCardBorder,
|
|
46
|
-
userData,
|
|
47
|
-
} = params;
|
|
35
|
+
const { productType, tags, showProductTypeLabel, showCardBorder, userData } =
|
|
36
|
+
params;
|
|
48
37
|
|
|
49
38
|
// Resolve Tags
|
|
50
39
|
const resolvedTags = `${tags?.trim()}`;
|
|
@@ -56,8 +45,6 @@ export async function getPageData({
|
|
|
56
45
|
// TODO: Check if this is needed or if we can remove it
|
|
57
46
|
// const parsedStaticProductTypes = parseStringProductTypes(staticProductTypes);
|
|
58
47
|
|
|
59
|
-
const isDev = getIsDevEnvironment(context);
|
|
60
|
-
|
|
61
48
|
const { productTypesDefinition, partnersOverrideDefinition } =
|
|
62
49
|
getProductTypesDefinition(context);
|
|
63
50
|
|
|
@@ -69,10 +56,6 @@ export async function getPageData({
|
|
|
69
56
|
const { productTypes, resultType } = await resolveProductTypes({
|
|
70
57
|
defaultProductType,
|
|
71
58
|
productType,
|
|
72
|
-
query,
|
|
73
|
-
searchAPIToken,
|
|
74
|
-
isDev,
|
|
75
|
-
onError,
|
|
76
59
|
});
|
|
77
60
|
|
|
78
61
|
onRateTableSubmit?.({
|
|
@@ -87,7 +70,6 @@ export async function getPageData({
|
|
|
87
70
|
await getDynamicOffers({
|
|
88
71
|
tags: safeTags,
|
|
89
72
|
productTypes,
|
|
90
|
-
resultType,
|
|
91
73
|
isCachedOffersRequest,
|
|
92
74
|
productTypesDefinition: [...productTypesDefinition],
|
|
93
75
|
partnersOverrideDefinition: [...partnersOverrideDefinition],
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { isEmpty } from "radash";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
getOffersByProductTypes,
|
|
5
|
-
selectDynamicOffers,
|
|
6
|
-
} from "../utils";
|
|
7
|
-
import type {
|
|
8
|
-
GetProductTypesProps,
|
|
9
|
-
ProductTypesResult,
|
|
10
|
-
} from "./getProductTypes";
|
|
2
|
+
import { addClientTagsToOfferLinks, getOffersByProductTypes } from "../utils";
|
|
3
|
+
import type { GetProductTypesProps } from "./getProductTypes";
|
|
11
4
|
import { sortOffersByRecommendationScore } from "../utils/sortOffersByRecommendationScore";
|
|
12
5
|
import { pipe } from "effect";
|
|
13
6
|
import { formatOfferUrl } from "../utils/formatOfferUrl";
|
|
@@ -22,7 +15,6 @@ import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
|
22
15
|
export type GetDynamicOffersProps = {
|
|
23
16
|
tags: string;
|
|
24
17
|
productTypes: string[];
|
|
25
|
-
resultType: ProductTypesResult["resultType"];
|
|
26
18
|
isCachedOffersRequest: boolean;
|
|
27
19
|
productTypesDefinition: ProductTypeDefinition[];
|
|
28
20
|
partnersOverrideDefinition: PartnerOverride[];
|
|
@@ -31,12 +23,7 @@ export type GetDynamicOffersProps = {
|
|
|
31
23
|
onError?: InternalOnErrorCallback;
|
|
32
24
|
} & Omit<
|
|
33
25
|
GetProductTypesProps,
|
|
34
|
-
| "
|
|
35
|
-
| "productTypeOrUrl"
|
|
36
|
-
| "query"
|
|
37
|
-
| "isDevMode"
|
|
38
|
-
| "referrer"
|
|
39
|
-
| "searchAPIToken"
|
|
26
|
+
"context" | "productTypeOrUrl" | "isDevMode" | "referrer"
|
|
40
27
|
>;
|
|
41
28
|
|
|
42
29
|
/**
|
|
@@ -49,7 +36,6 @@ export const getDynamicOffers = async ({
|
|
|
49
36
|
tags,
|
|
50
37
|
defaultProductType,
|
|
51
38
|
productTypes,
|
|
52
|
-
resultType,
|
|
53
39
|
isCachedOffersRequest,
|
|
54
40
|
productTypesDefinition,
|
|
55
41
|
partnersOverrideDefinition,
|
|
@@ -89,10 +75,7 @@ export const getDynamicOffers = async ({
|
|
|
89
75
|
errorCode = fallbackResult.errorCode;
|
|
90
76
|
}
|
|
91
77
|
|
|
92
|
-
const sortedOffers =
|
|
93
|
-
resultType === "QUERY"
|
|
94
|
-
? selectDynamicOffers(offers, productTypes)
|
|
95
|
-
: sortOffersByRecommendationScore(offers);
|
|
78
|
+
const sortedOffers = sortOffersByRecommendationScore(offers);
|
|
96
79
|
|
|
97
80
|
return {
|
|
98
81
|
offers: pipe(
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
2
|
-
import { getProductTypesByQuery } from "./getProductTypesByQuery";
|
|
3
|
-
|
|
4
1
|
export type GetProductTypesProps = {
|
|
5
2
|
productType?: string;
|
|
6
|
-
query?: string;
|
|
7
3
|
defaultProductType: string;
|
|
8
|
-
searchAPIToken: string;
|
|
9
|
-
isDev: boolean;
|
|
10
|
-
onError?: InternalOnErrorCallback;
|
|
11
4
|
};
|
|
12
5
|
|
|
13
|
-
export type ResultType = "STATIC" | "
|
|
6
|
+
export type ResultType = "STATIC" | "PRODUCT_TYPE" | "DEFAULT";
|
|
14
7
|
|
|
15
8
|
export type ProductTypesResult = {
|
|
16
9
|
productTypes: string[];
|
|
17
10
|
resultType: ResultType;
|
|
18
11
|
};
|
|
19
12
|
|
|
20
|
-
const parseProductTypes = (
|
|
21
|
-
return
|
|
22
|
-
?
|
|
23
|
-
: [
|
|
13
|
+
const parseProductTypes = (productType: string): string[] => {
|
|
14
|
+
return productType.includes(",")
|
|
15
|
+
? productType.split(",").map((productTypeSlug) => productTypeSlug.trim())
|
|
16
|
+
: [productType];
|
|
24
17
|
};
|
|
25
18
|
|
|
26
19
|
/**
|
|
@@ -31,23 +24,7 @@ const parseProductTypes = (query: string): string[] => {
|
|
|
31
24
|
export const getProductTypes = async ({
|
|
32
25
|
productType,
|
|
33
26
|
defaultProductType,
|
|
34
|
-
query,
|
|
35
|
-
searchAPIToken,
|
|
36
|
-
isDev,
|
|
37
|
-
onError,
|
|
38
27
|
}: GetProductTypesProps): Promise<ProductTypesResult> => {
|
|
39
|
-
if (query && query.trim().length > 0) {
|
|
40
|
-
const productTypes = await getProductTypesByQuery({
|
|
41
|
-
query,
|
|
42
|
-
searchAPIToken,
|
|
43
|
-
isDev,
|
|
44
|
-
onError,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
return { productTypes, resultType: "QUERY" };
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// TODO: Check if need to add support for productType as enf app
|
|
51
28
|
if (productType && productType.trim().length > 0) {
|
|
52
29
|
const productTypes = await parseProductTypes(productType);
|
|
53
30
|
return { productTypes, resultType: "PRODUCT_TYPE" };
|
package/src/utils/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from "./getDefaultProductType";
|
|
|
3
3
|
export * from "./getOffersByProductTypes";
|
|
4
4
|
export * from "./getProductTypesDefinition";
|
|
5
5
|
export * from "./resolveProductTypes";
|
|
6
|
-
export * from "./selectDynamicOffers";
|
|
7
6
|
export * from "./sortOffersByRecommendationScore";
|
|
8
7
|
export * from "./parseStringProductTypes";
|
|
9
8
|
export * from "./getEnableUseCachedOffers";
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type { InternalOnErrorCallback } from "../capabilities/errors/types";
|
|
2
1
|
import { getProductTypes, type ResultType } from "../services/getProductTypes";
|
|
3
2
|
|
|
4
3
|
type ResolveProductTypesProps = {
|
|
5
4
|
productType?: string;
|
|
6
|
-
query?: string;
|
|
7
5
|
defaultProductType: string;
|
|
8
|
-
searchAPIToken: string;
|
|
9
|
-
isDev: boolean;
|
|
10
|
-
onError?: InternalOnErrorCallback;
|
|
11
6
|
};
|
|
12
7
|
|
|
13
8
|
export const resolveProductTypes = async (
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Version is kept in sync with package.json via the sync-version script
|
|
2
|
-
export const VERSION = "1.9.
|
|
2
|
+
export const VERSION = "1.9.1";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _orderProductTypesByRankUtils = require("./orderProductTypesByRankUtils");
|
|
7
|
-
Object.keys(_orderProductTypesByRankUtils).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _orderProductTypesByRankUtils[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _orderProductTypesByRankUtils[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_orderProductTypesByRankUtils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../../../../../src","sources":["capabilities/core/src/domain/third-party-search/index.ts"],"mappings":";;;;;AAAA,IAAAA,6BAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,6BAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,6BAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,6BAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/lib/commonjs/capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.orderProductTypesByRank = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Orders product types by rank.
|
|
9
|
-
*
|
|
10
|
-
* @param productTypes {Record<string, number>} - The product types to order.
|
|
11
|
-
* @returns {string[]} The product types ordered by rank.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const productTypes = {
|
|
16
|
-
* 'credit-card': 1,
|
|
17
|
-
* 'loan': 2,
|
|
18
|
-
* 'insurance': 3,
|
|
19
|
-
* }
|
|
20
|
-
* const orderedProductTypes = orderProductTypesByRank(productTypes)
|
|
21
|
-
* // orderedProductTypes = ['insurance', 'loan', 'credit-card']
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
const orderProductTypesByRank = productTypes => {
|
|
25
|
-
const productTypesWithRank = Object.entries(productTypes).map(([productType, count]) => ({
|
|
26
|
-
productType,
|
|
27
|
-
rank: count
|
|
28
|
-
}));
|
|
29
|
-
const sortedProductTypes = productTypesWithRank.sort((a, b) => b.rank - a.rank);
|
|
30
|
-
return sortedProductTypes.map(pt => pt.productType);
|
|
31
|
-
};
|
|
32
|
-
exports.orderProductTypesByRank = orderProductTypesByRank;
|
|
33
|
-
//# sourceMappingURL=orderProductTypesByRankUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["orderProductTypesByRank","productTypes","productTypesWithRank","Object","entries","map","productType","count","rank","sortedProductTypes","sort","a","b","pt","exports"],"sourceRoot":"../../../../../../../src","sources":["capabilities/core/src/domain/third-party-search/orderProductTypesByRankUtils.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GACnCC,YAAoC,IAChC;EACJ,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAACH,YAAY,CAAC,CAACI,GAAG,CAC5D,CAAC,CAACC,WAAW,EAAEC,KAAK,CAAC,MAAM;IAC1BD,WAAW;IACXE,IAAI,EAAED;EACP,CAAC,CACF,CAAC;EAED,MAAME,kBAAkB,GAAGP,oBAAoB,CAACQ,IAAI,CACnD,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAACJ,IAAI,GAAGG,CAAC,CAACH,IACtB,CAAC;EAED,OAAOC,kBAAkB,CAACJ,GAAG,CAAEQ,EAAE,IAAKA,EAAE,CAACP,WAAW,CAAC;AACtD,CAAC;AAACQ,OAAA,CAAAd,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getProductTypesByQuery = void 0;
|
|
7
|
-
var _effect = require("effect");
|
|
8
|
-
var _apiEnvironment = require("../apiEnvironment");
|
|
9
|
-
var _thirdPartySearch = require("../capabilities/core/src/domain/third-party-search");
|
|
10
|
-
var _types = require("../capabilities/errors/types");
|
|
11
|
-
var _errorUtils = require("../components/utils/errorUtils");
|
|
12
|
-
/**
|
|
13
|
-
* Get product types by query
|
|
14
|
-
* @param query {string} - The query to get the product types for
|
|
15
|
-
* @param context The context to get the product types from
|
|
16
|
-
* @returns {Promise<string[]>} The product types
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const productTypes = await getProductTypesByQuery('best credit cards', {
|
|
21
|
-
* cnfEnv: {
|
|
22
|
-
* THIRD_PARTY_SEARCH_API_URL: 'https://api.third-party-search.com',
|
|
23
|
-
* THIRD_PARTY_SEARCH_API_TOKEN: 'your-token',
|
|
24
|
-
* },
|
|
25
|
-
* thirdPartySearchApiClient: makeThirdPartySearchApiClient,
|
|
26
|
-
* })
|
|
27
|
-
* // productTypes = ['credit-card', 'loan', 'insurance']
|
|
28
|
-
* or
|
|
29
|
-
* // productTypes = []
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const getProductTypesByQuery = async ({
|
|
34
|
-
query,
|
|
35
|
-
searchAPIToken,
|
|
36
|
-
isDev,
|
|
37
|
-
onError
|
|
38
|
-
}) => {
|
|
39
|
-
const url = `${(0, _apiEnvironment.getEwsSearchApiBaseUrl)(isDev)}/search/product-types?query=${encodeURIComponent(query)}`;
|
|
40
|
-
const headers = {
|
|
41
|
-
Authorization: `Bearer ${searchAPIToken}`
|
|
42
|
-
};
|
|
43
|
-
try {
|
|
44
|
-
const response = await fetch(url, {
|
|
45
|
-
headers
|
|
46
|
-
});
|
|
47
|
-
if (!response.ok) {
|
|
48
|
-
const error = new Error();
|
|
49
|
-
error.code = response.status;
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
const productTypes = await response.json();
|
|
53
|
-
return (0, _effect.pipe)(productTypes, _thirdPartySearch.orderProductTypesByRank);
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error("Error fetching ProductTypesByQuery", JSON.stringify(error));
|
|
56
|
-
onError === null || onError === void 0 || onError({
|
|
57
|
-
message: "Failed to fetch product types by query",
|
|
58
|
-
error,
|
|
59
|
-
additionalInfo: {
|
|
60
|
-
query,
|
|
61
|
-
isDev
|
|
62
|
-
},
|
|
63
|
-
...((0, _errorUtils.getApiErrorLogProperties)(error) || {
|
|
64
|
-
code: _types.ErrorCodes.FLOW_ERROR,
|
|
65
|
-
severity: "error"
|
|
66
|
-
})
|
|
67
|
-
});
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
exports.getProductTypesByQuery = getProductTypesByQuery;
|
|
72
|
-
//# sourceMappingURL=getProductTypesByQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_effect","require","_apiEnvironment","_thirdPartySearch","_types","_errorUtils","getProductTypesByQuery","query","searchAPIToken","isDev","onError","url","getEwsSearchApiBaseUrl","encodeURIComponent","headers","Authorization","response","fetch","ok","error","Error","code","status","productTypes","json","pipe","orderProductTypesByRank","console","JSON","stringify","message","additionalInfo","getApiErrorLogProperties","ErrorCodes","FLOW_ERROR","severity","exports"],"sourceRoot":"../../../src","sources":["services/getProductTypesByQuery.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMK,sBAAsB,GAAG,MAAAA,CAAO;EAC5CC,KAAK;EACLC,cAAc;EACdC,KAAK;EACLC;AAC4B,CAAC,KAAK;EAClC,MAAMC,GAAG,GAAG,GAAG,IAAAC,sCAAsB,EAACH,KAAK,CAAC,+BAA+BI,kBAAkB,CAACN,KAAK,CAAC,EAAE;EACtG,MAAMO,OAAO,GAAG;IACfC,aAAa,EAAE,UAAUP,cAAc;EACxC,CAAC;EACD,IAAI;IACH,MAAMQ,QAAQ,GAAG,MAAMC,KAAK,CAACN,GAAG,EAAE;MAAEG;IAAQ,CAAC,CAAC;IAC9C,IAAI,CAACE,QAAQ,CAACE,EAAE,EAAE;MACjB,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAa;MACrCD,KAAK,CAACE,IAAI,GAAGL,QAAQ,CAACM,MAAM;MAC5B,MAAMH,KAAK;IACZ;IACA,MAAMI,YAAY,GAAG,MAAMP,QAAQ,CAACQ,IAAI,CAAC,CAAC;IAE1C,OAAO,IAAAC,YAAI,EAACF,YAAY,EAAEG,yCAAuB,CAAC;EACnD,CAAC,CAAC,OAAOP,KAAK,EAAE;IACfQ,OAAO,CAACR,KAAK,CAAC,oCAAoC,EAAES,IAAI,CAACC,SAAS,CAACV,KAAK,CAAC,CAAC;IAC1ET,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAG;MACToB,OAAO,EAAE,wCAAwC;MACjDX,KAAK;MACLY,cAAc,EAAE;QACfxB,KAAK;QACLE;MACD,CAAC;MACD,IAAI,IAAAuB,oCAAwB,EAACb,KAAK,CAAC,IAAI;QACtCE,IAAI,EAAEY,iBAAU,CAACC,UAAU;QAC3BC,QAAQ,EAAE;MACX,CAAC;IACF,CAAC,CAAC;IAEF,OAAO,EAAE;EACV;AACD,CAAC;AAACC,OAAA,CAAA9B,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|