@moneylion/react-native-offer-carousel 1.10.0 → 1.10.2
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 +8 -0
- package/lib/commonjs/capabilities/configuration/src/brands/checkVisualEligibility.js +13 -11
- package/lib/commonjs/capabilities/configuration/src/brands/checkVisualEligibility.js.map +1 -1
- package/lib/commonjs/capabilities/configuration/src/brands/createDerivedBrands.js +8 -19
- package/lib/commonjs/capabilities/configuration/src/brands/createDerivedBrands.js.map +1 -1
- package/lib/commonjs/capabilities/offer-catalog/src/utils/formatUtils.js +36 -21
- package/lib/commonjs/capabilities/offer-catalog/src/utils/formatUtils.js.map +1 -1
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js +7 -30
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js.map +1 -1
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js +15 -17
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js.map +1 -1
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js +8 -2
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js.map +1 -1
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/index.js +40 -38
- package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/index.js.map +1 -1
- package/lib/commonjs/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js +22 -12
- package/lib/commonjs/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js.map +1 -1
- package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js +22 -10
- package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
- package/lib/commonjs/components/DynamicOffers/Render/Offer.js +51 -49
- package/lib/commonjs/components/DynamicOffers/Render/Offer.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/capabilities/configuration/src/brands/checkVisualEligibility.js +13 -11
- package/lib/module/capabilities/configuration/src/brands/checkVisualEligibility.js.map +1 -1
- package/lib/module/capabilities/configuration/src/brands/createDerivedBrands.js +7 -19
- package/lib/module/capabilities/configuration/src/brands/createDerivedBrands.js.map +1 -1
- package/lib/module/capabilities/offer-catalog/src/utils/formatUtils.js +35 -20
- package/lib/module/capabilities/offer-catalog/src/utils/formatUtils.js.map +1 -1
- package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js +7 -30
- package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js.map +1 -1
- package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js +15 -17
- package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js.map +1 -1
- package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js +8 -2
- package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js.map +1 -1
- package/lib/module/capabilities/offer-catalog/src/utils/stats/index.js +40 -38
- package/lib/module/capabilities/offer-catalog/src/utils/stats/index.js.map +1 -1
- package/lib/module/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js +22 -11
- package/lib/module/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js.map +1 -1
- package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js +22 -10
- package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
- package/lib/module/components/DynamicOffers/Render/Offer.js +51 -49
- package/lib/module/components/DynamicOffers/Render/Offer.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/apiEnvironment.d.ts.map +1 -0
- package/lib/typescript/builder/builder.d.ts.map +1 -0
- package/lib/typescript/builder/config/types.d.ts.map +1 -0
- package/lib/typescript/builder/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/configuration/src/brands/checkVisualEligibility.d.ts.map +1 -0
- package/lib/typescript/capabilities/configuration/src/brands/createDerivedBrands.d.ts.map +1 -0
- package/lib/typescript/capabilities/configuration/src/brands/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/configuration/src/brands/types.d.ts.map +1 -0
- package/lib/typescript/capabilities/configuration/src/userData/types.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/CnfContext.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/App.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/Brand.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/Configuration.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/Request.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/Session.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/Signals.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/Subaccount.d.ts.map +1 -0
- package/lib/typescript/capabilities/core/src/system/cnfContext/schemas/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/errors/types/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/types/offerCatalogSchema.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/arrayToMarkdownList.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/contextUtil.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/errorUtil.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/formatUtils.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/getEventCallbackContext.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/getOfferUrl.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/boolean.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/common.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/creditBureaus.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/currency.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/currencyOrBasis.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/freeTrialDays.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/fromListStringWithAnd.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/monthlyOrAnnualCurrency.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/percentage.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/rangeCurrency.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/rangeCurrencyByTime.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/rangeCurrencyUnabbreviated.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/rangeMonths.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/rangePercent.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/rewardsDisplay.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/offer-catalog/src/utils/stats/types.d.ts.map +1 -0
- package/lib/typescript/capabilities/offers/pipeline/src/sources/ratetables/offer-catalog/types/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/offers/pipeline/src/sources/ratetables/offer-catalog/types/oas/offer-catalog.d.ts.map +1 -0
- package/lib/typescript/capabilities/offers/pipeline/src/sources/ratetables/types/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.d.ts +20 -0
- package/lib/typescript/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/components/MarkdownText/Abbreviation.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/components/MarkdownText/components.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/components/MarkdownText/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/components/MarkdownText/markdownPreprocessor.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/components/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/components/thumbor/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/components/thumbor/useSvgUriViewBox.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/index.d.ts.map +1 -0
- package/lib/typescript/capabilities/ui/elements/src/offerCardAttributes.d.ts.map +1 -0
- package/lib/typescript/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/components/Common/BaseOfferCard/Content/Content.d.ts.map +1 -0
- package/lib/typescript/components/Common/BaseOfferCard/Content/index.d.ts.map +1 -0
- package/lib/typescript/components/Common/BaseOfferCard/Stat/Stat.d.ts.map +1 -0
- package/lib/typescript/components/Common/BaseOfferCard/Stat/index.d.ts.map +1 -0
- package/lib/typescript/components/Common/BaseOfferCard/StatsContainer/StatsContainer.d.ts.map +1 -0
- package/lib/typescript/components/Common/BaseOfferCard/StatsContainer/index.d.ts.map +1 -0
- package/lib/typescript/components/Common/BaseOfferCard/index.d.ts.map +1 -0
- package/lib/typescript/components/Common/DynamicOfferCard/CallToAction.d.ts.map +1 -0
- package/lib/typescript/components/Common/DynamicOfferCard/SeeMore.d.ts.map +1 -0
- package/lib/typescript/components/Common/DynamicOfferCard/index.d.ts.map +1 -0
- package/lib/typescript/components/Common/index.d.ts.map +1 -0
- package/lib/typescript/components/Divider/index.d.ts.map +1 -0
- package/lib/typescript/components/DynamicOffers/DynamicOffers.d.ts.map +1 -0
- package/lib/typescript/components/DynamicOffers/DynamicOffersContainer.d.ts.map +1 -0
- package/lib/typescript/components/DynamicOffers/Render/DynamicOffersRender.d.ts.map +1 -0
- package/lib/typescript/components/DynamicOffers/Render/FallbackOfferTemplate.d.ts.map +1 -0
- package/lib/typescript/components/DynamicOffers/Render/Offer.d.ts.map +1 -0
- package/lib/typescript/components/DynamicOffers/Render/index.d.ts.map +1 -0
- package/lib/typescript/components/DynamicOffers/SeeAllButton.d.ts.map +1 -0
- package/lib/typescript/components/ErrorBoundary/index.d.ts.map +1 -0
- package/lib/typescript/components/Layouts/CreditCardOfferCard/index.d.ts.map +1 -0
- package/lib/typescript/components/Layouts/CreditCardOfferCard/statsBuilder.d.ts.map +1 -0
- package/lib/typescript/components/Layouts/DefaultOfferCard/index.d.ts.map +1 -0
- package/lib/typescript/components/Layouts/DefaultOfferCard/statsBuilder.d.ts.map +1 -0
- package/lib/typescript/components/Layouts/HeadlineWithDescriptionCard/index.d.ts.map +1 -0
- package/lib/typescript/components/Layouts/index.d.ts.map +1 -0
- package/lib/typescript/components/Modal/AllOffersModal.d.ts.map +1 -0
- package/lib/typescript/components/Modal/DescriptionPoints.d.ts.map +1 -0
- package/lib/typescript/components/Modal/Disclaimer.d.ts.map +1 -0
- package/lib/typescript/components/Modal/OfferDetailsModal.d.ts.map +1 -0
- package/lib/typescript/components/MoneyLionOfferCarousel.d.ts.map +1 -0
- package/lib/typescript/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/typescript/components/Skeleton/index.d.ts.map +1 -0
- package/lib/typescript/components/Text/index.d.ts.map +1 -0
- package/lib/typescript/components/Touchable/TouchableOpacity.d.ts.map +1 -0
- package/lib/typescript/components/Touchable/index.d.ts.map +1 -0
- package/lib/typescript/components/View/index.d.ts.map +1 -0
- package/lib/typescript/components/utils/errorUtils.d.ts.map +1 -0
- package/lib/typescript/components/utils/withTestID.d.ts.map +1 -0
- package/lib/typescript/config/mocks/cnfContext.d.ts.map +1 -0
- package/lib/typescript/context/ConfigurationProvider.d.ts.map +1 -0
- package/lib/typescript/context/EventHandlerProvider.d.ts.map +1 -0
- package/lib/typescript/context/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/deps/configuration.d.ts.map +1 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/pageData.d.ts.map +1 -0
- package/lib/typescript/services/getDynamicOffers.d.ts.map +1 -0
- package/lib/typescript/services/getProductTypes.d.ts.map +1 -0
- package/lib/typescript/utils/addClientTagsToOfferLinks.d.ts.map +1 -0
- package/lib/typescript/utils/formatOfferUrl.d.ts.map +1 -0
- package/lib/typescript/utils/getDefaultProductType.d.ts.map +1 -0
- package/lib/typescript/utils/getEnableUseCachedOffers.d.ts.map +1 -0
- package/lib/typescript/utils/getOffersByProductTypes.d.ts.map +1 -0
- package/lib/typescript/utils/getProductTypesDefinition.d.ts.map +1 -0
- package/lib/typescript/utils/getThemeColors.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/lib/typescript/utils/parseStringProductTypes.d.ts.map +1 -0
- package/lib/typescript/utils/resolveProductTypes.d.ts.map +1 -0
- package/lib/typescript/utils/sortOffersByRecommendationScore.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +2 -0
- package/lib/typescript/version.d.ts.map +1 -0
- package/package.json +3 -8
- package/src/capabilities/configuration/src/brands/checkVisualEligibility.ts +22 -16
- package/src/capabilities/configuration/src/brands/createDerivedBrands.ts +10 -23
- package/src/capabilities/offer-catalog/src/utils/formatUtils.ts +38 -19
- package/src/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.ts +19 -46
- package/src/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.ts +17 -21
- package/src/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.ts +11 -8
- package/src/capabilities/offer-catalog/src/utils/stats/index.ts +40 -109
- package/src/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.ts +26 -17
- package/src/capabilities/ui/elements/src/components/MarkdownText/components.tsx +27 -6
- package/src/components/DynamicOffers/Render/Offer.tsx +34 -33
- package/src/version.ts +1 -1
- package/lib/typescript/src/apiEnvironment.d.ts.map +0 -1
- package/lib/typescript/src/builder/builder.d.ts.map +0 -1
- package/lib/typescript/src/builder/config/types.d.ts.map +0 -1
- package/lib/typescript/src/builder/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/configuration/src/brands/checkVisualEligibility.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/configuration/src/brands/createDerivedBrands.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/configuration/src/brands/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/configuration/src/brands/types.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/configuration/src/userData/types.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/CnfContext.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/App.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Brand.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Configuration.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Request.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Session.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Signals.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Subaccount.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/errors/types/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/api/offerCatalogApi.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/types/offerCatalogSchema.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/arrayToMarkdownList.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/contextUtil.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/errorUtil.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/formatUtils.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/getEventCallbackContext.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/getOfferUrl.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/boolean.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/common.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/creditBureaus.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/currency.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/currencyOrBasis.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/freeTrialDays.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/fromListStringWithAnd.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/monthlyOrAnnualCurrency.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/percentage.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/rangeCurrency.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/rangeCurrencyByTime.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/rangeCurrencyUnabbreviated.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/rangeMonths.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/rangePercent.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/formatters/rewardsDisplay.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offer-catalog/src/utils/stats/types.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offers/pipeline/src/sources/ratetables/offer-catalog/types/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offers/pipeline/src/sources/ratetables/offer-catalog/types/oas/offer-catalog.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offers/pipeline/src/sources/ratetables/types/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.d.ts +0 -208
- package/lib/typescript/src/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/Abbreviation.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/components.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/markdownPreprocessor.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/thumbor/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/components/thumbor/useSvgUriViewBox.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/index.d.ts.map +0 -1
- package/lib/typescript/src/capabilities/ui/elements/src/offerCardAttributes.d.ts.map +0 -1
- package/lib/typescript/src/components/Button/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/Content/Content.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/Content/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/Stat/Stat.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/Stat/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/StatsContainer/StatsContainer.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/StatsContainer/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/CallToAction.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/SeeMore.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/DynamicOfferCard/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Common/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Divider/index.d.ts.map +0 -1
- package/lib/typescript/src/components/DynamicOffers/DynamicOffers.d.ts.map +0 -1
- package/lib/typescript/src/components/DynamicOffers/DynamicOffersContainer.d.ts.map +0 -1
- package/lib/typescript/src/components/DynamicOffers/Render/DynamicOffersRender.d.ts.map +0 -1
- package/lib/typescript/src/components/DynamicOffers/Render/FallbackOfferTemplate.d.ts.map +0 -1
- package/lib/typescript/src/components/DynamicOffers/Render/Offer.d.ts.map +0 -1
- package/lib/typescript/src/components/DynamicOffers/Render/index.d.ts.map +0 -1
- package/lib/typescript/src/components/DynamicOffers/SeeAllButton.d.ts.map +0 -1
- package/lib/typescript/src/components/ErrorBoundary/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Layouts/CreditCardOfferCard/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Layouts/CreditCardOfferCard/statsBuilder.d.ts.map +0 -1
- package/lib/typescript/src/components/Layouts/DefaultOfferCard/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Layouts/DefaultOfferCard/statsBuilder.d.ts.map +0 -1
- package/lib/typescript/src/components/Layouts/HeadlineWithDescriptionCard/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Layouts/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Modal/AllOffersModal.d.ts.map +0 -1
- package/lib/typescript/src/components/Modal/DescriptionPoints.d.ts.map +0 -1
- package/lib/typescript/src/components/Modal/Disclaimer.d.ts.map +0 -1
- package/lib/typescript/src/components/Modal/OfferDetailsModal.d.ts.map +0 -1
- package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +0 -1
- package/lib/typescript/src/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/lib/typescript/src/components/Skeleton/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Text/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Touchable/TouchableOpacity.d.ts.map +0 -1
- package/lib/typescript/src/components/Touchable/index.d.ts.map +0 -1
- package/lib/typescript/src/components/View/index.d.ts.map +0 -1
- package/lib/typescript/src/components/utils/errorUtils.d.ts.map +0 -1
- package/lib/typescript/src/components/utils/withTestID.d.ts.map +0 -1
- package/lib/typescript/src/config/mocks/cnfContext.d.ts.map +0 -1
- package/lib/typescript/src/context/ConfigurationProvider.d.ts.map +0 -1
- package/lib/typescript/src/context/EventHandlerProvider.d.ts.map +0 -1
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +0 -1
- package/lib/typescript/src/deps/configuration.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/pageData.d.ts.map +0 -1
- package/lib/typescript/src/services/getDynamicOffers.d.ts.map +0 -1
- package/lib/typescript/src/services/getProductTypes.d.ts.map +0 -1
- package/lib/typescript/src/utils/addClientTagsToOfferLinks.d.ts.map +0 -1
- package/lib/typescript/src/utils/formatOfferUrl.d.ts.map +0 -1
- package/lib/typescript/src/utils/getDefaultProductType.d.ts.map +0 -1
- package/lib/typescript/src/utils/getEnableUseCachedOffers.d.ts.map +0 -1
- package/lib/typescript/src/utils/getOffersByProductTypes.d.ts.map +0 -1
- package/lib/typescript/src/utils/getProductTypesDefinition.d.ts.map +0 -1
- package/lib/typescript/src/utils/getThemeColors.d.ts.map +0 -1
- package/lib/typescript/src/utils/index.d.ts.map +0 -1
- package/lib/typescript/src/utils/parseStringProductTypes.d.ts.map +0 -1
- package/lib/typescript/src/utils/resolveProductTypes.d.ts.map +0 -1
- package/lib/typescript/src/utils/sortOffersByRecommendationScore.d.ts.map +0 -1
- package/lib/typescript/src/version.d.ts +0 -2
- package/lib/typescript/src/version.d.ts.map +0 -1
- /package/lib/typescript/{src/apiEnvironment.d.ts → apiEnvironment.d.ts} +0 -0
- /package/lib/typescript/{src/builder → builder}/builder.d.ts +0 -0
- /package/lib/typescript/{src/builder → builder}/config/types.d.ts +0 -0
- /package/lib/typescript/{src/builder → builder}/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/configuration/src/brands/checkVisualEligibility.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/configuration/src/brands/createDerivedBrands.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/configuration/src/brands/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/configuration/src/brands/types.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/configuration/src/userData/types.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/CnfContext.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/App.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/Brand.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/Configuration.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/Request.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/Session.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/Signals.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/Subaccount.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/core/src/system/cnfContext/schemas/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/errors/types/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/api/offerCatalogApi.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/types/offerCatalogSchema.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/arrayToMarkdownList.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/contextUtil.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/errorUtil.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/formatUtils.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/getEventCallbackContext.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/getOfferUrl.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/annualFee.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/boolean.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/common.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/creditBureaus.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/currency.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/currencyOrBasis.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/freeTrialDays.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/fromListStringWithAnd.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/monthlyOrAnnualCurrency.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/percentage.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/purchaseApr.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/rangeCurrency.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/rangeCurrencyByTime.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/rangeCurrencyUnabbreviated.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/rangeMonths.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/rangePercent.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/recommendedCredit.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/formatters/rewardsDisplay.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offer-catalog/src/utils/stats/types.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offers/pipeline/src/sources/ratetables/offer-catalog/types/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offers/pipeline/src/sources/ratetables/offer-catalog/types/oas/offer-catalog.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/offers/pipeline/src/sources/ratetables/types/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/components/MarkdownText/Abbreviation.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/components/MarkdownText/components.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/components/MarkdownText/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/components/MarkdownText/markdownPreprocessor.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/components/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/components/thumbor/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/components/thumbor/useSvgUriViewBox.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/index.d.ts +0 -0
- /package/lib/typescript/{src/capabilities → capabilities}/ui/elements/src/offerCardAttributes.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Button/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/BaseOfferCard/Content/Content.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/BaseOfferCard/Content/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/BaseOfferCard/Stat/Stat.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/BaseOfferCard/Stat/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/BaseOfferCard/StatsContainer/StatsContainer.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/BaseOfferCard/StatsContainer/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/BaseOfferCard/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/DynamicOfferCard/CallToAction.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/DynamicOfferCard/SeeMore.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/DynamicOfferCard/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Common/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Divider/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/DynamicOffers/DynamicOffers.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/DynamicOffers/DynamicOffersContainer.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/DynamicOffers/Render/DynamicOffersRender.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/DynamicOffers/Render/FallbackOfferTemplate.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/DynamicOffers/Render/Offer.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/DynamicOffers/Render/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/DynamicOffers/SeeAllButton.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/ErrorBoundary/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Layouts/CreditCardOfferCard/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Layouts/CreditCardOfferCard/statsBuilder.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Layouts/DefaultOfferCard/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Layouts/DefaultOfferCard/statsBuilder.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Layouts/HeadlineWithDescriptionCard/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Layouts/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Modal/AllOffersModal.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Modal/DescriptionPoints.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Modal/Disclaimer.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Modal/OfferDetailsModal.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/MoneyLionOfferCarousel.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Skeleton/Skeleton.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Skeleton/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Text/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Touchable/TouchableOpacity.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Touchable/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/View/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/utils/errorUtils.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/utils/withTestID.d.ts +0 -0
- /package/lib/typescript/{src/config → config}/mocks/cnfContext.d.ts +0 -0
- /package/lib/typescript/{src/context → context}/ConfigurationProvider.d.ts +0 -0
- /package/lib/typescript/{src/context → context}/EventHandlerProvider.d.ts +0 -0
- /package/lib/typescript/{src/context → context}/ThemeProvider.d.ts +0 -0
- /package/lib/typescript/{src/deps → deps}/configuration.d.ts +0 -0
- /package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/typescript/{src/pageData.d.ts → pageData.d.ts} +0 -0
- /package/lib/typescript/{src/services → services}/getDynamicOffers.d.ts +0 -0
- /package/lib/typescript/{src/services → services}/getProductTypes.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/addClientTagsToOfferLinks.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/formatOfferUrl.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/getDefaultProductType.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/getEnableUseCachedOffers.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/getOffersByProductTypes.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/getProductTypesDefinition.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/getThemeColors.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/index.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/parseStringProductTypes.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/resolveProductTypes.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/sortOffersByRecommendationScore.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneylion/react-native-offer-carousel",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "React Native components for the Engine by MoneyLion Mobile SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
|
-
"types": "lib/typescript/
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
8
|
"react-native": "src/index",
|
|
9
9
|
"source": "src/index",
|
|
10
10
|
"files": [
|
|
@@ -30,14 +30,12 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"test": "jest --silent",
|
|
32
32
|
"typecheck": "tsc --noEmit",
|
|
33
|
-
"clean": "del-cli lib",
|
|
34
33
|
"sync-version": "node scripts/sync-version.js",
|
|
35
34
|
"prepare": "yarn sync-version && bob build"
|
|
36
35
|
},
|
|
37
36
|
"author": "",
|
|
38
37
|
"license": "ISC",
|
|
39
38
|
"devDependencies": {
|
|
40
|
-
"del-cli": "^5.1.0",
|
|
41
39
|
"react-native-builder-bob": "^0.20.0",
|
|
42
40
|
"type-fest": "4.26.1"
|
|
43
41
|
},
|
|
@@ -61,10 +59,7 @@
|
|
|
61
59
|
]
|
|
62
60
|
},
|
|
63
61
|
"dependencies": {
|
|
64
|
-
"defu": "6.1.5",
|
|
65
|
-
"numbro": "^2.5.0",
|
|
66
62
|
"radash": "11.0.0",
|
|
67
|
-
"react-native-markdown-display": "^7.0.2"
|
|
68
|
-
"ts-pattern": "5.1.1"
|
|
63
|
+
"react-native-markdown-display": "^7.0.2"
|
|
69
64
|
}
|
|
70
65
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { get } from "radash";
|
|
2
2
|
import { enhanceType, type Brand } from "./types";
|
|
3
|
-
import { match, P } from "ts-pattern";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* A UI centric concept that prioritizes brands for visual use, both by the data available and the preferences of the brand.
|
|
@@ -12,18 +11,25 @@ export type VisualBrandKind = "primary" | "secondary" | "none";
|
|
|
12
11
|
* Used to rank a primary eligible brand highest if no brand prefers primary, such as a licensed brand
|
|
13
12
|
* @param brand
|
|
14
13
|
*/
|
|
15
|
-
export const checkVisualBrandEligibility = (brand: Brand) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
export const checkVisualBrandEligibility = (brand: Brand): VisualBrandKind => {
|
|
15
|
+
const type = enhanceType(brand);
|
|
16
|
+
const allowedMarks = get<{ logo?: boolean; name?: boolean } | undefined>(
|
|
17
|
+
brand,
|
|
18
|
+
"allowedMarks"
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const hasFullMarks =
|
|
22
|
+
allowedMarks?.logo === true && allowedMarks?.name === true;
|
|
23
|
+
const hasNameOnlyMarks =
|
|
24
|
+
allowedMarks?.logo === false && allowedMarks?.name === true;
|
|
25
|
+
|
|
26
|
+
if (brand?.isLicensed === true) return "primary";
|
|
27
|
+
if ((type === "business" || type === "product") && hasFullMarks) {
|
|
28
|
+
return "primary";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (type === "individual") return "secondary";
|
|
32
|
+
if (type === "business" && hasNameOnlyMarks) return "secondary";
|
|
33
|
+
|
|
34
|
+
return "none";
|
|
35
|
+
};
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { isObject, sift } from "radash";
|
|
2
2
|
import type { Brand } from "../../../../builder";
|
|
3
|
-
import { P, match } from "ts-pattern";
|
|
4
3
|
import { enhanceType } from "./types";
|
|
5
4
|
import { checkVisualBrandEligibility } from "./checkVisualEligibility";
|
|
6
5
|
|
|
6
|
+
const resolveLicensedBrand = (brand: Brand): Brand => {
|
|
7
|
+
if (enhanceType(brand) === "licensed") return brand;
|
|
8
|
+
|
|
9
|
+
const candidate = brand?.isLicensed || brand?.licensedBrand;
|
|
10
|
+
if (isObject(candidate)) return candidate as Brand;
|
|
11
|
+
|
|
12
|
+
throw new Error("Missing Licensed Brand");
|
|
13
|
+
};
|
|
14
|
+
|
|
7
15
|
/**
|
|
8
16
|
* Extracts and normalizes a brand into -
|
|
9
17
|
* LicensedBrand - The brand to be used for terms, legal and other compliance needs
|
|
@@ -11,29 +19,8 @@ import { checkVisualBrandEligibility } from "./checkVisualEligibility";
|
|
|
11
19
|
* @param brand
|
|
12
20
|
*/
|
|
13
21
|
export const createDerivedBrands = (brand: Brand) => {
|
|
14
|
-
|
|
15
|
-
const licensedBrand = match([
|
|
16
|
-
enhanceType(brand),
|
|
17
|
-
brand?.isLicensed || brand?.licensedBrand,
|
|
18
|
-
])
|
|
19
|
-
// Ensure we get back a brand at the end
|
|
20
|
-
.returnType<Brand>()
|
|
21
|
-
// If the type is licensed, return this brand
|
|
22
|
-
.with(["licensed", P._], () => brand)
|
|
23
|
-
// If the type is not licensed, but there is a cobrand setup, use that to get the licensed brand
|
|
24
|
-
.with(
|
|
25
|
-
[P.not("licensed"), P.select("licensedBrandObj")],
|
|
26
|
-
({ licensedBrandObj }) => {
|
|
27
|
-
if (isObject(licensedBrandObj)) return licensedBrandObj;
|
|
28
|
-
// Throw if no licensed brand is able to be found
|
|
29
|
-
throw new Error("Missing Licensed Brand");
|
|
30
|
-
}
|
|
31
|
-
)
|
|
32
|
-
.otherwise(() => {
|
|
33
|
-
throw new Error("Missing Licensed Brand");
|
|
34
|
-
});
|
|
22
|
+
const licensedBrand = resolveLicensedBrand(brand);
|
|
35
23
|
|
|
36
|
-
// Determine the set of visual brands which should be displayed on the page
|
|
37
24
|
const brandCanBeShown = checkVisualBrandEligibility(brand) !== "none";
|
|
38
25
|
return Array.from(new Set(sift([licensedBrand, brandCanBeShown && brand])));
|
|
39
26
|
};
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
const formatNumberWithMantissa = (
|
|
2
|
+
value: number,
|
|
3
|
+
mantissa: number,
|
|
4
|
+
trimMantissa: boolean,
|
|
5
|
+
thousandSeparated: boolean
|
|
6
|
+
): string => {
|
|
7
|
+
let str = value.toFixed(mantissa);
|
|
8
|
+
|
|
9
|
+
if (trimMantissa && str.includes(".")) {
|
|
10
|
+
str = str.replace(/0+$/, "").replace(/\.$/, "");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (thousandSeparated) {
|
|
14
|
+
const [intPart, decPart] = str.split(".");
|
|
15
|
+
const withCommas = (intPart ?? "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
16
|
+
str = decPart !== undefined ? `${withCommas}.${decPart}` : withCommas;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return str;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const COMPACT_UNITS = [
|
|
23
|
+
{ threshold: 1e12, suffix: "T" },
|
|
24
|
+
{ threshold: 1e9, suffix: "B" },
|
|
25
|
+
{ threshold: 1e6, suffix: "M" },
|
|
26
|
+
{ threshold: 1e3, suffix: "K" },
|
|
27
|
+
] as const;
|
|
2
28
|
|
|
3
29
|
/**
|
|
4
30
|
* Format the amount
|
|
@@ -25,15 +51,14 @@ export const formatAmount = (amount?: number, raw?: boolean): string => {
|
|
|
25
51
|
? (Math.ceil(amount / 1000000) * 1000000) / 100 // Round to nearest million if large
|
|
26
52
|
: amount / 100;
|
|
27
53
|
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
average: amountInDollars >= 1000,
|
|
31
|
-
mantissa: amountInDollars < 1000 ? 2 : 1,
|
|
32
|
-
trimMantissa: !(amount < 100 && amount !== 0),
|
|
33
|
-
spaceSeparated: false,
|
|
34
|
-
});
|
|
54
|
+
const mantissa = amountInDollars < 1000 ? 2 : 1;
|
|
55
|
+
const trimMantissa = !(amount < 100 && amount !== 0);
|
|
35
56
|
|
|
36
|
-
|
|
57
|
+
const unit = COMPACT_UNITS.find((u) => amountInDollars >= u.threshold);
|
|
58
|
+
const scaled = unit ? amountInDollars / unit.threshold : amountInDollars;
|
|
59
|
+
const suffix = unit?.suffix ?? "";
|
|
60
|
+
|
|
61
|
+
return `$${formatNumberWithMantissa(scaled, mantissa, trimMantissa, false)}${suffix}`.toUpperCase();
|
|
37
62
|
};
|
|
38
63
|
|
|
39
64
|
/**
|
|
@@ -51,10 +76,7 @@ export const formatAmount = (amount?: number, raw?: boolean): string => {
|
|
|
51
76
|
export const formatPercentage = (percentage?: number): string => {
|
|
52
77
|
if (percentage === undefined || percentage === null) return "N/A";
|
|
53
78
|
|
|
54
|
-
return `${
|
|
55
|
-
mantissa: 2,
|
|
56
|
-
trimMantissa: true,
|
|
57
|
-
})}%`;
|
|
79
|
+
return `${formatNumberWithMantissa(percentage / 100, 2, true, false)}%`;
|
|
58
80
|
};
|
|
59
81
|
|
|
60
82
|
/**
|
|
@@ -103,13 +125,10 @@ const formatAmountUnabbreviated = (amount?: number, raw?: boolean): string => {
|
|
|
103
125
|
const amountInDollars = isLargeAmount
|
|
104
126
|
? (Math.ceil(amount / 1000000) * 1000000) / 100 // Round to nearest million if large
|
|
105
127
|
: amount / 100;
|
|
128
|
+
const mantissa = amountInDollars < 1000 ? 2 : 1;
|
|
129
|
+
const trimMantissa = !(amount < 100 && amount !== 0);
|
|
106
130
|
// Format the amount in dollars
|
|
107
|
-
const formattedAmount =
|
|
108
|
-
mantissa: amountInDollars < 1000 ? 2 : 1,
|
|
109
|
-
trimMantissa: !(amount < 100 && amount !== 0),
|
|
110
|
-
spaceSeparated: false,
|
|
111
|
-
thousandSeparated: true,
|
|
112
|
-
});
|
|
131
|
+
const formattedAmount = `$${formatNumberWithMantissa(amountInDollars, mantissa, trimMantissa, true)}`;
|
|
113
132
|
|
|
114
133
|
return formattedAmount.toUpperCase();
|
|
115
134
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { get } from "radash";
|
|
2
|
-
import { P, match } from "ts-pattern";
|
|
3
2
|
import type { StatElementProps } from "../types";
|
|
4
3
|
import { formatAmount, formatRange } from "../../formatUtils";
|
|
5
4
|
import type { BaseOffer } from "../../../types/offerCatalogSchema";
|
|
@@ -21,56 +20,30 @@ const determineContent = ({
|
|
|
21
20
|
annualIntroFeeTermValue,
|
|
22
21
|
raw,
|
|
23
22
|
}: {
|
|
24
|
-
annualFeeValue?: string;
|
|
25
23
|
minAnnualFeeValue?: number;
|
|
26
24
|
maxAnnualFeeValue?: number;
|
|
27
25
|
annualIntroFeeValue?: number;
|
|
28
26
|
annualIntroFeeTermValue?: number;
|
|
29
27
|
raw: boolean;
|
|
30
|
-
}) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
50
|
-
return `${formatAmount(
|
|
51
|
-
annualIntroFeeValue
|
|
52
|
-
)} for ${annualIntroFeeTermValue} years, then ${postIntroFee}`;
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
.with(
|
|
56
|
-
{
|
|
57
|
-
minAnnualFeeValue: P.not(undefined),
|
|
58
|
-
maxAnnualFeeValue: P.not(undefined),
|
|
59
|
-
},
|
|
60
|
-
({ minAnnualFeeValue, maxAnnualFeeValue }) => {
|
|
61
|
-
if (minAnnualFeeValue === maxAnnualFeeValue) {
|
|
62
|
-
return formatAmount(minAnnualFeeValue, raw);
|
|
63
|
-
}
|
|
64
|
-
return formatRange(minAnnualFeeValue, maxAnnualFeeValue, "amount");
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
.with({ minAnnualFeeValue: P.not(undefined) }, ({ minAnnualFeeValue }) =>
|
|
68
|
-
formatAmount(minAnnualFeeValue)
|
|
69
|
-
)
|
|
70
|
-
.with({ maxAnnualFeeValue: P.not(undefined) }, ({ maxAnnualFeeValue }) =>
|
|
71
|
-
formatAmount(maxAnnualFeeValue)
|
|
72
|
-
)
|
|
73
|
-
.otherwise(() => "See Terms");
|
|
28
|
+
}): string => {
|
|
29
|
+
if (annualIntroFeeValue !== undefined) {
|
|
30
|
+
const postIntroFee = formatRange(
|
|
31
|
+
minAnnualFeeValue,
|
|
32
|
+
maxAnnualFeeValue,
|
|
33
|
+
"amount"
|
|
34
|
+
);
|
|
35
|
+
return `${formatAmount(annualIntroFeeValue)} for ${annualIntroFeeTermValue} years, then ${postIntroFee}`;
|
|
36
|
+
}
|
|
37
|
+
if (minAnnualFeeValue !== undefined && maxAnnualFeeValue !== undefined) {
|
|
38
|
+
if (minAnnualFeeValue === maxAnnualFeeValue) {
|
|
39
|
+
return formatAmount(minAnnualFeeValue, raw);
|
|
40
|
+
}
|
|
41
|
+
return formatRange(minAnnualFeeValue, maxAnnualFeeValue, "amount");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const fee = minAnnualFeeValue ?? maxAnnualFeeValue;
|
|
45
|
+
if (fee !== undefined) return formatAmount(fee);
|
|
46
|
+
return "See Terms";
|
|
74
47
|
};
|
|
75
48
|
|
|
76
49
|
export const annualFee =
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { get } from "radash";
|
|
2
|
-
import { P, match } from "ts-pattern";
|
|
3
2
|
import type { StatElementProps } from "../types";
|
|
4
3
|
import { formatRange } from "../../formatUtils";
|
|
5
4
|
import type { BaseOffer } from "../../../types/offerCatalogSchema";
|
|
@@ -33,21 +32,14 @@ const determineContent = ({
|
|
|
33
32
|
purchaseAprValue?: string;
|
|
34
33
|
minPurchaseAprValue?: number;
|
|
35
34
|
maxPurchaseAprValue?: number;
|
|
36
|
-
}) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
minPurchaseAprValue: P.not(undefined),
|
|
45
|
-
maxPurchaseAprValue: P.not(undefined),
|
|
46
|
-
},
|
|
47
|
-
({ minPurchaseAprValue, maxPurchaseAprValue }) =>
|
|
48
|
-
formatRange(minPurchaseAprValue, maxPurchaseAprValue, "percentage")
|
|
49
|
-
)
|
|
50
|
-
.otherwise(() => "See Terms");
|
|
35
|
+
}): string => {
|
|
36
|
+
if (purchaseAprValue !== undefined) {
|
|
37
|
+
return purchaseAprValue;
|
|
38
|
+
}
|
|
39
|
+
if (minPurchaseAprValue !== undefined && maxPurchaseAprValue !== undefined) {
|
|
40
|
+
return formatRange(minPurchaseAprValue, maxPurchaseAprValue, "percentage");
|
|
41
|
+
}
|
|
42
|
+
return "See Terms";
|
|
51
43
|
};
|
|
52
44
|
|
|
53
45
|
/**
|
|
@@ -56,11 +48,15 @@ const determineContent = ({
|
|
|
56
48
|
* @param label {string}
|
|
57
49
|
* @returns {string}
|
|
58
50
|
*/
|
|
59
|
-
const determineLabel = (aprType: string, label: string) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
const determineLabel = (aprType: string, label: string): string => {
|
|
52
|
+
switch (aprType) {
|
|
53
|
+
case "variable":
|
|
54
|
+
return "Variable APR:";
|
|
55
|
+
case "fixed":
|
|
56
|
+
return "Fixed APR:";
|
|
57
|
+
default:
|
|
58
|
+
return label;
|
|
59
|
+
}
|
|
64
60
|
};
|
|
65
61
|
|
|
66
62
|
export const purchaseApr =
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { get } from "radash";
|
|
2
|
-
import { P, match } from "ts-pattern";
|
|
3
2
|
import type { StatElementProps } from "../types";
|
|
4
3
|
import { formatStringListWithAnd } from "../../formatUtils";
|
|
5
4
|
import type { BaseOffer } from "../../../types/offerCatalogSchema";
|
|
@@ -28,13 +27,17 @@ export const recommendedCredit =
|
|
|
28
27
|
({ label, fieldName }: RecommendedCreditStat): StatElementProps => {
|
|
29
28
|
const recommendedCreditValue = get<string[]>(offer, fieldName);
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let content = "See Terms";
|
|
31
|
+
|
|
32
|
+
if (Array.isArray(recommendedCreditValue)) {
|
|
33
|
+
if (hasAllRecommendedRatings(recommendedCreditValue)) {
|
|
34
|
+
content = "Any";
|
|
35
|
+
} else {
|
|
36
|
+
content = formatStringListWithAnd(
|
|
37
|
+
orderRecommendedRatings(recommendedCreditValue)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
38
41
|
|
|
39
42
|
return {
|
|
40
43
|
label,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { match } from "ts-pattern";
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
annualFee,
|
|
5
3
|
creditBureaus,
|
|
@@ -29,113 +27,46 @@ export const statsToElementPropsBuilder = (
|
|
|
29
27
|
offer: BaseOffer
|
|
30
28
|
): StatElementProps[] =>
|
|
31
29
|
stats
|
|
32
|
-
.map((stat) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
format: "rangeCurrencyByTime",
|
|
73
|
-
},
|
|
74
|
-
fromRangeCurrencyByTimeStat(offer)
|
|
75
|
-
)
|
|
76
|
-
.with(
|
|
77
|
-
{
|
|
78
|
-
format: "freeTrial",
|
|
79
|
-
},
|
|
80
|
-
fromFreeTrialStat(offer)
|
|
81
|
-
)
|
|
82
|
-
.with(
|
|
83
|
-
{
|
|
84
|
-
format: "monthlyOrAnnualCurrency",
|
|
85
|
-
},
|
|
86
|
-
fromMonthlyOrAnnualCurrencyStat(offer)
|
|
87
|
-
)
|
|
88
|
-
.with(
|
|
89
|
-
{
|
|
90
|
-
format: "boolean",
|
|
91
|
-
},
|
|
92
|
-
fromBooleanStat(offer)
|
|
93
|
-
)
|
|
94
|
-
.with({ format: "rangeMonths" }, fromRangeMonthsStat(offer))
|
|
95
|
-
.with(
|
|
96
|
-
{
|
|
97
|
-
format: "listStringWithAnd",
|
|
98
|
-
},
|
|
99
|
-
fromListStringWithAnd(offer)
|
|
100
|
-
)
|
|
101
|
-
.with(
|
|
102
|
-
{
|
|
103
|
-
format: "currency",
|
|
104
|
-
},
|
|
105
|
-
fromCurrencyStat(offer)
|
|
106
|
-
)
|
|
107
|
-
.with(
|
|
108
|
-
{
|
|
109
|
-
format: "percentage",
|
|
110
|
-
},
|
|
111
|
-
fromPercentageStat(offer)
|
|
112
|
-
)
|
|
113
|
-
.with(
|
|
114
|
-
{
|
|
115
|
-
format: "recommendedCredit",
|
|
116
|
-
},
|
|
117
|
-
recommendedCredit(offer)
|
|
118
|
-
)
|
|
119
|
-
.with(
|
|
120
|
-
{
|
|
121
|
-
format: "rewardsDisplay",
|
|
122
|
-
},
|
|
123
|
-
rewardsDisplay(offer)
|
|
124
|
-
)
|
|
125
|
-
.with(
|
|
126
|
-
{
|
|
127
|
-
format: "purchaseApr",
|
|
128
|
-
},
|
|
129
|
-
purchaseApr(offer)
|
|
130
|
-
)
|
|
131
|
-
.with(
|
|
132
|
-
{
|
|
133
|
-
format: "annualFee",
|
|
134
|
-
},
|
|
135
|
-
annualFee(offer)
|
|
136
|
-
)
|
|
137
|
-
.exhaustive()
|
|
138
|
-
)
|
|
30
|
+
.map((stat): StatElementProps => {
|
|
31
|
+
switch (stat.format) {
|
|
32
|
+
case "rangeCurrency":
|
|
33
|
+
return fromRangeCurrencyStat(offer)(stat);
|
|
34
|
+
case "rangeCurrencyUnabbreviated":
|
|
35
|
+
return fromRangeCurrencyUnabbreviatedStat(offer)(stat);
|
|
36
|
+
case "BureausStat":
|
|
37
|
+
return creditBureaus(offer)(stat);
|
|
38
|
+
case "rangePercent":
|
|
39
|
+
return fromRangePercentStat(offer)(stat);
|
|
40
|
+
case "rangeCurrencyOrBasis":
|
|
41
|
+
return fromRangeCurrencyOrBasisStat(offer)(stat);
|
|
42
|
+
case "common":
|
|
43
|
+
return fromCommonStat(offer)(stat);
|
|
44
|
+
case "rangeCurrencyByTime":
|
|
45
|
+
return fromRangeCurrencyByTimeStat(offer)(stat);
|
|
46
|
+
case "freeTrial":
|
|
47
|
+
return fromFreeTrialStat(offer)(stat);
|
|
48
|
+
case "monthlyOrAnnualCurrency":
|
|
49
|
+
return fromMonthlyOrAnnualCurrencyStat(offer)(stat);
|
|
50
|
+
case "boolean":
|
|
51
|
+
return fromBooleanStat(offer)(stat);
|
|
52
|
+
case "rangeMonths":
|
|
53
|
+
return fromRangeMonthsStat(offer)(stat);
|
|
54
|
+
case "listStringWithAnd":
|
|
55
|
+
return fromListStringWithAnd(offer)(stat);
|
|
56
|
+
case "currency":
|
|
57
|
+
return fromCurrencyStat(offer)(stat);
|
|
58
|
+
case "percentage":
|
|
59
|
+
return fromPercentageStat(offer)(stat);
|
|
60
|
+
case "recommendedCredit":
|
|
61
|
+
return recommendedCredit(offer)(stat);
|
|
62
|
+
case "rewardsDisplay":
|
|
63
|
+
return rewardsDisplay(offer)(stat);
|
|
64
|
+
case "purchaseApr":
|
|
65
|
+
return purchaseApr(offer)(stat);
|
|
66
|
+
case "annualFee":
|
|
67
|
+
return annualFee(offer)(stat);
|
|
68
|
+
}
|
|
69
|
+
})
|
|
139
70
|
.filter((stat) => stat !== null);
|
|
140
71
|
|
|
141
72
|
export type { Stat, StatElementProps } from "./types";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import defu from "defu";
|
|
2
1
|
import { get, mapValues } from "radash";
|
|
3
2
|
import { createDerivedBrands } from "../../../../../configuration/src/brands/createDerivedBrands";
|
|
4
3
|
import type { CnfContext } from "../../../../../core/src/system/cnfContext/CnfContext";
|
|
@@ -63,21 +62,31 @@ export function withDeviceSignals<
|
|
|
63
62
|
cnfEnvironment,
|
|
64
63
|
};
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
// all clientTag values must be arrays of strings
|
|
66
|
+
const toStringArray = (value: unknown): string[] =>
|
|
67
|
+
Array.isArray(value) ? value.map(String) : [String(value)];
|
|
68
|
+
|
|
69
|
+
const defaultClientTags = mapValues(clientTags, toStringArray);
|
|
70
|
+
const payloadClientTags = mapValues(
|
|
71
|
+
(payload.clientTags ?? {}) as Record<string, unknown>,
|
|
72
|
+
toStringArray
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const mergedClientTags: Record<string, string[]> = { ...defaultClientTags };
|
|
76
|
+
for (const [key, value] of Object.entries(payloadClientTags)) {
|
|
77
|
+
const existing = mergedClientTags[key];
|
|
78
|
+
mergedClientTags[key] = existing ? [...value, ...existing] : value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The leads API requires device IDs be in the UUID format. If the string
|
|
83
|
+
* we receive here is not in the expected format, we omit it so the API can
|
|
84
|
+
* reject the request explicitly.
|
|
85
|
+
*/
|
|
86
|
+
return {
|
|
72
87
|
deviceId: isUUIDv4(maybeDeviceId) ? maybeDeviceId : undefined,
|
|
73
|
-
sessionInformation: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
clientTags: mapValues(
|
|
78
|
-
clientTags,
|
|
79
|
-
// all values must be arrays of strings
|
|
80
|
-
(value) => (Array.isArray(value) ? value.map(String) : [String(value)])
|
|
81
|
-
),
|
|
82
|
-
});
|
|
88
|
+
sessionInformation: { ipAddress, userAgent },
|
|
89
|
+
...payload,
|
|
90
|
+
clientTags: mergedClientTags,
|
|
91
|
+
};
|
|
83
92
|
}
|