@moneylion/react-native-offer-carousel 1.0.6 → 1.0.8

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 (122) hide show
  1. package/lib/commonjs/capabilities/core/src/system/cnfContext/schemas/Brand.js +45 -9
  2. package/lib/commonjs/capabilities/core/src/system/cnfContext/schemas/Brand.js.map +1 -1
  3. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js +2 -2
  4. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
  5. package/lib/commonjs/components/Button/index.js +4 -21
  6. package/lib/commonjs/components/Button/index.js.map +1 -1
  7. package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js +4 -4
  8. package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
  9. package/lib/commonjs/components/Common/BaseOfferCard/index.js +12 -11
  10. package/lib/commonjs/components/Common/BaseOfferCard/index.js.map +1 -1
  11. package/lib/commonjs/components/Common/DynamicOfferCard/CallToAction.js +2 -0
  12. package/lib/commonjs/components/Common/DynamicOfferCard/CallToAction.js.map +1 -1
  13. package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js +1 -1
  14. package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
  15. package/lib/commonjs/components/Common/DynamicOfferCard/index.js +1 -0
  16. package/lib/commonjs/components/Common/DynamicOfferCard/index.js.map +1 -1
  17. package/lib/commonjs/components/Layouts/CreditCardOfferCard/index.js +2 -1
  18. package/lib/commonjs/components/Layouts/CreditCardOfferCard/index.js.map +1 -1
  19. package/lib/commonjs/components/Modal/DescriptionPoints.js +2 -2
  20. package/lib/commonjs/components/Modal/DescriptionPoints.js.map +1 -1
  21. package/lib/commonjs/components/Modal/Disclaimer.js +2 -2
  22. package/lib/commonjs/components/Modal/Disclaimer.js.map +1 -1
  23. package/lib/commonjs/components/Modal/OfferDetailsModal.js +6 -2
  24. package/lib/commonjs/components/Modal/OfferDetailsModal.js.map +1 -1
  25. package/lib/commonjs/components/MoneyLionOfferCarousel.js +12 -14
  26. package/lib/commonjs/components/MoneyLionOfferCarousel.js.map +1 -1
  27. package/lib/commonjs/components/Text/index.js +18 -38
  28. package/lib/commonjs/components/Text/index.js.map +1 -1
  29. package/lib/commonjs/components/View/index.js +10 -94
  30. package/lib/commonjs/components/View/index.js.map +1 -1
  31. package/lib/commonjs/config/mocks/cnfContext.js +44 -8
  32. package/lib/commonjs/config/mocks/cnfContext.js.map +1 -1
  33. package/lib/commonjs/context/ThemeProvider.js +2 -2
  34. package/lib/commonjs/context/ThemeProvider.js.map +1 -1
  35. package/lib/commonjs/services/getDynamicOffers.js +7 -2
  36. package/lib/commonjs/services/getDynamicOffers.js.map +1 -1
  37. package/lib/module/capabilities/core/src/system/cnfContext/schemas/Brand.js +45 -9
  38. package/lib/module/capabilities/core/src/system/cnfContext/schemas/Brand.js.map +1 -1
  39. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js +2 -3
  40. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
  41. package/lib/module/components/Button/index.js +4 -21
  42. package/lib/module/components/Button/index.js.map +1 -1
  43. package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js +4 -4
  44. package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
  45. package/lib/module/components/Common/BaseOfferCard/index.js +12 -11
  46. package/lib/module/components/Common/BaseOfferCard/index.js.map +1 -1
  47. package/lib/module/components/Common/DynamicOfferCard/CallToAction.js +2 -0
  48. package/lib/module/components/Common/DynamicOfferCard/CallToAction.js.map +1 -1
  49. package/lib/module/components/Common/DynamicOfferCard/SeeMore.js +1 -1
  50. package/lib/module/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
  51. package/lib/module/components/Common/DynamicOfferCard/index.js +1 -0
  52. package/lib/module/components/Common/DynamicOfferCard/index.js.map +1 -1
  53. package/lib/module/components/Layouts/CreditCardOfferCard/index.js +2 -1
  54. package/lib/module/components/Layouts/CreditCardOfferCard/index.js.map +1 -1
  55. package/lib/module/components/Modal/DescriptionPoints.js +2 -2
  56. package/lib/module/components/Modal/DescriptionPoints.js.map +1 -1
  57. package/lib/module/components/Modal/Disclaimer.js +2 -2
  58. package/lib/module/components/Modal/Disclaimer.js.map +1 -1
  59. package/lib/module/components/Modal/OfferDetailsModal.js +6 -2
  60. package/lib/module/components/Modal/OfferDetailsModal.js.map +1 -1
  61. package/lib/module/components/MoneyLionOfferCarousel.js +12 -14
  62. package/lib/module/components/MoneyLionOfferCarousel.js.map +1 -1
  63. package/lib/module/components/Text/index.js +17 -38
  64. package/lib/module/components/Text/index.js.map +1 -1
  65. package/lib/module/components/View/index.js +11 -95
  66. package/lib/module/components/View/index.js.map +1 -1
  67. package/lib/module/config/mocks/cnfContext.js +44 -8
  68. package/lib/module/config/mocks/cnfContext.js.map +1 -1
  69. package/lib/module/context/ThemeProvider.js +2 -2
  70. package/lib/module/context/ThemeProvider.js.map +1 -1
  71. package/lib/module/services/getDynamicOffers.js +7 -2
  72. package/lib/module/services/getDynamicOffers.js.map +1 -1
  73. package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Brand.d.ts +90 -18
  74. package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Brand.d.ts.map +1 -1
  75. package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/components.d.ts +3 -2
  76. package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/components.d.ts.map +1 -1
  77. package/lib/typescript/src/components/Button/index.d.ts +3 -3
  78. package/lib/typescript/src/components/Button/index.d.ts.map +1 -1
  79. package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts +2 -2
  80. package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts.map +1 -1
  81. package/lib/typescript/src/components/Common/DynamicOfferCard/CallToAction.d.ts +1 -1
  82. package/lib/typescript/src/components/Common/DynamicOfferCard/CallToAction.d.ts.map +1 -1
  83. package/lib/typescript/src/components/Common/DynamicOfferCard/index.d.ts.map +1 -1
  84. package/lib/typescript/src/components/Layouts/CreditCardOfferCard/index.d.ts.map +1 -1
  85. package/lib/typescript/src/components/Modal/Disclaimer.d.ts.map +1 -1
  86. package/lib/typescript/src/components/Modal/OfferDetailsModal.d.ts.map +1 -1
  87. package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts +1 -0
  88. package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +1 -1
  89. package/lib/typescript/src/components/Text/index.d.ts +2 -2
  90. package/lib/typescript/src/components/Text/index.d.ts.map +1 -1
  91. package/lib/typescript/src/components/View/index.d.ts +4 -2
  92. package/lib/typescript/src/components/View/index.d.ts.map +1 -1
  93. package/lib/typescript/src/config/mocks/cnfContext.d.ts.map +1 -1
  94. package/lib/typescript/src/context/ThemeProvider.d.ts +47 -11
  95. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  96. package/lib/typescript/src/services/getDynamicOffers.d.ts.map +1 -1
  97. package/package.json +1 -1
  98. package/src/capabilities/core/src/system/cnfContext/schemas/Brand.ts +46 -10
  99. package/src/capabilities/ui/elements/src/components/MarkdownText/components.tsx +4 -4
  100. package/src/components/Button/index.tsx +7 -20
  101. package/src/components/Common/BaseOfferCard/Stat/Stat.tsx +4 -4
  102. package/src/components/Common/BaseOfferCard/index.tsx +32 -13
  103. package/src/components/Common/DynamicOfferCard/CallToAction.tsx +2 -0
  104. package/src/components/Common/DynamicOfferCard/SeeMore.tsx +1 -1
  105. package/src/components/Common/DynamicOfferCard/index.tsx +1 -0
  106. package/src/components/Layouts/CreditCardOfferCard/index.tsx +2 -1
  107. package/src/components/Modal/DescriptionPoints.tsx +2 -2
  108. package/src/components/Modal/Disclaimer.tsx +6 -2
  109. package/src/components/Modal/OfferDetailsModal.tsx +11 -6
  110. package/src/components/MoneyLionOfferCarousel.tsx +16 -11
  111. package/src/components/Text/index.tsx +10 -45
  112. package/src/components/View/index.tsx +13 -66
  113. package/src/config/mocks/cnfContext.ts +44 -8
  114. package/src/context/ThemeProvider.tsx +51 -14
  115. package/src/services/getDynamicOffers.ts +7 -2
  116. package/lib/commonjs/utils/getDefaultPaletteColor.js +0 -20
  117. package/lib/commonjs/utils/getDefaultPaletteColor.js.map +0 -1
  118. package/lib/module/utils/getDefaultPaletteColor.js +0 -13
  119. package/lib/module/utils/getDefaultPaletteColor.js.map +0 -1
  120. package/lib/typescript/src/utils/getDefaultPaletteColor.d.ts +0 -3
  121. package/lib/typescript/src/utils/getDefaultPaletteColor.d.ts.map +0 -1
  122. package/src/utils/getDefaultPaletteColor.ts +0 -15
@@ -7,15 +7,52 @@ import React, {
7
7
  } from "react";
8
8
  import { Platform } from "react-native";
9
9
 
10
- export interface ThemePalette {
11
- promotional?: string;
12
- generation?: ("generate" | "provided") | null;
13
- colorScheme?: ("balanced" | "light" | "dark") | null;
14
- positive: string;
15
- critical?: string;
16
- highlight?: string;
17
- neutral?: string;
10
+ export interface ThemeColors {
11
+ backgroundPrimary: string;
12
+ backgroundPrimaryFaded: string;
13
+ backgroundPrimaryHighlighted: string;
14
+ backgroundCritical: string;
15
+ backgroundCriticalFaded: string;
16
+ backgroundCriticalHighlighted: string;
17
+ backgroundWarning: string;
18
+ backgroundWarningFaded: string;
19
+ backgroundWarningHighlighted: string;
20
+ backgroundPositive: string;
21
+ backgroundPositiveFaded: string;
22
+ backgroundPositiveHighlighted: string;
23
+ backgroundNeutral: string;
24
+ backgroundNeutralFaded: string;
25
+ backgroundNeutralHighlighted: string;
26
+ backgroundDisabled: string;
27
+ backgroundDisabledFaded: string;
28
+ backgroundElevationBase: string;
29
+ backgroundElevationRaised: string;
30
+ backgroundElevationOverlay: string;
31
+ backgroundPage: string;
32
+ backgroundPageFaded: string;
33
+ borderPrimary: string;
34
+ borderPrimaryFaded: string;
35
+ borderCritical: string;
36
+ borderCriticalFaded: string;
37
+ borderWarning: string;
38
+ borderWarningFaded: string;
39
+ borderPositive: string;
40
+ borderPositiveFaded: string;
41
+ borderNeutral: string;
42
+ borderNeutralFaded: string;
43
+ borderDisabled: string;
44
+ foregroundPrimary: string;
45
+ foregroundCritical: string;
46
+ foregroundWarning: string;
47
+ foregroundPositive: string;
48
+ foregroundNeutral: string;
49
+ foregroundNeutralFaded: string;
50
+ foregroundDisabled: string;
51
+ brand: string;
52
+ white: string;
53
+ black: string;
18
54
  }
55
+
19
56
  export interface FontFamily {
20
57
  normal?: string;
21
58
  medium?: string;
@@ -29,9 +66,9 @@ const defaultFontFamily: FontFamily = {
29
66
  };
30
67
 
31
68
  interface ThemeContextType {
32
- theme: ThemePalette;
69
+ theme: ThemeColors;
33
70
  fontFamily: FontFamily;
34
- updateTheme: (newTheme: Partial<ThemePalette>) => void;
71
+ updateTheme: (newTheme: Partial<ThemeColors>) => void;
35
72
  updateFontFamily: (newFontFamily: Partial<FontFamily>) => void;
36
73
  }
37
74
 
@@ -46,23 +83,23 @@ export const useTheme = () => {
46
83
  };
47
84
 
48
85
  interface ThemeProviderProps {
49
- palette?: ThemePalette;
86
+ themeColors?: ThemeColors;
50
87
  fontFamily?: Partial<FontFamily>;
51
88
  children: ReactNode;
52
89
  }
53
90
 
54
91
  export const ThemeProvider: FC<ThemeProviderProps> = ({
55
- palette = {} as ThemePalette, // should be safe to assert as ThemePalette since the fallback colors are already handled by the consumers of ThemeProvider
92
+ themeColors = {} as ThemeColors, // should be safe to assert as ThemePalette since the fallback colors are already handled by the consumers of ThemeProvider
56
93
  fontFamily = {},
57
94
  children,
58
95
  }) => {
59
- const [theme, setTheme] = useState<ThemePalette>(palette);
96
+ const [theme, setTheme] = useState<ThemeColors>(themeColors);
60
97
  const [fonts, setFonts] = useState<FontFamily>({
61
98
  ...defaultFontFamily,
62
99
  ...fontFamily,
63
100
  });
64
101
 
65
- const updateTheme = (newTheme: Partial<ThemePalette>) => {
102
+ const updateTheme = (newTheme: Partial<ThemeColors>) => {
66
103
  setTheme((prevTheme) => ({
67
104
  ...prevTheme,
68
105
  ...newTheme,
@@ -63,12 +63,17 @@ export const getDynamicOffers = async ({
63
63
  context,
64
64
  });
65
65
 
66
- // If no initial offers are returned, get offers for the default product type
66
+ // if no offers are returned, we need to get the offers for the default product type
67
+ if (isEmpty(initialOffersData?.offers)) {
68
+ // Set the productTypes to be defaultProductType
69
+ productTypes = [defaultProductType];
70
+ }
71
+
67
72
  // if initial offers are returned, return them
68
73
  const offersData = isEmpty(initialOffersData?.offers)
69
74
  ? await getOffersByProductTypes({
70
75
  enableUseCachedOffers,
71
- productTypes: [defaultProductType],
76
+ productTypes,
72
77
  tags,
73
78
  context,
74
79
  })
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getDefaultPaletteColor = void 0;
7
- const getDefaultPaletteColor = colorKey => {
8
- const defaultColors = {
9
- positive: "#00E5C4"
10
- // promotional: "#FFD700",
11
- // generation: "#4CAF50",
12
- // colorScheme: "#9E9E9E",
13
- // critical: "#FF0000",
14
- // highlight: "#FFA500",
15
- // neutral: "#808080",
16
- };
17
- return defaultColors[colorKey] ?? "#000000"; // subject to change
18
- };
19
- exports.getDefaultPaletteColor = getDefaultPaletteColor;
20
- //# sourceMappingURL=getDefaultPaletteColor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getDefaultPaletteColor","colorKey","defaultColors","positive","exports"],"sourceRoot":"../../../src","sources":["utils/getDefaultPaletteColor.ts"],"mappings":";;;;;;AAEO,MAAMA,sBAAsB,GAAIC,QAAgB,IAAa;EACnE,MAAMC,aAA8C,GAAG;IACtDC,QAAQ,EAAE;IACV;IACA;IACA;IACA;IACA;IACA;EACD,CAAC;EAED,OAAOD,aAAa,CAACD,QAAQ,CAAC,IAAI,SAAS,CAAC,CAAC;AAC9C,CAAC;AAACG,OAAA,CAAAJ,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- export const getDefaultPaletteColor = colorKey => {
2
- const defaultColors = {
3
- positive: "#00E5C4"
4
- // promotional: "#FFD700",
5
- // generation: "#4CAF50",
6
- // colorScheme: "#9E9E9E",
7
- // critical: "#FF0000",
8
- // highlight: "#FFA500",
9
- // neutral: "#808080",
10
- };
11
- return defaultColors[colorKey] ?? "#000000"; // subject to change
12
- };
13
- //# sourceMappingURL=getDefaultPaletteColor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getDefaultPaletteColor","colorKey","defaultColors","positive"],"sourceRoot":"../../../src","sources":["utils/getDefaultPaletteColor.ts"],"mappings":"AAEA,OAAO,MAAMA,sBAAsB,GAAIC,QAAgB,IAAa;EACnE,MAAMC,aAA8C,GAAG;IACtDC,QAAQ,EAAE;IACV;IACA;IACA;IACA;IACA;IACA;EACD,CAAC;EAED,OAAOD,aAAa,CAACD,QAAQ,CAAC,IAAI,SAAS,CAAC,CAAC;AAC9C,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import type { Colors } from "../components/Button";
2
- export declare const getDefaultPaletteColor: (colorKey: Colors) => string;
3
- //# sourceMappingURL=getDefaultPaletteColor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDefaultPaletteColor.d.ts","sourceRoot":"","sources":["../../../../src/utils/getDefaultPaletteColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,eAAO,MAAM,sBAAsB,aAAc,MAAM,KAAG,MAYzD,CAAC"}
@@ -1,15 +0,0 @@
1
- import type { Colors } from "../components/Button";
2
-
3
- export const getDefaultPaletteColor = (colorKey: Colors): string => {
4
- const defaultColors: Partial<Record<Colors, string>> = {
5
- positive: "#00E5C4",
6
- // promotional: "#FFD700",
7
- // generation: "#4CAF50",
8
- // colorScheme: "#9E9E9E",
9
- // critical: "#FF0000",
10
- // highlight: "#FFA500",
11
- // neutral: "#808080",
12
- };
13
-
14
- return defaultColors[colorKey] ?? "#000000"; // subject to change
15
- };