@moneylion/react-native-offer-carousel 1.0.8 → 1.0.10
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/ui/elements/src/components/MarkdownText/components.js +25 -7
- package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
- package/lib/commonjs/pageData.js +2 -2
- package/lib/commonjs/pageData.js.map +1 -1
- package/lib/commonjs/services/getDynamicOffers.js +27 -19
- package/lib/commonjs/services/getDynamicOffers.js.map +1 -1
- package/lib/commonjs/utils/getOffersByProductTypes.js +27 -6
- package/lib/commonjs/utils/getOffersByProductTypes.js.map +1 -1
- package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js +26 -7
- package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
- package/lib/module/pageData.js +2 -2
- package/lib/module/pageData.js.map +1 -1
- package/lib/module/services/getDynamicOffers.js +27 -19
- package/lib/module/services/getDynamicOffers.js.map +1 -1
- package/lib/module/utils/getOffersByProductTypes.js +27 -6
- package/lib/module/utils/getOffersByProductTypes.js.map +1 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/components.d.ts.map +1 -1
- package/lib/typescript/src/services/getDynamicOffers.d.ts +2 -2
- package/lib/typescript/src/services/getDynamicOffers.d.ts.map +1 -1
- package/lib/typescript/src/utils/getOffersByProductTypes.d.ts +9 -4
- package/lib/typescript/src/utils/getOffersByProductTypes.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/ui/elements/src/components/MarkdownText/components.tsx +24 -10
- package/src/pageData.ts +2 -2
- package/src/services/getDynamicOffers.ts +29 -27
- package/src/utils/getOffersByProductTypes.ts +13 -10
|
@@ -10,7 +10,29 @@ var _Abbreviation = require("./Abbreviation");
|
|
|
10
10
|
var _reactNativeMarkdownDisplay = require("react-native-markdown-display");
|
|
11
11
|
var _Text = _interopRequireDefault(require("../../../../../../components/Text"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
13
|
+
const BoldText = ({
|
|
14
|
+
children
|
|
15
|
+
}) => {
|
|
16
|
+
const processChildren = _children => {
|
|
17
|
+
return _react.default.Children.map(_children, child => {
|
|
18
|
+
if (typeof child === "string") {
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
20
|
+
weight: "bold"
|
|
21
|
+
}, child);
|
|
22
|
+
}
|
|
23
|
+
if (/*#__PURE__*/_react.default.isValidElement(child) && child.type === _Text.default) {
|
|
24
|
+
// Use a properly typed props object
|
|
25
|
+
const newProps = {
|
|
26
|
+
weight: "bold",
|
|
27
|
+
style: child.props.style
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/_react.default.cloneElement(child, newProps);
|
|
30
|
+
}
|
|
31
|
+
return child;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, processChildren(children));
|
|
35
|
+
};
|
|
14
36
|
|
|
15
37
|
// Helper to create text variants
|
|
16
38
|
const createTextVariant = props => (_node, children) => {
|
|
@@ -107,12 +129,8 @@ const createMarkdownComponents = ({
|
|
|
107
129
|
color: color
|
|
108
130
|
}, children);
|
|
109
131
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
key: node.key || `${node.type}-${node.index}`,
|
|
113
|
-
variant: variant,
|
|
114
|
-
weight: "bold",
|
|
115
|
-
color: color
|
|
132
|
+
strong: (node, children) => /*#__PURE__*/_react.default.createElement(BoldText, {
|
|
133
|
+
key: node.key || `${node.type}-${node.index}`
|
|
116
134
|
}, children)
|
|
117
135
|
};
|
|
118
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_Abbreviation","_reactNativeMarkdownDisplay","_Text","e","__esModule","default","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_Abbreviation","_reactNativeMarkdownDisplay","_Text","e","__esModule","default","BoldText","children","processChildren","_children","React","Children","map","child","createElement","weight","isValidElement","type","Text","newProps","style","props","cloneElement","Fragment","createTextVariant","_node","createMarkdownComponents","numberOfLines","variant","color","isFirstListItem","heading1","heading2","heading3","heading4","heading5","bullet_list","node","key","index","styles","bulletList","link","attributes","title","Abbreviation","linkText","onPress","openUrl","href","text","content","list_item","prefix","paragraph","strong","exports","StyleSheet","create","marginVertical","flexDirection","alignItems","bulletPoint","width","height","borderRadius","backgroundColor","marginTop","marginRight","listItemText","marginBottom","textDecorationLine"],"sourceRoot":"../../../../../../../../src","sources":["capabilities/ui/elements/src/components/MarkdownText/components.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AAG2C,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG3C,MAAMG,QAAQ,GAAGA,CAAC;EAAEC;AAAwC,CAAC,KAAK;EACjE,MAAMC,eAAe,GAAIC,SAA0B,IAAK;IACvD,OAAOC,cAAK,CAACC,QAAQ,CAACC,GAAG,CAACH,SAAS,EAAGI,KAAK,IAAK;MAC/C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC9B,oBAAOjB,MAAA,CAAAS,OAAA,CAAAS,aAAA,CAACZ,KAAA,CAAAG,OAAI;UAACU,MAAM,EAAC;QAAM,GAAEF,KAAY,CAAC;MAC1C;MAEA,IAAI,aAAAH,cAAK,CAACM,cAAc,CAACH,KAAK,CAAC,IAAIA,KAAK,CAACI,IAAI,KAAKC,aAAI,EAAE;QACvD;QACA,MAAMC,QAAQ,GAAG;UAChB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gC,GAAG,EAAED,IAAI,CAACC,GAAG,IAAI,GAAGD,IAAI,CAACpB,IAAI,IAAIoB,IAAI,CAACE,KAAK;IAAG,GACtDhC,QACQ;EAEZ,CAAC;AACF,CAAC;AAACiD,OAAA,CAAA9B,wBAAA,GAAAA,wBAAA;AAEF,MAAMc,MAAM,GAAGiB,uBAAU,CAACC,MAAM,CAAC;EAChCjB,UAAU,EAAE;IACXkB,cAAc,EAAE,CAAC;IACjBC,aAAa,EAAE,QAAQ;IACvBC,UAAU,EAAE;EACb,CAAC;EACDC,WAAW,EAAE;IACZC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE,CAAC;IACfC,eAAe,EAAE,OAAO;IACxBC,SAAS,EAAE,CAAC;IACZC,WAAW,EAAE;EACd,CAAC;EACDC,YAAY,EAAE;IACbC,YAAY,EAAE;EACf,CAAC;EACDxB,QAAQ,EAAE;IACTyB,kBAAkB,EAAE;EACrB;AACD,CAAC,CAAC","ignoreList":[]}
|
package/lib/commonjs/pageData.js
CHANGED
|
@@ -27,7 +27,7 @@ async function getPageData({
|
|
|
27
27
|
|
|
28
28
|
// Resolve Tags
|
|
29
29
|
const resolvedTags = `${tags === null || tags === void 0 ? void 0 : tags.trim()}`;
|
|
30
|
-
const
|
|
30
|
+
const isCachedOffersRequest = (0, _getEnableUseCachedOffers.getEnableUseCachedOffers)(context);
|
|
31
31
|
const defaultProductType = (0, _utils.getDefaultProductType)(context);
|
|
32
32
|
|
|
33
33
|
// TODO: Check if this is needed or if we can remove it
|
|
@@ -71,7 +71,7 @@ async function getPageData({
|
|
|
71
71
|
displayLayout: safeDisplayLayout,
|
|
72
72
|
productTypes,
|
|
73
73
|
resultType,
|
|
74
|
-
|
|
74
|
+
isCachedOffersRequest,
|
|
75
75
|
productTypesDefinition: [...productTypesDefinition],
|
|
76
76
|
partnersOverrideDefinition: [...partnersOverrideDefinition],
|
|
77
77
|
context,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_contextUtil","require","_getDynamicOffers","_utils","_getEnableUseCachedOffers","getPageData","context","params","onRateTableSubmit","productType","query","tags","displayLayout","searchAPIToken","showProductTypeLabel","showCardBorder","resolvedTags","trim","
|
|
1
|
+
{"version":3,"names":["_contextUtil","require","_getDynamicOffers","_utils","_getEnableUseCachedOffers","getPageData","context","params","onRateTableSubmit","productType","query","tags","displayLayout","searchAPIToken","showProductTypeLabel","showCardBorder","resolvedTags","trim","isCachedOffersRequest","getEnableUseCachedOffers","defaultProductType","getDefaultProductType","isDev","getIsDevEnvironment","productTypesDefinition","partnersOverrideDefinition","getProductTypesDefinition","currentCountry","signals","deviceSignals","country","safeTags","encodeURI","safeDisplayLayout","getLayout","productTypes","resultType","resolveProductTypes","timestamp","Date","toISOString","offers","isError","leadUuid","rateTableUuid","getDynamicOffers"],"sourceRoot":"../../src","sources":["pageData.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAMA,IAAAG,yBAAA,GAAAH,OAAA;AAPA;;AAeO,eAAeI,WAAWA,CAAC;EACjCC,OAAO;EACPC,MAAM;EACNC;AACiB,CAAC,EAAE;EACpB,MAAM;IACLC,WAAW;IACXC,KAAK;IACLC,IAAI;IACJC,aAAa;IACbC,cAAc;IACdC,oBAAoB;IACpBC;EACD,CAAC,GAAGR,MAAM;;EAEV;EACA,MAAMS,YAAY,GAAG,GAAGL,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEM,IAAI,CAAC,CAAC,EAAE;EAEtC,MAAMC,qBAAqB,GAAG,IAAAC,kDAAwB,EAACb,OAAO,CAAC;EAE/D,MAAMc,kBAAkB,GAAG,IAAAC,4BAAqB,EAACf,OAAO,CAAC;;EAEzD;EACA;;EAEA,MAAMgB,KAAK,GAAG,IAAAC,gCAAmB,EAACjB,OAAO,CAAC;EAE1C,MAAM;IAAEkB,sBAAsB;IAAEC;EAA2B,CAAC,GAC3D,IAAAC,gCAAyB,EAACpB,OAAO,CAAC;EAEnC,MAAMqB,cAAc,GAAGrB,OAAO,CAACsB,OAAO,CAACC,aAAa,CAACC,OAAO;EAE5D,MAAMC,QAAQ,GAAGC,SAAS,CAAChB,YAAY,CAAC;EAExC,MAAMiB,iBAAiB,GAAG,IAAAC,gBAAS,EAACtB,aAAa,CAAC;;EAElD;EACA,MAAM;IAAEuB,YAAY;IAAEC;EAAW,CAAC,GAAG,MAAM,IAAAC,0BAAmB,EAAC;IAC9DjB,kBAAkB;IAClBX,WAAW;IACXC,KAAK;IACLG,cAAc;IACdS;EACD,CAAC,CAAC;EAEFd,iBAAiB,aAAjBA,iBAAiB,eAAjBA,iBAAiB,CAAG;IACnB8B,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;IACnCL,YAAY;IACZC,UAAU;IACVhB;EACD,CAAC,CAAC;;EAEF;EACA,MAAM;IAAEqB,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,MAAM,IAAAC,kCAAgB,EAAC;IAC3ElC,IAAI,EAAEoB,QAAQ;IACdnB,aAAa,EAAEqB,iBAAiB;IAChCE,YAAY;IACZC,UAAU;IACVlB,qBAAqB;IACrBM,sBAAsB,EAAE,CAAC,GAAGA,sBAAsB,CAAC;IACnDC,0BAA0B,EAAE,CAAC,GAAGA,0BAA0B,CAAC;IAC3DnB,OAAO;IACPc;EACD,CAAC,CAAC;EAEF,OAAO;IACNsB,OAAO;IACPC,QAAQ;IACRC,aAAa;IACb;IACAH,MAAM;IACNd,cAAc;IACd;IACAZ,cAAc;IACd;IACAD,oBAAoB;IACpBF,aAAa,EAAEqB;EAChB,CAAC;AACF","ignoreList":[]}
|
|
@@ -22,38 +22,46 @@ const getDynamicOffers = async ({
|
|
|
22
22
|
defaultProductType,
|
|
23
23
|
productTypes,
|
|
24
24
|
resultType,
|
|
25
|
-
|
|
25
|
+
isCachedOffersRequest,
|
|
26
26
|
productTypesDefinition,
|
|
27
27
|
partnersOverrideDefinition,
|
|
28
28
|
context
|
|
29
29
|
}) => {
|
|
30
30
|
// Get the initial offers
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
let {
|
|
32
|
+
offers,
|
|
33
|
+
rateTableUuid,
|
|
34
|
+
isError,
|
|
35
|
+
leadUuid
|
|
36
|
+
} = await (0, _utils.getOffersByProductTypes)({
|
|
37
|
+
isCachedOffersRequest,
|
|
33
38
|
productTypes,
|
|
34
39
|
tags,
|
|
35
40
|
context
|
|
36
41
|
});
|
|
37
42
|
|
|
38
|
-
//
|
|
39
|
-
if ((0, _radash.isEmpty)(
|
|
40
|
-
|
|
43
|
+
// If no offers found, fall back to the default product type
|
|
44
|
+
if ((0, _radash.isEmpty)(offers)) {
|
|
45
|
+
const fallbackResult = await (0, _utils.getOffersByProductTypes)({
|
|
46
|
+
isCachedOffersRequest,
|
|
47
|
+
productTypes: [defaultProductType],
|
|
48
|
+
tags,
|
|
49
|
+
context
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Update the offers, rateTableUuid, isError, leafUuid and productTypes
|
|
53
|
+
offers = fallbackResult.offers;
|
|
54
|
+
rateTableUuid = fallbackResult.rateTableUuid;
|
|
55
|
+
isError = fallbackResult.isError;
|
|
56
|
+
leadUuid = fallbackResult.leadUuid;
|
|
41
57
|
productTypes = [defaultProductType];
|
|
42
58
|
}
|
|
43
|
-
|
|
44
|
-
// if initial offers are returned, return them
|
|
45
|
-
const offersData = (0, _radash.isEmpty)(initialOffersData === null || initialOffersData === void 0 ? void 0 : initialOffersData.offers) ? await (0, _utils.getOffersByProductTypes)({
|
|
46
|
-
enableUseCachedOffers,
|
|
47
|
-
productTypes,
|
|
48
|
-
tags,
|
|
49
|
-
context
|
|
50
|
-
}) : initialOffersData;
|
|
51
|
-
const sortedOffers = resultType === "QUERY" ? (0, _utils.selectDynamicOffers)(offersData.offers, productTypes) : (0, _sortOffersByRecommendationScore.sortOffersByRecommendationScore)(offersData.offers);
|
|
59
|
+
const sortedOffers = resultType === "QUERY" ? (0, _utils.selectDynamicOffers)(offers, productTypes) : (0, _sortOffersByRecommendationScore.sortOffersByRecommendationScore)(offers);
|
|
52
60
|
return {
|
|
53
|
-
offers: (0, _effect.pipe)(sortedOffers, (0, _formatOfferUrl.formatOfferUrl)(productTypesDefinition, partnersOverrideDefinition), (0, _utils.addClientTagsToOfferLinks)(
|
|
54
|
-
isError:
|
|
55
|
-
leadUuid:
|
|
56
|
-
rateTableUuid
|
|
61
|
+
offers: (0, _effect.pipe)(sortedOffers, (0, _formatOfferUrl.formatOfferUrl)(productTypesDefinition, partnersOverrideDefinition), (0, _utils.addClientTagsToOfferLinks)(isCachedOffersRequest, tags), (0, _getOffersBasedOnLayout.getOffersBasedOnLayout)(displayLayout)),
|
|
62
|
+
isError: isError,
|
|
63
|
+
leadUuid: leadUuid,
|
|
64
|
+
rateTableUuid
|
|
57
65
|
};
|
|
58
66
|
};
|
|
59
67
|
exports.getDynamicOffers = getDynamicOffers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_radash","require","_utils","_sortOffersByRecommendationScore","_effect","_formatOfferUrl","_getOffersBasedOnLayout","getDynamicOffers","tags","displayLayout","defaultProductType","productTypes","resultType","
|
|
1
|
+
{"version":3,"names":["_radash","require","_utils","_sortOffersByRecommendationScore","_effect","_formatOfferUrl","_getOffersBasedOnLayout","getDynamicOffers","tags","displayLayout","defaultProductType","productTypes","resultType","isCachedOffersRequest","productTypesDefinition","partnersOverrideDefinition","context","offers","rateTableUuid","isError","leadUuid","getOffersByProductTypes","isEmpty","fallbackResult","sortedOffers","selectDynamicOffers","sortOffersByRecommendationScore","pipe","formatOfferUrl","addClientTagsToOfferLinks","getOffersBasedOnLayout","exports"],"sourceRoot":"../../../src","sources":["services/getDynamicOffers.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAA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,EAAEL,IAAI,CAAC,EACtD,IAAAsB,8CAAsB,EAACrB,aAAa,CACrC,CAAC;IACDU,OAAO,EAAEA,OAAO;IAChBC,QAAQ,EAAEA,QAAQ;IAClBF;EACD,CAAC;AACF,CAAC;AAACa,OAAA,CAAAxB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -10,22 +10,43 @@ var _contextUtil = require("../capabilities/offer-catalog/src/utils/contextUtil"
|
|
|
10
10
|
* Retrieves offers by product types.
|
|
11
11
|
*
|
|
12
12
|
* @param {Object} params - The parameters for retrieving offers by product types.
|
|
13
|
-
* @param {boolean} params.
|
|
13
|
+
* @param {boolean} params.isCachedOffersRequest - Indicates if the offers should be retrieved from the cache.
|
|
14
14
|
* @param {string[]} params.productTypes - The product types to retrieve offers for.
|
|
15
15
|
* @param {string} params.tags - The tags to use for retrieving offers.
|
|
16
16
|
* @returns {Promise<OffersData>} A promise that resolves to an array of offers or undefined if no offers are found.
|
|
17
17
|
*/
|
|
18
18
|
const getOffersByProductTypes = async ({
|
|
19
|
-
|
|
19
|
+
isCachedOffersRequest,
|
|
20
20
|
productTypes,
|
|
21
21
|
tags,
|
|
22
22
|
context
|
|
23
23
|
}) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if (isCachedOffersRequest) {
|
|
25
|
+
const {
|
|
26
|
+
offers,
|
|
27
|
+
uuid,
|
|
28
|
+
isError,
|
|
29
|
+
leadUuid
|
|
30
|
+
} = await (0, _offerCatalogApi.getCachedOffersByProductTypes)(context)(productTypes);
|
|
31
|
+
return {
|
|
32
|
+
offers,
|
|
33
|
+
rateTableUuid: uuid,
|
|
34
|
+
isError,
|
|
35
|
+
leadUuid
|
|
36
|
+
};
|
|
27
37
|
}
|
|
28
|
-
|
|
38
|
+
const {
|
|
39
|
+
offers,
|
|
40
|
+
uuid,
|
|
41
|
+
isError,
|
|
42
|
+
leadUuid
|
|
43
|
+
} = await (0, _offerCatalogApi.getOffersForProductTypes)(context)(productTypes, (0, _contextUtil.parseClientTags)(tags));
|
|
44
|
+
return {
|
|
45
|
+
offers,
|
|
46
|
+
rateTableUuid: uuid,
|
|
47
|
+
isError,
|
|
48
|
+
leadUuid
|
|
49
|
+
};
|
|
29
50
|
};
|
|
30
51
|
exports.getOffersByProductTypes = getOffersByProductTypes;
|
|
31
52
|
//# sourceMappingURL=getOffersByProductTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_offerCatalogApi","require","_contextUtil","getOffersByProductTypes","
|
|
1
|
+
{"version":3,"names":["_offerCatalogApi","require","_contextUtil","getOffersByProductTypes","isCachedOffersRequest","productTypes","tags","context","offers","uuid","isError","leadUuid","getCachedOffersByProductTypes","rateTableUuid","getOffersForProductTypes","parseClientTags","exports"],"sourceRoot":"../../../src","sources":["utils/getOffersByProductTypes.ts"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,uBAAuB,GAAG,MAAAA,CAAO;EAC7CC,qBAAqB;EACrBC,YAAY;EACZC,IAAI;EACJC;AAMD,CAAC,KAAK;EACL,IAAIH,qBAAqB,EAAE;IAC1B,MAAM;MAAEI,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAAS,CAAC,GACxC,MAAM,IAAAC,8CAA6B,EAACL,OAAO,CAAC,CAACF,YAAY,CAAC;IAE3D,OAAO;MAAEG,MAAM;MAAEK,aAAa,EAAEJ,IAAI;MAAEC,OAAO;MAAEC;IAAS,CAAC;EAC1D;EAEA,MAAM;IAAEH,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAG,MAAM,IAAAG,yCAAwB,EACzEP,OACD,CAAC,CAACF,YAAY,EAAE,IAAAU,4BAAe,EAACT,IAAI,CAAC,CAAC;EAEtC,OAAO;IAAEE,MAAM;IAAEK,aAAa,EAAEJ,IAAI;IAAEC,OAAO;IAAEC;EAAS,CAAC;AAC1D,CAAC;AAACK,OAAA,CAAAb,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
// components.tsx
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { StyleSheet } from "react-native";
|
|
4
3
|
import { Abbreviation } from "./Abbreviation";
|
|
5
4
|
import { openUrl } from "react-native-markdown-display";
|
|
6
5
|
import Text from "../../../../../../components/Text";
|
|
6
|
+
const BoldText = ({
|
|
7
|
+
children
|
|
8
|
+
}) => {
|
|
9
|
+
const processChildren = _children => {
|
|
10
|
+
return React.Children.map(_children, child => {
|
|
11
|
+
if (typeof child === "string") {
|
|
12
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
13
|
+
weight: "bold"
|
|
14
|
+
}, child);
|
|
15
|
+
}
|
|
16
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === Text) {
|
|
17
|
+
// Use a properly typed props object
|
|
18
|
+
const newProps = {
|
|
19
|
+
weight: "bold",
|
|
20
|
+
style: child.props.style
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/React.cloneElement(child, newProps);
|
|
23
|
+
}
|
|
24
|
+
return child;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, processChildren(children));
|
|
28
|
+
};
|
|
29
|
+
|
|
7
30
|
// Helper to create text variants
|
|
8
31
|
const createTextVariant = props => (_node, children) => {
|
|
9
32
|
return /*#__PURE__*/React.createElement(Text, props, children);
|
|
@@ -99,12 +122,8 @@ export const createMarkdownComponents = ({
|
|
|
99
122
|
color: color
|
|
100
123
|
}, children);
|
|
101
124
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
key: node.key || `${node.type}-${node.index}`,
|
|
105
|
-
variant: variant,
|
|
106
|
-
weight: "bold",
|
|
107
|
-
color: color
|
|
125
|
+
strong: (node, children) => /*#__PURE__*/React.createElement(BoldText, {
|
|
126
|
+
key: node.key || `${node.type}-${node.index}`
|
|
108
127
|
}, children)
|
|
109
128
|
};
|
|
110
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","Abbreviation","openUrl","Text","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","Abbreviation","openUrl","Text","BoldText","children","processChildren","_children","Children","map","child","createElement","weight","isValidElement","type","newProps","style","props","cloneElement","Fragment","createTextVariant","_node","createMarkdownComponents","numberOfLines","variant","color","isFirstListItem","heading1","heading2","heading3","heading4","heading5","bullet_list","node","key","index","styles","bulletList","link","attributes","title","linkText","onPress","href","text","content","list_item","prefix","paragraph","strong","create","marginVertical","flexDirection","alignItems","bulletPoint","width","height","borderRadius","backgroundColor","marginTop","marginRight","listItemText","marginBottom","textDecorationLine"],"sourceRoot":"../../../../../../../../src","sources":["capabilities/ui/elements/src/components/MarkdownText/components.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SACCC,OAAO,QAGD,+BAA+B;AACtC,OAAOC,IAAI,MAGJ,mCAAmC;AAG1C,MAAMC,QAAQ,GAAGA,CAAC;EAAEC;AAAwC,CAAC,KAAK;EACjE,MAAMC,eAAe,GAAIC,SAA0B,IAAK;IACvD,OAAOR,KAAK,CAACS,QAAQ,CAACC,GAAG,CAACF,SAAS,EAAGG,KAAK,IAAK;MAC/C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC9B,oBAAOX,KAAA,CAAAY,aAAA,CAACR,IAAI;UAACS,MAAM,EAAC;QAAM,GAAEF,KAAY,CAAC;MAC1C;MAEA,IAAI,aAAAX,KAAK,CAACc,cAAc,CAACH,KAAK,CAAC,IAAIA,KAAK,CAACI,IAAI,KAAKX,IAAI,EAAE;QACvD;QACA,MAAMY,QAAQ,GAAG;UAChBH,MAAM,EAAE,MAAoB;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AE;EACb,CAAC;EACDC,WAAW,EAAE;IACZC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE,CAAC;IACfC,eAAe,EAAE,OAAO;IACxBC,SAAS,EAAE,CAAC;IACZC,WAAW,EAAE;EACd,CAAC;EACDC,YAAY,EAAE;IACbC,YAAY,EAAE;EACf,CAAC;EACDrB,QAAQ,EAAE;IACTsB,kBAAkB,EAAE;EACrB;AACD,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/pageData.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function getPageData({
|
|
|
20
20
|
|
|
21
21
|
// Resolve Tags
|
|
22
22
|
const resolvedTags = `${tags === null || tags === void 0 ? void 0 : tags.trim()}`;
|
|
23
|
-
const
|
|
23
|
+
const isCachedOffersRequest = getEnableUseCachedOffers(context);
|
|
24
24
|
const defaultProductType = getDefaultProductType(context);
|
|
25
25
|
|
|
26
26
|
// TODO: Check if this is needed or if we can remove it
|
|
@@ -64,7 +64,7 @@ export async function getPageData({
|
|
|
64
64
|
displayLayout: safeDisplayLayout,
|
|
65
65
|
productTypes,
|
|
66
66
|
resultType,
|
|
67
|
-
|
|
67
|
+
isCachedOffersRequest,
|
|
68
68
|
productTypesDefinition: [...productTypesDefinition],
|
|
69
69
|
partnersOverrideDefinition: [...partnersOverrideDefinition],
|
|
70
70
|
context,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getIsDevEnvironment","getDynamicOffers","getDefaultProductType","getLayout","getProductTypesDefinition","resolveProductTypes","getEnableUseCachedOffers","getPageData","context","params","onRateTableSubmit","productType","query","tags","displayLayout","searchAPIToken","showProductTypeLabel","showCardBorder","resolvedTags","trim","
|
|
1
|
+
{"version":3,"names":["getIsDevEnvironment","getDynamicOffers","getDefaultProductType","getLayout","getProductTypesDefinition","resolveProductTypes","getEnableUseCachedOffers","getPageData","context","params","onRateTableSubmit","productType","query","tags","displayLayout","searchAPIToken","showProductTypeLabel","showCardBorder","resolvedTags","trim","isCachedOffersRequest","defaultProductType","isDev","productTypesDefinition","partnersOverrideDefinition","currentCountry","signals","deviceSignals","country","safeTags","encodeURI","safeDisplayLayout","productTypes","resultType","timestamp","Date","toISOString","offers","isError","leadUuid","rateTableUuid"],"sourceRoot":"../../src","sources":["pageData.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,oDAAoD;AAIxF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D;AACA,SACCC,qBAAqB,EACrBC,SAAS,EACTC,yBAAyB,EACzBC,mBAAmB,QACb,SAAS;AAChB,SAASC,wBAAwB,QAAQ,kCAAkC;AAQ3E,OAAO,eAAeC,WAAWA,CAAC;EACjCC,OAAO;EACPC,MAAM;EACNC;AACiB,CAAC,EAAE;EACpB,MAAM;IACLC,WAAW;IACXC,KAAK;IACLC,IAAI;IACJC,aAAa;IACbC,cAAc;IACdC,oBAAoB;IACpBC;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,GAAGnB,qBAAqB,CAACM,OAAO,CAAC;;EAEzD;EACA;;EAEA,MAAMc,KAAK,GAAGtB,mBAAmB,CAACQ,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,MAAMa,iBAAiB,GAAG5B,SAAS,CAACW,aAAa,CAAC;;EAElD;EACA,MAAM;IAAEkB,YAAY;IAAEC;EAAW,CAAC,GAAG,MAAM5B,mBAAmB,CAAC;IAC9DgB,kBAAkB;IAClBV,WAAW;IACXC,KAAK;IACLG,cAAc;IACdO;EACD,CAAC,CAAC;EAEFZ,iBAAiB,aAAjBA,iBAAiB,eAAjBA,iBAAiB,CAAG;IACnBwB,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;IACnCJ,YAAY;IACZC,UAAU;IACVZ;EACD,CAAC,CAAC;;EAEF;EACA,MAAM;IAAEgB,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,MAAMvC,gBAAgB,CAAC;IAC3EY,IAAI,EAAEgB,QAAQ;IACdf,aAAa,EAAEiB,iBAAiB;IAChCC,YAAY;IACZC,UAAU;IACVb,qBAAqB;IACrBG,sBAAsB,EAAE,CAAC,GAAGA,sBAAsB,CAAC;IACnDC,0BAA0B,EAAE,CAAC,GAAGA,0BAA0B,CAAC;IAC3DhB,OAAO;IACPa;EACD,CAAC,CAAC;EAEF,OAAO;IACNiB,OAAO;IACPC,QAAQ;IACRC,aAAa;IACb;IACAH,MAAM;IACNZ,cAAc;IACd;IACAR,cAAc;IACd;IACAD,oBAAoB;IACpBF,aAAa,EAAEiB;EAChB,CAAC;AACF","ignoreList":[]}
|
|
@@ -16,38 +16,46 @@ export const getDynamicOffers = async ({
|
|
|
16
16
|
defaultProductType,
|
|
17
17
|
productTypes,
|
|
18
18
|
resultType,
|
|
19
|
-
|
|
19
|
+
isCachedOffersRequest,
|
|
20
20
|
productTypesDefinition,
|
|
21
21
|
partnersOverrideDefinition,
|
|
22
22
|
context
|
|
23
23
|
}) => {
|
|
24
24
|
// Get the initial offers
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
let {
|
|
26
|
+
offers,
|
|
27
|
+
rateTableUuid,
|
|
28
|
+
isError,
|
|
29
|
+
leadUuid
|
|
30
|
+
} = await getOffersByProductTypes({
|
|
31
|
+
isCachedOffersRequest,
|
|
27
32
|
productTypes,
|
|
28
33
|
tags,
|
|
29
34
|
context
|
|
30
35
|
});
|
|
31
36
|
|
|
32
|
-
//
|
|
33
|
-
if (isEmpty(
|
|
34
|
-
|
|
37
|
+
// If no offers found, fall back to the default product type
|
|
38
|
+
if (isEmpty(offers)) {
|
|
39
|
+
const fallbackResult = await getOffersByProductTypes({
|
|
40
|
+
isCachedOffersRequest,
|
|
41
|
+
productTypes: [defaultProductType],
|
|
42
|
+
tags,
|
|
43
|
+
context
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Update the offers, rateTableUuid, isError, leafUuid and productTypes
|
|
47
|
+
offers = fallbackResult.offers;
|
|
48
|
+
rateTableUuid = fallbackResult.rateTableUuid;
|
|
49
|
+
isError = fallbackResult.isError;
|
|
50
|
+
leadUuid = fallbackResult.leadUuid;
|
|
35
51
|
productTypes = [defaultProductType];
|
|
36
52
|
}
|
|
37
|
-
|
|
38
|
-
// if initial offers are returned, return them
|
|
39
|
-
const offersData = isEmpty(initialOffersData === null || initialOffersData === void 0 ? void 0 : initialOffersData.offers) ? await getOffersByProductTypes({
|
|
40
|
-
enableUseCachedOffers,
|
|
41
|
-
productTypes,
|
|
42
|
-
tags,
|
|
43
|
-
context
|
|
44
|
-
}) : initialOffersData;
|
|
45
|
-
const sortedOffers = resultType === "QUERY" ? selectDynamicOffers(offersData.offers, productTypes) : sortOffersByRecommendationScore(offersData.offers);
|
|
53
|
+
const sortedOffers = resultType === "QUERY" ? selectDynamicOffers(offers, productTypes) : sortOffersByRecommendationScore(offers);
|
|
46
54
|
return {
|
|
47
|
-
offers: pipe(sortedOffers, formatOfferUrl(productTypesDefinition, partnersOverrideDefinition), addClientTagsToOfferLinks(
|
|
48
|
-
isError:
|
|
49
|
-
leadUuid:
|
|
50
|
-
rateTableUuid
|
|
55
|
+
offers: pipe(sortedOffers, formatOfferUrl(productTypesDefinition, partnersOverrideDefinition), addClientTagsToOfferLinks(isCachedOffersRequest, tags), getOffersBasedOnLayout(displayLayout)),
|
|
56
|
+
isError: isError,
|
|
57
|
+
leadUuid: leadUuid,
|
|
58
|
+
rateTableUuid
|
|
51
59
|
};
|
|
52
60
|
};
|
|
53
61
|
//# sourceMappingURL=getDynamicOffers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isEmpty","addClientTagsToOfferLinks","getOffersByProductTypes","selectDynamicOffers","sortOffersByRecommendationScore","pipe","formatOfferUrl","getOffersBasedOnLayout","getDynamicOffers","tags","displayLayout","defaultProductType","productTypes","resultType","
|
|
1
|
+
{"version":3,"names":["isEmpty","addClientTagsToOfferLinks","getOffersByProductTypes","selectDynamicOffers","sortOffersByRecommendationScore","pipe","formatOfferUrl","getOffersBasedOnLayout","getDynamicOffers","tags","displayLayout","defaultProductType","productTypes","resultType","isCachedOffersRequest","productTypesDefinition","partnersOverrideDefinition","context","offers","rateTableUuid","isError","leadUuid","fallbackResult","sortedOffers"],"sourceRoot":"../../../src","sources":["services/getDynamicOffers.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SACCC,yBAAyB,EACzBC,uBAAuB,EACvBC,mBAAmB,QAEb,UAAU;AAKjB,SAASC,+BAA+B,QAAQ,0CAA0C;AAC1F,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,sBAAsB,QAAQ,iCAAiC;AA0BxE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAO;EACtCC,IAAI;EACJC,aAAa;EACbC,kBAAkB;EAClBC,YAAY;EACZC,UAAU;EACVC,qBAAqB;EACrBC,sBAAsB;EACtBC,0BAA0B;EAC1BC;AACqC,CAAC,KAAK;EAC3C;EACA,IAAI;IAAEC,MAAM;IAAEC,aAAa;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAC/C,MAAMnB,uBAAuB,CAAC;IAC7BY,qBAAqB;IACrBF,YAAY;IACZH,IAAI;IACJQ;EACD,CAAC,CAAC;;EAEH;EACA,IAAIjB,OAAO,CAACkB,MAAM,CAAC,EAAE;IACpB,MAAMI,cAAc,GAAG,MAAMpB,uBAAuB,CAAC;MACpDY,qBAAqB;MACrBF,YAAY,EAAE,CAACD,kBAAkB,CAAC;MAClCF,IAAI;MACJQ;IACD,CAAC,CAAC;;IAEF;IACAC,MAAM,GAAGI,cAAc,CAACJ,MAAM;IAC9BC,aAAa,GAAGG,cAAc,CAACH,aAAa;IAC5CC,OAAO,GAAGE,cAAc,CAACF,OAAO;IAChCC,QAAQ,GAAGC,cAAc,CAACD,QAAQ;IAClCT,YAAY,GAAG,CAACD,kBAAkB,CAAC;EACpC;EAEA,MAAMY,YAAY,GACjBV,UAAU,KAAK,OAAO,GACnBV,mBAAmB,CAACe,MAAM,EAAEN,YAAY,CAAC,GACzCR,+BAA+B,CAACc,MAAM,CAAC;EAE3C,OAAO;IACNA,MAAM,EAAEb,IAAI,CACXkB,YAAY,EACZjB,cAAc,CAACS,sBAAsB,EAAEC,0BAA0B,CAAC,EAClEf,yBAAyB,CAACa,qBAAqB,EAAEL,IAAI,CAAC,EACtDF,sBAAsB,CAACG,aAAa,CACrC,CAAC;IACDU,OAAO,EAAEA,OAAO;IAChBC,QAAQ,EAAEA,QAAQ;IAClBF;EACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -5,21 +5,42 @@ import { parseClientTags } from "../capabilities/offer-catalog/src/utils/context
|
|
|
5
5
|
* Retrieves offers by product types.
|
|
6
6
|
*
|
|
7
7
|
* @param {Object} params - The parameters for retrieving offers by product types.
|
|
8
|
-
* @param {boolean} params.
|
|
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
11
|
* @returns {Promise<OffersData>} A promise that resolves to an array of offers or undefined if no offers are found.
|
|
12
12
|
*/
|
|
13
13
|
export const getOffersByProductTypes = async ({
|
|
14
|
-
|
|
14
|
+
isCachedOffersRequest,
|
|
15
15
|
productTypes,
|
|
16
16
|
tags,
|
|
17
17
|
context
|
|
18
18
|
}) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (isCachedOffersRequest) {
|
|
20
|
+
const {
|
|
21
|
+
offers,
|
|
22
|
+
uuid,
|
|
23
|
+
isError,
|
|
24
|
+
leadUuid
|
|
25
|
+
} = await getCachedOffersByProductTypes(context)(productTypes);
|
|
26
|
+
return {
|
|
27
|
+
offers,
|
|
28
|
+
rateTableUuid: uuid,
|
|
29
|
+
isError,
|
|
30
|
+
leadUuid
|
|
31
|
+
};
|
|
22
32
|
}
|
|
23
|
-
|
|
33
|
+
const {
|
|
34
|
+
offers,
|
|
35
|
+
uuid,
|
|
36
|
+
isError,
|
|
37
|
+
leadUuid
|
|
38
|
+
} = await getOffersForProductTypes(context)(productTypes, parseClientTags(tags));
|
|
39
|
+
return {
|
|
40
|
+
offers,
|
|
41
|
+
rateTableUuid: uuid,
|
|
42
|
+
isError,
|
|
43
|
+
leadUuid
|
|
44
|
+
};
|
|
24
45
|
};
|
|
25
46
|
//# sourceMappingURL=getOffersByProductTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getCachedOffersByProductTypes","getOffersForProductTypes","parseClientTags","getOffersByProductTypes","
|
|
1
|
+
{"version":3,"names":["getCachedOffersByProductTypes","getOffersForProductTypes","parseClientTags","getOffersByProductTypes","isCachedOffersRequest","productTypes","tags","context","offers","uuid","isError","leadUuid","rateTableUuid"],"sourceRoot":"../../../src","sources":["utils/getOffersByProductTypes.ts"],"mappings":"AACA,SACCA,6BAA6B,EAC7BC,wBAAwB,QAClB,uDAAuD;AAC9D,SAASC,eAAe,QAAQ,qDAAqD;;AAErF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,MAAAA,CAAO;EAC7CC,qBAAqB;EACrBC,YAAY;EACZC,IAAI;EACJC;AAMD,CAAC,KAAK;EACL,IAAIH,qBAAqB,EAAE;IAC1B,MAAM;MAAEI,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAAS,CAAC,GACxC,MAAMX,6BAA6B,CAACO,OAAO,CAAC,CAACF,YAAY,CAAC;IAE3D,OAAO;MAAEG,MAAM;MAAEI,aAAa,EAAEH,IAAI;MAAEC,OAAO;MAAEC;IAAS,CAAC;EAC1D;EAEA,MAAM;IAAEH,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAG,MAAMV,wBAAwB,CACzEM,OACD,CAAC,CAACF,YAAY,EAAEH,eAAe,CAACI,IAAI,CAAC,CAAC;EAEtC,OAAO;IAAEE,MAAM;IAAEI,aAAa,EAAEH,IAAI;IAAEC,OAAO;IAAEC;EAAS,CAAC;AAC1D,CAAC","ignoreList":[]}
|
package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/capabilities/ui/elements/src/components/MarkdownText/components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/capabilities/ui/elements/src/components/MarkdownText/components.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAa,EACZ,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA6B3D,eAAO,MAAM,wBAAwB;;;;;MAUjC,WAkHH,CAAC"}
|
|
@@ -7,7 +7,7 @@ export type GetDynamicOffersProps = {
|
|
|
7
7
|
displayLayout: Layout;
|
|
8
8
|
productTypes: string[];
|
|
9
9
|
resultType: ProductTypesResult["resultType"];
|
|
10
|
-
|
|
10
|
+
isCachedOffersRequest: boolean;
|
|
11
11
|
productTypesDefinition: ProductTypeDefinition[];
|
|
12
12
|
partnersOverrideDefinition: PartnerOverride[];
|
|
13
13
|
context: CnfContext;
|
|
@@ -18,7 +18,7 @@ export type GetDynamicOffersProps = {
|
|
|
18
18
|
* @param {GetDynamicOffersProps} params - The parameters for retrieving dynamic offers.
|
|
19
19
|
* @returns {Promise<{ productTypeDisplayName: string; offers: typeof offers }>} An object containing the product type display name and the offers.
|
|
20
20
|
*/
|
|
21
|
-
export declare const getDynamicOffers: ({ tags, displayLayout, defaultProductType, productTypes, resultType,
|
|
21
|
+
export declare const getDynamicOffers: ({ tags, displayLayout, defaultProductType, productTypes, resultType, isCachedOffersRequest, productTypesDefinition, partnersOverrideDefinition, context, }: Omit<GetDynamicOffersProps, "isDev">) => Promise<{
|
|
22
22
|
offers: import("../capabilities/offer-catalog/src").BaseOffer[];
|
|
23
23
|
isError: boolean | undefined;
|
|
24
24
|
leadUuid: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDynamicOffers.d.ts","sourceRoot":"","sources":["../../../../src/services/getDynamicOffers.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,MAAM,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACX,oBAAoB,EACpB,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAK3B,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,aAAa,EAAE,MAAM,CAAC;IACtB,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,+JAU1B,KAAK,qBAAqB,EAAE,OAAO,CAAC;;;;;
|
|
1
|
+
{"version":3,"file":"getDynamicOffers.d.ts","sourceRoot":"","sources":["../../../../src/services/getDynamicOffers.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,MAAM,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACX,oBAAoB,EACpB,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAK3B,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,aAAa,EAAE,MAAM,CAAC;IACtB,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,+JAU1B,KAAK,qBAAqB,EAAE,OAAO,CAAC;;;;;EA2CtC,CAAC"}
|
|
@@ -3,15 +3,20 @@ import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfC
|
|
|
3
3
|
* Retrieves offers by product types.
|
|
4
4
|
*
|
|
5
5
|
* @param {Object} params - The parameters for retrieving offers by product types.
|
|
6
|
-
* @param {boolean} params.
|
|
6
|
+
* @param {boolean} params.isCachedOffersRequest - Indicates if the offers should be retrieved from the cache.
|
|
7
7
|
* @param {string[]} params.productTypes - The product types to retrieve offers for.
|
|
8
8
|
* @param {string} params.tags - The tags to use for retrieving offers.
|
|
9
9
|
* @returns {Promise<OffersData>} A promise that resolves to an array of offers or undefined if no offers are found.
|
|
10
10
|
*/
|
|
11
|
-
export declare const getOffersByProductTypes: ({
|
|
12
|
-
|
|
11
|
+
export declare const getOffersByProductTypes: ({ isCachedOffersRequest, productTypes, tags, context, }: {
|
|
12
|
+
isCachedOffersRequest: boolean;
|
|
13
13
|
productTypes: string[];
|
|
14
14
|
tags: string;
|
|
15
15
|
context: CnfContext;
|
|
16
|
-
}) => Promise<
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
offers: import("../capabilities/offer-catalog/src").BaseOffer[];
|
|
18
|
+
rateTableUuid: string;
|
|
19
|
+
isError: boolean | undefined;
|
|
20
|
+
leadUuid: string;
|
|
21
|
+
}>;
|
|
17
22
|
//# sourceMappingURL=getOffersByProductTypes.d.ts.map
|
|
@@ -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;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;2BAMZ,OAAO;kBAChB,MAAM,EAAE;UAChB,MAAM;aACH,UAAU
|
|
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;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;2BAMZ,OAAO;kBAChB,MAAM,EAAE;UAChB,MAAM;aACH,UAAU;;;;;;EAcnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// components.tsx
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { StyleSheet } from "react-native";
|
|
4
3
|
import { Abbreviation } from "./Abbreviation";
|
|
@@ -13,6 +12,27 @@ import Text, {
|
|
|
13
12
|
} from "../../../../../../components/Text";
|
|
14
13
|
import type { ThemeColors } from "../../../../../core/src";
|
|
15
14
|
|
|
15
|
+
const BoldText = ({ children }: { children: React.ReactNode }) => {
|
|
16
|
+
const processChildren = (_children: React.ReactNode) => {
|
|
17
|
+
return React.Children.map(_children, (child) => {
|
|
18
|
+
if (typeof child === "string") {
|
|
19
|
+
return <Text weight="bold">{child}</Text>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (React.isValidElement(child) && child.type === Text) {
|
|
23
|
+
// Use a properly typed props object
|
|
24
|
+
const newProps = {
|
|
25
|
+
weight: "bold" as TextWeight,
|
|
26
|
+
style: child.props.style,
|
|
27
|
+
};
|
|
28
|
+
return React.cloneElement(child, newProps);
|
|
29
|
+
}
|
|
30
|
+
return child;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return <>{processChildren(children)}</>;
|
|
34
|
+
};
|
|
35
|
+
|
|
16
36
|
// Helper to create text variants
|
|
17
37
|
const createTextVariant =
|
|
18
38
|
(props: any) => (_node: ASTNode, children: React.ReactNode) => {
|
|
@@ -137,16 +157,10 @@ export const createMarkdownComponents = ({
|
|
|
137
157
|
);
|
|
138
158
|
},
|
|
139
159
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<Text
|
|
143
|
-
key={node.key || `${node.type}-${node.index}`}
|
|
144
|
-
variant={variant}
|
|
145
|
-
weight={"bold"}
|
|
146
|
-
color={color}
|
|
147
|
-
>
|
|
160
|
+
strong: (node, children) => (
|
|
161
|
+
<BoldText key={node.key || `${node.type}-${node.index}`}>
|
|
148
162
|
{children}
|
|
149
|
-
</
|
|
163
|
+
</BoldText>
|
|
150
164
|
),
|
|
151
165
|
};
|
|
152
166
|
};
|
package/src/pageData.ts
CHANGED
|
@@ -37,7 +37,7 @@ export async function getPageData({
|
|
|
37
37
|
// Resolve Tags
|
|
38
38
|
const resolvedTags = `${tags?.trim()}`;
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const isCachedOffersRequest = getEnableUseCachedOffers(context);
|
|
41
41
|
|
|
42
42
|
const defaultProductType = getDefaultProductType(context);
|
|
43
43
|
|
|
@@ -77,7 +77,7 @@ export async function getPageData({
|
|
|
77
77
|
displayLayout: safeDisplayLayout,
|
|
78
78
|
productTypes,
|
|
79
79
|
resultType,
|
|
80
|
-
|
|
80
|
+
isCachedOffersRequest,
|
|
81
81
|
productTypesDefinition: [...productTypesDefinition],
|
|
82
82
|
partnersOverrideDefinition: [...partnersOverrideDefinition],
|
|
83
83
|
context,
|
|
@@ -24,7 +24,7 @@ export type GetDynamicOffersProps = {
|
|
|
24
24
|
displayLayout: Layout;
|
|
25
25
|
productTypes: string[];
|
|
26
26
|
resultType: ProductTypesResult["resultType"];
|
|
27
|
-
|
|
27
|
+
isCachedOffersRequest: boolean;
|
|
28
28
|
productTypesDefinition: ProductTypeDefinition[];
|
|
29
29
|
partnersOverrideDefinition: PartnerOverride[];
|
|
30
30
|
context: CnfContext;
|
|
@@ -50,49 +50,51 @@ export const getDynamicOffers = async ({
|
|
|
50
50
|
defaultProductType,
|
|
51
51
|
productTypes,
|
|
52
52
|
resultType,
|
|
53
|
-
|
|
53
|
+
isCachedOffersRequest,
|
|
54
54
|
productTypesDefinition,
|
|
55
55
|
partnersOverrideDefinition,
|
|
56
56
|
context,
|
|
57
57
|
}: Omit<GetDynamicOffersProps, "isDev">) => {
|
|
58
58
|
// Get the initial offers
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
let { offers, rateTableUuid, isError, leadUuid } =
|
|
60
|
+
await getOffersByProductTypes({
|
|
61
|
+
isCachedOffersRequest,
|
|
62
|
+
productTypes,
|
|
63
|
+
tags,
|
|
64
|
+
context,
|
|
65
|
+
});
|
|
65
66
|
|
|
66
|
-
//
|
|
67
|
-
if (isEmpty(
|
|
68
|
-
|
|
67
|
+
// If no offers found, fall back to the default product type
|
|
68
|
+
if (isEmpty(offers)) {
|
|
69
|
+
const fallbackResult = await getOffersByProductTypes({
|
|
70
|
+
isCachedOffersRequest,
|
|
71
|
+
productTypes: [defaultProductType],
|
|
72
|
+
tags,
|
|
73
|
+
context,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Update the offers, rateTableUuid, isError, leafUuid and productTypes
|
|
77
|
+
offers = fallbackResult.offers;
|
|
78
|
+
rateTableUuid = fallbackResult.rateTableUuid;
|
|
79
|
+
isError = fallbackResult.isError;
|
|
80
|
+
leadUuid = fallbackResult.leadUuid;
|
|
69
81
|
productTypes = [defaultProductType];
|
|
70
82
|
}
|
|
71
83
|
|
|
72
|
-
// if initial offers are returned, return them
|
|
73
|
-
const offersData = isEmpty(initialOffersData?.offers)
|
|
74
|
-
? await getOffersByProductTypes({
|
|
75
|
-
enableUseCachedOffers,
|
|
76
|
-
productTypes,
|
|
77
|
-
tags,
|
|
78
|
-
context,
|
|
79
|
-
})
|
|
80
|
-
: initialOffersData;
|
|
81
|
-
|
|
82
84
|
const sortedOffers =
|
|
83
85
|
resultType === "QUERY"
|
|
84
|
-
? selectDynamicOffers(
|
|
85
|
-
: sortOffersByRecommendationScore(
|
|
86
|
+
? selectDynamicOffers(offers, productTypes)
|
|
87
|
+
: sortOffersByRecommendationScore(offers);
|
|
86
88
|
|
|
87
89
|
return {
|
|
88
90
|
offers: pipe(
|
|
89
91
|
sortedOffers,
|
|
90
92
|
formatOfferUrl(productTypesDefinition, partnersOverrideDefinition),
|
|
91
|
-
addClientTagsToOfferLinks(
|
|
93
|
+
addClientTagsToOfferLinks(isCachedOffersRequest, tags),
|
|
92
94
|
getOffersBasedOnLayout(displayLayout)
|
|
93
95
|
),
|
|
94
|
-
isError:
|
|
95
|
-
leadUuid:
|
|
96
|
-
rateTableUuid
|
|
96
|
+
isError: isError,
|
|
97
|
+
leadUuid: leadUuid,
|
|
98
|
+
rateTableUuid,
|
|
97
99
|
};
|
|
98
100
|
};
|
|
@@ -9,29 +9,32 @@ import { parseClientTags } from "../capabilities/offer-catalog/src/utils/context
|
|
|
9
9
|
* Retrieves offers by product types.
|
|
10
10
|
*
|
|
11
11
|
* @param {Object} params - The parameters for retrieving offers by product types.
|
|
12
|
-
* @param {boolean} params.
|
|
12
|
+
* @param {boolean} params.isCachedOffersRequest - Indicates if the offers should be retrieved from the cache.
|
|
13
13
|
* @param {string[]} params.productTypes - The product types to retrieve offers for.
|
|
14
14
|
* @param {string} params.tags - The tags to use for retrieving offers.
|
|
15
15
|
* @returns {Promise<OffersData>} A promise that resolves to an array of offers or undefined if no offers are found.
|
|
16
16
|
*/
|
|
17
17
|
export const getOffersByProductTypes = async ({
|
|
18
|
-
|
|
18
|
+
isCachedOffersRequest,
|
|
19
19
|
productTypes,
|
|
20
20
|
tags,
|
|
21
21
|
context,
|
|
22
22
|
}: {
|
|
23
|
-
|
|
23
|
+
isCachedOffersRequest: boolean;
|
|
24
24
|
productTypes: string[];
|
|
25
25
|
tags: string;
|
|
26
26
|
context: CnfContext;
|
|
27
27
|
}) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (isCachedOffersRequest) {
|
|
29
|
+
const { offers, uuid, isError, leadUuid } =
|
|
30
|
+
await getCachedOffersByProductTypes(context)(productTypes);
|
|
31
|
+
|
|
32
|
+
return { offers, rateTableUuid: uuid, isError, leadUuid };
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const { offers, uuid, isError, leadUuid } = await getOffersForProductTypes(
|
|
36
|
+
context
|
|
37
|
+
)(productTypes, parseClientTags(tags));
|
|
38
|
+
|
|
39
|
+
return { offers, rateTableUuid: uuid, isError, leadUuid };
|
|
37
40
|
};
|