@moneylion/react-native-offer-carousel 1.10.1 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/commonjs/capabilities/configuration/src/brands/checkVisualEligibility.js +13 -11
  3. package/lib/commonjs/capabilities/configuration/src/brands/checkVisualEligibility.js.map +1 -1
  4. package/lib/commonjs/capabilities/configuration/src/brands/createDerivedBrands.js +8 -19
  5. package/lib/commonjs/capabilities/configuration/src/brands/createDerivedBrands.js.map +1 -1
  6. package/lib/commonjs/capabilities/offer-catalog/src/utils/formatUtils.js +36 -21
  7. package/lib/commonjs/capabilities/offer-catalog/src/utils/formatUtils.js.map +1 -1
  8. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js +7 -30
  9. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js.map +1 -1
  10. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js +15 -17
  11. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js.map +1 -1
  12. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js +8 -2
  13. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js.map +1 -1
  14. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/index.js +40 -38
  15. package/lib/commonjs/capabilities/offer-catalog/src/utils/stats/index.js.map +1 -1
  16. package/lib/commonjs/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js +22 -12
  17. package/lib/commonjs/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js.map +1 -1
  18. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js +120 -116
  19. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
  20. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/index.js +8 -30
  21. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/index.js.map +1 -1
  22. package/lib/commonjs/components/DynamicOffers/Render/Offer.js +51 -49
  23. package/lib/commonjs/components/DynamicOffers/Render/Offer.js.map +1 -1
  24. package/lib/commonjs/version.js +1 -1
  25. package/lib/module/capabilities/configuration/src/brands/checkVisualEligibility.js +13 -11
  26. package/lib/module/capabilities/configuration/src/brands/checkVisualEligibility.js.map +1 -1
  27. package/lib/module/capabilities/configuration/src/brands/createDerivedBrands.js +7 -19
  28. package/lib/module/capabilities/configuration/src/brands/createDerivedBrands.js.map +1 -1
  29. package/lib/module/capabilities/offer-catalog/src/utils/formatUtils.js +35 -20
  30. package/lib/module/capabilities/offer-catalog/src/utils/formatUtils.js.map +1 -1
  31. package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js +7 -30
  32. package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.js.map +1 -1
  33. package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js +15 -17
  34. package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.js.map +1 -1
  35. package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js +8 -2
  36. package/lib/module/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.js.map +1 -1
  37. package/lib/module/capabilities/offer-catalog/src/utils/stats/index.js +40 -38
  38. package/lib/module/capabilities/offer-catalog/src/utils/stats/index.js.map +1 -1
  39. package/lib/module/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js +22 -11
  40. package/lib/module/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.js.map +1 -1
  41. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js +120 -115
  42. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
  43. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/index.js +9 -31
  44. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/index.js.map +1 -1
  45. package/lib/module/components/DynamicOffers/Render/Offer.js +51 -49
  46. package/lib/module/components/DynamicOffers/Render/Offer.js.map +1 -1
  47. package/lib/module/version.js +1 -1
  48. package/lib/typescript/capabilities/configuration/src/brands/checkVisualEligibility.d.ts.map +1 -1
  49. package/lib/typescript/capabilities/configuration/src/brands/createDerivedBrands.d.ts.map +1 -1
  50. package/lib/typescript/capabilities/offer-catalog/src/utils/formatUtils.d.ts.map +1 -1
  51. package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.d.ts.map +1 -1
  52. package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.d.ts.map +1 -1
  53. package/lib/typescript/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.d.ts.map +1 -1
  54. package/lib/typescript/capabilities/offer-catalog/src/utils/stats/index.d.ts.map +1 -1
  55. package/lib/typescript/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.d.ts +4 -192
  56. package/lib/typescript/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.d.ts.map +1 -1
  57. package/lib/typescript/capabilities/ui/elements/src/components/MarkdownText/components.d.ts +12 -3
  58. package/lib/typescript/capabilities/ui/elements/src/components/MarkdownText/components.d.ts.map +1 -1
  59. package/lib/typescript/capabilities/ui/elements/src/components/MarkdownText/index.d.ts.map +1 -1
  60. package/lib/typescript/components/DynamicOffers/Render/Offer.d.ts.map +1 -1
  61. package/lib/typescript/version.d.ts +1 -1
  62. package/package.json +3 -8
  63. package/src/capabilities/configuration/src/brands/checkVisualEligibility.ts +22 -16
  64. package/src/capabilities/configuration/src/brands/createDerivedBrands.ts +10 -23
  65. package/src/capabilities/offer-catalog/src/utils/formatUtils.ts +38 -19
  66. package/src/capabilities/offer-catalog/src/utils/stats/formatters/annualFee.ts +19 -46
  67. package/src/capabilities/offer-catalog/src/utils/stats/formatters/purchaseApr.ts +17 -21
  68. package/src/capabilities/offer-catalog/src/utils/stats/formatters/recommendedCredit.ts +11 -8
  69. package/src/capabilities/offer-catalog/src/utils/stats/index.ts +40 -109
  70. package/src/capabilities/offers/pipeline/src/sources/ratetables/withDeviceSignals.ts +26 -17
  71. package/src/capabilities/ui/elements/src/components/MarkdownText/components.tsx +157 -142
  72. package/src/capabilities/ui/elements/src/components/MarkdownText/index.tsx +11 -33
  73. package/src/components/DynamicOffers/Render/Offer.tsx +34 -33
  74. package/src/version.ts +1 -1
@@ -1,7 +1,5 @@
1
1
  import React, { Fragment } from "react";
2
2
 
3
- import { match } from "ts-pattern";
4
-
5
3
  import type { ProductTypeBuilder } from "../../../builder";
6
4
  import {
7
5
  DefaultOfferCard,
@@ -58,63 +56,66 @@ export const Offer = ({
58
56
  return <></>;
59
57
  }
60
58
 
61
- return (
62
- <Fragment key={`${offerIndex}-${offer.uuid}`}>
63
- {match(builder)
64
- .with({ layout: "defaultOfferCard" }, (layout) => (
59
+ const renderCard = () => {
60
+ if (!builder) {
61
+ if (!fallbackTemplate) return <></>;
62
+ const FallbackTemplate = fallbackTemplate;
63
+ return (
64
+ <FallbackTemplate
65
+ showCardBorder={showCardBorder}
66
+ offerIndex={offerIndex}
67
+ key={`${offerIndex}-${offer.uuid}`}
68
+ offer={offer}
69
+ showProductTypeLabel={showProductTypeLabel}
70
+ fullCardWidth={fullCardWidth}
71
+ isHorizontalScroll={isHorizontalScroll}
72
+ />
73
+ );
74
+ }
75
+ switch (builder.layout) {
76
+ case "defaultOfferCard":
77
+ return (
65
78
  <DefaultOfferCard
66
79
  offerIndex={offerIndex}
67
80
  key={`${offerIndex}-${offer.uuid}`}
68
81
  offer={offer}
69
- productTypeBuilder={layout}
82
+ productTypeBuilder={builder}
70
83
  showCardBorder={showCardBorder}
71
84
  showProductTypeLabel={showProductTypeLabel}
72
85
  fullCardWidth={fullCardWidth}
73
86
  isHorizontalScroll={isHorizontalScroll}
74
87
  />
75
- ))
76
- .with({ layout: "creditCardOfferCard" }, (layout) => (
88
+ );
89
+ case "creditCardOfferCard":
90
+ return (
77
91
  <CreditCardOfferCard
78
92
  offerIndex={offerIndex}
79
93
  key={`${offerIndex}-${offer.uuid}`}
80
94
  offer={offer}
81
- productTypeBuilder={layout}
95
+ productTypeBuilder={builder}
82
96
  showCardBorder={showCardBorder}
83
97
  showProductTypeLabel={showProductTypeLabel}
84
98
  fullCardWidth={fullCardWidth}
85
99
  isHorizontalScroll={isHorizontalScroll}
86
100
  />
87
- ))
88
- .with({ layout: "headlineWithDescriptionCard" }, (layout) => (
101
+ );
102
+ case "headlineWithDescriptionCard":
103
+ return (
89
104
  <HeadlineWithDescriptionCard
90
105
  offerIndex={offerIndex}
91
106
  key={`${offerIndex}-${offer.uuid}`}
92
107
  offer={offer}
93
- productTypeBuilder={layout}
108
+ productTypeBuilder={builder}
94
109
  showCardBorder={showCardBorder}
95
110
  showProductTypeLabel={showProductTypeLabel}
96
111
  fullCardWidth={fullCardWidth}
97
112
  isHorizontalScroll={isHorizontalScroll}
98
113
  />
99
- ))
100
- .with(undefined, () => {
101
- if (!fallbackTemplate) {
102
- return <></>;
103
- }
104
- const FallbackTemplate = fallbackTemplate;
105
- return (
106
- <FallbackTemplate
107
- showCardBorder={showCardBorder}
108
- offerIndex={offerIndex}
109
- key={`${offerIndex}-${offer.uuid}`}
110
- offer={offer}
111
- showProductTypeLabel={showProductTypeLabel}
112
- fullCardWidth={fullCardWidth}
113
- isHorizontalScroll={isHorizontalScroll}
114
- />
115
- );
116
- })
117
- .exhaustive()}
118
- </Fragment>
114
+ );
115
+ }
116
+ };
117
+
118
+ return (
119
+ <Fragment key={`${offerIndex}-${offer.uuid}`}>{renderCard()}</Fragment>
119
120
  );
120
121
  });
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Version is kept in sync with package.json via the sync-version script
2
- export const VERSION = "1.10.1";
2
+ export const VERSION = "1.11.0";