@npm_leadtech/legal-lib-components 7.63.11 → 7.65.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 (83) hide show
  1. package/dist/css/styles.css +0 -18
  2. package/dist/src/components/atoms/FeatureItem/FeatureItem.d.ts +3 -0
  3. package/dist/src/components/atoms/FeatureItem/FeatureItem.js +5 -0
  4. package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.d.ts +1 -0
  5. package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.js +18 -0
  6. package/dist/src/components/atoms/FeatureItem/FeatureItem.styled.ts +19 -0
  7. package/dist/src/components/atoms/FeatureItem/FeatureItem.tsx +12 -0
  8. package/dist/src/components/atoms/FeatureItem/FeatureItemProps.d.ts +9 -0
  9. package/dist/src/components/atoms/FeatureItem/FeatureItemProps.js +1 -0
  10. package/dist/src/components/atoms/FeatureItem/FeatureItemProps.ts +10 -0
  11. package/dist/src/components/atoms/FeatureItem/index.d.ts +2 -0
  12. package/dist/src/components/atoms/FeatureItem/index.js +2 -0
  13. package/dist/src/components/atoms/FeatureItem/index.ts +2 -0
  14. package/dist/src/components/atoms/Logo/Logo.js +4 -2
  15. package/dist/src/components/atoms/Logo/Logo.tsx +4 -2
  16. package/dist/src/components/atoms/Logo/svg/legalfinity-logo.svg +15 -0
  17. package/dist/src/components/atoms/Logo/svg/legalfinity-white-logo.svg +15 -0
  18. package/dist/src/components/atoms/PlanCard/PlanCard.d.ts +3 -0
  19. package/dist/src/components/atoms/PlanCard/PlanCard.js +6 -0
  20. package/dist/src/components/atoms/PlanCard/PlanCard.styled.d.ts +8 -0
  21. package/dist/src/components/atoms/PlanCard/PlanCard.styled.js +75 -0
  22. package/dist/src/components/atoms/PlanCard/PlanCard.styled.ts +83 -0
  23. package/dist/src/components/atoms/PlanCard/PlanCard.tsx +42 -0
  24. package/dist/src/components/atoms/PlanCard/PlanCardProps.d.ts +23 -0
  25. package/dist/src/components/atoms/PlanCard/PlanCardProps.js +1 -0
  26. package/dist/src/components/atoms/PlanCard/PlanCardProps.ts +26 -0
  27. package/dist/src/components/atoms/PlanCard/index.d.ts +2 -0
  28. package/dist/src/components/atoms/PlanCard/index.js +2 -0
  29. package/dist/src/components/atoms/PlanCard/index.ts +2 -0
  30. package/dist/src/components/atoms/index.d.ts +2 -0
  31. package/dist/src/components/atoms/index.js +2 -0
  32. package/dist/src/components/atoms/index.ts +2 -0
  33. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.d.ts +3 -0
  34. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.js +5 -0
  35. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.d.ts +3 -0
  36. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.js +69 -0
  37. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.styled.ts +72 -0
  38. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBar.tsx +23 -0
  39. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.d.ts +6 -0
  40. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.js +1 -0
  41. package/dist/src/components/molecules/StickyPlanBar/StickyPlanBarProps.ts +7 -0
  42. package/dist/src/components/molecules/StickyPlanBar/index.d.ts +2 -0
  43. package/dist/src/components/molecules/StickyPlanBar/index.js +2 -0
  44. package/dist/src/components/molecules/StickyPlanBar/index.ts +2 -0
  45. package/dist/src/components/molecules/index.d.ts +1 -0
  46. package/dist/src/components/molecules/index.js +1 -0
  47. package/dist/src/components/molecules/index.ts +1 -0
  48. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.d.ts +3 -0
  49. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.js +7 -0
  50. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.d.ts +3 -0
  51. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.js +35 -0
  52. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.styled.tsx +38 -0
  53. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeader.tsx +21 -0
  54. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.d.ts +4 -0
  55. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.js +1 -0
  56. package/dist/src/components/organisms/PricingPageHeader/PricingPageHeaderProps.ts +4 -0
  57. package/dist/src/components/organisms/PricingPageHeader/index.d.ts +2 -0
  58. package/dist/src/components/organisms/PricingPageHeader/index.js +2 -0
  59. package/dist/src/components/organisms/PricingPageHeader/index.ts +2 -0
  60. package/dist/src/components/organisms/index.d.ts +1 -0
  61. package/dist/src/components/organisms/index.js +1 -0
  62. package/dist/src/components/organisms/index.ts +1 -0
  63. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.d.ts +3 -0
  64. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.js +58 -0
  65. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.d.ts +16 -0
  66. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.js +88 -0
  67. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.styled.ts +107 -0
  68. package/dist/src/components/pages/PricingPlansPage/PricingPlansPage.tsx +128 -0
  69. package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.d.ts +9 -0
  70. package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.js +1 -0
  71. package/dist/src/components/pages/PricingPlansPage/PricingPlansPageProps.ts +10 -0
  72. package/dist/src/components/pages/PricingPlansPage/index.d.ts +2 -0
  73. package/dist/src/components/pages/PricingPlansPage/index.js +2 -0
  74. package/dist/src/components/pages/PricingPlansPage/index.ts +2 -0
  75. package/dist/src/components/pages/index.d.ts +1 -0
  76. package/dist/src/components/pages/index.js +1 -0
  77. package/dist/src/components/pages/index.ts +1 -0
  78. package/dist/src/globalStyles/themes.scss +0 -27
  79. package/dist/src/utils/throttle.d.ts +1 -0
  80. package/dist/src/utils/throttle.js +10 -0
  81. package/dist/src/utils/throttle.ts +11 -0
  82. package/dist/tsconfig.build.tsbuildinfo +1 -1
  83. package/package.json +2 -1
@@ -0,0 +1,128 @@
1
+ import { FeatureItem, PlanCard } from '../../atoms'
2
+ import {
3
+ FeaturesGrid,
4
+ FeaturesSection,
5
+ PlanSelector,
6
+ PlanWrapper,
7
+ PlansWrapper,
8
+ PricingContainerStyled,
9
+ SelectorButton
10
+ } from './PricingPlansPage.styled'
11
+ import { PricingPageHeader } from '../../organisms'
12
+ import { PricingPlansPageProps } from './PricingPlansPageProps'
13
+ import React from 'react'
14
+ import { StickyPlanBar } from '../../molecules/StickyPlanBar'
15
+ import { throttle } from '../../../utils/throttle'
16
+
17
+ export const PricingPlansPage: React.FC<PricingPlansPageProps> = ({
18
+ subscriptionPlans,
19
+ features,
20
+ onPlanSelect,
21
+ headerDivider,
22
+ siteName = 'Legalfinity',
23
+ phoneNumber
24
+ }) => {
25
+ const [activePlanIndex, setActivePlanIndex] = React.useState(0)
26
+ const plansWrapperRef = React.useRef<HTMLDivElement | null>(null)
27
+ const lastScrollYRef = React.useRef(0)
28
+ const [showStickyBar, setShowStickyBar] = React.useState(false)
29
+
30
+ const activePlan = subscriptionPlans[activePlanIndex]
31
+
32
+ React.useEffect(() => {
33
+ const handleScroll = () => {
34
+ if (!plansWrapperRef.current) return
35
+
36
+ const currentScrollY = window.scrollY
37
+ const isMobile = window.innerWidth < 720
38
+
39
+ if (!isMobile) {
40
+ if (showStickyBar) {
41
+ setShowStickyBar(false)
42
+ }
43
+ return
44
+ }
45
+
46
+ const isScrollingUp = currentScrollY < lastScrollYRef.current - 10 ? 'up' : null
47
+
48
+ const scrollDirection = currentScrollY > lastScrollYRef.current + 10 ? 'down' : isScrollingUp
49
+ if (!scrollDirection) return
50
+
51
+ const targetRect = plansWrapperRef.current.getBoundingClientRect()
52
+ const isPastWrapper = targetRect.bottom < 400
53
+
54
+ if (scrollDirection === 'down' && isPastWrapper) {
55
+ if (!showStickyBar) {
56
+ setShowStickyBar(true)
57
+ }
58
+ } else if (scrollDirection === 'up' || !isPastWrapper) {
59
+ if (showStickyBar && !isPastWrapper) {
60
+ setShowStickyBar(false)
61
+ }
62
+ }
63
+
64
+ lastScrollYRef.current = currentScrollY
65
+ }
66
+
67
+ const handleResize = () => {
68
+ if (window.innerWidth >= 720) {
69
+ setShowStickyBar(false)
70
+ }
71
+ }
72
+
73
+ const throttledHandleScroll = throttle(handleScroll, 100)
74
+
75
+ window.addEventListener('scroll', throttledHandleScroll)
76
+ window.addEventListener('resize', handleResize)
77
+
78
+ return () => {
79
+ window.removeEventListener('scroll', throttledHandleScroll)
80
+ window.removeEventListener('resize', handleResize)
81
+ }
82
+ }, [showStickyBar])
83
+
84
+ return (
85
+ <>
86
+ <PricingPageHeader siteName={siteName} phoneNumber={phoneNumber} />
87
+ {headerDivider}
88
+ {subscriptionPlans?.length > 0 && (
89
+ <PricingContainerStyled>
90
+ <PlanSelector>
91
+ {subscriptionPlans.map((plan, index) => (
92
+ <SelectorButton
93
+ key={`selector-${plan?.pricingLabel}`}
94
+ isActive={index === activePlanIndex}
95
+ onClick={() => setActivePlanIndex(index)}
96
+ dataQa={`selector-${plan.subscription_type?.name.replaceAll(' ', '')}`}
97
+ >
98
+ {plan?.subscription_type?.name}
99
+ </SelectorButton>
100
+ ))}
101
+ </PlanSelector>
102
+ <PlansWrapper ref={plansWrapperRef}>
103
+ {subscriptionPlans.map((plan, index) => (
104
+ <PlanWrapper
105
+ key={plan.pricingLabel}
106
+ isHighlighted={plan.highlightPlan}
107
+ isActive={index === activePlanIndex}
108
+ className={`pricing-plan__element-container ${plan?.highlightPlan ? 'highlight' : ''} ${index === activePlanIndex ? 'active' : ''}`}
109
+ >
110
+ <PlanCard onSelect={onPlanSelect ?? (() => {})} plan={plan} />
111
+ </PlanWrapper>
112
+ ))}
113
+ </PlansWrapper>
114
+ {features && features.length > 0 && (
115
+ <FeaturesSection>
116
+ <FeaturesGrid>
117
+ {features.map((feature) => (
118
+ <FeatureItem feature={feature} key={feature.description} />
119
+ ))}
120
+ </FeaturesGrid>
121
+ </FeaturesSection>
122
+ )}
123
+ <StickyPlanBar activePlan={activePlan} showStickyBar={showStickyBar} onPlanSelect={onPlanSelect} />
124
+ </PricingContainerStyled>
125
+ )}
126
+ </>
127
+ )
128
+ }
@@ -0,0 +1,9 @@
1
+ import { FeatureItemProp, SubscriptionPlan } from '../../atoms';
2
+ export interface PricingPlansPageProps {
3
+ subscriptionPlans: SubscriptionPlan[];
4
+ features?: FeatureItemProp[];
5
+ onPlanSelect?: (sku: string) => void;
6
+ headerDivider?: React.ReactNode;
7
+ siteName?: string;
8
+ phoneNumber?: string;
9
+ }
@@ -0,0 +1,10 @@
1
+ import { FeatureItemProp, SubscriptionPlan } from '../../atoms'
2
+
3
+ export interface PricingPlansPageProps {
4
+ subscriptionPlans: SubscriptionPlan[]
5
+ features?: FeatureItemProp[]
6
+ onPlanSelect?: (sku: string) => void
7
+ headerDivider?: React.ReactNode
8
+ siteName?: string
9
+ phoneNumber?: string
10
+ }
@@ -0,0 +1,2 @@
1
+ export * from './PricingPlansPage';
2
+ export * from './PricingPlansPageProps';
@@ -0,0 +1,2 @@
1
+ export * from './PricingPlansPage';
2
+ export * from './PricingPlansPageProps';
@@ -0,0 +1,2 @@
1
+ export * from './PricingPlansPage'
2
+ export * from './PricingPlansPageProps'
@@ -12,3 +12,4 @@ export * from './RatafiaResultPage';
12
12
  export * from './UnsubscribePage';
13
13
  export * from './LoginRatafiaPage';
14
14
  export * from './PricingPage';
15
+ export * from './PricingPlansPage';
@@ -12,3 +12,4 @@ export * from './RatafiaResultPage';
12
12
  export * from './UnsubscribePage';
13
13
  export * from './LoginRatafiaPage';
14
14
  export * from './PricingPage';
15
+ export * from './PricingPlansPage';
@@ -12,3 +12,4 @@ export * from './RatafiaResultPage'
12
12
  export * from './UnsubscribePage'
13
13
  export * from './LoginRatafiaPage'
14
14
  export * from './PricingPage'
15
+ export * from './PricingPlansPage'
@@ -52,9 +52,6 @@ html {
52
52
  --others-white: #fff;
53
53
  --others-disabled: #6b7280;
54
54
  --others-black: #000;
55
-
56
- --font-sans: 'Inter', sans-serif;
57
- --font-serif: 'Lora', serif;
58
55
  }
59
56
 
60
57
  html[data-theme='districtlaws'] {
@@ -89,9 +86,6 @@ html[data-theme='districtlaws'] {
89
86
  --others-white: #fff;
90
87
  --others-disabled: #6b7280;
91
88
  --others-black: #000;
92
-
93
- --font-sans: 'Inter', sans-serif;
94
- --font-serif: 'Lora', serif;
95
89
  }
96
90
 
97
91
  html[data-theme='lawdistricts'] {
@@ -126,9 +120,6 @@ html[data-theme='lawdistricts'] {
126
120
  --others-white: #fff;
127
121
  --others-disabled: #6b7280;
128
122
  --others-black: #000;
129
-
130
- --font-sans: 'Inter', sans-serif;
131
- --font-serif: 'Lora', serif;
132
123
  }
133
124
 
134
125
  html[data-theme='lawdistrict'] {
@@ -163,9 +154,6 @@ html[data-theme='lawdistrict'] {
163
154
  --others-white: #fff;
164
155
  --others-disabled: #6b7280;
165
156
  --others-black: #000;
166
-
167
- --font-sans: 'Inter', sans-serif;
168
- --font-serif: 'Lora', serif;
169
157
  }
170
158
 
171
159
  html[data-theme='lawdistrict'] {
@@ -226,9 +214,6 @@ html[data-theme='lawsdistrict'] {
226
214
  --others-white: #fff;
227
215
  --others-disabled: #6b7280;
228
216
  --others-black: #000;
229
-
230
- --font-sans: 'Inter', sans-serif;
231
- --font-serif: 'Lora', serif;
232
217
  }
233
218
 
234
219
  html[data-theme='lawdistrictinfo'] {
@@ -263,9 +248,6 @@ html[data-theme='lawdistrictinfo'] {
263
248
  --others-white: #fff;
264
249
  --others-disabled: #6b7280;
265
250
  --others-black: #000;
266
-
267
- --font-sans: 'Inter', sans-serif;
268
- --font-serif: 'Lora', serif;
269
251
  }
270
252
 
271
253
  html[data-theme='uslawdistrict'] {
@@ -300,9 +282,6 @@ html[data-theme='uslawdistrict'] {
300
282
  --others-white: #fff;
301
283
  --others-disabled: #6b7280;
302
284
  --others-black: #000;
303
-
304
- --font-sans: 'Inter', sans-serif;
305
- --font-serif: 'Lora', serif;
306
285
  }
307
286
 
308
287
  html[data-theme='lawdistrictonline'] {
@@ -337,9 +316,6 @@ html[data-theme='lawdistrictonline'] {
337
316
  --others-white: #fff;
338
317
  --others-disabled: #6b7280;
339
318
  --others-black: #000;
340
-
341
- --font-sans: 'Inter', sans-serif;
342
- --font-serif: 'Lora', serif;
343
319
  }
344
320
 
345
321
  html[data-theme='legalfinity'] {
@@ -392,7 +368,4 @@ html[data-theme='legalfinity'] {
392
368
  --others-white: #ffffff;
393
369
  --others-disabled: #6b7280;
394
370
  --others-black: #000;
395
-
396
- --font-sans: 'Poppins', sans-serif;
397
- --font-serif: 'Poppins', sans-serif;
398
371
  }
@@ -0,0 +1 @@
1
+ export declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, limit: number): (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
@@ -0,0 +1,10 @@
1
+ export function throttle(func, limit) {
2
+ let inThrottle;
3
+ return function (...args) {
4
+ if (!inThrottle) {
5
+ func.apply(this, args);
6
+ inThrottle = true;
7
+ setTimeout(() => (inThrottle = false), limit);
8
+ }
9
+ };
10
+ }
@@ -0,0 +1,11 @@
1
+ export function throttle<T extends (...args: unknown[]) => unknown>(func: T, limit: number) {
2
+ let inThrottle: boolean | undefined
3
+
4
+ return function (this: ThisParameterType<T>, ...args: Parameters<T>): void {
5
+ if (!inThrottle) {
6
+ func.apply(this, args)
7
+ inThrottle = true
8
+ setTimeout(() => (inThrottle = false), limit)
9
+ }
10
+ }
11
+ }